Bläddra i källkod

fix: 文档路径更新

xsx 1 år sedan
förälder
incheckning
9f7a3d4970
2 ändrade filer med 19 tillägg och 4 borttagningar
  1. 1 1
      im-ui/src/view/Login.vue
  2. 18 3
      im-uniapp/components/chat-record/chat-record.vue

+ 1 - 1
im-ui/src/view/Login.vue

@@ -20,7 +20,7 @@
 						<li>web端音视频功能优化:支持语音呼叫、会话中加入通话状态消息</li>
 						<li>uniapp端支持音视频通话,并与web端打通</li>
 						<li>uniapp端音视频源码通话源码暂未开源,需付费获取:
-							<a href="https://www.yuque.com/u1475064/oncgyg/vi7engzluty594s2" target="_blank">uniapp端音视频通源码购买说明</a>
+							<a href="https://www.yuque.com/u1475064/mufu2a/vi7engzluty594s2" target="_blank">uniapp端音视频通源码购买说明</a>
 						</li>
 					</ul>
 				</div>

+ 18 - 3
im-uniapp/components/chat-record/chat-record.vue

@@ -1,7 +1,10 @@
 <template>
 	<view class="chat-record">
-		<view class="chat-record-bar" id="chat-record-bar" :style="recordBarStyle" @touchstart="onStartRecord"
-			@touchmove="onTouchMove" @touchend.prevent="onEndRecord">{{recording?'正在录音':'长按 说话'}}</view>
+		<view class="chat-record-bar" id="chat-record-bar" :style="recordBarStyle" 
+			@click.stop=""
+			@touchstart.prevent="onStartRecord"
+			@touchmove.prevent="onTouchMove" 
+			@touchend.prevent="onEndRecord">{{recording?'正在录音':'长按 说话'}}</view>
 		<view v-if="recording" class="chat-record-window" :style="recordWindowStyle">
 			<view class="rc-wave">
 				<text class="note" style="--d: 0"></text>
@@ -13,7 +16,7 @@
 				<text class="note" style="--d: 6"></text>
 			</view>
 			<view class="rc-tip">{{recordTip}}</view>
-			<view class="cancel-btn">
+			<view class="cancel-btn" @click="onCancel">
 				<uni-icons :class="moveToCancel?'red':'black'" type="clear" 
 				:size="moveToCancel?45:40"></uni-icons>
 			</view>
@@ -40,7 +43,19 @@
 				const moveY = e.touches[0].clientY;
 				this.moveToCancel = moveY < this.recordBarTop-40;
 			},
+			onCancel(){
+				if(this.recording){
+					this.moveToCancel = true;
+					this.onEndRecord();
+				}
+			},
 			onStartRecord() {
+				/* 用户第一次使用语音会唤醒录音权限请求,此时会导致@touchend失效,
+					一直处于录音状态,这里允许用户再次点击发送语音并结束录音 */
+				if(this.recording){
+					this.onEndRecord();
+					return;
+				}
 				console.log("开始录音")
 				this.moveToCancel = false;
 				this.initRecordBar();