From 96db936c641b23897636ff6a15e31f8f87964342 Mon Sep 17 00:00:00 2001
From: qingyiay <2386314947@qq.com>
Date: 星期三, 11 十月 2023 13:44:05 +0800
Subject: [PATCH] 确定装卸逻辑修改 增加称重时稳定态
---
store/index.js | 153 +++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 129 insertions(+), 24 deletions(-)
diff --git a/store/index.js b/store/index.js
index dff5e8e..9e1b08f 100644
--- a/store/index.js
+++ b/store/index.js
@@ -42,13 +42,26 @@
selectedIconPath: '../../static/tabBar-icon/Bmine57.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/tabbar-page/myPage-tabbar/myPage-tabbar',
+ iconPath: '../../static/tabBar-icon/Gmine10.png',
+ selectedIconPath: '../../static/tabBar-icon/Bmine57.png',
+ text: '鎴戠殑'
+ }
]
}
const store = new Vuex.Store({
state: {
// 鐢ㄦ埗鐣岄潰鍒ゆ柗
userInfo: {},
- roleType: null, // 1瀹㈡埛锛�2璐т唬锛�3鍙告満
+ roleType: null, // 1瀹㈡埛锛�2璐т唬锛�3鍙告満 5瑁呭嵏鍛�
userTabbar: [], // 鐢ㄦ埛鎵�鍦ㄨ鑹插簳閮ㄨ彍鍗曪紝
// 绉伴噸鏃剁殑閲嶉噺
globalweigh: 0,
@@ -80,7 +93,63 @@
globalIntervalId: null,
is_open_socket: false, //閬垮厤閲嶅杩炴帴
connectNum: 1, //閲嶈繛娆℃暟,
- reconnectTimeOut: null
+ reconnectTimeOut: null,
+ // 鎵撳嵃鍑哄叆闂ㄨ瘉 涓�娆″氨鍙互鏈夋墦鍗板叆闂ㄨ瘉锛� 涓ゆ鍙互鏈夊叆闂ㄨ瘉 鍑洪棬璇� 0娆′竴寮犻兘娌℃湁
+ ablePrintInduction: false, //鍏ラ棬璇�
+ ablePrintOut: false, //鍑洪棬璇�
+ driverTourImgList: ['https://mx.jzeg.cn:9096/appimg/image/tour/driver/sj1.png',
+ 'https://mx.jzeg.cn:9096/appimg/image/tour/driver/sj2.jpg',
+ 'https://mx.jzeg.cn:9096/appimg/image/tour/driver/sj3.jpg',
+ 'https://mx.jzeg.cn:9096/appimg/image/tour/driver/sj4.jpg',
+ 'https://mx.jzeg.cn:9096/appimg/image/tour/driver/sj5.jpg',
+ 'https://mx.jzeg.cn:9096/appimg/image/tour/driver/sj6.jpg',
+ 'https://mx.jzeg.cn:9096/appimg/image/tour/driver/sj7.jpg',
+ 'https://mx.jzeg.cn:9096/appimg/image/tour/driver/sj8.jpg',
+ 'https://mx.jzeg.cn:9096/appimg/image/tour/driver/sj9.jpg',
+ 'https://mx.jzeg.cn:9096/appimg/image/tour/driver/sj10.jpg',
+ 'https://mx.jzeg.cn:9096/appimg/image/tour/driver/sj11.jpg',
+ 'https://mx.jzeg.cn:9096/appimg/image/tour/driver/sj12.jpg',
+ 'https://mx.jzeg.cn:9096/appimg/image/tour/driver/sj13.jpg',
+ 'https://mx.jzeg.cn:9096/appimg/image/tour/driver/sj14.jpg',
+ 'https://mx.jzeg.cn:9096/appimg/image/tour/driver/sj15.jpg',
+ 'https://mx.jzeg.cn:9096/appimg/image/tour/driver/sj16.jpg',
+ 'https://mx.jzeg.cn:9096/appimg/image/tour/driver/sj17.jpg',
+ 'https://mx.jzeg.cn:9096/appimg/image/tour/driver/sj18.jpg',
+ 'https://mx.jzeg.cn:9096/appimg/image/tour/driver/sj19.jpg',
+ 'https://mx.jzeg.cn:9096/appimg/image/tour/driver/sj20.jpg',
+ 'https://mx.jzeg.cn:9096/appimg/image/tour/driver/sj21.jpg',
+ 'https://mx.jzeg.cn:9096/appimg/image/tour/driver/sj22.jpg',
+ 'https://mx.jzeg.cn:9096/appimg/image/tour/driver/sj23.jpg',
+ 'https://mx.jzeg.cn:9096/appimg/image/tour/driver/sj24.jpg',
+ 'https://mx.jzeg.cn:9096/appimg/image/tour/driver/sj25.jpg',
+ 'https://mx.jzeg.cn:9096/appimg/image/tour/driver/sj26.jpg',
+ 'https://mx.jzeg.cn:9096/appimg/image/tour/driver/sj27.jpg',
+ 'https://mx.jzeg.cn:9096/appimg/image/tour/driver/sj28.jpg',
+ 'https://mx.jzeg.cn:9096/appimg/image/tour/driver/sj29.jpg',
+ 'https://mx.jzeg.cn:9096/appimg/image/tour/driver/sj30.jpg',
+ 'https://mx.jzeg.cn:9096/appimg/image/tour/driver/sj31.jpg',
+ 'https://mx.jzeg.cn:9096/appimg/image/tour/driver/sj32.jpg',
+ 'https://mx.jzeg.cn:9096/appimg/image/tour/driver/sj33.jpg',
+ 'https://mx.jzeg.cn:9096/appimg/image/tour/driver/sj33-1.jpg',
+ 'https://mx.jzeg.cn:9096/appimg/image/tour/driver/sj34.jpg',
+ 'https://mx.jzeg.cn:9096/appimg/image/tour/driver/sj35.jpg',
+ 'https://mx.jzeg.cn:9096/appimg/image/tour/driver/sj36.jpg',
+ 'https://mx.jzeg.cn:9096/appimg/image/tour/driver/sj37.jpg',
+ 'https://mx.jzeg.cn:9096/appimg/image/tour/driver/sj38.jpg',
+ 'https://mx.jzeg.cn:9096/appimg/image/tour/driver/sj39.jpg',
+ 'https://mx.jzeg.cn:9096/appimg/image/tour/driver/sj40.jpg',
+ 'https://mx.jzeg.cn:9096/appimg/image/tour/driver/sj41.jpg',
+ 'https://mx.jzeg.cn:9096/appimg/image/tour/driver/sj42.jpg',
+ 'https://mx.jzeg.cn:9096/appimg/image/tour/driver/sj43.jpg',
+ 'https://mx.jzeg.cn:9096/appimg/image/tour/driver/sj44.jpg',
+ ],
+ wsgVisiable: false, //纾呮埧蹇欑寮圭獥鎺у埗
+ wsgContent: '',
+ globalIsFirstWeighing: 1, //鏄惁鏄涓�娆′笂纾�
+ confirmWeighVisiable: false, //纾呮埧绠$悊纭绉伴噸瀹屾垚鎻愮ず寮圭獥
+ confirmWeighContent: '',
+ // 绉伴噸绋冲畾鎬� 0/绋冲畾 1/闈炵ǔ瀹� 闈炵ǔ瀹氭�佷笉鑳界偣绉伴噸
+ globalWarning: false,
},
mutations: {
lengthchange(state, payload) {
@@ -97,6 +166,9 @@
uni.setStorageSync('userTabbar', state.userTabbar)
} else if (roleType == 2 || roleType == 3) {
state.userTabbar = userRoleTabbar.second
+ uni.setStorageSync('userTabbar', state.userTabbar)
+ } else if (roleType == 5) {
+ state.userTabbar = userRoleTabbar.three
uni.setStorageSync('userTabbar', state.userTabbar)
}
},
@@ -121,6 +193,9 @@
changeuserInfo(state, payload) {
state.globaluserInfo = payload
},
+ changesocketTask(state, payload) {
+ state.socketTask = payload
+ },
// 鏀圭増鍏ㄥ眬websocket鐘舵��
changeisconnect(state, payload) {
state.globalisconnect = payload
@@ -141,17 +216,46 @@
},
// 鏀瑰彉閲嶈繛娆℃暟
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
+ }
}
+ },
+ changeablePrintInduction(state, payload) {
+ state.ablePrintInduction = payload
+ },
+ changeablePrintOut(state, payload) {
+ state.ablePrintOut = payload
+ },
+ changewsgVisiable(state, payload) {
+ state.wsgVisiable = payload
+ },
+ changewsgContent(state, payload) {
+ state.wsgContent = payload
+ },
+ changeglobalIsFirstWeighing(state, payload) {
+ state.globalIsFirstWeighing = payload
+ },
+ changeconfirmWeighVisiable(state, payload) {
+ state.confirmWeighVisiable = payload
+ },
+ changeconfirmWeighContent(state, payload) {
+ state.confirmWeighContent = payload
+ },
+ // 鏀瑰彉绋冲畾鎬�
+ changeWarning(state, payload) {
+ state.globalWarning = payload
},
},
actions: {
websocketInit({ state, dispatch, commit }) {
let wsUrl = `${webSocketUrl}?access_token=${uni.getStorageSync('token')}`
- state.socketTast = uni.connectSocket({
+ state.socketTask = uni.connectSocket({
url: wsUrl,
header: { CLIENT_TOC: 'Y' },
success: res => {
@@ -166,19 +270,20 @@
console.log('ws澶辫触');
commit('changereconnectState', false)
dispatch('reconnect')
+ commit('changeisconnect', false)
}
})
- 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, '鍙戦�佸績璺虫垚鍔�')
@@ -187,24 +292,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) {
+ if ((state.connectNum < 6 || state.connectNum.connectNum < 6) && state.globalisLogin) {
uni.showToast({
- title: `杩炴帴澶辫触锛屾鍦ㄥ皾璇曠${state.connectNum}娆¤繛鎺,
+ title: '杩炴帴澶辫触锛屾鍦ㄥ皾璇曢噸鏂拌繛鎺�',
icon: 'none'
})
- commit('changereconnectNum', 1)
+ 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'
@@ -218,17 +323,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) {
+ if (state.connectNum < 6 || state.connectNum.connectNum < 6 && state.globalisLogin) {
uni.showToast({
- title: `杩炴帴澶辫触锛屾鍦ㄥ皾璇曠${state.connectNum}娆¤繛鎺,
+ title: '杩炴帴澶辫触锛屾鍦ㄥ皾璇曢噸鏂拌繛鎺�',
icon: 'none'
})
- commit('changereconnectNum', 1)
+ commit('changereconnectNum', { connectNum: 1, isWeigh: false })
dispatch('reconnect')
} else if (state.connectNum > 6 && state.globalisLogin) {
- commit('changereconnectNum', 1)
+ commit('changereconnectNum', { connectNum: 1, isWeigh: false })
uni.showToast({
title: '缃戠粶寮傚父,璇风◢鍚庨噸璇�',
icon: 'none'
--
Gitblit v1.9.1