From c7372dc7f495bdefb7f5e78d1c02756d637377b3 Mon Sep 17 00:00:00 2001
From: yangan <yangan0921@163.com>
Date: 星期四, 20 六月 2024 17:13:06 +0800
Subject: [PATCH] feat:司机去掉查看验质出场时间

---
 store/index.js |  277 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 267 insertions(+), 10 deletions(-)

diff --git a/store/index.js b/store/index.js
index 45b8230..a7eed82 100644
--- a/store/index.js
+++ b/store/index.js
@@ -1,20 +1,21 @@
 import Vue from 'vue'
 import Vuex from 'vuex'
+import { webSocketUrl } from '@/api/request.js'
 Vue.use(Vuex)
 
 // 鍔ㄦ�佸簳閮╰abbar
 const userRoleTabbar = {
 	first: [{
 			pagePath: 'pages/tabbar-page/index-tabbar/index-tabbar',
-			iconPath: '../../static/tabBar-icon/Gfayun.png',
-			selectedIconPath: '../../static/tabBar-icon/Bfayun1.png',
+			iconPath: '../../static/tabBar-icon/home.png',
+			selectedIconPath: '../../static/tabBar-icon/homeblue.png',
 			text: '棣栭〉'
 		},
 		{
 			pagePath: 'pages/customer-page/customer-my/faYunstatistics/faYunstatistics',
 			iconPath: '../../static/tabBar-icon/statistics.png',
 			selectedIconPath: '../../static/tabBar-icon/statisticsactive.png',
-			text: '鍙戣繍缁熻'
+			text: '缁熻'
 		},
 		{
 			pagePath: 'pages/tabbar-page/myPage-tabbar/myPage-tabbar',
@@ -25,15 +26,41 @@
 	],
 	second: [{
 			pagePath: 'pages/tabbar-page/index-tabbar/index-tabbar',
-			iconPath: '../../static/tabBar-icon/Ghome.png',
-			selectedIconPath: '../../static/tabBar-icon/Bhome.png',
+			iconPath: '../../static/tabBar-icon/home.png',
+			selectedIconPath: '../../static/tabBar-icon/homeblue.png',
 			text: '棣栭〉'
 		},
 		{
 			pagePath: 'pages/customer-page/customer-my/faYunstatistics/faYunstatistics',
 			iconPath: '../../static/tabBar-icon/statistics.png',
 			selectedIconPath: '../../static/tabBar-icon/statisticsactive.png',
-			text: '鍙戣繍缁熻'
+			text: '缁熻'
+		},
+		{
+			pagePath: 'pages/tabbar-page/myPage-tabbar/myPage-tabbar',
+			iconPath: '../../static/tabBar-icon/Gmine10.png',
+			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/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/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',
@@ -56,7 +83,89 @@
 		// 鍏ㄥ眬weihousecode
 		globalweighHouseCode: '',
 		// 鍏ㄥ眬绾㈠鐘舵��
-		globalinfraredStatus: false
+		globalinfraredStatus: false,
+		// 鍙告満淇敼涓汉淇℃伅
+		globaluserInfo: {
+			phone: '',
+			name: '',
+			username: '',
+			type: 3,
+			idCard: '',
+			carNo: '',
+			carImg: '',
+			drivingImg: '',
+			axleNum: '',
+			weight: '',
+			userId: ''
+		},
+		globalisconnect: true,
+		globalisUploadimg: false,
+		globalisLogin: false,
+		socketTask: null,
+		websocketData: null, // 瀛樻斁浠庡悗绔帴鏀跺埌鐨剋ebsocket鏁版嵁
+		globalIntervalId: null,
+		is_open_socket: false, //閬垮厤閲嶅杩炴帴
+		connectNum: 1, //閲嶈繛娆℃暟,
+		reconnectTimeOut: null,
+		// 绉伴噸绋冲畾鎬�  0/绋冲畾 1/闈炵ǔ瀹�  闈炵ǔ瀹氭�佷笉鑳界偣绉伴噸
+		globalWarning: false,
+		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) {
@@ -68,11 +177,14 @@
 		// 璁剧疆搴曢儴鏍�
 		setUserTabbar(state, roleType) {
 			state.roleType = roleType
-			if (roleType == 1) {
+			if (roleType === 1) {
 				state.userTabbar = userRoleTabbar.first
 				uni.setStorageSync('userTabbar', state.userTabbar)
-			} else if (roleType == 2 || roleType == 3) {
+			} else if (roleType === 2 || roleType === 3) {
 				state.userTabbar = userRoleTabbar.second
+				uni.setStorageSync('userTabbar', state.userTabbar)
+			} else if (roleType === 4) {
+				state.userTabbar = userRoleTabbar.three
 				uni.setStorageSync('userTabbar', state.userTabbar)
 			}
 		},
@@ -93,8 +205,153 @@
 		// 鏀瑰彉绾㈠鐘舵��
 		changeinfraredStatus(state, payload) {
 			state.globalinfraredStatus = payload
+		},
+		changeuserInfo(state, payload) {
+			state.globaluserInfo = payload
+		},
+		// 鏀圭増鍏ㄥ眬websocket鐘舵��
+		changeisconnect(state, payload) {
+			state.globalisconnect = payload
+		},
+		changeisUploadimg(state, payload) {
+			state.globalisUploadimg = payload
+		},
+		changeisLogin(state, payload) {
+			state.globalisLogin = payload
+			console.log(state.globalisLogin, '鍏ㄥ眬鐧诲綍鐘舵�佹敼鍙樹簡')
+		},
+		setWebsocketData(state, data) {
+			state.websocketData = data
+		},
+		// 鏀瑰彉閲嶈繛鐘舵��
+		changereconnectState(state, payload) {
+			state.is_open_socket = payload
+		},
+		// 鏀瑰彉閲嶈繛娆℃暟
+		changereconnectNum(state, payload) {
+			if (state.connectNum <= 6) {
+				state.connectNum += payload
+			} else {
+				state.connectNum = payload
+			}
+		},
+		// 鏀瑰彉绋冲畾鎬�
+		changeWarning(state, payload) {
+			state.globalWarning = payload
+		},
+		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({
+				url: wsUrl,
+				header: { CLIENT_TOC: 'Y' },
+				success: res => {
+					console.log(res, 'socketSuccess')
+					if (res.errMsg === 'connectSocket:ok') {
+						commit('changeisconnect', true)
+						commit('changereconnectState', true)
+					}
+				},
+				fail: res => {
+					console.log(res, 'socketFail')
+					console.log('ws澶辫触');
+					commit('changereconnectState', false)
+					dispatch('reconnect')
+				}
+
+			})
+			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))
+		},
+		websocketOnOpen({ state, commit }) {
+			console.log('ws鎵撳紑')
+			clearInterval(state.reconnectTimeOut)
+			clearInterval(state.globalIntervalId)
+			state.globalIntervalId = setInterval(() => {
+				state.socketTast.send({
+					data: JSON.stringify({ type: 'ping' }),
+					success(e) {
+						console.log(e, '鍙戦�佸績璺虫垚鍔�')
+					}
+				})
+			}, 30000)
+		},
+		websocketOnClose({ state, commit, dispatch }, e) {
+			if (!state.socketTast) return
+			console.log('ws鍏抽棴', e)
+			state.socketTast.close(e => {
+				commit('changeisconnect', false)
+			})
+			clearInterval(state.globalIntervalId)
+			clearInterval(state.reconnectTimeOut)
+			state.socketTast = null
+			commit('changereconnectState', false)
+			if (state.connectNum <= 6 && state.globalisLogin) {
+				uni.showToast({
+					title: `杩炴帴澶辫触锛屾鍦ㄥ皾璇曠${state.connectNum}娆¤繛鎺,
+					icon: 'none'
+				})
+				commit('changereconnectNum', 1)
+				dispatch('reconnect')
+			} else if (state.connectNum > 6 && state.globalisLogin) {
+				commit('changereconnectNum', 1)
+				uni.showToast({
+					title: '缃戠粶寮傚父,璇风◢鍚庨噸璇�',
+					icon: 'none'
+				})
+			} else {
+				return
+			}
+		},
+		websocketOnError({ state, commit, dispatch }, e) {
+			// 濡傛灉閲嶈繛鐘舵�佷负false鍒欎笉杩涜閲嶈繛锛屼负true鎵嶄細
+			console.log('ws鎶ラ敊', e)
+			clearInterval(state.globalIntervalId)
+			clearInterval(state.reconnectTimeOut)
+			state.socketTast = null
+			commit('changereconnectState', false)
+			if (state.connectNum < 6 && state.globalisLogin) {
+				uni.showToast({
+					title: `杩炴帴澶辫触锛屾鍦ㄥ皾璇曠${state.connectNum}娆¤繛鎺,
+					icon: 'none'
+				})
+				commit('changereconnectNum', 1)
+				dispatch('reconnect')
+			} else if (state.connectNum >= 6 && state.globalisLogin) {
+				commit('changereconnectNum', 1)
+				uni.showToast({
+					title: '缃戠粶寮傚父,璇风◢鍚庨噸璇�',
+					icon: 'none'
+				})
+			} else {
+				return
+			}
+		},
+		// 鎺ユ敹鏁版嵁
+		websocketOnMessage({ state, commit }, result) {
+			commit('setWebsocketData', result)
+		},
+		// 閲嶆柊杩炴帴
+		reconnect({ state, commit, dispatch }) {
+			console.log(state.is_open_socket, '閲嶆柊杩炴帴socket鐘舵��');
+			clearInterval(state.globalIntervalId)
+			if (!state.is_open_socket && state.globalisLogin) {
+				state.reconnectTimeOut = setInterval(() => {
+					dispatch('websocketInit')
+				}, 5000)
+			}
 		}
 	}
 })
 
-export default store
+export default store
\ No newline at end of file

--
Gitblit v1.9.1