更新小程序仓库
This commit is contained in:
@@ -0,0 +1,216 @@
|
||||
// pages/message/message.js
|
||||
const app = getApp();
|
||||
import {lastSysMsg} from "../../api/msg"
|
||||
import {throttle,setBarData} from "../../utils/util"
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
systemMsg:{},
|
||||
show:false,
|
||||
isTriggered:false,
|
||||
isLock:false,
|
||||
currentConversationID:"",
|
||||
conversationUnread:0,
|
||||
conversationList:[],
|
||||
img_host:'https://oss.prod.applets.igandanyiyuan.com/applet/patient/static'
|
||||
},
|
||||
confirm:throttle(function(event){
|
||||
if(event.detail){
|
||||
this.delConversation(this.data.currentConversationID);
|
||||
}
|
||||
}),
|
||||
handleLastSysMsg(){
|
||||
// wx.showLoading({
|
||||
// title: '加载中',
|
||||
// mask: true
|
||||
// });
|
||||
lastSysMsg().then(data=>{
|
||||
this.setData({
|
||||
systemMsg:data,
|
||||
isTriggered:false
|
||||
})
|
||||
// let total=app.globalData.chatNumber+app.globalData.sysNumber;
|
||||
// setBarData(total)
|
||||
//let msg=data.count;
|
||||
this.getConversationList(data.count)
|
||||
|
||||
})
|
||||
},
|
||||
handleConfirm(event){
|
||||
let currentConversationID=event.currentTarget.dataset.id;
|
||||
let count=event.currentTarget.dataset.count;
|
||||
this.setData({
|
||||
show:true,
|
||||
conversationUnread:count,
|
||||
currentConversationID:currentConversationID
|
||||
})
|
||||
|
||||
},
|
||||
watchBack(){
|
||||
// this.setData({
|
||||
// conversationList:conversationList
|
||||
// })
|
||||
// setBarData(app.globalData.totalUnread);
|
||||
this.handleLastSysMsg();
|
||||
},
|
||||
delConversation(id){
|
||||
let promise=wx.$TUIKit.deleteConversation({conversationIDList:[id], clearHistoryMessage:false });
|
||||
promise.then(data=>{
|
||||
let conversationList=app.globalData.conversationList;
|
||||
for (let i = 0; i < conversationList.length; i++) {
|
||||
if(conversationList[i].conversationID==id){
|
||||
conversationList.splice(i,1);
|
||||
app.globalData.conversationList=conversationList;
|
||||
this.setData({
|
||||
conversationList:conversationList
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}).catch((imError)=>{
|
||||
console.warn('deleteConversation error:', imError); // 删除会话失败的相关信息
|
||||
});
|
||||
},
|
||||
formatData(read){
|
||||
let totalNum=Number(app.globalData.totalNumber);
|
||||
let total=totalNum-Number(read);
|
||||
app.globalData.totalNumber=total;
|
||||
if(total>0){
|
||||
if(total<=99){
|
||||
wx.setTabBarBadge({
|
||||
index:1,
|
||||
text: total.toString()
|
||||
})
|
||||
}else{
|
||||
wx.setTabBarBadge({
|
||||
index:1,
|
||||
text:"99+"
|
||||
})
|
||||
}
|
||||
}else{
|
||||
wx.removeTabBarBadge({
|
||||
index:1
|
||||
})
|
||||
}
|
||||
},
|
||||
getConversationList(msg){
|
||||
wx.$TUIKit.getConversationList().then((res)=>{
|
||||
const {conversationList}=res.data;
|
||||
console.log(conversationList)
|
||||
let list=conversationList.filter(item=>item.conversationID!='C2Cadministrator');
|
||||
app.globalData.conversationList=list;
|
||||
this.setData({
|
||||
conversationList: list
|
||||
})
|
||||
|
||||
let unread=0;
|
||||
list.forEach((item)=>{
|
||||
unread=unread+item.unreadCount;
|
||||
})
|
||||
let total=Number(msg)+Number(unread);
|
||||
app.globalData.totalUnread=total;
|
||||
setBarData(total);
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
goChat(event){
|
||||
if(!this.data.isLock){
|
||||
this.setData({
|
||||
isLock:true
|
||||
});
|
||||
let currentConversationID=event.currentTarget.dataset.chatid;
|
||||
try {
|
||||
let custom=JSON.parse(event.currentTarget.dataset.custom);
|
||||
app.method.navigateTo({
|
||||
url: '/TUIService/pages/index?currentConversationID='+currentConversationID+'&order_inquiry_id='+custom.order_inquiry_id+'&inquiry_type='+custom.inquiry_type
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
goSysMsg(){
|
||||
app.method.navigateTo({
|
||||
url: '/pages/sysMsgDetail/sysMsgDetail',
|
||||
})
|
||||
},
|
||||
handleRefresher(){
|
||||
this.setData({
|
||||
isLock:false,
|
||||
'systemMsg.count':0
|
||||
})
|
||||
this.handleLastSysMsg();
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
wx.removeTabBarBadge({
|
||||
index:1
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
app.globalData.origion=0;
|
||||
this.setData({
|
||||
isLock:false,
|
||||
'systemMsg.count':0,
|
||||
img_host:app.hostConfig().imghost
|
||||
});
|
||||
app.watch(this.watchBack.bind(this))//注册监听
|
||||
if(!app.globalData.totalUnread && app.globalData.totalUnread!=0){
|
||||
app.imLogin();
|
||||
}else{
|
||||
this.handleLastSysMsg();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
|
||||
})
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"consult-list":"../../components/consultList/consultList",
|
||||
"dialog":"../../components/dialog/dialog"
|
||||
},
|
||||
"navigationStyle":"custom",
|
||||
"navigationBarTitleText": "肝胆相照互联网医院"
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<!--pages/message/message.wxml-->
|
||||
<wxs src="../../filters/filter.wxs" module="filters"></wxs>
|
||||
<view class="page">
|
||||
<view class="ui-navigatorbar" style="background: #FFFFFF;border-bottom: 1rpx solid #E3E4E5;">
|
||||
<view class="ui-title">消息</view>
|
||||
</view>
|
||||
<view class="toptip" bindtap="goSysMsg" >
|
||||
<image src="../../assets/images/msg_new.png" alt="" class="bell" ></image>
|
||||
<view class="msg">
|
||||
<view class="titlebox">
|
||||
<view class="title">系统消息</view>
|
||||
<view class="circle" wx:if="{{systemMsg.count==1}}"></view>
|
||||
<view class="bage" wx:elif="{{systemMsg.count>1 && filters.formatNumber(systemMsg.count)}}"> {{filters.formatNumber(systemMsg.count)}} </view>
|
||||
</view>
|
||||
<view class="tips">{{systemMsg.info.notice_brief_title}}</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<scroll-view class="scrollbox" scroll-y="true" bindrefresherrefresh="handleRefresher" refresher-triggered="{{isTriggered}}" refresher-threshold="100" refresher-enabled="true">
|
||||
<view class="nomsg" hidden="{{conversationList.length>0}}">
|
||||
<view class="topdata">
|
||||
<view class="nodata">
|
||||
<view> 暂时没有</view>
|
||||
<view> 问诊记录</view>
|
||||
</view>
|
||||
<image src="{{img_host+'/nomessage.png'}}" class="msgicon"></image>
|
||||
</view>
|
||||
<consult-list consultbox="consultwraper"></consult-list>
|
||||
</view>
|
||||
<view class="list" hidden="{{conversationList.length==0}}">
|
||||
<view class="listcell" wx:for="{{conversationList}}" wx:key="conversationID" bindtap="goChat" data-custom="{{item.lastMessage.cloudCustomData}}" data-chatid="{{item.userProfile.userID}}" data-count="{{item.unreadCount}}" hidden="{{item.lastMessage.lastTime==0}}">
|
||||
<view class="info">
|
||||
<image src="{{item.userProfile.avatar}}" class="headicon" wx:if="{{item.userProfile.avatar}}" mode="aspectFill"></image>
|
||||
<image src="{{img_host+'/doctor_avatar.png'}}" class="headicon" wx:else></image>
|
||||
<view class="right">
|
||||
<!-- 1:主任中医师 2:主任医师 3:副主任中医师 4:副主任医师 5:主治医师 6:住院医师 -->
|
||||
<view class="name">{{item.userProfile.nick}}医生
|
||||
<!-- <text wx:if="{{filters.customString(item.userProfile.profileCustomField,0)==1}}">主任中医师</text>
|
||||
<text wx:elif="{{filters.customString(item.userProfile.profileCustomField,0)==2}}">主任医师</text>
|
||||
<text wx:elif="{{filters.customString(item.userProfile.profileCustomField,0)==3}}">副主任中医师</text>
|
||||
<text wx:elif="{{filters.customString(item.userProfile.profileCustomField,0)==4}}">副主任医师</text>
|
||||
<text wx:elif="{{filters.customString(item.userProfile.profileCustomField,0)==5}}">主治医师</text>
|
||||
<text wx:elif="{{filters.customString(item.userProfile.profileCustomField,0)==6}}">住院医师</text> -->
|
||||
</view>
|
||||
<!-- <view class="hospital" wx:if="{{filters.customString(item.userProfile.profileCustomField,1)}}">{{filters.customString(item.userProfile.profileCustomField,1)}}</view> -->
|
||||
<!-- <image catchtap="handleConfirm" data-id="{{item.conversationID}}" data-count="{{item.unreadCount}}" src="https://img.applets.igandanyiyuan.com/applet/patient/static/del.png" class="del"></image> -->
|
||||
</view>
|
||||
</view>
|
||||
<view class="persontip" wx:if="{{item.lastMessage.type=='TIMTextElem'}}">{{item.lastMessage.payload.text}}</view>
|
||||
<view class="persontip" wx:elif="{{item.lastMessage.type=='TIMCustomElem'}}">{{filters.formateText(item.lastMessage.payload.data).title}}</view>
|
||||
<view class="persontip" wx:elif="{{item.lastMessage.type=='TIMImageElem'}}">图片消息</view>
|
||||
<view class="bottombox">
|
||||
<view class="nameinfo">
|
||||
|
||||
就诊人:<text class="name"> {{filters.formateText(item.lastMessage.cloudCustomData).patient_family_data.patient_name}}</text>(<text decode="true" wx:if="{{filters.formateText(item.lastMessage.cloudCustomData).patient_family_data.patient_sex==1}}">男 </text><text decode="true" wx:elif="{{filters.formateText(item.lastMessage.cloudCustomData).patient_family_data.patient_sex==2}}">女 </text><text wx:else decode="true">未知 </text>|<text decode="true"> {{filters.formateText(item.lastMessage.cloudCustomData).patient_family_data.patient_age}}岁)</text>
|
||||
</view>
|
||||
<view class="date">{{filters.transforDay(item.lastMessage.lastTime,"dateminute")}}</view>
|
||||
</view>
|
||||
<view class="circle" wx:if="{{item.unreadCount==1}}"></view>
|
||||
<view class="bage" wx:elif="{{ item.unreadCount>1 && filters.formatNumber(item.unreadCount)}}"> {{filters.formatNumber(item.unreadCount)}} </view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<dialog bind:confirm="confirm" showDialog="{{show}}" message="确定删除该会话?"></dialog>
|
||||
@@ -0,0 +1,249 @@
|
||||
/* pages/message/message.wxss */
|
||||
.page {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
background: #F2F2F2;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.scrollbox{
|
||||
margin-top: 30rpx;
|
||||
flex: 1;
|
||||
overflow-y: scroll;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
|
||||
.toptip {
|
||||
margin-top: 172rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 35rpx 32rpx 20rpx;
|
||||
background: #FFFFFF;
|
||||
box-shadow: 0px 0px 14px 2px rgba(221, 221, 221, 0.68);
|
||||
|
||||
}
|
||||
.consultwraper {
|
||||
background-color: #fff;
|
||||
margin: 0 32rpx;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
.titlebox {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
}
|
||||
.msg{
|
||||
flex:1;
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
.msg .title {
|
||||
font-size: 30rpx;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.msg .tips {
|
||||
line-height: 48rpx;
|
||||
margin-top: 10rpx;
|
||||
font-size: 26rpx;
|
||||
color: #333333;
|
||||
}
|
||||
.bell{
|
||||
width:97rpx;
|
||||
height:100rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.circle{
|
||||
width: 20rpx;
|
||||
height:20rpx;
|
||||
background: #EF4F20;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.bage {
|
||||
min-width: 17rpx;
|
||||
padding: 0 10rpx;
|
||||
height: 36rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: #fff;
|
||||
justify-content: center;
|
||||
border-radius: 30rpx;
|
||||
font-size: 26rpx;
|
||||
background: #EF4F20;
|
||||
|
||||
}
|
||||
.listcell {
|
||||
position: relative;
|
||||
padding: 40rpx 32rpx 20rpx;
|
||||
background: #fff;
|
||||
border-bottom: 1rpx solid #E7E7E7;
|
||||
}
|
||||
.listcell:last-child{
|
||||
border:none;
|
||||
}
|
||||
.right .del{
|
||||
top:0;
|
||||
position: absolute;
|
||||
right:0;
|
||||
width:32rpx;
|
||||
height:32rpx;
|
||||
}
|
||||
.headicon {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.info{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.right{
|
||||
flex:1;
|
||||
position: relative;
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
.hospital{
|
||||
margin-top: 18rpx;
|
||||
}
|
||||
.persontip{
|
||||
margin-top:20rpx;
|
||||
font-size: 28rpx;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
color: rgba(0,0,0,0.85);
|
||||
}
|
||||
.bottombox{
|
||||
margin-top: 24rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.bottombox .nameinfo{
|
||||
|
||||
flex-shrink: 0;
|
||||
word-break: break-all;
|
||||
padding:0 20rpx;
|
||||
border-radius: 27rpx;
|
||||
border: 1rpx solid #3CC7C0;
|
||||
height: 57rpx;
|
||||
display: flex;
|
||||
|
||||
align-items: center;
|
||||
border-radius: 30rpx;
|
||||
color: rgba(0,0,0,0.65);
|
||||
font-size: 24rpx;
|
||||
}
|
||||
.nameinfo .name{
|
||||
display: inline-block;
|
||||
max-width:160rpx;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.bottombox .date{
|
||||
height: 30rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
white-space: nowrap;
|
||||
color: rgba(0,0,0,0.45);
|
||||
font-size: 24rpx;
|
||||
}
|
||||
.nomsg{
|
||||
width:100%;
|
||||
}
|
||||
.topdata{
|
||||
margin:98rpx 0 84rpx 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.nodata{
|
||||
color: #999999;
|
||||
font-size: 32rpx;
|
||||
margin-left: 30rpx;
|
||||
margin-right: 18rpx;
|
||||
}
|
||||
.msgicon{
|
||||
width:479rpx;
|
||||
height:216rpx;
|
||||
}
|
||||
.price{
|
||||
color:#EF4F20;
|
||||
font-size: 34rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
.consultbox{
|
||||
margin:0 32rpx;
|
||||
background-color: #fff;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
.consultbox .btn{
|
||||
width: 160rpx;
|
||||
height: 60rpx;
|
||||
background: #3CC7C0;
|
||||
color:#fff;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: 30rpx;
|
||||
border-radius: 30rpx;
|
||||
}
|
||||
.viewwrap{
|
||||
border-bottom:1rpx solid #E7E7E7;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding:30rpx 0rpx 30rpx;
|
||||
margin:0 52rpx;
|
||||
display: flex;
|
||||
}
|
||||
.viewwrap:last-child{
|
||||
border-bottom:none;
|
||||
}
|
||||
.viewwrap .right{
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
.viewwrap .price{
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
.viewwrap .name{
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
color: #333333
|
||||
}
|
||||
.top{
|
||||
width:100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding:20rpx 0;
|
||||
}
|
||||
.top .up{
|
||||
width:40rpx;
|
||||
height:22rpx;
|
||||
}
|
||||
.leftimg{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
}
|
||||
.price .unit{
|
||||
color:#333;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.zxicon{
|
||||
width:80rpx;
|
||||
height:80rpx;
|
||||
}
|
||||
.list .bage{
|
||||
top:50%;
|
||||
transform: translateY(-50%);
|
||||
position: absolute;
|
||||
right:32rpx;
|
||||
}
|
||||
.list .circle{
|
||||
top:50%;
|
||||
transform: translateY(-50%);
|
||||
margin-right: 8rpx;
|
||||
position: absolute;
|
||||
right:32rpx;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user