分包医生
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
import { API } from './../../../utils/network/api'
|
||||
const api = new API()
|
||||
const app = getApp()
|
||||
Page({
|
||||
data: {
|
||||
title: '',
|
||||
height: app.globalData.height,
|
||||
order_inquiry_id: "",
|
||||
from:'',
|
||||
baseInfo: {}
|
||||
},
|
||||
onLoad(option) {
|
||||
// console.log("chat onload", option);
|
||||
let order_inquiry_id = option.order_inquiry_id;
|
||||
let from=option.from;
|
||||
this.setData({
|
||||
order_inquiry_id: order_inquiry_id,
|
||||
from:from?from:''
|
||||
})
|
||||
this.getInquiryMessageBasic();
|
||||
},
|
||||
onUnload() {
|
||||
// console.log("chat onUnload");
|
||||
},
|
||||
onShow(){
|
||||
// console.log("chat onShow");
|
||||
// console.log("app.globalData.scene from chat: ", app.globalData.scene);
|
||||
},
|
||||
$onMessageReceived(value) {
|
||||
const message = value.data[0];
|
||||
// console.log("message from chat: ",message)
|
||||
},
|
||||
initChat(){
|
||||
let _this = this;
|
||||
let count = 0;
|
||||
let interval = setInterval(() => {
|
||||
// console.log("chat init count: ", count);
|
||||
// console.log("app.globalData.chat_sdk_ready: ", app.globalData.chat_sdk_ready);
|
||||
if(app.globalData.chat_sdk_ready){
|
||||
const TUIChat = _this.selectComponent('#TUIChat');
|
||||
TUIChat.init();
|
||||
// wx.$TUIKit.on(wx.$TUIKitTIM.EVENT.MESSAGE_RECEIVED, _this.$onMessageReceived, _this);
|
||||
clearInterval(interval);
|
||||
}
|
||||
count = count + 1;
|
||||
if(count > 5){//如果尝试5次不成功就去主动调用IM初始化
|
||||
app.imInit();
|
||||
count = 0;
|
||||
}
|
||||
}, 1000);
|
||||
},
|
||||
//获取问诊订单消息内页基础数据
|
||||
getInquiryMessageBasic() {
|
||||
// console.log("order_inquiry_id: ", this.data.order_inquiry_id);
|
||||
api.getInquiryMessageBasic({order_inquiry_id: this.data.order_inquiry_id}).then(response => {
|
||||
// console.log(response);
|
||||
this.setData({
|
||||
baseInfo: response.data
|
||||
})
|
||||
let promise=wx.$TUIKit.getUserProfile({
|
||||
userIDList: [response.data.patient_user_id]
|
||||
});
|
||||
promise.then(function(imResponse) {
|
||||
wx.setStorageSync('patient_avatar',imResponse.data[0].avatar);
|
||||
}).catch(function(imError) {
|
||||
console.warn('getUserProfile error:', imError); // 获取其他用户资料失败的相关信息
|
||||
});
|
||||
}).then(res => {
|
||||
this.initChat();
|
||||
}).catch(errors => {console.error(errors);})
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
|
||||
},
|
||||
"navigationStyle": "custom",
|
||||
"disableScroll":true
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<!-- 一对一聊天 不带会话列表 -->
|
||||
<view>
|
||||
<TUIChat id="TUIChat" currentConversationID="C2C{{baseInfo.patient_user_id}}" inquiry_type="{{baseInfo.inquiry_type}}" order_inquiry_id="{{order_inquiry_id}}" baseInfo="{{baseInfo}}"
|
||||
hasCallKit="{{ true }}" from="{{from}}" bind:handleCall="handleCall"></TUIChat>
|
||||
</view>
|
||||
@@ -0,0 +1,5 @@
|
||||
.container{
|
||||
background-color: #F4F4F4;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
}
|
||||
Reference in New Issue
Block a user