diff --git a/meeting/login/index.vue b/meeting/login/index.vue new file mode 100644 index 0000000..7190b18 --- /dev/null +++ b/meeting/login/index.vue @@ -0,0 +1,176 @@ + + + + + \ No newline at end of file diff --git a/meeting/online/index.vue b/meeting/online/index.vue index a248629..d3febda 100644 --- a/meeting/online/index.vue +++ b/meeting/online/index.vue @@ -61,6 +61,9 @@ export default { recorderManager: null, innerAudioContext: {}, isRecording: false, + ws: null, + webSocketUrl: "", + VITE_APP_WS: "wss://u140106-8027-537a5c07.westx.seetacloud.com:8443/api/stt/service" }; }, onLoad() { @@ -74,8 +77,37 @@ export default { // console.log('recorder stop' + JSON.stringify(res)); // self.voicePath = res.tempFilePath; // }); + this.initWebSocket(); }, methods: { + async initWebSocket() { + let url = this.VITE_APP_WS; + var audio_type = "mic_stream"; + var hot_words = "碳丝路 元梦空间"; + var hot_words2 = "碳丝路元梦空间"; + var language = "zh"; + var sample_rate = "16000"; + var timestamp = Math.floor(Date.now() / 1000); + var api_key = "AT_syAHhLp3vqOA!@+T9Cocxc0^6z@^9"; + var auth = `api_key=${api_key}&audio_type=${audio_type}&hot_words=${hot_words2}&language=${language}&sample_rate=${sample_rate}&stream=True×tamp=${timestamp}`; + const sign = await this.sha256(auth); + url = `${url}?audio_type=${audio_type}&hot_words=${encodeURIComponent(hot_words)}&language=${language}&sample_rate=${sample_rate}×tamp=${timestamp}&api_key=${encodeURIComponent(api_key)}&auth=${sign}`; + createdWebSocket(url); + }, + async sha256(str) { + // 将输入字符串转换为二进制数据 + const encoder = new TextEncoder(); + const data = encoder.encode(str); + // 调用原生的SubtleCrypto API计算SHA-256哈希 + return crypto.subtle.digest("SHA-256", data).then(buffer => { + // 将哈希结果转换为十六进制字符串 + const hexArray = Array.from(new Uint8Array(buffer)); + const hexString = hexArray + .map(byte => byte.toString(16).padStart(2, "0")) + .join(""); + return hexString; + }); + }, confirm() { this.popConfig.show = false; }, diff --git a/pages.json b/pages.json index 7f729f4..b3808bc 100644 --- a/pages.json +++ b/pages.json @@ -241,6 +241,13 @@ "navigationStyle": "custom", "enablePullDownRefresh":false } + },{ + "path":"login/index", + "style": { + "navigationBarTitleText": "登陆", + "navigationStyle": "custom", + "enablePullDownRefresh":false + } } ] } diff --git a/static/image/login/icon1.png b/static/image/login/icon1.png new file mode 100644 index 0000000..78584d9 Binary files /dev/null and b/static/image/login/icon1.png differ diff --git a/static/image/login/icon2.png b/static/image/login/icon2.png new file mode 100644 index 0000000..61d17d3 Binary files /dev/null and b/static/image/login/icon2.png differ diff --git a/static/image/login/icon3.png b/static/image/login/icon3.png new file mode 100644 index 0000000..0744b37 Binary files /dev/null and b/static/image/login/icon3.png differ diff --git a/static/image/login/icon4.png b/static/image/login/icon4.png new file mode 100644 index 0000000..f4c5402 Binary files /dev/null and b/static/image/login/icon4.png differ diff --git a/static/image/login/icon5.png b/static/image/login/icon5.png new file mode 100644 index 0000000..f618622 Binary files /dev/null and b/static/image/login/icon5.png differ diff --git a/static/image/login/icon6.png b/static/image/login/icon6.png new file mode 100644 index 0000000..6298dca Binary files /dev/null and b/static/image/login/icon6.png differ