修改
This commit is contained in:
parent
cb69adeb84
commit
35e3402db6
3
api/socketurl.js
Normal file
3
api/socketurl.js
Normal file
@ -0,0 +1,3 @@
|
||||
var socketurl = "ws://8.131.93.145:54010/webSocket/";
|
||||
|
||||
export default socketurl
|
||||
@ -136,7 +136,7 @@
|
||||
<image src="../../static/huijiantou.png" mode=""></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="myorder titles" @tap="remove()">
|
||||
<view class="myorder titles" @tap="remove">
|
||||
<view class="title">
|
||||
退出账号
|
||||
</view>
|
||||
@ -144,10 +144,8 @@
|
||||
<image src="../../static/huijiantou.png" mode=""></image>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<u-toast ref="uToast" />
|
||||
</view>
|
||||
</template>
|
||||
@ -208,30 +206,29 @@
|
||||
// 退出登录
|
||||
remove() {
|
||||
let that = this
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确认要退出此账号吗',
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
uni.clearStorageSync();
|
||||
that.$refs.uToast.show({
|
||||
title: '退出账号成功',
|
||||
type: 'success',
|
||||
duration: '1000'
|
||||
})
|
||||
setTimeout(e => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确认要退出此账号吗',
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
if (uni.getStorageSync("status") == 1) {
|
||||
uni.closeSocket();
|
||||
}
|
||||
uni.clearStorageSync();
|
||||
that.$refs.uToast.show({
|
||||
title: '退出账号成功',
|
||||
type: 'success',
|
||||
duration: '1000'
|
||||
})
|
||||
setTimeout(e => {
|
||||
uni.reLaunch({
|
||||
url: '/pages/login/login'
|
||||
})
|
||||
}, 1000)
|
||||
}
|
||||
}, 1000)
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@ -455,4 +452,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
@ -34,12 +34,10 @@
|
||||
getUserSig,
|
||||
consultation,
|
||||
} from '@/api/homepage/index.js'
|
||||
// import {
|
||||
// quanyi
|
||||
// } from '../quanyi/quanyi.vue'
|
||||
import {
|
||||
getSex
|
||||
} from '@/utils/conversion.js'
|
||||
import socketurl from '@/api/socketurl.js'
|
||||
export default {
|
||||
props: [
|
||||
'Refresh', 'down'
|
||||
@ -79,7 +77,7 @@
|
||||
}
|
||||
},
|
||||
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.info()
|
||||
this.socket();
|
||||
@ -153,7 +151,6 @@
|
||||
},
|
||||
//前往聊天
|
||||
goseekadvicefrom(item) {
|
||||
console.log(item, '854')
|
||||
uni.navigateTo({
|
||||
url: `/pages/seekadvicefrom/seekadvicefrom?item=${JSON.stringify(item)}`
|
||||
// url: '/pages/seekadvicefrom/seekadvicefrom'
|
||||
@ -213,16 +210,12 @@
|
||||
},
|
||||
info() {
|
||||
this.formdata.pageNum = 1
|
||||
console.log(this.formdata, '585')
|
||||
consultationInfolist(this.formdata).then(res => {
|
||||
this.listinfo = res.rows
|
||||
console.log(this.listinfo, '58')
|
||||
this.listtotal = res.total
|
||||
console.log(this.listtotal, '5')
|
||||
})
|
||||
},
|
||||
tabschange(index) {
|
||||
console.log(index, '858')
|
||||
this.tabscurrent = index;
|
||||
this.formdata.status = this.tabslist[index].value
|
||||
// this.optionname = '全部'
|
||||
@ -236,7 +229,6 @@
|
||||
// },
|
||||
},
|
||||
onReachBottom() { //下滑加载
|
||||
console.log(this.listinfo.length)
|
||||
if (this.listinfo.length >= this.listtotal) {} else {
|
||||
this.formdata.pageNum++
|
||||
consultationInfolist(this.formdata).then(res => {
|
||||
@ -245,7 +237,6 @@
|
||||
}
|
||||
},
|
||||
onPullDownRefresh() { //下拉刷新
|
||||
// console.log(this.listinfo.length)
|
||||
this.info();
|
||||
this.Refreshname++
|
||||
setTimeout(function() {
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
<image src="../../static/huijiantou.png" @click="back"></image>
|
||||
{{currentItem.senderName}}
|
||||
</view> -->
|
||||
|
||||
<!-- 聊天渲染列表 -->
|
||||
<!-- scroll-y scroll-into-view="placeholder" scroll-top="500" scroll-with-animation -->
|
||||
<scroll-view scroll-y="true" :scroll-top='scrollTop' id="demo"
|
||||
@ -26,7 +25,6 @@
|
||||
</view>
|
||||
<video v-if="item.video" :src="item.video"></video>
|
||||
</view>
|
||||
|
||||
<view class="placeholder" id="placeholder"></view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
@ -253,14 +251,9 @@
|
||||
},
|
||||
sendout() {
|
||||
const that = this
|
||||
if (this.socketOpen == false) {
|
||||
return
|
||||
}
|
||||
that.newsList.push({
|
||||
senderName: that.currentItem.doctorName,
|
||||
content: that.formData.content,
|
||||
messageType: 1,
|
||||
})
|
||||
// if (this.socketOpen == false) {
|
||||
// return
|
||||
// }
|
||||
let obj = {
|
||||
consultationId: that.currentItem.id,
|
||||
recipientId: that.currentItem.patientId,
|
||||
@ -272,13 +265,16 @@
|
||||
content: this.formData.content
|
||||
}
|
||||
sendMessage(obj).then(res => {
|
||||
that.newsList.push({
|
||||
senderName: that.currentItem.doctorName,
|
||||
content: that.formData.content,
|
||||
messageType: 1,
|
||||
})
|
||||
that.formData.content = '' //清空输入框的文本
|
||||
setTimeout(() => {
|
||||
that.scrollTop = that.scrollTop + 1;
|
||||
}, 100)
|
||||
if (res.code != 200) {
|
||||
|
||||
}
|
||||
if (res.code != 200) {}
|
||||
})
|
||||
// try {
|
||||
// const that = this
|
||||
@ -382,11 +378,10 @@
|
||||
},
|
||||
//发送图片
|
||||
chooseImage(sourceType) {
|
||||
console.log(sourceType)
|
||||
var that = this
|
||||
if (this.socketOpen == false) {
|
||||
return
|
||||
}
|
||||
// if (this.socketOpen == false) {
|
||||
// return
|
||||
// }
|
||||
uni.chooseImage({
|
||||
sourceType,
|
||||
sizeType: ["compressed"],
|
||||
@ -451,7 +446,7 @@
|
||||
},
|
||||
scoket() {
|
||||
const that = this
|
||||
this.socketOpen = false
|
||||
// this.socketOpen = false
|
||||
try {
|
||||
// uni.connectSocket({
|
||||
// url: that.SOCKETURL
|
||||
@ -508,7 +503,7 @@
|
||||
},
|
||||
fail(err) {
|
||||
console.log('心跳发送失败,重新连接...');
|
||||
that.socketOpen = true
|
||||
// that.socketOpen = true
|
||||
uni.connectSocket({
|
||||
url: that.SOCKETURL
|
||||
})
|
||||
@ -523,10 +518,10 @@
|
||||
}
|
||||
},
|
||||
onUnload() {
|
||||
clearInterval(this.timeoutObj);
|
||||
if (this.socketOpen == true) {
|
||||
uni.closeSocket();
|
||||
}
|
||||
// clearInterval(this.timeoutObj);
|
||||
// if (this.socketOpen == true) {
|
||||
// uni.closeSocket();
|
||||
// }
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user