This commit is contained in:
2023-11-13 11:38:32 +08:00
parent cb69adeb84
commit 35e3402db6
4 changed files with 43 additions and 57 deletions

3
api/socketurl.js Normal file
View File

@ -0,0 +1,3 @@
var socketurl = "ws://8.131.93.145:54010/webSocket/";
export default socketurl

View File

@ -136,7 +136,7 @@
<image src="../../static/huijiantou.png" mode=""></image> <image src="../../static/huijiantou.png" mode=""></image>
</view> </view>
</view> </view>
<view class="myorder titles" @tap="remove()"> <view class="myorder titles" @tap="remove">
<view class="title"> <view class="title">
退出账号 退出账号
</view> </view>
@ -144,10 +144,8 @@
<image src="../../static/huijiantou.png" mode=""></image> <image src="../../static/huijiantou.png" mode=""></image>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<u-toast ref="uToast" /> <u-toast ref="uToast" />
</view> </view>
</template> </template>
@ -208,30 +206,29 @@
// 退 // 退
remove() { remove() {
let that = this let that = this
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: '确认要退出此账号吗', content: '确认要退出此账号吗',
success: function(res) { success: function(res) {
if (res.confirm) { if (res.confirm) {
uni.clearStorageSync(); if (uni.getStorageSync("status") == 1) {
that.$refs.uToast.show({ uni.closeSocket();
title: '退出账号成功', }
type: 'success', uni.clearStorageSync();
duration: '1000' that.$refs.uToast.show({
}) title: '退出账号成功',
setTimeout(e => { type: 'success',
duration: '1000'
})
setTimeout(e => {
uni.reLaunch({ uni.reLaunch({
url: '/pages/login/login' url: '/pages/login/login'
}) })
}, 1000) }, 1000)
}
} }
}); }
});
}, },
} }
} }
</script> </script>
@ -455,4 +452,4 @@
} }
} }
} }
</style> </style>

View File

@ -34,12 +34,10 @@
getUserSig, getUserSig,
consultation, consultation,
} from '@/api/homepage/index.js' } from '@/api/homepage/index.js'
// import {
// quanyi
// } from '../quanyi/quanyi.vue'
import { import {
getSex getSex
} from '@/utils/conversion.js' } from '@/utils/conversion.js'
import socketurl from '@/api/socketurl.js'
export default { export default {
props: [ props: [
'Refresh', 'down' 'Refresh', 'down'
@ -79,7 +77,7 @@
} }
}, },
mounted() { mounted() {
this.SOCKETURL = 'ws://192.168.16.212:8088/webSocket/' + uni.getStorageSync("id") this.SOCKETURL = socketurl + uni.getStorageSync("id")
this.status = uni.getStorageInfoSync('status') this.status = uni.getStorageInfoSync('status')
this.info() this.info()
this.socket(); this.socket();
@ -153,7 +151,6 @@
}, },
// //
goseekadvicefrom(item) { goseekadvicefrom(item) {
console.log(item, '854')
uni.navigateTo({ uni.navigateTo({
url: `/pages/seekadvicefrom/seekadvicefrom?item=${JSON.stringify(item)}` url: `/pages/seekadvicefrom/seekadvicefrom?item=${JSON.stringify(item)}`
// url: '/pages/seekadvicefrom/seekadvicefrom' // url: '/pages/seekadvicefrom/seekadvicefrom'
@ -213,16 +210,12 @@
}, },
info() { info() {
this.formdata.pageNum = 1 this.formdata.pageNum = 1
console.log(this.formdata, '585')
consultationInfolist(this.formdata).then(res => { consultationInfolist(this.formdata).then(res => {
this.listinfo = res.rows this.listinfo = res.rows
console.log(this.listinfo, '58')
this.listtotal = res.total this.listtotal = res.total
console.log(this.listtotal, '5')
}) })
}, },
tabschange(index) { tabschange(index) {
console.log(index, '858')
this.tabscurrent = index; this.tabscurrent = index;
this.formdata.status = this.tabslist[index].value this.formdata.status = this.tabslist[index].value
// this.optionname = '' // this.optionname = ''
@ -236,7 +229,6 @@
// }, // },
}, },
onReachBottom() { // onReachBottom() { //
console.log(this.listinfo.length)
if (this.listinfo.length >= this.listtotal) {} else { if (this.listinfo.length >= this.listtotal) {} else {
this.formdata.pageNum++ this.formdata.pageNum++
consultationInfolist(this.formdata).then(res => { consultationInfolist(this.formdata).then(res => {
@ -245,7 +237,6 @@
} }
}, },
onPullDownRefresh() { // onPullDownRefresh() { //
// console.log(this.listinfo.length)
this.info(); this.info();
this.Refreshname++ this.Refreshname++
setTimeout(function() { setTimeout(function() {

View File

@ -4,7 +4,6 @@
<image src="../../static/huijiantou.png" @click="back"></image> <image src="../../static/huijiantou.png" @click="back"></image>
{{currentItem.senderName}} {{currentItem.senderName}}
</view> --> </view> -->
<!-- 聊天渲染列表 --> <!-- 聊天渲染列表 -->
<!-- scroll-y scroll-into-view="placeholder" scroll-top="500" scroll-with-animation --> <!-- scroll-y scroll-into-view="placeholder" scroll-top="500" scroll-with-animation -->
<scroll-view scroll-y="true" :scroll-top='scrollTop' id="demo" <scroll-view scroll-y="true" :scroll-top='scrollTop' id="demo"
@ -26,7 +25,6 @@
</view> </view>
<video v-if="item.video" :src="item.video"></video> <video v-if="item.video" :src="item.video"></video>
</view> </view>
<view class="placeholder" id="placeholder"></view> <view class="placeholder" id="placeholder"></view>
</view> </view>
</scroll-view> </scroll-view>
@ -253,14 +251,9 @@
}, },
sendout() { sendout() {
const that = this const that = this
if (this.socketOpen == false) { // if (this.socketOpen == false) {
return // return
} // }
that.newsList.push({
senderName: that.currentItem.doctorName,
content: that.formData.content,
messageType: 1,
})
let obj = { let obj = {
consultationId: that.currentItem.id, consultationId: that.currentItem.id,
recipientId: that.currentItem.patientId, recipientId: that.currentItem.patientId,
@ -272,13 +265,16 @@
content: this.formData.content content: this.formData.content
} }
sendMessage(obj).then(res => { sendMessage(obj).then(res => {
that.newsList.push({
senderName: that.currentItem.doctorName,
content: that.formData.content,
messageType: 1,
})
that.formData.content = '' // that.formData.content = '' //
setTimeout(() => { setTimeout(() => {
that.scrollTop = that.scrollTop + 1; that.scrollTop = that.scrollTop + 1;
}, 100) }, 100)
if (res.code != 200) { if (res.code != 200) {}
}
}) })
// try { // try {
// const that = this // const that = this
@ -382,11 +378,10 @@
}, },
// //
chooseImage(sourceType) { chooseImage(sourceType) {
console.log(sourceType)
var that = this var that = this
if (this.socketOpen == false) { // if (this.socketOpen == false) {
return // return
} // }
uni.chooseImage({ uni.chooseImage({
sourceType, sourceType,
sizeType: ["compressed"], sizeType: ["compressed"],
@ -451,7 +446,7 @@
}, },
scoket() { scoket() {
const that = this const that = this
this.socketOpen = false // this.socketOpen = false
try { try {
// uni.connectSocket({ // uni.connectSocket({
// url: that.SOCKETURL // url: that.SOCKETURL
@ -508,7 +503,7 @@
}, },
fail(err) { fail(err) {
console.log('心跳发送失败,重新连接...'); console.log('心跳发送失败,重新连接...');
that.socketOpen = true // that.socketOpen = true
uni.connectSocket({ uni.connectSocket({
url: that.SOCKETURL url: that.SOCKETURL
}) })
@ -523,10 +518,10 @@
} }
}, },
onUnload() { onUnload() {
clearInterval(this.timeoutObj); // clearInterval(this.timeoutObj);
if (this.socketOpen == true) { // if (this.socketOpen == true) {
uni.closeSocket(); // uni.closeSocket();
} // }
} }
}; };
</script> </script>