adasdasdasdas
This commit is contained in:
parent
29ba707cde
commit
81d90f7a04
1617
package-lock.json
generated
1617
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -15,8 +15,10 @@
|
|||||||
"core-js": "^3.8.3",
|
"core-js": "^3.8.3",
|
||||||
"echarts": "^5.4.3",
|
"echarts": "^5.4.3",
|
||||||
"element-ui": "^2.15.14",
|
"element-ui": "^2.15.14",
|
||||||
|
"fs-extra": "^11.2.0",
|
||||||
"gsap": "^3.12.4",
|
"gsap": "^3.12.4",
|
||||||
"jquery": "^3.7.1",
|
"jquery": "^3.7.1",
|
||||||
|
"node-polyfill-webpack-plugin": "^3.0.0",
|
||||||
"qs": "^6.11.2",
|
"qs": "^6.11.2",
|
||||||
"vue": "^2.6.14",
|
"vue": "^2.6.14",
|
||||||
"vue-router": "^3.5.1",
|
"vue-router": "^3.5.1",
|
||||||
|
@ -852,7 +852,7 @@ body.light-mode .video-bg:before {
|
|||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
.app-card + .app-card {
|
.app-card + .app-card {
|
||||||
margin-left: 20px;
|
/*margin-left: 20px;*/
|
||||||
}
|
}
|
||||||
.app-card span {
|
.app-card span {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -57,6 +57,7 @@ export default {
|
|||||||
this.getNavList();
|
this.getNavList();
|
||||||
this.getCategories();
|
this.getCategories();
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
|
||||||
@ -69,7 +70,6 @@ export default {
|
|||||||
method: 'post',
|
method: 'post',
|
||||||
url: '/api/UrlAndCate/disposeBookmarkExhibitedToJson',
|
url: '/api/UrlAndCate/disposeBookmarkExhibitedToJson',
|
||||||
}).then(function (res) {
|
}).then(function (res) {
|
||||||
// console.log(res);
|
|
||||||
if (res.data.data) {
|
if (res.data.data) {
|
||||||
_this.category = res.data.data;
|
_this.category = res.data.data;
|
||||||
} else {
|
} else {
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
style="width:200px;margin-top:30px;"
|
style="width:200px;margin-top:30px;"
|
||||||
@node-click="handleTreeNodeClick"
|
@node-click="handleTreeNodeClick"
|
||||||
:expand-on-click-node="false"
|
:expand-on-click-node="false"
|
||||||
|
:default-expand-all="true"
|
||||||
>
|
>
|
||||||
</el-tree>
|
</el-tree>
|
||||||
</div>
|
</div>
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
effect="dark" close-delay="2000">
|
effect="dark" close-delay="2000">
|
||||||
<div class="MyPopover" slot="content">
|
<div class="MyPopover" slot="content">
|
||||||
<span style="font-size:12px !important;">【{{ nav.name }}】手机二维码</span><br/><br/>
|
<span style="font-size:12px !important;">【{{ nav.name }}】手机二维码</span><br/><br/>
|
||||||
<div style="width:100% ;text-align: center"><img style="width:150px"
|
<div style="width:100% ;text-align: center"><img v-if="nav.userId && nav.icon" style="width:150px"
|
||||||
:src="getQR(nav.urlId,nav.icon)"/>
|
:src="getQR(nav.urlId,nav.icon)"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -61,26 +61,31 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
getQR(url_id, icon_url) {
|
getQR(url_id, icon_url) {
|
||||||
let _this = this;
|
let _this = this;
|
||||||
axios({
|
if(url_id && icon_url){
|
||||||
method: 'post',
|
axios({
|
||||||
url: '/api/qrcode/qrc_return',
|
method: 'post',
|
||||||
data: {
|
url: '/api/qrcode/qrc_return',
|
||||||
url_id: url_id,
|
data: {
|
||||||
icon_url: icon_url
|
url_id: url_id,
|
||||||
}
|
icon_url: icon_url
|
||||||
}).then(function (res) {
|
}
|
||||||
if (res.data) {
|
}).then(function (res) {
|
||||||
_this.imageCode = "data:image/jpg;base64," + res.data;
|
if (res.data) {
|
||||||
}
|
_this.imageCode = "data:image/jpg;base64," + res.data;
|
||||||
return false;
|
}
|
||||||
}).catch((error) => {
|
return false;
|
||||||
Vue.prototype.$notify.error({
|
}).catch((error) => {
|
||||||
title: '错误',
|
Vue.prototype.$notify.error({
|
||||||
message: error === null ? '' : error,
|
title: '错误',
|
||||||
offset: 0
|
message: error === null ? '' : error,
|
||||||
});
|
offset: 0
|
||||||
})
|
});
|
||||||
return this.imageCode
|
})
|
||||||
|
return this.imageCode
|
||||||
|
}else{
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
goToNavDetail() {
|
goToNavDetail() {
|
||||||
if (this.nav.urlId) {
|
if (this.nav.urlId) {
|
||||||
|
23
src/components/setting/attachment/AttachmentManage.vue
Normal file
23
src/components/setting/attachment/AttachmentManage.vue
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<template>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "AttachmentManage",
|
||||||
|
data() {
|
||||||
|
return {}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
|
||||||
|
},
|
||||||
|
computed: {},
|
||||||
|
methods: {}
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
23
src/components/setting/banner/BannerManage.vue
Normal file
23
src/components/setting/banner/BannerManage.vue
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<template>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "BannerManage",
|
||||||
|
data() {
|
||||||
|
return {}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
|
||||||
|
},
|
||||||
|
computed: {},
|
||||||
|
methods: {}
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
23
src/components/setting/category/CategoryManage.vue
Normal file
23
src/components/setting/category/CategoryManage.vue
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<template>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "CategoryManage",
|
||||||
|
data() {
|
||||||
|
return {}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
|
||||||
|
},
|
||||||
|
computed: {},
|
||||||
|
methods: {}
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
23
src/components/setting/notice/NoticeManage.vue
Normal file
23
src/components/setting/notice/NoticeManage.vue
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<template>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "NoticeManage",
|
||||||
|
data() {
|
||||||
|
return {}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
|
||||||
|
},
|
||||||
|
computed: {},
|
||||||
|
methods: {}
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
@ -14,6 +14,9 @@
|
|||||||
</el-upload>
|
</el-upload>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
import {parseByString } from "bookmark-file-parser"
|
||||||
|
import axios from "axios";
|
||||||
|
import Vue from "vue";
|
||||||
export default {
|
export default {
|
||||||
name: "Import",
|
name: "Import",
|
||||||
data() {
|
data() {
|
||||||
@ -27,73 +30,6 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {},
|
computed: {},
|
||||||
methods: {
|
methods: {
|
||||||
getBookmarksStrRootNode(str) {
|
|
||||||
// 创建iframe
|
|
||||||
let iframe = document.createElement('iframe')
|
|
||||||
document.body.appendChild(iframe)
|
|
||||||
iframe.style.display = 'none'
|
|
||||||
// 添加书签dom字符串
|
|
||||||
iframe.contentWindow.document.documentElement.innerHTML = str
|
|
||||||
// 获取书签树根节点
|
|
||||||
return iframe.contentWindow.document.querySelector('dl')
|
|
||||||
},
|
|
||||||
walkBookmarksTree (root) {
|
|
||||||
let result = []
|
|
||||||
// 深度优先遍历
|
|
||||||
let walk = (node, list) => {
|
|
||||||
let els = node.children
|
|
||||||
if (els && els.length > 0) {
|
|
||||||
for (let i = 0; i < els.length; i++) {
|
|
||||||
let item = els[i]
|
|
||||||
// p标签或h3标签直接跳过
|
|
||||||
if (item.tagName === 'P' || item.tagName === 'H3') {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
// 文件夹不用创建元素
|
|
||||||
if (item.tagName === 'DL') {
|
|
||||||
walk(els[i], list)
|
|
||||||
} else {// DT节点
|
|
||||||
let child = null
|
|
||||||
// 判断是否是文件夹
|
|
||||||
let children = item.children
|
|
||||||
let isDir = false
|
|
||||||
for(let j = 0; j < children.length; j++) {
|
|
||||||
if (children[j].tagName === 'H3' || children[j].tagName === 'DL') {
|
|
||||||
isDir = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 文件夹
|
|
||||||
if (isDir) {
|
|
||||||
child = {
|
|
||||||
name: item.tagName === 'DT' ? item.querySelector('h3') ? item.querySelector('h3').innerText : '' : '',
|
|
||||||
folder: true,
|
|
||||||
children: []
|
|
||||||
}
|
|
||||||
walk(els[i], child.children)
|
|
||||||
} else {// 书签
|
|
||||||
let _item = item.querySelector('a')
|
|
||||||
let icon=$('a').attr('ICON');
|
|
||||||
console.log(icon);
|
|
||||||
child = {
|
|
||||||
name: _item.innerText,
|
|
||||||
url: _item.href,
|
|
||||||
icon:icon,
|
|
||||||
folder: false,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
list.push(child)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
walk(root, result)
|
|
||||||
return result
|
|
||||||
},
|
|
||||||
analysisBookmarksStr(str) {
|
|
||||||
let root = this.getBookmarksStrRootNode(str)
|
|
||||||
let result = this.walkBookmarksTree(root)
|
|
||||||
console.log(result);
|
|
||||||
},
|
|
||||||
handleChange(file) {
|
handleChange(file) {
|
||||||
let _this=this;
|
let _this=this;
|
||||||
let reader = new FileReader(); //先new 一个读文件的对象 FileReader
|
let reader = new FileReader(); //先new 一个读文件的对象 FileReader
|
||||||
@ -112,11 +48,56 @@ export default {
|
|||||||
// let snippets = new TextDecoder('gb2312').decode(ints); //二进制缓存区内容转化成中文(即也就是读取到的内容)
|
// let snippets = new TextDecoder('gb2312').decode(ints); //二进制缓存区内容转化成中文(即也就是读取到的内容)
|
||||||
let snippets = new TextDecoder('utf-8').decode(ints); //二进制缓存区内容转化成中文(即也就是读取到的内容)
|
let snippets = new TextDecoder('utf-8').decode(ints); //二进制缓存区内容转化成中文(即也就是读取到的内容)
|
||||||
// console.log("读取的内容如下:");
|
// console.log("读取的内容如下:");
|
||||||
// console.log(snippets);
|
if(snippets){
|
||||||
_this.analysisBookmarksStr(snippets);
|
_this.disposeJson(parseByString(snippets));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
disposeJson(json) {
|
||||||
|
let _this = this;
|
||||||
|
if (localStorage.getItem('userId')) {
|
||||||
|
axios({
|
||||||
|
method: 'post',
|
||||||
|
url: '/api/UrlAndCate/disposeJson',
|
||||||
|
params: {
|
||||||
|
userId:localStorage.getItem('userId'),
|
||||||
|
},
|
||||||
|
data:json
|
||||||
|
}).then(function (res) {
|
||||||
|
if(res.data.code!==200){
|
||||||
|
Vue.prototype.$notify.error({
|
||||||
|
title: '错误',
|
||||||
|
message: "插入失败!",
|
||||||
|
offset: 0
|
||||||
|
});
|
||||||
|
}else {
|
||||||
|
Vue.prototype.$notify({
|
||||||
|
title: '成功',
|
||||||
|
message: ('i', {style: 'color: teal'}, "插入成功!"),
|
||||||
|
type: 'success',
|
||||||
|
offset: 0
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}).catch((error) => {
|
||||||
|
Vue.prototype.$notify.error({
|
||||||
|
title: '错误',
|
||||||
|
message: error,
|
||||||
|
offset: 0
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Vue.prototype.$notify.error({
|
||||||
|
title: '错误',
|
||||||
|
message: '登录状态失效,请重新登录!',
|
||||||
|
offset: 0
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
23
src/components/setting/user/UserManage.vue
Normal file
23
src/components/setting/user/UserManage.vue
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<template>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "UserManage",
|
||||||
|
data() {
|
||||||
|
return {}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
|
||||||
|
},
|
||||||
|
computed: {},
|
||||||
|
methods: {}
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
@ -16,165 +16,183 @@ import personalHomePage from "@/components/setting/home/PersonalHomePage.vue";
|
|||||||
import onSiteSetting from "@/components/setting/onsite/OnSiteSetting.vue";
|
import onSiteSetting from "@/components/setting/onsite/OnSiteSetting.vue";
|
||||||
import baseSettings from "@/components/setting/onsite/BaseSettings.vue";
|
import baseSettings from "@/components/setting/onsite/BaseSettings.vue";
|
||||||
import importExport from "@/components/setting/onsite/ImportExport.vue";
|
import importExport from "@/components/setting/onsite/ImportExport.vue";
|
||||||
|
import categoryManage from "@/components/setting/category/CategoryManage.vue";
|
||||||
|
import bannerManage from "@/components/setting/banner/BannerManage.vue";
|
||||||
|
import userManage from "@/components/setting/user/UserManage.vue";
|
||||||
|
import noticeManage from "@/components/setting/notice/NoticeManage.vue";
|
||||||
|
import attachmentManage from "@/components/setting/attachment/AttachmentManage.vue";
|
||||||
|
|
||||||
const originalPush = VueRouter.prototype.push
|
const originalPush = VueRouter.prototype.push
|
||||||
VueRouter.prototype.push = function push(location) {
|
VueRouter.prototype.push = function push(location) {
|
||||||
return originalPush.call(this, location).catch(err => err)
|
return originalPush.call(this, location).catch(err => err)
|
||||||
}
|
}
|
||||||
Vue.use(VueRouter)
|
Vue.use(VueRouter)
|
||||||
|
|
||||||
const routes = [
|
const routes = [
|
||||||
{
|
{
|
||||||
path: '/',
|
path: '/',
|
||||||
redirect: '/index'
|
redirect: '/index'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/index',
|
path: '/index',
|
||||||
redirect: '/home',
|
redirect: '/home',
|
||||||
name: 'index',
|
name: 'index',
|
||||||
component: index,
|
component: index,
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: '/home',
|
path: '/home',
|
||||||
name: 'home',
|
name: 'home',
|
||||||
component: home
|
component: home
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/news',
|
path: '/news',
|
||||||
name: 'news',
|
name: 'news',
|
||||||
component: news
|
component: news
|
||||||
},{
|
}, {
|
||||||
path: '/nav',
|
path: '/nav',
|
||||||
name: 'nav',
|
name: 'nav',
|
||||||
component: navDetail
|
component: navDetail
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/myNav',
|
path: '/myNav',
|
||||||
name: 'myNav',
|
name: 'myNav',
|
||||||
component: myNav
|
component: myNav
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/settings',
|
path: '/settings',
|
||||||
redirect: '/admin',
|
redirect: '/admin',
|
||||||
name: '/settings',
|
name: '/settings',
|
||||||
component: settings,
|
component: settings,
|
||||||
|
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: '/admin',
|
path: '/admin',
|
||||||
name: '/admin',
|
name: '/admin',
|
||||||
component: personalHomePage,
|
component: personalHomePage,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/system',
|
||||||
|
name: '/system',
|
||||||
|
redirect: '/appearance',
|
||||||
|
component: systemSettings,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: '/appearance',
|
||||||
|
name: '/appearance',
|
||||||
|
component: appearanceSettings,
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/system',
|
path: '/information',
|
||||||
name: '/system',
|
name: '/information',
|
||||||
redirect: '/appearance',
|
component: informationSettings,
|
||||||
component: systemSettings,
|
|
||||||
|
|
||||||
|
|
||||||
children:[
|
},
|
||||||
{
|
{
|
||||||
path: '/appearance',
|
path: '/function',
|
||||||
name: '/appearance',
|
name: '/function',
|
||||||
component: appearanceSettings,
|
component: functionSettings,
|
||||||
|
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/website',
|
||||||
|
name: '/website',
|
||||||
|
component: websiteManage,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/onSite',
|
||||||
|
name: '/onSite',
|
||||||
|
redirect: '/baseSettings',
|
||||||
|
component: onSiteSetting,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: '/baseSettings',
|
||||||
|
name: '/baseSettings',
|
||||||
|
component: baseSettings,
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/information',
|
path: '/importExport',
|
||||||
name: '/information',
|
name: '/importExport',
|
||||||
component: informationSettings,
|
component: importExport,
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
{
|
]
|
||||||
path: '/function',
|
},
|
||||||
name: '/function',
|
{
|
||||||
component: functionSettings,
|
path: '/category',
|
||||||
|
name: '/category',
|
||||||
|
component: categoryManage,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/banner',
|
||||||
|
name: '/banner',
|
||||||
|
component: bannerManage,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/user',
|
||||||
|
name: '/user',
|
||||||
|
component: userManage,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/notice',
|
||||||
|
name: '/notice',
|
||||||
|
component: noticeManage,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/attachment',
|
||||||
|
name: '/attachment',
|
||||||
|
component: attachmentManage,
|
||||||
|
},
|
||||||
|
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
}
|
{
|
||||||
]
|
path: '/404',
|
||||||
},
|
name: 'NoPage404',
|
||||||
{
|
component: notFound,
|
||||||
path: '/website',
|
hidden: true
|
||||||
name: '/website',
|
},
|
||||||
component: websiteManage,
|
{
|
||||||
|
path: '/:pathMatch(.*)',
|
||||||
|
redirect: '/404',
|
||||||
},
|
hidden: true
|
||||||
|
},
|
||||||
{
|
|
||||||
path: '/onSite',
|
|
||||||
name: '/onSite',
|
|
||||||
redirect:'/baseSettings',
|
|
||||||
component: onSiteSetting,
|
|
||||||
|
|
||||||
|
|
||||||
children:[
|
|
||||||
{
|
|
||||||
path: '/baseSettings',
|
|
||||||
name: '/baseSettings',
|
|
||||||
component: baseSettings,
|
|
||||||
|
|
||||||
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: '/importExport',
|
|
||||||
name: '/importExport',
|
|
||||||
component: importExport,
|
|
||||||
|
|
||||||
|
|
||||||
},
|
|
||||||
]
|
|
||||||
},
|
|
||||||
|
|
||||||
],
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
|
||||||
path: '/404',
|
|
||||||
name: 'NoPage404',
|
|
||||||
component: notFound,
|
|
||||||
hidden: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: '/:pathMatch(.*)',
|
|
||||||
redirect: '/404',
|
|
||||||
hidden: true
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
const router = new VueRouter({
|
const router = new VueRouter({
|
||||||
mode: 'history',
|
mode: 'history',
|
||||||
routes
|
routes
|
||||||
})
|
})
|
||||||
// // 导航守卫:使用 router.beforeEach 注册一个全局前置守卫,判断用户是否登陆
|
// // 导航守卫:使用 router.beforeEach 注册一个全局前置守卫,判断用户是否登陆
|
||||||
router.beforeEach((to, from, next) => {
|
router.beforeEach((to, from, next) => {
|
||||||
if (to.path === '/home') {
|
if (to.path === '/home') {
|
||||||
next();
|
next();
|
||||||
} else {
|
|
||||||
let token = localStorage.getItem('Authorization');
|
|
||||||
if (token === null || token === '' || token === undefined) {
|
|
||||||
next('/home');
|
|
||||||
Vue.prototype.$notify.error({
|
|
||||||
title: '权限不够',
|
|
||||||
message: "请先登录!",
|
|
||||||
offset: 0
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
next();
|
let token = localStorage.getItem('Authorization');
|
||||||
|
if (token === null || token === '' || token === undefined) {
|
||||||
|
next('/home');
|
||||||
|
Vue.prototype.$notify.error({
|
||||||
|
title: '权限不够',
|
||||||
|
message: "请先登录!",
|
||||||
|
offset: 0
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
next();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default router
|
export default router
|
||||||
|
@ -1,7 +1,12 @@
|
|||||||
const { defineConfig } = require('@vue/cli-service')
|
const { defineConfig } = require('@vue/cli-service')
|
||||||
|
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin')
|
||||||
module.exports = defineConfig({
|
module.exports = defineConfig({
|
||||||
transpileDependencies: true,
|
transpileDependencies: true,
|
||||||
lintOnSave:false,//关闭语法检查
|
lintOnSave:false,//关闭语法检查
|
||||||
|
configureWebpack: {
|
||||||
|
plugins: [new NodePolyfillPlugin()],
|
||||||
|
resolve: { fallback: { fs: false } }
|
||||||
|
},
|
||||||
devServer: {
|
devServer: {
|
||||||
client: {
|
client: {
|
||||||
overlay: false // 编译错误时,取消全屏覆盖
|
overlay: false // 编译错误时,取消全屏覆盖
|
||||||
|
Loading…
Reference in New Issue
Block a user