Skip to content

Commit d153d1a

Browse files
committed
'eslint引入/eslint校验'
1 parent 1c7e876 commit d153d1a

File tree

99 files changed

+1223
-776
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+1223
-776
lines changed

.eslintrc.js

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
module.exports = {
2+
"root": true,
3+
"env": {
4+
"browser": true,
5+
"node": true
6+
},
7+
"parserOptions": {
8+
"parser": "babel-eslint"
9+
},
10+
"extends": [
11+
"plugin:vue/recommended",
12+
"eslint:recommended"
13+
],
14+
"rules": {
15+
// vue组件 props必须默认值
16+
"vue/require-default-prop": 0,
17+
// vue组件中属性的定义顺序
18+
"vue/order-in-components": 0,
19+
// vue组件多个属性必须换行
20+
"vue/max-attributes-per-line": 0,
21+
// 不允许在template组件上绑定某些属性,例如key
22+
"vue/no-template-shadow": 0,
23+
// 生产环境下不允许debugger调试
24+
"no-debugger": process.env.NODE_ENV === "production" ? 2 : 0,
25+
// 函数后必须跟一个空格
26+
"space-before-function-paren": 1,
27+
// 分号后必须跟一个空格
28+
"comma-spacing": 1,
29+
// 箭头函数两侧必须有空格
30+
"arrow-spacing": 1,
31+
// 操作符两侧必须有空格
32+
"space-infix-ops": 1,
33+
// 始终使用严格相等,即xxx === xxx
34+
"eqeqeq": 1
35+
}
36+
}

src/App.vue

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<template>
22
<div id="app" :style="getOverflowStyle">
3-
<m-header></m-header>
4-
<m-sidebar></m-sidebar>
5-
<router-view></router-view>
6-
<m-footer></m-footer>
3+
<m-header />
4+
<m-sidebar />
5+
<router-view />
6+
<m-footer />
77

8-
<login v-if="showLogin" @maskClick="handleMaskClick"></login>
8+
<login v-if="showLogin" @maskClick="handleMaskClick" />
99
</div>
1010
</template>
1111
<script>
@@ -15,12 +15,12 @@ import MSidebar from 'components/sidebar/sidebar.vue'
1515
import { mapGetters, mapMutations } from 'vuex'
1616
import { scrollMixin } from 'assets/js/mixin.js'
1717
export default {
18-
name: 'app',
18+
name: 'App',
1919
mixins: [scrollMixin],
2020
computed: {
2121
getOverflowStyle () {
2222
return {
23-
'overflow': this.showLogin ? 'hidden': ''
23+
'overflow': this.showLogin ? 'hidden' : ''
2424
}
2525
},
2626
// vuex

src/api/home.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import axios from 'utils/axios.js'
22
import { IS_MOCK_LOCAL } from 'api/config.js'
33

44
// 获取主页导航信息
5-
export function getHomeNav() {
5+
export function getHomeNav () {
66
let url = IS_MOCK_LOCAL ? '/mock/home/nav.json' : '/home/nav'
77
return axios.get(url)
88
}
@@ -12,7 +12,7 @@ export function getSliderList () {
1212
return axios.get(url)
1313
}
1414
// 获取主页课程信息
15-
export function getHomeCourse() {
15+
export function getHomeCourse () {
1616
let url = IS_MOCK_LOCAL ? '/mock/home/course.json' : '/home/course'
1717
return axios.get(url)
1818
}
@@ -27,7 +27,7 @@ export function getTeacher () {
2727
return axios.get(url)
2828
}
2929
// 获取全明星信息
30-
export function getAllStar() {
30+
export function getAllStar () {
3131
let url = IS_MOCK_LOCAL ? '/mock/home/allstar.json' : '/home/allstar'
3232
return axios.get(url)
3333
}

src/api/user.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ export function userLogin () {
77
return axios.get(url)
88
}
99
// 用户注册接口
10-
export function userRegister() {
10+
export function userRegister () {
1111
let url = IS_MOCK_LOCAL ? '/mock/user/register.json' : '/user/register'
1212
return axios.get(url)
1313
}
1414
// 获取用户详细信息接口
15-
export function getUserInfo() {
15+
export function getUserInfo () {
1616
let url = IS_MOCK_LOCAL ? '/mock/user/userinfo.json' : '/user/info'
1717
return axios.get(url)
1818
}

src/base/badge/badge.vue

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
<template>
22
<div class="badge">
3-
<slot></slot>
3+
<slot />
44
<span
5-
class="badge-content"
6-
v-text="content"
75
v-if="isShow"
6+
class="badge-content"
87
:class="[
98
'badge-content-'+ type,
109
{
1110
'is-absolute': $slots.default,
1211
'is-dot': isDot
1312
}
1413
]"
15-
></span>
14+
v-text="content"
15+
/>
1616
</div>
1717
</template>
1818
<script>

src/base/dialog/dialog.vue

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
<template>
2-
<div class="dialog">dialog</div>
2+
<div class="dialog">
3+
dialog
4+
</div>
35
</template>

src/base/pagination/pagination.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
:current-page.sync="currentPage"
88
:page-size="pageSize"
99
@current-change="handleCurrentChange"
10-
></el-pagination>
10+
/>
1111
</div>
1212
</template>
1313
<script>

src/base/progress/progress.vue

+6-2
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,15 @@
99
>
1010
<div class="progress-bar-outer" :style="{ height: `${height}px` }">
1111
<div class="progress-bar-inner" :style="innerBarStyle">
12-
<div class="progress-bar-inner-text" v-if="inside && showText">{{text}}</div>
12+
<div v-if="inside && showText" class="progress-bar-inner-text">
13+
{{ text }}
14+
</div>
1315
</div>
1416
</div>
1517
</div>
16-
<div class="progress-text" v-if="!inside && showText">{{text}}</div>
18+
<div v-if="!inside && showText" class="progress-text">
19+
{{ text }}
20+
</div>
1721
</div>
1822
</template>
1923
<script>

src/base/star/star.vue

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
<template>
22
<div class="star">
33
<span
4-
class="star-item iconfont"
54
v-for="(item, index) in max"
5+
:key="index"
6+
class="star-item iconfont"
7+
:style="getStyle(item)"
8+
:class="{'disabled': disabled}"
69
@mouseenter="handleMouseEnter(item)"
710
@mouseleave="handleMouseLeave"
811
@click="handleStarClick(item)"
9-
:style="getStyle(item)"
10-
:class="{'disabled': disabled}"
11-
:key="index">
12+
>
1213
&#xe610;
1314
</span>
1415
<span
@@ -26,11 +27,11 @@ export default {
2627
name: 'MoocStar',
2728
props: {
2829
value: {
29-
type: [Number,String],
30+
type: [Number, String],
3031
default: 0
3132
},
3233
size: {
33-
type: [Number,String],
34+
type: [Number, String],
3435
default: 14
3536
},
3637
max: {

src/base/step-item/step-item.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div class="step-item"></div>
2+
<div class="step-item" />
33
</template>
44
<script>
55
export default {

src/base/step/step.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div class="step"></div>
2+
<div class="step" />
33
</template>
44

55
<script>

src/base/swiper/swiper.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
2-
<swiper :options="swiperOption" ref="mySwiper" class="swiper-container">
3-
<slot></slot>
4-
<div class="swiper-pagination" slot="pagination"></div>
2+
<swiper ref="mySwiper" :options="swiperOption" class="swiper-container">
3+
<slot />
4+
<div slot="pagination" class="swiper-pagination" />
55
</swiper>
66
</template>
77
<script>

src/base/switch/switch.vue

+8-8
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,31 @@
1616
@change="handleInputChange"
1717
>
1818
<span
19-
class="switch-label left"
20-
ref="LeftLabel"
2119
v-if="newInActive.text"
20+
ref="LeftLabel"
21+
class="switch-label left"
2222
:class="{
2323
'active': !checked
2424
}"
2525
>
26-
{{newInActive.text}}
26+
{{ newInActive.text }}
2727
</span>
2828
<span
29-
class="switch-radius"
3029
ref="SwitchRadius"
30+
class="switch-radius"
3131
:style="{
3232
'width': width + 'px'
3333
}"
34-
></span>
34+
/>
3535
<span
36-
class="switch-label right"
37-
ref="RightLabel"
3836
v-if="newActive.text"
37+
ref="RightLabel"
38+
class="switch-label right"
3939
:class="{
4040
'active': checked
4141
}"
4242
>
43-
{{newActive.text}}
43+
{{ newActive.text }}
4444
</span>
4545
</div>
4646
</template>

src/base/timeline-item/timeline-item.vue

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
<template>
22
<li class="timeline-item">
3-
<div class="timeline-item-line"></div>
3+
<div class="timeline-item-line" />
44

55
<div
6-
class="timeline-item-dot"
76
v-if="!$slots.dot"
7+
class="timeline-item-dot"
88
:style="{
99
'background-color': color
1010
}"
1111
:class="[
1212
`timeline-item-dot-${size || ''}`,
1313
`timeline-item-dot-${type || ''}`
14-
]">
15-
</div>
14+
]"
15+
/>
1616

17-
<div class="timeline-item-dot-customer" v-if="$slots.dot">
18-
<slot name="dot"></slot>
17+
<div v-if="$slots.dot" class="timeline-item-dot-customer">
18+
<slot name="dot" />
1919
</div>
2020

2121
<div class="timeline-item-wrapper">
@@ -24,7 +24,7 @@
2424
</div>
2525

2626
<div class="timeline-item-content">
27-
<slot></slot>
27+
<slot />
2828
</div>
2929

3030
<div v-if="!hideTimestamp && placement==='bottom'" class="timeline-item-timestamp bottom">

src/components/cart/cart.vue

+15-7
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,33 @@
66
我的购物车
77
<span class="total">共加入0门课程</span>
88
</dt>
9-
<div class="cart-item-wrapper" v-if="list.length > 0">
10-
<dd class="cart-item" v-for="(item,index) in list" :key="index" @click="handleCartItemClick">
9+
<div v-if="list.length > 0" class="cart-item-wrapper">
10+
<dd v-for="(item,index) in list" :key="index" class="cart-item" @click="handleCartItemClick">
1111
<div class="img-box">
1212
<img :src="item.img" alt="">
1313
</div>
1414
<div class="cart-content">
15-
<p class="name">{{item.name}}</p>
15+
<p class="name">
16+
{{ item.name }}
17+
</p>
1618
<p class="price-box">
17-
<span class="price">¥ {{item.price}}</span>
19+
<span class="price">¥ {{ item.price }}</span>
1820
<span class="delete" @click.stop="handleDeleteClick(index)">删除</span>
1921
</p>
2022
</div>
2123
</dd>
2224
</div>
2325
<div v-else class="empty-box">
2426
<span class="iconfont">&#xe63b;</span>
25-
<h2 class="empty-title">购物车里空空如也</h2>
26-
<p class="empty-desc">快去选购你中意的课程</p>
27-
<p class="empty-link" @click="handleLessonClick">实战课程</p>
27+
<h2 class="empty-title">
28+
购物车里空空如也
29+
</h2>
30+
<p class="empty-desc">
31+
快去选购你中意的课程
32+
</p>
33+
<p class="empty-link" @click="handleLessonClick">
34+
实战课程
35+
</p>
2836
</div>
2937
</dl>
3038

src/components/chapter/chapter.vue

+16-10
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,27 @@
11
<template>
22
<div class="chapter">
3-
<div class="chapter-introduce" v-if="list.introduce">{{list.introduce}}</div>
4-
<div class="chapter-item" v-for="(chapter,index) in list.data" :key="index">
5-
<h2 class="chapter-title">{{chapter.title}}</h2>
6-
<p class="chapter-desc">{{chapter.desc}}</p>
3+
<div v-if="list.introduce" class="chapter-introduce">
4+
{{ list.introduce }}
5+
</div>
6+
<div v-for="(chapter,index) in list.data" :key="index" class="chapter-item">
7+
<h2 class="chapter-title">
8+
{{ chapter.title }}
9+
</h2>
10+
<p class="chapter-desc">
11+
{{ chapter.desc }}
12+
</p>
713
<ul>
8-
<li class="term-item" v-for="(term,index) in chapter.term" :key="index">
14+
<li v-for="(term, index) in chapter.term" :key="index" class="term-item">
915
<p>
1016
<span class="iconfont play">&#xe615;</span>
11-
<span>{{term.title}}({{term.duration}})</span>
17+
<span>{{ term.title }}({{ term.duration }})</span>
1218
<span class="right">
13-
<i class="iconfont complete" v-if="term.rate == 100">&#xe60f;</i>
14-
<span class="doning" v-else-if="term.rate > 0 && term.rate < 100">
19+
<i v-if="term.rate == 100" class="iconfont complete">&#xe60f;</i>
20+
<span v-else-if="term.rate > 0 && term.rate < 100" class="doning">
1521
最近学习
16-
<i class="iconfont" >&#xe601;</i>
22+
<i class="iconfont">&#xe601;</i>
1723
</span>
18-
<i class="iconfont ready" v-else>&#xe6e8;</i>
24+
<i v-else class="iconfont ready">&#xe6e8;</i>
1925
</span>
2026
</p>
2127
</li>

0 commit comments

Comments
 (0)