12.19 bug
This commit is contained in:
@@ -77,9 +77,10 @@ Component({
|
||||
|
||||
// 音频播放
|
||||
audioPlay(e) {
|
||||
|
||||
const { id } = e.currentTarget.dataset;
|
||||
const { audioSave } = this.data;
|
||||
|
||||
this.triggerEvent("closeAudio",false)
|
||||
// 设置状态
|
||||
audioSave.forEach((message, index) => {
|
||||
message.isPlaying = false;
|
||||
@@ -132,6 +133,7 @@ Component({
|
||||
audioStop(e) {
|
||||
const { key } = e.currentTarget.dataset;
|
||||
const { audioSave } = this.data;
|
||||
console.log(audioSave);
|
||||
// 设置状态
|
||||
audioSave.forEach((message, index) => {
|
||||
message.isPlaying = false;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<block>
|
||||
<view class="audio-message {{isMine?'my-audio':'your-audio'}}">
|
||||
<!-- 默认状态 未播放 -->
|
||||
<view class='audio' wx:if="{{!isPlay}}" bindtap='audioPlay' data-id="{{message.ID}}" >
|
||||
<image class="image {{isMine?'my-image':''}}" src="{{isMine?'../../../../../static/images/play.png':'../../../../../static/images/playme.png'}}" /> {{renderDom[0].second}}s
|
||||
<view class='audio' wx:if="{{!isPlay}}" bindtap='audioPlay' data-id="{{message.ID}}" >
|
||||
<image class="image {{isMine?'my-image':''}}" src="../../../../../static/images/play.png" /> {{renderDom[0].second}}"
|
||||
</view>
|
||||
<!-- 当前正在播放状态 -->
|
||||
<view class='audio' wx:else data-value="{{message}}" bindtap='audioStop' data-id="{{message.ID}}" >
|
||||
<image class="image {{isMine?'my-image':''}}" src="{{isMine?'../../../../../static/images/play.gif':'../../../../../static/images/playme.gif'}}" /> {{renderDom[0].second}}s
|
||||
<view class='audio' wx:else data-value="{{message}}" bindtap='audioStop' id="audio{{message.ID}}" data-id="{{message.ID}}" >
|
||||
<image class="image {{isMine?'my-image':''}}" src="../../../../../static/images/play.gif" /> {{renderDom[0].second}}"
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
padding: 10rpx 18rpx;
|
||||
border-radius: 2px 10px 10px 10px;
|
||||
border: 1px solid #D9D9D9;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.my-audio {
|
||||
@@ -10,6 +11,7 @@
|
||||
background: rgb(212, 239, 241);
|
||||
border: 1rpx solid #1ACAD3;
|
||||
}
|
||||
|
||||
.my-audio::after{
|
||||
content:'';
|
||||
position: absolute;
|
||||
@@ -41,6 +43,7 @@
|
||||
border-style: none none solid solid
|
||||
}
|
||||
.audio {
|
||||
width:200rpx;
|
||||
/*border-radius: 2px 10px 10px 10px;*/
|
||||
height: 60rpx;
|
||||
font-family: PingFangSC-Medium;
|
||||
@@ -49,7 +52,10 @@
|
||||
line-height: 28rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
.my-audio .audio{
|
||||
flex-direction: row-reverse;
|
||||
}
|
||||
.image{
|
||||
width: 16px;
|
||||
@@ -61,4 +67,12 @@
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
transform:rotate(180deg)
|
||||
}
|
||||
.dot{
|
||||
top:10rpx;
|
||||
position: absolute;
|
||||
width:15rpx;
|
||||
height:15rpx;
|
||||
background-color: red;
|
||||
border-radius: 50%;
|
||||
}
|
||||
@@ -133,7 +133,7 @@ Component({
|
||||
icon: 'none',
|
||||
});
|
||||
} else {
|
||||
if(resData.duration >= 59000){
|
||||
if(resData.duration >= 60000){
|
||||
wx.showToast({
|
||||
title: '录音时间不能超过60s',
|
||||
duration:2000,
|
||||
@@ -266,7 +266,13 @@ Component({
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
},
|
||||
hide: function () {
|
||||
let THIS=this;
|
||||
if(THIS.data.isRecording){
|
||||
THIS.handleTouchEnd()
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -290,6 +296,20 @@ Component({
|
||||
// 打开录音开关
|
||||
switchAudio() {
|
||||
wx.hideKeyboard();
|
||||
if(!this.data.isAudio){
|
||||
wx.getSetting({
|
||||
success(res) {
|
||||
if (!res.authSetting['scope.record']) {
|
||||
wx.authorize({
|
||||
scope: 'scope.record',
|
||||
success () {
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
this.setData({
|
||||
isAudio: !this.data.isAudio,
|
||||
isEmoji: false,
|
||||
@@ -348,7 +368,7 @@ Component({
|
||||
ext3: wx.$chat_SDKAppID,
|
||||
});
|
||||
THIS.recorderManager.start({
|
||||
duration: 60000, // 录音的时长,单位 ms,最大值 600000(10 分钟)
|
||||
duration: 61000, // 录音的时长,单位 ms,最大值 600000(10 分钟)
|
||||
sampleRate: 44100, // 采样率
|
||||
numberOfChannels: 1, // 录音通道数
|
||||
encodeBitRate: 192000, // 编码码率
|
||||
@@ -356,14 +376,17 @@ Component({
|
||||
});
|
||||
|
||||
THIS.timer=setInterval(()=>{
|
||||
if(THIS.data.recordtime>59){
|
||||
clearInterval(THIS.timer)
|
||||
if(THIS.data.recordtime>=60){
|
||||
THIS.handleTouchEnd();
|
||||
clearInterval(THIS.timer);
|
||||
|
||||
};
|
||||
THIS.setData({
|
||||
recordtime:THIS.data.recordtime+1
|
||||
});
|
||||
|
||||
},1000)
|
||||
console.log("handleLongPress")
|
||||
THIS.setData({
|
||||
startPoint: e.touches[0],
|
||||
title: '正在录音',
|
||||
@@ -378,6 +401,7 @@ Component({
|
||||
|
||||
// 录音时的手势上划移动距离对应文案变化
|
||||
handleTouchMove(e) {
|
||||
console.log("handleTouchMove")
|
||||
if (this.data.isRecording) {
|
||||
if (this.data.startPoint.clientY - e.touches[e.touches.length - 1].clientY > 100) {
|
||||
this.setData({
|
||||
@@ -403,11 +427,29 @@ Component({
|
||||
|
||||
// 手指离开页面滑动
|
||||
handleTouchEnd() {
|
||||
wx.nextTick(() => {
|
||||
this.setData({
|
||||
isRecording: false,
|
||||
popupToggle: false,
|
||||
|
||||
});
|
||||
console.log("handleTouchEnd")
|
||||
wx.hideLoading();
|
||||
this.recorderManager.stop();
|
||||
clearInterval(this.timer);
|
||||
this.setData({
|
||||
recordtime:0
|
||||
})
|
||||
})
|
||||
|
||||
},
|
||||
handleTouchCancel(){
|
||||
this.setData({
|
||||
isRecording: false,
|
||||
popupToggle: false,
|
||||
|
||||
});
|
||||
console.log("handleTouchCancel")
|
||||
wx.hideLoading();
|
||||
this.recorderManager.stop();
|
||||
clearInterval(this.timer);
|
||||
|
||||
@@ -17,9 +17,11 @@
|
||||
/>
|
||||
</view>
|
||||
<view wx:if="{{isAudio}}" class="TUI-message-input-main"
|
||||
bind:longpress="handleLongPress"
|
||||
bind:touchmove="handleTouchMove"
|
||||
bind:touchend="handleTouchEnd"
|
||||
catchlongpress="handleLongPress"
|
||||
catchtouchmove="handleTouchMove"
|
||||
catchtouchend="handleTouchEnd"
|
||||
catchtap="handleTouchCancel"
|
||||
catchtouchcancel="handleTouchCancel"
|
||||
style="display: flex; justify-content: center; font-size: 32rpx; font-family: PingFangSC-Regular; height: 30px">
|
||||
<text >{{text}}</text>
|
||||
</view>
|
||||
|
||||
@@ -293,6 +293,19 @@ Component({
|
||||
url: url,
|
||||
})
|
||||
},
|
||||
closeAudio(data){
|
||||
//关闭其他语音
|
||||
this.data.messageList.forEach((item)=>{
|
||||
if(item.type=="TIMSoundElem"){
|
||||
let ele=this.selectComponent('#audio'+item.ID);
|
||||
ele.setData({
|
||||
isPlay:false
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
},
|
||||
refreshMessageRounds(message){
|
||||
try {
|
||||
// console.log("messageList refreshMessageRounds message: ", message);
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
<TextMessage wx:if="{{item.type === 'TIMTextElem'}}" message="{{item}}" isMine="{{item.flow === 'out'}}" />
|
||||
<ImageMessage wx:if="{{item.type === 'TIMImageElem'}}" message="{{item}}" isMine="{{item.flow === 'out'}}" />
|
||||
<VideoMessage wx:if="{{item.type === 'TIMVideoFileElem'}}" message="{{item}}" isMine="{{item.flow === 'out'}}"/>
|
||||
<AudioMessage wx:if="{{item.type === 'TIMSoundElem'}}" message="{{item}}" data-index ='{{index}}' messageList="{{messageList}}" isMine="{{item.flow === 'out'}}"/>
|
||||
<AudioMessage wx:if="{{item.type === 'TIMSoundElem'}}" message="{{item}}" data-index ='{{index}}' messageList="{{messageList}}" bind:closeAudio="closeAudio" id="audio{{item.ID}}" isMine="{{item.flow === 'out'}}"/>
|
||||
<CustomMessage wx:if="{{item.type === 'TIMCustomElem'}}" message="{{item}}" isMine="{{item.flow === 'out'}}" bindtap="handleJumpLink" data-value = "{{item}}" patient_family_data="{{concat.formateText(item.cloudCustomData).patient_family_data}}"/>
|
||||
<FaceMessage wx:if="{{item.type === 'TIMFaceElem'}}" message="{{item}}" isMine="{{item.flow === 'out'}}"/>
|
||||
<FileMessage wx:if="{{item.type === 'TIMFileElem'}}" message="{{item}}" isMine="{{item.flow === 'out'}}"/>
|
||||
|
||||
@@ -163,7 +163,7 @@
|
||||
}
|
||||
.time_desc .item{
|
||||
color:#E34D59;
|
||||
|
||||
margin-top:3rpx;
|
||||
display:inline-flex;
|
||||
white-space: nowrap;
|
||||
align-items: center;
|
||||
|
||||
Reference in New Issue
Block a user