From 5e08d4f61c24db589bd6d30875fcb1191f719b16 Mon Sep 17 00:00:00 2001 From: yangan <yangan0921@163.com> Date: 星期五, 11 四月 2025 20:41:44 +0800 Subject: [PATCH] feat:申请复磅 --- store/index.js | 162 ++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 120 insertions(+), 42 deletions(-) diff --git a/store/index.js b/store/index.js index 71899fe..85bcdbf 100644 --- a/store/index.js +++ b/store/index.js @@ -43,30 +43,34 @@ text: '鎴戠殑' } ], - three: [{ - pagePath: 'pages/tabbar-page/index-tabbar/index-tabbar', - iconPath: '../../static/tabBar-icon/home.png', - selectedIconPath: '../../static/tabBar-icon/homeblue.png', - text: '棣栭〉' - }, + three: [ + // { + // pagePath: 'pages/tabbar-page/index-tabbar/index-tabbar', + // iconPath: '../../static/tabBar-icon/home.png', + // selectedIconPath: '../../static/tabBar-icon/homeblue.png', + // text: '棣栭〉' + // }, { pagePath: 'pages/driver-page/driver-index/bill-of-lading-details/selectOrderPlan/selectOrderPlan', iconPath: '../../static/tabBar-icon/checking.png', selectedIconPath: '../../static/tabBar-icon/checkingblue.png', text: '楠岃川' - }, - { + },{ + pagePath: 'pages/customer-page/zhijian-bangfang/zhijian-bangfang', + iconPath: '../../static/tabBar-icon/bang.png', + selectedIconPath: '../../static/tabBar-icon/bangblue.png', + text: '纾呮埧' + },{ pagePath: 'pages/customer-page/customer-my/faYunstatistics/faYunstatistics', iconPath: '../../static/tabBar-icon/statistics.png', selectedIconPath: '../../static/tabBar-icon/statisticsactive.png', text: '缁熻' - }, - { + },{ pagePath: 'pages/tabbar-page/myPage-tabbar/myPage-tabbar', iconPath: '../../static/tabBar-icon/Gmine10.png', selectedIconPath: '../../static/tabBar-icon/Bmine57.png', text: '鎴戠殑' - } + }, ] } const store = new Vuex.Store({ @@ -108,7 +112,63 @@ reconnectTimeOut: null, // 绉伴噸绋冲畾鎬� 0/绋冲畾 1/闈炵ǔ瀹� 闈炵ǔ瀹氭�佷笉鑳界偣绉伴噸 globalWarning: false, - globalShowWeigh: [] + globalShowWeigh: [], + isFirstLogin: true, + driverTourImgList: ['https://mx.jzeg.cn:9095/appimg/image/tour/driver/sj1.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/driver/sj2.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/driver/sj3.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/driver/sj4.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/driver/sj5.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/driver/sj6.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/driver/sj7.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/driver/sj8.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/driver/sj9.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/driver/sj10.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/driver/sj11.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/driver/sj12.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/driver/sj13.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/driver/sj14.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/driver/sj15.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/driver/sj16.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/driver/sj17.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/driver/sj18.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/driver/sj19.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/driver/sj20.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/driver/sj21.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/driver/sj22.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/driver/sj23.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/driver/sj24.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/driver/sj25.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/driver/sj26.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/driver/sj27.jpg', + ], + customerTourImgList: ['https://mx.jzeg.cn:9095/appimg/image/tour/quality/quality1.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/quality/quality2.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/quality/quality3.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/quality/quality4.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/quality/quality5.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/quality/quality6.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/quality/quality7.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/quality/quality8.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/quality/quality9.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/quality/quality10.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/quality/quality11.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/quality/quality12.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/quality/quality13.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/quality/quality14.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/quality/quality15.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/quality/quality16.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/quality/quality17.jpg', + ], + qualityTourImgList:['https://mx.jzeg.cn:9095/appimg/image/tour/quality/quality1.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/quality/quality2.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/quality/quality3.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/quality/quality4.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/quality/quality5.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/quality/quality6.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/quality/quality7.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/quality/quality8.jpg', + 'https://mx.jzeg.cn:9095/appimg/image/tour/quality/quality9.jpg'] }, mutations: { lengthchange(state, payload) { @@ -120,6 +180,7 @@ // 璁剧疆搴曢儴鏍� setUserTabbar(state, roleType) { state.roleType = roleType + console.log(roleType,'roledType===') if (roleType === 1) { state.userTabbar = userRoleTabbar.first uni.setStorageSync('userTabbar', state.userTabbar) @@ -163,6 +224,9 @@ state.globalisLogin = payload console.log(state.globalisLogin, '鍏ㄥ眬鐧诲綍鐘舵�佹敼鍙樹簡') }, + changesocketTask(state, payload) { + state.socketTask = payload + }, setWebsocketData(state, data) { state.websocketData = data }, @@ -172,10 +236,14 @@ }, // 鏀瑰彉閲嶈繛娆℃暟 changereconnectNum(state, payload) { - if (state.connectNum <= 6) { - state.connectNum += payload + if (payload.isWeigh) { + state.connectNum = payload.connectNum } else { - state.connectNum = payload + if (state.connectNum < 6) { + state.connectNum += payload.connectNum + } else { + state.connectNum = payload.connectNum + } } }, // 鏀瑰彉绋冲畾鎬� @@ -184,12 +252,17 @@ }, changeglobalShowWeigh(state, payload) { state.globalShowWeigh = payload + }, + changeisFirstLogin(state, payload) { + state.isFirstLogin = payload + console.log(state.isFirstLogin, '绗竴娆$櫥褰�'); } }, actions: { websocketInit({ state, dispatch, commit }) { let wsUrl = `${webSocketUrl}?access_token=${uni.getStorageSync('token')}` - state.socketTast = uni.connectSocket({ + // let wsUrl = `${webSocketUrl}?UUID=boyingtest` + state.socketTask = uni.connectSocket({ url: wsUrl, header: { CLIENT_TOC: 'Y' }, success: res => { @@ -207,17 +280,17 @@ } }) - state.socketTast.onOpen(() => dispatch('websocketOnOpen')) - state.socketTast.onMessage(result => dispatch('websocketOnMessage', result.data)) - state.socketTast.onClose(e => dispatch('websocketOnClose', e)) - state.socketTast.onError(e => dispatch('websocketOnError', e)) + state.socketTask.onOpen(() => dispatch('websocketOnOpen')) + state.socketTask.onMessage(result => dispatch('websocketOnMessage', result.data)) + state.socketTask.onClose(e => dispatch('websocketOnClose', e)) + state.socketTask.onError(e => dispatch('websocketOnError', e)) }, websocketOnOpen({ state, commit }) { console.log('ws鎵撳紑') clearInterval(state.reconnectTimeOut) clearInterval(state.globalIntervalId) state.globalIntervalId = setInterval(() => { - state.socketTast.send({ + state.socketTask.send({ data: JSON.stringify({ type: 'ping' }), success(e) { console.log(e, '鍙戦�佸績璺虫垚鍔�') @@ -226,24 +299,24 @@ }, 30000) }, websocketOnClose({ state, commit, dispatch }, e) { - if (!state.socketTast) return + if (!state.socketTask) return console.log('ws鍏抽棴', e) - state.socketTast.close(e => { + state.socketTask.close(e => { commit('changeisconnect', false) }) clearInterval(state.globalIntervalId) clearInterval(state.reconnectTimeOut) - state.socketTast = null + state.socketTask = null commit('changereconnectState', false) - if (state.connectNum <= 6 && state.globalisLogin) { - uni.showToast({ - title: `杩炴帴澶辫触锛屾鍦ㄥ皾璇曠${state.connectNum}娆¤繛鎺, - icon: 'none' - }) - commit('changereconnectNum', 1) + if ((state.connectNum < 6 || state.connectNum.connectNum < 6) && state.globalisLogin) { + // uni.showToast({ + // title: '杩炴帴澶辫触锛屾鍦ㄥ皾璇曢噸鏂拌繛鎺�', + // icon: 'none' + // }) + commit('changereconnectNum', { connectNum: 1, isWeigh: false }) dispatch('reconnect') - } else if (state.connectNum > 6 && state.globalisLogin) { - commit('changereconnectNum', 1) + } else if (state.connectNum >= 6 && state.globalisLogin) { + commit('changereconnectNum', { connectNum: 1, isWeigh: false }) uni.showToast({ title: '缃戠粶寮傚父,璇风◢鍚庨噸璇�', icon: 'none' @@ -257,17 +330,17 @@ console.log('ws鎶ラ敊', e) clearInterval(state.globalIntervalId) clearInterval(state.reconnectTimeOut) - state.socketTast = null + state.socketTask = null commit('changereconnectState', false) - if (state.connectNum < 6 && state.globalisLogin) { - uni.showToast({ - title: `杩炴帴澶辫触锛屾鍦ㄥ皾璇曠${state.connectNum}娆¤繛鎺, - icon: 'none' - }) - commit('changereconnectNum', 1) + if (state.connectNum < 6 || state.connectNum.connectNum < 6 && state.globalisLogin) { + // uni.showToast({ + // title: '杩炴帴澶辫触锛屾鍦ㄥ皾璇曢噸鏂拌繛鎺�', + // icon: 'none' + // }) + commit('changereconnectNum', { connectNum: 1, isWeigh: false }) dispatch('reconnect') - } else if (state.connectNum >= 6 && state.globalisLogin) { - commit('changereconnectNum', 1) + } else if (state.connectNum > 6 && state.globalisLogin) { + commit('changereconnectNum', { connectNum: 1, isWeigh: false }) uni.showToast({ title: '缃戠粶寮傚父,璇风◢鍚庨噸璇�', icon: 'none' @@ -290,7 +363,12 @@ }, 5000) } } + }, + getters: { + websocketData:(state) => state.websocketData, + globalweigh:(state) => state.globalweigh, + userTabbar: (state) => state.userTabbar, } }) -export default store \ No newline at end of file +export default store -- Gitblit v1.9.1