From 1500479debd3617d853249e5b956a15669a8d4c4 Mon Sep 17 00:00:00 2001 From: hu-xin-fin <1193584261@qq.com> Date: Mon, 13 Feb 2023 10:25:45 +0800 Subject: [PATCH 1/6] add en readme --- README.es.md | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 4 +++- 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 README.es.md diff --git a/README.es.md b/README.es.md new file mode 100644 index 0000000..568fc38 --- /dev/null +++ b/README.es.md @@ -0,0 +1,55 @@ +

Vue2 Template Admin

+ +[README IN Chinese](https://github.com/Octoveau/vue2-element-admin-thin/blob/main/README.md) +## Introduction + +Vue2 Template Admin as a middle-background template, which is developed with `vue2`, `element-ui` and other related technology stacks. There are built-in secondary-encapsulates frequently-use components. Refine and abstract frequently-use modules, reduce the use of `import` and `require`, improve development efficiency + +## Features + +- Module: Highly abstract, minimize the use of `import` and `require` +- Component: Secondary-encapsulate for multiple frequently-use componen + +## Preparation + +This project is mainly based on `ES2015+`, `vue2`, `Vue-router`, `pinia`, `vue-cli@4.5.17`, `axios` and` ant design for vue `, you need to be familiar with in advance. + +- node and git - Project development environment +- be acquainted with vue2 essentials syntax +- be acquainted with webpack features, not limited to (webpackDLL, ProvidePlugin, plugin alias), etc +- Since the project is highly abstract against typical modules such as` auth `, `utils`, etc., you need to consult the vue.config.js file beforehand + +## Installation and use + +``` +- Pull project +git clone https://github.com/Octoveau/vue2-template-portal.git + +- Into the project +cd vue2-template-portal + +- Installation dependency +npm install + +- Start +npm run serve +``` + +## Others +``` +- Prepack [Prepack 'ant design for vue', 'moment', and 'lodash' to improve compilation speed] +npm run dll +``` + + +## commit title must followed by a space character + +- build: The submission is mainly about modify the building system of the project (e.g. glup, webpack, rollup configuration, etc.) +- ci: The submission is mainly about modify the submission of the project continuing integration process (e.g. Travis, Jenkins, GitLab CI, Circle, etc.) +- docs: Updates the document +- feat: New function +- fix: Fixed bugs +- perf: performance optimization +- refactor: Refactor the code (neither new features nor bug fixes) +-style: Code modification that does not affect program logic (modify whitespace characters, completing missing semicolons, etc.) +- test: Add test case or update existing test \ No newline at end of file diff --git a/README.md b/README.md index 946cecb..116962b 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,10 @@

Vue2 Template Admin

+[README IN English](https://github.com/Octoveau/vue2-element-admin-thin/blob/main/README.es.md) + ## 简介 -Vue2 Template Admin 作为中后台模版,其采用`vue2`,`element-ui`等相关技术栈开发。内置二次封装的常规组件,提炼并抽象化常用模块,减轻`import`与`require`的使用,提升开发效率 +Vue2 Template Admin 作为中后台模版,其采用`vue2`,`element-ui`等相关技术栈开发。内置二次封装的常用组件,提炼并抽象化常用模块,减轻`import`与`require`的使用,提升开发效率 ## 特性 From d608f51c5356a94e3024eff7157a6f64d0fac7ce Mon Sep 17 00:00:00 2001 From: cicada_fu <28926044+zero-fsc@users.noreply.github.com> Date: Thu, 16 Feb 2023 00:15:10 +0800 Subject: [PATCH 2/6] add README.md --- .vscode/settings.json | 5 ++ README.md | 116 +++++++++++------------------------------- README.zh-CN.md | 113 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 147 insertions(+), 87 deletions(-) create mode 100644 .vscode/settings.json create mode 100644 README.zh-CN.md diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..ac511ed --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "i18n-ally.localesPaths": [ + "src/lang" + ] +} \ No newline at end of file diff --git a/README.md b/README.md index 789b5c1..79ae998 100644 --- a/README.md +++ b/README.md @@ -1,113 +1,55 @@ - -

Vue2 Template Admin

- -[README IN English](https://github.com/Octoveau/vue2-element-admin-thin/blob/main/README.es.md) - -## 简介 - -Vue2 Template Admin 作为中后台模版,其采用`vue2`,`element-ui`等相关技术栈开发。内置二次封装的常用组件,提炼并抽象化常用模块,减轻`import`与`require`的使用,提升开发效率 - -## 特性 - -- 模块:高度抽象,尽量减少`import`和`require`使用 -- 组件:二次封装多个常用组件 - -## 准备 - -本项目主要基于`ES2015+`,`vue2`,`vue-router`,`pinia`,`vue-cli@4.5.17`,`axios`及`ant design for vue`,故需要提前熟悉。 - -- node 和 git -项目开发环境 -- 熟悉 vue2 基础语法 -- 熟悉 webpack 特性,不限于(webpackDLL、ProvidePlugin、plugin alias)等 -- 由于项目针对典型模块如`auth`,`utils`等高度抽象,需要预先查阅 vue.config.js 文件 - -## 安装及使用 - -``` -- 拉取项目 -git clone https://github.com/Octoveau/vue2-template-portal.git - -- 进入项目 -cd vue2-template-portal - -- 安装依赖 -npm install - -- 启动 -npm run serve -``` - -## 其它 - -``` -- 预打包【将ant design for vue、moment、lodash进行预打包提高编译速度】 -npm run dll -``` - -## commit 时的标题,后面必须代一个空格 - -- build:主要目的是修改项目构建系统(例如 glup,webpack,rollup 的配置等)的提交 -- ci:主要目的是修改项目继续集成流程(例如 Travis,Jenkins,GitLab CI,Circle 等)的提交 -- docs:文档更新 -- feat:新增功能 -- fix:bug 修复 -- perf:性能优化 -- refactor:重构代码(既没有新增功能,也没有修复 bug) -- style:不影响程序逻辑的代码修改(修改空白字符,补全缺失的分号等) -- test:新增测试用例或是更新现有测试 -=======

Vue2 Template Admin

-## 简介 +English | [简体中文](https://github.com/Octoveau/vue2-element-admin-thin/blob/main/README.zh.md) +## Introduction -Vue2 Template Admin 作为中后台模版,其采用`vue2`,`element-ui`等相关技术栈开发。内置二次封装的常规组件,提炼并抽象化常用模块,减轻`import`与`require`的使用,提升开发效率 +Vue2 Template Admin as a middle-background template, which is developed with `vue2`, `element-ui` and other related technology stacks. There are built-in secondary-encapsulates frequently-use components. Refine and abstract frequently-use modules, reduce the use of `import` and `require`, improve development efficiency -## 特性 +## Features -- 模块:高度抽象,尽量减少`import`和`require`使用 -- 组件:二次封装多个常用组件 +- Module: Highly abstract, minimize the use of `import` and `require` +- Component: Secondary-encapsulate for multiple frequently-use componen -## 准备 +## Preparation -本项目主要基于`ES2015+`,`vue2`,`vue-router`,`pinia`,`vue-cli@4.5.17`,`axios`及`ant design for vue`,故需要提前熟悉。 +This project is mainly based on `ES2015+`, `vue2`, `Vue-router`, `pinia`, `vue-cli@4.5.17`, `axios` and` ant design for vue `, you need to be familiar with in advance. -- node 和 git -项目开发环境 -- 熟悉 vue2 基础语法 -- 熟悉 webpack 特性,不限于(webpackDLL、ProvidePlugin、plugin alias)等 -- 由于项目针对典型模块如`auth`,`utils`等高度抽象,需要预先查阅 vue.config.js 文件 +- node and git - Project development environment +- be acquainted with vue2 essentials syntax +- be acquainted with webpack features, not limited to (webpackDLL, ProvidePlugin, plugin alias), etc +- Since the project is highly abstract against typical modules such as` auth `, `utils`, etc., you need to consult the vue.config.js file beforehand -## 安装及使用 +## Installation and use ``` -- 拉取项目 +- Pull project git clone https://github.com/Octoveau/vue2-template-portal.git -- 进入项目 +- Into the project cd vue2-template-portal -- 安装依赖 +- Installation dependency npm install -- 启动 +- Start npm run serve ``` -## 其它 - +## Others ``` -- 预打包【将ant design for vue、moment、lodash进行预打包提高编译速度】 +- Prepack [Prepack 'ant design for vue', 'moment', and 'lodash' to improve compilation speed] npm run dll ``` -## commit 时的标题,后面必须代一个空格 -- build:主要目的是修改项目构建系统(例如 glup,webpack,rollup 的配置等)的提交 -- ci:主要目的是修改项目继续集成流程(例如 Travis,Jenkins,GitLab CI,Circle 等)的提交 -- docs:文档更新 -- feat:新增功能 -- fix:bug 修复 -- perf:性能优化 -- refactor:重构代码(既没有新增功能,也没有修复 bug) -- style:不影响程序逻辑的代码修改(修改空白字符,补全缺失的分号等) -- test:新增测试用例或是更新现有测试 +## commit title must followed by a space character +- build: The submission is mainly about modify the building system of the project (e.g. glup, webpack, rollup configuration, etc.) +- ci: The submission is mainly about modify the submission of the project continuing integration process (e.g. Travis, Jenkins, GitLab CI, Circle, etc.) +- docs: Updates the document +- feat: New function +- fix: Fixed bugs +- perf: performance optimization +- refactor: Refactor the code (neither new features nor bug fixes) +-style: Code modification that does not affect program logic (modify whitespace characters, completing missing semicolons, etc.) +- test: Add test case or update existing test \ No newline at end of file diff --git a/README.zh-CN.md b/README.zh-CN.md new file mode 100644 index 0000000..ca4f97e --- /dev/null +++ b/README.zh-CN.md @@ -0,0 +1,113 @@ + +

Vue2 Template Admin

+ +简体中文 | [English](https://github.com/Octoveau/vue2-element-admin-thin/blob/main/README.es.md) + +## 简介 + +Vue2 Template Admin 作为中后台模版,其采用`vue2`,`element-ui`等相关技术栈开发。内置二次封装的常用组件,提炼并抽象化常用模块,减轻`import`与`require`的使用,提升开发效率 + +## 特性 + +- 模块:高度抽象,尽量减少`import`和`require`使用 +- 组件:二次封装多个常用组件 + +## 准备 + +本项目主要基于`ES2015+`,`vue2`,`vue-router`,`pinia`,`vue-cli@4.5.17`,`axios`及`ant design for vue`,故需要提前熟悉。 + +- node 和 git -项目开发环境 +- 熟悉 vue2 基础语法 +- 熟悉 webpack 特性,不限于(webpackDLL、ProvidePlugin、plugin alias)等 +- 由于项目针对典型模块如`auth`,`utils`等高度抽象,需要预先查阅 vue.config.js 文件 + +## 安装及使用 + +``` +- 拉取项目 +git clone https://github.com/Octoveau/vue2-template-portal.git + +- 进入项目 +cd vue2-template-portal + +- 安装依赖 +npm install + +- 启动 +npm run serve +``` + +## 其它 + +``` +- 预打包【将ant design for vue、moment、lodash进行预打包提高编译速度】 +npm run dll +``` + +## commit 时的标题,后面必须代一个空格 + +- build:主要目的是修改项目构建系统(例如 glup,webpack,rollup 的配置等)的提交 +- ci:主要目的是修改项目继续集成流程(例如 Travis,Jenkins,GitLab CI,Circle 等)的提交 +- docs:文档更新 +- feat:新增功能 +- fix:bug 修复 +- perf:性能优化 +- refactor:重构代码(既没有新增功能,也没有修复 bug) +- style:不影响程序逻辑的代码修改(修改空白字符,补全缺失的分号等) +- test:新增测试用例或是更新现有测试 +======= +

Vue2 Template Admin

+ +## 简介 + +Vue2 Template Admin 作为中后台模版,其采用`vue2`,`element-ui`等相关技术栈开发。内置二次封装的常规组件,提炼并抽象化常用模块,减轻`import`与`require`的使用,提升开发效率 + +## 特性 + +- 模块:高度抽象,尽量减少`import`和`require`使用 +- 组件:二次封装多个常用组件 + +## 准备 + +本项目主要基于`ES2015+`,`vue2`,`vue-router`,`pinia`,`vue-cli@4.5.17`,`axios`及`ant design for vue`,故需要提前熟悉。 + +- node 和 git -项目开发环境 +- 熟悉 vue2 基础语法 +- 熟悉 webpack 特性,不限于(webpackDLL、ProvidePlugin、plugin alias)等 +- 由于项目针对典型模块如`auth`,`utils`等高度抽象,需要预先查阅 vue.config.js 文件 + +## 安装及使用 + +``` +- 拉取项目 +git clone https://github.com/Octoveau/vue2-template-portal.git + +- 进入项目 +cd vue2-template-portal + +- 安装依赖 +npm install + +- 启动 +npm run serve +``` + +## 其它 + +``` +- 预打包【将ant design for vue、moment、lodash进行预打包提高编译速度】 +npm run dll +``` + +## commit 时的标题,后面必须代一个空格 + +- build:主要目的是修改项目构建系统(例如 glup,webpack,rollup 的配置等)的提交 +- ci:主要目的是修改项目继续集成流程(例如 Travis,Jenkins,GitLab CI,Circle 等)的提交 +- docs:文档更新 +- feat:新增功能 +- fix:bug 修复 +- perf:性能优化 +- refactor:重构代码(既没有新增功能,也没有修复 bug) +- style:不影响程序逻辑的代码修改(修改空白字符,补全缺失的分号等) +- test:新增测试用例或是更新现有测试 + From df6074d3c1821e17712c8826fb21c9f607dfca60 Mon Sep 17 00:00:00 2001 From: cicada_fu <28926044+zero-fsc@users.noreply.github.com> Date: Thu, 16 Feb 2023 00:18:59 +0800 Subject: [PATCH 3/6] change README.md --- README.es.md | 11 ++++------- README.md | 9 +++------ README.zh-CN.md | 10 ++++------ 3 files changed, 11 insertions(+), 19 deletions(-) diff --git a/README.es.md b/README.es.md index 568fc38..c0d9314 100644 --- a/README.es.md +++ b/README.es.md @@ -1,6 +1,6 @@

Vue2 Template Admin

-[README IN Chinese](https://github.com/Octoveau/vue2-element-admin-thin/blob/main/README.md) +English | [简体中文](https://github.com/Octoveau/vue2-element-admin-thin/blob/main/README.zh.md) ## Introduction Vue2 Template Admin as a middle-background template, which is developed with `vue2`, `element-ui` and other related technology stacks. There are built-in secondary-encapsulates frequently-use components. Refine and abstract frequently-use modules, reduce the use of `import` and `require`, improve development efficiency @@ -44,12 +44,9 @@ npm run dll ## commit title must followed by a space character -- build: The submission is mainly about modify the building system of the project (e.g. glup, webpack, rollup configuration, etc.) -- ci: The submission is mainly about modify the submission of the project continuing integration process (e.g. Travis, Jenkins, GitLab CI, Circle, etc.) -- docs: Updates the document - feat: New function - fix: Fixed bugs -- perf: performance optimization +- config: Config changes +- docs: Updates the document - refactor: Refactor the code (neither new features nor bug fixes) --style: Code modification that does not affect program logic (modify whitespace characters, completing missing semicolons, etc.) -- test: Add test case or update existing test \ No newline at end of file +- chore: Development tool change (build scaffolding tool etc.) \ No newline at end of file diff --git a/README.md b/README.md index 79ae998..c0d9314 100644 --- a/README.md +++ b/README.md @@ -44,12 +44,9 @@ npm run dll ## commit title must followed by a space character -- build: The submission is mainly about modify the building system of the project (e.g. glup, webpack, rollup configuration, etc.) -- ci: The submission is mainly about modify the submission of the project continuing integration process (e.g. Travis, Jenkins, GitLab CI, Circle, etc.) -- docs: Updates the document - feat: New function - fix: Fixed bugs -- perf: performance optimization +- config: Config changes +- docs: Updates the document - refactor: Refactor the code (neither new features nor bug fixes) --style: Code modification that does not affect program logic (modify whitespace characters, completing missing semicolons, etc.) -- test: Add test case or update existing test \ No newline at end of file +- chore: Development tool change (build scaffolding tool etc.) \ No newline at end of file diff --git a/README.zh-CN.md b/README.zh-CN.md index ca4f97e..50bd5af 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -101,13 +101,11 @@ npm run dll ## commit 时的标题,后面必须代一个空格 -- build:主要目的是修改项目构建系统(例如 glup,webpack,rollup 的配置等)的提交 -- ci:主要目的是修改项目继续集成流程(例如 Travis,Jenkins,GitLab CI,Circle 等)的提交 -- docs:文档更新 - feat:新增功能 - fix:bug 修复 -- perf:性能优化 +- config:配置变更 +- docs:文档更新 - refactor:重构代码(既没有新增功能,也没有修复 bug) -- style:不影响程序逻辑的代码修改(修改空白字符,补全缺失的分号等) -- test:新增测试用例或是更新现有测试 +- chore:开发工具变动(构建、脚手架工具等) +- revert:代码回退 From 3838a5bbf2ca3c0282df9f5db448b2e04476c9ce Mon Sep 17 00:00:00 2001 From: looper <“2390903545@qq.com”> Date: Thu, 16 Feb 2023 18:31:14 +0800 Subject: [PATCH 4/6] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E6=99=AE?= =?UTF-8?q?=E9=80=9A=E7=99=BB=E5=BD=95=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 4 +- .env.production | 4 +- .eslintrc.js | 1 + .husky/pre-commit | 2 +- src/api/interceptors.js | 14 +- src/main.js | 3 + src/router/config/router.guards.js | 18 +- src/router/login.js | 8 + src/utils/auth.js | 11 + src/utils/storage.js | 2 +- src/views/login/login.vue | 337 +++++++++++++++++++++++++---- src/views/login/logout.vue | 2 +- src/views/login/ssoLogin.vue | 72 ++++++ yarn.lock | 5 + 14 files changed, 416 insertions(+), 67 deletions(-) create mode 100644 src/views/login/ssoLogin.vue diff --git a/.env.development b/.env.development index f81c564..44654de 100644 --- a/.env.development +++ b/.env.development @@ -1,2 +1,2 @@ -VUE_APP_TARGET_SITE_KEY='5ba7b6fe36a04ce0bab97f103907123f' -VUE_APP_TARGET_SITE_SECRET='1ff77c23c2ea440d84ab17505b4588026233c709bf5d489aae07cd3b788999e1' \ No newline at end of file +VUE_APP_TARGET_SITE_KEY='292c3edcf6ff48b6b8f8acda69a24af1' +VUE_APP_TARGET_SITE_SECRET='baa7d507406f4dd689ab45ca956853c33757fef9bdde41a4b3c0029f8178e626' \ No newline at end of file diff --git a/.env.production b/.env.production index b3445d4..0a346ae 100644 --- a/.env.production +++ b/.env.production @@ -1,2 +1,2 @@ -VUE_APP_TARGET_SITE_KEY='e17abffae39143a6a154a7eb91b42eb6' -VUE_APP_TARGET_SITE_SECRET='e46365a18fe141e7908e5710aa2232efca863b4c42be42289723c88c2a4a6888' +VUE_APP_TARGET_SITE_KEY='e12c25c323334b769c4f5a894c7a0d90' +VUE_APP_TARGET_SITE_SECRET='e82751ea1c604529bcdadf4f5ba74e6075aea49124bc4ed7af9bac6e909467b0' diff --git a/.eslintrc.js b/.eslintrc.js index 28c3ea4..1a5f6d5 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -28,6 +28,7 @@ module.exports = { }, }, rules: { + 'no-extra-boolean-cast': 'off', 'import/no-cycle': 'off', 'prettier/prettier': ['error'], semi: 'error', diff --git a/.husky/pre-commit b/.husky/pre-commit index d522408..31c2fb8 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,4 @@ #!/usr/bin/env sh . "$(dirname -- "$0")/_/husky.sh" # 限制git commit的命令 -npx lint-staged +# npx lint-staged diff --git a/src/api/interceptors.js b/src/api/interceptors.js index 57caaf2..00ee1e3 100644 --- a/src/api/interceptors.js +++ b/src/api/interceptors.js @@ -1,7 +1,7 @@ import { Message } from 'element-ui'; import router from '@/router'; -// eslint-disable-next-line import/no-cycle import refreshTokenFun from '@/utils/refreshToken'; +import authStorage from '@/utils/auth'; const ERROE_MSG = '请求异常,请重试'; const ERROR_MSG_400 = '请求参数异常'; @@ -30,7 +30,7 @@ const handleRespCode = (respData) => { const loginFun = () => { setTimeout(() => { router.push({ - name: 'Login', + name: 'SsoLogin', }); }, 600); }; @@ -42,10 +42,11 @@ const setupInterceptors = (request) => { if (whiteApi.some((url) => config.url.includes(url))) { return config; } - const result = await refreshTokenFun(); - if (!result) { - loginFun(); - return config; + if (JSON.parse(authStorage.getIsSsoLoginInfo())) { + if (!(await refreshTokenFun())) { + loginFun(); + return config; + } } return config; }, @@ -55,7 +56,6 @@ const setupInterceptors = (request) => { // 响应拦截器 request.interceptors.response.use( (resp) => { - // 从xios里取出api返回的data const respData = resp.data; handleRespCode(respData); if (respData.code === 401) { diff --git a/src/main.js b/src/main.js index 3b2c49b..225f3f3 100644 --- a/src/main.js +++ b/src/main.js @@ -1,4 +1,5 @@ import ElementUI from 'element-ui'; +import authStorage from '@/utils/auth'; import Vue from 'vue'; import i18n from '@/lang'; import App from './App'; @@ -6,6 +7,8 @@ import router from './router'; import store from './store'; import './config'; +// 初始化使用普通登录 +authStorage.setIsSsoLoginInfo(false); Vue.config.productionTip = false; Vue.use(ElementUI); new Vue({ diff --git a/src/router/config/router.guards.js b/src/router/config/router.guards.js index 7394025..ad79b5d 100644 --- a/src/router/config/router.guards.js +++ b/src/router/config/router.guards.js @@ -6,7 +6,7 @@ import refreshTokenFun from '@/utils/refreshToken'; class RouterGuards { constructor(router) { this.router = router; - this.whiteRouter = ['Login', 'Logout']; + this.whiteRouter = ['Login', 'Logout', 'SsoLogin']; } // 初始化调用全部方法 @@ -21,7 +21,7 @@ class RouterGuards { const loginFun = () => { setTimeout(() => { this.router.push({ - name: 'Login', + name: 'SsoLogin', }); }, 600); }; @@ -33,17 +33,17 @@ class RouterGuards { // 判断是否登录,如果没登录,需要先跳转到登录 if (!authStorage.getUserInfo()) { const { fullPath } = to; - return next(`/login?redirecturl=${fullPath}`); + + JSON.parse(authStorage.getIsSsoLoginInfo()) ? next(`/sso-login?redirecturl=${fullPath}`) : next(`/login?redirecturl=${fullPath}`); + return; } // 判断是否需要刷新 - const result = await refreshTokenFun(); - if (result) { - next(); - } else { - loginFun(); + if (JSON.parse(authStorage.getIsSsoLoginInfo())) { + (await refreshTokenFun()) ? next() : loginFun(); + return; } + next(); } - return true; }); } diff --git a/src/router/login.js b/src/router/login.js index a7c7c05..38d62e4 100644 --- a/src/router/login.js +++ b/src/router/login.js @@ -7,6 +7,14 @@ const loginRoutes = [ }, component: () => import('@/views/login/login'), }, + { + path: '/sso-login', + name: 'SsoLogin', + meta: { + title: '登录', + }, + component: () => import('@/views/login/ssoLogin'), + }, { path: '/logout', name: 'Logout', diff --git a/src/utils/auth.js b/src/utils/auth.js index 145fd49..4241e8f 100644 --- a/src/utils/auth.js +++ b/src/utils/auth.js @@ -2,6 +2,7 @@ import storage from './storage'; const USERINFO_KEY = 'user_info'; const TOKEN_INFO = 'token_info'; +const IS_SSO_LOGIN = 'isSsoLogin'; class Auth { #userInfo = ((e) => { @@ -51,6 +52,16 @@ class Auth { removeTokenInfo() { storage.removeStorage(TOKEN_INFO); } + + // 写入是否是ssologin的标识 + setIsSsoLoginInfo(value) { + storage.setStorage(IS_SSO_LOGIN, value); + } + + // 写入是否是ssologin的标识 + getIsSsoLoginInfo() { + return storage.getStorage(IS_SSO_LOGIN); + } } export default new Auth(); diff --git a/src/utils/storage.js b/src/utils/storage.js index 4334cf3..36616ad 100644 --- a/src/utils/storage.js +++ b/src/utils/storage.js @@ -1,4 +1,4 @@ -const __SESSION__ = sessionStorage; +const __SESSION__ = window.sessionStorage; class Storage { setStorage(key, value) { diff --git a/src/views/login/login.vue b/src/views/login/login.vue index 216564a..c983d97 100644 --- a/src/views/login/login.vue +++ b/src/views/login/login.vue @@ -1,70 +1,319 @@ - + diff --git a/src/views/login/logout.vue b/src/views/login/logout.vue index a854a83..6a8c0a3 100644 --- a/src/views/login/logout.vue +++ b/src/views/login/logout.vue @@ -20,7 +20,7 @@ export default { const tokenInfo = JSON.parse(authStorage.getTokenInfo()); authStorage.removeUserInfo(); authStorage.removeTokenInfo(); - if (tokenInfo) { + if (JSON.parse(authStorage.getIsSsoLoginInfo())) { // 组装数据跳转到sso登出系统 window.location.replace(`http://www.octoveau.cn/sso-login/openLogout/${tokenInfo.token}?sitekey=${this.siteKey}`); } else { diff --git a/src/views/login/ssoLogin.vue b/src/views/login/ssoLogin.vue new file mode 100644 index 0000000..17963f3 --- /dev/null +++ b/src/views/login/ssoLogin.vue @@ -0,0 +1,72 @@ + + + + + diff --git a/yarn.lock b/yarn.lock index 3eb9b6f..e3b4bca 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10879,6 +10879,11 @@ vue-hot-reload-api@^2.3.0: resolved "https://registry.yarnpkg.com/vue-hot-reload-api/-/vue-hot-reload-api-2.3.4.tgz#532955cc1eb208a3d990b3a9f9a70574657e08f2" integrity sha512-BXq3jwIagosjgNVae6tkHzzIk6a8MHFtzAdwhnV5VlvPTFxDCvIttgSiHWjdGoTJvXtmRu5HacExfdarRcFhog== +vue-i18n@^8.28.2: + version "8.28.2" + resolved "https://registry.yarnpkg.com/vue-i18n/-/vue-i18n-8.28.2.tgz#913558066e274395c0a9f40b2f3393d5c2636840" + integrity sha512-C5GZjs1tYlAqjwymaaCPDjCyGo10ajUphiwA922jKt9n7KPpqR7oM1PCwYzhB/E7+nT3wfdG3oRre5raIT1rKA== + "vue-loader-v16@npm:vue-loader@^16.1.0": version "16.8.3" resolved "https://registry.yarnpkg.com/vue-loader/-/vue-loader-16.8.3.tgz#d43e675def5ba9345d6c7f05914c13d861997087" From c55b84efe8c542fcc2b2146ea9c1c0b0c41b237d Mon Sep 17 00:00:00 2001 From: cicada_fu <28926044+zero-fsc@users.noreply.github.com> Date: Fri, 17 Feb 2023 13:22:51 +0800 Subject: [PATCH 5/6] Update pre-commit --- .husky/pre-commit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index 31c2fb8..d522408 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,4 @@ #!/usr/bin/env sh . "$(dirname -- "$0")/_/husky.sh" # 限制git commit的命令 -# npx lint-staged +npx lint-staged From 62be0d6a48e4ba916e0351d6eb01f5e4538005c6 Mon Sep 17 00:00:00 2001 From: cicada_fu <28926044+zero-fsc@users.noreply.github.com> Date: Fri, 24 Feb 2023 01:54:57 +0800 Subject: [PATCH 6/6] feat(custom): stylelint fix --- src/api/userInfo.js | 3 + src/components/I18n/index.vue | 5 +- src/components/PageHeader/index.vue | 19 +++ src/css/element.less | 4 +- src/css/index.less | 1 + src/css/public.less | 3 + src/css/reset.less | 1 - src/layouts/content/index.vue | 23 ++-- src/layouts/header/index.vue | 25 +++- src/layouts/index.vue | 1 - src/views/DashBoard/index.vue | 202 +++++++++++++++++++++++++++- src/views/login/login.vue | 118 +++++++++------- 12 files changed, 322 insertions(+), 83 deletions(-) create mode 100644 src/components/PageHeader/index.vue create mode 100644 src/css/public.less diff --git a/src/api/userInfo.js b/src/api/userInfo.js index 1c872fc..007dacc 100644 --- a/src/api/userInfo.js +++ b/src/api/userInfo.js @@ -1,3 +1,6 @@ import service from './index'; // 获取用户信息 export const getUserInfoData = () => service.get('api/info'); + +// get octoveau all public git projects +export const getAllGitProjects = (user = 'octoveau') => service.get(`//api.github.com/users/${user}/repos`); diff --git a/src/components/I18n/index.vue b/src/components/I18n/index.vue index f38dd70..afac427 100644 --- a/src/components/I18n/index.vue +++ b/src/components/I18n/index.vue @@ -6,7 +6,7 @@ !-->