diff --git a/src/layouts/header/index.vue b/src/layouts/header/index.vue index 4505aac..3f9c0b6 100644 --- a/src/layouts/header/index.vue +++ b/src/layouts/header/index.vue @@ -39,13 +39,14 @@ export default { }, methods: { + ...mapActions('user', [ + 'logout' + ]), toPerson(){ this.$router.push('/setting/person') }, loginout() { - sessionStorage.removeItem(Setting.usernameKey); - sessionStorage.removeItem(Setting.storeKey); - location.reload() + this.logout() }, back(){ this.$router.back() diff --git a/src/libs/auth/generateBtnPermission.js b/src/libs/auth/generateBtnPermission.js index fff1faa..8ff2f6b 100644 --- a/src/libs/auth/generateBtnPermission.js +++ b/src/libs/auth/generateBtnPermission.js @@ -2,7 +2,7 @@ * @description 生成按钮级别权限组 * */ -import store from '@/store'; +import store from '@/store' export default function(data){ let result = [] data.map(e => { @@ -21,6 +21,6 @@ export default function(data){ }) } }) - store.commit('addBtnPerData',{btnPermissions: result}) + store.auth.commit('addBtnAuth',{btns: result}) // console.log('geneBtn:',result) } diff --git a/src/libs/bus.js b/src/libs/bus.js index b433c90..e1402d8 100644 --- a/src/libs/bus.js +++ b/src/libs/bus.js @@ -1,6 +1,6 @@ -import Vue from 'vue'; +import Vue from 'vue' // 使用 Event Bus -const bus = new Vue(); +const bus = new Vue() -export default bus; \ No newline at end of file +export default bus \ No newline at end of file diff --git a/src/libs/route/addRoutes.js b/src/libs/route/addRoutes.js index 51071df..6208af7 100644 --- a/src/libs/route/addRoutes.js +++ b/src/libs/route/addRoutes.js @@ -1,6 +1,6 @@ -import store from '@/store'; -import router from '@/router'; -import generateBtnPermission from '../auth/generateBtnPermission'; +import store from '@/store' +import router from '@/router' +import generateBtnPermission from '../auth/generateBtnPermission' const infoSidebar = ['information','content'] const matchSidebar = ['matchintro','matchprogress','matchsignup'] @@ -33,7 +33,7 @@ export default function(data,path){ createRoute(data) let routes = router.options.routes routes[1].children = [...routes[1].children,...newRoutes] - store.commit("addRoutesData", { routes }) + store.auth.commit("addRoutes", { routes }) router.addRoutes(routes) setTimeout(() => { !newRoutes.find(n => n.name == 'dashboard') && router.push(newRoutes[0].path) diff --git a/src/libs/route/generateRoutes.js b/src/libs/route/generateRoutes.js index 0938250..2762f9a 100644 --- a/src/libs/route/generateRoutes.js +++ b/src/libs/route/generateRoutes.js @@ -1,10 +1,9 @@ -import store from '@/store'; -import router from '@/router'; +import store from '@/store' +import router from '@/router' export default function(){ setTimeout(() => { - let routes = store.state.routes - console.log(333,routes) + let routes = store.state.auth.routes routes.forEach(e => { if(e.path == '/'){ e.component = () => import('@/layouts/home/index.vue') diff --git a/src/libs/route/resetRouter.js b/src/libs/route/resetRouter.js index 096e4f5..478cfd5 100644 --- a/src/libs/route/resetRouter.js +++ b/src/libs/route/resetRouter.js @@ -1,4 +1,4 @@ -import router from '@/router'; +import router from '@/router' export default function(){ const newRouter = createRouter() diff --git a/src/libs/util.cookies.js b/src/libs/util.cookies.js index 63c9a8b..5085a59 100644 --- a/src/libs/util.cookies.js +++ b/src/libs/util.cookies.js @@ -1,7 +1,7 @@ -import Cookies from 'js-cookie'; -import Setting from '@/setting'; +import Cookies from 'js-cookie' +import Setting from '@/setting' -const cookies = {}; +const cookies = {} /** * @description 存储 cookie 值 diff --git a/src/libs/util.js b/src/libs/util.js index 12204d9..1c8fb9a 100644 --- a/src/libs/util.js +++ b/src/libs/util.js @@ -1,5 +1,5 @@ -import cookies from './util.cookies'; -import {_local,_session} from './util.db'; +import cookies from './util.cookies' +import {_local,_session} from './util.db' const util = { cookies, @@ -57,7 +57,22 @@ const util = { break; } } + }, + // 传入文件后缀判断是否是视频 + isVideo(ext) { + if('mp4,3gp,mov,m4v,avi,dat,mkv,flv,vob,rmvb,rm,qlv'.includes(ext)) return true + return false + }, + // 传入文件后缀判断是否是音频 + isAudio(ext) { + if('mp3,aac,ape,flac,wav,wma,amr,mid'.includes(ext)) return true + return false + }, + // 传入文件后缀判断是否是图片 + isImg(ext) { + if('jpg,jpeg,png,gif,svg,psd'.includes(ext)) return true + return false } -}; +} -export default util; \ No newline at end of file +export default util \ No newline at end of file diff --git a/src/pages/account/login/index.vue b/src/pages/account/login/index.vue index 71924d4..88d36cb 100644 --- a/src/pages/account/login/index.vue +++ b/src/pages/account/login/index.vue @@ -94,11 +94,9 @@ export default { this.login(data).then(() => { this.$router.replace('/index') }) - .catch(() => { - - }) + .catch(() => {}) } - }); + }) } }, }; diff --git a/src/plugins/auth/index.js b/src/plugins/auth/index.js index b76d1c9..0ffa5b5 100644 --- a/src/plugins/auth/index.js +++ b/src/plugins/auth/index.js @@ -13,7 +13,7 @@ export default { }else{ btnText = `${vnode.context.$route.name}:${el.innerText}` } - const btnPermissions = store.state.btnPermissions; + const btnPermissions = store.state.auth.btns; // console.log(22,btnText,btnPermissions) if (btnText && btnPermissions && btnPermissions.length) { diff --git a/src/store/modules/auth.js b/src/store/modules/auth.js new file mode 100644 index 0000000..4ffed5e --- /dev/null +++ b/src/store/modules/auth.js @@ -0,0 +1,26 @@ +/** + * 权限管理 + * */ +export default { + namespaced: true, + state: { + btns: [], + routes: [] + }, + mutations: { + SET_BTN_AUTH: (state, btns) => { + state.btns = btns + }, + SET_ROUTE: (state, routes) => { + state.routes = routes + }, + }, + actions: { + addBtnAuth({ state,commit },btns) { + commit('SET_BTN_AUTH',btns) + }, + addRoutes({ state,commit },routes) { + commit('SET_ROUTE',routes) + } + } +} \ No newline at end of file diff --git a/src/styles/lib/background.scss b/src/styles/lib/_background.scss similarity index 100% rename from src/styles/lib/background.scss rename to src/styles/lib/_background.scss diff --git a/src/styles/lib/border.scss b/src/styles/lib/_border.scss similarity index 100% rename from src/styles/lib/border.scss rename to src/styles/lib/_border.scss diff --git a/src/styles/lib/box.scss b/src/styles/lib/_box.scss similarity index 100% rename from src/styles/lib/box.scss rename to src/styles/lib/_box.scss diff --git a/src/styles/lib/cursor.scss b/src/styles/lib/_cursor.scss similarity index 100% rename from src/styles/lib/cursor.scss rename to src/styles/lib/_cursor.scss diff --git a/src/styles/lib/display.scss b/src/styles/lib/_display.scss similarity index 100% rename from src/styles/lib/display.scss rename to src/styles/lib/_display.scss diff --git a/src/styles/lib/flex.scss b/src/styles/lib/_flex.scss similarity index 100% rename from src/styles/lib/flex.scss rename to src/styles/lib/_flex.scss diff --git a/src/styles/lib/float.scss b/src/styles/lib/_float.scss similarity index 100% rename from src/styles/lib/float.scss rename to src/styles/lib/_float.scss diff --git a/src/styles/lib/font-size.scss b/src/styles/lib/_font-size.scss similarity index 100% rename from src/styles/lib/font-size.scss rename to src/styles/lib/_font-size.scss diff --git a/src/styles/lib/font-weight.scss b/src/styles/lib/_font-weight.scss similarity index 100% rename from src/styles/lib/font-weight.scss rename to src/styles/lib/_font-weight.scss diff --git a/src/styles/lib/line-height.scss b/src/styles/lib/_line-height.scss similarity index 100% rename from src/styles/lib/line-height.scss rename to src/styles/lib/_line-height.scss diff --git a/src/styles/lib/link.scss b/src/styles/lib/_link.scss similarity index 100% rename from src/styles/lib/link.scss rename to src/styles/lib/_link.scss diff --git a/src/styles/lib/overflow.scss b/src/styles/lib/_overflow.scss similarity index 100% rename from src/styles/lib/overflow.scss rename to src/styles/lib/_overflow.scss diff --git a/src/styles/lib/position.scss b/src/styles/lib/_position.scss similarity index 100% rename from src/styles/lib/position.scss rename to src/styles/lib/_position.scss diff --git a/src/styles/lib/size.scss b/src/styles/lib/_size.scss similarity index 100% rename from src/styles/lib/size.scss rename to src/styles/lib/_size.scss diff --git a/src/styles/lib/text-align.scss b/src/styles/lib/_text-align.scss similarity index 100% rename from src/styles/lib/text-align.scss rename to src/styles/lib/_text-align.scss diff --git a/src/styles/lib/text-color.scss b/src/styles/lib/_text-color.scss similarity index 100% rename from src/styles/lib/text-color.scss rename to src/styles/lib/_text-color.scss diff --git a/src/styles/lib/vertical-align.scss b/src/styles/lib/_vertical-align.scss similarity index 100% rename from src/styles/lib/vertical-align.scss rename to src/styles/lib/_vertical-align.scss diff --git a/src/styles/lib/visibility.scss b/src/styles/lib/_visibility.scss similarity index 100% rename from src/styles/lib/visibility.scss rename to src/styles/lib/_visibility.scss diff --git a/src/styles/lib/white-space.scss b/src/styles/lib/_white-space.scss similarity index 100% rename from src/styles/lib/white-space.scss rename to src/styles/lib/_white-space.scss diff --git a/src/styles/lib/index.scss b/src/styles/lib/index.scss index f8e9bf0..6003530 100644 --- a/src/styles/lib/index.scss +++ b/src/styles/lib/index.scss @@ -25,5 +25,4 @@ @import "visibility"; @import "white-space"; -@import "style"; -@import "mixin"; +@import "style"; \ No newline at end of file diff --git a/src/styles/lib/mixin.scss b/src/styles/lib/mixin.scss deleted file mode 100644 index ad48275..0000000 --- a/src/styles/lib/mixin.scss +++ /dev/null @@ -1,9 +0,0 @@ -@mixin ellipsis { - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - -.ellipsis{ - @include ellipsis(); -} \ No newline at end of file diff --git a/src/styles/pages/tree.scss b/src/styles/pages/tree.scss new file mode 100644 index 0000000..59af75b --- /dev/null +++ b/src/styles/pages/tree.scss @@ -0,0 +1,104 @@ +$insideColor: rgba(245, 242, 255, 0.8); //内部节点的边框颜色 +$outColor: rgba(255, 255, 255, 0.8); //外部节点的边框颜色 +//混合代码,提取item共同样式 +@mixin public { + cursor: pointer; + font-size: 14px; + color: #333333; + display: flex; + align-items: center; + img { + height: 20px; + width: 20px; + margin-left: 10px; + } +} + +.side_tree{ + width: 100%; + font-size: 14px; + color: #333; + i{ + margin-left: 5px; + font-size: 17px; + } + span{ + margin-left: 5px; + font-size: 14px; + } +} +.item { + @include public; + width: 100%; + padding: 15px 0; + background:rgba(255,255,255,1); + box-shadow:1px 14px 29px 0px rgba(255,69,69,0.19); + border-radius:10px; + text-align: left; + margin-top: 20px; +} +.empty{ + width: 25px; +} +.item:first{ + margin-top: 0; +} +.item1 { + @include public; + margin-top: 20px; + margin-left: 23px; +} +.item2 { + @include public; + margin-top: 20px; + margin-left:80px +} +.item3 { + @include public; + margin-top: 20px; + margin-left:95px +} +.item2:hover{ + color: #cb221c; +} +.edit{ + display: inline-block; + width: 17px; + height: 17px; + background: url(../../../assets/svg/edit.svg) 0 0/cover no-repeat; +} +// 使三角形旋转动画 +.arrowTransform { + transition: 0.4s; + transform-origin: center; + transform: rotateZ(0deg); +} +.arrowTransformReturn { + transition: 0.4s; + transform-origin: center; + transform: rotateZ(90deg); +} + +//复选框样式 +.checkBox { + width: 14px; + height: 14px; + border-radius: 7px; + margin-left: 10px; + margin-right: 10px; + border: 2px solid rgba(146, 120, 255, 1); +} + +//当点击复选框时候切换背景图片 +.isActive { + background: url('../../../assets/img/icon-yigouxuan.png'); + background-size: 14px 14px; /*按比例缩放*/ +} + +.side_icon{ + text-align: right; +} +.side_icon i{ + cursor:pointer; + font-size: 20px; +} \ No newline at end of file diff --git a/src/styles/var.scss b/src/styles/var.scss new file mode 100644 index 0000000..db7369c --- /dev/null +++ b/src/styles/var.scss @@ -0,0 +1,24 @@ +$main-color: #e80909; + +@mixin ellipsis { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} +@mixin mul-ellipsis($num) { + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: $num; + text-overflow: ellipsis; + overflow: hidden; +} + +.ellipsis{ + @include ellipsis(); +} +.mul-ellipsis2{ + @include mul-ellipsis(2); +} +.mul-ellipsis3{ + @include mul-ellipsis(3); +} \ No newline at end of file diff --git a/vue.config.js b/vue.config.js index 131cd5b..757417e 100644 --- a/vue.config.js +++ b/vue.config.js @@ -14,6 +14,9 @@ module.exports = { lintOnSave: Setting.lintOnSave, css: { loaderOptions: { + sass: { + prependData: `@import "@/styles/var.scss";` + }, postcss: { plugins: [ postcss