From b85288f0fcf5bd9679d79ff2529251d5ab312c39 Mon Sep 17 00:00:00 2001 From: zhongzm Date: Mon, 25 Nov 2024 10:47:53 +0800 Subject: [PATCH 01/19] test --- vite.config.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/vite.config.ts b/vite.config.ts index 1393de1..92ec3fc 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -4,6 +4,7 @@ import { defineConfig, loadEnv } from 'vite'; import dayjs from 'dayjs'; import { setupVitePlugins } from './build/plugins'; import { createViteProxy } from './build/config'; +//test export default defineConfig(configEnv => { const viteEnv = loadEnv(configEnv.mode, process.cwd()) as unknown as Env.ImportMeta; From 0331c5fa9db29565d9a0b15ee90720f6b087effd Mon Sep 17 00:00:00 2001 From: caiyuchao Date: Mon, 25 Nov 2024 19:24:01 +0800 Subject: [PATCH 02/19] =?UTF-8?q?feat=EF=BC=9Aadd=20i18n=20header?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit a1dbcd1f003c6e4ce8f431277affb952dab84195) --- src/service/request/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/service/request/index.ts b/src/service/request/index.ts index 348b03c..1ed35ff 100644 --- a/src/service/request/index.ts +++ b/src/service/request/index.ts @@ -27,7 +27,10 @@ export const request = createFlatRequest( // set token const token = localStg.get('token'); const Authorization = token ? `Bearer ${token}` : null; - Object.assign(headers, { Authorization }); + + // set language + const ContentLanguage = localStg.get('lang') || 'zh-CN'; + Object.assign(headers, { Authorization, "Content-Language": ContentLanguage }); return config; }, From 7d5ed9cdf565c282b58af6f50384d6a5194864df Mon Sep 17 00:00:00 2001 From: caiyuchao Date: Tue, 26 Nov 2024 10:07:56 +0800 Subject: [PATCH 03/19] fix: fix login page (cherry picked from commit 074f9282dd410e25c8e3785b931fa10106e9ee8b) --- README.md | 2 ++ src/views/_builtin/login/modules/pwd-login.vue | 14 +++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d298789..a7d1c1e 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,8 @@ **安装依赖** +npm install -g pnpm + ```bash pnpm i ``` diff --git a/src/views/_builtin/login/modules/pwd-login.vue b/src/views/_builtin/login/modules/pwd-login.vue index fe74363..8ccd74d 100644 --- a/src/views/_builtin/login/modules/pwd-login.vue +++ b/src/views/_builtin/login/modules/pwd-login.vue @@ -1,5 +1,7 @@ - + From feefcfa7e60b7558fc9bf7994593dedac57d876a Mon Sep 17 00:00:00 2001 From: zhongzm Date: Wed, 27 Nov 2024 11:40:17 +0800 Subject: [PATCH 06/19] =?UTF-8?q?style=EF=BC=9A=E5=8D=8F=E8=AE=AE=E6=96=87?= =?UTF-8?q?=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/_builtin/login/modules/terms.ts | 50 +++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 src/views/_builtin/login/modules/terms.ts diff --git a/src/views/_builtin/login/modules/terms.ts b/src/views/_builtin/login/modules/terms.ts new file mode 100644 index 0000000..f03c289 --- /dev/null +++ b/src/views/_builtin/login/modules/terms.ts @@ -0,0 +1,50 @@ +export const registerTerms = { + 'zh-CN': ` +用户协议和隐私政策 + +1. 总则 +本协议是您与我们之间关于使用我们的服务所订立的协议。您注册成为用户,表示您已充分阅读、理解并同意接受本协议的全部内容。 + +2. 服务内容 +2.1 我们将为您提供安全、可靠的服务。 +2.2 我们保留随时修改或中断服务的权利。 + +3. 用户义务 +3.1 用户应当遵守相关法律法规。 +3.2 用户应当遵守社区规范和道德准则。 +3.3 用户应当保护账号安全,不得将账号借给他人使用。 + +4. 隐私保护 +4.1 我们将依法保护您的个人信息安全。 +4.2 未经您的同意,我们不会向第三方披露您的个人信息。 +4.3 我们采用业界标准的安全技术来保护您的个人信息。 + +5. 免责声明 +5.1 因不可抗力导致的服务中断,本平台不承担责任。 +5.2 用户因违反本协议造成的损失由用户自行承担。 +`, + 'en-US': ` +User Agreement and Privacy Policy + +1. General Provisions +This agreement is established between you and us regarding the use of our services. By registering as a user, you indicate that you have fully read, understood and agreed to accept all contents of this agreement. + +2. Service Content +2.1 We will provide you with secure and reliable services. +2.2 We reserve the right to modify or interrupt services at any time. + +3. User Obligations +3.1 Users shall comply with relevant laws and regulations. +3.2 Users shall comply with community standards and ethical guidelines. +3.3 Users shall protect account security and not lend their accounts to others. + +4. Privacy Protection +4.1 We will protect your personal information security in accordance with law. +4.2 We will not disclose your personal information to third parties without your consent. +4.3 We use industry-standard security technology to protect your personal information. + +5. Disclaimer +5.1 The platform is not liable for service interruptions caused by force majeure. +5.2 Users shall bear losses caused by their violation of this agreement. +` +}; From 1240d9aedf4d7bdaeb982b0ee80e8c69f600bf8a Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Wed, 27 Nov 2024 16:46:16 +0800 Subject: [PATCH 07/19] =?UTF-8?q?fix:=20=E7=94=A8=E6=88=B7=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0=E6=8C=87=E5=AE=9A=E6=A8=A1=E5=9D=97=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/service/api/auth.ts | 2 +- src/service/api/dept.ts | 10 +++++----- src/service/api/dict.ts | 8 ++++---- src/service/api/menu.ts | 16 ++++++++-------- src/service/api/post.ts | 10 +++++----- src/service/api/role.ts | 8 ++++---- src/service/api/route.ts | 2 +- src/service/api/user.ts | 16 ++++++++-------- src/typings/api.d.ts | 1 + src/views/_builtin/login/modules/pwd-login.vue | 7 ++++--- 10 files changed, 41 insertions(+), 39 deletions(-) diff --git a/src/service/api/auth.ts b/src/service/api/auth.ts index 1272330..01cd180 100644 --- a/src/service/api/auth.ts +++ b/src/service/api/auth.ts @@ -24,7 +24,7 @@ export function doDeleteLogout() { /** Get user info */ export function doGetUserInfo() { - return request({ url: '/system/user/getInfo' }); + return request({ url: '/u/user/getInfo' }); } /** diff --git a/src/service/api/dept.ts b/src/service/api/dept.ts index e588c7c..1a2ff39 100644 --- a/src/service/api/dept.ts +++ b/src/service/api/dept.ts @@ -8,7 +8,7 @@ export type DeptFormType = Pick< /** 获取部门列表 */ export function doGetDeptList(params: Api.SystemManage.DeptSearchParams) { return request({ - url: '/system/dept/list', + url: '/u/dept/list', params }); } @@ -20,7 +20,7 @@ export function doGetDeptList(params: Api.SystemManage.DeptSearchParams) { */ export function doGetDeptInfo(deptId: number) { return request({ - url: `/system/dept/${deptId}` + url: `/u/dept/${deptId}` }); } @@ -31,7 +31,7 @@ export function doGetDeptInfo(deptId: number) { */ export function doAddDept(body: DeptFormType) { return request({ - url: '/system/dept', + url: '/u/dept', method: 'post', data: body }); @@ -44,7 +44,7 @@ export function doAddDept(body: DeptFormType) { */ export function doEditDept(body: DeptFormType & { deptId: number }) { return request({ - url: '/system/dept', + url: '/u/dept', method: 'put', data: body }); @@ -57,7 +57,7 @@ export function doEditDept(body: DeptFormType & { deptId: number }) { */ export function doDeleteDept(deptId: string | number) { return request({ - url: `/system/dept/${deptId}`, + url: `/u/dept/${deptId}`, method: 'delete' }); } diff --git a/src/service/api/dict.ts b/src/service/api/dict.ts index 57f48c8..4e044c2 100644 --- a/src/service/api/dict.ts +++ b/src/service/api/dict.ts @@ -6,7 +6,7 @@ export type DictSubmitModel = Partial< export const doGetDictList = (params: Api.SystemManage.DictSearchParams) => { return request({ - url: '/system/dict/type/list', + url: '/u/dict/type/list', method: 'get', params }); @@ -14,7 +14,7 @@ export const doGetDictList = (params: Api.SystemManage.DictSearchParams) => { export const doAddDict = (data: DictSubmitModel) => { return request({ - url: '/system/dict/type', + url: '/u/dict/type', method: 'post', data }); @@ -22,7 +22,7 @@ export const doAddDict = (data: DictSubmitModel) => { export const doEditDict = (data: DictSubmitModel) => { return request({ - url: '/system/dict/type', + url: '/u/dict/type', method: 'put', data }); @@ -30,7 +30,7 @@ export const doEditDict = (data: DictSubmitModel) => { export const doDeleteDict = (dictId: string | number) => { return request({ - url: `/system/dict/type/${dictId}`, + url: `/u/dict/type/${dictId}`, method: 'post' }); }; diff --git a/src/service/api/menu.ts b/src/service/api/menu.ts index 60657f9..6e5b121 100644 --- a/src/service/api/menu.ts +++ b/src/service/api/menu.ts @@ -7,13 +7,13 @@ export type MenuListQuery = Partial< Api.SystemManage.CommonSearchParams; export function doGetMenuList(params: MenuListQuery) { - return request({ url: '/system/menu/list', method: 'get', params }); + return request({ url: '/u/menu/list', method: 'get', params }); } /** get all pages */ export function fetchGetAllPages() { return request[]>({ - url: '/system/menu/list', + url: '/u/menu/list', method: 'get', params: { menuType: 'C' @@ -24,7 +24,7 @@ export function fetchGetAllPages() { /** get menu tree */ export function fetchGetMenuTree() { return request({ - url: '/system/menu/treeselect', + url: '/u/menu/treeselect', method: 'get' }); } @@ -35,27 +35,27 @@ export function doGetRoleMenuList(roleId: number) { checkedKeys: number[]; menus: Api.SystemManage.MenuTree[]; }>({ - url: `/system/menu/roleMenuTreeselect/${roleId}`, + url: `/u/menu/roleMenuTreeselect/${roleId}`, method: 'get' }); } /** add menu */ export function doAddMenu(data: MenuModelType) { - return request({ url: '/system/menu', method: 'post', data }); + return request({ url: '/u/menu', method: 'post', data }); } /** delete menu */ export function doDeleteMenu(menuId: number) { - return request({ url: `/system/menu/${menuId}`, method: 'delete' }); + return request({ url: `/u/menu/${menuId}`, method: 'delete' }); } /** get menu detail */ export function doGetMenuDetail(menuId: number) { - return request({ url: `/system/menu/${menuId}`, method: 'get' }); + return request({ url: `/u/menu/${menuId}`, method: 'get' }); } /** edit menu */ export function doEditMenu(data: MenuModelType) { - return request({ url: '/system/menu', method: 'put', data }); + return request({ url: '/u/menu', method: 'put', data }); } diff --git a/src/service/api/post.ts b/src/service/api/post.ts index 549adfb..2cd6e9b 100644 --- a/src/service/api/post.ts +++ b/src/service/api/post.ts @@ -6,7 +6,7 @@ export type PostSubmitModel = Partial< export function doGetPostList(params: Api.SystemManage.PostSearchParams) { return request({ - url: '/system/post/list', + url: '/u/post/list', method: 'get', params }); @@ -14,14 +14,14 @@ export function doGetPostList(params: Api.SystemManage.PostSearchParams) { export function doGetPostDetail(postId: number) { return request({ - url: `/system/post/${postId}`, + url: `/u/post/${postId}`, method: 'get' }); } export function doAddPost(data: PostSubmitModel) { return request({ - url: '/system/post', + url: '/u/post', method: 'post', data }); @@ -29,7 +29,7 @@ export function doAddPost(data: PostSubmitModel) { export function doEditPost(data: PostSubmitModel) { return request({ - url: '/system/post', + url: '/u/post', method: 'put', data }); @@ -37,7 +37,7 @@ export function doEditPost(data: PostSubmitModel) { export function doDeletePost(postId: string | number) { return request({ - url: `/system/post/${postId}`, + url: `/u/post/${postId}`, method: 'delete' }); } diff --git a/src/service/api/role.ts b/src/service/api/role.ts index 5bd252f..c066f3b 100644 --- a/src/service/api/role.ts +++ b/src/service/api/role.ts @@ -7,7 +7,7 @@ import { request } from '../request'; * @returns */ export function doPutRole(role: Api.SystemManage.Role) { - return request({ url: '/system/role', method: 'put', data: role }); + return request({ url: '/u/role', method: 'put', data: role }); } /** @@ -17,7 +17,7 @@ export function doPutRole(role: Api.SystemManage.Role) { * @returns */ export function doPostRole(role: Api.SystemManage.Role) { - return request({ url: '/system/role', method: 'post', data: role }); + return request({ url: '/u/role', method: 'post', data: role }); } /** @@ -27,12 +27,12 @@ export function doPostRole(role: Api.SystemManage.Role) { * @returns */ export function doDeleteRole(roleId: number | string) { - return request({ url: `/system/role/${roleId}`, method: 'delete' }); + return request({ url: `/u/role/${roleId}`, method: 'delete' }); } export function doGetRoleList(params?: Api.SystemManage.RoleSearchParams) { return request({ - url: '/system/role/list', + url: '/u/role/list', method: 'get', params }); diff --git a/src/service/api/route.ts b/src/service/api/route.ts index 378a755..059df8d 100644 --- a/src/service/api/route.ts +++ b/src/service/api/route.ts @@ -7,7 +7,7 @@ export function fetchGetConstantRoutes() { /** get user routes */ export function doGetUserRoutes() { - return request({ url: '/system/menu/getRouters' }); + return request({ url: '/u/menu/getRouters' }); } /** diff --git a/src/service/api/user.ts b/src/service/api/user.ts index 6ec6de6..964f969 100644 --- a/src/service/api/user.ts +++ b/src/service/api/user.ts @@ -2,20 +2,20 @@ import { request } from '../request'; // user api export function doPutUser(user: Api.Auth.User) { - return request({ url: '/system/user', method: 'put', data: user }); + return request({ url: '/u/user', method: 'put', data: user }); } export function doPostUser(user: Api.Auth.User) { - return request({ url: '/system/user', method: 'post', data: user }); + return request({ url: '/u/user', method: 'post', data: user }); } export function doDeleteUser(userId: number | string) { - return request({ url: `/system/user/${userId}`, method: 'delete' }); + return request({ url: `/u/user/${userId}`, method: 'delete' }); } export function doGetUserList(params?: Api.SystemManage.UserSearchParams) { return request({ - url: '/system/user/list', + url: '/u/user/list', method: 'get', params }); @@ -29,26 +29,26 @@ export function doGetUserList(params?: Api.SystemManage.UserSearchParams) { export function doGetUserPostsAndRoles(userId: number | string | undefined) { if (!userId) { return request({ - url: '/system/user/', + url: '/u/user/', method: 'get' }); } return request({ - url: `/system/user/${userId}`, + url: `/u/user/${userId}`, method: 'get' }); } export function doGetAdminUserPostsAndRoles() { return request({ - url: `/system/user`, + url: `/u/user`, method: 'get' }); } export function doGetUserDeptTree() { return request({ - url: '/system/user/deptTree', + url: '/u/user/deptTree', method: 'get' }); } diff --git a/src/typings/api.d.ts b/src/typings/api.d.ts index eccdbda..d4262dd 100644 --- a/src/typings/api.d.ts +++ b/src/typings/api.d.ts @@ -136,6 +136,7 @@ declare namespace Api { password: string; code: string; uuid: string; + authType: string; } } diff --git a/src/views/_builtin/login/modules/pwd-login.vue b/src/views/_builtin/login/modules/pwd-login.vue index 8ccd74d..e840b2d 100644 --- a/src/views/_builtin/login/modules/pwd-login.vue +++ b/src/views/_builtin/login/modules/pwd-login.vue @@ -18,10 +18,11 @@ const codeImg = ref(''); getCheckCode(); const model = reactive({ - username: 'ryadmin', - password: 'admin123', + username: '123456', + password: '123456', code: '', - uuid: '' + uuid: '', + authType: 'u' }); const rules = { From 19d48eac0e8711a6c2e1689b075631b9a329d94a Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Thu, 28 Nov 2024 10:36:01 +0800 Subject: [PATCH 08/19] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E7=94=9F?= =?UTF-8?q?=E4=BA=A7API=E6=A0=87=E8=AF=86=EF=BC=8C=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 9 +---- .env.prod | 2 +- LICENSE | 21 ---------- README.md | 8 ++-- src/locales/langs/en-us.ts | 2 +- src/locales/langs/zh-cn.ts | 2 +- src/router/routes/builtin.ts | 4 +- src/store/modules/route/index.ts | 2 +- src/theme/settings.ts | 39 +++---------------- src/typings/components.d.ts | 2 - src/typings/env.d.ts | 9 ----- .../_builtin/login/modules/pwd-login.vue | 3 ++ src/views/_builtin/login/modules/register.vue | 2 +- vite.config.ts | 5 +-- vitest.config.ts | 8 ++-- 15 files changed, 27 insertions(+), 91 deletions(-) delete mode 100644 LICENSE diff --git a/.env b/.env index 01db102..6a529a8 100644 --- a/.env +++ b/.env @@ -1,8 +1,6 @@ VITE_BASE_URL=/ -VITE_APP_TITLE=Vue-AntD-Web - -VITE_APP_DESC=Vue-AntD-Web +VITE_APP_TITLE="WANFi Platform" # the prefix of the icon name VITE_ICON_PREFIX=icon @@ -12,10 +10,7 @@ VITE_ICON_PREFIX=icon VITE_ICON_LOCAL_PREFIX=icon-local # auth route mode: static | dynamic -VITE_AUTH_ROUTE_MODE=dynamic - -# static auth route home -VITE_ROUTE_HOME=manage_user +VITE_AUTH_ROUTE_MODE=static # default menu icon VITE_MENU_ICON=mdi:menu diff --git a/.env.prod b/.env.prod index 92c0aa8..9a336a2 100644 --- a/.env.prod +++ b/.env.prod @@ -1,5 +1,5 @@ # backend service base url, prod environment -VITE_SERVICE_BASE_URL=/prod-api +VITE_SERVICE_BASE_URL=/u-api # other backend service base url, prod environment VITE_OTHER_SERVICE_BASE_URL= `{ diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 7232979..0000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2024 SoybeanJS - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/README.md b/README.md index a7d1c1e..8e04369 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,4 @@ -# Front-End at CRM - -## Wfc-Cloud-Vue-AntD-Web(SoybeanAdmin AntDesign) +# WANFI 用户平台 ## 使用 @@ -17,8 +15,10 @@ npm install -g pnpm ```bash +npm install -g pnpm pnpm i ``` + > 由于本项目采用了 pnpm monorepo 的管理方式,因此请不要使用 npm 或 yarn 来安装依赖。 **启动项目** @@ -31,4 +31,4 @@ pnpm dev ```bash pnpm build -``` \ No newline at end of file +``` diff --git a/src/locales/langs/en-us.ts b/src/locales/langs/en-us.ts index c2df1cf..52acd61 100644 --- a/src/locales/langs/en-us.ts +++ b/src/locales/langs/en-us.ts @@ -1,6 +1,6 @@ const local: any = { system: { - title: 'Vue-AntD-Web' + title: 'WANFi Platform' }, common: { action: 'Action', diff --git a/src/locales/langs/zh-cn.ts b/src/locales/langs/zh-cn.ts index a094607..7da9af8 100644 --- a/src/locales/langs/zh-cn.ts +++ b/src/locales/langs/zh-cn.ts @@ -1,6 +1,6 @@ const local:any = { system: { - title: 'Vue-AntD-Web' + title: 'WANFi 平台', }, common: { action: '操作', diff --git a/src/router/routes/builtin.ts b/src/router/routes/builtin.ts index 953df9f..055708b 100644 --- a/src/router/routes/builtin.ts +++ b/src/router/routes/builtin.ts @@ -1,11 +1,11 @@ import type { CustomRoute } from '@elegant-router/types'; import { layouts, views } from '../elegant/imports'; -import { getRoutePath, transformElegantRoutesToVueRoutes } from '../elegant/transform'; +import { transformElegantRoutesToVueRoutes } from '../elegant/transform'; export const ROOT_ROUTE: CustomRoute = { name: 'root', path: '/', - redirect: getRoutePath(import.meta.env.VITE_ROUTE_HOME) || 'manage_user', + redirect: '/home', meta: { title: 'root', constant: true diff --git a/src/store/modules/route/index.ts b/src/store/modules/route/index.ts index f73e1b9..46c4f8b 100644 --- a/src/store/modules/route/index.ts +++ b/src/store/modules/route/index.ts @@ -40,7 +40,7 @@ export const useRouteStore = defineStore(SetupStoreId.Route, () => { const authRouteMode = ref(import.meta.env.VITE_AUTH_ROUTE_MODE); /** Home route key */ - const routeHome = ref(import.meta.env.VITE_ROUTE_HOME); + const routeHome = ref('home'); /** * Set route home diff --git a/src/theme/settings.ts b/src/theme/settings.ts index 6fbf003..fe659f6 100644 --- a/src/theme/settings.ts +++ b/src/theme/settings.ts @@ -2,34 +2,12 @@ export const themeSettings: App.Theme.ThemeSetting = { themeScheme: 'light', themeColor: '#646cff', - otherColor: { - info: '#2080f0', - success: '#52c41a', - warning: '#faad14', - error: '#f5222d' - }, + otherColor: { info: '#2080f0', success: '#52c41a', warning: '#faad14', error: '#f5222d' }, isInfoFollowPrimary: true, - layout: { - mode: 'vertical', - scrollMode: 'content' - }, - page: { - animate: true, - animateMode: 'fade-slide' - }, - header: { - height: 56, - breadcrumb: { - visible: true, - showIcon: true - } - }, - tab: { - visible: true, - cache: true, - height: 44, - mode: 'chrome' - }, + layout: { mode: 'horizontal-mix', scrollMode: 'content' }, + page: { animate: true, animateMode: 'fade-slide' }, + header: { height: 56, breadcrumb: { visible: true, showIcon: true } }, + tab: { visible: false, cache: true, height: 44, mode: 'chrome' }, fixedHeaderAndTab: true, sider: { inverted: false, @@ -39,12 +17,7 @@ export const themeSettings: App.Theme.ThemeSetting = { mixCollapsedWidth: 64, mixChildMenuWidth: 200 }, - footer: { - visible: false, - fixed: false, - height: 48, - right: true - } + footer: { visible: true, fixed: false, height: 36, right: true } }; /** diff --git a/src/typings/components.d.ts b/src/typings/components.d.ts index 2695c39..a5dc4fc 100644 --- a/src/typings/components.d.ts +++ b/src/typings/components.d.ts @@ -32,7 +32,6 @@ declare module 'vue' { AMenuDivider: typeof import('ant-design-vue/es')['MenuDivider'] AMenuItem: typeof import('ant-design-vue/es')['MenuItem'] AModal: typeof import('ant-design-vue/es')['Modal'] - AntTree: typeof import('./../components/custom/ant-tree.vue')['default'] APopconfirm: typeof import('ant-design-vue/es')['Popconfirm'] APopover: typeof import('ant-design-vue/es')['Popover'] AppLoading: typeof import('./../components/common/app-loading.vue')['default'] @@ -66,7 +65,6 @@ declare module 'vue' { IconGridiconsFullscreen: typeof import('~icons/gridicons/fullscreen')['default'] IconGridiconsFullscreenExit: typeof import('~icons/gridicons/fullscreen-exit')['default'] IconIcRoundDelete: typeof import('~icons/ic/round-delete')['default'] - IconIcRoundMenu: typeof import('~icons/ic/round-menu')['default'] IconIcRoundPlus: typeof import('~icons/ic/round-plus')['default'] IconIcRoundRefresh: typeof import('~icons/ic/round-refresh')['default'] IconIcRoundSearch: typeof import('~icons/ic/round-search')['default'] diff --git a/src/typings/env.d.ts b/src/typings/env.d.ts index d151ffb..ace9243 100644 --- a/src/typings/env.d.ts +++ b/src/typings/env.d.ts @@ -13,8 +13,6 @@ declare namespace Env { readonly VITE_BASE_URL: string; /** The title of the application */ readonly VITE_APP_TITLE: string; - /** The description of the application */ - readonly VITE_APP_DESC: string; /** The router history mode */ readonly VITE_ROUTER_HISTORY_MODE?: RouterHistoryMode; /** The prefix of the iconify icon */ @@ -78,13 +76,6 @@ declare namespace Env { * - Dynamic: the auth routes is generated in back-end */ readonly VITE_AUTH_ROUTE_MODE: 'static' | 'dynamic'; - /** - * The home route key - * - * It only has effect when the auth route mode is static, if the route mode is dynamic, the home route key is - * defined in the back-end - */ - readonly VITE_ROUTE_HOME: import('@elegant-router/types').LastLevelRouteKey; /** * Default menu icon if menu icon is not set * diff --git a/src/views/_builtin/login/modules/pwd-login.vue b/src/views/_builtin/login/modules/pwd-login.vue index e840b2d..7703bd4 100644 --- a/src/views/_builtin/login/modules/pwd-login.vue +++ b/src/views/_builtin/login/modules/pwd-login.vue @@ -45,6 +45,9 @@ async function getCheckCode() { if (!error) { codeImg.value = `data:image/png;base64,${data.img}`; model.uuid = data.uuid; + if (data?.text) { + model.code = data.text; + } } } diff --git a/src/views/_builtin/login/modules/register.vue b/src/views/_builtin/login/modules/register.vue index 02d9b0c..64d7440 100644 --- a/src/views/_builtin/login/modules/register.vue +++ b/src/views/_builtin/login/modules/register.vue @@ -124,7 +124,7 @@ const showSteps = computed(() => !isMobile.value); :current="currentStep" size="small" class="max-w-full mb-16px" - :direction="'horizontal'" + direction="horizontal" :responsive="false" > diff --git a/vite.config.ts b/vite.config.ts index 92ec3fc..a967ed1 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -4,7 +4,6 @@ import { defineConfig, loadEnv } from 'vite'; import dayjs from 'dayjs'; import { setupVitePlugins } from './build/plugins'; import { createViteProxy } from './build/config'; -//test export default defineConfig(configEnv => { const viteEnv = loadEnv(configEnv.mode, process.cwd()) as unknown as Env.ImportMeta; @@ -32,8 +31,8 @@ export default defineConfig(configEnv => { }, server: { host: '0.0.0.0', - port: 9527, - open: true, + port: 8085, + open: false, proxy: createViteProxy(viteEnv, configEnv.command === 'serve'), fs: { cachedChecks: false diff --git a/vitest.config.ts b/vitest.config.ts index cb8191c..644b643 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -1,7 +1,5 @@ -import { defineConfig } from 'vitest/config' +import { defineConfig } from 'vitest/config'; export default defineConfig({ - test: { - - } -}) + test: {} +}); From af1ed94499aea78bb9958fc5e2b60fdb9c75d9d2 Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Thu, 28 Nov 2024 11:02:56 +0800 Subject: [PATCH 09/19] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E7=94=9F?= =?UTF-8?q?=E4=BA=A7API=E6=A0=87=E8=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.prod | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.env.prod b/.env.prod index 9a336a2..e9c6b99 100644 --- a/.env.prod +++ b/.env.prod @@ -1,3 +1,9 @@ +# vue-router mode: hash | history | memory +VITE_ROUTER_HISTORY_MODE=hash + +# frontend service base url, prod environment +VITE_BASE_URL=/u + # backend service base url, prod environment VITE_SERVICE_BASE_URL=/u-api From 5700b1fc06253209add36ad81106d53fa01ac3ac Mon Sep 17 00:00:00 2001 From: zhongzm Date: Fri, 29 Nov 2024 09:00:25 +0800 Subject: [PATCH 10/19] =?UTF-8?q?fix:=E6=A0=A1=E9=AA=8C=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/constants/reg.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/constants/reg.ts b/src/constants/reg.ts index 8805ca8..c0d73e6 100644 --- a/src/constants/reg.ts +++ b/src/constants/reg.ts @@ -1,8 +1,8 @@ export const REG_USER_NAME = /^[\u4E00-\u9FA5a-zA-Z0-9_-]{4,16}$/; /** Phone reg */ -export const REG_PHONE = - /^[1](([3][0-9])|([4][01456789])|([5][012356789])|([6][2567])|([7][0-8])|([8][0-9])|([9][012356789]))[0-9]{8}$/; +export const REG_PHONE = /^.{3,}$/; + ///^[1](([3][0-9])|([4][01456789])|([5][012356789])|([6][2567])|([7][0-8])|([8][0-9])|([9][012356789]))[0-9]{8}$/; /** * Password reg @@ -12,7 +12,8 @@ export const REG_PHONE = export const REG_PWD = /^\w{6,18}$/; /** Email reg */ -export const REG_EMAIL = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/; +export const REG_EMAIL = ///^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/; + /^(([^<>()\\.,;:\s@"]+(\.[^<>()\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/; /** Six digit code reg */ export const REG_CODE_SIX = /^\d{6}$/; From 52699c74d25cf771aa2ca574b6e34fbafd3bae3b Mon Sep 17 00:00:00 2001 From: zhongzm Date: Fri, 29 Nov 2024 09:01:12 +0800 Subject: [PATCH 11/19] =?UTF-8?q?fix:=E9=AA=8C=E8=AF=81=E7=A0=81=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/common/form.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hooks/common/form.ts b/src/hooks/common/form.ts index dbb5f72..d08978c 100644 --- a/src/hooks/common/form.ts +++ b/src/hooks/common/form.ts @@ -1,7 +1,7 @@ import { ref, toValue } from 'vue'; import type { ComputedRef, Ref } from 'vue'; import type { FormInstance } from 'ant-design-vue'; -import { REG_CODE_SIX, REG_EMAIL, REG_PHONE, REG_PWD, REG_USER_NAME } from '@/constants/reg'; +import {REG_CODE_FOUR, REG_EMAIL, REG_PHONE, REG_PWD, REG_USER_NAME} from '@/constants/reg'; import { $t } from '@/locales'; export function useFormRules() { @@ -22,7 +22,7 @@ export function useFormRules() { trigger: 'change' }, code: { - pattern: REG_CODE_SIX, + pattern: REG_CODE_FOUR, message: $t('form.code.invalid'), trigger: 'change' }, From a3a6aeb40e12572ee38865bc16bd560256620c0c Mon Sep 17 00:00:00 2001 From: zhongzm Date: Fri, 29 Nov 2024 09:02:09 +0800 Subject: [PATCH 12/19] =?UTF-8?q?fix:=E7=99=BB=E5=BD=95=E6=A1=86=E6=9E=B6?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/_builtin/login/index.vue | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/views/_builtin/login/index.vue b/src/views/_builtin/login/index.vue index 8aadd98..3db6abb 100644 --- a/src/views/_builtin/login/index.vue +++ b/src/views/_builtin/login/index.vue @@ -11,14 +11,14 @@ import ResetPwd from './modules/reset-pwd.vue'; import BindWechat from './modules/bind-wechat.vue'; import { WifiOutlined } from '@ant-design/icons-vue'; import {useI18n} from "vue-i18n"; - +//import { $t } from '@/locales'; interface Props { /** The login module */ module?: UnionKey.LoginModule; } const props = defineProps(); -const { t } = useI18n(); +const {t} = useI18n(); const themeStore = useThemeStore(); interface LoginModule { @@ -55,11 +55,11 @@ const bgColor = computed(() => {
- -

{{ "WANFi" }}

+ +

{{ t(activeModule.label) }}

-

{{ t('activeModule.label') }}

+

{{ "WANFi" }}

From 650a180778ef94f19ce6a6f15d1585f8b381945c Mon Sep 17 00:00:00 2001 From: zhongzm Date: Fri, 29 Nov 2024 09:04:06 +0800 Subject: [PATCH 13/19] =?UTF-8?q?fix:=E6=B3=A8=E5=86=8C=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E5=8F=8A=E7=9B=B8=E5=85=B3=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/business/captcha.ts | 24 +-- src/locales/langs/en-us.ts | 4 + src/locales/langs/zh-cn.ts | 4 + src/service/api/auth.ts | 16 ++ src/store/modules/auth/index.ts | 33 +++- src/typings/api.d.ts | 14 ++ src/typings/app.d.ts | 1 + src/typings/auto-imports.d.ts | 3 + src/typings/components.d.ts | 1 + src/views/_builtin/login/modules/register.vue | 155 +++++++++++++++--- 10 files changed, 222 insertions(+), 33 deletions(-) diff --git a/src/hooks/business/captcha.ts b/src/hooks/business/captcha.ts index b041c17..3f27072 100644 --- a/src/hooks/business/captcha.ts +++ b/src/hooks/business/captcha.ts @@ -1,12 +1,13 @@ import { computed } from 'vue'; import { useCountDown, useLoading } from '@sa/hooks'; import { $t } from '@/locales'; -import { REG_PHONE } from '@/constants/reg'; +import {REG_EMAIL} from '@/constants/reg'; +import {useAuthStore} from "@/store/modules/auth"; export function useCaptcha() { const { loading, startLoading, endLoading } = useLoading(); const { count, start, stop, isCounting } = useCountDown(10); - + const authStore = useAuthStore(); const label = computed(() => { let text = $t('page.login.codeLogin.getCode'); @@ -23,14 +24,14 @@ export function useCaptcha() { return text; }); - function isPhoneValid(phone: string) { - if (phone.trim() === '') { + function isEmailValid(email: string) { + if (email.trim() === '') { $message?.error?.($t('form.phone.required')); return false; } - if (!REG_PHONE.test(phone)) { + if (!REG_EMAIL.test(email)) { $message?.error?.($t('form.phone.invalid')); return false; @@ -38,17 +39,20 @@ export function useCaptcha() { return true; } - - async function getCaptcha(phone: string) { - const valid = isPhoneValid(phone); - + //获取验证码方法 + async function getCaptcha(email: string) { + console.log(email) + //const valid = isPhoneValid(phone); + const valid = isEmailValid(email); if (!valid || loading.value) { return; } startLoading(); - // request + await authStore.captcha( + email, + ); await new Promise(resolve => { setTimeout(resolve, 500); }); diff --git a/src/locales/langs/en-us.ts b/src/locales/langs/en-us.ts index 52acd61..2ab7c78 100644 --- a/src/locales/langs/en-us.ts +++ b/src/locales/langs/en-us.ts @@ -178,6 +178,7 @@ const local: any = { back: 'Back', validateSuccess: 'Verification passed', loginSuccess: 'Login successfully', + registerSuccess:'Register successfully', welcomeBack: 'Welcome back, {username} !', checkCode: 'Please check the verification code', emailPlaceholder:'Please enter the email' @@ -224,6 +225,9 @@ const local: any = { address: 'Address', next: 'Next', prev: 'Prev', + birthDate: 'Birth Date', + birthDatePlaceholder: 'Please select birth date', + birthDateRequired: 'Please select birth date', }, resetPwd: { title: 'Reset Password' diff --git a/src/locales/langs/zh-cn.ts b/src/locales/langs/zh-cn.ts index 7da9af8..1f725c6 100644 --- a/src/locales/langs/zh-cn.ts +++ b/src/locales/langs/zh-cn.ts @@ -178,6 +178,7 @@ const local:any = { back: '返回', validateSuccess: '验证成功', loginSuccess: '登录成功', + registerSuccess:'注册成功', welcomeBack: '欢迎回来,{username} !', checkCode: '请输入验证码', emailPlaceholder:'请输入邮箱' @@ -224,6 +225,9 @@ const local:any = { address: '地址', next: '下一步', prev: '上一步', + birthDate: '出生日期', + birthDatePlaceholder: '请选择出生日期', + birthDateRequired: '请选择出生日期', }, resetPwd: { title: '重置密码' diff --git a/src/service/api/auth.ts b/src/service/api/auth.ts index 01cd180..45163c8 100644 --- a/src/service/api/auth.ts +++ b/src/service/api/auth.ts @@ -13,7 +13,23 @@ export function fetchLogin(body: Api.Auth.LoginBody) { data: body }); } +//邮箱验证码接口 +export function sendCaptcha(body:Api.Auth.EmailCaptcha){ + return request({ + url:`/system/email/code?email=${body.email}`, + method:'get', + }) +} +//验证注册 +//添加注册 +export function fetchRegister(body: Api.Auth.RegisterBody) { + return request({ + url: '/auth/register', + method: 'post', + data: body + }); +} /** logout */ export function doDeleteLogout() { return request>({ diff --git a/src/store/modules/auth/index.ts b/src/store/modules/auth/index.ts index e9f6b77..132d094 100644 --- a/src/store/modules/auth/index.ts +++ b/src/store/modules/auth/index.ts @@ -7,6 +7,7 @@ import { localStg } from '@/utils/storage'; import { $t } from '@/locales'; import { useRouteStore } from '../route'; import { clearAuthStorage, emptyInfo, getToken } from './shared'; +import {sendCaptcha} from "@/service/api/auth"; export const useAuthStore = defineStore(SetupStoreId.Auth, () => { const routeStore = useRouteStore(); @@ -121,6 +122,34 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => { } return false; } + /** + * Register new user + */ + async function register(registerForm: Api.Auth.RegisterBody) { + startLoading(); + + const { error } = await fetchRegister(registerForm); + + if (!error) { + $message?.success($t('page.login.common.registerSuccess')); + // 注册成功后跳转到登录页 + await toLogin(); + } + + endLoading(); + return !error; + } + async function captcha(email:string){ + if (!email) { + return; + } + + try { + await sendCaptcha({ email }); // 这里调用后端接口发送验证码 + } catch (error) { + + } + } return { token, @@ -131,6 +160,8 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => { resetStore, permissions, login, - refreshUserInfo + refreshUserInfo, + register, + captcha, }; }); diff --git a/src/typings/api.d.ts b/src/typings/api.d.ts index d4262dd..63746d2 100644 --- a/src/typings/api.d.ts +++ b/src/typings/api.d.ts @@ -138,6 +138,20 @@ declare namespace Api { uuid: string; authType: string; } + interface RegisterBody{ + username: string; + password: string; + authType:string; + email: string; + fullName: string; + age: number; + address: string; + sex: string; + phonenumber: string; + } + interface EmailCaptcha{ + email:string; + } } /** diff --git a/src/typings/app.d.ts b/src/typings/app.d.ts index 65c56f0..06bea1f 100644 --- a/src/typings/app.d.ts +++ b/src/typings/app.d.ts @@ -358,6 +358,7 @@ declare namespace App { back: string; validateSuccess: string; loginSuccess: string; + registerSuccess: string; welcomeBack: string; checkCode: string; }; diff --git a/src/typings/auto-imports.d.ts b/src/typings/auto-imports.d.ts index 889b2c3..ae8942e 100644 --- a/src/typings/auto-imports.d.ts +++ b/src/typings/auto-imports.d.ts @@ -20,6 +20,7 @@ declare global { const beforeAll: typeof import('vitest')['beforeAll'] const beforeEach: typeof import('vitest')['beforeEach'] const chai: typeof import('vitest')['chai'] + const checkReport: typeof import('../service/api/auth')['checkReport'] const clearAuthStorage: typeof import('../store/modules/auth/shared')['clearAuthStorage'] const cloneDeep: typeof import('lodash-es')['cloneDeep'] const computed: typeof import('vue')['computed'] @@ -96,6 +97,7 @@ declare global { const fetchIsRouteExist: typeof import('../service/api/route')['fetchIsRouteExist'] const fetchLogin: typeof import('../service/api/auth')['fetchLogin'] const fetchRefreshToken: typeof import('../service/api/auth')['fetchRefreshToken'] + const fetchRegister: typeof import('../service/api/auth')['fetchRegister'] const filterAuthRoutesByRoles: typeof import('../store/modules/route/shared')['filterAuthRoutesByRoles'] const filterTabsById: typeof import('../store/modules/tab/shared')['filterTabsById'] const filterTabsByIds: typeof import('../store/modules/tab/shared')['filterTabsByIds'] @@ -182,6 +184,7 @@ declare global { const resolveComponent: typeof import('vue')['resolveComponent'] const resolveRef: typeof import('@vueuse/core')['resolveRef'] const resolveUnref: typeof import('@vueuse/core')['resolveUnref'] + const sendCaptcha: typeof import('../service/api/auth')['sendCaptcha'] const sessionStg: typeof import('../utils/storage')['sessionStg'] const setActivePinia: typeof import('pinia')['setActivePinia'] const setMapStoreSuffix: typeof import('pinia')['setMapStoreSuffix'] diff --git a/src/typings/components.d.ts b/src/typings/components.d.ts index a5dc4fc..49cd77d 100644 --- a/src/typings/components.d.ts +++ b/src/typings/components.d.ts @@ -13,6 +13,7 @@ declare module 'vue' { ACard: typeof import('ant-design-vue/es')['Card'] ACheckbox: typeof import('ant-design-vue/es')['Checkbox'] ACol: typeof import('ant-design-vue/es')['Col'] + ADatePicker: typeof import('ant-design-vue/es')['DatePicker'] ADescriptions: typeof import('ant-design-vue/es')['Descriptions'] ADescriptionsItem: typeof import('ant-design-vue/es')['DescriptionsItem'] ADivider: typeof import('ant-design-vue/es')['Divider'] diff --git a/src/views/_builtin/login/modules/register.vue b/src/views/_builtin/login/modules/register.vue index 64d7440..62afc6c 100644 --- a/src/views/_builtin/login/modules/register.vue +++ b/src/views/_builtin/login/modules/register.vue @@ -1,17 +1,22 @@