forked from TALL/tall3-pc-keti
12 changed files with 5492 additions and 3486 deletions
@ -0,0 +1,8 @@ |
|||||
|
[*.{js,jsx,ts,tsx,vue}] |
||||
|
indent_style = space |
||||
|
indent_size = 2 |
||||
|
end_of_line = lf |
||||
|
trim_trailing_whitespace = true |
||||
|
insert_final_newline = true |
||||
|
max_line_length = 140 |
||||
|
root = true |
@ -0,0 +1,9 @@ |
|||||
|
node_modules |
||||
|
dist/ |
||||
|
test |
||||
|
build/ |
||||
|
babel.config.js |
||||
|
package.json |
||||
|
postcss.config.js |
||||
|
.eslintrc.js |
||||
|
vue.config.js |
@ -0,0 +1,50 @@ |
|||||
|
module.exports = { |
||||
|
env: { |
||||
|
browser: true, |
||||
|
es2021: true, |
||||
|
}, |
||||
|
extends: ['plugin:vue/essential', 'airbnb-base', 'plugin:prettier/recommended'], |
||||
|
parserOptions: { |
||||
|
ecmaVersion: 10, |
||||
|
sourceType: 'module', |
||||
|
}, |
||||
|
plugins: ['vue'], |
||||
|
rules: { |
||||
|
'vue/html-self-closing': 'off', |
||||
|
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off', |
||||
|
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off', |
||||
|
'no-param-reassign': 'off', |
||||
|
'max-len': ['error', { code: 140, tabWidth: 2 }], |
||||
|
'object-curly-newline': ['error', { multiline: true }], |
||||
|
'arrow-parens': ['error', 'as-needed'], |
||||
|
'linebreak-style': 'off', |
||||
|
'vue/attributes-order': 'off', |
||||
|
'vue/singleline-html-element-content-newline': 'off', |
||||
|
'vue/max-attributes-per-line': 'off', |
||||
|
'vue/multiline-html-element-content-newline': 'off', |
||||
|
'vue/html-indent': 'off', |
||||
|
'vue/html-closing-bracket-newline': [ |
||||
|
'error', |
||||
|
{ |
||||
|
singleline: 'never', |
||||
|
multiline: 'always', |
||||
|
}, |
||||
|
], |
||||
|
}, |
||||
|
|
||||
|
overrides: [ |
||||
|
{ |
||||
|
files: ['**/__tests__/*.{j,t}s?(x)'], |
||||
|
env: { jest: true }, |
||||
|
}, |
||||
|
], |
||||
|
|
||||
|
globals: { |
||||
|
Vue: true, |
||||
|
VueRouter: true, |
||||
|
Vuex: true, |
||||
|
axios: true, |
||||
|
_: true, |
||||
|
uni: true, |
||||
|
}, |
||||
|
}; |
@ -0,0 +1,4 @@ |
|||||
|
#!/bin/sh |
||||
|
. "$(dirname "$0")/_/husky.sh" |
||||
|
|
||||
|
npx lint-staged |
@ -0,0 +1,13 @@ |
|||||
|
{ |
||||
|
"printWidth": 140, |
||||
|
"singleQuote": true, |
||||
|
"semi": true, |
||||
|
"trailingComma": "all", |
||||
|
"arrowParens": "avoid", |
||||
|
"tabWidth": 2, |
||||
|
"useTabs": false, |
||||
|
"bracketSpacing": true, |
||||
|
"jsxBracketSameLine": false, |
||||
|
"proseWrap": "always", |
||||
|
"endOfLine": "lf" |
||||
|
} |
@ -0,0 +1 @@ |
|||||
|
module.exports = { extends: ['./node_modules/vue-cli-plugin-commitlint/lib/lint'] }; |
File diff suppressed because it is too large
@ -0,0 +1,39 @@ |
|||||
|
import Axios from 'axios'; |
||||
|
import { ElMessage } from 'element-plus'; |
||||
|
|
||||
|
const baseUrl = 'http://api.github.com'; |
||||
|
|
||||
|
const instance = Axios.create({ |
||||
|
baseUrl, |
||||
|
timeout: 20000, |
||||
|
}); |
||||
|
|
||||
|
// request
|
||||
|
instance.interceptors.request.use( |
||||
|
response => { |
||||
|
return response; |
||||
|
}, |
||||
|
error => { |
||||
|
return Promise.reject(error); |
||||
|
}, |
||||
|
); |
||||
|
|
||||
|
// response
|
||||
|
instance.interceptors.response.use( |
||||
|
response => { |
||||
|
return response; |
||||
|
}, |
||||
|
error => { |
||||
|
if (error.response && error.response.data) { |
||||
|
const code = error.response.status; |
||||
|
const msg = error.response.data.message; |
||||
|
ElMessage.error(`Code: ${code}, Message: ${msg}`); |
||||
|
console.error(`[Axios Error]`, error.response); |
||||
|
} else { |
||||
|
ElMessage.error(`${error}`); |
||||
|
} |
||||
|
return Promise.reject(error); |
||||
|
}, |
||||
|
); |
||||
|
|
||||
|
export default instance; |
File diff suppressed because it is too large
Loading…
Reference in new issue