优化websocket

This commit is contained in:
2024-04-30 13:51:32 +08:00
parent 243ef444c7
commit 068ffaaf6c
8 changed files with 70 additions and 84 deletions

View File

@@ -32,12 +32,16 @@
data() {
return {
intervalId: null,
interTime: this.$store.getters.setTime,
userName: this.$store.getters.userInfo !== '' ? JSON.parse(this.$store.getters.userInfo).username : '',
menuList: []
};
},
created () {
onLoad() {
// setTimeout(() => {
// uni.showLoading({
// title: '加载中...'
// })
// }, 200)
this._getBillsCount()
},
beforeDestroy () {
@@ -60,16 +64,8 @@
wsMessage (res) {
console.log(res)
clearTimeout(this.intervalId)
let data = res.head
this.$store.dispatch('materObj', res.home.result)
if (data.code === '1') {
this.menuList = [...data.result]
} else {
uni.showToast({
title: data.desc,
icon: 'none'
})
}
// uni.hideLoading()
this.menuList = [...res]
},
wsErr () {
this.intervalId = setTimeout(() => {
@@ -79,15 +75,15 @@
toPage (e) {
let url = ''
url = '/pages/management/in-storage?id=' + e.djlx + '&name=' + e.name + '&type=' + e.ywlx
uni.redirectTo({
uni.navigateTo({
url: url
})
},
Quit () {
this.$store.dispatch('delUserInfo', '')
uni.redirectTo({
url: '/pages/login/login'
})
this.$store.dispatch('delUserInfo', '')
uni.redirectTo({
url: '/pages/login/login'
})
}
}
}