| | |
| | | <template> |
| | | <view> |
| | | <view class="max-block"> |
| | | <view class="search-bar"> |
| | | <view class="icon-body"> |
| | | <view class="icon-box" @click="messagePage"> |
| | |
| | | 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: { |
| | |
| | | freightForwarderIndex |
| | | }, |
| | | computed: { |
| | | ...mapState(['globalweighHouseCode', 'globalweigh']) |
| | | ...mapState(['globalweighHouseCode', 'globalweigh', 'globalisconnect']) |
| | | }, |
| | | watch: { |
| | | globalisconnect(v, oldv) {} |
| | | }, |
| | | //首页下拉刷新 |
| | | onPullDownRefresh() { |
| | |
| | | }, |
| | | onShow() { |
| | | this.init(); |
| | | if (!this.isconnect) { |
| | | if (!this.globalisconnect || !this.isconnect) { |
| | | this.initWebsocket(); |
| | | } |
| | | this.userAuthorization(); |
| | |
| | | }, |
| | | onHide() { |
| | | console.log('页面隐藏'); |
| | | if (!this.isconnect) { |
| | | // this.isconnect = false; |
| | | // this.changeisconnect(false); |
| | | // socket.close(); |
| | | if (!this.globalisconnect || !this.isconnect) { |
| | | this.initWebsocket(); |
| | | } |
| | | }, |
| | |
| | | clearInterval(this.intervalId); |
| | | }, |
| | | methods: { |
| | | ...mapMutations(['pushMessage', 'changeWeigh', 'changeinfraredStatus']), |
| | | ...mapMutations(['pushMessage', 'changeWeigh', 'changeinfraredStatus', 'changeisconnect']), |
| | | messagePage() { |
| | | uni.navigateTo({ |
| | | url: '/pages/public-page/message/message' |
| | |
| | | complete: res => { |
| | | console.log(res, 'socket结果'); |
| | | if (res.errMsg == 'connectSocket:ok') { |
| | | this.changeisconnect(true); |
| | | this.isconnect = true; |
| | | } |
| | | } |
| | |
| | | this.$reqGet('getMessageByUser', { current: 1, size: 10 }).then(res => { |
| | | if (res.code == 0) { |
| | | this.messageList = res.data.records; |
| | | this.messageList.map(v => { |
| | | this.messageList.forEach(v => { |
| | | if (v.status !== 1) { |
| | | this.dotShow = true; |
| | | } else { |
| | |
| | | </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 { |