From 0f54604435521d08c803e0ef30b363c97f230724 Mon Sep 17 00:00:00 2001 From: "Michelle.Chung" <1242874891@qq.com> Date: Fri, 16 Jun 2023 20:32:46 +0800 Subject: [PATCH 01/26] =?UTF-8?q?update=20=E9=80=82=E9=85=8D=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E9=87=8D=E6=9E=84=E7=9A=84=E4=BF=AE=E6=94=B9(?= =?UTF-8?q?=E4=BF=AE=E6=94=B9token=E5=91=BD=E5=90=8D,=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E4=BC=A0=E5=8F=82)=20;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/login.ts | 4 +++- src/api/types.ts | 4 +++- src/store/modules/user.ts | 4 ++-- src/utils/auth.ts | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/api/login.ts b/src/api/login.ts index b95a0c0..4eaa594 100644 --- a/src/api/login.ts +++ b/src/api/login.ts @@ -13,7 +13,9 @@ export function login(data: LoginData): AxiosPromise { username: data.username.trim(), password: data.password, code: data.code, - uuid: data.uuid + uuid: data.uuid, + clientId: 'e5cd7e4891bf95d1d19206ce24a7b32e', + grantType: 'password' }; return request({ url: '/auth/login', diff --git a/src/api/types.ts b/src/api/types.ts index 68fb427..8ca204f 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -21,13 +21,15 @@ export interface LoginData { rememberMe?: boolean; code?: string; uuid?: string; + clientId: string; + grantType: string; } /** * 登录响应 */ export interface LoginResult { - token: string; + access_token: string; } /** diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index 6f30437..2593d1a 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -23,8 +23,8 @@ export const useUserStore = defineStore('user', () => { const [err, res] = await to(loginApi(userInfo)); if (res) { const data = res.data; - setToken(data.token); - token.value = data.token; + setToken(data.access_token); + token.value = data.access_token; return Promise.resolve(); } return Promise.reject(err); diff --git a/src/utils/auth.ts b/src/utils/auth.ts index 4020003..db50ac9 100644 --- a/src/utils/auth.ts +++ b/src/utils/auth.ts @@ -4,6 +4,6 @@ const tokenStorage = useStorage(TokenKey, null); export const getToken = () => tokenStorage.value; -export const setToken = (token: string) => (tokenStorage.value = token); +export const setToken = (access_token: string) => (tokenStorage.value = access_token); export const removeToken = () => (tokenStorage.value = null); From 44ea10d9c737d5bbd38669ee3a41b23a030d0ba5 Mon Sep 17 00:00:00 2001 From: "Michelle.Chung" <1242874891@qq.com> Date: Sun, 18 Jun 2023 16:58:28 +0800 Subject: [PATCH 02/26] =?UTF-8?q?add=20=E6=96=B0=E5=A2=9E=E5=AE=A2?= =?UTF-8?q?=E6=88=B7=E7=AB=AF=E7=AE=A1=E7=90=86=E9=A1=B5=E9=9D=A2=20;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/system/client/index.ts | 80 ++++++++ src/api/system/client/types.ts | 123 ++++++++++++ src/views/system/client/index.vue | 317 ++++++++++++++++++++++++++++++ 3 files changed, 520 insertions(+) create mode 100644 src/api/system/client/index.ts create mode 100644 src/api/system/client/types.ts create mode 100644 src/views/system/client/index.vue diff --git a/src/api/system/client/index.ts b/src/api/system/client/index.ts new file mode 100644 index 0000000..603208e --- /dev/null +++ b/src/api/system/client/index.ts @@ -0,0 +1,80 @@ +import request from '@/utils/request'; +import { AxiosPromise } from 'axios'; +import { ClientVO, ClientForm, ClientQuery } from '@/api/system/client/types'; + +/** + * 查询客户端管理列表 + * @param query + * @returns {*} + */ + +export const listClient = (query?: ClientQuery): AxiosPromise => { + return request({ + url: '/system/client/list', + method: 'get', + params: query + }); +}; + +/** + * 查询客户端管理详细 + * @param id + */ +export const getClient = (id: string | number): AxiosPromise => { + return request({ + url: '/system/client/' + id, + method: 'get' + }); +}; + +/** + * 新增客户端管理 + * @param data + */ +export const addClient = (data: ClientForm) => { + return request({ + url: '/system/client', + method: 'post', + data: data + }); +}; + +/** + * 修改客户端管理 + * @param data + */ +export const updateClient = (data: ClientForm) => { + return request({ + url: '/system/client', + method: 'put', + data: data + }); +}; + +/** + * 删除客户端管理 + * @param id + */ +export const delClient = (id: string | number | Array) => { + return request({ + url: '/system/client/' + id, + method: 'delete' + }); +}; + +/** + * 用户状态修改 + * @param userId 用户ID + * @param status 用户状态 + */ +export function changeStatus(id: number | string, status: string) { + const data = { + id, + status + }; + return request({ + url: '/system/client/changeStatus', + method: 'put', + data: data + }); +} diff --git a/src/api/system/client/types.ts b/src/api/system/client/types.ts new file mode 100644 index 0000000..1c505ac --- /dev/null +++ b/src/api/system/client/types.ts @@ -0,0 +1,123 @@ +export interface ClientVO { + /** + * id + */ + id: string | number; + + /** + * 客户端id + */ + clientId: string | number; + + /** + * 客户端key + */ + clientKey: string; + + /** + * 客户端秘钥 + */ + clientSecret: string; + + /** + * 授权类型 + */ + grantTypeList: string[]; + + /** + * token活跃超时时间 + */ + activityTimeout: number; + + /** + * token固定超时 + */ + timeout: number; + + /** + * 状态(0正常 1停用) + */ + status: string; + +} + +export interface ClientForm extends BaseEntity { + /** + * id + */ + id?: string | number; + + /** + * 客户端id + */ + clientId?: string | number; + + /** + * 客户端key + */ + clientKey?: string; + + /** + * 客户端秘钥 + */ + clientSecret?: string; + + /** + * 授权类型 + */ + grantTypeList?: string[]; + + /** + * token活跃超时时间 + */ + activityTimeout?: number; + + /** + * token固定超时 + */ + timeout?: number; + + /** + * 状态(0正常 1停用) + */ + status?: string; + +} + +export interface ClientQuery extends PageQuery { + /** + * 客户端id + */ + clientId?: string | number; + + /** + * 客户端key + */ + clientKey?: string; + + /** + * 客户端秘钥 + */ + clientSecret?: string; + + /** + * 授权类型 + */ + grantType?: string; + + /** + * token活跃超时时间 + */ + activityTimeout?: number; + + /** + * token固定超时 + */ + timeout?: number; + + /** + * 状态(0正常 1停用) + */ + status?: string; + +} diff --git a/src/views/system/client/index.vue b/src/views/system/client/index.vue new file mode 100644 index 0000000..1a5e191 --- /dev/null +++ b/src/views/system/client/index.vue @@ -0,0 +1,317 @@ + + + From ed84745897685368eb7c74c3d92673cdb486cd00 Mon Sep 17 00:00:00 2001 From: "Michelle.Chung" <1242874891@qq.com> Date: Sun, 18 Jun 2023 19:58:58 +0800 Subject: [PATCH 03/26] =?UTF-8?q?update=20=E6=9B=B4=E6=96=B0=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=8E=88=E6=9D=83=E7=B1=BB=E5=9E=8B=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=20;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/system/client/index.vue | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/views/system/client/index.vue b/src/views/system/client/index.vue index 1a5e191..5191108 100644 --- a/src/views/system/client/index.vue +++ b/src/views/system/client/index.vue @@ -47,7 +47,15 @@ - + + + From 952a2ba9068be8fe107aa88c4bd27ae457ad094e Mon Sep 17 00:00:00 2001 From: "Michelle.Chung" <1242874891@qq.com> Date: Mon, 19 Jun 2023 08:49:47 +0800 Subject: [PATCH 04/26] =?UTF-8?q?fix=20=E4=BF=AE=E6=AD=A3=E6=B3=A8?= =?UTF-8?q?=E9=87=8A=E9=94=99=E8=AF=AF=20;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/system/client/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/api/system/client/index.ts b/src/api/system/client/index.ts index 603208e..06544da 100644 --- a/src/api/system/client/index.ts +++ b/src/api/system/client/index.ts @@ -63,9 +63,9 @@ export const delClient = (id: string | number | Array) => { }; /** - * 用户状态修改 - * @param userId 用户ID - * @param status 用户状态 + * 状态修改 + * @param id ID + * @param status 状态 */ export function changeStatus(id: number | string, status: string) { const data = { From 13bb23c71706af747dacf89ae4eb47cf75a048e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?= <15040126243@163.com> Date: Wed, 21 Jun 2023 16:08:50 +0800 Subject: [PATCH 05/26] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8D=20=E5=89=8D?= =?UTF-8?q?=E7=AB=AF=E5=8F=82=E6=95=B0=E6=BC=8F=E6=94=B9=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E4=B8=89=E6=96=B9=E8=B7=B3=E8=BD=AC=E5=A4=B1=E8=B4=A5=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/login.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/api/login.ts b/src/api/login.ts index 9d6d1b7..f12d25a 100644 --- a/src/api/login.ts +++ b/src/api/login.ts @@ -67,10 +67,11 @@ export function getCodeImg(): AxiosPromise { export function socialLogin(source: string, code: any, state: any): AxiosPromise { const data = { code, - state + state, + source }; return request({ - url: '/auth/social-login/' + source, + url: '/auth/social-login', method: 'get', params: data }); From 18dd68edd5848638bafc8402da423a660b48e4da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?= <15040126243@163.com> Date: Wed, 21 Jun 2023 17:03:26 +0800 Subject: [PATCH 06/26] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8D=20=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E8=B0=83=E7=94=A8=E8=B7=B3=E8=BD=AC=E7=99=BD=E5=B1=8F?= =?UTF-8?q?=E9=97=AE=E9=A2=98(=E4=B8=B4=E6=97=B6=E4=BF=AE=E5=A4=8D)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layout/components/SocialLogin/index.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/layout/components/SocialLogin/index.vue b/src/layout/components/SocialLogin/index.vue index fad8286..127007b 100644 --- a/src/layout/components/SocialLogin/index.vue +++ b/src/layout/components/SocialLogin/index.vue @@ -22,13 +22,13 @@ await socialLogin(source, code, state) .then(async (res) => { if (res.code !== 200) { ElMessage.error(res.msg); - router.go(-2); + location.href = import.meta.env.VITE_APP_CONTEXT_PATH + 'index'; return; } loading.value = false; setToken(res.msg); ElMessage.success('登录成功'); - router.go(-2); + location.href = import.meta.env.VITE_APP_CONTEXT_PATH + 'index'; }) .catch(() => { loading.value = false; From cab430a4287c067f62e919a254457f511c83b5bd Mon Sep 17 00:00:00 2001 From: yhan219 Date: Fri, 16 Jun 2023 15:58:13 +0000 Subject: [PATCH 07/26] =?UTF-8?q?!12=20[=E9=9C=80=E6=B1=82=E8=AE=A4?= =?UTF-8?q?=E9=A2=86]=20=E5=AF=B9=E6=8E=A5=20powerjob=20=E5=AE=9E=E7=8E=B0?= =?UTF-8?q?=E5=88=86=E5=B8=83=E5=BC=8F=E4=BB=BB=E5=8A=A1=E8=B0=83=E5=BA=A6?= =?UTF-8?q?=20=E9=9B=86=E6=88=90=E6=96=B9=E5=BC=8F=E5=8F=82=E8=80=83?= =?UTF-8?q?=E6=A1=86=E6=9E=B6=E5=86=85=20xxl-job=20*=20[=E9=9C=80=E6=B1=82?= =?UTF-8?q?=E8=AE=A4=E9=A2=86]=20=E5=AF=B9=E6=8E=A5=20powerjob=20=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0=E5=88=86=E5=B8=83=E5=BC=8F=E4=BB=BB=E5=8A=A1=E8=B0=83?= =?UTF-8?q?=E5=BA=A6=20=E9=9B=86=E6=88=90=E6=96=B9=E5=BC=8F=E5=8F=82?= =?UTF-8?q?=E8=80=83=E6=A1=86=E6=9E=B6=E5=86=85=20xxl-job?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 4 ++-- .env.production | 4 ++-- src/types/env.d.ts | 2 +- src/views/index.vue | 2 +- src/views/monitor/{xxljob => powerjob}/index.vue | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) rename src/views/monitor/{xxljob => powerjob}/index.vue (67%) diff --git a/.env.development b/.env.development index 4ec5afb..6ca0e51 100644 --- a/.env.development +++ b/.env.development @@ -13,7 +13,7 @@ VITE_APP_CONTEXT_PATH = '/' # 监控地址 VITE_APP_MONITRO_ADMIN = 'http://localhost:9090/admin/applications' -# xxl-job 控制台地址 -VITE_APP_XXL_JOB_ADMIN = 'http://localhost:9100/xxl-job-admin' +# powerjob 控制台地址 +VITE_APP_POWERJOB_ADMIN = 'http://localhost:7700/' VITE_APP_PORT = 80 diff --git a/.env.production b/.env.production index 6e6510a..a5e77b3 100644 --- a/.env.production +++ b/.env.production @@ -10,8 +10,8 @@ VITE_APP_CONTEXT_PATH = '/' # 监控地址 VITE_APP_MONITRO_ADMIN = '/admin/applications' -# 监控地址 -VITE_APP_XXL_JOB_ADMIN = '/xxl-job-admin' +# powerjob 控制台地址 +VITE_APP_POWERJOB_ADMIN = '/powerjob' # 生产环境 VITE_APP_BASE_API = '/prod-api' diff --git a/src/types/env.d.ts b/src/types/env.d.ts index 7e5134a..032f52b 100644 --- a/src/types/env.d.ts +++ b/src/types/env.d.ts @@ -65,7 +65,7 @@ interface ImportMetaEnv { VITE_APP_BASE_URL: string; VITE_APP_CONTEXT_PATH: string; VITE_APP_MONITRO_ADMIN: string; - VITE_APP_XXL_JOB_ADMIN: string; + VITE_APP_POWERJOB_ADMIN: string; VITE_APP_ENV: string; } interface ImportMeta { diff --git a/src/views/index.vue b/src/views/index.vue index 70912af..4b3bebd 100644 --- a/src/views/index.vue +++ b/src/views/index.vue @@ -21,7 +21,7 @@ * 分布式锁 Lock4j 注解锁、工具锁 多种多样
* 分布式幂等 Lock4j 基于分布式锁实现
* 分布式链路追踪 SkyWalking 支持链路追踪、网格分析、度量聚合、可视化
- * 分布式任务调度 Xxl-Job 高性能 高可靠 易扩展
+ * 分布式任务调度 PowerJob 高性能 高可靠 易扩展
* 文件存储 Minio 本地存储
* 文件存储 七牛、阿里、腾讯 云存储
* 监控框架 SpringBoot-Admin 全方位服务监控
diff --git a/src/views/monitor/xxljob/index.vue b/src/views/monitor/powerjob/index.vue similarity index 67% rename from src/views/monitor/xxljob/index.vue rename to src/views/monitor/powerjob/index.vue index 9349081..0319e97 100644 --- a/src/views/monitor/xxljob/index.vue +++ b/src/views/monitor/powerjob/index.vue @@ -5,5 +5,5 @@ From 3b4ac3e525bdc51cf5176d3d52cd01d0a9c67d7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E4=B8=AA=E4=B8=89?= <2029364173@qq.com> Date: Tue, 20 Jun 2023 04:12:49 +0000 Subject: [PATCH 08/26] =?UTF-8?q?!16=20=E6=89=A9=E5=B1=95=E7=AC=AC?= =?UTF-8?q?=E4=B8=89=E6=96=B9=E7=99=BB=E5=BD=95=E6=8E=88=E6=9D=83=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=20*=20add=20=E7=AC=AC=E4=B8=89=E6=96=B9=E6=8E=88?= =?UTF-8?q?=E6=9D=83=20*=20add=20=E7=AC=AC=E4=B8=89=E6=96=B9=E6=8E=88?= =?UTF-8?q?=E6=9D=83=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + src/api/login.ts | 18 ++ src/api/system/social/auth.ts | 33 ++++ src/assets/icons/svg/gitee.svg | 1 + src/layout/components/socialLogin/index.vue | 36 ++++ src/permission.ts | 2 +- src/router/index.ts | 5 + src/views/login.vue | 181 +++++++++++-------- src/views/system/user/profile/index.vue | 16 +- src/views/system/user/profile/thirdParty.vue | 140 ++++++++++++++ 10 files changed, 359 insertions(+), 74 deletions(-) create mode 100644 src/api/system/social/auth.ts create mode 100644 src/assets/icons/svg/gitee.svg create mode 100644 src/layout/components/socialLogin/index.vue create mode 100644 src/views/system/user/profile/thirdParty.vue diff --git a/.gitignore b/.gitignore index 79e7fd9..40df474 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .DS_Store +.history node_modules/ dist/ npm-debug.log* diff --git a/src/api/login.ts b/src/api/login.ts index 4eaa594..6c03dd3 100644 --- a/src/api/login.ts +++ b/src/api/login.ts @@ -62,6 +62,24 @@ export function getCodeImg(): AxiosPromise { timeout: 20000 }); } +/** + * 第三方登录 + * @param source 第三方登录类型 + * */ +export function socialLogin(source: string, code: any, state: any): AxiosPromise { + const data = { + code, + state + }; + return request({ + url: '/auth/social-login/' + source, + method: 'get', + headers: { + isToken: true + }, + params: data + }); +} // 获取用户详细信息 export function getInfo(): AxiosPromise { diff --git a/src/api/system/social/auth.ts b/src/api/system/social/auth.ts new file mode 100644 index 0000000..b1f2106 --- /dev/null +++ b/src/api/system/social/auth.ts @@ -0,0 +1,33 @@ +import request from '@/utils/request'; + +// 绑定账号 +export function authBinding(source: string) { + return request({ + url: '/auth/binding/' + source, + method: 'get', + headers: { + isToken: true + } + }); +} + +// 解绑账号 +export function authUnlock(authId: string) { + return request({ + url: '/auth/unlock/' + authId, + method: 'delete', + headers: { + isToken: true + } + }); +} +//获取授权列表 +export function getAuthList() { + return request({ + url: '/system/social/list', + method: 'get', + headers: { + isToken: true + } + }); +} diff --git a/src/assets/icons/svg/gitee.svg b/src/assets/icons/svg/gitee.svg new file mode 100644 index 0000000..6324608 --- /dev/null +++ b/src/assets/icons/svg/gitee.svg @@ -0,0 +1 @@ + diff --git a/src/layout/components/socialLogin/index.vue b/src/layout/components/socialLogin/index.vue new file mode 100644 index 0000000..e125c12 --- /dev/null +++ b/src/layout/components/socialLogin/index.vue @@ -0,0 +1,36 @@ + + + diff --git a/src/permission.ts b/src/permission.ts index 4713383..c2743eb 100644 --- a/src/permission.ts +++ b/src/permission.ts @@ -10,7 +10,7 @@ import useSettingsStore from '@/store/modules/settings'; import usePermissionStore from '@/store/modules/permission'; NProgress.configure({ showSpinner: false }); -const whiteList = ['/login', '/register']; +const whiteList = ['/login', '/register', '/social-login']; router.beforeEach(async (to, from, next) => { NProgress.start(); diff --git a/src/router/index.ts b/src/router/index.ts index 9540ab2..33e3e5e 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -37,6 +37,11 @@ export const constantRoutes: RouteOption[] = [ } ] }, + { + path: '/social-login', + hidden: true, + component: () => import('@/layout/components/socialLogin/index.vue') + }, { path: '/login', component: () => import('@/views/login.vue'), diff --git a/src/views/login.vue b/src/views/login.vue index 9559f9b..af98f01 100644 --- a/src/views/login.vue +++ b/src/views/login.vue @@ -4,7 +4,7 @@

RuoYi-Vue-Plus多租户管理系统

- + @@ -36,6 +36,20 @@ 立即注册 +
+ + + + + + + + + + + + +