优化聊天界面

This commit is contained in:
haomingming
2023-03-30 08:49:38 +08:00
parent 5ba50e4e61
commit 9859b0cbea
28 changed files with 422 additions and 124 deletions
+2 -2
View File
@@ -47,8 +47,8 @@ Page({
api.wechatMobileLogin(params).then(response => {
console.log(response);
wx.setStorageSync('AUTH_TOKEN_'+usertype, response.data.token);
wx.setStorageSync('user_id', response.data.user_id);
wx.setStorageSync('client_user_id', response.data.client_user_id);
wx.setStorageSync('user_id_'+usertype, response.data.user_id);
wx.setStorageSync('client_user_id_'+usertype, response.data.client_user_id);
app.globalData.config.userID = response.data.user_id;
app.imInit();
//跳转页面
+3 -3
View File
@@ -12,7 +12,7 @@ Page({
sms: "",
btn_msg: "获取验证码",
btn_disabled: false,
login_disabled: true,
login_disabled: false,
btn_color: "#ccc"
},
onChange(event) {
@@ -115,8 +115,8 @@ Page({
api.mobileLogin(params).then(response => {
console.log(response);
wx.setStorageSync('AUTH_TOKEN_'+usertype, response.data.token);
wx.setStorageSync('user_id', response.data.user_id);
wx.setStorageSync('client_user_id', response.data.client_user_id);
wx.setStorageSync('user_id_'+usertype, response.data.user_id);
wx.setStorageSync('client_user_id_'+usertype, response.data.client_user_id);
app.globalData.config.userID = response.data.user_id;
app.imInit();
wx.switchTab({
+2 -2
View File
@@ -36,8 +36,8 @@ Page({
if (res.confirm) {
console.log('用户点击确定')
wx.setStorageSync('AUTH_TOKEN_'+usertype, "");
wx.setStorageSync('user_id', "");
wx.setStorageSync('client_user_id', "");
wx.setStorageSync('user_id_'+usertype, "");
wx.setStorageSync('client_user_id_'+usertype, "");
app.go("/Pages/index/index");
} else if (res.cancel) {
console.log('用户点击取消')
+4 -4
View File
@@ -90,11 +90,11 @@ Page({
case_text: "请您先多点执业认证"
},
],
skeleton_loading: true,
contactKeFu: false,
jiesuan_dialog_show: false,
jiesuan_dialog_visible: false,
aa: 0
funbox_height: 100,
skeleton_loading: true
},
// 获取状态栏信息
getMenuButtonBound() {
@@ -316,8 +316,8 @@ Page({
let multi_point_status = this.data.info.multi_point_status;
//绑定结算银行卡
var is_bind_bank = this.data.info.is_bind_bank;
let userID = wx.getStorageSync('user_id');
let usertype = wx.getStorageSync('usertype');
let userID = wx.getStorageSync('user_id_'+usertype);
wx.setStorageSync(userID+'_idcard_status', idcard_status);
wx.setStorageSync(userID+'_iden_auth_status', iden_auth_status);
wx.setStorageSync(userID+'_multi_point_status', multi_point_status);
+2 -1
View File
@@ -7,6 +7,7 @@
"t-swiper": "tdesign-miniprogram/swiper/swiper",
"t-badge": "tdesign-miniprogram/badge/badge",
"t-dialog": "tdesign-miniprogram/dialog/dialog",
"van-image": "@vant/weapp/image/index"
"van-image": "@vant/weapp/image/index",
"t-skeleton": "tdesign-miniprogram/skeleton/skeleton"
}
}
+35 -14
View File
@@ -1,5 +1,3 @@
<view class="container" id="container">
<!-- 顶部背景 -->
<view class="top_bk"></view>
@@ -8,39 +6,57 @@
style="top:0;padding-top: {{stateHeight}}px;height: {{navHeight + 10}}px;line-height: {{navHeight}}px;">{{ title }}</view>
<!-- 用户信息 -->
<view class="info_box" style="margin-top: {{stateHeight+navHeight+10}}px;">
<view class="info">
<view class="info_top">
<view class="info_photo" bindtap="go" data-url="/Pages/yishi/myinfo/index">
<!-- 跳转我的信息 -->
<t-avatar alt="头像" class="avatar" size="medium" image="{{info.avatar}}" />
<t-avatar alt="头像" class="avatar" size="medium" image="{{info.avatar}}" wx:if="{{!skeleton_loading}}"/>
<!-- 骨架屏 -->
<t-skeleton theme="avatar" animation="gradient" loading="{{skeleton_loading}}" />
</view>
<view class="info_content">
<view class="info_mobile">{{info.user_name}}</view>
<view class="info_mobile" wx:if="{{!skeleton_loading}}">{{info.user_name}}</view>
<t-skeleton theme="text" row-col="{{[1]}}" animation="gradient" loading="{{skeleton_loading}}" />
</view>
<view class="info_shiming" bindtap="go" data-url="{{shiming_status_url}}">
<view class="info_shiming_status {{info.info_shiming_status}}">{{info.info_shiming_status_txt}}</view>
<view class="info_shiming_status {{info.info_shiming_status}}" wx:if="{{!skeleton_loading}}">{{info.info_shiming_status_txt}}</view>
<t-skeleton theme="text" row-col="{{[1]}}" animation="gradient" loading="{{skeleton_loading}}" />
</view>
</view>
<view class="info_wenzhen">
<view class="info_wenzhen_new" bindtap="go" data-url="/Pages/yishi/wenzhen_v2/wenzhen" data-moudle="0">新问诊:{{info.not_accepted_inquiry_num}}</view>
<view class="info_wenzhen_ing" bindtap="go" data-url="/Pages/yishi/wenzhen_v2/wenzhen" data-moudle="1">接诊中:{{info.accepting_inquiry_num}}</view>
<view class="info_wenzhen_new" wx:if="{{skeleton_loading}}">
<t-skeleton theme="text" row-col="{{[{ width: '70%' }]}}" animation="gradient" loading="{{skeleton_loading}}" />
</view>
<view class="info_wenzhen_new" bindtap="go" data-url="/Pages/yishi/wenzhen_v2/wenzhen" data-moudle="0" wx:if="{{!skeleton_loading}}">
新问诊:{{info.not_accepted_inquiry_num}}
<t-skeleton theme="text" row-col="{{[1]}}" animation="gradient" loading="{{skeleton_loading}}" />
</view>
<view class="info_wenzhen_ing" bindtap="go" data-url="/Pages/yishi/wenzhen_v2/wenzhen" data-moudle="1" wx:if="{{!skeleton_loading}}">接诊中:{{info.accepting_inquiry_num}}</view>
</view>
</view>
<view class="info_note" wx:if="{{info.show_info_note}}">
<view class="haoping info_note_item">
<view class="haoping info_note_item" wx:if="{{skeleton_loading}}">
<t-skeleton theme="text" row-col="{{[{ width: '90%' }]}}" animation="gradient" loading="{{skeleton_loading}}" />
</view>
<view class="haoping info_note_item" wx:if="{{!skeleton_loading}}">
<text class="info_note_txt">好评率</text><text class="info_note_num"> {{info.praise_rate}}%</text>
</view>
<view class="time info_note_item">
<view class="time info_note_item" wx:if="{{!skeleton_loading}}">
<text class="info_note_txt">响应时间</text><text class="info_note_num"> {{info.avg_response_time}} </text><text class="info_note_txt">分钟</text>
</view>
<view class="follow info_note_item">
<view class="follow info_note_item" wx:if="{{!skeleton_loading}}">
<text class="info_note_txt">关注数</text><text class="info_note_num"> {{info.number_of_fans}}</text>
</view>
</view>
</view>
<!-- 认证信息 -->
<view class="renzhen">
<view class="renzheng_left" bindtap="go" data-url="/Pages/yishi/identity/index">
<view class="renzheng_left" wx:if="{{skeleton_loading}}">
<t-skeleton theme="image" row-col="{{[1]}}" animation="gradient" loading="{{skeleton_loading}}" />
</view>
<view class="renzheng_left" bindtap="go" data-url="/Pages/yishi/identity/index" wx:if="{{!skeleton_loading}}">
<view class="renzheng_content_left">
<view class="renzheng_content_name">医师身份认证</view>
<view class="renzheng_content_status">
@@ -56,8 +72,10 @@
/>
</view>
</view>
<view class="renzheng_right" bindtap="gozhiye" data-url="/Pages/yishi/zhiye_identity/index">
<view class="renzheng_right" wx:if="{{skeleton_loading}}">
<t-skeleton theme="image" row-col="{{[1,1,1]}}" animation="gradient" loading="{{skeleton_loading}}" />
</view>
<view class="renzheng_right" bindtap="gozhiye" data-url="/Pages/yishi/zhiye_identity/index" wx:if="{{!skeleton_loading}}">
<view class="renzheng_content_left">
<view class="renzheng_content_name">多点执业认证</view>
<view class="renzheng_content_status">
@@ -85,6 +103,7 @@
bind:click="onTapAD"
bind:change="onChangeAD"
data-url="123"
wx:if="{{!skeleton_loading}}"
>
</t-swiper>
</view>
@@ -179,4 +198,6 @@
confirm-button-color="#3CC7C0"
confirm-button-open-type="contact"
/>
</view>
</view>
+4 -4
View File
@@ -27,8 +27,8 @@ Page({
},
});
top = wx.getMenuButtonBoundingClientRect().top - stateHeight; // 获取top值
console.log('navHeight', navHeight);
console.log('top', top);
// console.log('navHeight', navHeight);
// console.log('top', top);
this.setData({
// navHeight: navHeight + top * 2, // 导航栏高度
navHeight, // 导航栏高度
@@ -37,7 +37,7 @@ Page({
},
onShow: function () {
console.log("onshow ");
// console.log("onshow ");
if (typeof this.getTabBar === 'function' && this.getTabBar()) {
this.getTabBar().setData({
active: 2 //数字是当前页面在tabbar的索引,如我的查询页索引是2,因此这边为2,同理首页就为0,审批页面为1
@@ -46,7 +46,7 @@ Page({
this.getMenuButtonBound();
},
onLoad(){
console.log("my onLoad");
// console.log("my onLoad");
//获取个人中心数据
api.getDoctorCenter().then(response => {
this.setData({
+10 -3
View File
@@ -35,7 +35,8 @@ Page({
}).catch(errors => {console.error(errors);})
},
onShow(){
let user_id = wx.getStorageSync("user_id");
let usertype = wx.getStorageSync('usertype');
let user_id = wx.getStorageSync("user_id_"+usertype);
let is_bind_bank = wx.getStorageSync(user_id+'_is_bind_bank');
this.setData({
is_bind_bank: is_bind_bank
@@ -51,8 +52,14 @@ Page({
if (res.confirm) {
console.log('用户点击确定')
wx.setStorageSync('AUTH_TOKEN_'+usertype, "");
wx.setStorageSync('user_id', "");
wx.setStorageSync('client_user_id', "");
wx.setStorageSync('user_id_'+usertype, "");
wx.setStorageSync('client_user_id_'+usertype, "");
let promise = wx.$TUIKit.logout();
promise.then(function(imResponse) {
console.log(imResponse.data); // 登出成功
}).catch(function(imError) {
console.warn('logout error:', imError);
});
app.go("/Pages/index/index");
} else if (res.cancel) {
console.log('用户点击取消')
+36 -4
View File
@@ -19,11 +19,14 @@ Page({
conversationList: [],
message_inquiry_type: 1,
system_notice_unreadnnum: "",
service_notice_unreadnnum: ""
service_notice_unreadnnum: "",
hasOnShow: false
},
onLoad() {
console.log("wenzhen onload");
let userID = wx.getStorageSync('user_id');
let usertype = wx.getStorageSync('usertype');
let userID = wx.getStorageSync('user_id_'+usertype);
wx.$TUIKit.on(wx.$TUIKitTIM.EVENT.MESSAGE_RECEIVED, this.$onMessageReceived, this);
setInterval(() => {
let system_notice_unreadnnum = wx.getStorageSync(userID+"_system_notice_unreadnnum");
let service_notice_unreadnnum = wx.getStorageSync(userID+"_service_notice_unreadnnum");
@@ -35,13 +38,28 @@ Page({
},
onShow: function () {
console.log("onShow from wenzhen V2")
if(this.data.hasOnShow){
return;
}
if (typeof this.getTabBar === 'function' && this.getTabBar()) {
this.getTabBar().setData({
active: 1 //数字是当前页面在tabbar的索引,如我的查询页索引是2,因此这边为2,同理首页就为0,审批页面为1
})
}
this.getConversationList();
wx.$TUIKit.on(wx.$TUIKitTIM.EVENT.MESSAGE_RECEIVED, this.$onMessageReceived, this);
//避免onshow加载多次
this.setData({
hasOnShow: true
})
},
onHide(){
console.log("onHideonHide from wenzhen")
this.setData({hasOnShow: false})
},
onUnload(){
console.log("onUnload from wenzhen")
this.setData({hasOnShow: false})
// wx.$TUIKit.off(wx.$TUIKitTIM.EVENT.MESSAGE_RECEIVED, this.$onMessageReceived);
},
getConversationList(){
wx.$TUIKit.getConversationList().then((imResponse) => {
@@ -234,6 +252,11 @@ Page({
session_list.push(session_data_list_4);
session_list.push(session_data_list_5);
let usertype = wx.getStorageSync('usertype');
let userID = wx.getStorageSync('user_id_'+usertype);
let wenzhen_info = 0;
let message_inquiry_type = this.data.message_inquiry_type;
this.data.conversationList.forEach(item => {
let conversationID = item.conversationID;
if(conversationID == "C2Cadministrator") return;//如果是管理员消息直接跳过
@@ -249,8 +272,11 @@ Page({
let inquiry_type = cloudCustomDataJson.inquiry_type;
if(!inquiry_type) return;
if(inquiry_type > 4) return;
if(inquiry_type < message_inquiry_type){
message_inquiry_type = inquiry_type;
}
let patient_family_data = cloudCustomDataJson.patient_family_data;
if(!patient_family_data) return;
if(patient_family_data == undefined) return;
console.log("patient_family_data: ", patient_family_data);
let session_item = {};
session_item.inquiry_status = item.inquiry_status;//订单状态暂无
@@ -267,17 +293,23 @@ Page({
session_item.from_account = userProfile.userID;
let unreadCount = item.unreadCount;
if(unreadCount > 0){
wenzhen_info = wenzhen_info + unreadCount;
session_item.message_dot = true;
}else{
session_item.message_dot = false;
}
session_list[inquiry_type - 1].push(session_item);
})
if(wenzhen_info == 0) wenzhen_info = "";
wx.setStorageSync(userID+'_wenzhen_info', wenzhen_info);
this.setData({
data_list_1: session_data_list_1,
data_list_2: session_data_list_2,
data_list_3: session_data_list_3,
data_list_4: session_data_list_4,
message_inquiry_type: message_inquiry_type
})
if(this.data.data_list_1.length == 0 && this.data.data_list_2.length == 0 && this.data.data_list_3.length == 0 && this.data.data_list_4.length == 0 && this.data.data_list_5.length == 0){