Skip to content

Commit

Permalink
Merge pull request #28 from Octoveau/dev
Browse files Browse the repository at this point in the history
sync dev
  • Loading branch information
zero-fsc authored Feb 3, 2023
2 parents 66e65d0 + 1279fca commit 5aa0857
Show file tree
Hide file tree
Showing 11 changed files with 11,428 additions and 14 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ module.exports = {
'vue/no-reserved-component-names': 'off',
'import/extensions': ['error', { vue: 'never' }],
'vue/multi-word-component-names': 'off',
'no-unused-expressions': 'off',
// 特别注意:vue/order-in-components,此规则用于矫正vue文件结构顺序乱写问题
'vue/order-in-components': [
'error',
Expand Down
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
. "$(dirname -- "$0")/_/husky.sh"

# 限制git commit的命令
npx lint-staged
npx lint-staged
2 changes: 1 addition & 1 deletion .stylelintignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
*.ttf
*.woff
*.woff2
assets/
assets/
2 changes: 1 addition & 1 deletion .stylelintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ module.exports = {
customSyntax: 'postcss-html',
},
],
ignoreFiles: ['**/*.js', '**/*.jsx', '**/*.tsx', '**/*.ts', '**/*.json', '**/*.md', '**/*.yaml'],
rules: {
'no-descending-specificity': null, // 禁止在具有较高优先级的选择器后出现被其覆盖的较低优先级的选择器
'no-duplicate-selectors': null,
Expand All @@ -22,6 +21,7 @@ module.exports = {
'declaration-block-trailing-semicolon': null,
'string-quotes': null,
'color-function-notation': 'legacy',
'declaration-block-single-line-max-declarations': null,
'selector-pseudo-element-no-unknown': [
true,
{
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"build": "vue-cli-service build",
"lint": "eslint --fix --ext .js,.vue src",
"lint:fix": "eslint --fix --ext .js,.vue --fix src",
"lint:style": "stylelint \"./**/*.{css,less,vue,html}\" --fix src",
"lint:style": "stylelint --fix .css, .less, .vue, .html --fix src",
"dll": "webpack --config ./webpack/webpack.dll.js",
"prepare": "husky install",
"commit": "git-cz"
Expand Down
1 change: 0 additions & 1 deletion src/api/userInfo.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import service from './index';

// 获取用户信息
export const getUserInfoData = () => service.get('api/info');
4 changes: 3 additions & 1 deletion src/router/config/router.guards.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@ class RouterGuards {

beforeEach() {
return this.router.beforeEach((to, from, next) => {
console.log('to', to);
NProgress.start();
// 判断是否是白名单,白名单不需要进行登录验证
if (this.whiteRouter.includes(to.name)) {
next();
} else {
// 判断是否登录,如果没登录,需要先跳转到登录
if (!authStorage.getUserInfo()) {
return next(`/login`);
const { fullPath } = to;
return next(`/login?redirecturl=${fullPath}`);
}
next();
}
Expand Down
3 changes: 1 addition & 2 deletions src/utils/auth.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import storage from './storage';

const USERINFO_KEY = 'user_info';
const TOKEN_INFO = 'user_info';
const TOKEN_INFO = 'token_info';

class Auth {
#userInfo = ((e) => {
console.log('e', e);
if (!e) {
return null;
}
Expand Down
14 changes: 11 additions & 3 deletions src/views/login/login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,22 @@ export default {
this.getUserInfo(res.data.token);
}
});
} else {
// 需要跳转到单点登录平台
window.location.replace(`http://www.octoveau.cn/sso-login/openLogin/${this.loginConfig.siteKey}`);
return;
}
// 需要跳转到单点登录平台
const fullPath = this.$route.query.redirecturl;
fullPath
? window.location.replace(`http://www.octoveau.cn/sso-login/openLogin/${this.loginConfig.siteKey}?redirecturl=${fullPath}`)
: window.location.replace(`http://www.octoveau.cn/sso-login/openLogin/${this.loginConfig.siteKey}`);
},
getUserInfo(token) {
getUserInfoByToken(token).then((res) => {
authStorage.setUserInfo(res.data);
const fullPath = this.$route.query.redirecturl;
if (fullPath) {
this.$router.push(`${fullPath}`);
return;
}
this.$router.push({
name: 'DashBoard',
});
Expand Down
11 changes: 8 additions & 3 deletions vue.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@
}
],
"settings": {
// "editor.fontWeight": "600", //字体粗细
// "editor.fontSize": 16, //字体大小
"breadcrumbs.enabled": true, //内容上方的面包屑
"editor.formatOnPaste": true, //复制时候自动格式化
"editor.accessibilityPageSize": 12, //屏幕阅读器的可视区域
"editor.tabCompletion": "on", //tab的最佳补全
"editor.detectIndentation": true, //检测文件是否启动tabsize
"editor.tabSize": 2,
"eslint.enable": true,
"workbench.colorTheme": "Palenight Theme",
"window.zoomLevel": 1,
"workbench.iconTheme": "material-icon-theme",
"explorer.confirmDelete": false,
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
Expand Down
Loading

0 comments on commit 5aa0857

Please sign in to comment.