优化
This commit is contained in:
@@ -37,6 +37,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {messageConfirm} from '@/utils/getData4.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -75,7 +76,9 @@
|
||||
// }
|
||||
// },
|
||||
mounted() {
|
||||
this.initWebSocket()
|
||||
if (this.$store.getters.saveIssend == '2') {
|
||||
this.initWebSocket()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
initWebSocket() {
|
||||
@@ -128,11 +131,19 @@
|
||||
},
|
||||
|
||||
handleWebSocketMessage(res) {
|
||||
console.log(res, 'res')
|
||||
// console.log(res, 'res')
|
||||
console.log(res.msg.data, 'res.msg.data')
|
||||
uni.showToast({
|
||||
uni.showModal({
|
||||
title: res.msg.data,
|
||||
icon: 'none'
|
||||
cancelText: '关闭',
|
||||
confirmText: '稍后提醒',
|
||||
success: res => {
|
||||
if (res.confirm) {
|
||||
this._messageConfirm('1')
|
||||
} else if (res.cancel) {
|
||||
this._messageConfirm('2')
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
@@ -156,6 +167,16 @@
|
||||
this.initWebSocket()
|
||||
}, 5000) // 5秒后重连
|
||||
},
|
||||
async _messageConfirm (type) {
|
||||
try {
|
||||
let res = await messageConfirm(type)
|
||||
uni.showToast({
|
||||
title: res.message,
|
||||
icon: 'none'
|
||||
})
|
||||
} catch (e) {
|
||||
}
|
||||
},
|
||||
toPage1 (e) {
|
||||
if (e.sonTree.length > 0) {
|
||||
this.show = true
|
||||
|
||||
Reference in New Issue
Block a user