diff --git a/src/layout/components/SystemSettingDialog.vue b/src/layout/components/SystemSettingDialog.vue index 0335061..ebd6e43 100644 --- a/src/layout/components/SystemSettingDialog.vue +++ b/src/layout/components/SystemSettingDialog.vue @@ -33,8 +33,7 @@ Enter发送 - - + @@ -169,11 +168,9 @@ export default { activeTab: "basic", basicForm: { notification: true, - // autoStart: false, // 只能在软件中使用 - // exitOnClose: true, // 只能在软件中使用 sendKey: "enter", - // videoPath: "2026-05/HiuUltraTalk_V01.01.16/HiuTalkStore", // 只能在软件中使用 - // cachePath: "2026-05/HiuUltraTalk_V01.01.16/HiuTalkStore", // 只能在软件中使用 + videoPath: "", + cachePath: "", }, audioForm: { autoGain: true, @@ -200,15 +197,28 @@ export default { this.otherForm.signature = signatureData; this.saveSettings(); }, + // 获取默认路径 + getDefaultPath() { + const version = this.$store.getters.loginInfo?.upgrade_data?.version || "V01.01.16"; + return `D:\\RUS_${version}\\HiUTalkStore`; + }, // 从本地加载设置 loadSettings() { try { const savedSettings = localStorage.getItem(SYSTEM_SETTINGS_KEY); + const defaultPath = this.getDefaultPath(); if (savedSettings) { const settings = JSON.parse(savedSettings); // 合并保存的设置到表单 if (settings.basicForm) { this.basicForm = { ...this.basicForm, ...settings.basicForm }; + // 如果没有保存路径,则使用默认路径 + if (!this.basicForm.videoPath) { + this.basicForm.videoPath = defaultPath; + } + if (!this.basicForm.cachePath) { + this.basicForm.cachePath = defaultPath; + } } if (settings.audioForm) { this.audioForm = { ...this.audioForm, ...settings.audioForm }; @@ -216,6 +226,10 @@ export default { if (settings.otherForm) { this.otherForm = { ...this.otherForm, ...settings.otherForm }; } + } else { + // 如果没有保存的设置,使用默认路径 + this.basicForm.videoPath = defaultPath; + this.basicForm.cachePath = defaultPath; } } catch (e) { console.error("加载系统设置失败:", e); @@ -260,13 +274,13 @@ export default { cancelButtonText: "取消", type: "warning", }).then(() => { + const version = this.$store.getters.loginInfo?.upgrade_data?.version || "V01.01.16"; + const defaultPath = `D:\\RUS_${version}\\HiUTalkStore`; this.basicForm = { notification: true, - // autoStart: false, - // exitOnClose: true, sendKey: "enter", - // videoPath: "2026-05/HiuUltraTalk_V01.01.16/HiuTalkStore", - // cachePath: "2026-05/HiuUltraTalk_V01.01.16/HiuTalkStore", + videoPath: defaultPath, + cachePath: defaultPath, }; this.audioForm = { autoGain: true, diff --git a/src/permission.js b/src/permission.js index 53f4777..7564660 100644 --- a/src/permission.js +++ b/src/permission.js @@ -15,6 +15,41 @@ const isWhiteList = (path) => { return whiteList.some(pattern => isPathMatch(pattern, path)) } +// 初始化系统设置(登录时调用) +const initSystemSettings = () => { + const SYSTEM_SETTINGS_KEY = "systemSettings"; + try { + const savedSettings = localStorage.getItem(SYSTEM_SETTINGS_KEY); + if (!savedSettings) { + // 获取版本号 + const version = store.getters.loginInfo?.upgrade_data?.version || "V01.01.16"; + const defaultPath = `D:\\RUS_${version}\\HiUTalkStore`; + // 初始化默认设置 + const defaultSettings = { + basicForm: { + notification: true, + sendKey: "enter", + videoPath: defaultPath, + cachePath: defaultPath, + }, + audioForm: { + autoGain: true, + echoCancel: true, + noiseReduction: true, + }, + otherForm: { + signature: null, + skipEvaluation: false, + }, + }; + localStorage.setItem(SYSTEM_SETTINGS_KEY, JSON.stringify(defaultSettings)); + console.log("系统设置初始化完成"); + } + } catch (e) { + console.error("初始化系统设置失败:", e); + } +} + router.beforeEach((to, from, next) => { NProgress.start() if (getToken()) { @@ -39,6 +74,8 @@ router.beforeEach((to, from, next) => { store.dispatch('GetNetConfig').then(res => { store.dispatch('GetInfo').then(() => { isRelogin.show = false + // 初始化系统设置(包括视讯存储路径和缓存路径) + initSystemSettings() store.dispatch('GenerateRoutes').then(accessRoutes => { // 根据roles权限生成可访问的路由表 router.addRoutes(accessRoutes) // 动态添加可访问路由表 diff --git a/src/utils/request.js b/src/utils/request.js index b9b9f2d..797780f 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -82,32 +82,20 @@ service.interceptors.response.use(res => { if (res.request.responseType === 'blob' || res.request.responseType === 'arraybuffer') { return res.data } - if (code === 401 || code == 910) { - // 防止重复弹窗,使用延时重置锁,兼容并发请求 + if (code === 401) { if (!isRelogin.show) { isRelogin.show = true - MessageBox.confirm( - '登录状态已过期,您可以继续留在该页面,或者重新登录', - '系统提示', - { - confirmButtonText: '重新登录', - cancelButtonText: '取消', - type: 'warning' - } - ).then(() => { - // 退出登录并跳转 - return store.dispatch('LogOut') - }).then(() => { - location.href = '/index' + MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { confirmButtonText: '重新登录', cancelButtonText: '取消', type: 'warning' }).then(() => { + isRelogin.show = false + store.dispatch('LogOut').then(() => { + location.href = '/index' + }) }).catch(() => { - // 捕获异常,保证锁一定释放 - }).finally(() => { - // 无论点确定/取消/报错,最终都解锁 isRelogin.show = false }) } return Promise.reject('无效的会话,或者会话已过期,请重新登录。') - } else if (code === 500 || code === 901) { + } else if (code === 500 || code === 900 || code === 901 || code === 903) { Message({ message: msg, type: 'error' }) return Promise.reject(new Error(msg)) } else if (code === 601) { diff --git a/src/views/cases/components/CaseFormDialog.vue b/src/views/cases/components/CaseFormDialog.vue index 1ea52b4..2e3b1e8 100644 --- a/src/views/cases/components/CaseFormDialog.vue +++ b/src/views/cases/components/CaseFormDialog.vue @@ -537,43 +537,27 @@ export default { date_time: this.form.date_time, report_id: this.form.id, time_section: this.form.time_section, - }) - .then((response) => { - if (response.code === 200) { - this.$modal.msgSuccess("预约时间修改成功"); - this.open = false; - this.$emit("getList"); - } else { - this.$modal.msgError(response.msg || "预约时间修改成功失败"); - } - }) - .catch(() => { - this.$modal.msgError("预约时间修改成功失败"); - }); + }).then((response) => { + this.$modal.msgSuccess("预约时间修改成功"); + this.open = false; + this.$emit("getList"); + }); } else { // 新增病例 postReportCreate({ ...this.form, exam_rooms: this.form.exam_rooms ? [this.form.exam_rooms] : [], - }) - .then((response) => { - if (response.code === 200) { - this.$modal.msgSuccess("新增成功"); - this.open = false; - if (response.data && response.data.report_id) { - postReportInfo({ report_id: response.data.report_id }).then( - (response) => { - this.$emit("handleView", response.data); - } - ); + }).then((response) => { + this.$modal.msgSuccess("新增成功"); + this.open = false; + if (response.data && response.data.report_id) { + postReportInfo({ report_id: response.data.report_id }).then( + (response) => { + this.$emit("handleView", response.data); } - } else { - this.$modal.msgError(response.msg || "新增失败"); - } - }) - .catch(() => { - this.$modal.msgError("新增失败"); - }); + ); + } + }); } } }); diff --git a/src/views/cases/index.vue b/src/views/cases/index.vue index b53baad..411f5d8 100644 --- a/src/views/cases/index.vue +++ b/src/views/cases/index.vue @@ -268,12 +268,12 @@