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/.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.es.md b/README.es.md new file mode 100644 index 0000000..c0d9314 --- /dev/null +++ b/README.es.md @@ -0,0 +1,52 @@ +

Vue2 Template Admin

+ +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 + +## 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 + +- feat: New function +- fix: Fixed bugs +- config: Config changes +- docs: Updates the document +- refactor: Refactor the code (neither new features nor bug fixes) +- chore: Development tool change (build scaffolding tool etc.) \ No newline at end of file diff --git a/README.md b/README.md index 431bee4..c0d9314 100644 --- a/README.md +++ b/README.md @@ -1,54 +1,52 @@ -

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:新增测试用例或是更新现有测试 +

Vue2 Template Admin

+ +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 + +## 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 + +- feat: New function +- fix: Fixed bugs +- config: Config changes +- docs: Updates the document +- refactor: Refactor the code (neither new features nor bug fixes) +- 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 new file mode 100644 index 0000000..50bd5af --- /dev/null +++ b/README.zh-CN.md @@ -0,0 +1,111 @@ + +

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 时的标题,后面必须代一个空格 + +- feat:新增功能 +- fix:bug 修复 +- config:配置变更 +- docs:文档更新 +- refactor:重构代码(既没有新增功能,也没有修复 bug) +- chore:开发工具变动(构建、脚手架工具等) +- revert:代码回退 + 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/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 @@ !-->