This commit is contained in:
辉 2023-11-10 10:42:10 +08:00
parent 3d7dbddefd
commit b52a960592
4 changed files with 113 additions and 50 deletions

View File

@ -47,8 +47,8 @@
{ {
"path": "pages/homepage/homepage", "path": "pages/homepage/homepage",
"style": { "style": {
// "navigationBarTitleText": "工单", "navigationBarTitleText": "",
"navigationStyle": "custom", // "navigationStyle": "custom",
"onReachBottomDistance": 40, //距离底部多远时触发 单位为px "onReachBottomDistance": 40, //距离底部多远时触发 单位为px
"enablePullDownRefresh": true //设置参数为true "enablePullDownRefresh": true //设置参数为true
} }
@ -56,8 +56,8 @@
{ {
"path": "pages/quanyi/quanyi", "path": "pages/quanyi/quanyi",
"style": { "style": {
// "navigationBarTitleText": "工单", // "navigationBarTitleText": "消息列表",
"navigationStyle": "custom", // "navigationStyle": "custom",
"onReachBottomDistance": 40, //距离底部多远时触发 单位为px "onReachBottomDistance": 40, //距离底部多远时触发 单位为px
"enablePullDownRefresh": true //设置参数为true "enablePullDownRefresh": true //设置参数为true
} }
@ -105,9 +105,7 @@
// "navigationStyle": "custom" // "navigationStyle": "custom"
} }
} }
],
],
"globalStyle": { "globalStyle": {
"navigationBarTextStyle": "white", "navigationBarTextStyle": "white",
"navigationBarTitleText": "", "navigationBarTitleText": "",

View File

@ -2,7 +2,7 @@
<view class="app"> <view class="app">
<!-- 泉医到家 --> <!-- 泉医到家 -->
<view class="" v-if="status==2"> <view class="" v-if="status==2">
<uni-nav-bar title="工单" background-color="#18CBB3" color="white"></uni-nav-bar> <!-- <uni-nav-bar title="工单" background-color="#18CBB3" color="white"></uni-nav-bar> -->
<u-tabs :list="tabslist" :is-scroll="false" :current="tabscurrent" @change="tabschange" <u-tabs :list="tabslist" :is-scroll="false" :current="tabscurrent" @change="tabschange"
inactive-color='#fff' active-color='#fff'></u-tabs> inactive-color='#fff' active-color='#fff'></u-tabs>
<view class="top" v-if="tabscurrent==0"> <view class="top" v-if="tabscurrent==0">
@ -183,15 +183,22 @@
}, },
listinfo: [], listinfo: [],
listtotal: 0, listtotal: 0,
status: '',
} }
}, },
onReady() { //更改导航栏文字
uni.setNavigationBarTitle({
title: this.title,
});
},
onShow() { onShow() {
this.status = uni.getStorageSync("status")
if (this.status == 2) { if (this.status == 2) {
this.title = '工单'
this.info(); this.info();
} else {
this.title = '消息列表'
} }
this.status = uni.getStorageSync("status", )
// console.log(this.status, '555')
}, },
methods: { methods: {
//前往聊天 //前往聊天
@ -286,16 +293,13 @@
this.query.pageNum++ this.query.pageNum++
getList(this.query).then( getList(this.query).then(
res => { res => {
console.log(res, '77')
res.rows.forEach(e => { res.rows.forEach(e => {
console.log(e, '787')
e.sex = getSex(e.cardNo) e.sex = getSex(e.cardNo)
this.missionlist.push(e) this.missionlist.push(e)
}) })
}) })
} }
// } // }
}, },
onPullDownRefresh() { //下拉刷新 onPullDownRefresh() { //下拉刷新
if (this.status == 2) { if (this.status == 2) {

View File

@ -1,6 +1,6 @@
<template> <template>
<view class="app"> <view class="app">
<uni-nav-bar title="消息列表" background-color="#18CBB3" color="white"></uni-nav-bar> <!-- <uni-nav-bar title="消息列表" background-color="#18CBB3" color="white"></uni-nav-bar> -->
<u-tabs :list="tabslist" :is-scroll="false" :current="tabscurrent" @change="tabschange" inactive-color='#fff' <u-tabs :list="tabslist" :is-scroll="false" :current="tabscurrent" @change="tabschange" inactive-color='#fff'
active-color='#fff'></u-tabs> active-color='#fff'></u-tabs>
<view class="inputs" style="width: 90%;height: 60rpx;transform: none;margin: 20rpx auto;"> <view class="inputs" style="width: 90%;height: 60rpx;transform: none;margin: 20rpx auto;">
@ -73,20 +73,84 @@
listinfo: [], listinfo: [],
listtotal: 0, listtotal: 0,
status: '', status: '',
SOCKETURL: '',
socketOpen: false,
timeoutObj: null,
} }
}, },
mounted() { mounted() {
this.SOCKETURL = 'ws://192.168.16.212:8088/webSocket/' + uni.getStorageSync("id")
this.status = uni.getStorageInfoSync('status') this.status = uni.getStorageInfoSync('status')
this.info() this.info()
this.socket();
}, },
watch: { watch: {
Refresh(newvalue, oldvalue) { Refresh(newvalue, oldvalue) {
console.log(newvalue, oldvalue, '55')
this.info(); this.info();
}, },
}, },
methods: { methods: {
socket() {
let that = this
console.log(that.SOCKETURL)
try {
uni.connectSocket({
url: that.SOCKETURL
})
uni.onSocketOpen(res => {
console.log('webScoket连接已打开', res);
that.socketOpen = true
that.reset()
})
uni.onSocketError(err => {
console.log('webScoket连接打开失败', err);
if (err && err.code != 1000) {
setTimeout(() => {
that.socketOpen = true
uni.connectSocket({
url: that.SOCKETURL
})
}, 3 * 1000)
}
})
uni.onSocketClose(err => {
console.log('webScoket连接关闭', err);
if (err && err.code !== 1000) {
setTimeout(() => {
that.socketOpen = true
uni.connectSocket({
url: that.SOCKETURL
})
}, 3 * 1000)
}
})
uni.onSocketMessage(res => {
console.log("webScoket监听收到的信息", res);
that.info();
})
} catch (e) {
console.log(e);
}
},
reset() {
let that = this
clearInterval(that.timeoutObj);
that.timeoutObj = setInterval(() => {
uni.sendSocketMessage({
data: 'ping',
success(res) {
console.log('正在发送心跳');
},
fail(err) {
console.log('心跳发送失败,重新连接...');
that.socketOpen = true
uni.connectSocket({
url: that.SOCKETURL
})
}
})
}, 180000)
},
//前往聊天 //前往聊天
goseekadvicefrom(item) { goseekadvicefrom(item) {
console.log(item, '854') console.log(item, '854')

View File

@ -212,14 +212,11 @@
}) })
}, },
Read() { Read() {
console.log(this.currentItem.doctorId, '888888888')
let markReadData = { let markReadData = {
consultationId: this.currentItem.id, consultationId: this.currentItem.id,
recipientId: Number(this.currentItem.doctorId), recipientId: Number(this.currentItem.doctorId),
} }
console.log(markReadData, '6')
markRead(markReadData) markRead(markReadData)
}, },
//键盘发送 //键盘发送
sendconfirm(value) { sendconfirm(value) {
@ -456,36 +453,36 @@
const that = this const that = this
this.socketOpen = false this.socketOpen = false
try { try {
uni.connectSocket({ // uni.connectSocket({
url: that.SOCKETURL // url: that.SOCKETURL
}) // })
uni.onSocketOpen(res => { // uni.onSocketOpen(res => {
console.log('webScoket连接已打开', res); // console.log('webScoket连接已打开', res);
that.socketOpen = true // that.socketOpen = true
that.reset() // that.reset()
}) // })
uni.onSocketError(err => { // uni.onSocketError(err => {
console.log('webScoket连接打开失败', err); // console.log('webScoket连接打开失败', err);
if (err && err.code != 1000) { // if (err && err.code != 1000) {
setTimeout(() => { // setTimeout(() => {
that.socketOpen = true // that.socketOpen = true
uni.connectSocket({ // uni.connectSocket({
url: that.SOCKETURL // url: that.SOCKETURL
}) // })
}, 3 * 1000) // }, 3 * 1000)
} // }
}) // })
uni.onSocketClose(err => { // uni.onSocketClose(err => {
console.log('webScoket连接关闭', err); // console.log('webScoket连接关闭', err);
if (err && err.code !== 1000) { // if (err && err.code !== 1000) {
setTimeout(() => { // setTimeout(() => {
that.socketOpen = true // that.socketOpen = true
uni.connectSocket({ // uni.connectSocket({
url: that.SOCKETURL // url: that.SOCKETURL
}) // })
}, 3 * 1000) // }, 3 * 1000)
} // }
}) // })
uni.onSocketMessage(res => { uni.onSocketMessage(res => {
console.log("webScoket监听收到的信息", res); console.log("webScoket监听收到的信息", res);
that.newsList.push({ that.newsList.push({