From b904c5619dddbb9bb8254d19a3f4a6f566c98485 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=BF=97=E5=BC=BA?= <357099073@qq.com> Date: Wed, 11 Mar 2026 11:11:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=8B=A5=E5=B9=B2bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/sitesettings.js | 46 ++- .../components/contactSettings.vue | 40 +- .../siteSettings/components/legalNotice.vue | 21 +- .../components/normalSettings.vue | 41 +- .../basicSettings/siteSettings/index.vue | 20 +- src/views/basicSettings/tenants/domain.vue | 175 ++++++--- src/views/basicSettings/tenants/index.vue | 367 +++++++++++------- 7 files changed, 461 insertions(+), 249 deletions(-) diff --git a/src/api/sitesettings.js b/src/api/sitesettings.js index a47111d..7dddbac 100644 --- a/src/api/sitesettings.js +++ b/src/api/sitesettings.js @@ -2,12 +2,14 @@ import request from "@/utils/request"; /** * 获取基本信息 + * @param {number} tid 租户ID * @returns {Promise} */ -export function getNormalInfos() { +export function getNormalInfos(tid) { return request({ - url: "/admin/normalInfos", + url: "/admin/normalInfos", method: "get", + params: { tid } }); } @@ -20,9 +22,7 @@ export function saveNormalInfos(data) { return request({ url: "/admin/saveNormalInfos", method: "post", - data: { - data: JSON.stringify(data) - }, + data: data, }); } @@ -52,12 +52,14 @@ export function saveVerifyInfos(data) { /** * 获取法律声明和隐私条款 + * @param {number} tid 租户ID * @returns {Promise} */ -export function getLegalInfos() { +export function getLegalInfos(tid) { return request({ - url: "/admin/legalInfos", + url: "/admin/legalInfos", method: "get", + params: { tid } }); } @@ -70,8 +72,32 @@ export function saveLegalInfos(data) { return request({ url: "/admin/saveLegalInfos", method: "post", - data: { - data: JSON.stringify(data) - }, + data: data, }); } + +/** + * 获取企业信息 + * @param {number} tid 租户ID + * @returns {Promise} + */ +export function getCompanyInfos(tid) { + return request({ + url: "/admin/companyInfos", + method: "get", + params: { tid } + }); +} + +/** + * 保存企业信息 + * @param {Object} data 要保存的数据 + * @returns {Promise} + */ +export function saveCompanyInfos(data) { + return request({ + url: "/admin/saveCompanyInfos", + method: "post", + data: data, + }); +} \ No newline at end of file diff --git a/src/views/basicSettings/siteSettings/components/contactSettings.vue b/src/views/basicSettings/siteSettings/components/contactSettings.vue index 6d652d3..209d541 100644 --- a/src/views/basicSettings/siteSettings/components/contactSettings.vue +++ b/src/views/basicSettings/siteSettings/components/contactSettings.vue @@ -20,10 +20,14 @@ diff --git a/src/views/basicSettings/siteSettings/components/legalNotice.vue b/src/views/basicSettings/siteSettings/components/legalNotice.vue index 7ef3cb3..320965c 100644 --- a/src/views/basicSettings/siteSettings/components/legalNotice.vue +++ b/src/views/basicSettings/siteSettings/components/legalNotice.vue @@ -22,7 +22,7 @@ /> - 保存设置 + 保存设置 重置 @@ -34,7 +34,9 @@ import { ElMessage } from "element-plus"; import type { FormInstance, FormRules } from "element-plus"; import { getLegalInfos, saveLegalInfos } from "@/api/sitesettings"; +import { useAuthStore } from "@/stores/auth"; +const authStore = useAuthStore(); const legalNoticeFormRef = ref(); const legalNotice = ref(""); @@ -64,12 +66,21 @@ const initLegalInfos = async () => { } }; -const saveLegalInfos = async () => { +const handleSaveLegalInfos = async () => { if (!legalNoticeFormRef.value) return; - await legalNoticeFormRef.value.validate((valid) => { + await legalNoticeFormRef.value.validate(async (valid) => { if (valid) { - // TODO: 保存法律声明和隐私条款 - ElMessage.success("法律声明和隐私条款保存成功"); + const data = { + tid: authStore.user.tid, + legalNotice: legalNotice.value, + privacyTerms: privacyTerms.value + }; + const res = await saveLegalInfos(data); + if (res.code === 200) { + ElMessage.success("保存成功"); + } else { + ElMessage.error(res.msg || "保存失败"); + } } }); }; diff --git a/src/views/basicSettings/siteSettings/components/normalSettings.vue b/src/views/basicSettings/siteSettings/components/normalSettings.vue index 8b22905..c81de3e 100644 --- a/src/views/basicSettings/siteSettings/components/normalSettings.vue +++ b/src/views/basicSettings/siteSettings/components/normalSettings.vue @@ -67,8 +67,10 @@ import { Plus } from "@element-plus/icons-vue"; import type { FormInstance, FormRules, UploadFile } from "element-plus"; import { getNormalInfos, saveNormalInfos } from "@/api/sitesettings"; import { uploadFile } from "@/api/file"; +import { useAuthStore } from "@/stores/auth"; const API_BASE_URL = import.meta.env.VITE_API_BASE_URL; +const authStore = useAuthStore(); const normalFormRef = ref(); @@ -96,20 +98,16 @@ const normalRules: FormRules = { //调用基础数据 const initNormalInfos = async () => { - const res = await getNormalInfos(); + const res = await getNormalInfos(authStore.user.tid); if (res.code === 200 && res.data) { const data = res.data; - const dataMap: Record = {}; - data.forEach((item: any) => { - dataMap[item.label] = item.value; - }); - sitename.value = dataMap["sitename"] || ""; - logo.value = dataMap["logo"] || ""; - logow.value = dataMap["logow"] || ""; - description.value = dataMap["description"] || ""; - copyright.value = dataMap["copyright"] || ""; - icp.value = dataMap["icp"] || ""; - companyname.value = dataMap["companyname"] || ""; + sitename.value = data.sitename || ""; + logo.value = data.logo || ""; + logow.value = data.logow || ""; + description.value = data.description || ""; + copyright.value = data.copyright || ""; + icp.value = data.icp || ""; + companyname.value = data.companyname || ""; } }; @@ -153,15 +151,16 @@ const handleSaveNormalInfos = async () => { if (!normalFormRef.value) return; await normalFormRef.value.validate(async (valid) => { if (valid) { - const data = [ - { label: "sitename", value: sitename.value }, - { label: "logo", value: logo.value }, - { label: "logow", value: logow.value }, - { label: "description", value: description.value }, - { label: "companyname", value: companyname.value }, - { label: "copyright", value: copyright.value }, - { label: "icp", value: icp.value }, - ]; + const data = { + tid: authStore.user.tid, + sitename: sitename.value, + logo: logo.value, + logow: logow.value, + description: description.value, + companyname: companyname.value, + copyright: copyright.value, + icp: icp.value, + }; const res = await saveNormalInfos(data); if (res.code === 200) { ElMessage.success("保存成功"); diff --git a/src/views/basicSettings/siteSettings/index.vue b/src/views/basicSettings/siteSettings/index.vue index 9dae6fd..cd7d82c 100644 --- a/src/views/basicSettings/siteSettings/index.vue +++ b/src/views/basicSettings/siteSettings/index.vue @@ -9,7 +9,10 @@ - + @@ -17,15 +20,24 @@ - + - + - + diff --git a/src/views/basicSettings/tenants/domain.vue b/src/views/basicSettings/tenants/domain.vue index 0c14aa6..510478c 100644 --- a/src/views/basicSettings/tenants/domain.vue +++ b/src/views/basicSettings/tenants/domain.vue @@ -23,7 +23,11 @@ - + {{ scope.row.full_domain }} @@ -31,16 +35,31 @@ 审核中 - 已生效 + 已生效 已禁用 - + - + 复制 + + 删除 + @@ -49,7 +68,11 @@ - + - {{ form.main_domain ? '.' + form.main_domain : '' }} + {{ + form.main_domain ? "." + form.main_domain : "" + }} - 只能包含字母、数字和连字符,不能以连字符开头或结尾 + + 只能包含字母、数字和连字符,不能以连字符开头或结尾 + - {{ form.sub_domain ? form.sub_domain + '.' + (form.main_domain || 'example.com') : '请填写上方信息' }} + {{ + form.sub_domain + ? form.sub_domain + "." + (form.main_domain || "example.com") + : "请填写上方信息" + }} 取消 - 提交申请 + 提交申请 \ No newline at end of file +