From 3ae864f005e8a874de01c15e14b83196a3f6f11b Mon Sep 17 00:00:00 2001 From: xusd <hugeinfo123> Date: Wed, 18 Sep 2024 10:21:30 +0800 Subject: [PATCH] 新增一个测试环境 --- gz-wxparty/pages/speechToText/index.js | 36 ++++++++++++++++++++++++++++++++++-- 1 files changed, 34 insertions(+), 2 deletions(-) diff --git a/gz-wxparty/pages/speechToText/index.js b/gz-wxparty/pages/speechToText/index.js index 58d241a..28eafb2 100644 --- a/gz-wxparty/pages/speechToText/index.js +++ b/gz-wxparty/pages/speechToText/index.js @@ -113,6 +113,7 @@ if (code === '0' || code === 0) { that.setData({ value: that.data.value + data || '', + number: (that.data.value + data || '').length, }); } else { $$.showToast({ @@ -165,11 +166,42 @@ */ onLoad(options) { let { - type + type, + value } = options console.log('type', type); this.setData({ - key: type + key: type, + value, + number: value?.length || 0, + }) + wx.getSetting({ + success(res) { + if (res.authSetting['scope.record'] === false) { + $$.hideLoading(); + $$.showModal({ + content: '抱歉!此功能需授权麦克风录音功能', + confirmText: '跳转授权', + success: (res) => { + if (res.confirm) { + wx.openSetting({ + success(res) { + if (res.authSetting['scope.record']) { + $$.showToast({ + title: '授权成功' + }); + } else { + $$.showToast({ + title: '授权失败' + }); + } + }, + }); + } + }, + }); + } + } }) }, }) \ No newline at end of file -- Gitblit v1.8.0