From 2a19fd53d6e0535cd54c5e6fd1dd180c30a6fb85 Mon Sep 17 00:00:00 2001
From: 罗广辉 <guanghui.luo@foxmail.com>
Date: Thu, 23 Oct 2025 17:05:52 +0800
Subject: [PATCH] feat: 广播90%
---
src/subPackages/droneConsole/index.vue | 24 ++++++++++++------------
1 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/src/subPackages/droneConsole/index.vue b/src/subPackages/droneConsole/index.vue
index a39ab4e..8df7c7b 100644
--- a/src/subPackages/droneConsole/index.vue
+++ b/src/subPackages/droneConsole/index.vue
@@ -5,7 +5,7 @@
<script setup>
import {onHide, onLoad, onShow} from "@dcloudio/uni-app";
import WebViewPlus from "@/components/WebViewPlus.vue";
-import {getWebViewUrl} from "@/utils/index.js";
+import {getEnvObj, getWebViewUrl} from "@/utils/index.js";
import Recorder from "js-audio-recorder";
import dayjs from "dayjs";
import {useUserStore} from "@/store/index.js";
@@ -16,13 +16,15 @@
const soundVideoName = ref('') // 喊话名称
soundVideoName.value = `${dayjs().format('YYYYMMDDHHmmss')}实时喊话`
const droneHornState = ref('0')
+const updateKey = ref(0)
const uNotifyRef = ref(null)
const viewUrl = computed(() => {
return getWebViewUrl('/DroneConsole', {
wayLineJodInfoId: wayLineJodInfoId.value,
startState: startState.value,
- droneHornState: droneHornState.value
+ droneHornState: droneHornState.value,
+ updateKey: updateKey.value
})
})
@@ -47,6 +49,7 @@
recorder.play()
} else if (data.type === 'resetRecording') {
startState.value = '0'
+ droneHornState.value = '0'
recorder?.destroy().then(() => {
recorder = null // 释放资源
})
@@ -57,22 +60,24 @@
}
}
+const {VITE_API_BASE_URL} = getEnvObj()
+
function uploadUtil(options) {
const {formData, file, url} = options
return new Promise((resolve, reject) => {
let accessToken = useUserStore()?.$state?.userInfo?.access_token;
const file = new File([recorder.getWAVBlob()], '.wav')
uni.uploadFile({
- url: `https://wrj.shuixiongit.com/api${url}`,
+ url: `${VITE_API_BASE_URL}${url}`,
name: 'file',
header: {'Blade-Auth': 'bearer ' + accessToken},
file,
formData,
success: (res) => {
const resData = JSON.parse(res.data)
- if (resData.code === 200){
+ if (resData.code === 200 || resData.code === 0) {
resolve(res)
- }else{
+ } else {
showToast(resData.message)
reject(res)
}
@@ -88,13 +93,6 @@
uNotifyRef.value.show({
type: 'default',
message,
- // top: 10,
- // color: '#fff',
- // bgColor: '#000',
- // message,
- // duration: 1000 * 3,
- // fontSize: 20,
- // safeAreaInsetTop: true
});
}
@@ -132,6 +130,8 @@
showToast('播放成功')
}).catch(() => {
droneHornState.value = '0'
+ }).finally(() => {
+ updateKey.value += 1
})
}
--
Gitblit v1.9.3