Skip to content

Commit ec54d9b

Browse files
committed
feat: Qiniu cdn spedding
1 parent 869febe commit ec54d9b

File tree

9 files changed

+62
-352
lines changed

9 files changed

+62
-352
lines changed

front/.eslintrc.js

Lines changed: 1 addition & 344 deletions
Original file line numberDiff line numberDiff line change
@@ -28,349 +28,6 @@ module.exports = {
2828
// add your custom rules here
2929
//it is base on https://github.com/vuejs/eslint-config-vue
3030
rules: {
31-
// 定义对象的set存取器属性时,强制定义get
32-
'accessor-pairs': 2,
33-
// =>的前后空格
34-
'arrow-spacing': [
35-
2,
36-
{
37-
before: true,
38-
after: true
39-
}
40-
],
41-
//如果代码块是单行的时候,代码块内部前后需要留一个空格
42-
'block-spacing': [2, 'always'],
43-
// if while function 后面的{必须与if在同一行,java风格。
44-
'brace-style': [
45-
0,
46-
'1tbs',
47-
{
48-
allowSingleLine: true
49-
}
50-
],
51-
camelcase: [
52-
0,
53-
{
54-
properties: 'always'
55-
}
56-
],
57-
// 数组和对象键值对最后一个逗号, never参数:不能带末尾的逗号, always参数:必须带末尾的逗号,
58-
// always-multiline:多行模式必须带逗号,单行模式不能带逗号
59-
'comma-dangle': [2, 'never'],
60-
// 控制逗号前后的空格
61-
'comma-spacing': [
62-
2,
63-
{
64-
before: false,
65-
after: true
66-
}
67-
],
68-
// 控制逗号在行尾出现还是在行首出现
69-
'comma-style': [2, 'last'],
70-
// 强制在子类构造函数中用super()调用父类构造函数,TypeScrip的编译器也会提示
71-
'constructor-super': 2,
72-
curly: [2, 'multi-line'],
73-
// 强制object.key 中 . 的位置,参数:
74-
// property,'.'号应与属性在同一行
75-
// object, '.' 号应与对象名在同一行
76-
'dot-location': [2, 'property'],
77-
'eol-last': 2,
78-
// 使用 === 替代 ==
79-
eqeqeq: [1, 'allow-null'],
80-
//生成器函数*的前后空格
81-
'generator-star-spacing': [
82-
2,
83-
{
84-
before: true,
85-
after: true
86-
}
87-
],
88-
//缩进风格
89-
indent: [
90-
2,
91-
2,
92-
{
93-
SwitchCase: 1
94-
}
95-
],
96-
// 对所有不包含单引号的JSX属性值强制使用单引号
97-
// 'jsx-quotes': [2, 'prefer-single'],
98-
//对象字面量中冒号的前后空格
99-
'key-spacing': [
100-
2,
101-
{
102-
beforeColon: false,
103-
afterColon: true
104-
}
105-
],
106-
// 关键字空格
107-
'keyword-spacing': [
108-
2,
109-
{
110-
before: true,
111-
after: true
112-
}
113-
],
114-
//函数名首行大写必须使用new方式调用,首行小写必须用不带new方式调用
115-
'new-cap': [
116-
1,
117-
{
118-
newIsCap: true,
119-
capIsNew: false
120-
}
121-
],
122-
//new时必须加小括号
123-
'new-parens': 2,
124-
//禁止使用数组构造器
125-
'no-array-constructor': 1,
126-
//禁止使用arguments.caller或arguments.callee
127-
'no-caller': 2,
128-
// 禁止使用console
129-
'no-console': 'off',
130-
// 禁止给类赋值
131-
'no-class-assign': 2,
132-
//禁止在条件表达式中使用赋值语句
133-
'no-cond-assign': 2,
134-
//禁止修改const声明的变量
135-
'no-const-assign': 2,
136-
//禁止在正则表达式中使用控制字符
137-
'no-control-regex': 0,
138-
// 不能对var声明的变量使用delete操作符
139-
'no-delete-var': 2,
140-
// 函数参数不能重复
141-
'no-dupe-args': 2,
142-
// class中的成员禁止重名
143-
'no-dupe-class-members': 2,
144-
// 在对象字面量中,禁止使用重复的key
145-
'no-dupe-keys': 2,
146-
// 在switch语句中禁止重复的case
147-
'no-duplicate-case': 2,
148-
// 禁止使用不匹配任何字符串的正则表达式
149-
'no-empty-character-class': 2,
150-
// 禁止使用不匹配任何字符串的正则表达式
151-
'no-empty-pattern': 2,
152-
// 禁止使用eval函数
153-
'no-eval': 1,
154-
// 禁止对catch语句中的参数进行赋值
155-
'no-ex-assign': 2,
156-
// 禁止扩展原生对象
157-
'no-extend-native': 2,
158-
// 禁止在不必要的时候使用bind函数
159-
'no-extra-bind': 1,
160-
//在一个本来就会自动转化为布尔值的上下文中就没必要再使用!! 进行强制转化了
161-
'no-extra-boolean-cast': 1,
162-
// 禁止使用多余的圆括号
163-
'no-extra-parens': [2, 'functions'],
164-
// 在case语句中尽量加break
165-
'no-fallthrough': 2,
166-
// 简单来说不要写这样的数字.2 2.。应该写全,2.2 2.0 .
167-
// 'no-floating-decimal': 2,
168-
// 禁止对函数名重新赋值
169-
'no-func-assign': 2,
170-
// 禁止使用类eval的函数。
171-
'no-implied-eval': 2,
172-
// 禁止在代码块中定义函数(下面的规则仅限制函数)
173-
'no-inner-declarations': [1, 'functions'],
174-
// RegExp构造函数中禁止使用非法正则语句
175-
'no-invalid-regexp': 2,
176-
//禁止使用不规则的空白符
177-
'no-irregular-whitespace': 2,
178-
//禁止使用__iterator__属性
179-
'no-iterator': 2,
180-
// label和var申明的变量不能重名
181-
'no-label-var': 2,
182-
// 禁止使用label语句
183-
'no-labels': [
184-
2,
185-
{
186-
allowLoop: false,
187-
allowSwitch: false
188-
}
189-
],
190-
// 禁止使用没有必要的嵌套代码块
191-
'no-lone-blocks': 2,
192-
// 不要把空格和tab混用
193-
'no-mixed-spaces-and-tabs': 0,
194-
// 申明语句、数组元素、对象属性、sequences、函数参数中不使用超过一个的空白符
195-
'no-multi-spaces': 2,
196-
//该规则保证了字符串不分两行书写。
197-
'no-multi-str': 2,
198-
//空行不能够超过2行
199-
'no-multiple-empty-lines': [
200-
2,
201-
{
202-
max: 2
203-
}
204-
],
205-
// 该规则保证了不重写原生对象
206-
'no-native-reassign': 2,
207-
//在in操作符左边的操作项不能用! 例如这样写不对的:if ( !a in b) { //dosomething }
208-
'no-negated-in-lhs': 2,
209-
//不要通过new Object(),来定义对象
210-
'no-new-object': 1,
211-
//禁止把require方法和new操作符一起使用。
212-
'no-new-require': 2,
213-
'no-new-symbol': 2,
214-
//当定义字符串、数字、布尔值就不要使用构造函数了,String、Number、Boolean
215-
'no-new-wrappers': 2,
216-
//禁止无意把全局对象当函数调用了,比如下面写法错误的:Math(), JSON()
217-
'no-obj-calls': 2,
218-
//不要使用八进制的语法。
219-
'no-octal': 2,
220-
'no-octal-escape': 2,
221-
'no-path-concat': 2,
222-
//不要使用__proto__
223-
'no-proto': 2,
224-
//不要重复申明一个变量
225-
'no-redeclare': 2,
226-
//正则表达式中不要使用空格
227-
'no-regex-spaces': 2,
228-
//return语句中不要写赋值语句
229-
'no-return-assign': [2, 'except-parens'],
230-
'no-self-assign': 2,
231-
//不要和自身作比较
232-
'no-self-compare': 2,
233-
//不要使用逗号操作符
234-
'no-sequences': 2,
235-
// 禁止对一些关键字或者保留字进行赋值操作,比如NaN、Infinity、undefined、eval、arguments等。
236-
'no-shadow-restricted-names': 2,
237-
// 函数调用时,圆括号前面不能有空格
238-
'no-spaced-func': 2,
239-
//禁止使用稀疏数组
240-
'no-sparse-arrays': 2,
241-
//在调用super之前不能使用this对象
242-
'no-this-before-super': 2,
243-
//一般来说,不允许抛出常量,例如 throw 'error' ,正确使用: throw new Error('something wrong')
244-
'no-throw-literal': 2,
245-
//行末禁止加空格
246-
'no-trailing-spaces': 2,
247-
//禁止使用没有定义的变量,除非在/*global*/已经申明
248-
'no-undef': 2,
249-
//禁止把undefined赋值给一个变量
250-
'no-undef-init': 1,
251-
//禁止在不需要分行的时候使用了分行
252-
'no-unexpected-multiline': 2,
253-
'no-unmodified-loop-condition': 2,
254-
//禁止使用没有必要的三元操作符,因为用些三元操作符可以使用其他语句替换
255-
'no-unneeded-ternary': [
256-
0,
257-
{
258-
defaultAssignment: false
259-
}
260-
],
261-
//禁止出现不可运行到的代码
262-
'no-unreachable': 1,
263-
//是否禁止在case语句中声明变量
264-
'no-case-declarations': 0,
265-
// 禁止在 finally 语句块中出现控制流语句
266-
'no-unsafe-finally': 2,
267-
// 禁止定义没用没使用的变量
268-
'no-unused-vars': [
269-
2,
270-
{
271-
vars: 'all',
272-
args: 'none'
273-
}
274-
],
275-
//禁止在不需要使用call()或者apply()的时候使用了这两个方法
276-
'no-useless-call': 2,
277-
'no-useless-computed-key': 2,
278-
'no-useless-constructor': 2,
279-
'no-useless-escape': 0,
280-
'no-whitespace-before-property': 2,
281-
//不要使用with语句
282-
'no-with': 2,
283-
//在某些场景只能使用一个var来申明变量
284-
'one-var': [
285-
2,
286-
{
287-
initialized: 'never'
288-
}
289-
],
290-
//在进行断行时,操作符应该放在行首还是行尾。并且还可以对某些操作符进行重写。
291-
'operator-linebreak': [
292-
2,
293-
'after',
294-
{
295-
overrides: {
296-
'?': 'before',
297-
':': 'before'
298-
}
299-
}
300-
],
301-
'padded-blocks': [2, 'never'],
302-
//使用单引号 还是 双引号
303-
quotes: [
304-
2,
305-
'single',
306-
{
307-
avoidEscape: true,
308-
allowTemplateLiterals: true
309-
}
310-
],
311-
//是否加分号
312-
semi: [2, 'never'],
313-
//该规则规定了分号前后的空格
314-
'semi-spacing': [
315-
2,
316-
{
317-
before: false,
318-
after: true
319-
}
320-
],
321-
//代码块前面需要加空格
322-
'space-before-blocks': [2, 'always'],
323-
//函数圆括号前面需要是否加空格
324-
'space-before-function-paren': [
325-
2,
326-
{
327-
anonymous: 'never',
328-
named: 'never',
329-
asyncArrow: 'always'
330-
}
331-
],
332-
//圆括号内部不需要加空格
333-
'space-in-parens': [2, 'never'],
334-
//操作符前后需要加空格
335-
'space-infix-ops': 2,
336-
//一元操作符前后是否需要加空格,单词类操作符需要加,而非单词类操作符不用加
337-
'space-unary-ops': [
338-
2,
339-
{
340-
words: true,
341-
nonwords: false
342-
}
343-
],
344-
//评论符号`/*` `//`,后面需要留一个空格
345-
'spaced-comment': [
346-
0,
347-
'always',
348-
{
349-
markers: ['global', 'globals', 'eslint', 'eslint-disable', '*package', '!', ',']
350-
}
351-
],
352-
//强制模板字符串中空格的使用
353-
'template-curly-spacing': [2, 'never'],
354-
//推荐使用isNaN方法,而不要直接和NaN作比较
355-
'use-isnan': 2,
356-
//在使用typeof操作符时,作比较的字符串必须是合法字符串eg:'string' 'object'
357-
'valid-typeof': 2,
358-
//立即执行函数需要用圆括号包围
359-
'wrap-iife': [1, 'any'],
360-
'yield-star-spacing': [2, 'both'],
361-
yoda: [2, 'never'],
362-
// 首选const
363-
'prefer-const': 0,
364-
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
365-
//大括号内是否允许不必要的空格
366-
'object-curly-spacing': [
367-
2,
368-
'always',
369-
{
370-
objectsInObjects: true
371-
}
372-
],
373-
// 指定数组的元素之间要以空格隔开(,后面), never参数:[ 之后和 ] 之前不能带空格,always参数:[ 之后和 ] 之前必须带空格
374-
'array-bracket-spacing': [2, 'never']
31+
'vue/multi-word-component-names': 'off'
37532
}
37633
}

front/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
"postcss-loader": "^2.0.8",
9191
"postcss-url": "^7.2.1",
9292
"prettier": "^2.5.1",
93+
"qiniu": "^7.4.0",
9394
"rimraf": "^2.6.0",
9495
"sass": "^1.0.0-beta.4",
9596
"sass-loader": "^6.0.6",

front/server.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const { startSchedule } = require('./server/utils/schedule')
1414
const template = fs.readFileSync('./src/index.template.html', 'utf-8')
1515
const isProd = process.env.NODE_ENV === 'production'
1616
const server = express()
17-
const resolve = file => path.resolve(__dirname, file)
17+
const resolve = (file) => path.resolve(__dirname, file)
1818
server.use(logger('dev')) //日志记录中间件,将请求信息打印在控制台
1919
server.use(bodyParser.json())
2020
server.use(bodyParser.urlencoded({ extended: true }))
@@ -66,7 +66,7 @@ readyPromise.then(() => {
6666
server.use(express.static(path.join(__dirname, 'static'))) //设置静态文件夹
6767
server.use(
6868
'/api/ueditor/UE',
69-
ueditor(path.join(__dirname, 'static'), function(req, res, next) {
69+
ueditor(path.join(__dirname, 'static'), function (req, res) {
7070
//客户端上传文件设置
7171
let imgDir = '/img/upload'
7272
let ActionType = req.query.action
@@ -118,7 +118,7 @@ readyPromise.then(() => {
118118
server.get(['/admin', '/admin/*', '/login'], (req, res) => {
119119
res.render('admin.html', { title: '登录' })
120120
})
121-
server.get('*', function(req, res) {
121+
server.get('*', function (req, res) {
122122
res.render('404.html', {
123123
title: 'No Found'
124124
})

0 commit comments

Comments
 (0)