| | |
| | | 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({ |
| | |
| | | // 设置底部栏 |
| | | setUserTabbar(state, roleType) { |
| | | state.roleType = roleType |
| | | console.log(roleType,'roledType===') |
| | | if (roleType === 1) { |
| | | state.userTabbar = userRoleTabbar.first |
| | | uni.setStorageSync('userTabbar', state.userTabbar) |
| | |
| | | }, |
| | | // 改变重连次数 |
| | | 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 |
| | | } |
| | | } |
| | | }, |
| | | // 改变稳定态 |
| | |
| | | }, |
| | | websocketOnClose({ state, commit, dispatch }, e) { |
| | | if (!state.socketTask) return |
| | | console.log('ws关闭',state.connectNum , JSON.parse( state.globalisLogin), e) |
| | | console.log('ws关闭', e) |
| | | state.socketTask.close(e => { |
| | | commit('changeisconnect', false) |
| | | }) |
| | |
| | | clearInterval(state.reconnectTimeOut) |
| | | state.socketTask = null |
| | | commit('changereconnectState', false) |
| | | if (state.connectNum <= 6 && state.globalisLogin) { |
| | | console.log('触发重连,========') |
| | | 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' |
| | |
| | | clearInterval(state.reconnectTimeOut) |
| | | 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' |
| | |
| | | }, 5000) |
| | | } |
| | | } |
| | | }, |
| | | getters: { |
| | | websocketData:(state) => state.websocketData, |
| | | globalweigh:(state) => state.globalweigh, |
| | | userTabbar: (state) => state.userTabbar, |
| | | } |
| | | }) |
| | | |
| | | export default store |
| | | export default store |