Commit e81524e4 authored by huanglu's avatar huanglu

init

parents
> 1%
last 2 versions
not dead
[*.{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 = 100
VUE_APP_API_HOST = ''
VUE_APP_API_HOST = ''
\ No newline at end of file
VUE_APP_API_HOST = ''
\ No newline at end of file
/public
/mock
/config/
/dist
/node_modules/
/*.js
module.exports = {
root: true,
env: {
node: true,
},
extends: [
'plugin:vue/essential',
'@vue/airbnb',
],
parserOptions: {
parser: 'babel-eslint',
},
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'comma-dangle': 0,
'comma-spacing': 0,// 逗号前后的空格
'comma-style': [2, 'last'],// 逗号风格,换行时在行首还是行尾
quotes: [1, 'single'],
eqeqeq: 2,
'no-var': 1,
'key-spacing': [2, { beforeColon: false, afterColon: true }],// 对象字面量中冒号的前后空格
semi: 0,
'semi-spacing': [0, { before: false, after: true }], // 分号前后空格,
'use-isnan': 2, // 禁止比较时使用NaN,只能用isNaN()
'prefer-promise-reject-errors': 0,
'no-param-reassign': 0,
'no-unused-vars': 1,
'no-shadow': 0,
'import/extensions': 0,
'import/prefer-default-export': 1,
'eol-last': 0,
'object-curly-spacing': 0,
'padded-blocks': 0,
'no-trailing-spaces': 0
},
};
.DS_Store
node_modules
/dist
plugins/*
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
{
"types": ["feat", "fix", "docs", "style", "refactor", "perf", "test", "build", "ci", "chore", "revert"],
"scope": {
"required": false,
"allowed": ["*"],
"validate": false,
"multiple": false
},
"warnOnFail": false,
"maxSubjectLength": 100,
"subjectPattern": ".+",
"subjectPatternErrorMsg": "subject does not match subject pattern!",
"helpMessage": "",
"autoFix": false
}
\ No newline at end of file
# 配置说明
## 使用方法:
- 通过 git 直接 克隆到本地,然后删除 .git 文件夹目录, 修改 package.json的name等数据(不建议)
- 通过 fastgeek create 命令创建项目
- 目录结构
- 在 src/views 目录下创建路由文件
- 路由建议通过 名称/ index.vue 的方式创建
- 在 src/store/modules 文件夹下创建 全局状态数据,且创建后,可以自动注入到全局状态中, 状态的命名即文件名,所有文件名建议不要使用 [store].js 的格式
- 在 src/global 下的文件是全局样式文件
- common.less 放在一些全局的函数、mixins、公共的样式等, 如 border, rpx() 等
- variable.less 放一些全局的样式变量,如颜色,大小等
- 在 src/constant 目录下,放置 一些全局变量, 并统一使用 该 目录下的 index.js 导出
- 在 src/component 放置全局组件, 如果非全局组件,建议放在对应的路由目录的 component 目录下,并统一在 component / index.js 统一导出
- 在 src/ router 文件中,配置路由,建议使用懒加载
- 在根目录中的 public 目录下,可以保存不需要 webpack 编译的文件
- 根目录下 config 目录下进行项目配置(一般不需要再配置)
- mock目录下可以编写mock数据
## router / request base url 请自行配置
\ No newline at end of file
const plugins = [
[
"component",
{
"libraryName": "element-ui",
"styleLibraryName": "theme-chalk"
}
]
]
if (process.env.NODE_ENV === 'production') {
plugins.push(
[
"transform-remove-console",
{
exclude: [ "error", "warn" ]
}
]
)
}
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset',
],
plugins: plugins
};
const path = require('path');
const util = require('./util');
const { proxyUrl } = require('./index');
console.log("===============build config==================");
const BUILD_INFO = {
branch: process.env["npm_config_app_build_branch"] || '',
commit: process.env["npm_config_app_build_commit"] || '',
tag: process.env["npm_config_app_build_tag"] || '',
time: process.env["npm_config_app_build_time"] || '',
isAlert: process.env["npm_config_app_build_alert"] || 'false',
version: process.env["npm_config_app_version"] || '',
isRelease: process.env["npm_config_app_isRelease"] || 'false',
description: process.env["npm_config_app_description"] || ''
};
console.log(BUILD_INFO)
const VUE_APP_PROXYURL = proxyUrl
console.log('===============build config end==================')
const localEnv = path.join(__dirname, '..', '.env.local')
util.writeTxtToFile(`VUE_APP_BUILD_INFO=${JSON.stringify(BUILD_INFO)}\nVUE_APP_PROXYURL=${VUE_APP_PROXYURL}`, localEnv)
const proxyUrl = 'http://192.168.32.30:3000'
const agentList = {
'/': {
target: proxyUrl,
}
}
module.exports = {
proxy: {
...agentList
},
publicPath: '/gk-online',
outputDir: 'gk-online'
}
\ No newline at end of file
const path = require('path')
const fs = require('fs')
const resolve = (dir) => {
return path.join(__dirname, '..', dir)
}
const multiPages = () => {
const pagesPath = path.join(__dirname, '../src/pages')
const pages = {}
console.log(pagesPath)
if(fs.existsSync(pagesPath)) {
const files = fs.readdirSync(pagesPath)
console.log(files)
files.forEach(item => {
const fileName = item.split('.')[0];
pages[fileName] = `src/pages/${fileName}/index.js`
})
} else {
return null
}
return pages
}
const configProxy = (proxy) => {
const uris = Object.keys(proxy)
const proxys = uris.map(uri => ({
[`/api${[uri]}`]: {
...proxy[uri],
bypass: (req, res) => {
res.header('x-target-url', (proxy[uri] || {}).target)
},
changeOrigin: true,
pathRewrite: {"^/api" : ""}
}
})).reduce((pre, current) => {
return {
...pre,
...current
}
}, {})
return proxys
}
const writeTxtToFile = (txt, file) => {
try {
fs.writeFileSync(file, txt, {
encoding: 'utf-8'
})
} catch (error) {
}
}
const readFile = (file) => {
if (fs.existsSync(file)) {
const data = fs.readFileSync(file, 'utf-8')
return data
}
return null
}
module.exports = {
multiPages,
configProxy,
writeTxtToFile,
readFile,
resolve
}
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["src/*"],
}
}
}
\ No newline at end of file
module.exports = {
'/userinfo': (req, res) => {
setTimeout(() => {
res.json({
code: 1,
message: '',
data: 'this is hello apisssfafafassss555555',
});
}, 1000);
},
'/hello': {
code: 1,
message: '',
data: 'this is hello api',
},
'POST /login': {
code: 1,
message: '',
data: 'this is hello api',
},
};
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment