chore: globalconfig edit (#25)

* chore: globalconfig edit

* chore: mv stylelint-config-prettier to devdep

* feat: add vscode config

* fix: lint fix

* feat: update base url
This commit is contained in:
PY 2021-12-13 11:44:18 +08:00 committed by GitHub
parent 7fe368c874
commit 4f77a18b2a
12 changed files with 72 additions and 52 deletions

2
.gitignore vendored
View File

@ -1,7 +1,5 @@
node_modules
.vscode
.DS_Store
.vscode
# build files
es/

4
.husky/commit-msg Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npx --no-install commitlint -e $GIT_PARAMS

4
.husky/pre-commit Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npx lint-staged

3
.vscode/extensions.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"recommendations": ["dbaeumer.vscode-eslint"]
}

24
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,24 @@
{
"eslint.format.enable": true,
"eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact", "vue"],
"[vue]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[typescriptreact]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[javascriptreact]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[typescript]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[javascript]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
}
}

View File

@ -1,5 +1,5 @@
# 选择一个 Base 镜像
FROM node:12
FROM node:14
# 设置工作目录
WORKDIR /space

View File

@ -10,7 +10,8 @@
"lint": "eslint --ext .vue,.js,.jsx,.ts,.tsx ./ --max-warnings 0",
"lint:fix": "eslint --ext .vue,.js,jsx,.ts,.tsx ./ --max-warnings 0 --fix",
"stylelint": "stylelint src/**/*.{html,vue,sass,less}",
"stylelint:fix": "stylelint --cache --fix src/**/*.{html,vue,vss,sass,less}"
"stylelint:fix": "stylelint --fix src/**/*.{html,vue,vss,sass,less}",
"prepare": "husky install"
},
"dependencies": {
"dayjs": "^1.10.6",
@ -25,7 +26,7 @@
},
"devDependencies": {
"@commitlint/cli": "^15.0.0",
"@commitlint/config-conventional": "^13.1.0",
"@commitlint/config-conventional": "^15.0.0",
"@types/echarts": "^4.9.10",
"@types/ws": "^8.2.2",
"@typescript-eslint/eslint-plugin": "^4.29.3",
@ -42,20 +43,19 @@
"eslint-plugin-import": "^2.24.2",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-vue": "^8.2.0",
"http-proxy-agent": "^4.0.1",
"http-proxy-agent": "^5.0.0",
"husky": "^7.0.4",
"less": "^4.1.1",
"lint-staged": "^12.1.2",
"mockjs": "^1.1.0",
"postcss-less": "^5.0.0",
"prettier": "^2.4.1",
"stylelint": "^14.1.0",
"stylelint-config-standard": "^24.0.0",
"stylelint": "^13.13.1",
"stylelint-config-prettier": "^9.0.3",
"stylelint-less": "^1.0.1",
"stylelint-order": "^4.1.0",
"stylelint-scss": "^4.0.0",
"typescript": "^4.4.3",
"vite": "^2.7.1",
"vite-plugin-mock": "^2.9.6",
"vite-plugin-svg-sprite-component": "^1.0.10",
"vite-svg-loader": "^3.1.0",
"vue-clipboard3": "^1.0.1",
"vue-tsc": "^0.29.8"
@ -65,22 +65,15 @@
"path": "./node_modules/cz-conventional-changelog"
}
},
"husky": {
"hooks": {
"pre-commit": "lint-staged",
"prepare-commit-msg": "exec < /dev/tty && git cz --hook || true",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
"lint-staged": {
"*.{js,jsx,vue,ts,tsx}": [
"prettier --write",
"npm run lint:fix",
"git add"
"git add ."
],
"*.{html,vue,vss,sass,less}": [
"npm run stylelint:fix",
"git add"
"git add ."
]
}
}

View File

@ -9,7 +9,7 @@
>
<template v-if="type == 'password'">
<t-form-item name="account">
<t-input v-model="formData.account" size="large" placeholder="请输入您的账号:td">
<t-input v-model="formData.account" size="large" placeholder="请输入您的账号">
<template #prefix-icon>
<t-icon name="user" />
</template>
@ -22,7 +22,7 @@
size="large"
:type="showPsw ? 'text' : 'password'"
clearable
placeholder="请输入登录密码:main_/dev_"
placeholder="请输入登录密码"
>
<template #prefix-icon>
<t-icon name="lock-on" />
@ -43,7 +43,7 @@
<template v-else-if="type == 'qrcode'">
<div class="tip-container">
<span class="tip">请使用微信扫一扫登录</span>
<span class="refresh">刷新 <t-icon name="refresh" color="#0052D9" /> </span>
<span class="refresh">刷新 <t-icon name="refresh" /> </span>
</div>
<qrcode-vue value="" :size="192" level="H" />
</template>

View File

@ -86,6 +86,7 @@
.t-icon {
font-size: 14px;
margin-left: 4px;
}
&:hover {

View File

@ -36,27 +36,28 @@ const getters = {
const actions = {
async login({ commit }, userInfo) {
const mockLogin = async (userInfo) => {
const { account, password } = userInfo;
if (account !== 'td') {
return {
code: 401,
message: '账号不存在',
};
}
if (['main_', 'dev_'].indexOf(password) === -1) {
return {
code: 401,
message: '密码错误',
};
}
const token = {
main_: 'main_token',
dev_: 'dev_token',
}[password];
console.log(userInfo);
// const { account, password } = userInfo;
// if (account !== 'td') {
// return {
// code: 401,
// message: '账号不存在',
// };
// }
// if (['main_', 'dev_'].indexOf(password) === -1) {
// return {
// code: 401,
// message: '密码错误',
// };
// }
// const token = {
// main_: 'main_token',
// dev_: 'dev_token',
// }[password];
return {
code: 200,
message: '登陆成功',
data: token,
data: 'main_token',
};
};

View File

@ -1,14 +1,5 @@
module.exports = {
defaultSeverity: 'error',
extends: ['stylelint-config-standard'],
plugin: ['stylelint-less'],
rules: {
'max-nesting-depth': 10,
'string-quotes': 'single',
'selector-class-pattern': null,
'no-descending-specificity': null,
'font-family-no-missing-generic-family-keyword': null,
'font-family-name-quotes': null,
'no-invalid-double-slash-comments': null,
},
extends: ['stylelint-config-prettier'],
plugins: ['stylelint-less'],
};

View File

@ -8,6 +8,7 @@ import path from 'path';
// https://vitejs.dev/config/
export default defineConfig({
base: './',
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),