From dd892964c9b0bf9d82fef002e82b7e22b05db98b Mon Sep 17 00:00:00 2001
From: zoujiandong <10130823232@qq.com>
Date: Thu, 14 Dec 2023 13:04:09 +0800
Subject: [PATCH] =?UTF-8?q?=E9=97=AE=E8=AF=8A=E8=A1=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../TUIChat/components/MessageInput/index.js | 65 +++++++++++++++++--
.../components/MessageInput/index.wxml | 3 +
.../components/MessageInput/index.wxss | 12 +++-
.../TUIChat/components/MessageList/index.js | 3 -
pages/inquiryForm/inquiryForm.js | 14 ++++
pages/inquiryForm/inquiryForm.wxml | 4 +-
6 files changed, 88 insertions(+), 13 deletions(-)
diff --git a/TUIService/TUIKit/components/TUIChat/components/MessageInput/index.js b/TUIService/TUIKit/components/TUIChat/components/MessageInput/index.js
index e50dc96..f6ed94d 100644
--- a/TUIService/TUIKit/components/TUIChat/components/MessageInput/index.js
+++ b/TUIService/TUIKit/components/TUIChat/components/MessageInput/index.js
@@ -143,6 +143,8 @@ Component({
title: ' ',
notShow: false,
isShow: true,
+ timer:null,
+ recordtime:0,
commonFunction: [
{ name: '常用语', key: '0' },
{ name: '发送订单', key: '1' },
@@ -175,6 +177,13 @@ Component({
});
} else {
// res.tempFilePath 存储录音文件的临时路径
+ if(res.duration >= 59000){
+ wx.showToast({
+ title: '录音时间不能超过60s',
+ duration:2000,
+ icon: 'none',
+ });
+ }
this.sendCallback();
const message = wx.$TUIKit.createAudioMessage({
to: this.getToAccount(),
@@ -266,24 +275,70 @@ Component({
focus: false,
});
},
+ openRecord(e,callback){
+ let THIS=this;
+ return new Promise((resolve, reject) => {
+ wx.getSetting({
+ success(res) {
+ if(!(res.authSetting['scope.record'])) { // 关闭订阅消息主按钮
+ return wx.showModal({
+ title: '提示',
+ content: '您已关闭麦克风权限,请点击“确认”按钮在设置中打开麦克风权限。',
+ success: function (res) {
+ if (res.confirm) {
+ wx.openSetting({
+ success(res) {
+
+ }
+ });
+ }
+ },
+ complete(){
+
+ }
+ });
+ } else { // 开放订阅消息主按钮
+ callback(e,THIS);
+ resolve()
+ }
+ },
+ complete(){
+ wx.hideLoading();
+ }
+ })
+ })
+ },
// 长按录音
handleLongPress(e) {
- if(this.setMsgRound()){
+ this.openRecord(e,this.recording);
+
+ },
+ recording(e,THIS){
+ console.log(THIS);
+ if(THIS.setMsgRound()){
wx.aegis.reportEvent({
name: 'messageType',
ext1: 'messageType-audio',
ext2: wx.$chat_reportType,
ext3: wx.$chat_SDKAppID,
});
- this.recorderManager.start({
+ THIS.recorderManager.start({
duration: 60000, // 录音的时长,单位 ms,最大值 600000(10 分钟)
sampleRate: 44100, // 采样率
numberOfChannels: 1, // 录音通道数
encodeBitRate: 192000, // 编码码率
format: 'aac', // 音频格式,选择此格式创建的音频消息,可以在即时通信 IM 全平台(Android、iOS、微信小程序和Web)互通
});
- this.setData({
+ THIS.timer=setInterval(()=>{
+ if(THIS.data.recordtime>59){
+ clearInterval(THIS.timer)
+ };
+ THIS.setData({
+ recordtime:THIS.data.recordtime+1
+ });
+ },1000)
+ THIS.setData({
startPoint: e.touches[0],
title: '正在录音',
// isRecording : true,
@@ -296,7 +351,6 @@ Component({
}
},
-
// 录音时的手势上划移动距离对应文案变化
handleTouchMove(e) {
if (this.data.isRecording) {
@@ -331,6 +385,7 @@ Component({
});
wx.hideLoading();
this.recorderManager.stop();
+ clearInterval(this.timer)
},
// 选中表情消息
handleEmoji() {
@@ -753,7 +808,7 @@ Component({
cloudCustomData: JSON.stringify({
order_inquiry_id:this.data.order_inquiry_id,
inquiry_type:this.data.inquiry_type,
- message_rounds:this.data.msgData.msg_round+1,
+ message_rounds:this.data.msgData.msg_round,
patient_family_data:this.data.patient_family_data,
is_system:0
}),
diff --git a/TUIService/TUIKit/components/TUIChat/components/MessageInput/index.wxml b/TUIService/TUIKit/components/TUIChat/components/MessageInput/index.wxml
index cefd355..9ea8092 100644
--- a/TUIService/TUIKit/components/TUIChat/components/MessageInput/index.wxml
+++ b/TUIService/TUIKit/components/TUIChat/components/MessageInput/index.wxml
@@ -95,6 +95,9 @@
+
+ 00:{{recordtime<10?'0'+recordtime:recordtime}}
+
{{title}}
diff --git a/TUIService/TUIKit/components/TUIChat/components/MessageInput/index.wxss b/TUIService/TUIKit/components/TUIChat/components/MessageInput/index.wxss
index f365588..dcefa00 100644
--- a/TUIService/TUIKit/components/TUIChat/components/MessageInput/index.wxss
+++ b/TUIService/TUIKit/components/TUIChat/components/MessageInput/index.wxss
@@ -61,7 +61,13 @@
.audio-main{
padding:12rpx 10rpx;
}
-
+.recordtime{
+ display: flex;
+ font-size: 32rpx;
+ margin-bottom: 10rpx;
+ justify-content: center;
+ color:#fff;
+}
.TUI-message-input-main-focus {
max-height: 300rpx;
@@ -169,9 +175,9 @@
.record-modal .wrapper {
display: flex;
- height: 200rpx;
+ height: 140rpx;
box-sizing: border-box;
- padding: 10vw;
+ padding: 8vw;
}
.record-modal .wrapper .modal-loading {
diff --git a/TUIService/TUIKit/components/TUIChat/components/MessageList/index.js b/TUIService/TUIKit/components/TUIChat/components/MessageList/index.js
index 9a0858a..dae6b47 100644
--- a/TUIService/TUIKit/components/TUIChat/components/MessageList/index.js
+++ b/TUIService/TUIKit/components/TUIChat/components/MessageList/index.js
@@ -245,9 +245,6 @@ Component({
'msgData.msg_round':0,
'msgData.msg_type':2
});
- // if(cloudCustomData.order_inquiry_id!=this.data.order_inquiry_id){
- // return false;
- // };
this.triggerEvent("getMessageRounds",this.data.msgData);
break;
};
diff --git a/pages/inquiryForm/inquiryForm.js b/pages/inquiryForm/inquiryForm.js
index 27a2fb8..45a358b 100644
--- a/pages/inquiryForm/inquiryForm.js
+++ b/pages/inquiryForm/inquiryForm.js
@@ -86,6 +86,20 @@ Page({
},
+ handleIpt(e){
+ let key = e.target.dataset.id;
+ let obj="personInfo."+key;
+ if(key=='height' || key=="weight"){
+ this.setData({
+ [obj]:e.detail.value
+ })
+ }else{
+ this.setData({
+ [obj]: e.detail.value
+ })
+ }
+
+ },
handleSendFields(){
const {order_inquiry_id,personInfo,list1,list2,marital_name,jobname,nationname}=this.data;
console.log(personInfo)
diff --git a/pages/inquiryForm/inquiryForm.wxml b/pages/inquiryForm/inquiryForm.wxml
index 7d0744f..4cab3c5 100644
--- a/pages/inquiryForm/inquiryForm.wxml
+++ b/pages/inquiryForm/inquiryForm.wxml
@@ -11,7 +11,7 @@
{{filter.formatwenzhenList(list1,'height').NUMBER}}、身高(CM)
-
+
@@ -22,7 +22,7 @@
{{filter.formatwenzhenList(list1,'weight').NUMBER}}、体重(KG)
-
+