This commit is contained in:
landaiqing 2023-12-23 21:33:16 +08:00
parent 81d5e7b111
commit 19f6259c78
6 changed files with 83 additions and 147 deletions

View File

@ -21,7 +21,7 @@
<i class="upload el-icon-upload"></i>
</div>
<div class="login-div">
<div v-show="isLogin" class="login-div">
<i @click="openLoginDialog" class="login el-icon-s-custom"></i>
</div>
</div>
@ -303,10 +303,12 @@ export default {
repassword: [{required: true, message: "请输入确认密码", trigger: "blur"}],
activeCode: [{required: true, message: "请输入验证码", trigger: "blur"}],
},
userToken: ''
userToken: '',
isLogin:true,
}
},
mounted() {
this.isLogin = !localStorage.getItem("Authorization");
this.toggleActive();
this.reacherBarFun();
this.changeImg();
@ -390,7 +392,6 @@ export default {
type: 'success',
offset: 0
});
_this.$store.state.isLogin='1';
// _this.userToken = 'Bearer ' + res.data.token;
_this.userToken = res.data.token;
_this.changeLogin({ Authorization: _this.userToken });
@ -398,6 +399,7 @@ export default {
setTimeout(()=>{
window.location.reload();
},2000)
}
}).catch((error)=>{

View File

@ -22,108 +22,21 @@
</a>
</div>
</div>
<div class="side-wrapper">
<div class="side-title">Categories</div>
<div class="side-menu">
<a href="#">
<svg viewBox="0 0 488.455 488.455" fill="currentColor">
<path d="M287.396 216.317c23.845 23.845 23.845 62.505 0 86.35s-62.505 23.845-86.35 0-23.845-62.505 0-86.35 62.505-23.845 86.35 0"></path>
<path d="M427.397 91.581H385.21l-30.544-61.059H133.76l-30.515 61.089-42.127.075C27.533 91.746.193 119.115.164 152.715L0 396.86c0 33.675 27.384 61.074 61.059 61.074h366.338c33.675 0 61.059-27.384 61.059-61.059V152.639c-.001-33.674-27.385-61.058-61.059-61.058zM244.22 381.61c-67.335 0-122.118-54.783-122.118-122.118s54.783-122.118 122.118-122.118 122.118 54.783 122.118 122.118S311.555 381.61 244.22 381.61z"></path>
</svg>
Photography
</a>
<a href="#">
<svg viewBox="0 0 512 512" fill="currentColor">
<circle cx="295.099" cy="327.254" r="110.96" transform="rotate(-45 295.062 327.332)"></circle>
<path d="M471.854 338.281V163.146H296.72v41.169a123.1 123.1 0 01121.339 122.939c0 3.717-.176 7.393-.5 11.027zM172.14 327.254a123.16 123.16 0 01100.59-120.915L195.082 73.786 40.146 338.281H172.64c-.325-3.634-.5-7.31-.5-11.027z"></path>
</svg>
Graphic Design
</a>
<a href="#">
<svg viewBox="0 0 58 58" fill="currentColor">
<path d="M57 6H1a1 1 0 00-1 1v44a1 1 0 001 1h56a1 1 0 001-1V7a1 1 0 00-1-1zM10 50H2v-9h8v9zm0-11H2v-9h8v9zm0-11H2v-9h8v9zm0-11H2V8h8v9zm26.537 12.844l-11 7a1.007 1.007 0 01-1.018.033A1.001 1.001 0 0124 36V22a1.001 1.001 0 011.538-.844l11 7a1.003 1.003 0 01-.001 1.688zM56 50h-8v-9h8v9zm0-11h-8v-9h8v9zm0-11h-8v-9h8v9zm0-11h-8V8h8v9z"></path>
</svg>
Video
</a>
<a href="#">
<svg viewBox="0 0 512 512" fill="currentColor">
<path d="M499.377 46.402c-8.014-8.006-18.662-12.485-29.985-12.613a41.13 41.13 0 00-.496-.003c-11.142 0-21.698 4.229-29.771 11.945L198.872 275.458c25.716 6.555 47.683 23.057 62.044 47.196a113.544 113.544 0 0110.453 23.179L500.06 106.661C507.759 98.604 512 88.031 512 76.89c0-11.507-4.478-22.33-12.623-30.488zM176.588 302.344a86.035 86.035 0 00-3.626-.076c-20.273 0-40.381 7.05-56.784 18.851-19.772 14.225-27.656 34.656-42.174 53.27C55.8 397.728 27.795 409.14 0 416.923c16.187 42.781 76.32 60.297 115.752 61.24 1.416.034 2.839.051 4.273.051 44.646 0 97.233-16.594 118.755-60.522 23.628-48.224-5.496-112.975-62.192-115.348z"></path>
</svg>
Illustrations
</a>
<a href="#">
<svg viewBox="0 0 512 512" fill="currentColor">
<path d="M497 151H316c-8.401 0-15 6.599-15 15v300c0 8.401 6.599 15 15 15h181c8.401 0 15-6.599 15-15V166c0-8.401-6.599-15-15-15zm-76 270h-30c-8.401 0-15-6.599-15-15s6.599-15 15-15h30c8.401 0 15 6.599 15 15s-6.599 15-15 15zm0-180h-30c-8.401 0-15-6.599-15-15s6.599-15 15-15h30c8.401 0 15 6.599 15 15s-6.599 15-15 15z"></path>
<path d="M15 331h196v60h-75c-8.291 0-15 6.709-15 15s6.709 15 15 15h135v-30h-30v-60h30V166c0-24.814 20.186-45 45-45h135V46c0-8.284-6.716-15-15-15H15C6.716 31 0 37.716 0 46v270c0 8.284 6.716 15 15 15z"></path>
</svg>
UI/UX
</a>
<a href="#">
<svg viewBox="0 0 512 512" fill="currentColor">
<path d="M0 331v112.295a14.996 14.996 0 007.559 13.023L106 512V391L0 331zM136 391v121l105-60V331zM271 331v121l105 60V391zM406 391v121l98.441-55.682A14.995 14.995 0 00512 443.296V331l-106 60zM391 241l-115.754 57.876L391 365.026l116.754-66.15zM262.709 1.583a15.006 15.006 0 00-13.418 0L140.246 57.876 256 124.026l115.754-66.151L262.709 1.583zM136 90v124.955l105 52.5V150zM121 241L4.246 298.876 121 365.026l115.754-66.15zM271 150v117.455l105-52.5V90z"></path>
</svg>
3D/AR
</a>
</div>
</div>
<div class="side-wrapper">
<div class="side-title">Fonts</div>
<div class="side-menu">
<a href="#">
<svg viewBox="0 0 332 332" fill="currentColor">
<path d="M282.341 8.283C275.765 2.705 266.211 0 253.103 0c-18.951 0-36.359 5.634-51.756 16.743-14.972 10.794-29.274 28.637-42.482 53.028-4.358 7.993-7.428 11.041-8.973 12.179h-26.255c-10.84 0-19.626 8.786-19.626 19.626 0 8.989 6.077 16.486 14.323 18.809l-.05.165h.589c1.531.385 3.109.651 4.757.651h18.833l-32.688 128.001c-7.208 27.848-10.323 37.782-11.666 41.24-1.445 3.711-3.266 7.062-5.542 10.135-.42-5.39-2.637-10.143-6.508-13.854-4.264-4.079-10.109-6.136-17.364-6.136-8.227 0-15.08 2.433-20.37 7.229-5.416 4.93-8.283 11.193-8.283 18.134 0 5.157 1.701 12.712 9.828 19.348 6.139 4.97 14.845 7.382 26.621 7.382 17.096 0 32.541-4.568 45.891-13.577 13.112-8.845 24.612-22.489 34.166-40.522 9.391-17.678 18.696-45.124 28.427-83.9l18.598-73.479h30.016c10.841 0 19.625-8.785 19.625-19.625s-8.784-19.626-19.625-19.626h-19.628c6.34-21.62 14.175-37.948 23.443-48.578 2.284-2.695 5.246-5.692 8.412-7.678-1.543 3.392-2.325 6.767-2.325 10.055 0 6.164 2.409 11.714 6.909 16.03 4.484 4.336 10.167 6.54 16.888 6.54 7.085 0 13.373-2.667 18.17-7.716 4.76-5.005 7.185-11.633 7.185-19.703.017-9.079-3.554-16.899-10.302-22.618z"></path>
</svg>
Manage Fonts
</a>
</div>
</div>
<div class="side-wrapper">
<div class="side-title">Resource Links</div>
<div class="side-menu">
<a href="#">
<svg viewBox="0 0 512 512" fill="currentColor">
<path d="M467 0H45C20.186 0 0 20.186 0 45v422c0 24.814 20.186 45 45 45h422c24.814 0 45-20.186 45-45V45c0-24.814-20.186-45-45-45zM181 241c41.353 0 75 33.647 75 75s-33.647 75-75 75-75-33.647-75-75c0-8.291 6.709-15 15-15s15 6.709 15 15c0 24.814 20.186 45 45 45s45-20.186 45-45-20.186-45-45-45c-41.353 0-75-33.647-75-75s33.647-75 75-75 75 33.647 75 75c0 8.291-6.709 15-15 15s-15-6.709-15-15c0-24.814-20.186-45-45-45s-45 20.186-45 45 20.186 45 45 45zm180 120h30c8.291 0 15 6.709 15 15s-6.709 15-15 15h-30c-24.814 0-45-20.186-45-45V211h-15c-8.291 0-15-6.709-15-15s6.709-15 15-15h15v-45c0-8.291 6.709-15 15-15s15 6.709 15 15v45h45c8.291 0 15 6.709 15 15s-6.709 15-15 15h-45v135c0 8.276 6.724 15 15 15z"></path>
</svg>
Stock
</a>
<a href="#">
<svg viewBox="0 0 511.441 511.441" fill="currentColor">
<path d="M255.721 347.484L90.22 266.751v106.57l165.51 73.503 165.509-73.503V266.742z"></path>
<path d="M511.441 189.361L255.721 64.617 0 189.361l255.721 124.744 195.522-95.378v111.032h30V204.092z"></path>
</svg>
Tutorials
</a>
<a href="#">
<svg viewBox="0 0 512 512" fill="currentColor">
<path d="M196 151h-75v90h75c24.814 0 45-20.186 45-45s-20.186-45-45-45z"></path>
<path d="M467 0H45C20.186 0 0 20.186 0 45v422c0 24.814 20.186 45 45 45h422c24.814 0 45-20.186 45-45V45c0-24.814-20.186-45-45-45zM196 271h-75v105c0 8.291-6.709 15-15 15s-15-6.709-15-15V136c0-8.291 6.709-15 15-15h90c41.353 0 75 33.647 75 75s-33.647 75-75 75zm210-60c8.291 0 15 6.709 15 15s-6.709 15-15 15h-45v135c0 8.291-6.709 15-15 15s-15-6.709-15-15V241h-15c-8.291 0-15-6.709-15-15s6.709-15 15-15h15v-45c0-24.814 20.186-45 45-45h30c8.291 0 15 6.709 15 15s-6.709 15-15 15h-30c-8.276 0-15 6.724-15 15v45h45z"></path>
</svg>
Portfolio
</a>
<a href="#">
<svg viewBox="0 0 512 512" fill="currentColor">
<path d="M181 181h-60v60h60c16.54 0 30-13.46 30-30s-13.46-30-30-30zm0 0M181 271h-60v60h60c16.54 0 30-13.46 30-30s-13.46-30-30-30zm0 0M346 241c-19.555 0-36.238 12.54-42.438 30h84.875c-6.199-17.46-22.882-30-42.437-30zm0 0"></path>
<path d="M436 0H75C33.648 0 0 33.648 0 75v362c0 41.352 33.648 75 75 75h361c41.352 0 76-33.648 76-75V75c0-41.352-34.648-75-76-75zM286 151h120v30H286zm-45 150c0 33.09-26.91 60-60 60H91V151h90c33.09 0 60 26.91 60 60 0 18.008-8.133 33.996-20.73 45 12.597 11.004 20.73 26.992 20.73 45zm180 0H303.562c6.196 17.46 22.883 30 42.438 30 16.012 0 30.953-8.629 38.992-22.516l25.957 15.032C397.58 346.629 372.687 361 346 361c-41.352 0-75-33.648-75-75s33.648-75 75-75 75 33.648 75 75zm0 0"></path>
</svg>
Behance
</a>
<a href="#">
<svg viewBox="0 0 512 512" fill="currentColor">
<path d="M352 0H64C28.704 0 0 28.704 0 64v320a16.02 16.02 0 009.216 14.496A16.232 16.232 0 0016 400c3.68 0 7.328-1.248 10.24-3.712L117.792 320H352c35.296 0 64-28.704 64-64V64c0-35.296-28.704-64-64-64z"></path>
<path d="M464 128h-16v128c0 52.928-43.072 96-96 96H129.376L128 353.152V400c0 26.464 21.536 48 48 48h234.368l75.616 60.512A16.158 16.158 0 00496 512c2.336 0 4.704-.544 6.944-1.6A15.968 15.968 0 00512 496V176c0-26.464-21.536-48-48-48z"></path>
</svg>
Social Forum
</a>
</div>
</div>
<el-tree :data="category" :props="defaultProps"></el-tree>
</div>
</template>
<script>
export default {
name:"LeftSide",
props:{
category:Array
},
data() {
return {
defaultProps: {
children: 'childUC',
label: 'name'
}
}},
mounted() {

View File

@ -13,13 +13,18 @@ export default {
return {}
},
mounted() {
this.removeToken();
},
created() {
},
computed: {},
methods: {}
methods: {
removeToken(){
// localStorage.removeItem("Authorization")
// console.log(localStorage.getItem("Authorization"));
}
}
}
</script>

View File

@ -59,13 +59,13 @@ const routes = [
redirect: '/admin',
name: '/settings',
component: settings,
meta:{Authorization:true},
children: [
{
path: '/admin',
name: '/admin',
component: personalHomePage,
meta:{Authorization:true},
},
{
@ -73,28 +73,28 @@ const routes = [
name: '/system',
redirect: '/appearance',
component: systemSettings,
meta:{Authorization:true},
children:[
{
path: '/appearance',
name: '/appearance',
component: appearanceSettings,
meta:{Authorization:true},
},
{
path: '/information',
name: '/information',
component: informationSettings,
meta:{Authorization:true},
},
{
path: '/function',
name: '/function',
component: functionSettings,
meta:{Authorization:true},
}
]
@ -103,7 +103,7 @@ const routes = [
path: '/website',
name: '/website',
component: websiteManage,
meta:{Authorization:true},
},
@ -112,21 +112,21 @@ const routes = [
name: '/onSite',
redirect:'/baseSettings',
component: onSiteSetting,
meta:{Authorization:true},
children:[
{
path: '/baseSettings',
name: '/baseSettings',
component: baseSettings,
meta:{Authorization:true},
},
{
path: '/importExport',
name: '/importExport',
component: importExport,
meta:{Authorization:true},
},
]
@ -148,7 +148,8 @@ const routes = [
path: '/:pathMatch(.*)',
redirect: '/404',
hidden: true
}
},
]
@ -158,39 +159,22 @@ const router = new VueRouter({
routes
})
// // 导航守卫:使用 router.beforeEach 注册一个全局前置守卫,判断用户是否登陆
// router.beforeEach((to, from, next) => {
// if (to.path === '/home') {
// next();
// } else {
// let token = localStorage.getItem('Authorization');
// if (token === null || token === '') {
// next('/home');
// } else {
// next();
// }
// }
// });
// 全局路由构造函数,判断是否登录和要跳转到页面
router.beforeEach((to, from, next) => {
if (to.matched.some(m => m.meta.requiresAuth)) { // 需要登录
if(window.localStorage.Authorization && window.localStorage.isLogin === '1'){
next()
} else if (to.path !== '/home') {
let token = localStorage.getItem('Authorization');
if (token === 'null' || token === '' || token === undefined){
next({path: '/home'})
// Toast({ message: '检测到您还未登录,请登录后操作!', duration: 1500 })
Vue.prototype.$notify.error({
if (to.path === '/home') {
next();
} else {
let token = localStorage.getItem('Authorization');
if (token === null || token === '' || token === undefined) {
next('/home');
Vue.prototype.$notify.error({
title: '权限不够',
message: "请先登录!",
offset: 0
});
}
} else {
next()
next();
}
} else { // 不需要登录
next()
}
})
});
export default router

View File

@ -8,15 +8,8 @@ export default new Vuex.Store({
theme:'dark',
// 存储token
Authorization: localStorage.getItem('Authorization') ? localStorage.getItem('Authorization') : '',
isLogin:'0',
},
getters: {
getStorage(state){ // 获取本地存储的登录信息
if(!state.Authorization){
state.Authorization =JSON.parse(localStorage.getItem(key))
}
return state.Authorization
}
},
mutations: {
SET_THEME:(state,data)=>{

View File

@ -19,7 +19,7 @@
<HomeHeader></HomeHeader>
<!-- <router-view></router-view>-->
<div class="wrapper">
<LeftSide></LeftSide>
<LeftSide :category="category"></LeftSide>
<router-view></router-view>
</div>
<div class="overlay-app"></div>
@ -31,6 +31,8 @@
// @ is an alias to /src
import HomeHeader from "@/components/home/HomeHeader.vue";
import LeftSide from "@/components/home/LeftSide.vue";
import axios from "axios";
import Vue from "vue";
export default {
@ -42,10 +44,15 @@ export default {
data() {
return {
isLight:false,
darkMode:window.sessionStorage.getItem('theme')
darkMode:window.sessionStorage.getItem('theme'),
folderTrue:[],
folderFalse:[],
category:[],
}
},
mounted() {
this.getCategories();
let nowDate=new Date()
let hour=nowDate.getHours()
//
@ -85,6 +92,38 @@ export default {
// document.body.classList.toggle('light-mode');
// });
// }
getCategories(){
let _this=this;
axios({
method: 'post',
url: '/api//UrlAndCate/disposeBookmarkExhibitedToJson',
}).then(function (res) {
console.log(res);
_this.category=res.data.data;
_this.extractData(res.data.data,_this.folderTrue,_this.folderFalse);
console.log(_this.folderTrue);
console.log(_this.folderFalse);
}).catch((error)=>{
Vue.prototype.$notify.error({
title: '错误',
message: error,
offset: 0
});
})
},
extractData(data, trueArray,falseArray) {
data.forEach((item) => {
if (item.floder === 'true') {
trueArray.push(item);
if (item.childUC && item.childUC.length > 0) {
this.extractData(item.childUC, trueArray,falseArray);
}
} else if (item.floder === 'false') {
falseArray.push(item);
}
});
},
}
}
</script>