This commit is contained in:
zoujiandong 2023-09-04 09:10:35 +08:00
parent 68d817d135
commit 0d1af8ef0e
6 changed files with 46 additions and 12 deletions

View File

@ -169,7 +169,7 @@ Page({
}) })
}, },
onSDKReady(){ onSDKReady(){
//console.log("onSDKReady from wenzhen"); console.log("onSDKReady from wenzhen");
this.getConversationList(); this.getConversationList();
}, },
getConversationList(){ getConversationList(){
@ -299,10 +299,12 @@ Page({
let order_inquiry_id_list = []; let order_inquiry_id_list = [];
order_inquiry_id_list.push("");//初始化一个,防止失败 order_inquiry_id_list.push("");//初始化一个,防止失败
console.log(this.data.conversationList.length) console.log(this.data.conversationList.length)
this.data.conversationList.forEach(item => { let arr=this.data.conversationList.filter(item => item.conversationID != 'C2Cadministrator');
arr.forEach(item => {
let conversationID = item.conversationID; let conversationID = item.conversationID;
console.warn("conversationID: ", conversationID) console.warn("conversationID: ", conversationID)
if(conversationID == "C2Cadministrator") return;//如果是管理员消息直接跳过 // if(conversationID == "C2Cadministrator") return;//如果是管理员消息直接跳过
let lastMessage = item.lastMessage; let lastMessage = item.lastMessage;
if(!lastMessage) return; if(!lastMessage) return;
let cloudCustomData = lastMessage.cloudCustomData; let cloudCustomData = lastMessage.cloudCustomData;
@ -320,14 +322,14 @@ Page({
let order_inquiry_id = cloudCustomDataJson.order_inquiry_id; let order_inquiry_id = cloudCustomDataJson.order_inquiry_id;
order_inquiry_id_list.push(order_inquiry_id);//准备去请求后端那订单状态 order_inquiry_id_list.push(order_inquiry_id);//准备去请求后端那订单状态
}) })
let conversationList = this.data.conversationList; let conversationList = arr; //this.data.conversationList;
//获取医生问诊消息用户属性 //获取医生问诊消息用户属性
api.getDoctorInquiryMessageAttr({order_inquiry_ids: order_inquiry_id_list.join(",")}).then(response => { api.getDoctorInquiryMessageAttr({order_inquiry_ids: order_inquiry_id_list.join(",")}).then(response => {
let new_conversationList = []; let new_conversationList = [];
if(response.data.length > 0){ if(response.data.length > 0){
conversationList.forEach(item => { conversationList.forEach(item => {
let conversationID = item.conversationID; let conversationID = item.conversationID;
if(conversationID == "C2Cadministrator") return;//如果是管理员消息直接跳过 //if(conversationID == "C2Cadministrator") return;//如果是管理员消息直接跳过
let lastMessage = item.lastMessage; let lastMessage = item.lastMessage;
if(!lastMessage) return; if(!lastMessage) return;
let cloudCustomData = lastMessage.cloudCustomData; let cloudCustomData = lastMessage.cloudCustomData;
@ -359,7 +361,7 @@ Page({
new_conversationList.push(item); new_conversationList.push(item);
}) })
}; };
//console.log(new_conversationList); console.log(new_conversationList);
this.setData({ this.setData({
conversationList: new_conversationList conversationList: new_conversationList
}) })
@ -576,7 +578,8 @@ Page({
current_page:0, current_page:0,
data_list_6:[] data_list_6:[]
}) })
this.getDoctorInquiryFinishMessage(); //点击请求数据为0则重新渲染页面
this.getDoctorInquiryFinishMessage('end');
} }
}, },
vanTabsChange(e){ vanTabsChange(e){
@ -600,13 +603,14 @@ Page({
} }
} }
}, },
getDoctorInquiryFinishMessage(){ getDoctorInquiryFinishMessage(from=''){
let data_list_6= this.data.data_list_6; let data_list_6= this.data.data_list_6;
let params = {}; let params = {};
params.page = this.data.current_page + 1; params.page = this.data.current_page + 1;
this.setData({data_list_6_loading: true}) this.setData({data_list_6_loading: true})
api.getDoctorInquiryFinishMessage(params).then(response => { api.getDoctorInquiryFinishMessage(params).then(response => {
// console.log(response); // console.log(response);
this.setData({ this.setData({
"data_list_6": data_list_6.concat(response.data.data), "data_list_6": data_list_6.concat(response.data.data),
current_page: response.data.current_page, current_page: response.data.current_page,
@ -614,6 +618,9 @@ Page({
per_page: response.data.per_page, per_page: response.data.per_page,
last_page: response.data.last_page last_page: response.data.last_page
}) })
if(from && response.data.data.length==0){
this.formatStatus();
}
// this.selectComponent('#tabs').resize(); // this.selectComponent('#tabs').resize();
}).then(res =>{ }).then(res =>{
this.setData({ data_list_6_loading: false}) this.setData({ data_list_6_loading: false})

View File

@ -404,6 +404,7 @@
<van-divider contentPosition="center" wx:if="{{data_list_6.length > 0 && current_page == last_page}}">到底了~</van-divider> <van-divider contentPosition="center" wx:if="{{data_list_6.length > 0 && current_page == last_page}}">到底了~</van-divider>
</van-tab> </van-tab>
</van-tabs> </van-tabs>
</view> </view>
<view style="height: 200rpx;"></view> <view style="height: 200rpx;"></view>

View File

@ -1,4 +1,8 @@
{ {
"component": true, "component": true,
"usingComponents": {} "usingComponents": {
"van-image": "@vant/weapp/image/index",
"van-loading": "@vant/weapp/loading/index"
}
} }

View File

@ -1,5 +1,12 @@
<view class="TUI-ImageMessage" bindtap="previewImage"> <view class="TUI-ImageMessage" bindtap="previewImage">
<image class="image-message {{isMine?'my-image':''}}" mode="aspectFill" src="{{renderDom[0].src}}" /> <!-- <image class="image-message {{isMine?'my-image':''}}" mode="aspectFill" src="{{renderDom[0].src}}" /> -->
<image wx:if="{{showSave}}" class="image-message {{isMine?'my-image':''}}" mode="aspectFill" src="{{renderDom[0].src}}" show-menu-by-longpress="{{true}}"/>
<!-- <image wx:if="{{showSave}}" class="image-message {{isMine?'my-image':''}}" mode="aspectFill" src="{{renderDom[0].src}}" show-menu-by-longpress="{{true}}"/> -->
<van-image use-loading-slot fit="cover" class="image-message {{isMine?'my-image':''}}" width="100%" height="100" src="{{renderDom[0].src}}" radius="6px">
<van-loading slot="loading" type="spinner" size="20" vertical />
</van-image>
<van-image wx:if="{{showSave}}" use-loading-slot fit="cover" class="image-message {{isMine?'my-image':''}}" width="100%" height="100" src="{{renderDom[0].src}}" radius="6px" show-menu-by-longpress="{{true}}">
<van-loading slot="loading" type="spinner" size="20" vertical />
</van-image>
</view> </view>

View File

@ -152,6 +152,7 @@ Component({
// wx.showToast({ // wx.showToast({
// title: '网络类型:'+res.networkType, // title: '网络类型:'+res.networkType,
// }) // })
_this.setData({ _this.setData({
networkstatus: res.networkType networkstatus: res.networkType
}) })

View File

@ -124,7 +124,20 @@ Component({
finsh_btn: false finsh_btn: false
}) })
wx.onNetworkStatusChange((res) => {
let msg = ''
if (!res.isConnected) {
msg = '当前网络不可用,请检查你的网络设置'
} else if (res.networkType === 'none') {
msg = '网络开小差了,请在网络良好后重试'
}
if (msg) {
wx.showToast({
title: msg,
icon: 'none',
})
}
})
} }
}, },
@ -280,6 +293,7 @@ Component({
}).catch(errors => { }).catch(errors => {
console.error(errors); console.error(errors);
this.setData({ this.setData({
message_rounds:this.data.total_rounds,
finsh_btn: false finsh_btn: false
}) })
}) })