123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434 |
- <template>
- <el-container>
- <LoadingAll :isType="2">
- <el-container class="main">
- <div class="main-left">
- <el-aside class="el-main-left-aside">
- <div style="padding: 20px;padding-left: 20px;font-weight: 600;border-bottom: 1px solid #f1f1f1;font-size: 16px;">积分系统</div>
- <el-menu :default-active="defaultActive" class="el-menu-vertical-demo" ref="elMenu" :router="true" @select="activeRouter" :unique-opened="true">
- <template v-for="(item, index) in routers">
- <div v-if="item.children.length != 0" :key="index">
- <!-- <el-submenu :index="index.toString()" :key="index" v-if="item.children.length >= 1 && item.name != '首页'">-->
- <el-submenu :index="index.toString()" :key="index" v-if="item.children.length >= 1 && !['首页','工作台'].includes(item.name)">
- <template slot="title">
- <div class="flex-box-ce">
- <svg-icon :icon-class="item.icon" class="svgIcon"></svg-icon>
- <span style="margin-left: 5px;">{{ item.name }}</span>
- </div>
- </template>
- <template v-for="(item2, index2) in item.children">
- <el-menu-item :index="returnIndex(index, index2)" :ref="item2.path" :route="item2.path" :key="index2" class="font-flex-word">
- <span slot="title" style="margin-left: 10px;width:120px">{{ item2.name }}</span>
- </el-menu-item>
- </template>
- </el-submenu>
- <el-menu-item v-else :index="returnIndex(index, index)" :route="item.children[0].path" :ref="item.children[0].path">
- <div class="flex-box-ce">
- <svg-icon :icon-class="item.icon" class="svgIcon"></svg-icon>
- <span slot="title" style="margin-left: 5px;">{{ item.children[0].name }}</span>
- </div>
- </el-menu-item>
- </div>
- </template>
- </el-menu>
- </el-aside>
- </div>
- <el-main>
- <router-view />
- </el-main>
- </el-container>
- </LoadingAll>
- </el-container>
- </template>
- <script>
- import {mapGetters} from 'vuex';
- import LoadingAll from '@/components/LoadingAll';
- export default {
- components:{LoadingAll},
- data() {
- return {
- routers: [],
- defaultActive: '0-0',
- };
- },
- watch: {
- $route(to, from) {
- var str = to.path;
- this.routers.map((item, index) => {
- if (item.children.length > 0) {
- item.children.map((item2, index2) => {
- if (item2.path == str) {
- this.defaultActive = index + '-' + index2;
- this.$setCache('point_path', index + '-' + index2);
- }
- });
- }
- });
- }
- },
- computed: {
- ...mapGetters(['site_info'])
- },
- created() {
- if(this.site_info.integral&&this.site_info.integral.enable){
- this.initRouter();
- }
- },
- methods: {
- initRouter() {
- setTimeout(()=>{
- this.routers = [
- { name: '首页', children: this.returnRoutersArr('home'), icon: '#icon-shezhi_qiyexinxi' },
- { name: '工作台', children: this.returnRoutersArr('workbench'), icon: '#icon-biaoqian_guanlizhongxin' },
- { name: '基础设置', children: this.returnRoutersArr('basics'), icon: '#icon-shezhi_jichushezhi' },
- { name: '积分管理', children: this.returnRoutersArr('integral'), icon: '#icon-PC_gongzuotai_ABfen' },
- { name: '任务管理', children: this.returnRoutersArr('task'), icon: '#icon-tongji_jifenshijian1' },
- { name: '考勤管理', children: this.returnRoutersArr('attendance'), icon: '#icon-kaoqindaka_daka' },
- { name: '排名&统计', children: this.returnRoutersArr('statistics'), icon: '#icon-kaoqindaka_paiming' },
- // { name: 'A分', children: this.returnRoutersArr('aPoints'), icon: '#icon-kaoqin_kaoqinshenpi' },
- ];
- let point_path=this.$getCache('point_path');
- if (point_path) {
- this.defaultActive = point_path;
- if(point_path=='0-0'){
- this.$router.push({ path:'/pointHome'});
- }
- }
- let pointIndex=this.$getCache('pointIndex');
- if (pointIndex) {
- this.$router.push({ path:pointIndex});
- this.$removeCache('pointIndex')
- }
- },500)
- },
- //当刷新页面是控制左边导航栏的选中
- activeRouter(index, indexPath) {
- this.$setCache('point_path', indexPath[1] ? indexPath[1] : indexPath[0]);
- },
- routerAstrict(data) {
- //限制路由
- let obj = [];
- let supAuthority = this.$supremeAuthority(); //$supremeAuthority获取当前登录者的最高权限
- data.forEach(item => {
- if (!item.hidden) {
- if (!item.meta.jurisdiction) {
- obj.push(item);
- } else {
- if (item.meta.jurisdiction.indexOf(supAuthority) >= 0) {
- obj.push(item);
- }
- }
- }
- });
- return obj;
- },
- returnRoutersArr(str, bool) {
- let routers = [];
- this.$router.options.routes[0].children.some((item, i) => {
- if (item.name == 'pointIndex') {
- routers=item.children
- return true;
- }
- });
- var routersArr = [];
- routers.forEach(item => {
- if (item.meta.groupCode == str) {
- //获取对应模块的路由
- routersArr.push(item);
- }
- });
- if (bool) {
- return routersArr;
- }
- return this.routerAstrict(routersArr);
- },
- returnIndex(str, str2) {
- return str + '-' + str2;
- }
- }
- };
- </script>
- <style scoped="scoped" lang="scss">
- .announDetails {
- ::v-deep img {
- width: 100%;
- }
- }
- .updateNotice ::v-deep .el-dialog {
- border-radius: 10px;
- .el-dialog__header {
- padding: 13px 20px;
- text-align: center;
- background-color: #3193fc;
- border-radius: 8px 8px 0 0;
- .el-dialog__title {
- font-size: 16px;
- color: #fff;
- }
- .el-icon-close {
- color: #fff;
- }
- }
- .el-dialog__body {
- padding: 20px 20px 30px 20px;
- }
- .el-dialog__footer {
- .dialog-footer {
- .is-round {
- padding: 10px 19px;
- border-radius: 15px;
- }
- }
- }
- }
- /deep/ .el-aside {
- transition: width 0.28s;
- width: 180px !important;
- height: calc(100vh - 80px);
- background-color: #fff;
- }
- /deep/ .el-aside::-webkit-scrollbar {
- width: 0px;
- background-color: #fff;
- }
- /deep/ .el-aside::-webkit-scrollbar-thumb {
- background-color: #ccc;
- }
- .navigation {
- position: fixed;
- right: 20px;
- bottom: 100px;
- z-index: 999;
- }
- .navigationBox {
- background-color: #409eff;
- color: #fff;
- font-size: 12px;
- margin-top: 20px;
- text-align: center;
- }
- .navigationItem {
- padding: 6px;
- cursor: pointer;
- }
- .navigationItem:hover {
- background-color: #005bea;
- }
- .svgIcon {
- font-size: 20px;
- color: #99a9bf;
- }
- .money {
- line-height: 32px;
- text-align: center;
- height: 32px;
- color: #ff9600;
- width: 88px;
- background: #ffffff;
- border: 1px solid #ff9600;
- opacity: 1;
- border-radius: 3px;
- cursor: pointer;
- margin-left: 20px;
- }
- .money2 {
- line-height: 32px;
- text-align: center;
- height: 32px;
- color: #409eff;
- width: 120px;
- background: #ffffff;
- border: 1px solid #409eff;
- opacity: 1;
- border-radius: 3px;
- cursor: pointer;
- margin: 0 20px;
- padding-left: 10px;
- }
- .megData div:nth-child(1) {
- background-image: linear-gradient(to bottom, #5e6e9b 0%, #232d48 100%);
- text-align: center;
- color: #e1bf66;
- border-top-left-radius: 25px;
- border-bottom-left-radius: 25px;
- line-height: 35px;
- height: 35px;
- padding: 0 10px;
- }
- .megData div:nth-child(2) {
- background-image: linear-gradient(to bottom, #ffeab2 0%, #e1bf66 100%);
- text-align: center;
- color: #232d48;
- border-top-right-radius: 25px;
- border-bottom-right-radius: 25px;
- line-height: 35px;
- height: 35px;
- padding: 0 10px;
- }
- .routerActive {
- background-color: #199afb !important;
- }
- .active {
- color: #409eff;
- background-color: rgba(38, 162, 255, 0.1);
- }
- .right-menu {
- float: right;
- height: 100%;
- display: flex;
- align-items: center;
- &:focus {
- outline: none;
- }
- .right-menu-item {
- display: inline-block;
- margin: 0 8px;
- }
- .screenfull {
- height: 20px;
- }
- .international {
- vertical-align: top;
- }
- .theme-switch {
- vertical-align: 15px;
- }
- .avatar-container {
- height: 60px;
- margin-right: 30px;
- .avatar-wrapper {
- cursor: pointer;
- margin-top: 5px;
- position: relative;
- .user-avatar {
- width: 40px;
- height: 40px;
- border-radius: 10px;
- }
- .el-icon-caret-bottom {
- position: absolute;
- right: -20px;
- top: 25px;
- font-size: 12px;
- }
- }
- }
- }
- .el-menu-vertical-demo:not(.el-menu--collapse) {
- width: 180px;
- }
- .el-header {
- background-color: #fff;
- padding: 0 !important;
- border-bottom: 1px solid #f1f1f1;
- min-width: 1100px;
- }
- .el-menu {
- overflow: hidden;
- border: none;
- }
- .con_nav_left {
- background: #fff;
- overflow-y: scroll;
- }
- .box-all {
- height: 100%;
- overflow: hidden;
- }
- .el-main {
- background-color: #f0f4fa;
- height: calc(100vh - 80px);
- overflow-y: scroll;
- padding:0 10px;
- min-width: 1100px;
- }
- .logo-box {
- width: 180px;
- cursor: pointer;
- }
- .logo-box .logo {
- width: 30px;
- height: 30px;
- margin-right: 5px;
- border-radius: 6px;
- }
- .logo-box div {
- font-size: 16px;
- font-weight: 600;
- }
- .wn {
- height: 26px;
- width: 26px;
- margin-right: 12px;
- cursor: pointer;
- }
- .hea-right {
- padding: 0 20px;
- }
- .upgrade {
- margin-left: 10px;
- margin-right: 10px;
- }
- /deep/ .el-menu-item {
- padding-right: 10px !important;
- }
- /deep/ .el-menu-item.is-active {
- color: #409eff;
- background-color: #ecf5ff;
- }
- /deep/ .el-submenu .el-menu-item {
- min-width: 180px;
- box-sizing: border-box;
- }
- .main-left {
- position: relative;
- .el-main-left-aside {
- // padding-bottom: 90px;
- }
- .menu-bot-but {
- position: absolute;
- bottom: 0;
- width: 100%;
- background-color: #fff;
- text-align: center;
- padding-bottom: 30px;
- span {
- width: 86%;
- display: inline-block;
- height: 50px;
- background-color: #ecf5ff;
- line-height: 50px;
- text-align: center;
- color: #409eff;
- border: 1px solid #409eff;
- border-radius: 3px;
- cursor: pointer;
- transition: all 0.5s;
- }
- span:hover {
- background-color: #e0eeff;
- color: #2892e2;
- }
- }
- }
- </style>
|