Skip to content

Commit 3c12e8d

Browse files
committed
fix:eslint
1 parent a7c06c8 commit 3c12e8d

35 files changed

+1885
-1850
lines changed

.eslintrc.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module.exports = {
2+
root: true,
3+
extends: ['standard'],
4+
env: {
5+
browser: true,
6+
},
7+
plugins: [
8+
'html'
9+
]
10+
}

package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@
2525
"babel-preset-es2015": "^6.22.0",
2626
"babel-preset-stage-0": "^6.22.0",
2727
"css-loader": "^0.26.2",
28+
"eslint": "^3.17.0",
29+
"eslint-config-standard": "^8.0.0-beta.0",
30+
"eslint-loader": "^1.6.3",
31+
"eslint-plugin-html": "^2.0.1",
32+
"eslint-plugin-import": "^2.2.0",
33+
"eslint-plugin-node": "^4.1.0",
34+
"eslint-plugin-promise": "^3.5.0",
35+
"eslint-plugin-standard": "^2.1.1",
2836
"express": "^4.15.0",
2937
"file-loader": "^0.10.1",
3038
"html-webpack-plugin": "^2.28.0",

src/app.vue

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
11
<style lang="less" scoped>
2-
32
</style>
43
<template>
5-
<router-view></router-view>
4+
<router-view></router-view>
65
</template>
76
<script>
8-
export default {
9-
data() {
10-
return {}
11-
},
12-
mounted() {
13-
this.appShow()
14-
},
15-
methods: {
16-
appShow() {
17-
const END_TIME = new Date().getTime() //结束时间
18-
const diffTime = END_TIME - PAGE_START_TIME
19-
const timer = setTimeout(() => {
20-
clearTimeout(timer)
21-
document.querySelector('.app-loading').className += ' app-loading-hide'
22-
}, diffTime > 2000 ? 0 : 2000 - diffTime)
23-
}
24-
}
7+
export default {
8+
data () {
9+
return {}
10+
},
11+
mounted () {
12+
this.appShow()
13+
},
14+
methods: {
15+
appShow () {
16+
const { PAGE_START_TIME } = window
17+
const END_TIME = new Date().getTime() // 结束时间
18+
const diffTime = END_TIME - PAGE_START_TIME
19+
const timer = setTimeout(() => {
20+
clearTimeout(timer)
21+
document.querySelector('.app-loading').className += ' app-loading-hide'
22+
}, diffTime > 2000 ? 0 : 2000 - diffTime)
23+
}
2524
}
26-
</script>
25+
}
26+
27+
</script>

src/components/content.vue

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<style lang="less" scoped>
2-
@import "../less/config";
3-
.content {
4-
overflow: auto;
5-
position: absolute;
6-
top: 50px;
7-
right: 0;
8-
bottom: 50px;
9-
left: 0;
10-
z-index: 100;
11-
-webkit-overflow-scrolling : touch;
12-
}
2+
@import "../less/config";
3+
.content {
4+
overflow: auto;
5+
position: absolute;
6+
top: 50px;
7+
right: 0;
8+
bottom: 50px;
9+
left: 0;
10+
z-index: 100;
11+
-webkit-overflow-scrolling : touch;
12+
}
1313
</style>
1414
<template>
1515
<div class="content">
@@ -18,4 +18,4 @@
1818
</template>
1919
<script>
2020
21-
</script>
21+
</script>

src/components/data-null.vue

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
11
<style lang="less" scoped>
2-
.data-null {
3-
position: absolute;
4-
top: 45%;
5-
left: 50%;
6-
z-index: 2;
7-
width: 120px;
8-
margin: 0 0 0 -60px;
9-
text-align: center;
10-
font-size: 14px;
11-
}
2+
.data-null {
3+
position: absolute;
4+
top: 45%;
5+
left: 50%;
6+
z-index: 2;
7+
width: 120px;
8+
margin: 0 0 0 -60px;
9+
text-align: center;
10+
font-size: 14px;
11+
}
1212
</style>
1313
<template>
14-
<div class="data-null">{{ msg }}</div>
14+
<div class="data-null">{{ msg }}</div>
1515
</template>
1616
<script>
17-
export default {
18-
props: {
19-
msg: {
20-
type: String,
21-
default: '暂无记录'
22-
}
23-
}
17+
export default {
18+
props: {
19+
msg: {
20+
type: String,
21+
default: '暂无记录'
22+
}
2423
}
25-
</script>
24+
}
25+
26+
</script>

src/components/footer.vue

Lines changed: 108 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -1,114 +1,117 @@
11
<style lang="less" scoped>
2-
@import "../less/config";
3-
.footer {
4-
position: absolute;
5-
right: 0;
6-
bottom: 0;
7-
left: 0;
8-
z-index: 50;
9-
height: 49px;
10-
text-align: center;
11-
border-top: 1px solid #ddd;
12-
ul {
13-
padding: 5px 0;
14-
margin: 0;
15-
li {
16-
list-style: none;
17-
a {
18-
position: relative;
19-
display: block;
20-
text-decoration: none;
21-
color: @text;
22-
i {
23-
display: block;
24-
line-height: 24px;
25-
}
26-
em {
27-
line-height: 16px;
28-
font-size: 13px;
29-
font-style: normal;
30-
}
31-
.count {
32-
position: absolute;
33-
top: 0;
34-
left: 50%;
35-
z-index: 2;
36-
padding: 1px 4px;
37-
line-height: 12px;
38-
border-radius: 50%;
39-
text-align: center;
40-
font-size: 12px;
41-
opacity: 0.9;
42-
color: #fff;
43-
background: red;
44-
}
45-
}
46-
}
47-
.active {
48-
i,
49-
em {
50-
color: @main;
51-
}
52-
}
2+
@import "../less/config";
3+
.footer {
4+
position: absolute;
5+
right: 0;
6+
bottom: 0;
7+
left: 0;
8+
z-index: 50;
9+
height: 49px;
10+
text-align: center;
11+
border-top: 1px solid #ddd;
12+
ul {
13+
padding: 5px 0;
14+
margin: 0;
15+
li {
16+
list-style: none;
17+
a {
18+
position: relative;
19+
display: block;
20+
text-decoration: none;
21+
color: @text;
22+
i {
23+
display: block;
24+
line-height: 24px;
25+
}
26+
em {
27+
line-height: 16px;
28+
font-size: 13px;
29+
font-style: normal;
30+
}
31+
.count {
32+
position: absolute;
33+
top: 0;
34+
left: 50%;
35+
z-index: 2;
36+
padding: 1px 4px;
37+
line-height: 12px;
38+
border-radius: 50%;
39+
text-align: center;
40+
font-size: 12px;
41+
opacity: 0.9;
42+
color: #fff;
43+
background: red;
44+
}
5345
}
46+
}
47+
.active {
48+
i,
49+
em {
50+
color: @main;
51+
}
52+
}
5453
}
54+
}
5555
</style>
5656
<template>
57-
<footer class="footer">
58-
<ul flex="box:mean">
59-
<template v-for="item in list">
60-
<li :class="{ active: item.path == $route.path }">
61-
<router-link :to="item.path">
62-
<i class="iconfont" :class="[ item.icon ]"></i>
63-
<em>{{ item.title }}</em>
64-
<div class="count" v-if="item.path == '/my/messages' && count > 0">{{ count }}</div>
65-
</router-link>
66-
</li>
67-
</template>
68-
</ul>
69-
</footer>
57+
<footer class="footer">
58+
<ul flex="box:mean">
59+
<template v-for="item in list">
60+
<li :class="{ active: item.path == $route.path }">
61+
<router-link :to="item.path">
62+
<i class="iconfont" :class="[ item.icon ]"></i>
63+
<em>{{ item.title }}</em>
64+
<div class="count" v-if="item.path == '/my/messages' && count > 0">{{ count }}</div>
65+
</router-link>
66+
</li>
67+
</template>
68+
</ul>
69+
</footer>
7070
</template>
7171
<script>
72-
import util from 'util'
73-
import { mapState } from 'vuex'
72+
import util from 'util'
73+
import { mapState } from 'vuex'
7474
75-
export default {
76-
computed: mapState({ user: (state) => state.user }),
77-
data() {
78-
return {
79-
count: 0,
80-
list: [
81-
{
82-
title: '首页',
83-
path: '/',
84-
icon: 'icon-index'
85-
},
86-
{
87-
title: '发表',
88-
path: '/topic/create',
89-
icon: 'icon-edit'
90-
},
91-
{
92-
title: '消息',
93-
path: '/my/messages',
94-
icon: 'icon-msg'
95-
},
96-
{
97-
title: '我的',
98-
path: '/my/home',
99-
icon: 'icon-user'
100-
}
101-
]
102-
}
103-
},
104-
created() {
105-
this.getCount()
106-
},
107-
methods: {
108-
getCount() {
109-
if (!this.user.id) return
110-
util.get('/api/v1/message/count', {}, (res) => this.count = res.data)
111-
}
112-
}
75+
export default {
76+
computed: mapState({ user: (state) => state.user }),
77+
data () {
78+
return {
79+
count: 0,
80+
list: [
81+
{
82+
title: '首页',
83+
path: '/',
84+
icon: 'icon-index'
85+
},
86+
{
87+
title: '发表',
88+
path: '/topic/create',
89+
icon: 'icon-edit'
90+
},
91+
{
92+
title: '消息',
93+
path: '/my/messages',
94+
icon: 'icon-msg'
95+
},
96+
{
97+
title: '我的',
98+
path: '/my/home',
99+
icon: 'icon-user'
100+
}
101+
]
102+
}
103+
},
104+
created () {
105+
this.getCount()
106+
},
107+
methods: {
108+
getCount () {
109+
if (!this.user.id) return
110+
util.get('/api/v1/message/count', {}, (res) => {
111+
this.count = res.data
112+
})
113+
}
113114
}
114-
</script>
115+
}
116+
117+
</script>

0 commit comments

Comments
 (0)