-
-
-

-
-
-

-
-
-

-
-
-

-
-
+
+
+
+
+
-
-
-

-
-
-

-
-
-

-
-
-

-
-
+
+
+
+
+
+
+
+
+

+
+
+
+

+
+
+
+

+
+
+
+

+
+
+
+
+
+
+

+
+
+
+

+
+
+
+

+
+
+
+

+
+
-
-
+
diff --git a/src/api/api.ts b/src/api/api.ts
index b9b3efe..224aabf 100644
--- a/src/api/api.ts
+++ b/src/api/api.ts
@@ -1,15 +1,4 @@
import request from "@/http/request";
-export const getStreamAnswer = async (streamName: string, data: string) => {
- return request.post(
- `/index/api/webrtc?app=live&stream=${streamName}&type=play`,
- data,
- {
- headers: {
- "Content-Type": "text/plain;charset=UTF-8",
- },
- }
- );
-};
export const openDoorApi = async (port: number, sid: number, token: string) => {
return request.post(
"/pc/v1/operate/open/door",
@@ -38,3 +27,55 @@ export const lockDoorApi = async (type: number, sid: number, token: string) => {
}
);
};
+export const voiceList = async (
+ token
+) => {
+ return request.post(
+ "/pc/operate/intercom",
+ { },
+ {
+ headers: {
+ Authorization: "Bearer " + token,
+ },
+ }
+ );
+};
+export const setVoiceApi = async (sid,id,cid) => {
+ return request.get(
+ "/pc/voice/set",
+ {
+ params:{sid,id,cid}
+ },
+ );
+};
+export const exitServerApi = async (
+ client_id: number,
+ store_id: number,
+ token
+) => {
+ return request.post(
+ "/pc/v1/end/service",
+ { client_id, store_id },
+ {
+ headers: {
+ Authorization: "Bearer " + token,
+ },
+ }
+ );
+};
+export const speechToTextLogApi = async (
+ sid: number,
+ cid: number,
+ content: string,
+ token
+) => {
+ return request.post(
+ "/pc/speech/to/text",
+ { sid, cid,content },
+ {
+ headers: {
+ Authorization: "Bearer " + token,
+ },
+ }
+ );
+};
\ No newline at end of file
diff --git a/src/api/talk.ts b/src/api/talk.ts
new file mode 100644
index 0000000..a05f846
--- /dev/null
+++ b/src/api/talk.ts
@@ -0,0 +1,34 @@
+import talkRequest from "@/http/talkRequest";
+
+export function talkLogin(params) {
+ return talkRequest({
+ url: '/api/user/login',
+ method: 'get',
+ params: params
+ })
+}
+export function audioStartPlay({deviceId, channelId}) {
+ return talkRequest({
+ method: 'get',
+ url: '/api/play/start/' + deviceId + '/' + channelId
+ })
+}
+export function broadcastStart({deviceId, channelId, broadcastMode}, accessToken) {
+ return talkRequest({
+ method: 'get',
+ url: '/api/play/broadcast/' + deviceId + '/' + channelId + "?timeout=30&broadcastMode=" + broadcastMode,
+ headers:{
+ 'access-token': accessToken
+ }
+ })
+}
+
+export function broadcastStop({deviceId, channelId, accessToken}) {
+ return talkRequest({
+ method: 'get',
+ url: '/api/play/broadcast/stop/' + deviceId + '/' + channelId,
+ headers:{
+ 'access-token': accessToken
+ }
+ })
+}
\ No newline at end of file
diff --git a/src/assets/images/icon_gb.png b/src/assets/images/icon_gb.png
new file mode 100644
index 0000000..3c00c4f
Binary files /dev/null and b/src/assets/images/icon_gb.png differ
diff --git a/src/assets/images/icon_ht.png b/src/assets/images/icon_ht.png
new file mode 100644
index 0000000..2a42158
Binary files /dev/null and b/src/assets/images/icon_ht.png differ
diff --git a/src/assets/images/icon_km@2x.png b/src/assets/images/icon_km@2x.png
new file mode 100644
index 0000000..fdbfbcf
Binary files /dev/null and b/src/assets/images/icon_km@2x.png differ
diff --git a/src/assets/images/icon_ks@2x.png b/src/assets/images/icon_ks@2x.png
new file mode 100644
index 0000000..e2cf2a2
Binary files /dev/null and b/src/assets/images/icon_ks@2x.png differ
diff --git a/src/assets/images/icon_yy@2x.png b/src/assets/images/icon_yy@2x.png
new file mode 100644
index 0000000..632d650
Binary files /dev/null and b/src/assets/images/icon_yy@2x.png differ
diff --git a/src/components/talk.vue b/src/components/talk.vue
new file mode 100644
index 0000000..5c0c199
--- /dev/null
+++ b/src/components/talk.vue
@@ -0,0 +1,180 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/http/talkRequest.ts b/src/http/talkRequest.ts
new file mode 100644
index 0000000..55d44bc
--- /dev/null
+++ b/src/http/talkRequest.ts
@@ -0,0 +1,15 @@
+import axios from 'axios'
+
+const talkUrl = 'https://audio.test.7games.store'
+
+// create an axios instance
+const service = axios.create({
+ baseURL: talkUrl, // url = base url + request url
+ // withCredentials: true, // send cookies when cross-domain requests
+ timeout: 30000, // request timeout
+ headers:{
+ 'Access-Control-Allow-Origin':'*'
+ }
+})
+
+export default service
\ No newline at end of file
diff --git a/src/testKey/localhost+2-key.pem b/src/testKey/localhost+2-key.pem
new file mode 100644
index 0000000..1f17eb0
--- /dev/null
+++ b/src/testKey/localhost+2-key.pem
@@ -0,0 +1,28 @@
+-----BEGIN PRIVATE KEY-----
+MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQD2XjO7qYpeZANM
+4F+/kDWkTDBEJkbXeVg8Scix6DY+xxi4pYDpux5frP8eb/0NouGPyfRLf3NXri/8
+wQxHuxjaa1uvDkk2ogV1rCwnfmxbeiUY/fKt6U9ukSP4+mt7mBQxnRxPmoAaD7Vc
+09LsL/N7wsnaSOOap9jK9M9lIOnKOdwZbGwT+eemye1b4N+jIAtm6M630vZ0czbL
+xmnff8Yp7ibBvQzb8OIj3zJ4GhhZTKYIW+1R1jyY29h+OfYZu2kWseuLCQc7IXGL
+5MFZ6N1euCo3RD+hcGo+zQl5ikzPL2CikTyqH/Da1cTzjUnMb02UbH0dCj00zgIe
+2j5K9XIXAgMBAAECggEBALDj3EMerOGu74uwAi9ZzJoFthYIYY7uakMHOxk5wFD8
+xKw28MNg/aL2ZEqnX8r9qvSBrWzTuq42u++/cCDEnkidErwzBrA6Tq85io5kwEpB
+/gbetvLVdJnPjkODEc8w1zb0NlKVfOq5Yp+e22+H0kuHBUU8VmdBom++rHZQ1mvC
+DLb40+XDRLzosGDnZxaTqrbeSOwLBumdmo6RMA2340vgUrnnGroLHgeI1HJZ+rn/
+wEjLseyvGOxS9LPZ9NMWzzBMnerT4dFgPYypG6HvPQ3euSPcqwOmys49Ou6GAdGZ
+Fg5AQJCj+wrc9TiZpCdQlOlRNht3qn5o3DO5z4YJIRECgYEA+PJD2GFNpnejkE0U
+QCMVZx7T4zLO2+sPEtUbclUzeLJVMRUWY837BonNUatpAALNTbWanP+gDYmzRfAN
+Q5Ul/VP/vTO/uWBpWXNhZm4m5eIHuQrcxk4EhzTBTQhsoBBA5TaTvCVdWHD/8Ci2
+nmTAUMMTZf3eRS9VCqzTyf228YkCgYEA/Vk8HUGdOE9SgtluBO0q02ddQHcB1dIG
+EaDaCMarxBYfh/pBIJ5KbHSbk2iGhe+KOArKAPAFvohCCJpmsFM9qN9XTBkG6pTK
+9N/3jlPSupNGEgyxYgzHQbEfIsL3uzVrYrs087cQn7iFOEBf5o3B18kEnUCON84B
+WupO0PbUfp8CgYEAph5jj3w+qJqlFqGYpcPDgHBdy/oXd0C/aj2ydvTLx/qYRoxf
+yHGm1JIX5CuRgWRdQ0Gvzpv1XZNJgZ3R/AsGsqjeuo5RnY3sPrhzgjp20mel56CL
++fgNpXtakeDRO24dH9bvdlkolN+yqbtBQSjR/BJwW1qwe1I+WUVCfkNDVKECgYAz
+mI/QmYNOa4EvWt64LCDzqvJn5ZS/GiXYQz0EWomyxpqnU8Udwn7/tYPVsozrDAzH
+OxNGu5s/4XopTGCrelhtYwbhXZt1/NWUp2RAXTvmeYXkuScLA/U0oMDpkHFpdAip
+s9yl4duF28tt2FZvmuEmdC73Y6VTIiZOgLeKgSpnmwKBgQDmqXROzaeXUVM0QZwW
+ijwMsgKschvfPvI+6rFstIS22iBbq1SEltiZ2gs2jaRojvWqdaI9y0XojL+jMMB1
+J8OkzFZDszXVwkmBwrv3crUwNiXRTHcjLDEFOsKw0QwH6HSMMlDB4/2uecArT/QL
+F0VxBVe6zK9v1Hlbp8NZARTGfw==
+-----END PRIVATE KEY-----
diff --git a/src/testKey/localhost+2.pem b/src/testKey/localhost+2.pem
new file mode 100644
index 0000000..ac5edfe
--- /dev/null
+++ b/src/testKey/localhost+2.pem
@@ -0,0 +1,27 @@
+-----BEGIN CERTIFICATE-----
+MIIEgDCCAuigAwIBA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GN1rNHSz+5ZvVexIt4OPlhh+X/TDmQ3
+vjkdF1UyG8RIqJ7N3sNgPIBj4fW48skWhLU1NZtrUWCxRmveZXsDqPDmx+AErSCR
+/XySMr4dn07GLh/cbWr6mLn5/2PMaSC8YJtMLMkmEHiBttaTNAnC7JUu3epu0iQY
+shCEpu+UKpX3WiTDitS5KzcPTgH7xLuLVFANwnkP+KGge96WrZ5AA10Uq41eW2Ir
+JHkQfKqt+k2gK0donZTbCRoWoI//uirnNcWtybZegVAgzv75UdlDkOfdQMNSYzBR
+qfvb7YcBv/2f+YKoGxGPjilIxg7cphPhX4SH1EzuTY6zxLHrOdGRzks701R3D15g
+Xv37oOJTcjpqWWCVPnGreNfAR9W3Hl8WMPHfnSxid4823XwFEjDnHvGOFBcKLp1P
+zSAWZnQp0vgfpMrCwPx3QH0ZxM7gN/Ff2rhrYzmdXn1vdGmO2NDeU6Lw/ScP1qKl
+G72f4w==
+-----END CERTIFICATE-----
diff --git a/src/utils/utils.ts b/src/utils/utils.ts
new file mode 100644
index 0000000..033fa8e
--- /dev/null
+++ b/src/utils/utils.ts
@@ -0,0 +1,10 @@
+export function chunkArray
(arr: T[], size: number): T[][] {
+ const result: T[][] = [];
+ let index = 0;
+
+ while (index < arr.length) {
+ result.push(arr.slice(index, index + size));
+ index += size;
+ }
+ return result;
+}
\ No newline at end of file
diff --git a/src/utils/websocket.ts b/src/utils/websocket.ts
index 842f18b..302549a 100644
--- a/src/utils/websocket.ts
+++ b/src/utils/websocket.ts
@@ -5,6 +5,7 @@ export class WebSocketClient {
oncelisteners: any;
breathCount: number;
eventKey: string;
+ breathTimer: any;
constructor(url: string, eventKey: string = "type") {
this.breathCount = 0;
this.ws = null;
@@ -21,6 +22,7 @@ export class WebSocketClient {
this.ws = new WebSocket(this.url);
this.ws.onopen = () => {
console.log("WebSocket connected");
+ this.breath()
resolve("连接成功");
call&&call(this);
// this.breath();
@@ -90,8 +92,21 @@ export class WebSocketClient {
this.send(types, data);
await this.once(types, call);
}
-
+ breath(){
+ if(this.breathTimer){
+ clearInterval(this.breathTimer)
+ }
+ this.breathTimer = setInterval(()=>{
+ if(this.ws.readyState===WebSocket.OPEN){
+ console.log(11)
+ this.send('breath',{})
+ }else{
+ this.connect()
+ }
+ },5000)
+ }
disconnect() {
this.ws.close();
+ clearInterval(this.breathTimer)
}
}
diff --git a/uno.config.ts b/uno.config.ts
index 9013e22..7f7e177 100644
--- a/uno.config.ts
+++ b/uno.config.ts
@@ -2,4 +2,10 @@ import { defineConfig } from 'unocss'
export default defineConfig({
// ...UnoCSS options
+ theme:{
+ breakpoints:{
+ md:'1000px',
+ sm:"600px"
+ }
+ }
})
\ No newline at end of file
diff --git a/vite.config.ts b/vite.config.ts
index 3ec8153..b909c43 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -3,18 +3,36 @@ import vue from "@vitejs/plugin-vue";
import UnoCSS from "unocss/vite";
// import basicSsl from "@vitejs/plugin-basic-ssl";
import { resolve } from "path";
+import fs from 'fs'
// https://vite.dev/config/
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd());
console.log(env);
+
+
return {
+ build: {
+ chunkSizeWarningLimit: 1500,
+ rollupOptions: {
+ output: {
+ manualChunks: {
+ flv: ['flv.js'],
+ primevue: ['primevue'],
+ webrtc: ['@/utils/websocket']
+ }
+ }
+ }
+ },
plugins: [vue(), UnoCSS(),
// basicSsl()
],
server: {
port: 4444,
host: "0.0.0.0",
- // https: true as unknown as any,
+ https: {
+ key: fs.readFileSync(resolve(__dirname, 'src/testKey/localhost+2-key.pem')),
+ cert: fs.readFileSync(resolve(__dirname, 'src/testKey/localhost+2.pem'))
+ },
proxy: {
"/index/api/webrtc": {
target: "http://webrtc.test.7games.store",