From bebd889f287f2af647677467738753fcc5818076 Mon Sep 17 00:00:00 2001 From: yangan <yangan0921@163.com> Date: 星期二, 25 六月 2024 14:42:55 +0800 Subject: [PATCH] feat:新增测试页面,称重页面去除默认0 --- pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice.vue | 2 pages/test/index.vue | 80 ++++++++++++++++++++++++++++++++++++++++ store/index.js | 4 + 3 files changed, 84 insertions(+), 2 deletions(-) diff --git a/pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice.vue b/pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice.vue index 93f30be..8227ee2 100644 --- a/pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice.vue +++ b/pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice.vue @@ -163,7 +163,7 @@ this.weighData.overTmWaixiao = 1 } this.changeweighHouseCode(params.weighHouseCode); - this.changeWeigh(0) + this.changeWeigh('') }, components: { combinedTitle, diff --git a/pages/test/index.vue b/pages/test/index.vue new file mode 100644 index 0000000..b0d06c8 --- /dev/null +++ b/pages/test/index.vue @@ -0,0 +1,80 @@ +<template> +<view style="display:flex;justify-content: center;fontSize:20px;flex-direction: column;"> + <h2 style="font-size:30px;text-align:center"> {{globalweigh}}</h2> + <button style="margin-top:90%" @click="rest">鐐瑰嚮閲嶈繛</button> + </view> +</template> + +<script> +import { mapState, mapMutations } from 'vuex'; +export default { + data() { + return { + roleType: null, + orderPlanDataStore: [], + indexHuoDaiOrderPlanData: [], + indexHistoryCoalData: [], + indexdriverBillOfLoadingData: {}, + messagePushShow: false, + messageList: { + title: '', + content: "", + }, + isconnect: false, + dotShow: false, + appHide: false, + phone: '' + } + }, + computed: { + ...mapState(['globalweighHouseCode', 'globalweigh', 'globalisconnect', 'globalSocket', 'websocketData', + 'globalIntervalId' + ]) + }, + watch:{ + '$store.state.websocketData'(v) { + console.log(v,'鎺ュ彈鐨剋s鏁版嵁'); + if (v.startsWith('weigh')) { + let nowWeighObj = JSON.parse(v.slice(7)); + console.log(v, this.globalweighHouseCode == false , nowWeighObj.eqCode,'鎺ュ彈鐨剋s鏁版嵁'); + if (this.globalweighHouseCode && nowWeighObj.eqCode == this.globalweighHouseCode) { + if (nowWeighObj.eqInfraredStatus) { + this.changeinfraredStatus(true); + this.changeWeigh(nowWeighObj.weigh); + let warningState = nowWeighObj.warning == 1 + this.changeWarning(warningState) + } else { + this.changeinfraredStatus(false); + this.changeWeigh(nowWeighObj.weigh); + let warningState = nowWeighObj.warning == 1 + this.changeWarning(warningState) + } + } + } else if (v.startsWith('msg')) { + function removeTags(str) { + return str.replace(/<\/?[^>]+>/gi, ''); + } + this.messageList = JSON.parse(v.slice(5)); + this.messageList = { + ...this.messageList, + title: this.messageList.title.slice(0, 8) + '...', + content: removeTags(this.messageList.content).trim().slice(0, 8) + '...' + } + this.messagePushShow = true; + } else {} + } + + }, + onShow(){ + this.$store.dispatch('websocketInit') + }, + rest(){ + this.$store.dispatch('websocketInit') + } + +} +</script> + +<style> + +</style> \ No newline at end of file diff --git a/store/index.js b/store/index.js index b289eb0..b0f55d7 100644 --- a/store/index.js +++ b/store/index.js @@ -253,6 +253,7 @@ actions: { websocketInit({ state, dispatch, commit }) { let wsUrl = `${webSocketUrl}?access_token=${uni.getStorageSync('token')}` + // let wsUrl = `${webSocketUrl}?UUID=boyingtest` state.socketTask = uni.connectSocket({ url: wsUrl, header: { CLIENT_TOC: 'Y' }, @@ -291,7 +292,7 @@ }, websocketOnClose({ state, commit, dispatch }, e) { if (!state.socketTask) return - console.log('ws鍏抽棴', e) + console.log('ws鍏抽棴',state.connectNum , JSON.parse( state.globalisLogin), e) state.socketTask.close(e => { commit('changeisconnect', false) }) @@ -300,6 +301,7 @@ state.socketTask = null commit('changereconnectState', false) if (state.connectNum <= 6 && state.globalisLogin) { + console.log('瑙﹀彂閲嶈繛锛�========') uni.showToast({ title: `杩炴帴澶辫触锛屾鍦ㄥ皾璇曠${state.connectNum}娆¤繛鎺, icon: 'none' -- Gitblit v1.9.1