From 4e77e01f068e8ea2ec914698aa55fcf369afc919 Mon Sep 17 00:00:00 2001 From: qingyiay <2386314947@qq.com> Date: 星期一, 15 五月 2023 11:17:25 +0800 Subject: [PATCH] 司机首页修改 --- pages/tabbar-page/index-tabbar/index-tabbar.vue | 23 +++++++++++++++++------ 1 files changed, 17 insertions(+), 6 deletions(-) diff --git a/pages/tabbar-page/index-tabbar/index-tabbar.vue b/pages/tabbar-page/index-tabbar/index-tabbar.vue index 6111883..b15ebb7 100644 --- a/pages/tabbar-page/index-tabbar/index-tabbar.vue +++ b/pages/tabbar-page/index-tabbar/index-tabbar.vue @@ -1,5 +1,5 @@ <template> - <view> + <view class="max-block"> <view class="search-bar"> <view class="icon-body"> <view class="icon-box" @click="messagePage"> @@ -31,6 +31,7 @@ import freightForwarderIndex from '@/pages/freight-forwarder-page/freightForwarder-index/freightForwarder-index.vue'; import { mapState, mapMutations } from 'vuex'; import { webSocketUrl } from '@/api/request.js'; + let socket = null; export default { components: { @@ -39,7 +40,10 @@ freightForwarderIndex }, computed: { - ...mapState(['globalweighHouseCode', 'globalweigh']) + ...mapState(['globalweighHouseCode', 'globalweigh', 'globalisconnect']) + }, + watch: { + globalisconnect(v, oldv) {} }, //棣栭〉涓嬫媺鍒锋柊 onPullDownRefresh() { @@ -126,7 +130,7 @@ }, onShow() { this.init(); - if (!this.isconnect) { + if (!this.globalisconnect || !this.isconnect) { this.initWebsocket(); } this.userAuthorization(); @@ -134,7 +138,10 @@ }, onHide() { console.log('椤甸潰闅愯棌'); - if (!this.isconnect) { + // this.isconnect = false; + // this.changeisconnect(false); + // socket.close(); + if (!this.globalisconnect || !this.isconnect) { this.initWebsocket(); } }, @@ -144,7 +151,7 @@ clearInterval(this.intervalId); }, methods: { - ...mapMutations(['pushMessage', 'changeWeigh', 'changeinfraredStatus']), + ...mapMutations(['pushMessage', 'changeWeigh', 'changeinfraredStatus', 'changeisconnect']), messagePage() { uni.navigateTo({ url: '/pages/public-page/message/message' @@ -223,6 +230,7 @@ complete: res => { console.log(res, 'socket缁撴灉'); if (res.errMsg == 'connectSocket:ok') { + this.changeisconnect(true); this.isconnect = true; } } @@ -293,9 +301,12 @@ </script> <style lang="scss" scoped> +.max-block { + font-family: siYuanLight !important; +} .white-block { width: 100%; - height: vww(50); + height: vww(20); margin-top: vww(10); } .search-bar { -- Gitblit v1.9.1