优化
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import logger from '../../../../utils/logger';
|
||||
import constant from '../../../../utils/constant';
|
||||
import { API } from '../../../../../utils/network/api';
|
||||
import { requestSubscribeMessage } from '../../../../../utils/requestSubscribeUtil';
|
||||
|
||||
const api = new API()
|
||||
let app = getApp()
|
||||
@@ -79,7 +80,7 @@ Component({
|
||||
notShow: false,
|
||||
isShow: true,
|
||||
commonFunction: [
|
||||
{ name: '查看完整病例', key: '10' },
|
||||
{ name: '查看完整病历', key: '10' },
|
||||
{ name: '在线开处方', key: '11' },
|
||||
],
|
||||
displayServiceEvaluation: false,
|
||||
@@ -95,6 +96,7 @@ Component({
|
||||
showChangYongYu: false,
|
||||
ChangYongYu: [],
|
||||
dialog_visible: false,
|
||||
sub_visible: false,
|
||||
dialog_message: "在线开处方需先进行多点执业认证",
|
||||
message_rounds: 0,
|
||||
networkstatus: "wifi"
|
||||
@@ -456,7 +458,7 @@ Component({
|
||||
},
|
||||
|
||||
handleCommonFunctions(e) {
|
||||
// console.log("handleCommonFunctions: ", e)
|
||||
console.log("handleCommonFunctions: ", e)
|
||||
switch (e.target.dataset.key) {
|
||||
case '0':
|
||||
this.setData({
|
||||
@@ -478,26 +480,19 @@ Component({
|
||||
break;
|
||||
case '11'://在线开方
|
||||
let _this = this;
|
||||
// console.log("开始订阅消息");
|
||||
wx.requestSubscribeMessage({
|
||||
tmplIds: ['kUy70xHlr7ADo4aIHiictM4Te7MSec3E5kHsYvFQu40'],
|
||||
success (res) {
|
||||
// console.log(res);
|
||||
let order_inquiry_id = _this.data.order_inquiry_id
|
||||
api.getDoctorPrescriptionCheck({order_inquiry_id: order_inquiry_id}).then(response => {
|
||||
let status = response.data.status
|
||||
if(status == 1){
|
||||
app.go("/Pages/yishi/onlinechufang/index?order_inquiry_id="+order_inquiry_id)
|
||||
}else{
|
||||
_this.setData({
|
||||
dialog_visible: true,
|
||||
dialog_message: response.data.message
|
||||
})
|
||||
}
|
||||
}).catch(errors => {
|
||||
console.error(errors);
|
||||
console.log("开始订阅消息");
|
||||
let tmplIds = ['kUy70xHlr7ADo4aIHiictM4Te7MSec3E5kHsYvFQu40']
|
||||
let sub_promise = requestSubscribeMessage(tmplIds)
|
||||
sub_promise.then(res => {
|
||||
console.log("订阅成功")
|
||||
this.goCase()
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
let errCode = err.errCode
|
||||
if(errCode == 20004){
|
||||
_this.setData({
|
||||
sub_visible: true,
|
||||
})
|
||||
|
||||
}
|
||||
})
|
||||
break;
|
||||
@@ -505,6 +500,23 @@ Component({
|
||||
break;
|
||||
}
|
||||
},
|
||||
goCase(){
|
||||
|
||||
let order_inquiry_id = this.data.order_inquiry_id
|
||||
api.getDoctorPrescriptionCheck({order_inquiry_id: order_inquiry_id}).then(response => {
|
||||
let status = response.data.status
|
||||
if(status == 1){
|
||||
app.go("/Pages/yishi/onlinechufang/index?order_inquiry_id="+order_inquiry_id)
|
||||
}else{
|
||||
this.setData({
|
||||
dialog_visible: true,
|
||||
dialog_message: response.data.message
|
||||
})
|
||||
}
|
||||
}).catch(errors => {
|
||||
console.error(errors);
|
||||
})
|
||||
},
|
||||
cancelDialog(){
|
||||
this.setData({
|
||||
dialog_visible: false
|
||||
@@ -516,6 +528,22 @@ Component({
|
||||
dialog_visible: false
|
||||
})
|
||||
},
|
||||
subcancelDialog(){
|
||||
this.setData({
|
||||
sub_visible: false
|
||||
})
|
||||
this.goCase()
|
||||
},
|
||||
subconfirmDialog(){
|
||||
this.setData({
|
||||
sub_visible: false
|
||||
})
|
||||
wx.openSetting({
|
||||
success (res) {
|
||||
console.log(res.authSetting)
|
||||
}
|
||||
})
|
||||
},
|
||||
handleSendOrder() {
|
||||
this.setData({
|
||||
displayOrderList: true,
|
||||
@@ -849,7 +877,11 @@ Component({
|
||||
event,
|
||||
});
|
||||
},
|
||||
|
||||
inputBindLinechange(event){
|
||||
this.triggerEvent('inputBindLinechange', {
|
||||
event,
|
||||
});
|
||||
},
|
||||
$handleSendTextMessage(event) {
|
||||
this.sendTextMessage(event.detail.message, true);
|
||||
this.setData({
|
||||
|
||||
@@ -1,18 +1,20 @@
|
||||
<view class="TUI-message-input-container">
|
||||
<view class="TUI-commom-function">
|
||||
<view class="TUI-commom-function-item" data-key="10" bindtap="handleCommonFunctions">查看完整病例</view>
|
||||
<view class="TUI-commom-function-item" data-key="10" bindtap="handleCommonFunctions">查看完整病历</view>
|
||||
<view class="TUI-commom-function-item" data-key="11" bindtap="handleCommonFunctions" wx:if="{{baseInfo.multi_point_status == 1}}">在线开处方</view>
|
||||
</view>
|
||||
<view class="TUI-message-input">
|
||||
<image class="TUI-icon" bindtap="switchAudio" wx:if="{{has_audio}}"
|
||||
src="{{isAudio ? '../../../../static/assets/keyboard.svg' : '../../../../static/assets/audio.svg'}}" />
|
||||
<view wx:if="{{!isAudio || isEmoji}}" class="TUI-message-input-main {{ focus && 'TUI-message-input-main-focus'}}" >
|
||||
<textarea hold-keyboard id="mytextarea" class="TUI-message-input-area" adjust-position="{{false}}" cursor-spacing="0"
|
||||
<textarea focus="{{false}}" hold-keyboard id="mytextarea" class="TUI-message-input-area" adjust-position="{{false}}" cursor-spacing="0"
|
||||
value="{{message}}" bindinput="onInputValueChange" maxlength="-1" type="text" auto-height="{{true}}"
|
||||
placeholder="请输入文字" placeholder-class="input-placeholder" confirm-type="return" show-confirm-bar="{{false}}"
|
||||
bindfocus="inputBindFocus"
|
||||
bindblur="inputBindBlur"
|
||||
bindconfirm="sendTextMessage"/>
|
||||
bindconfirm="sendTextMessage"
|
||||
bindlinechange="inputBindLinechange"
|
||||
/>
|
||||
</view>
|
||||
<view wx:if="{{isAudio}}" class="TUI-message-input-main"
|
||||
bind:longpress="handleLongPress"
|
||||
@@ -114,3 +116,16 @@
|
||||
确定
|
||||
</view>
|
||||
</t-dialog>
|
||||
|
||||
<t-dialog
|
||||
visible="{{ sub_visible }}"
|
||||
title="温馨提示"
|
||||
content="您已关闭订阅消息通知,请点击“确认”按钮在设置中打开订阅通知。"
|
||||
>
|
||||
<view slot="cancel-btn" class="dialog dialog_cancel_btn" bindtap="subcancelDialog">
|
||||
取消
|
||||
</view>
|
||||
<view slot="confirm-btn" class="dialog dialog_confirm_btn" bindtap="subconfirmDialog">
|
||||
确定
|
||||
</view>
|
||||
</t-dialog>
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
}
|
||||
.TUI-message-input-area {
|
||||
width: 100%;
|
||||
max-height: 300rpx;
|
||||
max-height: 100px;
|
||||
/* 最多显示10行 */
|
||||
line-height: 30rpx;
|
||||
overflow: scroll;
|
||||
|
||||
@@ -162,6 +162,7 @@ Component({
|
||||
this.setData({
|
||||
isCompleted: true,
|
||||
triggered: false,
|
||||
list_first_loading: false
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -293,8 +294,10 @@ Component({
|
||||
if(Number(customMessage.message_type) == GDXZ_CUSTOM_MSEEAGE.TRABECULA && refreshBaseInfo){
|
||||
const title = customMessage.title
|
||||
if(title.indexOf("问诊已结束") > -1){
|
||||
//收到横条消息去触发父组件getbase方法
|
||||
this.triggerEvent('getInquiryMessageBasic');
|
||||
setTimeout(() => {
|
||||
//收到横条消息去触发父组件getbase方法,演示1秒
|
||||
this.triggerEvent('getInquiryMessageBasic');
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import logger from '../../utils/logger';
|
||||
import constant from '../../utils/constant';
|
||||
import { API } from './../../../utils/network/api'
|
||||
import { rpxTopx } from './../../../utils/util'
|
||||
const api = new API()
|
||||
// eslint-disable-next-line no-undef
|
||||
const app = getApp();
|
||||
@@ -79,14 +80,19 @@ Component({
|
||||
message_rounds: 0
|
||||
});
|
||||
}
|
||||
//console.log("000")
|
||||
this.getNavbarHeight()
|
||||
wx.onKeyboardHeightChange(res => {
|
||||
// console.log("键盘高度:", res.height)
|
||||
this.setData({
|
||||
keysboards_height: res.height
|
||||
})
|
||||
this.getNavbarHeight();
|
||||
})
|
||||
|
||||
// let _this = this
|
||||
// wx.onKeyboardHeightChange(res => {
|
||||
// let kb_height = res.height
|
||||
// console.log("键盘高度:", kb_height)
|
||||
// _this.setData({
|
||||
// kb_height: kb_height
|
||||
// })
|
||||
// console.log("111")
|
||||
// _this.getNavbarHeight();
|
||||
// })
|
||||
},
|
||||
|
||||
ready() {
|
||||
@@ -103,6 +109,12 @@ Component({
|
||||
"navbarData.showCapsule": 3
|
||||
})
|
||||
}
|
||||
this.setData({
|
||||
finsh_btn: false
|
||||
})
|
||||
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
/**
|
||||
@@ -137,11 +149,14 @@ Component({
|
||||
showCapsule: 2, //是否显示左上角图标 1表示显示 0表示不显示
|
||||
title: '', //导航栏 中间的标题
|
||||
},
|
||||
navbar_height: 0,
|
||||
navbar_height: 120,
|
||||
dialog_visible: false,
|
||||
finsh_btn: false,
|
||||
KeysBoardsStatus: "down",
|
||||
message_rounds: 0,
|
||||
keysboards_height: 0
|
||||
keysboards_height: 0,
|
||||
kb_height: 0,
|
||||
change_kb: false
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -157,6 +172,9 @@ Component({
|
||||
})
|
||||
},
|
||||
getNavbarHeight(addHeight){
|
||||
|
||||
try {
|
||||
//console.log("getNavbarHeight: ", new Date().getTime())
|
||||
let rect = null;
|
||||
if (wx.getMenuButtonBoundingClientRect) {
|
||||
rect = wx.getMenuButtonBoundingClientRect();
|
||||
@@ -164,32 +182,55 @@ Component({
|
||||
// console.log("rect: ", rect)
|
||||
wx.getSystemInfo({
|
||||
success: (res) => {
|
||||
const { statusBarHeight } = wx.getSystemInfoSync();
|
||||
// const { statusBarHeight } = wx.getSystemInfoSync();
|
||||
// console.log("statusBarHeight: ", statusBarHeight);
|
||||
// console.log("${rect.height}px: ", `${rect.height}`);
|
||||
let height = Number.parseInt(statusBarHeight) + Number.parseInt(`${rect.height}`) + 50;
|
||||
if(addHeight){
|
||||
let height = Number.parseInt(res.statusBarHeight) + Number.parseInt(`${rect.height}`);
|
||||
|
||||
let KeysBoardsStatus = this.data.KeysBoardsStatus
|
||||
if(KeysBoardsStatus == 'pull'){
|
||||
height = height + rpxTopx(35)
|
||||
}else{
|
||||
height = height + rpxTopx(70)
|
||||
}
|
||||
if(addHeight > 0){
|
||||
height = height + addHeight
|
||||
}
|
||||
let keysboards_height = this.data.keysboards_height
|
||||
// console.log("getNavbarHeight 键盘高度:", keysboards_height)
|
||||
if(keysboards_height){
|
||||
height = height + keysboards_height
|
||||
let kb_height = Number.parseInt(this.data.kb_height)
|
||||
let textarea_height = Number.parseInt(this.data.textarea_height)
|
||||
//console.log("getNavbarHeight 键盘高度:", kb_height)
|
||||
if(kb_height > 0){
|
||||
//console.log("height 1: ", height)
|
||||
height = height + kb_height
|
||||
//console.log("height 2: ", height)
|
||||
}
|
||||
if(textarea_height > 0){
|
||||
//console.log("height 1: ", height)
|
||||
height = height + textarea_height
|
||||
//console.log("height 2: ", height)
|
||||
}
|
||||
|
||||
this.setData({
|
||||
navbar_height: height
|
||||
})
|
||||
//console.log(444)
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('navbar 获取系统信息失败', err);
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
//结束问诊
|
||||
putDoctorInquiryFinish() {
|
||||
this.setData({
|
||||
dialog_visible: true
|
||||
})
|
||||
wx.hideKeyboard()
|
||||
},
|
||||
cancelDialog(){
|
||||
this.setData({
|
||||
@@ -197,12 +238,25 @@ Component({
|
||||
})
|
||||
},
|
||||
confirmDialog(){
|
||||
let finsh_btn = this.data.finsh_btn
|
||||
if(finsh_btn){
|
||||
return
|
||||
}
|
||||
this.setData({
|
||||
finsh_btn: true
|
||||
})
|
||||
api.putDoctorInquiryFinish({order_inquiry_id: this.data.order_inquiry_id}).then(response => {
|
||||
// console.log(response);
|
||||
this.getInquiryMessageBasic();
|
||||
// this.getInquiryMessageBasic();
|
||||
//调用子组件中的跳到最新消息
|
||||
this.getNavbarHeight()
|
||||
this.selectComponent('#MessageList').handleJumpNewMessage();
|
||||
}).catch(errors => {console.error(errors);})
|
||||
}).catch(errors => {
|
||||
console.error(errors);
|
||||
this.setData({
|
||||
finsh_btn: false
|
||||
})
|
||||
})
|
||||
this.setData({
|
||||
dialog_visible: false
|
||||
})
|
||||
@@ -215,6 +269,10 @@ Component({
|
||||
this.setData({
|
||||
baseInfo: response.data,
|
||||
})
|
||||
if(response.data.inquiry_status > 4){
|
||||
wx.hideKeyboard()
|
||||
this.getNavbarHeight()
|
||||
}
|
||||
}).catch(errors => {console.error(errors);})
|
||||
},
|
||||
init() {
|
||||
@@ -261,14 +319,14 @@ Component({
|
||||
this.getNavbarHeight();
|
||||
},
|
||||
refreshMessageStatus(message) {
|
||||
console.log("TUIchat refreshMessageStatus", message)
|
||||
//console.log("TUIchat refreshMessageStatus", message)
|
||||
this.selectComponent('#MessageList').refreshMessageStatus(message);
|
||||
},
|
||||
showMessageErrorImage(event) {
|
||||
this.selectComponent('#MessageList').sendMessageError(event);
|
||||
},
|
||||
triggerClose() {
|
||||
// console.log("message-list triggerClose")
|
||||
//console.log("message-list triggerClose")
|
||||
if(this.data.baseInfo.inquiry_status == 4){
|
||||
this.selectComponent('#MessageInput').handleClose();
|
||||
}
|
||||
@@ -305,13 +363,13 @@ Component({
|
||||
this.selectComponent('#MessageInput').onInputValueChange(event);
|
||||
},
|
||||
myhandleExtensions(e){
|
||||
// console.log("myhandleExtensionsmyhandleExtensions: ", e);
|
||||
//console.log("myhandleExtensionsmyhandleExtensions: ", e);
|
||||
wx.hideKeyboard()
|
||||
let displayFlag = e.detail.displayFlag;
|
||||
setTimeout(() => {
|
||||
// setTimeout(() => {
|
||||
if(displayFlag){
|
||||
this.setData({
|
||||
input_area_style: "position: absolute; bottom: 30px;"
|
||||
input_area_style: "position: absolute; bottom: 20px;"
|
||||
})
|
||||
this.getNavbarHeight(100);
|
||||
this.selectComponent('#MessageList').handleJumpNewMessage();
|
||||
@@ -321,39 +379,66 @@ Component({
|
||||
})
|
||||
this.getNavbarHeight();
|
||||
}
|
||||
}, 100);
|
||||
// }, 100);
|
||||
},
|
||||
// 监听键盘,获取焦点时将输入框推到键盘上方
|
||||
pullKeysBoards(event) {
|
||||
// console.log("pullKeysBoardspullKeysBoards")
|
||||
setNewInputStyle(event.detail.event.detail.height);
|
||||
//console.log("pullKeysBoardspullKeysBoards")
|
||||
let value = event.detail.event.detail.value;
|
||||
let height = event.detail.event.detail.height;
|
||||
|
||||
this.getNavbarHeight();
|
||||
//console.log("pullKeysBoards value: ", height)
|
||||
setNewInputStyle(height);
|
||||
if(height){
|
||||
this.setData({
|
||||
kb_height: height
|
||||
})
|
||||
}
|
||||
//console.log("333")
|
||||
this.setData({
|
||||
'viewData.style': newInputStyle,
|
||||
input_area_style: "position: absolute; bottom: 52rpx;",
|
||||
// input_area_style: "position: absolute; bottom: 52rpx;",
|
||||
KeysBoardsStatus: "pull"
|
||||
});
|
||||
this.getNavbarHeight();
|
||||
this.selectComponent('#MessageList').handleJumpNewMessage();
|
||||
|
||||
},
|
||||
// 监听键盘,失去焦点时收起键盘
|
||||
downKeysBoards(event) {
|
||||
// console.log("downKeysBoardsdownKeysBoards")
|
||||
// console.log(event)
|
||||
//console.log("downKeysBoardsdownKeysBoards")
|
||||
// //console.log(event)
|
||||
let value = event.detail.event.detail.value;
|
||||
this.getNavbarHeight();
|
||||
//console.log("downKeysBoards value: ", value)
|
||||
if(value){
|
||||
this.setData({
|
||||
'viewData.style': inputStyle,
|
||||
KeysBoardsStatus: "down"
|
||||
KeysBoardsStatus: "down",
|
||||
kb_height: 0
|
||||
});
|
||||
}else{
|
||||
this.setData({
|
||||
'viewData.style': inputStyle,
|
||||
input_area_style: "",
|
||||
KeysBoardsStatus: "down"
|
||||
KeysBoardsStatus: "down",
|
||||
kb_height: 0
|
||||
});
|
||||
}
|
||||
//console.log("444")
|
||||
this.getNavbarHeight();
|
||||
},
|
||||
inputBindLinechange(event){
|
||||
console.log(event)
|
||||
let lineCount = event.detail.event.detail.lineCount;
|
||||
let height = event.detail.event.detail.height;
|
||||
if(height > 100){
|
||||
return
|
||||
}
|
||||
let lineHeight = height / lineCount;
|
||||
this.setData({
|
||||
textarea_height: lineHeight * (lineCount - 1)
|
||||
})
|
||||
this.getNavbarHeight();
|
||||
},
|
||||
typing(event) {
|
||||
const { STRING_TEXT, FEAT_NATIVE_CODE } = constant;
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
<!--TUIKit-WChat/Chat/index.wxml-->
|
||||
<te-nav-bar navbar-data='{{navbarData}}' ></te-nav-bar>
|
||||
<view class="container">
|
||||
<view class="info" wx:if="{{ true }}">
|
||||
<view class="left">
|
||||
<view class="name">{{baseInfo.patient_family_name}}</view>
|
||||
<view class="age">{{baseInfo.patient_family_sex==1?'男':'女'}}|{{baseInfo.patient_family_age}}岁</view>
|
||||
<view class="status {{baseInfo.inquiry_status==5?'status_complete':''}}">{{baseInfo.inquiry_status==1?'待支付':baseInfo.inquiry_status==2?'待分配':baseInfo.inquiry_status==3?'待接诊':baseInfo.inquiry_status==4?'接诊中':baseInfo.inquiry_status==5?'问诊完成':baseInfo.inquiry_status==6?'已结束':baseInfo.inquiry_status==7?'已取消':'未知'}}</view>
|
||||
<view class="info" wx:if="{{ baseInfo.inquiry_status > 0 }}">
|
||||
<view class="left" >
|
||||
<view class="name">{{baseInfo.patient_family_name}}</view>
|
||||
<view class="age">{{baseInfo.patient_family_sex==1?'男':'女'}}|{{baseInfo.patient_family_age}}岁</view>
|
||||
<view class="status {{baseInfo.inquiry_status==5?'status_complete':''}}">{{baseInfo.inquiry_status==1?'待支付':baseInfo.inquiry_status==2?'待分配':baseInfo.inquiry_status==3?'待接诊':baseInfo.inquiry_status==4?'接诊中':baseInfo.inquiry_status==5?'问诊完成':baseInfo.inquiry_status==6?'已结束':baseInfo.inquiry_status==7?'已取消':'未知'}}</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<text class="right_txt" bindtap="putDoctorInquiryFinish" wx:if="{{baseInfo.inquiry_status==4}}">结束问诊</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<text class="right_txt" bindtap="putDoctorInquiryFinish" wx:if="{{baseInfo.inquiry_status==4}}">结束问诊</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- <view class="tui-navigatorbar">
|
||||
<image class="tui-navigatorbar-back" bindtap="goBack" src="../../static/assets/ic_back_black.svg" />
|
||||
@@ -37,6 +37,7 @@
|
||||
<view class="message-input" style="{{viewData.style}}" wx:if="{{showChat}}">
|
||||
<MessageInput bind:myhandleExtensions="myhandleExtensions" id="MessageInput" inquiry_type="{{inquiry_type}}" baseInfo="{{baseInfo}}" order_inquiry_id="{{order_inquiry_id}}" conversation="{{conversation}}" hasCallKit="{{hasCallKit}}" bind:sendMessage="sendMessage" bind:downKeysBoards="downKeysBoards" bind:pullKeysBoards="pullKeysBoards" bind:showMessageErrorImage="showMessageErrorImage"
|
||||
bind:refreshMessageStatus="refreshMessageStatus"
|
||||
bind:inputBindLinechange="inputBindLinechange"
|
||||
bind:handleCall="handleCall" message_rounds="{{message_rounds}}"></MessageInput>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
Reference in New Issue
Block a user