diff --git a/src/apis/rtsp/api.js b/src/apis/rtsp/api.js new file mode 100644 index 0000000..7898334 --- /dev/null +++ b/src/apis/rtsp/api.js @@ -0,0 +1,5 @@ +// 開關 RTSP(啟用/停用) +export const POST_SET_RTSP_ENABLE = `/api/rtsp/set-rtsp-enable`; + +// 設定 SAMBA 儲存目錄 +export const POST_SET_SAMBA_DIRECTORY = `/api/rtsp/set-samba-directory`; diff --git a/src/apis/rtsp/index.js b/src/apis/rtsp/index.js new file mode 100644 index 0000000..9e11747 --- /dev/null +++ b/src/apis/rtsp/index.js @@ -0,0 +1,29 @@ +import { + POST_SET_RTSP_ENABLE, + POST_SET_SAMBA_DIRECTORY, +} from "./api"; +import instance from "@/util/request"; +import apihandler from "@/util/apihandler"; + +/** + * 開關 RTSP + * Swagger: POST /api/rtsp/set-rtsp-enable + * body: { main_id: number, enable: boolean } + */ +export const setRtspEnable = async ({ main_id, enable }) => { + const res = await instance.post(POST_SET_RTSP_ENABLE, { main_id, enable }); + return apihandler(res.code, res.data, { msg: res.msg, code: res.code }); +}; + +/** + * 設定 SAMBA 儲存目錄 + * Swagger: POST /api/rtsp/set-samba-directory + * body: { main_id: number, directory: string } + */ +export const setSambaDirectory = async ({ main_id, directory }) => { + const res = await instance.post(POST_SET_SAMBA_DIRECTORY, { + main_id, + directory, + }); + return apihandler(res.code, res.data, { msg: res.msg, code: res.code }); +}; diff --git a/src/config/cn.json b/src/config/cn.json index ad2f09b..2a98729 100644 --- a/src/config/cn.json +++ b/src/config/cn.json @@ -426,7 +426,16 @@ "title": "影像串流", "start": "开始侦测", "stop": "结束侦测", - "selectPath": "选择保存路径", - "displayArea": "RTSP 画面显示区域" + "selectPath": "选择存储位置", + "selectDevice": "选择设备", + "pleaseSelectDevice": "请先选择设备", + "selectPathFirst": "请先选择存储文件夹", + "startSuccess": "已开始侦测…", + "startFail": "开始侦测失败,请稍后再试", + "stopSuccess": "已请求结束侦测…", + "stopFail": "结束侦测失败,请稍后再试", + "noPermission": "未获得写入权限,请重新选择文件夹并授权", + "selectFolderSuccess": "已选择文件夹:{name}", + "selectFolderFail": "选择文件夹失败,请再试一次" } } diff --git a/src/config/tw.json b/src/config/tw.json index 85bedab..5e79ae1 100644 --- a/src/config/tw.json +++ b/src/config/tw.json @@ -427,6 +427,15 @@ "start": "開始偵測", "stop": "結束偵測", "selectPath": "選擇儲存位置", - "displayArea": "RTSP 畫面顯示區域" + "selectDevice": "選擇設備", + "pleaseSelectDevice": "請先選擇設備", + "selectPathFirst": "請先選擇儲存資料夾", + "startSuccess": "已開始偵測…", + "startFail": "開始偵測失敗,請稍後再試", + "stopSuccess": "已請求結束偵測…", + "stopFail": "結束偵測失敗,請稍後再試", + "noPermission": "沒有取得寫入權限,請重新選擇資料夾並允許", + "selectFolderSuccess": "已選擇資料夾:{name}", + "selectFolderFail": "選擇資料夾失敗,請再試一次" } } diff --git a/src/config/us.json b/src/config/us.json index b65be7e..4f9d069 100644 --- a/src/config/us.json +++ b/src/config/us.json @@ -423,10 +423,19 @@ "json_click_text": "Please enter JSON on the left and click the conversion button" }, "rtsp": { - "title": "Media Streaming", + "title": "Video Stream", "start": "Start Detection", "stop": "Stop Detection", - "selectPath": "Select Save Path", - "displayArea": "RTSP Display Area" + "selectPath": "Select Folder", + "selectDevice": "Select Device", + "pleaseSelectDevice": "Please select a device first", + "selectPathFirst": "Please select a folder first", + "startSuccess": "Detection started…", + "startFail": "Failed to start detection, please try again later", + "stopSuccess": "Detection stop requested…", + "stopFail": "Failed to stop detection, please try again later", + "noPermission": "No write permission. Please select a folder again and grant access", + "selectFolderSuccess": "Folder selected: {name}", + "selectFolderFail": "Failed to select folder, please try again" } } diff --git a/src/views/dashboard/Dashboard.vue b/src/views/dashboard/Dashboard.vue index d5cbe04..6ad2e45 100644 --- a/src/views/dashboard/Dashboard.vue +++ b/src/views/dashboard/Dashboard.vue @@ -136,20 +136,14 @@ onUnmounted(() => { diff --git a/src/views/rtsp/Rtsp.vue b/src/views/rtsp/Rtsp.vue index 561b942..72415ce 100644 --- a/src/views/rtsp/Rtsp.vue +++ b/src/views/rtsp/Rtsp.vue @@ -2,9 +2,33 @@

{{ $t("rtsp.title") }}

-
- + +
+

+ {{ $t("rtsp.selectDevice") }} : +

+ + + +
+ +
+
- +