修改显示字段,增加信息弹窗,保存账号,增加websocket定时刷新,增加校验功能

This commit is contained in:
2024-04-29 16:46:44 +08:00
parent 3bbea6fcae
commit 243ef444c7
11 changed files with 567 additions and 83 deletions

View File

@@ -27,38 +27,30 @@
</template>
<script>
// import {getBillsCount} from '@/utils/getData2.js'
import { sendWebsocket, closeWebsocket } from '@/utils/websocket.js'
export default {
data() {
return {
intervalId: null,
interTime: this.$store.getters.setTime,
userName: this.$store.getters.userInfo !== '' ? JSON.parse(this.$store.getters.userInfo).username : '',
menuList: []
};
},
onLoad () {
created () {
this._getBillsCount()
// this.intervalId = setInterval(this._getBillsCount, this.$store.getters.setTime)
},
onUnload () {
beforeDestroy () {
closeWebsocket(true)
if (this.intervalId) {
clearInterval(this.intervalId)
}
clearTimeout(this.intervalId)
this.intervalId = null
},
destroyed () {
closeWebsocket(true)
clearTimeout(this.intervalId)
this.intervalId = null
},
methods: {
// async _getBillsCount () {
// let res = await getBillsCount()
// if (res.code === 1) {
// this.menuList = [...res.result]
// } else {
// uni.showToast({
// title: res.desc,
// icon: 'none'
// })
// }
// },
_getBillsCount () {
let getTimestamp = new Date().getTime()
let url = this.$store.getters.baseUrl
@@ -67,17 +59,17 @@
},
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'
// })
// }
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'
})
}
},
wsErr () {
this.intervalId = setTimeout(() => {