Skip to content

Commit 7cad868

Browse files
committed
♻️ refactor: code
1 parent 2806fd8 commit 7cad868

File tree

11 files changed

+44
-117
lines changed

11 files changed

+44
-117
lines changed

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
"build": "vue-cli-service build",
1111
"build:node18": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build",
1212
"lint": "vue-cli-service lint --fix",
13+
"lint:eslint": "eslint {src,mock,library}/**/*.{vue,js,ts} --fix",
14+
"lint:prettier": "prettier {src,mock,library}/**/*.{html,vue,css,sass,scss,js,ts,md} --write",
1315
"clear": "rimraf node_modules&&npm install --registry=--registry=https://registry.npmmirror.com",
1416
"image-webpack-loader": "cnpm i image-webpack-loader -D",
1517
"update": "ncu -u --reject webpack,eslint-plugin-prettier,@vue/eslint-config-prettier,prettier,layouts,sass-loader,sass,screenfull,eslint,chalk,vue,vue-template-compiler,vue-router,vuex,@vue/cli-plugin-babel,@vue/cli-plugin-eslint,@vue/cli-service,eslint-plugin-vue --registry=https://registry.npmmirror.com&&cnpm i",

src/layouts/components/VabAd/index.vue

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
<template>
22
<div class="vab-ad">
3-
<el-carousel
4-
v-if="adList"
5-
:autoplay="true"
6-
:interval="3000"
7-
direction="vertical"
8-
height="30px"
9-
indicator-position="none"
10-
>
3+
<el-carousel v-if="adList" :autoplay="true" :interval="3000" direction="vertical" height="30px" indicator-position="none">
114
<el-carousel-item v-for="(item, index) in adList" :key="index">
125
<el-tag type="warning">Ad</el-tag>
136
<a :href="item.url" target="_blank">{{ item.title }}</a>

src/layouts/components/VabAvatar/index.vue

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@
1414
<el-dropdown-item command="gitee" divided>码云地址</el-dropdown-item>
1515
<el-dropdown-item command="pro" divided>pro付费版地址</el-dropdown-item>
1616
<el-dropdown-item command="plus" divided>plus付费版地址</el-dropdown-item>
17-
<el-dropdown-item command="shop" divided>
18-
shop-vite付费版地址
19-
</el-dropdown-item>
17+
<el-dropdown-item command="shop" divided>shop-vite付费版地址</el-dropdown-item>
2018
<el-dropdown-item command="logout" divided>退出登录</el-dropdown-item>
2119
</el-dropdown-menu>
2220
</el-dropdown>
@@ -50,37 +48,27 @@
5048
window.open('https://gitee.com/chu1204505056/vue-admin-better')
5149
break
5250
case 'pro':
53-
window.open(
54-
'https://vue-admin-beautiful.com/admin-pro/?hmsr=homeAd&hmpl=&hmcu=&hmkw=&hmci='
55-
)
51+
window.open('https://vue-admin-beautiful.com/admin-pro/?hmsr=homeAd&hmpl=&hmcu=&hmkw=&hmci=')
5652
break
5753
case 'plus':
58-
window.open(
59-
'https://vue-admin-beautiful.com/admin-plus/?hmsr=homeAd&hmpl=&hmcu=&hmkw=&hmci='
60-
)
54+
window.open('https://vue-admin-beautiful.com/admin-plus/?hmsr=homeAd&hmpl=&hmcu=&hmkw=&hmci=')
6155
case 'shop':
62-
window.open(
63-
'https://vue-admin-beautiful.com/shop-vite/?hmsr=homeAd&hmpl=&hmcu=&hmkw=&hmci='
64-
)
56+
window.open('https://vue-admin-beautiful.com/shop-vite/?hmsr=homeAd&hmpl=&hmcu=&hmkw=&hmci=')
6557
}
6658
},
6759
personalCenter() {
6860
this.$router.push('/personalCenter/personalCenter')
6961
},
7062
logout() {
71-
this.$baseConfirm(
72-
'您确定要退出' + this.$baseTitle + '吗?',
73-
null,
74-
async () => {
75-
await this.$store.dispatch('user/logout')
76-
if (recordRoute) {
77-
const fullPath = this.$route.fullPath
78-
this.$router.push(`/login?redirect=${fullPath}`)
79-
} else {
80-
this.$router.push('/login')
81-
}
63+
this.$baseConfirm('您确定要退出' + this.$baseTitle + '吗?', null, async () => {
64+
await this.$store.dispatch('user/logout')
65+
if (recordRoute) {
66+
const fullPath = this.$route.fullPath
67+
this.$router.push(`/login?redirect=${fullPath}`)
68+
} else {
69+
this.$router.push('/login')
8270
}
83-
)
71+
})
8472
},
8573
},
8674
}

src/layouts/components/VabBreadcrumb/index.vue

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@
2121
},
2222
methods: {
2323
getBreadcrumb() {
24-
return this.$route.matched.filter(
25-
(item) => item.name && item.meta.title
26-
)
24+
return this.$route.matched.filter((item) => item.name && item.meta.title)
2725
},
2826
},
2927
}

src/layouts/components/VabLogo/index.vue

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@
33
<router-link to="/">
44
<!-- 这里是logo变更的位置 -->
55
<vab-remix-icon v-if="logo" :icon-class="logo" class="logo" />
6-
<span
7-
:class="{ 'hidden-xs-only': layout === 'horizontal' }"
8-
:title="title"
9-
class="title"
10-
>
6+
<span :class="{ 'hidden-xs-only': layout === 'horizontal' }" :title="title" class="title">
117
{{ title }}
128
</span>
139
</router-link>

src/layouts/components/VabNavBar/index.vue

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,7 @@
1717
<vab-error-log />
1818
<vab-full-screen-bar @refresh="refreshRoute" />
1919
<vab-theme-bar class="hidden-xs-only" />
20-
<vab-icon
21-
:icon="['fas', 'redo']"
22-
:pulse="pulse"
23-
title="重载所有路由"
24-
@click="refreshRoute"
25-
/>
20+
<vab-icon :icon="['fas', 'redo']" :pulse="pulse" title="重载所有路由" @click="refreshRoute" />
2621
<vab-avatar />
2722
<!-- <vab-icon
2823
title="退出系统"

src/layouts/components/VabThemeBar/index.vue

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
<template>
22
<span v-if="themeBar">
3-
<vab-icon
4-
:icon="['fas', 'palette']"
5-
title="主题配置"
6-
@click="handleOpenThemeBar"
7-
/>
3+
<vab-icon :icon="['fas', 'palette']" title="主题配置" @click="handleOpenThemeBar" />
84
<div class="theme-bar-setting">
95
<div @click="handleOpenThemeBar">
106
<vab-icon :icon="['fas', 'palette']" />
@@ -16,13 +12,7 @@
1612
</div>
1713
</div>
1814

19-
<el-drawer
20-
:visible.sync="drawerVisible"
21-
append-to-body
22-
direction="rtl"
23-
size="300px"
24-
title="主题配置"
25-
>
15+
<el-drawer :visible.sync="drawerVisible" append-to-body direction="rtl" size="300px" title="主题配置">
2616
<el-scrollbar style="height: 80vh; overflow: hidden">
2717
<div class="el-drawer__body">
2818
<el-form ref="form" :model="theme" label-position="top">
@@ -128,19 +118,15 @@
128118
if (!this.handleIsMobile()) this.changeLayout(layout)
129119
this.changeHeader(header)
130120
this.changeTabsBar(tabsBar)
131-
document.getElementsByTagName(
132-
'body'
133-
)[0].className = `vue-admin-beautiful-theme-${name}`
121+
document.getElementsByTagName('body')[0].className = `vue-admin-beautiful-theme-${name}`
134122
this.drawerVisible = false
135123
},
136124
handleSaveTheme() {
137125
this.handleSetTheme()
138126
},
139127
handleSetDfaultTheme() {
140128
let { name } = this.theme
141-
document
142-
.getElementsByTagName('body')[0]
143-
.classList.remove(`vue-admin-beautiful-theme-${name}`)
129+
document.getElementsByTagName('body')[0].classList.remove(`vue-admin-beautiful-theme-${name}`)
144130
localStorage.removeItem('vue-admin-beautiful-theme')
145131
this.$refs['form'].resetFields()
146132
Object.assign(this.$data, this.$options.data())
@@ -153,8 +139,7 @@
153139
location.reload()
154140
},
155141
handleGetCode() {
156-
const url =
157-
'https://github.com/chuzhixin/vue-admin-beautiful/tree/master/src/views'
142+
const url = 'https://github.com/chuzhixin/vue-admin-beautiful/tree/master/src/views'
158143
let path = this.$route.path + '/index.vue'
159144
if (path === '/vab/menu1/menu1-1/menu1-1-1/index.vue') {
160145
path = '/vab/nested/menu1/menu1-1/menu1-1-1/index.vue'

src/layouts/index.vue

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@
1010
>
1111
<div :class="header === 'fixed' ? 'fixed-header' : ''">
1212
<vab-top-bar />
13-
<div
14-
v-if="tabsBar === 'true' || tabsBar === true"
15-
:class="{ 'tag-view-show': tabsBar }"
16-
>
13+
<div v-if="tabsBar === 'true' || tabsBar === true" :class="{ 'tag-view-show': tabsBar }">
1714
<div class="vab-main">
1815
<vab-tabs-bar />
1916
</div>
@@ -32,11 +29,7 @@
3229
}"
3330
class="layout-container-vertical"
3431
>
35-
<div
36-
v-if="device === 'mobile' && collapse === false"
37-
class="mask"
38-
@click="handleFoldSideBar"
39-
/>
32+
<div v-if="device === 'mobile' && collapse === false" class="mask" @click="handleFoldSideBar" />
4033
<vab-side-bar />
4134
<div :class="collapse ? 'is-collapse-main' : ''" class="vab-main">
4235
<div :class="header === 'fixed' ? 'fixed-header' : ''">
@@ -108,8 +101,7 @@
108101
'storage',
109102
(e) => {
110103
if (e.key === tokenName || e.key === null) window.location.reload()
111-
if (e.key === tokenName && e.value === null)
112-
window.location.reload()
104+
if (e.key === tokenName && e.value === null) window.location.reload()
113105
},
114106
false
115107
)
@@ -132,10 +124,7 @@
132124
this.$store.dispatch('settings/changeLayout', this.oldLayout)
133125
}
134126
135-
this.$store.dispatch(
136-
'settings/toggleDevice',
137-
isMobile ? 'mobile' : 'desktop'
138-
)
127+
this.$store.dispatch('settings/toggleDevice', isMobile ? 'mobile' : 'desktop')
139128
}
140129
},
141130
},

src/styles/element-variables.scss

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
$--all-transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
66
$--fade-transition: opacity 300ms cubic-bezier(0.23, 1, 0.32, 1);
77
$--fade-linear-transition: opacity 200ms linear;
8-
$--md-fade-transition: transform 300ms cubic-bezier(0.23, 1, 0.32, 1),
9-
opacity 300ms cubic-bezier(0.23, 1, 0.32, 1);
8+
$--md-fade-transition: transform 300ms cubic-bezier(0.23, 1, 0.32, 1), opacity 300ms cubic-bezier(0.23, 1, 0.32, 1);
109
$--border-transition-base: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
1110
$--color-transition-base: color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
1211

src/styles/spinner/dots.css

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,75 +8,61 @@
88
text-indent: -9999px;
99
background: transparent;
1010
border-radius: 100%;
11-
box-shadow: #f86 -14px -14px 0 7px, #fc6 14px -14px 0 7px,
12-
#6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px;
11+
box-shadow: #f86 -14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px;
1312
transform-origin: 50% 50%;
1413
animation: dots-loader 5s infinite ease-in-out;
1514
}
1615

1716
@keyframes dots-loader {
1817
0% {
19-
box-shadow: #f86 -14px -14px 0 7px, #fc6 14px -14px 0 7px,
20-
#6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px;
18+
box-shadow: #f86 -14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px;
2119
}
2220

2321
8.33% {
24-
box-shadow: #f86 14px -14px 0 7px, #fc6 14px -14px 0 7px,
25-
#6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px;
22+
box-shadow: #f86 14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px;
2623
}
2724

2825
16.67% {
29-
box-shadow: #f86 14px 14px 0 7px, #fc6 14px 14px 0 7px, #6d7 14px 14px 0 7px,
30-
#4ae -14px 14px 0 7px;
26+
box-shadow: #f86 14px 14px 0 7px, #fc6 14px 14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px;
3127
}
3228

3329
25% {
34-
box-shadow: #f86 -14px 14px 0 7px, #fc6 -14px 14px 0 7px,
35-
#6d7 -14px 14px 0 7px, #4ae -14px 14px 0 7px;
30+
box-shadow: #f86 -14px 14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px 14px 0 7px, #4ae -14px 14px 0 7px;
3631
}
3732

3833
33.33% {
39-
box-shadow: #f86 -14px -14px 0 7px, #fc6 -14px 14px 0 7px,
40-
#6d7 -14px -14px 0 7px, #4ae -14px -14px 0 7px;
34+
box-shadow: #f86 -14px -14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae -14px -14px 0 7px;
4135
}
4236

4337
41.67% {
44-
box-shadow: #f86 14px -14px 0 7px, #fc6 -14px 14px 0 7px,
45-
#6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px;
38+
box-shadow: #f86 14px -14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px;
4639
}
4740

4841
50% {
49-
box-shadow: #f86 14px 14px 0 7px, #fc6 -14px 14px 0 7px,
50-
#6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px;
42+
box-shadow: #f86 14px 14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px;
5143
}
5244

5345
58.33% {
54-
box-shadow: #f86 -14px 14px 0 7px, #fc6 -14px 14px 0 7px,
55-
#6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px;
46+
box-shadow: #f86 -14px 14px 0 7px, #fc6 -14px 14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px;
5647
}
5748

5849
66.67% {
59-
box-shadow: #f86 -14px -14px 0 7px, #fc6 -14px -14px 0 7px,
60-
#6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px;
50+
box-shadow: #f86 -14px -14px 0 7px, #fc6 -14px -14px 0 7px, #6d7 -14px -14px 0 7px, #4ae 14px -14px 0 7px;
6151
}
6252

6353
75% {
64-
box-shadow: #f86 14px -14px 0 7px, #fc6 14px -14px 0 7px,
65-
#6d7 14px -14px 0 7px, #4ae 14px -14px 0 7px;
54+
box-shadow: #f86 14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px -14px 0 7px, #4ae 14px -14px 0 7px;
6655
}
6756

6857
83.33% {
69-
box-shadow: #f86 14px 14px 0 7px, #fc6 14px -14px 0 7px,
70-
#6d7 14px 14px 0 7px, #4ae 14px 14px 0 7px;
58+
box-shadow: #f86 14px 14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae 14px 14px 0 7px;
7159
}
7260

7361
91.67% {
74-
box-shadow: #f86 -14px 14px 0 7px, #fc6 14px -14px 0 7px,
75-
#6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px;
62+
box-shadow: #f86 -14px 14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px;
7663
}
7764

7865
100% {
79-
box-shadow: #f86 -14px -14px 0 7px, #fc6 14px -14px 0 7px,
80-
#6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px;
66+
box-shadow: #f86 -14px -14px 0 7px, #fc6 14px -14px 0 7px, #6d7 14px 14px 0 7px, #4ae -14px 14px 0 7px;
8167
}
8268
}

0 commit comments

Comments
 (0)