更新密码找回uniapp

This commit is contained in:
hero920103 committed 2026-11-16 17:22:50 +08:00
1 parent 7f9a66da0f
commit 3fdda89833
1304 files changed
+3503 -26132

No files matched your search

-3
View File
@@ -1,6 +1,3 @@
/**
* 构建前删除 dist,带重试。缓解 Windows 上 Vite emptyDir 的 EPERM(文件被资源管理器预览、杀毒、vite preview 等占用)。
*/
import fs from "fs";
import path from "path";
import { fileURLToPath } from "url";
-2
View File
@@ -4,14 +4,12 @@ import { onMounted } from 'vue'
import { getWebsiteSetting } from '@/api/websiteSetting'
import { applyFavicon } from '@/utils/favicon'
// 浏览器标签页图标:取「平台设置 - 平台信息」的站点图标,未配置则保留默认图标
onMounted(async () => {
if (!localStorage.getItem('token')) return
try {
const res = await getWebsiteSetting()
if (res?.code === 200) applyFavicon(res.data?.values?.ico)
} catch (error) {
// 图标属于装饰信息,取不到时不影响页面
}
})
</script>
-1
View File
@@ -91,7 +91,6 @@ export function replenishAccountPool(module, data) {
});
}
/** 使用厂商 Token 探测是否可用(服务端转发)。Cursor 传 { id, accessToken }(会话 JWT)以便回写 is_used;仅传 accessToken 也可探测但不更新库;Windsurf/Kiro 传 { id } */
export function probeAccountPoolToken(module, data) {
return request({
url: `${base(module)}/probeToken`,
-13
View File
@@ -1,11 +1,5 @@
import request from "@/utils/request";
/**
* 智能体 API 管理模块
* 按上游接口(OpenAI / Anthropic / Gemini 等)存储调用地址、Key、模型列表
*/
/** 上游接口配置列表 */
export function getAgentApiList(params) {
return request({
url: "/platform/agentApi/list",
@@ -14,7 +8,6 @@ export function getAgentApiList(params) {
});
}
/** 上游接口配置详情 */
export function getAgentApiDetail(id) {
return request({
url: `/platform/agentApi/${id}`,
@@ -22,7 +15,6 @@ export function getAgentApiDetail(id) {
});
}
/** 新增上游接口配置 */
export function createAgentApi(data) {
return request({
url: "/platform/agentApi",
@@ -31,7 +23,6 @@ export function createAgentApi(data) {
});
}
/** 更新上游接口配置 */
export function updateAgentApi(id, data) {
return request({
url: `/platform/agentApi/${id}`,
@@ -40,7 +31,6 @@ export function updateAgentApi(id, data) {
});
}
/** 删除上游接口配置 */
export function deleteAgentApi(id) {
return request({
url: `/platform/agentApi/${id}`,
@@ -48,7 +38,6 @@ export function deleteAgentApi(id) {
});
}
/** 批量删除 */
export function batchDeleteAgentApi(ids) {
return request({
url: "/platform/agentApi/batchDelete",
@@ -57,7 +46,6 @@ export function batchDeleteAgentApi(ids) {
});
}
/** 切换启用状态 */
export function toggleAgentApiStatus(id, status) {
return request({
url: `/platform/agentApi/${id}/status`,
@@ -66,7 +54,6 @@ export function toggleAgentApiStatus(id, status) {
});
}
/** 测试指定配置下某个模型的连通性 */
export function testAgentApiConnection(data) {
return request({
url: "/platform/agentApi/test",
-9
View File
@@ -1,6 +1,5 @@
import request from "@/utils/request";
/** AI 服务商列表(可按 provider_type 过滤) */
export function getAiProviderList(params) {
return request({ url: "/platform/ai/provider/list", method: "get", params });
}
@@ -17,12 +16,10 @@ export function deleteAiProvider(id) {
return request({ url: `/platform/ai/provider/${id}`, method: "delete" });
}
/** 连通性测试 { id, model? } */
export function testAiProvider(data) {
return request({ url: "/platform/ai/provider/test", method: "post", data });
}
/** Playground 对话 { provider_id, model, messages } */
export function aiChat(data) {
return request({ url: "/platform/ai/chat", method: "post", data });
}
@@ -35,32 +32,26 @@ export function saveOcrConfig(data) {
return request({ url: "/platform/ai/ocrConfig", method: "post", data });
}
/** OCR 识别占位接口 */
export function ocrRecognize(data) {
return request({ url: "/platform/ai/ocr/recognize", method: "post", data });
}
/** AI 会话列表 */
export function getAiChatSessions() {
return request({ url: "/platform/ai/chat/sessions", method: "get" });
}
/** 新建 AI 会话 { provider_id, model } */
export function createAiChatSession(data) {
return request({ url: "/platform/ai/chat/session", method: "post", data });
}
/** 会话消息列表 */
export function getAiChatSessionMessages(id) {
return request({ url: `/platform/ai/chat/session/${id}/messages`, method: "get" });
}
/** 重命名 / 置顶会话 { title?, is_top? } */
export function updateAiChatSession(id, data) {
return request({ url: `/platform/ai/chat/session/${id}`, method: "put", data });
}
/** 删除会话 */
export function deleteAiChatSession(id) {
return request({ url: `/platform/ai/chat/session/${id}`, method: "delete" });
}
-1
View File
@@ -1,6 +1,5 @@
import request from "@/utils/request";
// 用户 / 租户统计(真实数据,取自租户端用户表、租户表与登录日志)
export function getPlatformUserAnalytics() {
return request({
url: "/platform/analytics/users",
-10
View File
@@ -1,8 +1,5 @@
import request from '@/utils/request'
// ==================== 平台端审批流配置 ====================
// 可绑定的业务类型(顶级选择,用于流程绑定模块)
export function getApprovalBizTypes() {
return request({
url: '/platform/approval/biz-types',
@@ -10,7 +7,6 @@ export function getApprovalBizTypes() {
})
}
// 流程列表(可按 biz_type 过滤)
export function getApprovalFlowList(params) {
return request({
url: '/platform/approval/flow/list',
@@ -19,7 +15,6 @@ export function getApprovalFlowList(params) {
})
}
// 流程详情(含全部节点)
export function getApprovalFlowDetail(id) {
return request({
url: `/platform/approval/flow/detail/${id}`,
@@ -27,7 +22,6 @@ export function getApprovalFlowDetail(id) {
})
}
// 保存流程(新建或更新,节点全量覆盖)
export function saveApprovalFlow(data) {
return request({
url: '/platform/approval/flow/save',
@@ -36,7 +30,6 @@ export function saveApprovalFlow(data) {
})
}
// 删除流程
export function deleteApprovalFlow(id) {
return request({
url: `/platform/approval/flow/delete/${id}`,
@@ -44,7 +37,6 @@ export function deleteApprovalFlow(id) {
})
}
// 审批人候选项(平台角色 + 平台用户 + 分类模块)
export function getApprovalOptions() {
return request({
url: '/platform/approval/options',
@@ -52,7 +44,6 @@ export function getApprovalOptions() {
})
}
// 审批流编号轻量清单(按分类返回启用流程的 flow_code/flow_name)
export function getApprovalFlowPick(params) {
return request({
url: '/platform/approval/flow/pick',
@@ -61,7 +52,6 @@ export function getApprovalFlowPick(params) {
})
}
// 业务侧发起前拉可用流
export function getAvailableFlows(params) {
return request({ url: '/platform/approval/flow/available', method: 'get', params })
}
-28
View File
@@ -1,12 +1,5 @@
import request from "@/utils/request";
// ==================== 官网管理 - 文章 / 分类(平台端) ====================
// 数据表:yz_platform_website_article / yz_platform_website_category
// 建表 SQL:go/docs/sql/create_platform_website.sql
// ---------- 文章 ----------
// 文章列表(分页):keyword / cate / status / startDate / endDate / page / pageSize
export function listArticles(params) {
return request({
url: "/platform/website/article/list",
@@ -15,7 +8,6 @@ export function listArticles(params) {
});
}
// 全部文章(不分页,供选择/关联使用)
export function listAllArticles(params) {
return request({
url: "/platform/website/article/all",
@@ -24,7 +16,6 @@ export function listAllArticles(params) {
});
}
// 文章详情(含标签ID列表 tags)
export function getArticle(id) {
return request({
url: `/platform/website/article/${id}`,
@@ -32,7 +23,6 @@ export function getArticle(id) {
});
}
// 新增文章
export function createArticle(data) {
return request({
url: "/platform/website/article",
@@ -41,7 +31,6 @@ export function createArticle(data) {
});
}
// 编辑文章
export function editArticle(id, data) {
return request({
url: `/platform/website/article/${id}`,
@@ -50,7 +39,6 @@ export function editArticle(id, data) {
});
}
// 删除文章
export function deleteArticle(id) {
return request({
url: `/platform/website/article/${id}`,
@@ -58,7 +46,6 @@ export function deleteArticle(id) {
});
}
// 回收站列表(已软删除的文章):keyword / page / pageSize
export function recycleArticles(params) {
return request({
url: "/platform/website/article/recycle",
@@ -67,7 +54,6 @@ export function recycleArticles(params) {
});
}
// 从回收站恢复文章
export function restoreArticle(id) {
return request({
url: `/platform/website/article/${id}/restore`,
@@ -75,7 +61,6 @@ export function restoreArticle(id) {
});
}
// 彻底删除文章(仅限回收站中的记录,不可恢复)
export function purgeArticle(id) {
return request({
url: `/platform/website/article/${id}/purge`,
@@ -83,7 +68,6 @@ export function purgeArticle(id) {
});
}
// 发布文章(uid 选填,用于记录发布人)
export function publishArticle(id, uid) {
return request({
url: `/platform/website/article/${id}/publish`,
@@ -92,7 +76,6 @@ export function publishArticle(id, uid) {
});
}
// 下架文章(状态置为「已隐藏」)
export function unPublishArticle(id) {
return request({
url: `/platform/website/article/${id}/unpublish`,
@@ -100,7 +83,6 @@ export function unPublishArticle(id) {
});
}
// 文章推荐 / 取消推荐
export function articleRecommend(id) {
return request({
url: `/platform/website/article/${id}/recommend`,
@@ -115,7 +97,6 @@ export function unArticleRecommend(id) {
});
}
// 文章置顶 / 取消置顶
export function articleTop(id) {
return request({
url: `/platform/website/article/${id}/top`,
@@ -130,9 +111,6 @@ export function unArticleTop(id) {
});
}
// ---------- 分类 ----------
// 全量分类(前端自行组树,支持 keyword)
export function allCategories(params) {
return request({
url: "/platform/website/category/all",
@@ -141,7 +119,6 @@ export function allCategories(params) {
});
}
// 分类分页列表
export function listCategories(params) {
return request({
url: "/platform/website/category/list",
@@ -150,7 +127,6 @@ export function listCategories(params) {
});
}
// 分类详情
export function getCategory(id) {
return request({
url: `/platform/website/category/${id}`,
@@ -158,7 +134,6 @@ export function getCategory(id) {
});
}
// 新增分类
export function createCategory(data) {
return request({
url: "/platform/website/category",
@@ -167,7 +142,6 @@ export function createCategory(data) {
});
}
// 编辑分类
export function editCategory(id, data) {
return request({
url: `/platform/website/category/${id}`,
@@ -176,7 +150,6 @@ export function editCategory(id, data) {
});
}
// 删除分类
export function deleteCategory(id) {
return request({
url: `/platform/website/category/${id}`,
@@ -184,7 +157,6 @@ export function deleteCategory(id) {
});
}
// 更新分类状态
export function updateCategoryStatus(id, status) {
return request({
url: `/platform/website/category/${id}/status`,
-4
View File
@@ -1,7 +1,5 @@
import request from "@/utils/request";
// 统一认证中心 - 接入应用(OIDC Client)管理
export function getAuthClientList(params) {
return request({
url: "/platform/authClient/list",
@@ -33,7 +31,6 @@ export function editAuthClient(id, data) {
});
}
/** 重置密钥:返回的新密钥仅此一次显示 */
export function resetAuthClientSecret(id) {
return request({
url: `/platform/authClient/resetSecret/${id}`,
@@ -41,7 +38,6 @@ export function resetAuthClientSecret(id) {
});
}
/** 停用应用(逻辑删除) */
export function deleteAuthClient(id) {
return request({
url: `/platform/authClient/delete/${id}`,
-3
View File
@@ -1,7 +1,5 @@
import request from "@/utils/request";
// 统一认证中心 - 租户登录策略配置
export function getAuthConfig(tid) {
return request({
url: "/platform/authConfig/detail",
@@ -18,7 +16,6 @@ export function saveAuthConfig(data) {
});
}
/** 恢复默认值(删除该租户的自定义配置) */
export function resetAuthConfig(tid) {
return request({
url: `/platform/authConfig/reset/${tid}`,
-3
View File
@@ -1,7 +1,5 @@
import request from "@/utils/request";
// 统一认证中心 - 第三方登录配置(tid=0 全局 / tid>0 租户自带)
export function getAuthIdpList(tid) {
return request({
url: "/platform/authIdp/list",
@@ -33,7 +31,6 @@ export function deleteAuthIdp(id) {
});
}
/** 获取某平台需要填写的回调地址 */
export function getAuthIdpCallbackHint(provider) {
return request({
url: "/platform/authIdp/callbackHint",
-73
View File
@@ -1,13 +1,5 @@
import request from "@/utils/request";
/*************************************************
****************** 宝贝相关接口 ******************
*************************************************/
/**
* 获取宝贝列表
* @returns {Promise}
*/
export function getBabyList() {
return request({
url: '/platform/babys/list',
@@ -15,11 +7,6 @@ export function getBabyList() {
});
}
/**
* 获取宝贝详情
* @param {number} id 宝贝ID
* @returns {Promise}
*/
export function getBabyDetail(id) {
return request({
url: `/platform/babys/${id}`,
@@ -27,11 +14,6 @@ export function getBabyDetail(id) {
});
}
/**
* 创建宝贝数据
* @param {Object} data 宝贝数据
* @returns {Promise}
*/
export function createBaby(data) {
return request({
url: "/platform/babys",
@@ -43,7 +25,6 @@ export function createBaby(data) {
});
}
// 更新宝贝信息
export function editBaby(id, data) {
return request({
url: `/platform/baby/update/${id}`,
@@ -52,11 +33,6 @@ export function editBaby(id, data) {
});
}
/**
* 删除宝贝数据
* @param {number} id 宝贝ID
* @returns {Promise}
*/
export function deleteBaby(id) {
return request({
url: `/platform/babys/${id}`,
@@ -64,12 +40,6 @@ export function deleteBaby(id) {
});
}
/**
* 绑定父母
* @param {number} id 宝贝ID
* @param {Object} data 绑定数据
* @returns {Promise}
*/
export function bindParent(id, data) {
return request({
url: `/platform/babys/bindparents/${id}`,
@@ -78,11 +48,6 @@ export function bindParent(id, data) {
});
}
/**
* 获取父母
* @param {number} id 宝贝ID
* @returns {Promise}
*/
export function getParents(id) {
return request({
url: `/platform/babys/getParents/${id}`,
@@ -90,14 +55,6 @@ export function getParents(id) {
});
}
/*************************************************
****************** 用户相关接口 ******************
*************************************************/
/**
* 获取用户列表
* @returns {Promise}
*/
export function getUserList() {
return request({
url: "/platform/babyhealthUser/list",
@@ -105,11 +62,6 @@ export function getUserList() {
});
}
/**
* 获取用户详情
* @param {number} id 用户ID
* @returns {Promise}
*/
export function getUserDetail(id) {
return request({
url: `/platform/babyhealthUser/detail/${id}`,
@@ -117,11 +69,6 @@ export function getUserDetail(id) {
});
}
/**
* 创建用户数据
* @param {Object} data 用户数据
* @returns {Promise}
*/
export function createUser(data) {
return request({
url: "/platform/babyhealthUser/create",
@@ -133,12 +80,6 @@ export function createUser(data) {
});
}
/**
* 更新用户数据
* @param {number} id 用户ID
* @param {Object} data 更新的数据
* @returns {Promise}
*/
export function updateUser(id, data) {
return request({
url: `/platform/babyhealthUser/update/${id}`,
@@ -150,11 +91,6 @@ export function updateUser(id, data) {
});
}
/**
* 删除用户数据
* @param {number} id 用户ID
* @returns {Promise}
*/
export function deleteUser(id) {
return request({
url: `/platform/babyhealthUser/delete/${id}`,
@@ -162,15 +98,6 @@ export function deleteUser(id) {
});
}
/*************************************************
****************** 仪表盘相关接口 ******************
*************************************************/
/**
* dashborad总体输出
* @returns {Promise}
*/
export function getDashborad() {
return request({
url: "/platform/babyhealthDashborad/dashborad",
-20
View File
@@ -1,9 +1,5 @@
import request from "@/utils/request";
/**
* 获取所有Banner
* @returns {Promise}
*/
export function getBanners() {
return request({
url: "/platform/allbanners",
@@ -11,11 +7,6 @@ export function getBanners() {
});
}
/**
* 创建Banner
* @param {Object} bannerData Banner数据
* @returns {Promise}
*/
export function createBanner(formData) {
return request({
url: "/platform/createbanner",
@@ -27,12 +18,6 @@ export function createBanner(formData) {
});
}
/**
* 编辑Banner
* @param {number|string} id Banner ID
* @param {Object} bannerData 更新的数据
* @returns {Promise}
*/
export function editBanner(id, bannerData) {
return request({
url: `/platform/editbanner/${id}`,
@@ -41,11 +26,6 @@ export function editBanner(id, bannerData) {
});
}
/**
* 删除Banner
* @param {number|string} id Banner ID
* @returns {Promise}
*/
export function deleteBanner(id) {
return request({
url: `/platform/deletebanner/${id}`,
-10
View File
@@ -1,10 +1,5 @@
import request from "@/utils/request";
// ==================== 官网管理 - 评论管理(平台端) ====================
// 数据表:yz_platform_website_comment
// status:0 待审核,1 已通过,2 已拒绝
// 评论列表(分页):keyword / status / article_id / page / pageSize
export function listComments(params) {
return request({
url: "/platform/website/comment/list",
@@ -13,7 +8,6 @@ export function listComments(params) {
});
}
// 评论详情
export function getComment(id) {
return request({
url: `/platform/website/comment/${id}`,
@@ -21,7 +15,6 @@ export function getComment(id) {
});
}
// 审核评论(status:1 通过 / 2 拒绝)
export function auditComment(id, status) {
return request({
url: `/platform/website/comment/${id}/audit`,
@@ -30,7 +23,6 @@ export function auditComment(id, status) {
});
}
// 回复评论
export function replyComment(id, reply) {
return request({
url: `/platform/website/comment/${id}/reply`,
@@ -39,7 +31,6 @@ export function replyComment(id, reply) {
});
}
// 删除评论
export function deleteComment(id) {
return request({
url: `/platform/website/comment/${id}`,
@@ -47,7 +38,6 @@ export function deleteComment(id) {
});
}
// 批量删除评论
export function batchDeleteComments(ids) {
return request({
url: "/platform/website/comment/batchdelete",
-2
View File
@@ -1,6 +1,5 @@
import request from "@/utils/request";
/** 投诉建议列表 */
export function getComplaintList(params) {
return request({
url: "/platform/complaint/list",
@@ -39,7 +38,6 @@ export function deleteComplaint(id) {
});
}
/** 产品分类(投诉建议用) */
export function getComplaintCategoryList() {
return request({
url: "/platform/complaintCategory/list",
-14
View File
@@ -1,9 +1,5 @@
import request from "@/utils/request";
/**
* 获取平台统计数据(平台用户使用)
* @returns {Promise}
*/
export function getPlatformStats() {
return request({
url: "/platform/dashboard/platform-stats",
@@ -11,10 +7,6 @@ export function getPlatformStats() {
});
}
/**
* 获取租户统计数据(租户员工使用)
* @returns {Promise}
*/
export function getTenantStats() {
return request({
url: "/platform/dashboard/tenant-stats",
@@ -22,12 +14,6 @@ export function getTenantStats() {
});
}
/**
* 获取用户活动日志(操作日志和登录日志)
* @param {number} pageNum - 页码
* @param {number} pageSize - 每页数量
* @returns {Promise}
*/
export function getActivityLogs(pageNum = 1, pageSize = 10) {
return request({
url: "/platform/dashboard/user-activity-logs",
-20
View File
@@ -1,9 +1,5 @@
import request from "@/utils/request";
/**
* 获取需求列表
* @returns {Promise}
*/
export function getDemandList() {
return request({
url: "/platform/demandList",
@@ -11,11 +7,6 @@ export function getDemandList() {
});
}
/**
* 新增需求
* @param {Object} data 需求数据
* @returns {Promise}
*/
export function addDemand(data) {
return request({
url: "/platform/addDemand",
@@ -24,12 +15,6 @@ export function addDemand(data) {
});
}
/**
* 编辑需求
* @param {number} id 需求ID
* @param {Object} data 需求数据
* @returns {Promise}
*/
export function editDemand(id, data) {
return request({
url: `/platform/editDemand/${id}`,
@@ -38,11 +23,6 @@ export function editDemand(id, data) {
});
}
/**
* 删除需求
* @param {number} id 需求ID
* @returns {Promise}
*/
export function deleteDemand(id) {
return request({
url: `/platform/deleteDemand/${id}`,
-5
View File
@@ -1,6 +1,5 @@
import request from '@/utils/request';
// 获取租户下的所有部门
export function getTenantDepartments(tenantId) {
return request({
url: `/platform/departments/tenant/${tenantId}`,
@@ -8,7 +7,6 @@ export function getTenantDepartments(tenantId) {
});
}
// 获取部门详情
export function getDepartmentInfo(departmentId) {
return request({
url: `/platform/departments/${departmentId}`,
@@ -16,7 +14,6 @@ export function getDepartmentInfo(departmentId) {
});
}
// 添加部门
export function addDepartment(data) {
return request({
url: '/platform/departments',
@@ -25,7 +22,6 @@ export function addDepartment(data) {
});
}
// 更新部门信息
export function editDepartment(departmentId, data) {
return request({
url: `/platform/departments/${departmentId}`,
@@ -34,7 +30,6 @@ export function editDepartment(departmentId, data) {
});
}
// 删除部门
export function deleteDepartment(departmentId) {
return request({
url: `/platform/departments/${departmentId}`,
-28
View File
@@ -1,16 +1,7 @@
import request from '@/utils/request'
/**
* 数据字典接口(平台端)
*
* 表:yz_platform_dict / yz_platform_dict_item
* 平台端字典不做租户隔离,与租户端(/backend/dict)各自独立。
*/
const PREFIX = '/platform/dict'
/* ================= 字典列表(字典类型) ================= */
/** 字典列表(分页)params: { page, pageSize, keyword, status } */
export function getDictTypes(params) {
return request({
url: `${PREFIX}/types`,
@@ -19,7 +10,6 @@ export function getDictTypes(params) {
})
}
/** 新增字典 */
export function createDictType(data) {
return request({
url: `${PREFIX}/types`,
@@ -28,7 +18,6 @@ export function createDictType(data) {
})
}
/** 编辑字典(dict_code 不可改,由后端忽略) */
export function updateDictType(id, data) {
return request({
url: `${PREFIX}/types/${id}`,
@@ -37,7 +26,6 @@ export function updateDictType(id, data) {
})
}
/** 删除字典(其下仍有字典项时后端会拒绝) */
export function deleteDictType(id) {
return request({
url: `${PREFIX}/types/${id}`,
@@ -45,9 +33,6 @@ export function deleteDictType(id) {
})
}
/* ================= 字典项 ================= */
/** 字典项列表(分页)params: { dict_id, page, pageSize, keyword, status } */
export function getDictItems(params) {
return request({
url: `${PREFIX}/items`,
@@ -56,7 +41,6 @@ export function getDictItems(params) {
})
}
/** 新增字典项 */
export function createDictItem(data) {
return request({
url: `${PREFIX}/items`,
@@ -65,7 +49,6 @@ export function createDictItem(data) {
})
}
/** 编辑字典项 */
export function updateDictItem(id, data) {
return request({
url: `${PREFIX}/items/${id}`,
@@ -74,7 +57,6 @@ export function updateDictItem(id, data) {
})
}
/** 启用 / 停用字典项 */
export function toggleDictItemStatus(id, status) {
return request({
url: `${PREFIX}/items/${id}/status`,
@@ -83,7 +65,6 @@ export function toggleDictItemStatus(id, status) {
})
}
/** 删除字典项 */
export function deleteDictItem(id) {
return request({
url: `${PREFIX}/items/${id}`,
@@ -91,9 +72,6 @@ export function deleteDictItem(id) {
})
}
/* ================= 业务读取 ================= */
/** 按字典编码取「字典类型与字典项都启用」的选项,供业务页面下拉使用 */
export function getDictOptions(code) {
return request({
url: `${PREFIX}/options/${code}`,
@@ -101,11 +79,6 @@ export function getDictOptions(code) {
})
}
/**
* 批量取多个字典的选项(一次请求),供页面/应用启动时预加载。
* 返回 data.dicts = { [dict_code]: 字典项[] },不存在的编码返回空数组。
* @param {string[]} codes 字典编码数组
*/
export function getDictOptionsBatch(codes) {
return request({
url: `${PREFIX}/options`,
@@ -114,7 +87,6 @@ export function getDictOptionsBatch(codes) {
})
}
/** 一次取回全部「启用」字典的字典项,供登录后预热缓存 */
export function getAllDictOptions() {
return request({
url: `${PREFIX}/options`,
-20
View File
@@ -1,8 +1,5 @@
import request from '@/utils/request'
// ==================== 主域名池管理 ====================
// 获取域名池列表
export function getDomainPoolList(params) {
return request({
url: '/platform/domain/pool/index',
@@ -11,7 +8,6 @@ export function getDomainPoolList(params) {
})
}
// 获取启用的主域名列表
export function getEnabledDomains() {
return request({
url: '/platform/domain/pool/getEnabledDomains',
@@ -19,7 +15,6 @@ export function getEnabledDomains() {
})
}
// 创建主域名
export function createDomainPool(data) {
return request({
url: '/platform/domain/pool/create',
@@ -28,7 +23,6 @@ export function createDomainPool(data) {
})
}
// 更新主域名
export function updateDomainPool(data) {
return request({
url: '/platform/domain/pool/update',
@@ -37,7 +31,6 @@ export function updateDomainPool(data) {
})
}
// 删除主域名
export function deleteDomainPool(id) {
return request({
url: `/platform/domain/pool/delete/${id}`,
@@ -45,7 +38,6 @@ export function deleteDomainPool(id) {
})
}
// 切换主域名状态
export function toggleDomainPoolStatus(id) {
return request({
url: '/platform/domain/pool/toggleStatus',
@@ -54,9 +46,6 @@ export function toggleDomainPoolStatus(id) {
})
}
// ==================== 租户域名管理 ====================
// 获取租户域名列表(管理员)
export function getTenantDomainList(params) {
return request({
url: '/platform/domain/tenant/index',
@@ -65,7 +54,6 @@ export function getTenantDomainList(params) {
})
}
// 获取当前租户的域名列表
export function getMyDomains(params) {
return request({
url: '/platform/domain/tenant/myDomains',
@@ -74,7 +62,6 @@ export function getMyDomains(params) {
})
}
// 申请二级域名
export function applyTenantDomain(data) {
return request({
url: '/platform/domain/tenant/apply',
@@ -83,7 +70,6 @@ export function applyTenantDomain(data) {
})
}
// 绑定自有域名(提交后需按提示配置解析,再调 checkCustomDns)
export function bindCustomDomain(data) {
return request({
url: '/platform/domain/tenant/bindCustom',
@@ -92,7 +78,6 @@ export function bindCustomDomain(data) {
})
}
// 检测自有域名解析,通过后后端自动申请 HTTPS 证书
export function checkCustomDomainDns(id) {
return request({
url: '/platform/domain/tenant/checkCustomDns',
@@ -101,7 +86,6 @@ export function checkCustomDomainDns(id) {
})
}
// 获取自有域名解析配置指引(CNAME 目标 / A 记录 IP)
export function getCustomDomainGuide() {
return request({
url: '/platform/domain/tenant/customDomainGuide',
@@ -109,7 +93,6 @@ export function getCustomDomainGuide() {
})
}
// 审核租户域名
export function auditTenantDomain(data) {
return request({
url: '/platform/domain/tenant/audit',
@@ -118,7 +101,6 @@ export function auditTenantDomain(data) {
})
}
// 获取域名审批进度(引擎节点与各审批人状态)
export function getDomainAuditProgress(id) {
return request({
url: `/platform/domain/tenant/audit/progress/${id}`,
@@ -126,7 +108,6 @@ export function getDomainAuditProgress(id) {
})
}
// 禁用/启用租户域名
export function toggleTenantDomainStatus(id) {
return request({
url: '/platform/domain/tenant/toggleStatus',
@@ -135,7 +116,6 @@ export function toggleTenantDomainStatus(id) {
})
}
// 删除租户域名
export function deleteTenantDomain(id) {
return request({
url: `/platform/domain/tenant/delete/${id}`,
-12
View File
@@ -1,9 +1,5 @@
import request from "@/utils/request";
/**
* 获取邮箱信息
* @returns {Promise}
*/
export function getEmailInfo() {
return request({
url: "/platform/email/info",
@@ -11,10 +7,6 @@ export function getEmailInfo() {
});
}
/**
* 编辑邮箱信息
* @returns {Promise}
*/
export function editEmailInfo(data) {
return request({
url: "/platform/email/editinfo",
@@ -23,10 +15,6 @@ export function editEmailInfo(data) {
});
}
/**
* 发送测试邮件
* @returns {Promise}
*/
export function sendTestEmail(data) {
return request({
url: "/platform/email/sendtestemail",
-58
View File
@@ -1,13 +1,5 @@
import request from "@/utils/request";
/*************************************************
****************** 组织机构相关接口 ******************
*************************************************/
/**
* 获取组织机构列表
* @returns {Promise}
*/
export function getOrganizationList() {
return request({
url: '/platform/erp/getOrganization',
@@ -15,11 +7,6 @@ export function getOrganizationList() {
});
}
/**
* 获取组织机构详情
* @param {number} id 组织机构ID
* @returns {Promise}
*/
export function getOrganizationDetail(id) {
return request({
url: `/platform/erp/getOrganizationDetail/${id}`,
@@ -27,11 +14,6 @@ export function getOrganizationDetail(id) {
});
}
/**
* 创建组织机构数据
* @param {Object} data 组织机构数据
* @returns {Promise}
*/
export function createOrganization(data) {
return request({
url: "/platform/erp/createOrganization",
@@ -43,7 +25,6 @@ export function createOrganization(data) {
});
}
// 更新组织机构信息
export function editOrganization(id, data) {
return request({
url: `/platform/erp/editOrganization/${id}`,
@@ -52,11 +33,6 @@ export function editOrganization(id, data) {
});
}
/**
* 删除组织机构数据
* @param {number} id 组织机构ID
* @returns {Promise}
*/
export function deleteOrganization(id) {
return request({
url: `/platform/erp/deleteOrganization/${id}`,
@@ -64,10 +40,6 @@ export function deleteOrganization(id) {
});
}
/**
* 获取企业单位列表
* @returns {Promise}
*/
export function getCompanys() {
return request({
url: '/platform/erp/getCompanys',
@@ -75,11 +47,6 @@ export function getCompanys() {
});
}
/**
* 获取部门列表
* @param {number} parentId 隶属单位ID
* @returns {Promise}
*/
export function getDepartments(parentId) {
return request({
url: '/platform/erp/getDepartments',
@@ -88,15 +55,6 @@ export function getDepartments(parentId) {
});
}
/*************************************************
****************** 员工相关接口 ******************
*************************************************/
/**
* 获取员工列表
* @param {number} tenantId 租户ID
* @returns {Promise}
*/
export function getEmployeeList(tenantId) {
return request({
url: '/platform/erp/getEmployee',
@@ -105,11 +63,6 @@ export function getEmployeeList(tenantId) {
});
}
/**
* 获取员工详情
* @param {number} id 员工ID
* @returns {Promise}
*/
export function getEmployeeDetail(id) {
return request({
url: `/platform/erp/getEmployeeDetail/${id}`,
@@ -117,11 +70,6 @@ export function getEmployeeDetail(id) {
});
}
/**
* 创建员工数据
* @param {Object} data 员工数据
* @returns {Promise}
*/
export function createEmployee(data) {
return request({
url: "/platform/erp/createEmployee",
@@ -133,7 +81,6 @@ export function createEmployee(data) {
});
}
// 更新员工信息
export function editEmployee(id, data) {
return request({
url: `/platform/erp/editEmployee/${id}`,
@@ -142,11 +89,6 @@ export function editEmployee(id, data) {
});
}
/**
* 删除员工数据
* @param {number} id 员工ID
* @returns {Promise}
*/
export function deleteEmployee(id) {
return request({
url: `/platform/erp/deleteEmployee/${id}`,
-87
View File
@@ -1,9 +1,5 @@
import request from "@/utils/request";
/**
* 获取用户分类
* @returns {Promise}
*/
export function getUserCate() {
return request({
url: `/platform/usercate`,
@@ -11,11 +7,6 @@ export function getUserCate() {
});
}
/**
* 获取所有文件(支持分页、分类、关键词,与后端 query 一致)
* @param {Object} [params] page, pageSize, cate, keyword
* @returns {Promise}
*/
export function getAllFiles(params = {}) {
return request({
url: "/platform/allfiles",
@@ -24,11 +15,6 @@ export function getAllFiles(params = {}) {
});
}
/**
* 新建文件分组
* @param {Object} data 文件分组数据
* @returns {Promise}
*/
export function createFileCate(data) {
return request({
url: "/platform/createfilecate",
@@ -37,12 +23,6 @@ export function createFileCate(data) {
});
}
/**
* 重命名文件分组
* @param {number|string} id 文件分组ID
* @param {Object} data 文件分组数据
* @returns {Promise}
*/
export function renameFileCate(id, data) {
return request({
url: `/platform/renamefilecate/${id}`,
@@ -51,11 +31,6 @@ export function renameFileCate(id, data) {
});
}
/**
* 删除文件分组
* @param {number|string} id 文件分组ID
* @returns {Promise}
*/
export function deleteFileCate(id) {
return request({
url: `/platform/deletefilecate/${id}`,
@@ -63,14 +38,6 @@ export function deleteFileCate(id) {
});
}
/**
* 根据分类ID获取文件
* @param {number|string} id 分类ID
* @param {number} page 页码,默认1
* @param {number} pageSize 每页数量,默认24
* @param {string} keyword 搜索关键词,可选
* @returns {Promise}
*/
export function getCateFiles(id, page = 1, pageSize = 24, keyword = "") {
const params = {
page,
@@ -86,11 +53,6 @@ export function getCateFiles(id, page = 1, pageSize = 24, keyword = "") {
});
}
/**
* 根据文件 ID 获取单条文件信息(非分类列表)
* @param {number|string} id 文件主键 ID
* @returns {Promise}
*/
export function getFileById(id) {
return request({
url: `/platform/file/${id}`,
@@ -98,17 +60,7 @@ export function getFileById(id) {
});
}
/**
* 上传文件
* @param {FormData} formData 文件数据
* @param {Object} options 额外选项
* @param {string|number} [options.cate] 文件分组,0 为未分类
* @param {string|number} [options.tuid] 租户用户 yz_tenant_user.id;租户侧上传时传,平台管理员不传
* @param {(e: { loaded: number; total?: number }) => void} [options.onUploadProgress] 上传进度(浏览器 XHR)
* @returns {Promise}
*/
export function uploadFile(formData, options = {}) {
// 0 表示「未分类」,不能用 truthy 判断
if (options.cate !== undefined && options.cate !== null && options.cate !== "") {
formData.append("cate", String(options.cate));
}
@@ -120,7 +72,6 @@ export function uploadFile(formData, options = {}) {
url: "/platform/uploadfile",
method: "post",
data: formData,
// 不设置超时时间,等待文件上传完毕;勿设置 Content-Type(由浏览器自动带 boundary)
timeout: 0,
};
if (typeof options.onUploadProgress === "function") {
@@ -129,12 +80,6 @@ export function uploadFile(formData, options = {}) {
return request(config);
}
/**
* 更新文件信息
* @param {number|string} id 文件ID
* @param {Object} fileData 更新的数据
* @returns {Promise}
*/
export function updateFile(id, fileData) {
return request({
url: `/platform/updatefile/${id}`,
@@ -143,11 +88,6 @@ export function updateFile(id, fileData) {
});
}
/**
* 删除文件
* @param {number|string} id 文件ID
* @returns {Promise}
*/
export function deleteFile(id) {
return request({
url: `/platform/deletefile/${id}`,
@@ -155,11 +95,6 @@ export function deleteFile(id) {
});
}
/**
* 删除文件
* @param {number|string} id 文件ID
* @returns {Promise}
*/
export function deleteFilePermanently(id) {
return request({
url: `/platform/deletefilepermanently/${id}`,
@@ -167,12 +102,6 @@ export function deleteFilePermanently(id) {
});
}
/**
* 移动文件
* @param {number|string} id 文件ID
* @param {Object} fileData 更新的数据
* @returns {Promise}
*/
export function moveFile(id, cate) {
return request({
url: `/platform/movefile/${id}`,
@@ -181,11 +110,6 @@ export function moveFile(id, cate) {
});
}
/**
* 批量删除文件
* @param {Array} ids 文件ID数组
* @returns {Promise}
*/
export function batchDeleteFiles(ids) {
return request({
url: "/platform/batchdeletefiles",
@@ -194,11 +118,6 @@ export function batchDeleteFiles(ids) {
});
}
/**
* 批量彻底删除文件
* @param {Array} ids 文件ID数组
* @returns {Promise}
*/
export function batchDeleteFilesPermanently(ids) {
return request({
url: "/platform/batchDeleteFilesPermanently",
@@ -207,12 +126,6 @@ export function batchDeleteFilesPermanently(ids) {
});
}
/**
* 批量移动文件
* @param {Array} ids 文件ID数组
* @param {number} cate 目标分类ID
* @returns {Promise}
*/
export function batchMoveFiles(ids, cate) {
return request({
url: "/platform/batchMoveFiles",
-34
View File
@@ -1,14 +1,5 @@
import request from "@/utils/request";
// ==================== 官网管理 - 友情链接(平台端) ====================
// 数据表:yz_platform_website_link
// 建表 SQL:go/docs/sql/create_platform_website.sql
/**
* 获取友情链接列表(分页)
* @param {Object} params page / pageSize / keyword / status
* @returns {Promise}
*/
export function getFriendlinkList(params) {
return request({
url: "/platform/website/link/list",
@@ -17,10 +8,6 @@ export function getFriendlinkList(params) {
});
}
/**
* 获取所有启用中的友情链接
* @returns {Promise}
*/
export function getAllFriendlinks() {
return request({
url: "/platform/website/link/all",
@@ -28,11 +15,6 @@ export function getAllFriendlinks() {
});
}
/**
* 添加友情链接
* @param {Object} data 链接数据
* @returns {Promise}
*/
export function addFriendlink(data) {
return request({
url: "/platform/website/link",
@@ -41,12 +23,6 @@ export function addFriendlink(data) {
});
}
/**
* 更新友情链接(支持只传部分字段,如 {status:1})
* @param {number} id 链接ID
* @param {Object} data 链接数据
* @returns {Promise}
*/
export function updateFriendlink(id, data) {
return request({
url: `/platform/website/link/${id}`,
@@ -55,11 +31,6 @@ export function updateFriendlink(id, data) {
});
}
/**
* 删除友情链接
* @param {number} id 链接ID
* @returns {Promise}
*/
export function deleteFriendlink(id) {
return request({
url: `/platform/website/link/${id}`,
@@ -67,11 +38,6 @@ export function deleteFriendlink(id) {
});
}
/**
* 批量删除友情链接
* @param {Array} ids 链接ID数组
* @returns {Promise}
*/
export function batchDeleteFriendlinks(ids) {
return request({
url: "/platform/website/link/batchdelete",
-24
View File
@@ -1,13 +1,5 @@
import request from "@/utils/request";
// ==================== 官网管理 - 导航菜单(平台端) ====================
// 数据表:yz_platform_website_nav
// 建表 SQL:go/docs/sql/create_platform_website.sql
/**
* 获取全部导航菜单(平铺返回,前端按 pid 组树)
* @returns {Promise}
*/
export function getFrontMenus() {
return request({
url: "/platform/website/nav/list",
@@ -15,11 +7,6 @@ export function getFrontMenus() {
});
}
/**
* 创建导航菜单
* @param {Object} data 菜单数据
* @returns {Promise}
*/
export function createFrontMenu(data) {
return request({
url: "/platform/website/nav",
@@ -28,12 +15,6 @@ export function createFrontMenu(data) {
});
}
/**
* 编辑导航菜单
* @param {number|string} id 菜单ID
* @param {Object} data 更新的数据
* @returns {Promise}
*/
export function editFrontMenu(id, data) {
return request({
url: `/platform/website/nav/${id}`,
@@ -42,11 +23,6 @@ export function editFrontMenu(id, data) {
});
}
/**
* 删除导航菜单
* @param {number|string} id 菜单ID
* @returns {Promise}
*/
export function deleteFrontMenu(id) {
return request({
url: `/platform/website/nav/${id}`,
-5
View File
@@ -1,9 +1,5 @@
import request from '@/utils/request';
/**
* 按天统计号池已提取(售卖)数量,依据 extracted_time
* @param {{ days?: number }} params days 默认 14,最大 90
*/
export function getAccountPoolDailyExtract(params) {
return request({
url: '/platform/home/accountPoolDailyExtract',
@@ -12,7 +8,6 @@ export function getAccountPoolDailyExtract(params) {
});
}
/** 号池账号总数 / 已售卖(按 Cursor、Kiro、Windsurf) */
export function getAccountPoolInventoryTotals() {
return request({
url: '/platform/home/accountPoolInventoryTotals',
-21
View File
@@ -1,6 +1,5 @@
import request from "@/utils/request";
// 登录(平台端 / 使用租户名称)
export function login(data) {
return request({
url: `/platform/login`,
@@ -9,7 +8,6 @@ export function login(data) {
});
}
/** 当前登录用户信息(含角色名称),需携带 token */
export function getCurrentUser() {
return request({
url: `/platform/currentUser`,
@@ -17,7 +15,6 @@ export function getCurrentUser() {
});
}
// 发送登录验证码(手机号)
export function sendLoginCode(data) {
return request({
url: "/platform/sendLoginCode",
@@ -26,7 +23,6 @@ export function sendLoginCode(data) {
});
}
// 手机号验证码登录
export function loginBySms(data) {
return request({
url: "/platform/loginBySms",
@@ -34,9 +30,7 @@ export function loginBySms(data) {
data,
});
}
// 登出
export function logout(userInfo = null) {
// 如果没有传入 userInfo,尝试从 localStorage 获取
if (!userInfo) {
const cachedUserInfo = localStorage.getItem('userInfo');
if (cachedUserInfo) {
@@ -55,10 +49,6 @@ export function logout(userInfo = null) {
});
}
/**
* 获取极验3.0数据
* @returns {Promise}
*/
export function getGeetest3Infos() {
return request({
url: '/platform/login/getGeetest3Infos',
@@ -66,10 +56,6 @@ export function getGeetest3Infos() {
});
}
/**
* 获取极验4.0数据
* @returns {Promise}
*/
export function getGeetest4Infos() {
return request({
url: '/platform/login/getGeetest4Infos',
@@ -77,10 +63,6 @@ export function getGeetest4Infos() {
});
}
/**
* 判断是否开启验证
* @returns {Promise}
*/
export function getOpenVerify() {
return request({
url: '/platform/login/getOpenVerify',
@@ -88,7 +70,6 @@ export function getOpenVerify() {
});
}
// 忘记密码重置
export function resetPassword(data) {
return request({
url: "/platform/resetPassword",
@@ -97,7 +78,6 @@ export function resetPassword(data) {
});
}
// 发送找回密码验证码
export function sendResetCode(data) {
return request({
url: "/platform/sendResetCode",
@@ -106,7 +86,6 @@ export function sendResetCode(data) {
});
}
// 租户自助注册(平台端独立接口 /platform/*,与 go routers/platform 一致)
export function register(data) {
return request({
url: "/platform/register",
-27
View File
@@ -1,17 +1,5 @@
import request from "@/utils/request";
/**
* 获取登录日志列表
* @param {Object} params 查询参数
* @param {number} params.page 页码
* @param {number} params.pageSize 每页数量
* @param {string} params.keyword 关键词搜索(账号/姓名/租户/IP)
* @param {string} params.status 状态筛选
* @param {string} params.loginType 登录方式筛选
* @param {string} params.startTime 开始时间
* @param {string} params.endTime 结束时间
* @returns {Promise}
*/
export function getLoginLogs(params) {
return request({
url: "/platform/loginLogs",
@@ -20,11 +8,6 @@ export function getLoginLogs(params) {
});
}
/**
* 获取登录日志详情
* @param {number|string} id 日志ID
* @returns {Promise}
*/
export function getLoginLogDetail(id) {
return request({
url: `/platform/loginLogs/${id}`,
@@ -32,11 +15,6 @@ export function getLoginLogDetail(id) {
});
}
/**
* 删除登录日志
* @param {number|string} id 日志ID
* @returns {Promise}
*/
export function deleteLoginLog(id) {
return request({
url: `/platform/loginLogs/${id}`,
@@ -44,11 +22,6 @@ export function deleteLoginLog(id) {
});
}
/**
* 批量删除登录日志
* @param {Array} ids 日志ID数组
* @returns {Promise}
*/
export function batchDeleteLoginLogs(ids) {
return request({
url: "/platform/loginLogs/batchDelete",
-6
View File
@@ -1,6 +1,5 @@
import request from "@/utils/request";
// 获取所有菜单
export function getAllMenus(params) {
return request({
url: `/platform/allmenu`,
@@ -9,7 +8,6 @@ export function getAllMenus(params) {
});
}
//获取用户菜单
export function getMenus(id){
return request({
url: `/platform/menu/${parseInt(id)}`,
@@ -17,7 +15,6 @@ export function getMenus(id){
});
}
// 更新菜单状态
export function updateMenuStatus(menuId, status) {
return request({
url: `/platform/menu/status/${menuId}`,
@@ -26,7 +23,6 @@ export function updateMenuStatus(menuId, status) {
});
}
// 创建菜单
export function createMenu(menuData) {
return request({
url: `/platform/createmenu`,
@@ -35,7 +31,6 @@ export function createMenu(menuData) {
});
}
// 更新菜单
export function updateMenu(menuId, menuData) {
return request({
url: `/platform/updatemenu/${menuId}`,
@@ -44,7 +39,6 @@ export function updateMenu(menuId, menuData) {
});
}
// 删除菜单
export function deleteMenu(menuId) {
return request({
url: `/platform/deletemenu/${menuId}`,
-52
View File
@@ -1,10 +1,5 @@
import request from "@/utils/request";
/**
* 小程序多应用管理
*/
/** 获取小程序应用列表(AppSecret 不回显,返回 configured 标记;含 qrcode_url) */
export function listMiniApps() {
return request({
url: "/platform/wechatMini/apps",
@@ -12,18 +7,6 @@ export function listMiniApps() {
});
}
/**
* 新增/更新小程序应用
* @param {Object} data
* @param {number} [data.id] 更新时携带;新增不传
* @param {string} data.name 应用名称
* @param {string} data.app_id 小程序 AppID
* @param {string} [data.app_secret] 掩码/空串 = 不修改原值
* @param {string} [data.qrcode_url] 小程序二维码图片地址(空串 = 清空)
* @param {number} data.enabled 1=启用 0=停用
* @param {number} data.auto_bind 1=手机号命中身份后自动绑定
* @param {string} [data.remark] 备注
*/
export function saveMiniApp(data) {
return request({
url: "/platform/wechatMini/app/save",
@@ -32,7 +15,6 @@ export function saveMiniApp(data) {
});
}
/** 删除应用(软删并停用) */
export function deleteMiniApp(id) {
return request({
url: `/platform/wechatMini/app/delete/${id}`,
@@ -40,11 +22,6 @@ export function deleteMiniApp(id) {
});
}
/**
* 消息推送配置(对应小程序后台「开发管理 → 开发设置 → 消息推送」)
*/
/** 获取指定小程序的推送配置(含回调地址,aes_key 掩码回显) */
export function getMiniAppPush(appId) {
return request({
url: "/platform/wechatMini/app/push",
@@ -53,16 +30,6 @@ export function getMiniAppPush(appId) {
});
}
/**
* 保存推送配置
* @param {Object} data
* @param {string} data.app_id 小程序 AppID
* @param {string} [data.token] 令牌(3-32 位字母数字)
* @param {string} [data.aes_key] 消息加解密密钥(43 位,掩码/空串 = 不修改原值)
* @param {string} [data.encrypt_mode] plain / compatible / safe
* @param {string} [data.data_format] xml / json
* @param {string} [data.push_reply] 客服消息自动回复文案
*/
export function saveMiniAppPush(data) {
return request({
url: "/platform/wechatMini/app/push/save",
@@ -71,7 +38,6 @@ export function saveMiniAppPush(data) {
});
}
/** 生成随机 Token 与 EncodingAESKey */
export function generateMiniAppPushSecret() {
return request({
url: "/platform/wechatMini/app/push/generate",
@@ -79,11 +45,6 @@ export function generateMiniAppPushSecret() {
});
}
/**
* 订阅消息模板(小程序后台「功能 → 订阅消息」选用模板后登记)
*/
/** 模板列表 */
export function listMiniTemplates(appId) {
return request({
url: "/platform/wechatMini/templates",
@@ -92,17 +53,6 @@ export function listMiniTemplates(appId) {
});
}
/**
* 保存模板
* @param {Object} data
* @param {string} data.app_id 小程序 AppID
* @param {string} data.code 场景码,如 notice
* @param {string} data.template_id 微信模板 ID
* @param {string} [data.title] 场景名称
* @param {string} [data.page] 点击消息跳转的小程序页面
* @param {string} [data.fields] JSON:微信字段键 → 语义变量名,如 {"thing1":"title"}
* @param {number} data.enabled 1=启用 0=停用
*/
export function saveMiniTemplate(data) {
return request({
url: "/platform/wechatMini/template/save",
@@ -111,7 +61,6 @@ export function saveMiniTemplate(data) {
});
}
/** 删除模板 */
export function deleteMiniTemplate(id) {
return request({
url: `/platform/wechatMini/template/delete/${id}`,
@@ -119,7 +68,6 @@ export function deleteMiniTemplate(id) {
});
}
/** 给指定租户用户发一条测试订阅消息 */
export function testMiniTemplate(data) {
return request({
url: "/platform/wechatMini/template/test",
-25
View File
@@ -1,9 +1,5 @@
import request from "@/utils/request";
/**
* 获取模块中心分类
* @returns {Promise}
*/
export function getModuleCategory() {
return request({
url: "/platform/moduleCategory",
@@ -11,11 +7,6 @@ export function getModuleCategory() {
});
}
/**
* 获取模块中心列表
* @param {number} cid 分类id
* @returns {Promise}
*/
export function getModules(cid) {
return request({
url: "/platform/moduleCenter/modules",
@@ -24,14 +15,6 @@ export function getModules(cid) {
});
}
/**
* 编辑模块分类
* @param {Object} data 分类数据
* @param {number} data.id 分类id(编辑时必填,新增时不填)
* @param {string} data.title 分类名称
* @param {number} data.status 分类状态
* @returns {Promise}
*/
export function editModuleCategory(data) {
return request({
url: "/platform/moduleCenter/editCategory",
@@ -40,14 +23,6 @@ export function editModuleCategory(data) {
});
}
/**
* 编辑模块
* @param {Object} data 模块数据
* @param {number} data.id 模块id(编辑时必填,新增时不填)
* @param {string} data.title 模块名称
* @param {number} data.status 模块状态
* @returns {Promise}
*/
export function editModules(data) {
return request({
url: "/platform/moduleCenter/editModules",
-28
View File
@@ -1,12 +1,5 @@
import request from '@/utils/request'
/**
* 获取笔记列表
* @param {Object} params - 查询参数
* @param {number} params.page - 页码
* @param {number} params.pageSize - 每页数量
* @param {string} params.keyword - 搜索关键词
*/
export function getNotebookList(params) {
return request({
url: '/platform/notebook/list',
@@ -15,10 +8,6 @@ export function getNotebookList(params) {
})
}
/**
* 获取笔记详情
* @param {number} id - 笔记ID
*/
export function getNotebookDetail(id) {
return request({
url: `/platform/notebook/detail/${id}`,
@@ -26,12 +15,6 @@ export function getNotebookDetail(id) {
})
}
/**
* 创建笔记
* @param {Object} data - 笔记数据
* @param {string} data.title - 笔记标题
* @param {string} data.content - 笔记内容
*/
export function createNotebook(data) {
return request({
url: '/platform/notebook/create',
@@ -40,13 +23,6 @@ export function createNotebook(data) {
})
}
/**
* 更新笔记
* @param {number} id - 笔记ID
* @param {Object} data - 笔记数据
* @param {string} data.title - 笔记标题
* @param {string} data.content - 笔记内容
*/
export function updateNotebook(id, data) {
return request({
url: `/platform/notebook/update/${id}`,
@@ -55,10 +31,6 @@ export function updateNotebook(id, data) {
})
}
/**
* 删除笔记
* @param {number} id - 笔记ID
*/
export function deleteNotebook(id) {
return request({
url: `/platform/notebook/delete/${id}`,
-16
View File
@@ -1,13 +1,5 @@
import request from "@/utils/request";
// ==================== 官网管理 - 站点公告(平台端) ====================
// 数据表:yz_platform_website_notice
// 建表 SQL:go/docs/sql/create_platform_website_notice.sql
//
// 状态约定:0 草稿 / 1 已发布 / 2 已下线
// 类型约定:1 通知公告 / 2 活动公告 / 3 系统维护
// 公告列表(分页):keyword / type / status / is_popup / page / pageSize
export function listNotices(params) {
return request({
url: "/platform/website/notice/list",
@@ -16,7 +8,6 @@ export function listNotices(params) {
});
}
// 公告详情(含富文本正文,供编辑回显)
export function getNotice(id) {
return request({
url: `/platform/website/notice/${id}`,
@@ -24,7 +15,6 @@ export function getNotice(id) {
});
}
// 新增公告
export function createNotice(data) {
return request({
url: "/platform/website/notice",
@@ -33,7 +23,6 @@ export function createNotice(data) {
});
}
// 编辑公告
export function editNotice(id, data) {
return request({
url: `/platform/website/notice/${id}`,
@@ -42,7 +31,6 @@ export function editNotice(id, data) {
});
}
// 删除公告(软删除)
export function deleteNotice(id) {
return request({
url: `/platform/website/notice/${id}`,
@@ -50,7 +38,6 @@ export function deleteNotice(id) {
});
}
// 批量删除公告
export function batchDeleteNotices(ids) {
return request({
url: "/platform/website/notice/batchdelete",
@@ -59,7 +46,6 @@ export function batchDeleteNotices(ids) {
});
}
// 发布 / 下线(status 1 / 2)
export function publishNotice(id) {
return request({
url: `/platform/website/notice/${id}/publish`,
@@ -74,7 +60,6 @@ export function unpublishNotice(id) {
});
}
// 置顶 / 取消置顶
export function topNotice(id) {
return request({
url: `/platform/website/notice/${id}/top`,
@@ -89,7 +74,6 @@ export function untopNotice(id) {
});
}
// 标记为弹窗公告 / 取消弹窗
export function popupNotice(id) {
return request({
url: `/platform/website/notice/${id}/popup`,
-34
View File
@@ -1,13 +1,5 @@
import request from "@/utils/request";
// ==================== 官网管理 - 单页管理(平台端) ====================
// 数据表:yz_platform_website_page
// 建表 SQL:go/docs/sql/create_platform_website.sql
/**
* 获取全部单页
* @returns {Promise}
*/
export function getOnePages() {
return request({
url: "/platform/website/page/all",
@@ -15,11 +7,6 @@ export function getOnePages() {
});
}
/**
* 单页详情
* @param {number|string} id 单页ID
* @returns {Promise}
*/
export function getOnePage(id) {
return request({
url: `/platform/website/page/${id}`,
@@ -27,11 +14,6 @@ export function getOnePage(id) {
});
}
/**
* 创建单页
* @param {Object} data 单页数据
* @returns {Promise}
*/
export function createOnePage(data) {
return request({
url: "/platform/website/page",
@@ -40,12 +22,6 @@ export function createOnePage(data) {
});
}
/**
* 编辑单页
* @param {number|string} id 单页ID
* @param {Object} data 更新的数据
* @returns {Promise}
*/
export function editOnePage(id, data) {
return request({
url: `/platform/website/page/${id}`,
@@ -54,11 +30,6 @@ export function editOnePage(id, data) {
});
}
/**
* 删除单页
* @param {number|string} id 单页ID
* @returns {Promise}
*/
export function deleteOnePage(id) {
return request({
url: `/platform/website/page/${id}`,
@@ -66,11 +37,6 @@ export function deleteOnePage(id) {
});
}
/**
* 平台端:根据路径读取单页(平台端独立接口,不跨端复用 /index)
* @param {string} path 路由路径
* @returns {Promise}
*/
export function getOnePageByPath(path) {
return request({
url: `/platform/website/page/path/${encodeURIComponent(path)}`,
-32
View File
@@ -1,18 +1,5 @@
import request from "@/utils/request";
/**
* 获取操作日志列表
* @param {Object} params 查询参数
* @param {number} params.page 页码
* @param {number} params.pageSize 每页数量
* @param {string} params.keyword 关键词搜索
* @param {string} params.module 模块筛选
* @param {string} params.action 操作动作筛选
* @param {string} params.status 状态筛选
* @param {string} params.startTime 开始时间
* @param {string} params.endTime 结束时间
* @returns {Promise}
*/
export function getOperationLogs(params) {
return request({
url: "/platform/operationLogs",
@@ -21,11 +8,6 @@ export function getOperationLogs(params) {
});
}
/**
* 获取操作日志详情
* @param {number|string} id 日志ID
* @returns {Promise}
*/
export function getOperationLogDetail(id) {
return request({
url: `/platform/operationLogs/${id}`,
@@ -33,11 +15,6 @@ export function getOperationLogDetail(id) {
});
}
/**
* 删除操作日志
* @param {number|string} id 日志ID
* @returns {Promise}
*/
export function deleteOperationLog(id) {
return request({
url: `/platform/operationLogs/${id}`,
@@ -45,11 +22,6 @@ export function deleteOperationLog(id) {
});
}
/**
* 批量删除操作日志
* @param {Array} ids 日志ID数组
* @returns {Promise}
*/
export function batchDeleteOperationLogs(ids) {
return request({
url: "/platform/operationLogs/batchDelete",
@@ -58,10 +30,6 @@ export function batchDeleteOperationLogs(ids) {
});
}
/**
* 获取操作统计信息
* @returns {Promise}
*/
export function getOperationStatistics() {
return request({
url: "/platform/operationLogs/statistics",
-2
View File
@@ -6,7 +6,5 @@ export const getPasswordStoreDetail = (id) => request({ url: `${resource}/detail
export const createPasswordStore = (data) => request({ url: `${resource}/create`, method: 'post', data })
export const updatePasswordStore = (id, data) => request({ url: `${resource}/update/${id}`, method: 'post', data })
export const deletePasswordStore = (id) => request({ url: `${resource}/delete/${id}`, method: 'delete' })
/** 导出全部记录(不受列表 200 条限制),返回 data.list */
export const exportPasswordStore = () => request({ url: `${resource}/export`, method: 'get' })
/** 批量导入:rows 为 Excel/CSV 解析后的行数据,返回 created/updated/failed/failures */
export const importPasswordStore = (rows) => request({ url: `${resource}/import`, method: 'post', data: { rows } })
-100
View File
@@ -1,30 +1,8 @@
import request from "@/utils/request";
/*************************************************
*************** 平台端支付模块接口 ***************
* 业务:平台向租户收取平台使用费,资金直接进平台对公账户;
* 不涉及退款流程(仅保留后台手动原路退回兜底);
* 推广佣金为平台自有资金支出,与收款解耦;不跨境。
*************************************************/
/**
* 支付模块接口前缀。
* 需求约定里接口写作 /api/payment/*、/api/commission/*,
* 但本项目平台端接口统一走 /platform 前缀(vite.config.js 的 dev 代理也只转发 /platform、/backend)。
* 若后端最终把支付路由挂在 /api 下,只需要改下面这两个常量。
*/
const PAY = "/platform/payment";
const COMMISSION = "/platform/commission";
/* ================= 支付单 ================= */
/**
* 创建支付单
*
* 该接口仅供租户端收银台使用;平台端不直接创建支付单。
* @param {Object} data 下单参数
* @returns {Promise}
*/
export function createPayment(data) {
return request({
url: `${PAY}/create`,
@@ -33,12 +11,6 @@ export function createPayment(data) {
});
}
/**
* 手动查询支付单并同步渠道状态
* @param {string} payNo 支付单号
* @param {Object} [params] { sync: true } 时同步渠道最新状态后再返回
* @returns {Promise}
*/
export function queryPayment(payNo, params = {}) {
return request({
url: `${PAY}/orders/${payNo}/query`,
@@ -48,10 +20,7 @@ export function queryPayment(payNo, params = {}) {
}
/**
* 手动原路退回(兜底,不做业务层退款流程)
* TODO: 后端实现 POST /api/payment/refund
* @param {Object} data { pay_no, amount(分), reason }
* @returns {Promise}
*/
export function refundPayment(data) {
return request({
@@ -62,10 +31,7 @@ export function refundPayment(data) {
}
/**
* 支付单列表
* TODO: 后端实现 GET /api/payment/orders
* @param {Object} params { page, pageSize, tenant_id, channel, status, start_time, end_time }
* @returns {Promise}
*/
export function getOrders(params) {
return request({
@@ -76,10 +42,7 @@ export function getOrders(params) {
}
/**
* 支付单详情(含状态流转记录)
* TODO: 后端实现 GET /api/payment/orders/:payNo
* @param {string} payNo 支付单号
* @returns {Promise}
*/
export function getOrderDetail(payNo) {
return request({
@@ -88,12 +51,8 @@ export function getOrderDetail(payNo) {
});
}
/* ================= 渠道配置 ================= */
/**
* 渠道配置列表(首页概览用)
* TODO: 后端实现 GET /api/payment/channels
* @returns {Promise}
*/
export function getChannelList() {
return request({
@@ -103,11 +62,7 @@ export function getChannelList() {
}
/**
* 获取单个渠道配置
* TODO: 后端实现 GET /api/payment/channels/:channel
* 注意:敏感字段(密钥/私钥/Secret)后端只返回掩码,前端提交时掩码值应原样回传表示“不修改”
* @param {string} channel 渠道标识 wechat / alipay / unionpay / cloudpay / paypal
* @returns {Promise}
*/
export function getChannelConfig(channel) {
return request({
@@ -117,11 +72,7 @@ export function getChannelConfig(channel) {
}
/**
* 保存渠道配置
* TODO: 后端实现 POST /api/payment/channels/:channel
* @param {string} channel 渠道标识
* @param {Object} data 渠道参数
* @returns {Promise}
*/
export function saveChannelConfig(channel, data) {
return request({
@@ -132,11 +83,7 @@ export function saveChannelConfig(channel, data) {
}
/**
* 测试渠道连通性(校验参数 + 渠道鉴权)
* TODO: 后端实现 POST /api/payment/channels/:channel/test
* @param {string} channel 渠道标识
* @param {Object} [data] 未保存的参数可一并提交
* @returns {Promise}
*/
export function testChannelConnection(channel, data) {
return request({
@@ -147,11 +94,7 @@ export function testChannelConnection(channel, data) {
}
/**
* 启用 / 停用渠道
* TODO: 后端实现 POST /api/payment/channels/:channel/status
* @param {string} channel 渠道标识
* @param {boolean} enabled 是否启用
* @returns {Promise}
*/
export function toggleChannel(channel, enabled) {
return request({
@@ -162,12 +105,7 @@ export function toggleChannel(channel, enabled) {
}
/**
* 上传渠道证书(微信 apiclient_cert.pem / apiclient_key.pem、银联证书等)
* TODO: 后端实现 POST /api/payment/channels/:channel/certificate
* @param {string} channel 渠道标识
* @param {File} file 证书文件
* @param {string} [certType] 证书类型 cert / key
* @returns {Promise}
*/
export function uploadChannelCert(channel, file, certType = "cert") {
const formData = new FormData();
@@ -181,13 +119,8 @@ export function uploadChannelCert(channel, file, certType = "cert") {
});
}
/* ================= 推广佣金 ================= */
/**
* 佣金台账列表
* TODO: 后端实现 GET /api/commission/list
* @param {Object} params { page, pageSize, promoter, status, start_time, end_time }
* @returns {Promise}
*/
export function getCommissionList(params) {
return request({
@@ -198,10 +131,7 @@ export function getCommissionList(params) {
}
/**
* 佣金统计(应付总额 / 已付总额 / 待处理笔数)
* TODO: 后端实现 GET /api/commission/stats
* @param {Object} [params] 统计维度(时间范围等)
* @returns {Promise}
*/
export function getCommissionStats(params) {
return request({
@@ -212,11 +142,7 @@ export function getCommissionStats(params) {
}
/**
* 标记佣金已发放
* TODO: 后端实现 POST /api/commission/:id/pay
* @param {number|string} id 佣金单 id
* @param {Object} [data] { pay_method, remark }
* @returns {Promise}
*/
export function markCommissionPaid(id, data = {}) {
return request({
@@ -227,10 +153,7 @@ export function markCommissionPaid(id, data = {}) {
}
/**
* 佣金规则列表
* TODO: 后端实现 GET /api/commission/rules
* @param {Object} [params] { page, pageSize, keyword }
* @returns {Promise}
*/
export function getCommissionRules(params) {
return request({
@@ -241,10 +164,7 @@ export function getCommissionRules(params) {
}
/**
* 新增佣金规则
* TODO: 后端实现 POST /api/commission/rules
* @param {Object} data 规则数据
* @returns {Promise}
*/
export function saveCommissionRule(data) {
return request({
@@ -255,11 +175,7 @@ export function saveCommissionRule(data) {
}
/**
* 更新佣金规则
* TODO: 后端实现 POST /api/commission/rules/:id
* @param {number|string} id 规则 id
* @param {Object} data 规则数据
* @returns {Promise}
*/
export function updateCommissionRule(id, data) {
return request({
@@ -270,10 +186,7 @@ export function updateCommissionRule(id, data) {
}
/**
* 删除佣金规则
* TODO: 后端实现 DELETE /api/commission/rules/:id
* @param {number|string} id 规则 id
* @returns {Promise}
*/
export function deleteCommissionRule(id) {
return request({
@@ -283,11 +196,7 @@ export function deleteCommissionRule(id) {
}
/**
* 启用 / 停用佣金规则
* TODO: 后端实现 POST /api/commission/rules/:id/status
* @param {number|string} id 规则 id
* @param {number} status 1 启用 / 0 停用
* @returns {Promise}
*/
export function toggleCommissionRule(id, status) {
return request({
@@ -297,8 +206,6 @@ export function toggleCommissionRule(id, status) {
});
}
/* ================= 对账 ================= */
export function runReconcile(data) {
return request({
url: `${PAY}/reconcile/run`,
@@ -317,10 +224,7 @@ export function importReconcileBill(data) {
}
/**
* 对账差异列表
* TODO: 后端实现 GET /api/payment/reconcile
* @param {Object} params { page, pageSize, channel, reconcile_date, diff_type, handle_status }
* @returns {Promise}
*/
export function getReconcileList(params) {
return request({
@@ -331,11 +235,7 @@ export function getReconcileList(params) {
}
/**
* 标记对账差异已处理
* TODO: 后端实现 POST /api/payment/reconcile/:id/handle
* @param {number|string} id 差异记录 id
* @param {Object} [data] { handle_type, remark }
* @returns {Promise}
*/
export function markReconcileHandled(id, data = {}) {
return request({
-6
View File
@@ -1,6 +1,5 @@
import request from '@/utils/request';
// 获取租户下的所有职位
export function getTenantPositions(tenantId) {
return request({
url: `/platform/positions/tenant/${tenantId}`,
@@ -8,7 +7,6 @@ export function getTenantPositions(tenantId) {
});
}
// 根据部门ID获取职位列表
export function getPositionsByDepartment(departmentId) {
return request({
url: `/platform/positions/department/${departmentId}`,
@@ -16,7 +14,6 @@ export function getPositionsByDepartment(departmentId) {
});
}
// 获取职位详情
export function getPositionInfo(positionId) {
return request({
url: `/platform/positions/${positionId}`,
@@ -24,7 +21,6 @@ export function getPositionInfo(positionId) {
});
}
// 添加职位
export function addPosition(data) {
return request({
url: '/platform/positions',
@@ -33,7 +29,6 @@ export function addPosition(data) {
});
}
// 更新职位信息
export function editPosition(positionId, data) {
return request({
url: `/platform/positions/${positionId}`,
@@ -42,7 +37,6 @@ export function editPosition(positionId, data) {
});
}
// 删除职位
export function deletePosition(positionId) {
return request({
url: `/platform/positions/${positionId}`,
-12
View File
@@ -1,10 +1,5 @@
import request from "@/utils/request";
/*************************************************
* 产品定价(产品 / 功能节点 / 价格档位 / 购买订单)
*************************************************/
/** 产品列表 */
export function getProductList(params) {
return request({
url: "/platform/product/list",
@@ -13,7 +8,6 @@ export function getProductList(params) {
});
}
/** 产品详情(含功能节点与价格档位) */
export function getProductDetail(id) {
return request({
url: `/platform/product/detail/${id}`,
@@ -21,7 +15,6 @@ export function getProductDetail(id) {
});
}
/** 新增产品 */
export function createProduct(data) {
return request({
url: "/platform/product/create",
@@ -30,7 +23,6 @@ export function createProduct(data) {
});
}
/** 编辑产品 */
export function updateProduct(id, data) {
return request({
url: `/platform/product/edit/${id}`,
@@ -39,7 +31,6 @@ export function updateProduct(id, data) {
});
}
/** 删除产品 */
export function deleteProduct(id) {
return request({
url: `/platform/product/delete/${id}`,
@@ -47,7 +38,6 @@ export function deleteProduct(id) {
});
}
/** 购买订单列表 */
export function getProductOrders(params) {
return request({
url: "/platform/product/orders",
@@ -56,7 +46,6 @@ export function getProductOrders(params) {
});
}
/** 手动开通订单 */
export function activateProductOrder(id) {
return request({
url: `/platform/product/order/activate/${id}`,
@@ -64,7 +53,6 @@ export function activateProductOrder(id) {
});
}
/** 关闭已开通的单品功能(回收模块权益,可在购买订单中重新开通) */
export function closeProductOrder(id) {
return request({
url: `/platform/product/order/close/${id}`,
-42
View File
@@ -1,10 +1,5 @@
import request from '@/utils/request'
/**
* 获取特色产品列表
* @param {Object} params - 查询参数
* @returns {Promise}
*/
export function getProductsList(params) {
return request({
url: '/platform/productsList',
@@ -13,11 +8,6 @@ export function getProductsList(params) {
})
}
/**
* 添加特色产品
* @param {Object} data - 产品数据
* @returns {Promise}
*/
export function addProducts(data) {
return request({
url: '/platform/addProducts',
@@ -26,12 +16,6 @@ export function addProducts(data) {
})
}
/**
* 更新特色产品
* @param {number} id - 产品ID
* @param {Object} data - 产品数据
* @returns {Promise}
*/
export function updateProducts(id, data) {
return request({
url: `/platform/editProducts/${id}`,
@@ -40,11 +24,6 @@ export function updateProducts(id, data) {
})
}
/**
* 删除特色产品
* @param {number} id - 产品ID
* @returns {Promise}
*/
export function deleteProducts(id) {
return request({
url: `/platform/deleteProducts/${id}`,
@@ -52,11 +31,6 @@ export function deleteProducts(id) {
})
}
/**
* 获取产品分类列表
* @param {Object} params - 查询参数
* @returns {Promise}
*/
export function getProductsTypesList(params) {
return request({
url: '/platform/productsTypesList',
@@ -65,11 +39,6 @@ export function getProductsTypesList(params) {
})
}
/**
* 添加产品分类
* @param {Object} data - 分类数据
* @returns {Promise}
*/
export function addProductsTypes(data) {
return request({
url: '/platform/addProductsTypes',
@@ -78,12 +47,6 @@ export function addProductsTypes(data) {
})
}
/**
* 更新产品分类
* @param {number} id - 分类ID
* @param {Object} data - 分类数据
* @returns {Promise}
*/
export function updateProductsTypes(id, data) {
return request({
url: `/platform/editProductsTypes/${id}`,
@@ -92,11 +55,6 @@ export function updateProductsTypes(id, data) {
})
}
/**
* 删除产品分类
* @param {number} id - 分类ID
* @returns {Promise}
*/
export function deleteProductsTypes(id) {
return request({
url: `/platform/deleteProductsTypes/${id}`,
-8
View File
@@ -1,6 +1,5 @@
import request from "@/utils/request";
/** 提醒列表 */
export function getReminderList(params) {
return request({
url: "/platform/reminder/list",
@@ -9,7 +8,6 @@ export function getReminderList(params) {
});
}
/** 提醒详情 */
export function getReminderDetail(id) {
return request({
url: `/platform/reminder/${id}`,
@@ -17,7 +15,6 @@ export function getReminderDetail(id) {
});
}
/** 新增提醒 */
export function createReminder(data) {
return request({
url: "/platform/reminder",
@@ -26,7 +23,6 @@ export function createReminder(data) {
});
}
/** 更新提醒 */
export function updateReminder(id, data) {
return request({
url: `/platform/reminder/${id}`,
@@ -35,7 +31,6 @@ export function updateReminder(id, data) {
});
}
/** 删除提醒 */
export function deleteReminder(id) {
return request({
url: `/platform/reminder/${id}`,
@@ -43,7 +38,6 @@ export function deleteReminder(id) {
});
}
/** 批量删除提醒 */
export function batchDeleteReminder(ids) {
return request({
url: "/platform/reminder/batchDelete",
@@ -52,7 +46,6 @@ export function batchDeleteReminder(ids) {
});
}
/** 测试提醒渠道 */
export function testReminder(data) {
return request({
url: "/platform/reminder/test",
@@ -61,7 +54,6 @@ export function testReminder(data) {
});
}
/** 结束提醒 */
export function finishReminder(id) {
return request({
url: `/platform/reminder/${id}/finish`,
-2
View File
@@ -1,7 +1,5 @@
import request from "@/utils/request";
// 平台端排班模板管理(全局模板,只有平台可维护)
// 系统预置模板只读:后端会拒绝对 is_system=1 的编辑 / 删除 / 停用
const PREFIX = "/platform/schedTemplates";
export function getSchedTemplateList(params) {
-21
View File
@@ -1,10 +1,5 @@
import request from '@/utils/request'
/**
* 获取特色服务列表
* @param {Object} params - 查询参数
* @returns {Promise}
*/
export function getServiceList(params) {
return request({
url: '/platform/servicesList',
@@ -13,11 +8,6 @@ export function getServiceList(params) {
})
}
/**
* 添加特色服务
* @param {Object} data - 服务数据
* @returns {Promise}
*/
export function addService(data) {
return request({
url: '/platform/addServices',
@@ -26,12 +16,6 @@ export function addService(data) {
})
}
/**
* 更新特色服务
* @param {number} id - 服务ID
* @param {Object} data - 服务数据
* @returns {Promise}
*/
export function updateService(id, data) {
return request({
url: `/platform/editServices/${id}`,
@@ -40,11 +24,6 @@ export function updateService(id, data) {
})
}
/**
* 删除特色服务
* @param {number} id - 服务ID
* @returns {Promise}
*/
export function deleteService(id) {
return request({
url: `/platform/deleteServices/${id}`,
-10
View File
@@ -1,6 +1,5 @@
import request from "@/utils/request";
/** 获取站内信配置 */
export function getSiteReminderConfig() {
return request({
url: "/platform/sitereminder/config",
@@ -8,7 +7,6 @@ export function getSiteReminderConfig() {
});
}
/** 保存站内信配置 */
export function saveSiteReminderConfig(data) {
return request({
url: "/platform/sitereminder/config",
@@ -17,7 +15,6 @@ export function saveSiteReminderConfig(data) {
});
}
/** 发送站内信 */
export function sendSiteReminder(data) {
return request({
url: "/platform/sitereminder/send",
@@ -26,7 +23,6 @@ export function sendSiteReminder(data) {
});
}
/** 获取我的消息列表 */
export function getMySiteReminders(params) {
return request({
url: "/platform/sitereminder/myList",
@@ -35,7 +31,6 @@ export function getMySiteReminders(params) {
});
}
/** 标记消息为已读 */
export function readSiteReminder(id) {
return request({
url: "/platform/sitereminder/read",
@@ -44,7 +39,6 @@ export function readSiteReminder(id) {
});
}
/** 一键全部已读 */
export function readAllSiteReminders() {
return request({
url: "/platform/sitereminder/readall",
@@ -52,7 +46,6 @@ export function readAllSiteReminders() {
});
}
/** 删除消息 */
export function deleteSiteReminder(id) {
return request({
url: "/platform/sitereminder/delete",
@@ -61,7 +54,6 @@ export function deleteSiteReminder(id) {
});
}
/** 获取已发送的站内信列表(按 batch_id 分组) */
export function getSentSiteReminders(params) {
return request({
url: "/platform/sitereminder/sentList",
@@ -70,7 +62,6 @@ export function getSentSiteReminders(params) {
});
}
/** 编辑/更新已发送的站内信 */
export function updateSentSiteReminder(data) {
return request({
url: "/platform/sitereminder/updateSent",
@@ -79,7 +70,6 @@ export function updateSentSiteReminder(data) {
});
}
/** 删除已发送的站内信批次 */
export function deleteSentSiteReminderBatch(batch_id) {
return request({
url: "/platform/sitereminder/deleteSent",
-81
View File
@@ -1,10 +1,5 @@
import request from "@/utils/request";
/**
* 获取基本信息
* @param {number} tid 租户ID
* @returns {Promise}
*/
export function getNormalInfos(tid) {
return request({
url: "/platform/normalInfos",
@@ -13,11 +8,6 @@ export function getNormalInfos(tid) {
});
}
/**
* 保存基本信息
* @param {Object} data 要保存的数据
* @returns {Promise}
*/
export function saveNormalInfos(data) {
return request({
url: "/platform/saveNormalInfos",
@@ -26,10 +16,6 @@ export function saveNormalInfos(data) {
});
}
/**
* 获取登录验证数据
* @returns {Promise}
*/
export function getVerifyInfos() {
return request({
url: "/platform/loginVerifyInfos",
@@ -37,11 +23,6 @@ export function getVerifyInfos() {
});
}
/**
* 保存登录验证数据
* @param {Object} data 要保存的数据
* @returns {Promise}
*/
export function saveVerifyInfos(data) {
return request({
url: "/platform/saveloginVerifyInfos",
@@ -50,11 +31,6 @@ export function saveVerifyInfos(data) {
});
}
/**
* 获取法律声明和隐私条款
* @param {number} tid 租户ID
* @returns {Promise}
*/
export function getLegalInfos(tid) {
return request({
url: "/platform/legalInfos",
@@ -63,11 +39,6 @@ export function getLegalInfos(tid) {
});
}
/**
* 保存法律声明和隐私条款
* @param {Object} data 要保存的数据
* @returns {Promise}
*/
export function saveLegalInfos(data) {
return request({
url: "/platform/saveLegalInfos",
@@ -76,11 +47,6 @@ export function saveLegalInfos(data) {
});
}
/**
* 获取企业信息
* @param {number} tid 租户ID
* @returns {Promise}
*/
export function getCompanyInfos(tid) {
return request({
url: "/platform/companyInfos",
@@ -89,11 +55,6 @@ export function getCompanyInfos(tid) {
});
}
/**
* 保存企业信息
* @param {Object} data 要保存的数据
* @returns {Promise}
*/
export function saveCompanyInfos(data) {
return request({
url: "/platform/saveCompanyInfos",
@@ -102,11 +63,6 @@ export function saveCompanyInfos(data) {
});
}
/**
* 获取企业SEO
* @param {number} tid 租户ID
* @returns {Promise}
*/
export function getCompanySeo(tid) {
return request({
url: "/platform/companySeo",
@@ -115,11 +71,6 @@ export function getCompanySeo(tid) {
});
}
/**
* 保存企业SEO
* @param {Object} data 要保存的数据
* @returns {Promise}
*/
export function saveCompanySeo(data) {
return request({
url: "/platform/saveCompanySeo",
@@ -128,10 +79,6 @@ export function saveCompanySeo(data) {
});
}
/**
* 获取存储配置
* @returns {Promise}
*/
export function getStorageConfig() {
return request({
url: "/platform/storageConfig",
@@ -139,11 +86,6 @@ export function getStorageConfig() {
});
}
/**
* 保存存储配置
* @param {Object} data 要保存的数据
* @returns {Promise}
*/
export function saveStorageConfig(data) {
return request({
url: "/platform/saveStorageConfig",
@@ -152,10 +94,6 @@ export function saveStorageConfig(data) {
});
}
/**
* 获取 Bark 配置
* @returns {Promise}
*/
export function getBarkConfig() {
return request({
url: "/platform/bark/info",
@@ -163,11 +101,6 @@ export function getBarkConfig() {
});
}
/**
* 保存 Bark 配置
* @param {Object} data 要保存的数据
* @returns {Promise}
*/
export function saveBarkConfig(data) {
return request({
url: "/platform/bark/editinfo",
@@ -176,11 +109,6 @@ export function saveBarkConfig(data) {
});
}
/**
* 发送测试 Bark 推送
* @param {Object} data 测试数据
* @returns {Promise}
*/
export function sendTestBark(data) {
return request({
url: "/platform/bark/sendtest",
@@ -189,10 +117,6 @@ export function sendTestBark(data) {
});
}
/**
* 获取统一登录页品牌配置(主标题 / 副标题 / Logo / 背景图)
* @returns {Promise}
*/
export function getLoginBrand() {
return request({
url: "/platform/loginBrand",
@@ -200,11 +124,6 @@ export function getLoginBrand() {
});
}
/**
* 保存统一登录页品牌配置
* @param {Object} data { login_title, login_subtitle, login_logo, login_bg }
* @returns {Promise}
*/
export function saveLoginBrand(data) {
return request({
url: "/platform/saveLoginBrand",
-15
View File
@@ -1,8 +1,5 @@
import request from "@/utils/request";
/**
* 获取短信网关配置
*/
export function getSmsInfo() {
return request({
url: "/platform/sms/info",
@@ -10,9 +7,6 @@ export function getSmsInfo() {
});
}
/**
* 编辑短信网关配置
*/
export function editSmsInfo(data: any) {
return request({
url: "/platform/sms/editinfo",
@@ -21,9 +15,6 @@ export function editSmsInfo(data: any) {
});
}
/**
* 发送测试短信(入队任务,等待网关发送)
*/
export function sendTestSms(data: any) {
return request({
url: "/platform/sms/sendtest",
@@ -32,9 +23,6 @@ export function sendTestSms(data: any) {
});
}
/**
* 获取短信任务列表(租户隔离)
*/
export function getSmsTaskList(params: { status?: string | number; phone?: string } = {}) {
return request({
url: "/platform/sms/taskList",
@@ -43,9 +31,6 @@ export function getSmsTaskList(params: { status?: string | number; phone?: strin
});
}
/**
* 编辑短信任务
*/
export function editSmsTask(id: number | string, data: any) {
return request({
url: `/platform/sms/taskEdit/${id}`,
-6
View File
@@ -1,7 +1,5 @@
import request from "@/utils/request";
// ==================== 附件空间套餐(平台端维护) ====================
export function getStoragePackages() {
return request({
url: "/platform/storage/packages",
@@ -40,8 +38,6 @@ export function deleteStoragePackage(id) {
});
}
// ==================== 租户空间用量 / 基础额度 ====================
export function getTenantStorageInfo(tid) {
return request({
url: `/platform/storage/tenant/${tid}`,
@@ -57,8 +53,6 @@ export function updateTenantStorageQuota(tid, storageQuotaMB) {
});
}
// ==================== 购买记录 ====================
export function getStorageOrders(params = {}) {
return request({
url: "/platform/storage/orders",
-11
View File
@@ -1,10 +1,5 @@
import request from "@/utils/request";
// ==================== 官网管理 - 标签管理(平台端) ====================
// 数据表:yz_platform_website_tag(+ 关联表 yz_platform_website_article_tag)
// 建表 SQL:go/docs/sql/create_platform_website.sql
// 标签列表(分页):keyword / status / page / pageSize
export function listTags(params) {
return request({
url: "/platform/website/tag/list",
@@ -13,7 +8,6 @@ export function listTags(params) {
});
}
// 全部标签(不分页,供文章编辑选择)
export function allTags(params) {
return request({
url: "/platform/website/tag/all",
@@ -22,7 +16,6 @@ export function allTags(params) {
});
}
// 标签详情
export function getTag(id) {
return request({
url: `/platform/website/tag/${id}`,
@@ -30,7 +23,6 @@ export function getTag(id) {
});
}
// 新增标签
export function createTag(data) {
return request({
url: "/platform/website/tag",
@@ -39,7 +31,6 @@ export function createTag(data) {
});
}
// 编辑标签
export function editTag(id, data) {
return request({
url: `/platform/website/tag/${id}`,
@@ -48,7 +39,6 @@ export function editTag(id, data) {
});
}
// 删除标签
export function deleteTag(id) {
return request({
url: `/platform/website/tag/${id}`,
@@ -56,7 +46,6 @@ export function deleteTag(id) {
});
}
// 更新标签状态(1 启用 / 0 禁用)
export function updateTagStatus(id, status) {
return request({
url: `/platform/website/tag/${id}/status`,
-11
View File
@@ -1,8 +1,5 @@
import request from '@/utils/request'
// ==================== 官网模板管理(平台端) ====================
// 模板列表
export function getTemplateList(params) {
return request({
url: '/platform/template/index',
@@ -11,7 +8,6 @@ export function getTemplateList(params) {
})
}
// 扫描 themes/ 目录,自动登记新模板
export function scanTemplates() {
return request({
url: '/platform/template/scan',
@@ -19,7 +15,6 @@ export function scanTemplates() {
})
}
// 上传模板 zip
export function uploadTemplate(formData) {
return request({
url: '/platform/template/upload',
@@ -29,7 +24,6 @@ export function uploadTemplate(formData) {
})
}
// 模板目录下可编辑文件列表
export function getTemplateFiles(code) {
return request({
url: `/platform/template/files/${code}`,
@@ -37,7 +31,6 @@ export function getTemplateFiles(code) {
})
}
// 读取模板文件内容
export function getTemplateFile(code, path) {
return request({
url: '/platform/template/file',
@@ -46,7 +39,6 @@ export function getTemplateFile(code, path) {
})
}
// 保存模板文件
export function saveTemplateFile(data) {
return request({
url: '/platform/template/file/save',
@@ -55,7 +47,6 @@ export function saveTemplateFile(data) {
})
}
// 启用/停用模板
export function setTemplateStatus(id, status) {
return request({
url: '/platform/template/status',
@@ -64,7 +55,6 @@ export function setTemplateStatus(id, status) {
})
}
// 删除模板登记(可选删除磁盘目录)
export function deleteTemplate(id, removeFiles = false) {
return request({
url: `/platform/template/delete/${id}`,
@@ -73,7 +63,6 @@ export function deleteTemplate(id, removeFiles = false) {
})
}
// 标签调用说明数据
export function getTagDocs() {
return request({
url: '/platform/template/tags',
-34
View File
@@ -1,14 +1,5 @@
import request from "@/utils/request";
/*************************************************
****************** 租户相关接口 ******************
*************************************************/
/**
* 获取租户列表
* @param {Object} params 包含 page 和 pageSize
* @returns {Promise}
*/
export function getTenantList(params) {
return request({
url: "/platform/tenant/getTenant",
@@ -17,11 +8,6 @@ export function getTenantList(params) {
});
}
/**
* 获取租户详情
* @param {number} id 租户ID
* @returns {Promise}
*/
export function getTenantDetail(id) {
return request({
url: `/platform/tenant/getTenantDetail/${id}`,
@@ -29,11 +15,6 @@ export function getTenantDetail(id) {
});
}
/**
* 创建租户数据
* @param {Object} data 租户数据
* @returns {Promise}
*/
export function createTenant(data) {
return request({
url: "/platform/tenant/createTenant",
@@ -45,11 +26,6 @@ export function createTenant(data) {
});
}
/**
* 更新租户数据
* @param {Object} data 租户数据
* @returns {Promise}
*/
export function editTenant(id, data) {
return request({
url: `/platform/tenant/editTenant/${id}`,
@@ -58,11 +34,6 @@ export function editTenant(id, data) {
});
}
/**
* 删除租户数据
* @param {number} id 租户ID
* @returns {Promise}
*/
export function deleteTenant(id) {
return request({
url: `/platform/tenant/deleteTenant/${id}`,
@@ -70,11 +41,6 @@ export function deleteTenant(id) {
});
}
/**
* 校验租户编码是否重复
* @param {string} tenant_code 编码
* @param {number} id 可选,当前编辑的租户ID
*/
export function checkTenantCode(tenant_code) {
return request({
url: '/platform/tenant/findTenantCode',
-21
View File
@@ -1,13 +1,5 @@
import request from "@/utils/request";
/**
* 获取企业申请列表(platform 审核用)
* @param {Object} params
* @param {number} params.page 页码
* @param {number} params.pageSize 每页数量
* @param {number} params.type 类型筛选:1=加入企业 2=创建企业
* @param {number} params.status 状态筛选:0=待审核 1=已通过 2=已驳回
*/
export function getTenantApplies(params) {
return request({
url: "/platform/tenantApply/list",
@@ -16,10 +8,6 @@ export function getTenantApplies(params) {
});
}
/**
* 获取申请详情
* @param {number|string} id 申请ID
*/
export function getTenantApplyDetail(id) {
return request({
url: `/platform/tenantApply/detail/${id}`,
@@ -27,10 +15,6 @@ export function getTenantApplyDetail(id) {
});
}
/**
* 通过创建企业申请:自动创建租户并把申请人绑定为企业管理员
* @param {number|string} id 申请ID
*/
export function approveTenantApply(id) {
return request({
url: `/platform/tenantApply/approve/${id}`,
@@ -38,11 +22,6 @@ export function approveTenantApply(id) {
});
}
/**
* 驳回申请
* @param {number|string} id 申请ID
* @param {{reason: string}} data 驳回原因
*/
export function rejectTenantApply(id, data) {
return request({
url: `/platform/tenantApply/reject/${id}`,
-21
View File
@@ -1,10 +1,5 @@
import request from "@/utils/request";
/*************************************************
* 租户套餐(功能开通 + 用户数配额)相关接口
*************************************************/
/** 套餐列表 */
export function getTenantPackageList(params) {
return request({
url: "/platform/tenantPackage/list",
@@ -13,7 +8,6 @@ export function getTenantPackageList(params) {
});
}
/** 套餐下拉(仅启用套餐) */
export function getTenantPackageSelectList() {
return request({
url: "/platform/tenantPackage/select/list",
@@ -21,7 +15,6 @@ export function getTenantPackageSelectList() {
});
}
/** 套餐详情(含功能模块) */
export function getTenantPackageDetail(id) {
return request({
url: `/platform/tenantPackage/detail/${id}`,
@@ -29,7 +22,6 @@ export function getTenantPackageDetail(id) {
});
}
/** 可加入套餐的功能模块清单 */
export function getTenantPackageModuleOptions() {
return request({
url: "/platform/tenantPackage/moduleOptions",
@@ -37,7 +29,6 @@ export function getTenantPackageModuleOptions() {
});
}
/** 新增套餐 */
export function createTenantPackage(data) {
return request({
url: "/platform/tenantPackage/create",
@@ -46,7 +37,6 @@ export function createTenantPackage(data) {
});
}
/** 编辑套餐 */
export function updateTenantPackage(id, data) {
return request({
url: `/platform/tenantPackage/edit/${id}`,
@@ -55,7 +45,6 @@ export function updateTenantPackage(id, data) {
});
}
/** 删除套餐 */
export function deleteTenantPackage(id) {
return request({
url: `/platform/tenantPackage/delete/${id}`,
@@ -63,7 +52,6 @@ export function deleteTenantPackage(id) {
});
}
/** 套餐购买链接(租户端未开通功能「购买」按钮跳转地址) */
export function getPackagePurchaseUrl() {
return request({
url: "/platform/tenantPackage/purchaseUrl",
@@ -71,7 +59,6 @@ export function getPackagePurchaseUrl() {
});
}
/** 保存套餐购买链接 */
export function savePackagePurchaseUrl(purchaseUrl) {
return request({
url: "/platform/tenantPackage/purchaseUrl",
@@ -80,7 +67,6 @@ export function savePackagePurchaseUrl(purchaseUrl) {
});
}
/** 用户数加购规格列表(enabled=1 仅启用) */
export function getQuotaPackageList(params) {
return request({
url: "/platform/tenantQuotaPackage/list",
@@ -89,7 +75,6 @@ export function getQuotaPackageList(params) {
});
}
/** 新增加购规格 */
export function createQuotaPackage(data) {
return request({
url: "/platform/tenantQuotaPackage/create",
@@ -98,7 +83,6 @@ export function createQuotaPackage(data) {
});
}
/** 编辑加购规格 */
export function updateQuotaPackage(id, data) {
return request({
url: `/platform/tenantQuotaPackage/edit/${id}`,
@@ -107,7 +91,6 @@ export function updateQuotaPackage(id, data) {
});
}
/** 删除加购规格 */
export function deleteQuotaPackage(id) {
return request({
url: `/platform/tenantQuotaPackage/delete/${id}`,
@@ -115,7 +98,6 @@ export function deleteQuotaPackage(id) {
});
}
/** 为租户设置套餐 */
export function setTenantPackage(data) {
return request({
url: "/platform/tenant/setPackage",
@@ -124,7 +106,6 @@ export function setTenantPackage(data) {
});
}
/** 租户用户数配额信息(含套餐、已用、可加购规格) */
export function getTenantQuotaInfo(tid) {
return request({
url: "/platform/tenant/quotaInfo",
@@ -133,7 +114,6 @@ export function getTenantQuotaInfo(tid) {
});
}
/** 租户用户数增购(type=1 单个增购 / type=2 按加购规格) */
export function rechargeTenantQuota(data) {
return request({
url: "/platform/tenant/rechargeQuota",
@@ -142,7 +122,6 @@ export function rechargeTenantQuota(data) {
});
}
/** 租户用户数增购记录 */
export function getTenantQuotaOrders(tid) {
return request({
url: "/platform/tenant/quotaOrders",
-5
View File
@@ -1,6 +1,5 @@
import request from "@/utils/request";
/** 获取租户用户列表;params 可含 tid、uid、keyword(模糊匹配姓名/手机/邮箱/账号) */
export function getTenantUserList(params) {
return request({
url: "/platform/tenantUser/list",
@@ -9,7 +8,6 @@ export function getTenantUserList(params) {
});
}
/** 创建租户用户绑定(后端写入 yz_tenant_user) */
export function createTenantUser(data) {
return request({
url: "/platform/tenantUser/create",
@@ -18,7 +16,6 @@ export function createTenantUser(data) {
});
}
// 修改租户用户绑定信息(用于修改密码、启用/禁用等)
export function editTenantUser(id, data) {
return request({
url: `/platform/tenantUser/edit/${id}`,
@@ -27,7 +24,6 @@ export function editTenantUser(id, data) {
});
}
// 删除租户用户绑定
export function deleteTenantUser(id) {
return request({
url: `/platform/tenantUser/delete/${id}`,
@@ -35,7 +31,6 @@ export function deleteTenantUser(id) {
});
}
/** 查询指定租户的组织架构(部门下拉用) */
export function getTenantOrganizations(tid) {
return request({
url: "/platform/tenantUser/orgs",
-4
View File
@@ -1,6 +1,5 @@
import request from '@/utils/request'
// 获取模板列表
export function getThemeList() {
return request({
url: '/platform/theme',
@@ -8,7 +7,6 @@ export function getThemeList() {
})
}
// 切换模板
export function switchTheme(data) {
return request({
url: '/platform/theme/switch',
@@ -17,7 +15,6 @@ export function switchTheme(data) {
})
}
// 获取模板数据
export function getThemeData(params) {
return request({
url: '/platform/theme/data',
@@ -26,7 +23,6 @@ export function getThemeData(params) {
})
}
// 保存模板数据
export function saveThemeData(data) {
return request({
url: '/platform/theme/data',
-8
View File
@@ -1,6 +1,5 @@
import request from '@/utils/request';
//获取所有用户信息
export function getAllUsers() {
return request({
url: '/platform/getAllUsers',
@@ -8,7 +7,6 @@ export function getAllUsers() {
});
}
//获取租户用户
export function getTenantUsers(tenantId) {
return request({
url: `/platform/getTenantUsers/${tenantId}`,
@@ -16,7 +14,6 @@ export function getTenantUsers(tenantId) {
});
}
// 获取用户信息
export function getUserInfo(userId) {
return request({
url: `/platform/getUserInfo/${userId}`,
@@ -24,7 +21,6 @@ export function getUserInfo(userId) {
});
}
// 添加用户
export function addUser(data) {
return request({
url: '/platform/addUser',
@@ -33,7 +29,6 @@ export function addUser(data) {
});
}
// 编辑用户信息
export function editUser(userId, data) {
return request({
url: `/platform/editUser/${userId}`,
@@ -42,12 +37,10 @@ export function editUser(userId, data) {
});
}
// 更新用户信息(编辑用户的别名)
export function updateUserInfo(userId, data) {
return editUser(userId, data);
}
// 删除用户
export function deleteUser(userId) {
return request({
url: `/platform/deleteUser/${userId}`,
@@ -55,7 +48,6 @@ export function deleteUser(userId) {
});
}
// 修改密码
export function changePassword(userId, data) {
return request({
url: '/platform/changePassword',
-6
View File
@@ -1,10 +1,5 @@
import request from '@/utils/request'
// ==================== 官网管理 - 站点设置(平台端) ====================
// 数据落在 yz_platform_site_setting(单行配置),字段可被官网模板标签调用:
// {yz:sitename} {yz:logo} {yz:logow} {yz:icp} {yz:policeicp} {yz:copyright} {yz:privacy} {yz:terms}
// 读取站点设置
export function getWebsiteSetting() {
return request({
url: '/platform/website/setting/info',
@@ -12,7 +7,6 @@ export function getWebsiteSetting() {
})
}
// 保存站点设置
export function saveWebsiteSetting(data) {
return request({
url: '/platform/website/setting/save',
-26
View File
@@ -1,10 +1,5 @@
import request from "@/utils/request";
/*************************************************
* 微信公众号(服务号):配置 / 绑定 / 粉丝 / 推送
*************************************************/
/** 获取服务号配置(敏感字段返回掩码) */
export function getWechatMpConfig() {
return request({
url: "/platform/wechatMp/config",
@@ -12,7 +7,6 @@ export function getWechatMpConfig() {
});
}
/** 保存服务号配置(掩码 / 空串表示不修改原值) */
export function saveWechatMpConfig(data) {
return request({
url: "/platform/wechatMp/config",
@@ -21,7 +15,6 @@ export function saveWechatMpConfig(data) {
});
}
/** 连接测试:校验 AppID / AppSecret 是否能换取 access_token */
export function testWechatMpConnection() {
return request({
url: "/platform/wechatMp/test",
@@ -29,7 +22,6 @@ export function testWechatMpConnection() {
});
}
/** 通过接口发布「扫码登录」菜单(需认证公众号) */
export function publishWechatMpMenu() {
return request({
url: "/platform/wechatMp/menu/publish",
@@ -37,7 +29,6 @@ export function publishWechatMpMenu() {
});
}
/** 上传公众号「关注二维码」图片(formData 含 file 字段),返回 data.follow_qrcode */
export function uploadWechatFollowQrcode(formData) {
return request({
url: "/platform/wechatMp/followQrcode",
@@ -47,7 +38,6 @@ export function uploadWechatFollowQrcode(formData) {
});
}
/** 删除公众号「关注二维码」 */
export function deleteWechatFollowQrcode() {
return request({
url: "/platform/wechatMp/followQrcode/delete",
@@ -55,7 +45,6 @@ export function deleteWechatFollowQrcode() {
});
}
/** 发起绑定:生成带参数二维码(扫码关注后公众号回复验证码) */
export function startWechatMpBind() {
return request({
url: "/platform/wechatMp/bind/start",
@@ -63,7 +52,6 @@ export function startWechatMpBind() {
});
}
/** 查询绑定会话状态:0待扫码 1已扫码待核销 2已核销 3已过期 */
export function getWechatMpBindStatus(scene) {
return request({
url: "/platform/wechatMp/bind/status",
@@ -72,7 +60,6 @@ export function getWechatMpBindStatus(scene) {
});
}
/** 核销验证码完成绑定 */
export function confirmWechatMpBind(data) {
return request({
url: "/platform/wechatMp/bind/confirm",
@@ -81,7 +68,6 @@ export function confirmWechatMpBind(data) {
});
}
/** 当前平台用户的绑定信息 */
export function getMyWechatMpBinding() {
return request({
url: "/platform/wechatMp/my",
@@ -89,7 +75,6 @@ export function getMyWechatMpBinding() {
});
}
/** 解除当前平台用户的微信绑定 */
export function unbindWechatMp() {
return request({
url: "/platform/wechatMp/unbind",
@@ -97,7 +82,6 @@ export function unbindWechatMp() {
});
}
/** 粉丝列表 */
export function getWechatMpFollowers(params) {
return request({
url: "/platform/wechatMp/followers",
@@ -106,7 +90,6 @@ export function getWechatMpFollowers(params) {
});
}
/** 设置粉丝备注 */
export function setWechatMpFollowerRemark(data) {
return request({
url: "/platform/wechatMp/follower/remark",
@@ -115,7 +98,6 @@ export function setWechatMpFollowerRemark(data) {
});
}
/** 解除粉丝绑定(保留粉丝记录) */
export function unbindWechatMpFollower(data) {
return request({
url: "/platform/wechatMp/follower/unbind",
@@ -124,7 +106,6 @@ export function unbindWechatMpFollower(data) {
});
}
/** 批量推送(认证后可用) */
export function pushWechatMpMessage(data) {
return request({
url: "/platform/wechatMp/push",
@@ -133,7 +114,6 @@ export function pushWechatMpMessage(data) {
});
}
/** 测试推送:发送给当前账号绑定的微信 */
export function pushWechatMpTest(data) {
return request({
url: "/platform/wechatMp/push/test",
@@ -142,11 +122,6 @@ export function pushWechatMpTest(data) {
});
}
/*************************************************
* 微信小程序:一键登录配置(AppID / AppSecret / 启用)
*************************************************/
/** 获取小程序配置(AppSecret 返回掩码) */
export function getWechatMiniConfig() {
return request({
url: "/platform/wechatMini/config",
@@ -154,7 +129,6 @@ export function getWechatMiniConfig() {
});
}
/** 保存小程序配置(掩码 / 空串表示不修改原值) */
export function saveWechatMiniConfig(data) {
return request({
url: "/platform/wechatMini/config",
-2
View File
@@ -1,7 +1,5 @@
// 文章管理相关API
import request from "@/utils/request";
// 获取文章列表
export function GetCRMWorkbench(params) {
return request({
url: `/platform/workbench/crm`,
+2 -9
View File
@@ -124,7 +124,6 @@ var loadScript = function (url, cb) {
script.charset = "UTF-8";
script.async = true;
// 对geetestçš„é™æ€èµ„æºæ·»åŠ crossOrigin
if ( /static\.geetest\.com/g.test(url)) {
script.crossOrigin = "anonymous";
}
@@ -150,9 +149,7 @@ var loadScript = function (url, cb) {
};
var normalizeDomain = function (domain) {
// special domain: uems.sysu.edu.cn/jwxt/geetest/
// return domain.replace(/^https?:\/\/|\/.*$/g, ''); uems.sysu.edu.cn
return domain.replace(/^https?:\/\/|\/$/g, ''); // uems.sysu.edu.cn/jwxt/geetest
return domain.replace(/^https?:\/\/|\/$/g, '');
};
var normalizePath = function (path) {
path = path.replace(/\/+/g, '/');
@@ -195,7 +192,6 @@ var load = function (config, send, protocol, domains, path, query, cb) {
if (err) {
if (at >= domains.length - 1) {
cb(true);
// report gettype error
if (send) {
config.error_code = 508;
var url = protocol + domains[at] + path;
@@ -212,7 +208,6 @@ var load = function (config, send, protocol, domains, path, query, cb) {
tryRequest(0);
};
var jsonp = function (domains, path, config, callback) {
if (isObject(config.getLib)) {
config._extend(config.getLib);
@@ -290,10 +285,9 @@ window.initGeetest = function (userConfig, callback) {
config.protocol = window.location.protocol + '//';
}
// for KFC
if (userConfig.gt === '050cffef4ae57b5d5e529fea9540b0d1' ||
userConfig.gt === '3bd38408ae4af923ed36e13819b14d42') {
config.apiserver = 'yumchina.geetest.com/'; // for old js
config.apiserver = 'yumchina.geetest.com/';
config.api_server = 'yumchina.geetest.com';
}
@@ -349,5 +343,4 @@ window.initGeetest = function (userConfig, callback) {
};
})(window);
+1 -25
View File
@@ -99,8 +99,6 @@ var random = function () {
return parseInt(Math.random() * 10000) + (new Date()).valueOf();
};
// bind 函数polify, 不带new功能的bind
var bind = function(target,context){
if(typeof target !== 'function'){
return;
@@ -117,8 +115,6 @@ var bind = function(target,context){
}
}
var toString = Object.prototype.toString;
var _isFunction = function(obj) {
@@ -140,7 +136,6 @@ var _isBoolean = function(obj) {
return toString.call(obj) == '[object Boolean]';
};
function resolveKey(input){
return input.replace(/(\S)(_([a-zA-Z]))/g, function(match, $1, $2, $3){
return $1 + $3.toUpperCase() || "";
@@ -174,14 +169,12 @@ var loadScript = function (url, cb, timeout) {
script.charset = "UTF-8";
script.async = true;
// 对geetestçš„é™æ€èµ„æºæ·»åŠ crossOrigin
if ( /static\.geetest\.com/g.test(url)) {
script.crossOrigin = "anonymous";
}
script.onerror = function () {
cb(true);
// 错误触发了,超时逻辑就不用了
loaded = true;
};
var loaded = false;
@@ -210,9 +203,7 @@ var loadScript = function (url, cb, timeout) {
};
var normalizeDomain = function (domain) {
// special domain: uems.sysu.edu.cn/jwxt/geetest/
// return domain.replace(/^https?:\/\/|\/.*$/g, ''); uems.sysu.edu.cn
return domain.replace(/^https?:\/\/|\/$/g, ''); // uems.sysu.edu.cn/jwxt/geetest
return domain.replace(/^https?:\/\/|\/$/g, '');
};
var normalizePath = function (path) {
@@ -250,17 +241,14 @@ var makeURL = function (protocol, domain, path, query) {
var load = function (config, protocol, domains, path, query, cb, handleCb) {
var tryRequest = function (at) {
// 处理jsonp回调,这里为了保证每个不同jsonp都有唯一的回调函数
if(handleCb){
var cbName = "geetest_" + random();
// 需要与预先定义好cbnameå‚æ•°ï¼Œåˆ é™¤å¯¹è±¡
window[cbName] = bind(handleCb, null, cbName);
query.callback = cbName;
}
var url = makeURL(protocol, domains[at], path, query);
loadScript(url, function (err) {
if (err) {
// 超时或者出错的时候 移除回调
if(cbName){
try {
window[cbName] = function(){
@@ -271,7 +259,6 @@ var load = function (config, protocol, domains, path, query, cb, handleCb) {
if (at >= domains.length - 1) {
cb(true);
// report gettype error
} else {
tryRequest(at + 1);
}
@@ -283,19 +270,15 @@ var load = function (config, protocol, domains, path, query, cb, handleCb) {
tryRequest(0);
};
var jsonp = function (domains, path, config, callback) {
var handleCb = function (cbName, data) {
// 保证只执行一次,全部超时的情况下不会再触发;
if (data.status == 'success') {
callback(data.data);
} else if (!data.status) {
callback(data);
} else {
//接口有返回,但是返回了错误状态,进入报错逻辑
callback(data);
}
window[cbName] = undefined;
@@ -314,10 +297,7 @@ var jsonp = function (domains, path, config, callback) {
call_type: config.callType,
lang: config.language? config.language : navigator.appName === 'Netscape' ? navigator.language.toLowerCase() : navigator.userLanguage.toLowerCase()
}, function (err) {
// ç½‘ç»œé—®é¢˜æŽ¥å£æ²¡æœ‰è¿”å›žï¼Œç›´æŽ¥ä½¿ç”¨æœ¬åœ°éªŒè¯ç ï¼Œèµ°å®•æœºæ¨¡å¼
// è¿™é‡Œå¯ä»¥æ·»åŠ ç”¨æˆ·çš„é€»è¾‘
if(err && typeof config.offlineCb === 'function'){
// 执行自己的宕机
config.offlineCb();
return;
}
@@ -384,13 +364,11 @@ window.initGeetest4 = function (userConfig,callback) {
config.protocol = window.location.protocol + '//';
}
if (isObject(userConfig.getType)) {
config._extend(userConfig.getType);
}
jsonp(config.apiServers , config.typePath, config, function (newConfig) {
//错误捕获,第一个load请求可能直接报错
var newConfig = camelizeKeys(newConfig);
if(newConfig.status === 'error'){
@@ -453,7 +431,6 @@ window.initGeetest4 = function (userConfig,callback) {
}
});
} else if (s === "loaded") {
// 判断gctæ˜¯å¦éœ€è¦é‡æ–°åŠ è½½
if(newConfig.gctPath && !GeetestIsLoad(newConfig.gctPath)){
load(config, config.protocol, Object.hasOwnProperty.call(config, 'staticServers') ? config.staticServers : newConfig.staticServers || config.staticServers , newConfig.gctPath, null, function (err){
if(err){
@@ -483,5 +460,4 @@ window.initGeetest4 = function (userConfig,callback) {
};
})(window);
+5 -25
View File
@@ -1,5 +1,3 @@
// reset.less - 现代 CSS 样式重置
// 统一盒模型为 border-box
*,
*::before,
*::after {
@@ -8,31 +6,25 @@
padding: 0;
}
// 基础字体与颜色设置
html {
// 基础字体大小 (1rem = 16px)
font-size: 16px;
// 平滑滚动
scroll-behavior: smooth;
height: 100%;
width: 100%;
}
body {
// 继承父级字体设置
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
font-size: 1rem;
line-height: 1.5; // 舒适行高
color: #333; // 基础文本色
// background-color: #fff; // 基础背景色
-webkit-text-size-adjust: 100%; // 防止iOS横屏字体放大
line-height: 1.5;
color: #333;
-webkit-text-size-adjust: 100%;
height: 100%;
width: 100%;
margin: 0;
padding: 0;
}
// 移除默认边框
img,
iframe,
embed,
@@ -41,7 +33,6 @@ video {
border: 0;
}
// 图片与媒体元素自适应
img,
svg,
video,
@@ -55,23 +46,20 @@ object {
height: auto;
}
// 表格重置
table {
border-collapse: collapse;
border-spacing: 0;
width: 100%;
}
// 列表样式重置
ul,
ol,
li {
list-style: none;
}
// 文本元素重置
a {
color: inherit; // 继承父级颜色
color: inherit;
text-decoration: none;
background-color: transparent;
}
@@ -81,7 +69,6 @@ a:focus {
outline: none;
}
// 标题元素重置
h1,
h2,
h3,
@@ -93,7 +80,6 @@ h6 {
margin: 0;
}
// 表单元素重置
button,
input,
optgroup,
@@ -119,7 +105,6 @@ select {
text-transform: none;
}
// 按钮样式重置
button,
[type="button"],
[type="reset"],
@@ -136,7 +121,6 @@ button::-moz-focus-inner,
padding: 0;
}
// 输入框聚焦样式
input:focus,
select:focus,
textarea:focus,
@@ -144,13 +128,11 @@ button:focus {
outline: none;
}
// 文本区域不允许拖拽调整大小
textarea {
overflow: auto;
resize: vertical; // 仅允许垂直调整
resize: vertical;
}
// 移除占位符默认样式
::-webkit-input-placeholder {
color: #999;
opacity: 1;
@@ -171,14 +153,12 @@ textarea {
opacity: 1;
}
// 清除浮动
.clearfix::after {
content: "";
display: table;
clear: both;
}
// 隐藏元素(屏幕阅读器可见)
.sr-only {
position: absolute;
width: 1px;
-10
View File
@@ -1,5 +1,3 @@
// 全局主题:浅蓝白后台框架
// 自定义变量供顶栏 / 侧栏 / 内容区统一取色,Element Plus 主色同步收敛。
:root {
--el-message-z-index: 9999;
@@ -26,7 +24,6 @@
--yz-header-height: 64px;
}
// 暗色模式:只覆盖框架自定义变量,Element Plus 变量交给官方 dark css-vars
html.dark {
--yz-primary: #6f97ff;
--yz-primary-soft: rgba(64, 110, 220, 0.2);
@@ -42,17 +39,13 @@ html.dark {
--yz-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}
// body 样式
body {
color: var(--yz-text);
background-color: var(--yz-page-bg);
transition: background-color 0.3s ease, color 0.3s ease;
}
// container-box 样式
.container-box {
// background-color: #ffffff;
// border: 1px solid #ebeef5;
padding: 24px;
background-color: var(--el-bg-color);
border: 1px solid var(--el-border-color-lighter);
@@ -74,10 +67,7 @@ body {
margin: 14px 0 0 0;
}
// 修复 ElMessage 显示问题
// 只修复定位,保持 Element Plus 官方样式
.el-message {
// 确保消息固定在页面顶部中央,不受父容器影响
position: fixed !important;
z-index: var(--el-message-z-index, 9999) !important;
pointer-events: auto !important;
-18
View File
@@ -3,12 +3,10 @@
:width="width"
:class="['common-aside', { 'is-collapsed': isCollapse }]"
>
<!-- 加载状态 -->
<div v-if="loading" class="loading-spinner">
<i class="el-icon-loading"></i>
</div>
<!-- 错误提示 -->
<div v-else-if="hasError && list.length === 0" class="error-container">
<el-icon class="error-icon"><Warning /></el-icon>
<div class="error-text">{{ errorMsg }}</div>
@@ -16,7 +14,6 @@
</div>
<template v-if="showMenu">
<!-- 完整菜单树:不再按模块拆分,直接展示后端下发的全部菜单 -->
<el-menu
:collapse="isCollapse"
:collapse-transition="false"
@@ -38,14 +35,12 @@
暂无菜单
</div>
<!-- 底部浅蓝装饰与标语 -->
<div class="aside-decoration"></div>
<div v-if="!isCollapse" class="aside-slogan">
<span>用数据</span>
<span>让管理更美好</span>
</div>
<!-- 折叠开关放在侧栏右下角,不占用顶部、也不产生横向分割线 -->
<button
class="aside-collapse-btn"
:title="isCollapse ? '展开侧栏' : '收起侧栏'"
@@ -85,11 +80,9 @@ const showMenu = computed(
const processMenus = (menus) => {
return (menus || [])
.filter((menu) => {
// isPlatform 控制「平台端是否展示」,0 表示不在平台端显示
if (menu.isPlatform !== undefined && Number(menu.isPlatform) === 0) {
return false;
}
// is_visible 控制「侧边栏是否展示」,不参与动态路由与缓存层面的过滤
if (menu.is_visible !== undefined && Number(menu.is_visible) === 0) {
return false;
}
@@ -169,14 +162,11 @@ const fetchMenus = async () => {
try {
await menuStore.fetchMenus();
} catch (error) {
// 错误态由上方模板展示
}
};
</script>
<style scoped lang="less">
// 用 aside.common-aside 提权:Main.vue 里 :deep(.el-aside) 也是 !important,
// 权重相同时会被后加载的规则覆盖,导致 flex 布局失效、菜单无法滚动。
aside.common-aside {
position: relative;
display: flex !important;
@@ -234,8 +224,6 @@ aside.common-aside {
}
}
// 只作用于「侧栏根菜单」:flex / overflow / padding 不能写到 :deep(.el-menu) 上,
// 否则展开出来的 el-menu--inline 也会命中,导致子菜单的宽度、缩进、箭头定位全部错乱。
.aside-root-menu {
flex: 1 1 auto;
min-height: 0;
@@ -264,7 +252,6 @@ aside.common-aside {
}
}
// 菜单项视觉:所有层级统一(不覆盖 Element Plus 的层级缩进,保持图标与文字间距)
.aside-root-menu :deep(.el-menu-item),
.aside-root-menu :deep(.el-sub-menu__title) {
height: 42px;
@@ -289,7 +276,6 @@ aside.common-aside {
font-weight: 600;
}
// 展开出来的子菜单背景透明;缩进交给 Element Plus 自身(--el-menu-level)计算
.aside-root-menu :deep(.el-menu--inline) {
background: transparent !important;
}
@@ -304,7 +290,6 @@ aside.common-aside {
color: var(--yz-text-muted);
}
// ---------- 折叠态:仅根菜单 ----------
.aside-root-menu.el-menu--collapse {
width: 100% !important;
padding-left: 0;
@@ -381,7 +366,6 @@ aside.common-aside {
pointer-events: none;
}
// 折叠开关:右下角悬浮按钮,不加任何横向分割线
.aside-collapse-btn {
position: absolute;
right: 12px;
@@ -422,7 +406,6 @@ aside.common-aside.is-collapsed .aside-collapse-btn {
</style>
<style lang="less">
// 折叠后 hover 弹出的子菜单浮层被 teleport 到 body,scoped 样式命中不了
.common-aside-popper.el-popper {
background: var(--yz-card-bg) !important;
border: 1px solid var(--yz-border) !important;
@@ -459,7 +442,6 @@ aside.common-aside.is-collapsed .aside-collapse-btn {
background: var(--yz-primary-soft) !important;
}
// 折叠态下 EP 会把箭头翻成向左,浮层里的子菜单始终指向右
.el-sub-menu__icon-arrow {
transform: rotateZ(0deg) !important;
}
-35
View File
@@ -1,9 +1,7 @@
<template>
<div class="header">
<!-- 顶栏品牌区:宽度与侧栏对齐(224px / 折叠 64px) -->
<div class="header-left" :class="{ 'is-collapsed': isCollapse }">
<div class="brand" :title="brandTitle" @click="goHome">
<!-- 平台设置里上传的 Logo:优先长方形,深色主题优先深色版 -->
<img
v-if="brandPrimary.src && !logoBroken"
:src="brandPrimary.src"
@@ -11,7 +9,6 @@
:class="['brand-logo-img', brandPrimary.shape]"
@error="logoBroken = true"
/>
<!-- 未配置 Logo 时回退内置图标 + 品牌文字 -->
<template v-else>
<img :src="fallbackLogo" alt="logo" class="brand-logo-img is-square" />
<span class="brand-meta">
@@ -22,7 +19,6 @@
</div>
</div>
<!-- 面包屑 -->
<el-breadcrumb class="bread" separator="/">
<el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
<el-breadcrumb-item
@@ -34,7 +30,6 @@
</el-breadcrumb>
<div class="header-tools">
<!-- 菜单快捷搜索 -->
<div class="header-search-wrap">
<div class="header-search" :class="{ 'is-open': searchVisible }">
<el-input
@@ -76,7 +71,6 @@
</div>
</div>
<!-- 个人中心菜单:站内通知 / 刷新缓存 / 主题 / 个人资料 / 退出 -->
<el-dropdown
trigger="click"
placement="bottom-end"
@@ -101,7 +95,6 @@
</span>
<template #dropdown>
<el-dropdown-menu class="user-dropdown-menu">
<!-- 站内通知(二级面板) -->
<div
class="dropdown-submenu"
@mouseenter="openSubmenu = 'notification'"
@@ -150,7 +143,6 @@
<span>刷新缓存</span>
</el-dropdown-item>
<!-- 主题(二级面板) -->
<div
class="dropdown-submenu"
@mouseenter="openSubmenu = 'theme'"
@@ -240,7 +232,6 @@ const authStore = useAuthStore();
const isCollapse = computed(() => store.state.isCollapse);
// ---------- 品牌(平台设置 - 平台信息 / 官网管理 - 站点设置) ----------
const fallbackLogo = logoUrl;
const API_BASE_URL = String(import.meta.env.VITE_API_BASE_URL || "").replace(/\/+$/, "");
const brand = ref({
@@ -256,7 +247,6 @@ const brand = ref({
});
const logoBroken = ref(false);
// 相对路径(/uploads/xxx.png)补上接口基址,完整 URL / data: 原样使用
const resolveBrandImage = (url) => {
const value = String(url || "").trim().replace(/\\/g, "/");
if (!value) return "";
@@ -264,7 +254,6 @@ const resolveBrandImage = (url) => {
return `${API_BASE_URL}/${value.replace(/^\/+/, "")}`;
};
// 正方形 Logo:深色主题优先深色版,未配置回退浅色版
const brandSquareSrc = computed(() =>
resolveBrandImage(
isDark.value
@@ -273,7 +262,6 @@ const brandSquareSrc = computed(() =>
),
);
// 长方形 Logo:深色主题优先深色版,其次官网浅色 Logo
const brandWideSrc = computed(() => {
const value = isDark.value
? brand.value.logoRectDark ||
@@ -284,7 +272,6 @@ const brandWideSrc = computed(() => {
return resolveBrandImage(value);
});
// 顶栏左上角优先用长方形 Logo(品牌名通常已含在图中),没有则用方形
const brandPrimary = computed(() => {
const square = { src: brandSquareSrc.value, shape: "is-square" };
const wide = { src: brandWideSrc.value, shape: "is-wide" };
@@ -314,7 +301,6 @@ const fetchBrand = async () => {
};
logoBroken.value = false;
} catch (e) {
// 品牌属于装饰信息,加载失败保留内置占位
console.warn("加载平台品牌信息失败:", e);
}
};
@@ -324,7 +310,6 @@ const goHome = () => {
router.push("/home");
};
// ---------- 菜单扁平化(面包屑 / 搜索) ----------
interface FlatMenu {
id: number;
pid: number;
@@ -382,7 +367,6 @@ const breadcrumbs = computed(() => {
return chain;
});
// ---------- 菜单搜索 ----------
const keyword = ref("");
const searchOpen = ref(false);
const searchVisible = ref(false);
@@ -436,7 +420,6 @@ const handleSearchBlur = () => {
}, 150);
};
// ---------- 用户信息 ----------
const getImageUrl = () => {
return new URL(`/src/assets/images/default_avatar.png`, import.meta.url).href;
};
@@ -453,7 +436,6 @@ const roleLabel = computed(() => {
return typeof n === "string" && n.trim() ? n.trim() : "";
});
// ---------- 刷新缓存 ----------
const cacheLoading = ref(false);
const refreshCache = async () => {
cacheLoading.value = true;
@@ -473,7 +455,6 @@ const refreshCache = async () => {
}
};
// ---------- 站内通知 ----------
const unreadCount = ref(0);
const messages = ref<any[]>([]);
const loadingMessages = ref(false);
@@ -507,7 +488,6 @@ const fetchMessages = async () => {
}
};
// 用户菜单二级面板(站内通知 / 主题)开合状态:'' | 'notification' | 'theme'
const openSubmenu = ref("");
const toggleSubmenu = (name: string) => {
@@ -523,7 +503,6 @@ const handleDropdownVisibleChange = (visible: boolean) => {
fetchMessages();
fetchUnreadCount();
} else {
// 下拉整体关闭时收起二级面板
openSubmenu.value = "";
}
};
@@ -561,7 +540,6 @@ const handleMessagesChanged = () => {
fetchMessages();
};
// ---------- 个人中心 / 退出 ----------
const handleCommand = async (command) => {
if (command === "profile") {
router.push("/user/userProfile");
@@ -603,7 +581,6 @@ const handleCommand = async (command) => {
router.push("/login");
};
// ---------- 主题(跟随系统 / 亮色 / 暗色) ----------
const THEME_STORAGE_KEY = "element-plus-theme";
const themeOptions = [
{ label: "跟随系统", value: "system" },
@@ -635,7 +612,6 @@ const initTheme = () => {
applyThemeMode();
};
// ---------- 生命周期 ----------
let mediaQuery: MediaQueryList | null = null;
let handleChange: ((e: MediaQueryListEvent) => void) | null = null;
@@ -672,7 +648,6 @@ onUnmounted(() => {
window.removeEventListener("site-messages-changed", handleMessagesChanged);
});
// 路由变化时收起搜索面板
watch(
() => route.fullPath,
() => {
@@ -699,7 +674,6 @@ watch(
transition: background-color 0.3s ease, border-color 0.3s ease;
}
// 顶栏最左区块:宽度与侧栏一致(224px / 折叠 64px)
.header-left {
display: flex;
align-items: center;
@@ -759,14 +733,12 @@ watch(
display: block;
object-fit: contain;
// 正方形 Logo({yz:logo_square})
&.is-square {
width: 44px;
height: 44px;
border-radius: 12px;
}
// 长方形 Logo({yz:logo_rect}):品牌名通常已在图里,不重复显示文字
&.is-wide {
height: 44px;
width: auto;
@@ -798,7 +770,6 @@ watch(
text-overflow: ellipsis;
}
// 面包屑:占据中间剩余空间
.bread {
flex: 1 1 auto;
min-width: 0;
@@ -1049,7 +1020,6 @@ watch(
}
}
/* 消息中心下拉列表样式 */
.message-dropdown-container {
width: 320px;
background-color: var(--el-bg-color-overlay);
@@ -1234,10 +1204,7 @@ watch(
}
</style>
<!-- 个人中心下拉(teleport 到 body,需用全局样式) -->
<style lang="less">
// EP 2.11 的下拉菜单内容包在 el-scrollbar 里(overflow:hidden/auto),
// 二级面板 absolute 在菜单外侧,会被这层裁剪。用户菜单内容不长,放开裁剪换子菜单可见。
.user-dropdown-popper .el-scrollbar,
.user-dropdown-popper .el-scrollbar__wrap {
overflow: visible !important;
@@ -1245,7 +1212,6 @@ watch(
.user-dropdown-menu.el-dropdown-menu {
min-width: 248px;
// 不能加 max-height/overflow:二级面板 absolute 定位在菜单外侧,加了会被裁剪导致弹不出来
padding: 4px 0;
.el-dropdown-menu__item {
@@ -1293,7 +1259,6 @@ watch(
}
}
// 面板显隐由 v-show(内联 display)控制,这里不能写 display:none
.dropdown-submenu-panel {
position: absolute;
z-index: 2200;
-2
View File
@@ -15,8 +15,6 @@ const props = defineProps({
const instance = getCurrentInstance();
const isFontAwesome = computed(() => /fa-|(^|\s)fa[srlb]?\s/.test(props.icon || ""));
// main.js 已把所有 Element Plus 图标全局注册;数据库里存的是图标组件名,
// 未能识别时统一回退到 Grid,避免渲染出空白图标。
const elementIconName = computed(() => {
const name = props.icon || "Grid";
const components = instance?.appContext?.components || {};
@@ -1,6 +1,5 @@
<template>
<div class="flow-canvas">
<!-- 左侧节点面板 -->
<div class="palette">
<div class="palette-title">节点面板</div>
<div class="palette-list">
@@ -29,7 +28,6 @@
</div>
</div>
<!-- 画布 -->
<div ref="canvasWrap" class="canvas-wrap" @drop="onDrop" @dragover.prevent @dragenter.prevent>
<VueFlow
v-model:nodes="nodes"
@@ -41,14 +39,12 @@
@edge-click="onEdgeClick"
>
<template #node-flow="nodeProps">
<!-- 判断节点:菱形 -->
<div v-if="nodeProps.data.cls === 'decision'" class="fn-diamond">
<Handle type="target" :position="Position.Left" />
<div class="fn-diamond-shape"></div>
<div class="fn-diamond-label">{{ nodeProps.data.name || '判断' }}</div>
<Handle type="source" :position="Position.Right" />
</div>
<!-- 开始 / 结束:胶囊 -->
<div
v-else-if="nodeProps.data.cls === 'start' || nodeProps.data.cls === 'end'"
class="fn-pill"
@@ -59,14 +55,12 @@
<span>{{ nodeProps.data.name || (nodeProps.data.cls === 'start' ? '开始' : '结束') }}</span>
<Handle type="source" :position="Position.Right" />
</div>
<!-- 通知节点:圆形 -->
<div v-else-if="nodeProps.data.cls === 'notify'" class="fn-circle fn-circle-notify">
<Handle type="target" :position="Position.Left" />
<el-icon class="fn-circle-icon"><Bell /></el-icon>
<div class="fn-circle-label">{{ nodeProps.data.name || '通知' }}</div>
<Handle type="source" :position="Position.Right" />
</div>
<!-- 审批节点:矩形卡片 -->
<div v-else class="fn" :class="'fn-' + nodeProps.data.cls">
<Handle type="target" :position="Position.Left" />
<div class="fn-badge">{{ typeShort(nodeProps.data.nodeType) }}</div>
@@ -80,7 +74,6 @@
</VueFlow>
</div>
<!-- 节点配置对话框 -->
<el-dialog v-model="nodeDialog" :title="nodeDialogTitle" width="560px" append-to-body>
<el-form :model="nodeForm" label-width="96px">
<el-form-item label="节点名称" required>
@@ -170,7 +163,6 @@
</template>
</el-dialog>
<!-- 连线条件对话框 -->
<el-dialog v-model="edgeDialog" title="设置分支条件" width="460px" append-to-body>
<el-form label-width="88px">
<el-form-item label="条件表达式">
@@ -202,11 +194,8 @@ import '@vue-flow/core/dist/theme-default.css'
import '@vue-flow/controls/dist/style.css'
const props = defineProps({
// { nodes: [payloadNode], edges: [payloadEdge] }
modelValue: { type: Object, default: () => ({ nodes: [], edges: [] }) },
// 审批人类型:[{ value, label, needsSelection, selectLabel, poolKey }]
approverTypes: { type: Array, default: () => [] },
// 候选池:{ [poolKey]: [{ id, name }] }
pools: { type: Object, default: () => ({}) },
})
@@ -253,7 +242,6 @@ function approverSummary(node: any) {
return ''
}
// 由 payload 节点/边构建画布内部结构
function buildGraph(payload: any) {
const pNodes = payload?.nodes || []
const pEdges = payload?.edges || []
@@ -293,10 +281,8 @@ function makeNodeData(n: any) {
return data
}
// 初始化 / 外部切换流程时重建
function reload() {
const { ns, es } = buildGraph(props.modelValue || {})
// 避免坐标全 0 重叠:无坐标时自动铺开
let autoX = 60
let autoY = 60
ns.forEach((n: any) => {
@@ -312,7 +298,6 @@ function reload() {
watch(() => props.modelValue, reload, { deep: false, immediate: true })
// ==================== 拖拽添加 ====================
let dragType = 0
let dragging = false
function onDragStart(_evt: DragEvent, p: any) {
@@ -332,7 +317,6 @@ function onDrop(evt: DragEvent) {
dragType = 0
}
// 单击 palette 项:自动在画布中心附近新增节点(小量抖动避免重叠)
function onPaletteAdd(p: any) {
if (dragging) return
if (!canvasWrap.value) return
@@ -351,7 +335,6 @@ function defaultName(t: number) {
return t === NODE_TYPE.START ? '开始' : t === NODE_TYPE.END ? '结束' : t === NODE_TYPE.DECISION ? '判断节点' : t === NODE_TYPE.NOTIFY ? '通知节点' : '审批节点'
}
// ==================== 连线 ====================
onConnect((params: any) => {
const exists = edges.value.some((e) => e.source === params.source && e.target === params.target)
if (exists) return
@@ -366,7 +349,6 @@ onConnect((params: any) => {
})
})
// ==================== 节点配置 ====================
const nodeDialog = ref(false)
const editingNodeId = ref('')
const nodeForm = reactive<any>({
@@ -450,7 +432,6 @@ function removeCurrentNode() {
nodeDialog.value = false
}
// ==================== 连线条件 ====================
const edgeDialog = ref(false)
const editingEdgeId = ref('')
const edgeForm = reactive<any>({ condition: '' })
@@ -478,7 +459,6 @@ function removeCurrentEdge() {
edgeDialog.value = false
}
// ==================== 对外序列化 ====================
function serialize() {
const outNodes = nodes.value.map((n: any, i: number) => ({
node_key: n.id,
@@ -591,7 +571,6 @@ defineExpose({ serialize, fitView })
display: inline-block;
}
// 开始/结束:胶囊
.shape-start,
.shape-end {
width: 22px;
@@ -603,7 +582,6 @@ defineExpose({ serialize, fitView })
background: #909399;
}
// 审批节点:矩形
.shape-approval {
width: 20px;
height: 15px;
@@ -611,7 +589,6 @@ defineExpose({ serialize, fitView })
background: #409eff;
}
// 判断节点:菱形(旋转方块)
.shape-decision {
width: 15px;
height: 15px;
@@ -620,7 +597,6 @@ defineExpose({ serialize, fitView })
background: #e6a23c;
}
// 通知节点:圆形
.shape-notify {
width: 17px;
height: 17px;
@@ -715,7 +691,6 @@ defineExpose({ serialize, fitView })
.fn-approval { border-top: 3px solid #409eff; .fn-badge { background: #409eff; } }
.fn-end { border-top: 3px solid #909399; .fn-badge { background: #909399; } }
// 开始 / 结束:胶囊
.fn-pill {
display: flex;
align-items: center;
@@ -745,7 +720,6 @@ defineExpose({ serialize, fitView })
background: #f4f4f5;
}
// 判断节点:菱形
.fn-diamond {
position: relative;
width: 120px;
@@ -778,7 +752,6 @@ defineExpose({ serialize, fitView })
}
}
// 通知节点:圆形
.fn-circle {
position: relative;
width: 88px;
@@ -819,7 +792,6 @@ defineExpose({ serialize, fitView })
</style>
<style lang="less">
/* 多人方式问号图标 + 气泡内容:因 el-dialog / el-tooltip 均 append-to-body,需非 scoped 样式 */
.el-radio .mode-tip-icon {
margin-left: 4px;
color: #909399;
-18
View File
@@ -1,24 +1,11 @@
import { computed } from 'vue'
import { useDictStore } from '@/stores/dict'
/**
* 字典 Composable:把「加载 + 取值 + 文案/标签色查询」收敛成一行调用。
*
* 用法:
* const { items, options, label, tagType } = useDictionary('payment_channel')
* // 模板:<el-option v-for="o in options" :label="o.label" :value="o.value" />
* // <el-tag :type="tagType(row.status)">{{ label(row.status) }}</el-tag>
*
* @param {string} code 字典编码(库里真实的 dict_code)
*/
export function useDictionary(code) {
const dictStore = useDictStore()
// setup 阶段同步触发加载:缓存命中时不发请求,首次会自动拉取并响应式刷新
dictStore.ensure(code)
/** 字典项原始数组(含 item_value / item_label / tag_type 等) */
const items = computed(() => dictStore.getDictItemsSync(code))
/** el-select / el-option 直接可用的 { label, value } 列表 */
const options = computed(() => items.value.map((it) => ({
label: it.item_label,
value: it.item_value,
@@ -34,10 +21,6 @@ export function useDictionary(code) {
}
}
/**
* 只要「值 → 文案」或「值 → 标签色」时的轻量用法。
* const channelLabel = useDictLabel('payment_channel')
*/
export function useDictLabel(code) {
const dictStore = useDictStore()
dictStore.ensure(code)
@@ -50,7 +33,6 @@ export function useDictTagType(code) {
return (value, fallback) => dictStore.getDictTagType(code, value, fallback)
}
/** 预加载多个字典(页面 onMounted 里调用,一次批量请求) */
export function useDictPreload(codes) {
const dictStore = useDictStore()
return () => dictStore.preloadDicts(codes)
-1
View File
@@ -14,7 +14,6 @@ declare module '@/*' {
interface ImportMetaEnv {
readonly VITE_API_BASE_URL: string;
// 添加其他环境变量...
}
interface ImportMeta {
-11
View File
@@ -1,9 +1,7 @@
import { createApp } from 'vue'
import App from '@/App.vue'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
// 导入 Element Plus 样式(必须)
import 'element-plus/dist/index.css'
// 导入 Element Plus 暗黑模式样式
import 'element-plus/theme-chalk/dark/css-vars.css'
import '@/assets/less/index.less'
import '@/assets/css/all.min.css'
@@ -12,13 +10,10 @@ import router from './router'
import { loadAndAddDynamicRoutes } from './router'
import { createPinia } from 'pinia'
import { useAuthStore } from './stores/auth'
// import { initTheme } from './utils/theme'
// 导入全局组件
import UmoEditor from '@/views/components/UmoEditor.vue';
const app = createApp(App)
const pinia = createPinia()
// 全局注册 UmoEditor 组件
app.component('UmoEditor', UmoEditor);
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
@@ -28,21 +23,15 @@ for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
app.use(pinia)
app.use(router)
// 初始化主题(必须在挂载前执行)
// initTheme()
// 初始化时检查认证状态
const authStore = useAuthStore()
authStore.checkAuth()
// 如果用户已登录,在应用启动时加载动态路由
if (authStore.isLoggedIn) {
loadAndAddDynamicRoutes()
.catch(err => {
console.error('应用启动时加载动态路由失败:', err);
})
.then(() => {
// 检查是否因为 token 无效而导致路由加载失败
const token = localStorage.getItem('token');
if (!token) {
authStore.clearToken();
-11
View File
@@ -9,7 +9,6 @@ function computeFullPath(menuPath, parentPath) {
return `${base}/${menuPath}`.replace(/\/+/g, '/');
}
/** 将子路由的绝对路径转为相对父布局的路径,供 Vue Router 嵌套使用 */
function toRelativeChildPath(parentAbs, childAbs) {
const base = (parentAbs || '').replace(/\/$/, '');
const target = (childAbs || '').replace(/\/$/, '');
@@ -19,7 +18,6 @@ function toRelativeChildPath(parentAbs, childAbs) {
if (target.startsWith(prefix)) {
return target.slice(prefix.length);
}
// 兜底:取最后一段(菜单 path 配置异常时)
const parts = target.split('/').filter(Boolean);
return parts.length ? parts[parts.length - 1] : '';
}
@@ -38,9 +36,6 @@ function resolvePageComponent(menu) {
return () => import('@/views/404/404.vue');
}
/**
* 菜单子节点 -> 嵌套路由(path 相对 layoutAbsPath)
*/
function convertNestedMenuChildren(children, layoutAbsPath) {
if (!children || children.length === 0) return [];
return children.map((child) => nestedMenuToRoute(child, layoutAbsPath));
@@ -59,7 +54,6 @@ function nestedMenuToRoute(menu, layoutAbsPath) {
componentPath: menu.component_path,
};
// 既有自己的页面又有子菜单:套一层 EmptyLayout,避免父页面组件里没有 <router-view> 导致子路由无法渲染
if (hasChildren && ownPage) {
return {
path: relPath,
@@ -78,7 +72,6 @@ function nestedMenuToRoute(menu, layoutAbsPath) {
};
}
// 纯目录 + 子节点
if (hasChildren && !ownPage) {
const route = {
path: relPath,
@@ -98,7 +91,6 @@ function nestedMenuToRoute(menu, layoutAbsPath) {
return route;
}
// 叶子页面
return {
path: relPath,
name: `menu_${menu.id}`,
@@ -107,12 +99,10 @@ function nestedMenuToRoute(menu, layoutAbsPath) {
};
}
// 递归转换嵌套菜单为嵌套路由
export function convertMenusToRoutes(menus, parentPath = '') {
if (!menus || menus.length === 0) return [];
return menus
// 平台端:只转换 isPlatform !== 0 的菜单(默认视为平台可见)
.filter((menu) => menu.isPlatform === undefined || Number(menu.isPlatform) !== 0)
.map((menu) => {
const fullPath = menu.path
@@ -131,7 +121,6 @@ export function convertMenusToRoutes(menus, parentPath = '') {
componentPath: menu.component_path,
};
// 顶层:有页面 + 有子菜单 -> EmptyLayout + 默认子路由 + 相对 path 子路由
if (hasChildren && ownPage) {
return {
path: fullPath || menu.path || '',
+1 -34
View File
@@ -1,7 +1,6 @@
import { createRouter, createWebHashHistory } from "vue-router";
import { convertMenusToRoutes } from "./dynamicRoutes";
// 静态子路由:需要在 Main 框架内显示的页面
const staticMainChildren = [
{
path: "/home",
@@ -21,7 +20,6 @@ const staticMainChildren = [
component: () => import("@/views/system/email/index.vue"),
meta: { requiresAuth: true, title: "邮箱管理" }
},
// 平台 AI 服务商配置与 Playground(设置页保留 /setting 兼容路径)
{
path: "/system/aisettings",
name: "PlatformAiSettings",
@@ -38,28 +36,24 @@ const staticMainChildren = [
component: () => import("@/views/system/aisettings/playground.vue"),
meta: { requiresAuth: true, title: "AI Playground" }
},
// 统一认证中心:接入应用(OIDC Client)注册管理
{
path: "/system/authClient",
name: "AuthClientManage",
component: () => import("@/views/system/authClient/index.vue"),
meta: { requiresAuth: true, title: "应用注册" }
},
// 统一认证中心:第三方登录配置(全局 / 租户自带)
{
path: "/system/authIdp",
name: "AuthIdpManage",
component: () => import("@/views/system/authIdp/index.vue"),
meta: { requiresAuth: true, title: "第三方登录" }
},
// 统一认证中心:租户登录策略(验证方式/会话时长/1号1机)
{
path: "/system/authConfig",
name: "AuthConfigManage",
component: () => import("@/views/system/authConfig/index.vue"),
meta: { requiresAuth: true, title: "登录策略" }
},
// 审批流配置(平台侧:域名申请等管控场景)
{
path: "/system/approval",
name: "PlatformApprovalFlow",
@@ -90,21 +84,18 @@ const staticMainChildren = [
component: () => import("@/views/template/tags.vue"),
meta: { requiresAuth: true, title: "标签调用说明" }
},
// 排班模板(全局模板管理,只有平台可维护)
{
path: "/basicSettings/schedTemplate",
name: "PlatformSchedTemplate",
component: () => import("@/views/system/schedTemplate/index.vue"),
meta: { requiresAuth: true, title: "排班模板" }
},
// 兼容拼写错误的路径重定向
{
path: "/apps/erp/dashborad",
redirect: "/apps/erp/dashboard"
}
];
// 静态路由:登录页独立、404 页面独立(Main 布局路由单独定义,见 mainRoute)
const staticRoutes = [
{
path: "/login",
@@ -125,7 +116,6 @@ const staticRoutes = [
meta: { requiresAuth: false }
},
// 兼容路径拼写错误:dashborad -> dashboard
{
path: "/apps/erp/dashborad",
redirect: "/apps/erp/dashboard"
@@ -139,9 +129,6 @@ const notFoundRoute = {
meta: { requiresAuth: false }
};
// 主布局路由必须随应用一起注册:/home、/user/userProfile 等静态页面
// 不能等菜单接口返回后才存在。否则菜单接口失败或返回空数组时,
// 登录后跳转 /home 会命中 404 兜底路由(URL 停在 /#/home)。
const mainRoute = {
path: "/",
name: "Main",
@@ -159,7 +146,6 @@ const router = createRouter({
let dynamicRoutesAdded = false;
let dynamicRoutesData = [];
let routesLoadingPromise = null;
// 加载代数:登录/登出时自增,用于丢弃「上一账号」发起但已过期的加载结果
let routesGeneration = 0;
export function resetDynamicRoutes() {
@@ -184,8 +170,6 @@ export async function loadAndAddDynamicRoutes() {
const menuStore = useMenuStore();
const menuData = await menuStore.fetchMenus();
// 等待期间已切换账号(resetDynamicRoutes 被调用):
// 丢弃这批旧结果,避免用上一个会话的菜单覆盖路由表。
if (generation !== routesGeneration) {
return;
}
@@ -193,14 +177,10 @@ export async function loadAndAddDynamicRoutes() {
if (menuData && menuData.length > 0) {
addDynamicRoutes(menuData);
}
// 菜单为空也要标记完成(/home 等静态页面已在初始路由表中,不受影响),
// 避免每次导航都重复请求空菜单接口。
dynamicRoutesAdded = true;
routesLoadingPromise = null;
} catch (error) {
console.error('加载动态路由失败:', error);
// 关键:失败时不要置 dynamicRoutesAdded,否则同一会话内重新登录
// 后不会再加载路由表,业务菜单会全部落到 404;保留重试机会。
if (generation === routesGeneration) {
routesLoadingPromise = null;
}
@@ -211,10 +191,6 @@ export async function loadAndAddDynamicRoutes() {
return routesLoadingPromise;
}
/**
* 安全的动态路由加载:从不抛错,返回是否加载成功。
* 失败仅记录日志,由路由守卫决定放行静态页面还是重新登录。
*/
async function ensureDynamicRoutes() {
try {
await loadAndAddDynamicRoutes();
@@ -225,23 +201,20 @@ async function ensureDynamicRoutes() {
}
}
// 核心修改:移除扁平化,直接使用嵌套菜单生成路由
function addDynamicRoutes(menus) {
if (!menus?.length) {
return;
}
// 直接转换嵌套菜单为嵌套路由(不再扁平化)
const dynamicRoutes = convertMenusToRoutes(menus);
if (router.hasRoute('Main')) {
router.removeRoute('Main');
}
// 重新添加主路由,合并静态子路由和动态路由
router.addRoute({
...mainRoute,
children: [...staticMainChildren, ...dynamicRoutes] // 合并静态和动态子路由
children: [...staticMainChildren, ...dynamicRoutes]
});
dynamicRoutesAdded = true;
@@ -284,8 +257,6 @@ router.beforeEach(async (to, from, next) => {
if (publicPaths.includes(to.path)) {
if (token) {
if (!dynamicRoutesAdded) {
// 已在登录页且带 token:加载失败也要放行(静态路由已就绪),
// 不能因为一次接口失败卡在登录页或落到 404。
await ensureDynamicRoutes();
}
next({ path: "/home" });
@@ -302,18 +273,14 @@ router.beforeEach(async (to, from, next) => {
if (!dynamicRoutesAdded) {
const loaded = await ensureDynamicRoutes();
// 加载过程中请求被判 401,拦截器已清掉 token,直接回登录页
if (!localStorage.getItem("token")) {
next({ path: '/login' });
return;
}
if (loaded) {
// 路由表刚变化,重新解析目标地址,避免命中兜底 404
next({ path: to.path, query: to.query, hash: to.hash, replace: true });
return;
}
// 加载失败但 token 仍有效:静态页面(/home 等)照常放行,
// 下次导航会再次尝试加载业务路由。
}
next();
-12
View File
@@ -1,7 +1,6 @@
import { defineStore } from 'pinia'
import { ref, reactive } from 'vue'
// 平台登录缓存仅保留以下字段(不含 tid、group_id)
const defaultUser = {
id: '',
account: '',
@@ -11,10 +10,6 @@ const defaultUser = {
role_name: ''
}
/**
* 规范化写入 localStorage 的用户信息,去掉 tid、group_id 等废弃字段;
* 若仅有历史 group_id,则迁移到 rid。
*/
function normalizePlatformUser(raw) {
if (!raw || typeof raw !== 'object') {
return { ...defaultUser }
@@ -41,7 +36,6 @@ export const useAuthStore = defineStore('auth', () => {
const isLoggedIn = ref(!!token.value)
const user = reactive({ ...defaultUser })
// 从缓存加载用户信息
function loadUserFromCache() {
const cachedUser = localStorage.getItem('userInfo')
if (cachedUser) {
@@ -56,10 +50,8 @@ export const useAuthStore = defineStore('auth', () => {
}
}
// 初始化时加载用户信息
loadUserFromCache()
// 保存登录信息(token 和用户信息)
function setLoginInfo(loginData) {
const userInfo = loginData.user || loginData
const normalizedUser = normalizePlatformUser(userInfo)
@@ -74,14 +66,12 @@ export const useAuthStore = defineStore('auth', () => {
localStorage.setItem('userInfo', JSON.stringify(normalizedUser))
}
// 设置 token(兼容旧代码)
function setToken(newToken) {
token.value = newToken
isLoggedIn.value = true
localStorage.setItem('token', newToken)
}
// 清除登录信息
function clearToken() {
token.value = ''
isLoggedIn.value = false
@@ -90,7 +80,6 @@ export const useAuthStore = defineStore('auth', () => {
localStorage.removeItem('userInfo')
}
// 检查认证状态
function checkAuth() {
const storedToken = localStorage.getItem('token')
if (storedToken) {
@@ -104,7 +93,6 @@ export const useAuthStore = defineStore('auth', () => {
}
}
// 更新用户信息(合并后仍只持久化平台字段)
function updateUserInfo(partial) {
const merged = normalizePlatformUser({ ...user, ...partial })
Object.assign(user, merged)
-38
View File
@@ -2,29 +2,11 @@ import { defineStore } from 'pinia'
import { ref } from 'vue'
import { getDictOptions, getDictOptionsBatch, getAllDictOptions } from '@/api/dict'
/**
* 字典 Store(平台端)
*
* 全部字典数据都来自数据库,前端不维护编码清单:
* - 登录后调用一次 loadAll(),把库里所有「启用」字典读进缓存;
* - 页面按库里真实的 dict_code 取值即可(字符串直接写,无需常量文件);
* - 之后在字典管理页新增的字典,第一次被引用时会按需自动加载。
*
* 用法:
* const dictStore = useDictStore()
* dictStore.getDictLabel('payment_order_status', row.status) // 文案
* dictStore.getDictTagType('payment_order_status', row.status) // 标签色
* dictStore.getSelectOptions('payment_channel') // 下拉选项
*/
export const useDictStore = defineStore('dict', () => {
/** dict_code -> 字典项数组(渲染依赖它,必须是响应式的) */
const dictMap = ref({})
/** 已加载过的编码(仅用于去重,不参与渲染) */
let loaded = {}
/** 正在请求中的编码 -> Promise(并发调用复用同一个请求) */
const pending = new Map()
/** 是否已完成全量预热 */
let allLoaded = false
let allPending = null
@@ -36,15 +18,10 @@ export const useDictStore = defineStore('dict', () => {
return dictMap.value[code] || []
}
/** 把入参规范成去重后的编码数组 */
function normalizeCodes(codes) {
return [...new Set((codes || []).map((c) => String(c || '').trim()).filter(Boolean))]
}
/**
* 加载字典(带缓存与并发去重)。
* 请求失败也会标记为已加载,避免页面反复重试;需要重试请先 clearCache。
*/
async function load(codes) {
const list = normalizeCodes(codes)
const missing = list.filter((c) => !loaded[c] && !pending.has(c))
@@ -52,7 +29,6 @@ export const useDictStore = defineStore('dict', () => {
if (missing.length) {
const promise = (async () => {
if (missing.length === 1) {
// 单个字典走专用接口
const code = missing[0]
try {
const res = await getDictOptions(code)
@@ -61,7 +37,6 @@ export const useDictStore = defineStore('dict', () => {
setItems(code, [])
}
} else {
// 多个字典合并成一次请求
try {
const res = await getDictOptionsBatch(missing)
const dicts = res?.code === 200 ? res.data?.dicts || {} : {}
@@ -84,10 +59,6 @@ export const useDictStore = defineStore('dict', () => {
return list.flatMap((c) => itemsOf(c))
}
/**
* 全量预热:一次请求把库里所有启用字典读进缓存(登录后调用一次即可)。
* 之后再新增的字典仍会走 load() 按需加载。
*/
function loadAll() {
if (allLoaded) return Promise.resolve()
if (allPending) return allPending
@@ -103,7 +74,6 @@ export const useDictStore = defineStore('dict', () => {
})
dictMap.value = next
} catch {
// 预热失败不影响使用:后续按需加载
} finally {
allLoaded = true
allPending = null
@@ -112,7 +82,6 @@ export const useDictStore = defineStore('dict', () => {
return allPending
}
/** 同步触发加载(不等待),用于组件 setup/onMounted 里“先渲染后填充” */
function ensure(code) {
const list = normalizeCodes([code])
if (list.some((c) => !loaded[c] && !pending.has(c))) {
@@ -120,20 +89,17 @@ export const useDictStore = defineStore('dict', () => {
}
}
/** 同步取字典项;未加载时顺带触发加载,拿到后由响应式自动刷新 */
function getDictItemsSync(code) {
ensure(code)
return itemsOf(code)
}
/** 值 → 字典项(值按字符串比较,兼容 1 / '1' 混用) */
function getDictItem(code, value) {
if (value === undefined || value === null || value === '') return null
const key = String(value)
return itemsOf(code).find((it) => String(it.item_value) === key) || null
}
/** 值 → 文案;取不到时返回 fallback,未传则原样返回取值 */
function getDictLabel(code, value, fallback) {
const hit = getDictItem(code, value)
if (hit) return hit.item_label
@@ -141,23 +107,19 @@ export const useDictStore = defineStore('dict', () => {
return value === undefined || value === null ? '' : String(value)
}
/** 值 → el-tag 的 type;取不到时返回 fallback(默认 info) */
function getDictTagType(code, value, fallback = 'info') {
const hit = getDictItem(code, value)
return hit && hit.tag_type ? hit.tag_type : fallback
}
/** 值 → 下拉选项 { label, value },供 el-select / el-option 直接使用 */
function getSelectOptions(code) {
return getDictItemsSync(code).map((it) => ({ label: it.item_label, value: it.item_value, tag_type: it.tag_type }))
}
/** 预加载多个字典(一次批量请求) */
function preloadDicts(codes) {
return load(codes)
}
/** 清空缓存:传编码清单个,不传清全部(同时允许重新全量预热) */
function clearCache(code) {
if (code) {
delete loaded[code]
-28
View File
@@ -1,7 +1,6 @@
import { defineStore } from 'pinia';
import { ref, computed, reactive } from 'vue';
// ========== 全局状态 Store ==========
function initState() {
return {
isCollapse: false,
@@ -16,7 +15,6 @@ export const useAllDataStore = defineStore('allData', () => {
count.value++;
}
// 是否为手机端(≤768px),通过 matchMedia 响应式监听
const mobileQuery = window.matchMedia('(max-width: 768px)');
const isMobile = ref(mobileQuery.matches);
const handleMobileQueryChange = (e) => {
@@ -37,30 +35,17 @@ export const useAllDataStore = defineStore('allData', () => {
};
});
// ========== 多标签页 Tabs Store ==========
import { defineStore as defineTabsStore } from 'pinia';
import { ref as vueRef } from 'vue';
/**
* 多标签页Tabs状态管理
* tabList每个tab结构: {
* title: 标签显示名,
* fullPath: 路由路径(唯一key),
* name: 路由name,
* icon: 图标(可选)
* }
*/
export const useTabsStore = defineTabsStore('tabs', () => {
// 固定首页 tab:/home 是数据概览页
const defaultDashboardPath = '/home';
// 从 localStorage 恢复 tabs 状态
function loadTabsFromStorage() {
try {
const savedTabs = localStorage.getItem('tabs_list');
if (savedTabs) {
const tabs = JSON.parse(savedTabs);
// 确保至少包含首页
const hasHome = tabs.some(t => t.fullPath === defaultDashboardPath);
if (!hasHome) {
tabs.unshift({ title: '首页', fullPath: defaultDashboardPath, name: 'Home' });
@@ -73,7 +58,6 @@ export const useTabsStore = defineTabsStore('tabs', () => {
return [{ title: '首页', fullPath: defaultDashboardPath, name: 'Home' }];
}
// 保存 tabs 到 localStorage
function saveTabsToStorage(tabs, active) {
try {
localStorage.setItem('tabs_list', JSON.stringify(tabs));
@@ -89,7 +73,6 @@ export const useTabsStore = defineTabsStore('tabs', () => {
const savedActiveTab = localStorage.getItem('active_tab');
const activeTab = vueRef(savedActiveTab || defaultDashboardPath);
// 添加tab,若已存在则激活
function addTab(tab) {
const exist = tabList.value.find((t) => t.fullPath === tab.fullPath);
if (!exist) {
@@ -99,20 +82,16 @@ export const useTabsStore = defineTabsStore('tabs', () => {
saveTabsToStorage(tabList.value, activeTab.value);
}
// 删除指定tab并切换激活tab
function removeTab(fullPath) {
if (fullPath === defaultDashboardPath) return;
const idx = tabList.value.findIndex((t) => t.fullPath === fullPath);
if (idx > -1) {
tabList.value.splice(idx, 1);
// 只在关闭当前激活tab时切换激活tab
if (activeTab.value === fullPath) {
if (tabList.value.length > 0) {
// 优先激活右侧(如无则激活左侧)
const newIdx = idx >= tabList.value.length ? tabList.value.length - 1 : idx;
activeTab.value = tabList.value[newIdx].fullPath;
} else {
// 全部关闭,兜底首页
activeTab.value = defaultDashboardPath;
}
}
@@ -120,7 +99,6 @@ export const useTabsStore = defineTabsStore('tabs', () => {
}
}
// 关闭其他,只留首页和当前激活tab
function closeOthers() {
tabList.value = tabList.value.filter(
(t) => t.fullPath === defaultDashboardPath || t.fullPath === activeTab.value
@@ -128,7 +106,6 @@ export const useTabsStore = defineTabsStore('tabs', () => {
saveTabsToStorage(tabList.value, activeTab.value);
}
// 关闭左侧(关闭指定tab左侧的所有tab,保留首页和目标tab)
function closeLeft(targetFullPath) {
const targetIndex = tabList.value.findIndex((t) => t.fullPath === targetFullPath);
if (targetIndex > -1) {
@@ -147,7 +124,6 @@ export const useTabsStore = defineTabsStore('tabs', () => {
}
}
// 关闭右侧(关闭指定tab右侧的所有tab,保留首页和目标tab)
function closeRight(targetFullPath) {
const targetIndex = tabList.value.findIndex((t) => t.fullPath === targetFullPath);
if (targetIndex > -1) {
@@ -166,20 +142,17 @@ export const useTabsStore = defineTabsStore('tabs', () => {
}
}
// 关闭全部,只留首页
function closeAll() {
tabList.value = tabList.value.filter((t) => t.fullPath === defaultDashboardPath);
activeTab.value = defaultDashboardPath;
saveTabsToStorage(tabList.value, activeTab.value);
}
// 设置激活tab(不触发路由跳转,仅用于更新状态)
function setActiveTab(fullPath) {
activeTab.value = fullPath;
saveTabsToStorage(tabList.value, activeTab.value);
}
// 重置 tabs store 到初始状态(登出时使用)
function resetTabs() {
tabList.value = [{ title: '首页', fullPath: defaultDashboardPath, name: 'Home' }];
activeTab.value = defaultDashboardPath;
@@ -203,5 +176,4 @@ export const useTabsStore = defineTabsStore('tabs', () => {
};
});
// ========== 菜单 Menu Store ==========
export { useMenuStore } from './menu';
-39
View File
@@ -1,24 +1,16 @@
import { defineStore } from 'pinia'
import { ref, computed } from 'vue'
// import { getUserInfo } from '@/utils/auth'
import { getMenus } from '@/api/menu';
export const useMenuStore = defineStore('menu', () => {
// 菜单数据
const menus = ref([]);
// 加载状态
const loading = ref(false);
// 加载错误
const error = ref(null);
// 正在加载的 Promise(用于避免重复请求)
let loadingPromise = null;
// 菜单缓存 key(基于用户类型、角色ID、用户ID)
// 必须带上用户ID:同一浏览器换账号登录时,若只看角色ID会复用上一个账号的菜单,
// 导致新账号进入后菜单/路由与权限不匹配。
const getCacheKey = () => {
try {
const userInfo = JSON.parse(localStorage.getItem('userInfo') || '{}');
@@ -31,14 +23,12 @@ export const useMenuStore = defineStore('menu', () => {
}
};
// 从缓存加载菜单
const loadFromCache = () => {
try {
const cacheKey = getCacheKey();
const cached = localStorage.getItem(cacheKey);
if (cached) {
const menuData = JSON.parse(cached);
// 检查缓存是否过期(5分钟过期)
if (menuData.timestamp && Date.now() - menuData.timestamp < 5 * 60 * 1000) {
return menuData.menus;
}
@@ -49,7 +39,6 @@ export const useMenuStore = defineStore('menu', () => {
return null;
};
// 保存菜单到缓存
const saveToCache = (menuData) => {
try {
const cacheKey = getCacheKey();
@@ -62,7 +51,6 @@ export const useMenuStore = defineStore('menu', () => {
}
};
// 清除菜单缓存(含历史 key 格式与其他账号遗留的缓存)
const clearCache = () => {
try {
const cacheKeys = [];
@@ -78,7 +66,6 @@ export const useMenuStore = defineStore('menu', () => {
}
};
// 获取用户信息
const getUserInfo = () => {
try {
return JSON.parse(localStorage.getItem('userInfo') || '{}');
@@ -87,14 +74,11 @@ export const useMenuStore = defineStore('menu', () => {
}
};
// 从 API 加载菜单(核心方法,确保只请求一次)
const fetchMenus = async (forceRefresh = false) => {
// 如果已经有正在加载的请求,直接返回该 Promise
if (loadingPromise && !forceRefresh) {
return loadingPromise;
}
// 如果不强制刷新,先尝试从缓存加载
if (!forceRefresh) {
const cachedMenus = loadFromCache();
if (cachedMenus && cachedMenus.length > 0) {
@@ -103,12 +87,10 @@ export const useMenuStore = defineStore('menu', () => {
}
}
// 如果正在加载且不是强制刷新,返回现有的 Promise
if (loading.value && !forceRefresh) {
return loadingPromise;
}
// 创建新的加载 Promise
loadingPromise = (async () => {
loading.value = true;
error.value = null;
@@ -120,37 +102,27 @@ export const useMenuStore = defineStore('menu', () => {
let res;
// 检查用户ID是否存在
if (!userInfo.id) {
throw new Error('用户ID不存在,请重新登录');
}
// 用户登录,使用 getMenus 接口
res = await getMenus(userInfo.id);
// 检查响应格式
if (!res) {
throw new Error('获取菜单失败:服务器无响应');
}
// 检查后端返回的 code 字段
if (res.code !== 200) {
throw new Error(res.msg || '获取菜单失败');
}
// 如果 code 为 200,检查 data
if (res.code === 200) {
// data 可能是空数组,这也是有效的
if (res.data !== undefined && res.data !== null) {
// 确保 data 是数组
const menuData = Array.isArray(res.data) ? res.data : [];
// 直接使用后端返回的树形结构数据,不需要额外过滤
menus.value = menuData;
// 保存到缓存
saveToCache(menuData);
return menuData;
} else {
// data 为 null 或 undefined,使用空数组
console.warn('菜单数据为空,使用空数组');
menus.value = [];
saveToCache([]);
@@ -158,7 +130,6 @@ export const useMenuStore = defineStore('menu', () => {
}
}
// 如果响应格式不符合预期,尝试直接使用 res.data
if (res.data !== undefined) {
const menuData = Array.isArray(res.data) ? res.data : [];
const filtered = menuData.filter(m => (m.isShow ?? 1) !== 0);
@@ -167,7 +138,6 @@ export const useMenuStore = defineStore('menu', () => {
return filtered;
}
// 如果都不符合,抛出错误
throw new Error(res.message || '获取菜单失败:响应格式错误');
} catch (err) {
error.value = err.message || '获取菜单失败';
@@ -178,14 +148,12 @@ export const useMenuStore = defineStore('menu', () => {
stack: err.stack
});
// 如果是 token 无效错误,不使用缓存,直接抛出
if (err.message === 'token无效' || err.response?.status === 401) {
clearCache();
menus.value = [];
throw err;
}
// 如果出错,尝试使用缓存数据
const cachedMenus = loadFromCache();
if (cachedMenus && cachedMenus.length > 0) {
console.warn('使用缓存的菜单数据');
@@ -193,7 +161,6 @@ export const useMenuStore = defineStore('menu', () => {
return cachedMenus;
}
// 如果连缓存都没有,设置空数组,避免页面崩溃
menus.value = [];
throw err;
} finally {
@@ -205,13 +172,11 @@ export const useMenuStore = defineStore('menu', () => {
return loadingPromise;
};
// 刷新菜单(强制从 API 获取)
const refreshMenus = async () => {
clearCache();
return await fetchMenus(true);
};
// 重置菜单 store(登出时使用)
const resetMenus = () => {
menus.value = [];
loading.value = false;
@@ -220,20 +185,16 @@ export const useMenuStore = defineStore('menu', () => {
clearCache();
};
// 计算属性:获取菜单列表
const menuList = computed(() => menus.value);
// 计算属性:菜单是否已加载
const isLoaded = computed(() => menus.value.length > 0);
return {
// 状态
menus: menuList,
loading,
error,
isLoaded,
// 方法
fetchMenus,
refreshMenus,
resetMenus,
-15
View File
@@ -1,30 +1,18 @@
/**
* 统一日期时间格式化工具(platform 端)
*
* 后端(Go)返回的时间字段为 RFC3339 / ISO 8601 字符串,
* 例如 "2026-03-31T23:34:07+08:00",直接渲染不友好。
* 页面上显示时间统一使用本工具,输出:
* formatDateTime / formatTime -> 2026-03-31 23:34:07(YYYY-MM-DD HH:mm:ss)
* formatDate / formatDateOnly -> 2026-03-31(YYYY-MM-DD)
*/
const pad = (n: number) => String(n).padStart(2, "0");
function toDate(value: any): Date | null {
if (value === null || value === undefined || value === "") return null;
if (value instanceof Date) return isNaN(value.getTime()) ? null : value;
// 兼容秒级 / 毫秒级时间戳
if (typeof value === "number") {
const d = new Date(value < 1e12 ? value * 1000 : value);
return isNaN(d.getTime()) ? null : d;
}
// "2026-03-31 23:34:07" 形式在部分浏览器解析异常,统一先替换为 ISO 形式
const str = String(value).trim().replace(" ", "T");
const d = new Date(str);
return isNaN(d.getTime()) ? null : d;
}
/** 2026-03-31 23:34:07(YYYY-MM-DD HH:mm:ss);非法值返回 "-" */
export function formatDateTime(value: any): string {
const d = toDate(value);
if (!d) return "-";
@@ -34,12 +22,10 @@ export function formatDateTime(value: any): string {
);
}
/** 与 formatDateTime 相同(兼容旧调用名) */
export function formatTime(value: any): string {
return formatDateTime(value);
}
/** 2026-03-31(YYYY-MM-DD);非法值返回 "-";纯日期串不做时区换算 */
export function formatDate(value: any): string {
if (typeof value === "string" && /^\d{4}-\d{2}-\d{2}$/.test(value.trim())) {
return value.trim();
@@ -49,7 +35,6 @@ export function formatDate(value: any): string {
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;
}
/** 与 formatDate 相同(兼容旧调用名) */
export function formatDateOnly(value: any): string {
return formatDate(value);
}
-13
View File
@@ -1,13 +1,6 @@
/**
* 浏览器标签页图标(favicon)。
*
* 图标来源:平台「系统设置 - 平台设置 - 平台信息」的「站点图标」(标签 ico)。
* 未配置时保留 index.html 里的默认图标,不做任何改写。
*/
const API_BASE_URL = String(import.meta.env.VITE_API_BASE_URL || "").replace(/\/+$/, "");
/** 相对路径(/uploads/x.ico)补上接口基址,完整 URL 原样使用 */
function resolveIconUrl(url) {
const value = String(url || "").trim().replace(/\\/g, "/");
if (!value) return "";
@@ -15,11 +8,6 @@ function resolveIconUrl(url) {
return `${API_BASE_URL}/${value.replace(/^\/+/, "")}`;
}
/**
* 把指定地址应用为页面 favicon。
* @param {string} url 图片地址(可相对)
* @returns {boolean} 是否已应用
*/
export function applyFavicon(url) {
const href = resolveIconUrl(url);
if (!href) return false;
@@ -31,7 +19,6 @@ export function applyFavicon(url) {
document.head.appendChild(link);
}
// .ico 显式声明 MIME,其余交给浏览器按扩展名/内容识别
if (/\.ico(\?|#|$)/i.test(href)) {
link.setAttribute("type", "image/x-icon");
} else {
-4
View File
@@ -1,7 +1,3 @@
/**
* 将 Font Awesome HTML 片段或普通 class 字符串统一转换为可存储的 class 字符串。
* 例如:<i class="fa-solid fa-water-ladder"></i> -> fa-solid fa-water-ladder
*/
export function normalizeFontAwesomeIcon(value) {
const input = String(value ?? "").trim();
if (!input) return "";
-37
View File
@@ -1,60 +1,33 @@
/**
* 通用的别名路径解析工具
* 用于在动态导入时解析 @ 别名路径
*/
import { h } from 'vue';
// 使用 import.meta.glob 预加载所有组件
const viewsModules = import.meta.glob('../views/**/*.vue');
// 创建路径映射表
const pathMap = new Map();
// 初始化路径映射
Object.keys(viewsModules).forEach(relativePath => {
// relativePath 示例: ../views/system/users.vue
// 统一去掉扩展名进行存储,方便各种格式匹配
const baseNoExt = relativePath.replace('../views/', '').replace('.vue', '');
const baseWithExt = relativePath.replace('../views/', '');
// 1. 存储标准路径
pathMap.set(relativePath, viewsModules[relativePath]);
// 2. 存储 @/views 路径
pathMap.set(relativePath.replace('../views', '@/views'), viewsModules[relativePath]);
// 3. 存储 /system/users 格式(不带扩展名)
pathMap.set(`/${baseNoExt}`, viewsModules[relativePath]);
// 4. 存储 system/users 格式(不带扩展名)
pathMap.set(baseNoExt, viewsModules[relativePath]);
// 5. 存储 /system/users.vue 格式(带扩展名)
pathMap.set(`/${baseWithExt}`, viewsModules[relativePath]);
// 6. 存储 system/users.vue 格式(带扩展名)
pathMap.set(baseWithExt, viewsModules[relativePath]);
});
/**
* 解析别名路径为实际模块加载器
* @param {string} path - 支持的路径格式:
* - @/views/dashboard/index.vue (别名格式)
* - /dashboard/index.vue (数据库格式,带前导斜杠)
* - dashboard/index.vue (相对格式)
* @returns {Function|null} 返回模块加载器函数,找不到时返回 null
*/
export function resolveComponent(path) {
if (!path) return null;
// 预处理 path:去掉可能的 .vue 后缀统一查找
const cleanPath = path.replace('.vue', '');
// 尝试直接匹配
const loader = pathMap.get(path) || pathMap.get(cleanPath);
if (loader) return loader;
// 数据库格式补全匹配 (针对 /system/users)
const dbFormat = cleanPath.startsWith('/') ? cleanPath : `/${cleanPath}`;
if (pathMap.get(dbFormat)) return pathMap.get(dbFormat);
// 模糊匹配:文件名匹配
const fileName = cleanPath.split('/').pop();
for (const [mappedPath, loader] of pathMap.entries()) {
if (mappedPath.endsWith(`${fileName}.vue`) || mappedPath.endsWith(fileName)) {
@@ -64,18 +37,12 @@ export function resolveComponent(path) {
return null;
}
/**
* 创建组件加载器
* @param {string} componentPath - 组件路径
* @returns {Function} Vue 路由组件加载函数
*/
export function createComponentLoader(componentPath) {
const loader = resolveComponent(componentPath);
if (loader) return loader;
console.error(`❌ [路由错误] 未找到组件: ${componentPath}`);
// 返回一个标准的 Vue 组件对象,确保 Router 不报错
return () => Promise.resolve({
name: 'ComponentNotFound',
render: () => {
@@ -85,10 +52,6 @@ export function createComponentLoader(componentPath) {
});
}
/**
* 获取所有已加载的模块路径(用于调试)
* @returns {Array<string>} 所有可用的路径列表
*/
export function getAllModulePaths() {
return Array.from(pathMap.keys());
}
+8 -66
View File
@@ -1,10 +1,6 @@
import request from '@/utils/request';
import * as qiniu from 'qiniu-js';
/**
* 获取存储配置
* @returns {Promise<{storageType: string, qiniuDomain?: string, qiniuRegion?: string}>}
*/
export async function getStorageConfig() {
const res = await request({
url: '/platform/storage/config',
@@ -16,10 +12,6 @@ export async function getStorageConfig() {
return { storageType: 'local' };
}
/**
* 获取七牛云上传凭证
* @returns {Promise}
*/
export async function getQiniuToken() {
return request({
url: '/platform/qiniu/token',
@@ -27,11 +19,6 @@ export async function getQiniuToken() {
});
}
/**
* 保存文件记录到数据库
* @param {Object} data 文件信息
* @returns {Promise}
*/
export async function saveFileRecord(data) {
return request({
url: '/platform/qiniu/save',
@@ -40,35 +27,17 @@ export async function saveFileRecord(data) {
});
}
/**
* 上传文件(自动选择本地或七牛云)
* @param {File} file 文件对象
* @param {Object} options 配置选项
* @param {number} [options.cate] 文件分类
* @param {Function} [options.onProgress] 进度回调
* @returns {Promise<{url: string, id: number, name: string, key?: string}>}
*/
export async function smartUpload(file, options = {}) {
// 获取存储配置
const config = await getStorageConfig();
if (config.storageType === 'qiniu') {
// 使用七牛云直传
return uploadToQiniu(file, options);
} else {
// 使用本地上传(通过后端)
return uploadToLocal(file, options);
}
}
/**
* 上传到七牛云(直传)
* @param {File} file 文件对象
* @param {Object} options 配置选项
* @returns {Promise}
*/
export async function uploadToQiniu(file, options = {}) {
// 1. 获取上传凭证
const tokenRes = await getQiniuToken();
if (tokenRes?.code !== 200) {
throw new Error(tokenRes?.msg || '获取上传凭证失败');
@@ -76,17 +45,14 @@ export async function uploadToQiniu(file, options = {}) {
const { token, keyPrefix, domain, region, uploadUrl } = tokenRes.data;
// 2. 生成文件 key
const ext = file.name.split('.').pop();
const key = `${keyPrefix}.${ext}`;
// 3. 配置上传参数
const putExtra = {
fname: file.name,
mimeType: file.type || 'application/octet-stream',
};
// 4. 根据区域代码获取七牛云区域对象
const qiniuRegion = getQiniuRegion(region);
const config = {
@@ -94,14 +60,11 @@ export async function uploadToQiniu(file, options = {}) {
region: qiniuRegion,
};
// 5. 创建 observable 对象
const observable = qiniu.upload(file, key, token, putExtra, config);
// 5. 执行上传
return new Promise((resolve, reject) => {
const subscription = observable.subscribe({
next(res) {
// 进度回调
if (options.onProgress) {
options.onProgress({
loaded: res.total.loaded,
@@ -115,7 +78,6 @@ export async function uploadToQiniu(file, options = {}) {
},
async complete(res) {
try {
// 6. 保存文件记录到数据库
const saveRes = await saveFileRecord({
key: res.key,
hash: res.hash,
@@ -143,12 +105,6 @@ export async function uploadToQiniu(file, options = {}) {
});
}
/**
* 上传到本地(通过后端中转)
* @param {File} file 文件对象
* @param {Object} options 配置选项
* @returns {Promise}
*/
export async function uploadToLocal(file, options = {}) {
const formData = new FormData();
formData.append('file', file);
@@ -161,7 +117,7 @@ export async function uploadToLocal(file, options = {}) {
url: '/platform/uploadfile',
method: 'post',
data: formData,
timeout: 0, // 不设置超时
timeout: 0,
};
if (options.onProgress) {
@@ -187,15 +143,6 @@ export async function uploadToLocal(file, options = {}) {
}
}
/**
* 批量上传文件
* @param {File[]} files 文件数组
* @param {Object} options 配置选项
* @param {Function} [options.onFileProgress] 单个文件进度回调 (file, progress) => void
* @param {Function} [options.onFileComplete] 单个文件完成回调 (file, result) => void
* @param {Function} [options.onFileError] 单个文件错误回调 (file, error) => void
* @returns {Promise<Array>}
*/
export async function batchUpload(files, options = {}) {
const results = [];
@@ -227,26 +174,21 @@ export async function batchUpload(files, options = {}) {
return results;
}
/**
* 根据区域代码获取七牛云区域对象
* @param {string} regionCode 区域代码 (z0, z1, z2, na0, as0, cn-east-2)
* @returns {Object} 七牛云区域对象
*/
function getQiniuRegion(regionCode) {
switch (regionCode) {
case 'z0':
return qiniu.region.z0; // 华东
return qiniu.region.z0;
case 'z1':
return qiniu.region.z1; // 华北
return qiniu.region.z1;
case 'z2':
return qiniu.region.z2; // 华南
return qiniu.region.z2;
case 'na0':
return qiniu.region.na0; // 北美
return qiniu.region.na0;
case 'as0':
return qiniu.region.as0; // 新加坡
return qiniu.region.as0;
case 'cn-east-2':
return qiniu.region.cnEast2; // 华东-浙江2
return qiniu.region.cnEast2;
default:
return qiniu.region.z0; // 默认华东
return qiniu.region.z0;
}
}
+1 -6
View File
@@ -1,16 +1,13 @@
import axios from 'axios';
// 获取API基础URL;开发环境可在 .env.development 留空,配合 Vite 代理访问 /platform
const apiBaseURL = import.meta.env.VITE_API_BASE_URL ?? "";
// 创建axios实例(普通接口 5min;大文件上传在 api/file.js 单独更长 timeout)
const service = axios.create({
baseURL: apiBaseURL,
timeout: 300000,
withCredentials: false // JWT 不需要 Cookie
withCredentials: false
});
// 请求拦截器
service.interceptors.request.use(
config => {
const token = localStorage.getItem('token');
@@ -18,7 +15,6 @@ service.interceptors.request.use(
config.headers['Authorization'] = `Bearer ${token}`;
}
// 对于有 body 的请求(POST、PUT、PATCH),默认 JSON;FormData 由浏览器带 multipart boundary,不可手写 Content-Type
if (config.data && ['post', 'put', 'patch'].includes(config.method?.toLowerCase())) {
if (config.data instanceof FormData) {
delete config.headers['Content-Type'];
@@ -34,7 +30,6 @@ service.interceptors.request.use(
}
);
// 响应拦截器
service.interceptors.response.use(
response => {
return response.data;
-22
View File
@@ -1,41 +1,19 @@
/**
* URL工具函数
*/
/**
* 获取完整的文件URL
* 如果URL已经是完整URL(http://或https://开头),直接返回
* 否则拼接API基础URL
* @param {string} url - 文件URL或路径
* @returns {string} 完整的URL
*/
export function getFileUrl(url) {
if (!url) return '';
// 如果URL已经是完整的URL(以http://或https://开头),直接返回
if (url.startsWith('http://') || url.startsWith('https://')) {
return url;
}
// 否则拼接API基础URL
const API_BASE_URL = import.meta.env.VITE_API_BASE_URL || '';
return `${API_BASE_URL}${url}`;
}
/**
* 获取环境URL(getEnvUrl的别名)
* @param {string} path - 文件路径
* @returns {string} 完整的URL
*/
export function getEnvUrl(path) {
return getFileUrl(path);
}
/**
* 判断URL是否是完整URL
* @param {string} url - URL字符串
* @returns {boolean} 是否是完整URL
*/
export function isFullUrl(url) {
if (!url) return false;
return url.startsWith('http://') || url.startsWith('https://');
-22
View File
@@ -1,26 +1,9 @@
/**
* 官网管理上传辅助(platform/src/views/website 专用)
*
* 官网管理各页面(文章封面 / 分类图片 / Logo / 友情链接 Logo / 富文本正文图片)
* 上传的文件统一归入「文件管理」的「官网素材」分组,便于在
* /system/fileManager 中集中查找与复用。
*
* 分组按名称查找,不存在时补建 —— 与 platform/softwareupgrade 的
* appsupgrade 分组使用同一套做法;该默认分组同时由
* go/docs/sql/init_platform_website_file_cate.sql 预置。
*/
import { getUserCate, createFileCate, uploadFile } from "@/api/file";
export const WEBSITE_MATERIAL_CATE_NAME = "官网素材";
// 分组ID缓存(同一会话内只解析一次,并发调用复用同一个 Promise)
let cateIdPromise = null;
/**
* 取「官网素材」分组ID。
* 查询/创建任一环节失败时返回 0(未分类),不阻断上传本身。
* @returns {Promise<number>}
*/
export function ensureWebsiteMaterialCate() {
if (!cateIdPromise) {
cateIdPromise = (async () => {
@@ -48,11 +31,6 @@ export function ensureWebsiteMaterialCate() {
return cateIdPromise;
}
/**
* 上传文件到「官网素材」分组
* @param {File} file 待上传文件
* @returns {Promise} 与 uploadFile 返回值一致(code 200 新上传 / 201 已存在)
*/
export async function uploadToWebsiteMaterial(file) {
const cate = await ensureWebsiteMaterialCate();
const formData = new FormData();
-6
View File
@@ -1,6 +1,5 @@
<template>
<div class="not-found-page">
<!-- 背景装饰:柔光 + 网格 -->
<div class="bg-decor" aria-hidden="true">
<span class="orb orb-1"></span>
<span class="orb orb-2"></span>
@@ -94,7 +93,6 @@ import { ElMessage, ElMessageBox } from "element-plus";
const router = useRouter();
const route = useRoute();
// 当前访问路径:方便用户/管理员定位是哪个链接失效
const currentPath = computed(() => {
const full = route.fullPath || "";
if (!full || full === "/") return "";
@@ -102,12 +100,10 @@ const currentPath = computed(() => {
});
const backToHome = () => {
// Hash 模式下 /home 是系统导航门户
router.push("/home");
};
const backToPrev = () => {
// 有站内历史就退一步,否则回首页
if (window.history.length > 1) {
router.back();
return;
@@ -139,7 +135,6 @@ const clearCache = async () => {
ElMessage.success("缓存已清除");
window.location.reload();
} catch {
// 用户取消,不做任何操作
}
};
</script>
@@ -413,7 +408,6 @@ h1 {
}
}
/* 深色主题(backend 支持亮/暗切换;platform 无暗色时不会命中) */
html.dark .not-found-page {
background:
radial-gradient(900px 480px at 10% 6%, rgba(47, 107, 255, 0.18) 0%, rgba(47, 107, 255, 0) 62%),
-22
View File
@@ -13,12 +13,10 @@ const dictStore = useDictStore();
const router = useRouter();
const route = useRoute();
// 固定首页(数据概览)作为不可关闭的默认标签
const defaultDashboardPath = computed(
() => tabsStore.defaultDashboardPath || '/home'
);
// ========== 手机端侧栏抽屉控制 ==========
const MOBILE_QUERY = '(max-width: 768px)';
const mobileMedia = window.matchMedia(MOBILE_QUERY);
const isMobile = ref(mobileMedia.matches);
@@ -53,7 +51,6 @@ const closeMobileSidebar = () => {
sidebarVisible.value = false;
};
// 根据当前路由恢复 tab(刷新时使用)
function restoreTabFromRoute() {
const currentPath = route.fullPath;
const currentName = route.name;
@@ -99,7 +96,6 @@ onMounted(() => {
});
});
// 监听路由变化,自动添加/激活对应的 tab
watch(
() => route.fullPath,
(newPath) => {
@@ -111,7 +107,6 @@ watch(
{ immediate: false }
);
// 侧栏/顶栏菜单点击:加入/激活 Tab 并切换路由
const handleAsideMenuClick = async (menuItem) => {
const targetPath = menuItem.path;
if (!targetPath) return;
@@ -158,7 +153,6 @@ const closeAll = () => {
router.push(defaultDashboardPath.value || route.fullPath);
};
// 主动监听 tab 激活,保证切 tab 时内容区切换
watch(
() => tabsStore.activeTab,
(newVal, oldVal) => {
@@ -175,7 +169,6 @@ watch(
{ flush: 'post' }
);
// ========== 右键菜单逻辑 ==========
const contextMenu = reactive({
visible: false,
x: 0,
@@ -321,7 +314,6 @@ const canCloseRight = computed(() => {
<template>
<div class="common-layout">
<!-- 手机端汉堡菜单按钮(仅 ≤768px 显示,CSS 控制) -->
<button
class="mobile-menu-btn"
:aria-label="sidebarVisible ? '关闭菜单' : '打开菜单'"
@@ -333,7 +325,6 @@ const canCloseRight = computed(() => {
</el-icon>
</button>
<!-- 手机端遮罩层,点击关闭侧栏 -->
<transition name="mask-fade">
<div
v-if="isMobile && sidebarVisible"
@@ -343,7 +334,6 @@ const canCloseRight = computed(() => {
</transition>
<el-container class="main-container" direction="vertical">
<!-- 顶栏全宽:logo 位于页面真正的左上角 -->
<el-header class="main-header">
<common-header @menu-click="handleAsideMenuClick" />
</el-header>
@@ -372,7 +362,6 @@ const canCloseRight = computed(() => {
/>
</el-tabs>
<!-- 右键菜单 -->
<teleport to="body">
<div
v-if="contextMenu.visible"
@@ -410,7 +399,6 @@ const canCloseRight = computed(() => {
</div>
</div>
</teleport>
<!-- 右侧操作按钮 -->
<div class="tabs-extra-actions">
<el-dropdown trigger="click">
<el-button type="primary" link size="small" class="extra-btn">
@@ -430,7 +418,6 @@ const canCloseRight = computed(() => {
</div>
</div>
<!-- 主内容毛玻璃卡片容器 -->
<div class="main-panel glass-card">
<router-view v-slot="{ Component }">
<keep-alive :max="10">
@@ -439,7 +426,6 @@ const canCloseRight = computed(() => {
</router-view>
</div>
<!-- 回到顶部按钮 -->
<el-backtop :target="'.right-main'" :visibility-height="300" :right="30" :bottom="50">
<div class="backtop-button">
<el-icon :size="20">
@@ -463,9 +449,6 @@ const canCloseRight = computed(() => {
transition: background-color 0.3s ease;
:deep(.el-aside) {
// 侧栏内部是「菜单 + 底部装饰」的纵向布局:
// 必须是 flex 列容器,菜单才能 flex:1 收缩并在内部滚动。
// 不能写成 display:block,否则 el-menu 的高度会撑开、溢出被裁剪且无法滚动。
display: flex !important;
flex-direction: column;
visibility: visible !important;
@@ -618,7 +601,6 @@ const canCloseRight = computed(() => {
border-right: none !important;
}
// ========== 手机端侧栏抽屉(仅 ≤768px 生效,桌面端不受影响) ==========
.mobile-menu-btn {
display: none;
position: fixed;
@@ -668,7 +650,6 @@ const canCloseRight = computed(() => {
display: flex;
}
// 覆盖 el-aside 的 :width 内联宽度(224px/64px),改为 fixed 抽屉
.common-layout .common-aside-wrapper {
position: fixed !important;
top: 0;
@@ -700,7 +681,6 @@ const canCloseRight = computed(() => {
}
}
// 回到顶部按钮样式
.backtop-button {
width: 40px;
height: 40px;
@@ -726,7 +706,6 @@ const canCloseRight = computed(() => {
</style>
<style lang="less">
// 右键菜单样式 - 全局样式,因为使用了 teleport 到 body
.context-menu {
position: fixed !important;
z-index: 9999 !important;
@@ -759,7 +738,6 @@ const canCloseRight = computed(() => {
}
}
// 确保编辑器工具栏的 z-index 高于右键菜单
.tiptap-toolbar {
z-index: 10000 !important;
pointer-events: auto !important;
@@ -9,14 +9,14 @@ const props = defineProps({
},
mode: {
type: String,
default: 'single', // single | batch
default: 'single',
},
});
const emit = defineEmits(['update:modelValue', 'submit']);
const form = reactive({
type: 'account', // account | tk | account_tk
type: 'account',
account: '',
password: '',
token: '',
@@ -475,7 +475,6 @@ onMounted(() => {
fetchList();
});
// ---- 接口说明数据 ----
const BASE_URL = "https://api.yunzer.cn";
const paramDocs = [
@@ -822,7 +821,6 @@ async function handleProbeToken(row) {
@confirm="handleReplenish"
/>
<!-- 接口说明抽屉 -->
<el-drawer
v-model="apiDocVisible"
title="提卡接口说明"
@@ -8,7 +8,6 @@ const props = defineProps({
type: Boolean,
default: false,
},
/** cursor / windsurf / krio */
module: {
type: String,
required: true,
@@ -17,7 +16,6 @@ const props = defineProps({
type: Object,
default: () => ({}),
},
/** 打开弹窗时的默认账号类型(与列表 Tab 对齐:全部时用 account) */
defaultAccountType: {
type: String,
default: 'account',
@@ -245,7 +245,6 @@ onBeforeUnmount(() => {
</template>
<div v-if="row" class="detail-body" v-loading="loading">
<!-- Prev/Next Navigation Buttons -->
<div
class="nav-btn prev-btn"
:class="{ 'is-disabled': !hasPrev || loading }"
@@ -384,13 +383,6 @@ onBeforeUnmount(() => {
<el-button type="success" plain @click="openUsableDialog">
改可用状态
</el-button>
<!-- <el-button
type="danger"
plain
@click="unavailableDialogVisible = true"
>
改不可用
</el-button> -->
<el-button
type="warning"
plain
@@ -625,7 +617,6 @@ onBeforeUnmount(() => {
min-height: 18px;
}
/* Navigation buttons styles */
.nav-btn {
position: absolute;
top: 50%;
@@ -9,14 +9,14 @@ const props = defineProps({
},
mode: {
type: String,
default: "single", // single | batch
default: "single",
},
});
const emit = defineEmits(["update:modelValue", "submit"]);
const form = reactive({
type: "tk", // account | tk | account_tk
type: "tk",
account: "",
password: "",
token: "",
@@ -110,7 +110,6 @@ const pagination = reactive({
pageSize: storedPagination.pageSize,
});
/** 跳转未提取末页时跳过 watcher,避免先被重置到第 1 页 */
const skipWatchFetchDuringUnusedJump = ref(false);
const pagedList = computed(() => tableData.value);
@@ -558,7 +557,6 @@ function normalizeRow(raw) {
}
return "";
};
// 指针类型字段(可能为 null),单独处理
const pickNullable = (...keys) => {
for (const key of keys) {
if (raw?.[key] !== undefined) return raw[key] ?? null;
@@ -630,7 +628,6 @@ async function fetchList() {
}
}
/** 筛选「未提取」并翻到该条件下的最后一页(当前搜索条件、账号类型 tab 不变) */
async function jumpToLastUnusedPage() {
const type = activeTypeTab.value === "all" ? undefined : activeTypeTab.value;
const res = await getAccountPoolList(moduleKey, {
@@ -676,7 +673,6 @@ onUnmounted(() => {
window.removeEventListener('resize', updateDeviceType);
});
// ---- 接口说明数据 ----
const BASE_URL = "https://api.yunzer.cn";
const paramDocs = [
@@ -754,12 +750,10 @@ function copyCardInfo(row) {
const CURSOR_PRO_LIMIT_TEXT = 'Get Cursor Pro for more Agent usage, unlimited Tab, and more.';
function formatCursorProbeDialogText(d) {
// 1. 优先以新版后端的 ok 字段(也就是底层探针的交叉判定结论)为核心准则
if (d && typeof d.ok === 'boolean') {
return d.ok ? '该TOKEN可用' : `该TOKEN已用完 (${d.detail || '额度枯竭'})`;
}
// 2. 兼容旧数据的兜底检测
const CURSOR_PRO_LIMIT_TEXT = 'Get Cursor Pro for more Agent usage, unlimited Tab, and more.';
const detail = String(d?.detail || '');
const rawPreview = String(d?.rawPreview || '');
@@ -776,16 +770,13 @@ function formatCursorProbeDetail(d) {
const parts = [];
// 提取关键信息
if (d.httpStatus) parts.push(`HTTP状态: ${d.httpStatus}`);
if (d.endpoint) parts.push(`接口: ${d.endpoint}`);
if (d.probeMessage) parts.push(`探测方式: ${d.probeMessage}`);
if (d.bytesRead) parts.push(`响应大小: ${d.bytesRead} 字节`);
if (d.streamProtocol) parts.push(`协议: ${d.streamProtocol}`);
// 提取检测结论
if (d.detail) {
// 解析流匹配信息
const matchPrefix = '流中匹配:';
if (d.detail.includes(matchPrefix)) {
const matchStart = d.detail.indexOf(matchPrefix);
@@ -819,7 +810,6 @@ async function handleProbeToken(row) {
const text = formatCursorProbeDialogText(d);
const isOk = d.ok === true;
// 构建详细信息
const detailItems = [];
if (d.httpStatus) detailItems.push(`HTTP状态: ${d.httpStatus}`);
if (d.endpoint) detailItems.push(`接口: ${d.endpoint}`);
@@ -827,7 +817,6 @@ async function handleProbeToken(row) {
if (d.bytesRead) detailItems.push(`响应大小: ${d.bytesRead} 字节`);
if (d.streamProtocol) detailItems.push(`协议: ${d.streamProtocol}`);
// 提取检测结论(从 detail 字段)
if (d.detail) {
const matchPrefix = '流中匹配:';
if (d.detail.includes(matchPrefix)) {
@@ -859,7 +848,6 @@ async function handleProbeToken(row) {
closeOnClickModal: true,
});
} catch {
/* 用户关闭弹窗 */
}
await fetchList();
} catch {
@@ -946,57 +934,6 @@ function closeBatchProbeDialog() {
batchProbePhase.value = "running";
}
// async function handleBatchProbeExpireTime() {
// if (!selectedRows.value.length) {
// ElMessage.warning("请先选择数据");
// return;
// }
// const rows = selectedRows.value.filter((r) => r?.token);
// if (!rows.length) {
// ElMessage.warning("所选行均无 Token,无法检测时间");
// return;
// }
// const skipped = selectedRows.value.length - rows.length;
// const validRows = rows.map((row) => ({
// ...row,
// ...resolveAccessTokenExpireInfo(row.token),
// }));
// const validCount = validRows.filter((row) => row.accessTokenExpireStatus === "valid").length;
// const expiredCount = validRows.filter((row) => row.accessTokenExpireStatus === "expired").length;
// const unknownCount = validRows.filter((row) => row.accessTokenExpireStatus === "unknown").length;
// tableData.value = tableData.value.map((item) => {
// const found = validRows.find((row) => row.id === item.id);
// return found
// ? {
// ...item,
// accessTokenExpireAt: found.accessTokenExpireAt,
// accessTokenExpireStatus: found.accessTokenExpireStatus,
// accessTokenExpireText: found.accessTokenExpireText,
// }
// : item;
// });
// const lines = validRows.slice(0, 20).map((row) => `ID ${row.id}:${row.accessTokenExpireText}`);
// if (validRows.length > 20) {
// lines.push(`...其余 ${validRows.length - 20} 条未展开`);
// }
// if (skipped > 0) {
// lines.push(`已跳过无 Token ${skipped} 条`);
// }
// await ElMessageBox({
// title: "批量时间检测结果",
// message: h("div", { class: "cursor-probe-result cursor-expire-result" }, [
// h("div", `有效 ${validCount} 条,已失效 ${expiredCount} 条,无法解析 ${unknownCount} 条`),
// h("pre", { class: "cursor-expire-result-pre" }, lines.join("\n")),
// ]),
// confirmButtonText: "关闭",
// customClass: "cursor-probe-dialog",
// closeOnClickModal: true,
// });
// }
</script>
<template>
@@ -1077,7 +1014,6 @@ function closeBatchProbeDialog() {
<el-button @click="replenishVisible = true">补号</el-button>
<el-button @click="markExtractForSelected">批量提取</el-button>
<el-button plain @click="handleBatchProbe">批量检测</el-button>
<!-- <el-button type="info" plain @click="handleBatchProbeExpireTime">批量时间检测</el-button> -->
<el-button @click="apiDocVisible = true">接口说明</el-button>
</div>
</div>
@@ -1109,12 +1045,6 @@ function closeBatchProbeDialog() {
</template>
</el-table-column>
<el-table-column prop="account" label="账号" min-width="180" show-overflow-tooltip :tooltip-options="tooltipOpts" />
<!-- <el-table-column prop="password" label="密码" min-width="160" show-overflow-tooltip :tooltip-options="tooltipOpts">
<template #default="{ row }">{{ row.password || '-' }}</template>
</el-table-column>
<el-table-column label="Token" min-width="200" show-overflow-tooltip :tooltip-options="tooltipOpts">
<template #default="{ row }">{{ row.token || '-' }}</template>
</el-table-column> -->
<el-table-column label="提取状态" width="100">
<template #default="{ row }">
<el-tag :type="extractStatusTagType(row)">
@@ -1329,7 +1259,6 @@ function closeBatchProbeDialog() {
</template>
</el-dialog>
<!-- 接口说明抽屉 -->
<el-drawer
v-model="apiDocVisible"
title="提卡接口说明"
@@ -1552,7 +1481,6 @@ function closeBatchProbeDialog() {
}
/* 接口说明抽屉 */
.api-doc {
padding: 0 4px;
font-size: 13px;
@@ -1747,7 +1675,6 @@ function closeBatchProbeDialog() {
display: block;
}
/* Cursor 探测结果弹窗(teleport 到 body,需非 scoped) */
.cursor-probe-dialog .el-message-box__message {
padding: 12px 8px 4px;
width: 100%;
@@ -9,14 +9,14 @@ const props = defineProps({
},
mode: {
type: String,
default: 'single', // single | batch
default: 'single',
},
});
const emit = defineEmits(['update:modelValue', 'submit']);
const form = reactive({
type: 'account', // account | tk | account_tk
type: 'account',
account: '',
password: '',
token: '',
@@ -475,7 +475,6 @@ onMounted(() => {
fetchList();
});
// ---- 接口说明数据 ----
const BASE_URL = "https://api.yunzer.cn";
const paramDocs = [
@@ -821,7 +820,6 @@ async function handleProbeToken(row) {
@confirm="handleReplenish"
/>
<!-- 接口说明抽屉 -->
<el-drawer
v-model="apiDocVisible"
title="提卡接口说明"
@@ -9,14 +9,14 @@ const props = defineProps({
},
mode: {
type: String,
default: 'single', // single | batch
default: 'single',
},
});
const emit = defineEmits(['update:modelValue', 'submit']);
const form = reactive({
type: 'account', // account | tk | account_tk
type: 'account',
account: '',
password: '',
token: '',
@@ -432,7 +432,6 @@ async function jumpToLastUnusedPage() {
onMounted(() => { fetchList(); });
// ---- 接口说明数据 ----
const BASE_URL = "https://api.yunzer.cn";
const paramDocs = [
@@ -712,7 +711,6 @@ async function handleProbeToken(row) {
@confirm="handleReplenish"
/>
<!-- 接口说明抽屉 -->
<el-drawer
v-model="apiDocVisible"
title="提卡接口说明"
@@ -302,7 +302,6 @@ onUnmounted(() => {
}
}
// 暗色主题:卡片数字用纯白
html.dark & {
.data-overview .data-card .card-content .text-box .value {
color: #fff;
@@ -132,35 +132,29 @@ const formData = reactive<{
const formRules: FormRules = {};
// 过滤男性用户
const maleUsers = computed(() => {
return users.value.filter(user => user.sex === 1);
});
// 过滤女性用户
const femaleUsers = computed(() => {
return users.value.filter(user => user.sex === 2);
});
// 拼接接口路径
const getEnvUrl = (path: string) => {
const API_BASE_URL = import.meta.env.VITE_API_BASE_URL;
return `${API_BASE_URL}${path}`;
};
// 重置表单
const resetForm = () => {
formData.father_id = null;
formData.mother_id = null;
};
// 关闭对话框
const handleClose = () => {
dialogVisible.value = false;
resetForm();
};
// 监听 visible 变化
watch(() => props.visible, (val) => {
dialogVisible.value = val;
if (val) {
@@ -168,36 +162,30 @@ watch(() => props.visible, (val) => {
}
});
// 监听对话框关闭,重置搜索结果
watch(dialogVisible, (val) => {
if (!val) {
users.value = parents.value;
}
});
// 监听 dialogVisible 变化
watch(dialogVisible, (val) => {
emit('update:visible', val);
});
// 获取用户列表和已有父母数据
const fetchUsers = async () => {
try {
// 获取所有用户列表
const res = await getUserList();
if (res.code === 200) {
allUsers.value = res.data || [];
users.value = res.data || [];
}
// 获取当前宝贝已绑定的父母数据
if (props.babyData?.id) {
const parentsRes = await getParents(props.babyData.id);
if (parentsRes.code === 200 && parentsRes.data) {
formData.father_id = parentsRes.data.father_id || null;
formData.mother_id = parentsRes.data.mother_id || null;
// 如果已绑定父亲但不在用户列表中,添加进去以便显示名称
if (parentsRes.data.father_id && parentsRes.data.father) {
const fatherExists = allUsers.value.some(u => u.id === parentsRes.data.father_id);
if (!fatherExists) {
@@ -211,7 +199,6 @@ const fetchUsers = async () => {
}
}
// 如果已绑定母亲但不在用户列表中,添加进去以便显示名称
if (parentsRes.data.mother_id && parentsRes.data.mother) {
const motherExists = allUsers.value.some(u => u.id === parentsRes.data.mother_id);
if (!motherExists) {
@@ -225,7 +212,6 @@ const fetchUsers = async () => {
}
}
// 更新用户列表
users.value = allUsers.value;
}
}
@@ -235,15 +221,12 @@ const fetchUsers = async () => {
}
};
// 搜索用户
const handleSearchUser = async (query: string, sex: number) => {
searchLoading.value = true;
try {
if (!query) {
// 如果查询为空,显示所有对应性别的用户
users.value = allUsers.value.filter(user => user.sex === sex);
} else {
// 通过账号或手机号搜索
const filteredUsers = allUsers.value.filter(user => {
const isTargetSex = user.sex === sex;
const matchAccount = user.account?.toLowerCase().includes(query.toLowerCase());
@@ -261,7 +244,6 @@ const handleSearchUser = async (query: string, sex: number) => {
}
};
// 提交表单
const handleSubmit = async () => {
if (!formRef.value) return;
if (!props.babyData?.id) {
@@ -3,7 +3,6 @@
@close="handleClose">
<div class="dialog-content">
<!-- 表单区域 -->
<el-form ref="editFormRef" :model="formData" :rules="formRules" label-width="100px">
<el-form-item label="头像" prop="avatar">
<div class="preview-image">
@@ -16,7 +15,6 @@
</div>
</div>
<!-- 裁剪区域 -->
<div class="cutter-container">
<img-cutter ref="imgCutterRef" :img="formData.avatar ? getEnvUrl(formData.avatar) : ''" :cutWidth="400"
:cutHeight="400" :rate="'1:1'" :fixedNumber="[1, 1]" :fixed="true" :fixedBox="true" :original="false"
@@ -89,26 +87,21 @@
</el-dialog>
<!-- <ImgCutter :cutWidth="300" :cutHeight="300" :tool="true" V-on:cutDown="handleCut" /> -->
</template>
<script setup lang="ts">
import { ref, reactive, watch, nextTick } from 'vue';
import { ElMessage, type FormInstance, type FormRules } from 'element-plus';
import { Plus, Picture } from '@element-plus/icons-vue';
// import { createBaby, editBaby } from '@/api/babyhealth';
// import { uploadAvatar } from '@/api/file';
import ImgCutter from 'vue-img-cutter';
// 定义 ImgCutter 实例类型
interface ImgCutterInstance {
chooseImg: () => void;
resetCrop: () => void;
crop: () => void;
}
// 定义裁剪数据结构类型
interface CroppedData {
blob: Blob;
dataURL: string;
@@ -129,10 +122,8 @@ interface BabyFormData {
status: number;
}
const imgCutterRef = ref<ImgCutterInstance | null>(null);
// 处理裁剪按钮点击
const handleCropClick = () => {
if (imgCutterRef.value) {
(imgCutterRef.value as any).crop();
@@ -155,21 +146,16 @@ const editFormRef = ref<FormInstance>();
const cropDialogVisible = ref(false);
const croppingImage = ref('');
let selectedFile: File | null = null;
// 图片大小限制 (5MB)
const MAX_IMAGE_SIZE = 5 * 1024 * 1024;
// 支持的图片类型
const SUPPORTED_IMAGE_TYPES = ['image/jpeg', 'image/png', 'image/gif'];
// 处理裁剪完成
const handleCut = async (data: CroppedData) => {
try {
// 创建FormData
const uploadFormData = new FormData();
uploadFormData.append('file', data.file);
uploadFormData.append('cate', 'baby_avatar');
// 上传裁剪后的图片
const response = await uploadAvatar(uploadFormData);
if (response.code === 200 || response.code === 201) {
@@ -188,13 +174,11 @@ const handleCut = async (data: CroppedData) => {
console.error('上传失败:', error);
ElMessage.error("上传失败,请重试");
} finally {
// 清理
croppingImage.value = '';
selectedFile = null;
}
};
const formData = reactive<BabyFormData>({
id: 0,
name: '',
@@ -215,13 +199,11 @@ const formRules: FormRules = {
birth: [{ required: true, message: '请选择出生日期', trigger: 'change' }]
};
// 拼接接口路径
const getEnvUrl = (path: string) => {
const API_BASE_URL = import.meta.env.VITE_API_BASE_URL;
return `${API_BASE_URL}${path}`;
};
// 重置表单
const resetForm = () => {
Object.assign(formData, {
id: 0,
@@ -236,23 +218,19 @@ const resetForm = () => {
});
};
// 关闭对话框
const handleClose = () => {
dialogVisible.value = false;
resetForm();
};
// 监听 visible 变化
watch(() => props.visible, (val) => {
dialogVisible.value = val;
});
// 监听 dialogVisible 变化
watch(dialogVisible, (val) => {
emit('update:visible', val);
});
// 监听 editData 变化
watch(() => props.editData, (data) => {
if (data) {
isEdit.value = true;
@@ -263,8 +241,6 @@ watch(() => props.editData, (data) => {
}
}, { immediate: true });
// 提交表单
const handleSubmit = async () => {
if (!editFormRef.value) return;
@@ -274,7 +250,6 @@ const handleSubmit = async () => {
try {
let res;
if (formData.id) {
// 编辑
const submitData: Record<string, any> = {};
Object.keys(formData).forEach(key => {
if (key !== 'id' && formData[key as keyof BabyFormData] !== undefined && formData[key as keyof BabyFormData] !== null) {
@@ -283,7 +258,6 @@ const handleSubmit = async () => {
});
res = await editBaby(formData.id, submitData);
} else {
// 新增
const submitData = new FormData();
Object.keys(formData).forEach(key => {
if (key !== 'id' && formData[key as keyof BabyFormData] !== undefined && formData[key as keyof BabyFormData] !== null) {
@@ -81,14 +81,12 @@
<el-empty description="暂无宝贝数据" :image-size="120" />
</div>
<!-- 编辑对话框 -->
<BabyEdit
v-model:visible="editDialogVisible"
:editData="currentBaby"
@success="handleEditSuccess"
/>
<!-- 绑定父母对话框 -->
<BindParents
v-model:visible="bindParentsVisible"
:babyData="currentBaby"
@@ -123,19 +121,16 @@ const editDialogVisible = ref(false);
const bindParentsVisible = ref(false);
const currentBaby = ref<Baby | null>(null);
// 拼接接口路径
const getEnvUrl = (path: string) => {
const API_BASE_URL = import.meta.env.VITE_API_BASE_URL;
return `${API_BASE_URL}${path}`;
};
// 格式化日期
const formatDate = (date: string) => {
if (!date) return '-';
return date.substring(0, 10);
};
// 格式化性别
const formatGender = (gender: number) => {
const map: Record<number, string> = {
1: '男',
@@ -144,29 +139,24 @@ const formatGender = (gender: number) => {
return map[gender] || '未知';
};
// 刷新列表
const handleRefresh = () => {
fetchBabyList();
};
// 添加宝贝
const handleAdd = () => {
currentBaby.value = null;
editDialogVisible.value = true;
};
// 查看详情
const handleView = (row: Baby) => {
ElMessage.info('详情功能待实现');
};
// 编辑宝贝
const handleEdit = (row: Baby) => {
currentBaby.value = row;
editDialogVisible.value = true;
};
// 删除宝贝
const handleDelete = (row: Baby) => {
ElMessageBox.confirm(`确定要删除宝贝「${row.name}」吗?删除后不可恢复。`, '警告', {
type: 'warning'
@@ -191,28 +181,23 @@ const handleDelete = (row: Baby) => {
.catch(() => {});
};
// 绑定父母
const handleBindParents = (row: Baby) => {
currentBaby.value = row;
bindParentsVisible.value = true;
};
// 编辑/添加成功回调
const handleEditSuccess = () => {
fetchBabyList();
};
// 绑定父母成功回调
const handleBindParentsSuccess = () => {
fetchBabyList();
};
// 获取宝贝列表
const fetchBabyList = async () => {
loading.value = true;
try {
const res = await getBabyList();
// console.log('获取宝贝列表响应:', res);
if (res.code === 200) {
babyList.value = res.data || [];
} else {
@@ -321,7 +306,6 @@ onMounted(() => {
.baby-name {
font-size: 20px;
font-weight: 600;
// color: var(--el-text-color-primary);
line-height: 1.4;
}
.baby-nickname {
@@ -1,6 +1,5 @@
<template>
<div class="statistics-container">
<!-- 第一行:宝贝统计 -->
<el-row :gutter="20" class="data-overview">
<el-col :span="8" v-for="item in babyData" :key="item.title">
<el-card shadow="hover" class="data-card">
@@ -17,7 +16,6 @@
</el-col>
</el-row>
<!-- 第二行:用户统计 -->
<el-row :gutter="20" class="data-overview" style="margin-top: 20px;">
<el-col :span="8" v-for="item in userData" :key="item.title">
<el-card shadow="hover" class="data-card">
@@ -34,16 +32,13 @@
</el-col>
</el-row>
<!-- 图表区域 -->
<el-row :gutter="20" class="charts-row" style="margin-top: 20px;">
<!-- 宝贝增长趋势柱状图 -->
<el-col :span="12">
<el-card shadow="hover" header="宝贝增长趋势">
<div ref="babyChartRef" class="chart-box"></div>
</el-card>
</el-col>
<!-- 用户增长趋势柱状图 -->
<el-col :span="12">
<el-card shadow="hover" header="用户增长趋势">
<div ref="userChartRef" class="chart-box"></div>
@@ -59,7 +54,6 @@ import { ref, onMounted, onUnmounted, shallowRef, nextTick } from 'vue';
import * as echarts from 'echarts';
import { getDashborad } from '@/api/babyhealth';
// --- 类型定义 ---
interface SummaryItem {
title: string;
value: number;
@@ -69,7 +63,6 @@ interface SummaryItem {
isUp: boolean;
}
// --- 响应式数据 ---
const babyChartRef = ref<HTMLElement | null>(null);
const userChartRef = ref<HTMLElement | null>(null);
const babyChartInstance = shallowRef<echarts.ECharts | null>(null);
@@ -87,20 +80,17 @@ const userData = ref<SummaryItem[]>([
{ title: '母亲数', value: 0, icon: 'fa-solid fa-person-dress', color: '#F56C6C', percentage: 0, isUp: false }
]);
// 调用总输出接口
async function fetchGetDashborad() {
try {
const res = await getDashborad();
if (res.code === 200 && res.data) {
const { userCounts, babyCounts } = res.data;
// 更新宝贝数据
if (babyCounts) {
babyData.value[0].value = babyCounts.total || 0; // 总宝贝数
babyData.value[1].value = babyCounts.male || 0; // 男宝宝数
babyData.value[2].value = babyCounts.female || 0; // 女宝宝数
babyData.value[0].value = babyCounts.total || 0;
babyData.value[1].value = babyCounts.male || 0;
babyData.value[2].value = babyCounts.female || 0;
// 更新宝贝图表
updateBabyChart(
babyCounts.total || 0,
babyCounts.male || 0,
@@ -108,13 +98,11 @@ async function fetchGetDashborad() {
);
}
// 更新用户数据
if (userCounts) {
userData.value[0].value = userCounts.total || 0; // 总用户数
userData.value[1].value = userCounts.father || 0; // 父亲数
userData.value[2].value = userCounts.mother || 0; // 母亲数
userData.value[0].value = userCounts.total || 0;
userData.value[1].value = userCounts.father || 0;
userData.value[2].value = userCounts.mother || 0;
// 更新用户图表
updateUserChart(
userCounts.total || 0,
userCounts.father || 0,
@@ -127,9 +115,6 @@ async function fetchGetDashborad() {
}
}
// 初始化宝贝柱状图
const initBabyChart = () => {
if (babyChartRef.value) {
babyChartInstance.value = echarts.init(babyChartRef.value);
@@ -158,7 +143,6 @@ const initBabyChart = () => {
}
};
// 初始化用户柱状图
const initUserChart = () => {
if (userChartRef.value) {
userChartInstance.value = echarts.init(userChartRef.value);
@@ -187,7 +171,6 @@ const initUserChart = () => {
}
};
// 更新宝贝柱状图数据
const updateBabyChart = (total: number, male: number, female: number) => {
if (babyChartInstance.value) {
babyChartInstance.value.setOption({
@@ -202,7 +185,6 @@ const updateBabyChart = (total: number, male: number, female: number) => {
}
};
// 更新用户柱状图数据
const updateUserChart = (total: number, father: number, mother: number) => {
if (userChartInstance.value) {
userChartInstance.value.setOption({
@@ -217,7 +199,6 @@ const updateUserChart = (total: number, father: number, mother: number) => {
}
};
// 生命周期与自适应
const handleResize = () => {
babyChartInstance.value?.resize();
userChartInstance.value?.resize();
@@ -226,7 +207,6 @@ const handleResize = () => {
onMounted(async () => {
initBabyChart();
initUserChart();
// 等待图表初始化完成后再加载数据
await nextTick();
await fetchGetDashborad();
window.addEventListener('resize', handleResize);
Loaded 100 of 1304 files, more files were not shown because too many files have changed in this diff. Show more