From 40af4ebe6578a78daf8fb75c8cefa1ce374b04bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Fri, 25 Jul 2025 13:48:20 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=96=B0=E6=95=B4=E7=90=86=E4=BB=93?= =?UTF-8?q?=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 24 ++++- .env.example | 22 +++++ .gitignore | 9 +- README.md | 57 ++++++++++-- package-lock.json | 4 +- src/api/layout/index.ts | 87 +------------------ src/config/menu.ts | 2 - src/config/setting.ts | 22 +++-- src/i18n/use-locale.ts | 4 +- .../system/admin/components/user-import.vue | 2 +- .../system/user/components/user-import.vue | 2 +- 11 files changed, 121 insertions(+), 114 deletions(-) create mode 100644 .env.example diff --git a/.env b/.env index fe99737..9d32662 100644 --- a/.env +++ b/.env @@ -1,2 +1,22 @@ -VITE_APP_NAME=WSADMIN -VITE_API_URL=/api +# 应用名称 +VITE_APP_NAME=WebSoftAdmin + +# API 配置 +VITE_API_URL=https://cms-api.websoft.top/api +VITE_SERVER_API_URL=https://server.gxwebsoft.com/api + +VITE_FILE_SERVER=https://oss.wsnds.cn + +# 租户配置 +VITE_TENANT_ID=your_tenant_id +VITE_TEMPLATE_ID=10258 + +# 应用密钥 +VITE_APP_SECRET=ffd6eee985af45e4a75098422d1decbb + +# 高德地图配置 (请到高德地图官网申请) +VITE_MAP_KEY=8191620da39a742c6f18f010c084c772 +VITE_MAP_CODE=7225174a116c1c44e1bd7a177d1787d5 + +# WebSoftAdmin 授权码 (请联系官方获取) +VITE_LICENSE_CODE=dk9mcwJyetRWQlxWRiojIzJCLi8mcQ5Wa4ojI0NWZqJWd6ICZpJCL0kjNwl1NnhENahnIvl2cyVmdiwiIiATMuEjI6IibQf0NW== diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..19b436f --- /dev/null +++ b/.env.example @@ -0,0 +1,22 @@ +# 应用名称 +VITE_APP_NAME=WebSoftAdmin + +# API 配置 +VITE_API_URL=https://your-api.com/api +VITE_SERVER_API_URL=https://your-server.com/api +VITE_DOMAIN=https://your-domain.com +VITE_FILE_SERVER=https://your-file-server.com + +# 租户配置 +VITE_TENANT_ID=your_tenant_id +VITE_TEMPLATE_ID=10258 + +# 应用密钥 +VITE_APP_SECRET=your_app_secret + +# 高德地图配置 (请到高德地图官网申请) +VITE_MAP_KEY=your_map_key +VITE_MAP_CODE=your_map_security_code + +# WebSoftAdmin 授权码 (请联系官方获取) +VITE_LICENSE_CODE=your_license_code diff --git a/.gitignore b/.gitignore index f3fed43..12a146e 100644 --- a/.gitignore +++ b/.gitignore @@ -5,9 +5,11 @@ dist /dist /dist-ssr -# local env files +# 环境变量文件 +.env .env.local .env.*.local +.env.production # Log files npm-debug.log* @@ -25,5 +27,6 @@ pnpm-debug.log* *.njsproj *.sln *.sw? -node_modules -node_modules + +# 配置文件备份 +config/setting.backup.ts diff --git a/README.md b/README.md index 95415b0..008896d 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@
-

🌐 WebSoft Admin

+

🌐 WebSoftAdmin

基于 Vue 3 + Ant Design Vue 的企业级后台管理系统

@@ -13,7 +13,7 @@ ## 📖 项目简介 -WebSoft Admin 是一个基于 **Vue 3 + Ant Design Vue** 构建的现代化企业级后台管理系统,采用最新的前端技术栈: +WebSoftAdmin 是一个基于 **Vue 3 + Ant Design Vue** 构建的现代化企业级后台管理系统,采用最新的前端技术栈: - **前端框架**:Vue 3 + TypeScript + Vite - **UI 组件库**:Ant Design Vue 3.x @@ -52,7 +52,13 @@ WebSoft Admin 是一个基于 **Vue 3 + Ant Design Vue** 构建的现代化企 ## 🚀 快速开始 -### 安装依赖 +### 1. 克隆项目 +```bash +git clone https://github.com/your-username/ele-admin-pro.git +cd ele-admin-pro +``` + +### 2. 安装依赖 ```bash # 使用 npm npm install @@ -61,7 +67,16 @@ npm install yarn install ``` -### 启动开发服务器 +### 3. 配置环境变量 +```bash +# 复制环境变量示例文件 +cp .env.example .env + +# 编辑 .env 文件,填入您的配置信息 +# 注意:请不要将 .env 文件提交到版本控制系统 +``` + +### 4. 启动开发服务器 ```bash # 开发模式 npm run dev @@ -72,7 +87,7 @@ yarn dev 访问 `http://localhost:3000` 即可看到管理后台。 -### 构建生产版本 +### 5. 构建生产版本 ```bash # 生产构建 npm run build @@ -81,6 +96,38 @@ npm run build npm run serve ``` +## ⚙️ 环境变量配置 + +项目使用环境变量来管理敏感信息和配置。请按照以下步骤配置: + +### 必需配置 +```bash +# API 配置 +VITE_API_URL=https://your-api.com/api # 后端 API 地址 +VITE_THINK_URL=https://your-think-api.com # Think API 地址 +VITE_SERVER_API_URL=https://your-server.com/api # 服务器 API 地址 +VITE_FILE_SERVER=https://your-file-server.com # 文件服务器地址 + +# 应用配置 +VITE_APP_SECRET=your_app_secret # 应用密钥 +VITE_TENANT_ID=your_tenant_id # 租户 ID +``` + +### 可选配置 +```bash +# 高德地图 (如需使用地图功能) +VITE_MAP_KEY=your_map_key # 高德地图 Key +VITE_MAP_CODE=your_map_security_code # 高德地图安全密钥 + +# WebSoftAdmin 授权 (商业版功能) +VITE_LICENSE_CODE=your_license_code # 授权码 +``` + +### 获取配置信息 +- **高德地图密钥**:访问 [高德开放平台](https://lbs.amap.com/) 申请 +- **WebSoftAdmin 授权码**:联系 [官方网站](https://websoft.top/) 获取 +- **其他 API 配置**:根据您的后端服务配置 + ## 🎯 核心功能 ### 📝 内容管理系统 diff --git a/package-lock.json b/package-lock.json index 38dc13b..1aa2213 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "ele-admin-pro-template", + "name": "mp-vue-template", "version": "1.10.1", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "ele-admin-pro-template", + "name": "mp-vue-template", "version": "1.10.1", "dependencies": { "@amap/amap-jsapi-loader": "^1.0.1", diff --git a/src/api/layout/index.ts b/src/api/layout/index.ts index cb5f1a6..b329699 100644 --- a/src/api/layout/index.ts +++ b/src/api/layout/index.ts @@ -149,89 +149,8 @@ export async function initialization(roleId?: number) { */ export async function getUnreadNotice(): Promise { return { - notice: [ - { - color: '#60B2FC', - icon: 'NotificationFilled', - title: '你收到了一封14份新周报', - time: '2020-07-27 18:30:18' - }, - { - color: '#F5686F', - icon: 'PushpinFilled', - title: '许经理同意了你的请假申请', - time: '2020-07-27 09:08:36' - }, - { - color: '#7CD734', - icon: 'VideoCameraFilled', - title: '陈总邀请你参加视频会议', - time: '2020-07-26 18:30:01' - }, - { - color: '#FAAD14', - icon: 'CarryOutFilled', - title: '你推荐的刘诗雨已通过第三轮面试', - time: '2020-07-25 16:38:46' - }, - { - color: '#2BCACD', - icon: 'BellFilled', - title: '你的6月加班奖金已发放', - time: '2020-07-25 11:03:31' - } - ], - letter: [ - { - avatar: - 'https://cdn.eleadmin.com/20200609/c184eef391ae48dba87e3057e70238fb.jpg', - title: 'SunSmile 评论了你的日志', - content: '写的不错, 以后多多向你学习~', - time: '2020-07-27 18:30:18' - }, - { - avatar: - 'https://cdn.eleadmin.com/20200609/948344a2a77c47a7a7b332fe12ff749a.jpg', - title: '刘诗雨 点赞了你的日志', - content: '写的不错, 以后多多向你学习~', - time: '2020-07-27 09:08:36' - }, - { - avatar: - 'https://cdn.eleadmin.com/20200609/2d98970a51b34b6b859339c96b240dcd.jpg', - title: '酷酷的大叔 评论了你的周报', - content: '写的不错, 以后多多向你学习~', - time: '2020-07-26 18:30:01' - }, - { - avatar: - 'https://cdn.eleadmin.com/20200609/f6bc05af944a4f738b54128717952107.jpg', - title: 'Jasmine 点赞了你的周报', - content: '写的不错, 以后多多向你学习~', - time: '2020-07-25 11:03:31' - } - ], - todo: [ - { - status: 0, - title: '刘诗雨的请假审批', - description: '刘诗雨在 07-27 18:30 提交的请假申请' - }, - { - status: 1, - title: '第三方代码紧急变更', - description: '需要在 2020-07-27 之前完成' - }, - { - status: 2, - title: '信息安全考试', - description: '需要在 2020-07-26 18:30 前完成' - }, - { - status: 2, - title: 'EleAdmin发布新版本', - description: '需要在 2020-07-25 11:03 前完成' - } - ] + notice: [], + letter: [], + todo: [] }; } diff --git a/src/config/menu.ts b/src/config/menu.ts index 2c4497f..7053780 100644 --- a/src/config/menu.ts +++ b/src/config/menu.ts @@ -1,5 +1,3 @@ -// 请参考开发文档配置菜单 https://eleadmin.com/doc/eleadminpro/#/config?id=menu - export default [ { path: '/assets/server', diff --git a/src/config/setting.ts b/src/config/setting.ts index 299cf5b..b47aee7 100644 --- a/src/config/setting.ts +++ b/src/config/setting.ts @@ -1,18 +1,17 @@ // 租户ID -export const TENANT_ID = import.meta.env.VITE_TENANT_ID; +export const TENANT_ID = import.meta.env.VITE_TENANT_ID || 10258; // 模板ID -export const TEMPLATE_ID = 10258; +export const TEMPLATE_ID = import.meta.env.VITE_TEMPLATE_ID || 10258; // appSecret -export const APP_SECRET = 'ffd6eee985af45e4a75098422d1decbb'; +export const APP_SECRET = import.meta.env.VITE_APP_SECRET || ''; // 开发商官方网站 -export const domain = 'https://websoft.top'; +export const domain = import.meta.env.VITE_DOMAIN || 'https://your-domain.com'; // 主节点 -export const SERVER_API_URL = 'https://server.gxwebsoft.com/api'; +export const SERVER_API_URL = import.meta.env.VITE_SERVER_API_URL || 'https://your-api.com/api'; // 模块节点 export const MODULES_API_URL = import.meta.env.VITE_API_URL; -export const THINK_API_URL = import.meta.env.VITE_THINK_URL; // 文件服务器地址 -export const FILE_SERVER = 'https://file.wsdns.cn'; +export const FILE_SERVER = import.meta.env.VITE_FILE_SERVER || 'https://your-file-server.com'; /** * 以下配置一般不需要修改 @@ -67,12 +66,11 @@ export const I18N_CACHE_NAME = 'i18n-lang'; // 是否开启国际化功能 export const I18N_ENABLE = true; // 高德地图 key , 自带的只能用于测试, 正式项目请自行到高德地图官网申请 key -export const MAP_KEY = '8191620da39a742c6f18f010c084c772'; +export const MAP_KEY = import.meta.env.VITE_MAP_KEY || ''; // 高德地图 安全密钥 -export const MAP_CODE = '7225174a116c1c44e1bd7a177d1787d5'; -// EleAdminPro 授权码, 自带的只能用于演示, 正式项目请更换为自己的授权码 -export const LICENSE_CODE = - 'dk9mcwJyetRWQlxWRiojIzJCLi8mcQ5Wa4ojI0NWZqJWd6ICZpJCL0kjNwl1NnhENahnIvl2cyVmdiwiIiATMuEjI6IibQf0NW=='; +export const MAP_CODE = import.meta.env.VITE_MAP_CODE || ''; +// WebSoftAdmin 授权码, 自带的只能用于演示, 正式项目请更换为自己的授权码 +export const LICENSE_CODE = import.meta.env.VITE_LICENSE_CODE || ''; // 缩略图前缀 export const FILE_THUMBNAIL = FILE_SERVER + '/thumbnail'; // 文件下载前缀 diff --git a/src/i18n/use-locale.ts b/src/i18n/use-locale.ts index 1d05c68..010ee5c 100644 --- a/src/i18n/use-locale.ts +++ b/src/i18n/use-locale.ts @@ -1,5 +1,5 @@ /** - * AntDesignVue、EleAdminPro、Dayjs 国际化配置 + * AntDesignVue、WebSoftAdmin、Dayjs 国际化配置 */ import { ref, watch } from 'vue'; import { useI18n } from 'vue-i18n'; @@ -8,7 +8,7 @@ import type { EleLocale } from 'ele-admin-pro/es'; // AntDesignVue import zh_CN from 'ant-design-vue/es/locale/zh_CN'; import en from 'ant-design-vue/es/locale/en_US'; -// EleAdminPro +// WebSoftAdmin import eleZh_CN from 'ele-admin-pro/es/lang/zh_CN'; import eleEn from 'ele-admin-pro/es/lang/en_US'; // Dayjs diff --git a/src/views/system/admin/components/user-import.vue b/src/views/system/admin/components/user-import.vue index 0d8cbcb..f5b1088 100644 --- a/src/views/system/admin/components/user-import.vue +++ b/src/views/system/admin/components/user-import.vue @@ -23,7 +23,7 @@

只能上传xls、xlsx文件, 下载模板 diff --git a/src/views/system/user/components/user-import.vue b/src/views/system/user/components/user-import.vue index 0d8cbcb..f5b1088 100644 --- a/src/views/system/user/components/user-import.vue +++ b/src/views/system/user/components/user-import.vue @@ -23,7 +23,7 @@