pointIndex.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434
  1. <template>
  2. <el-container>
  3. <LoadingAll :isType="2">
  4. <el-container class="main">
  5. <div class="main-left">
  6. <el-aside class="el-main-left-aside">
  7. <div style="padding: 20px;padding-left: 20px;font-weight: 600;border-bottom: 1px solid #f1f1f1;font-size: 16px;">积分系统</div>
  8. <el-menu :default-active="defaultActive" class="el-menu-vertical-demo" ref="elMenu" :router="true" @select="activeRouter" :unique-opened="true">
  9. <template v-for="(item, index) in routers">
  10. <div v-if="item.children.length != 0" :key="index">
  11. <!-- <el-submenu :index="index.toString()" :key="index" v-if="item.children.length >= 1 && item.name != '首页'">-->
  12. <el-submenu :index="index.toString()" :key="index" v-if="item.children.length >= 1 && !['首页','工作台'].includes(item.name)">
  13. <template slot="title">
  14. <div class="flex-box-ce">
  15. <svg-icon :icon-class="item.icon" class="svgIcon"></svg-icon>
  16. <span style="margin-left: 5px;">{{ item.name }}</span>
  17. </div>
  18. </template>
  19. <template v-for="(item2, index2) in item.children">
  20. <el-menu-item :index="returnIndex(index, index2)" :ref="item2.path" :route="item2.path" :key="index2" class="font-flex-word">
  21. <span slot="title" style="margin-left: 10px;width:120px">{{ item2.name }}</span>
  22. </el-menu-item>
  23. </template>
  24. </el-submenu>
  25. <el-menu-item v-else :index="returnIndex(index, index)" :route="item.children[0].path" :ref="item.children[0].path">
  26. <div class="flex-box-ce">
  27. <svg-icon :icon-class="item.icon" class="svgIcon"></svg-icon>
  28. <span slot="title" style="margin-left: 5px;">{{ item.children[0].name }}</span>
  29. </div>
  30. </el-menu-item>
  31. </div>
  32. </template>
  33. </el-menu>
  34. </el-aside>
  35. </div>
  36. <el-main>
  37. <router-view />
  38. </el-main>
  39. </el-container>
  40. </LoadingAll>
  41. </el-container>
  42. </template>
  43. <script>
  44. import {mapGetters} from 'vuex';
  45. import LoadingAll from '@/components/LoadingAll';
  46. export default {
  47. components:{LoadingAll},
  48. data() {
  49. return {
  50. routers: [],
  51. defaultActive: '0-0',
  52. };
  53. },
  54. watch: {
  55. $route(to, from) {
  56. var str = to.path;
  57. this.routers.map((item, index) => {
  58. if (item.children.length > 0) {
  59. item.children.map((item2, index2) => {
  60. if (item2.path == str) {
  61. this.defaultActive = index + '-' + index2;
  62. this.$setCache('point_path', index + '-' + index2);
  63. }
  64. });
  65. }
  66. });
  67. }
  68. },
  69. computed: {
  70. ...mapGetters(['site_info'])
  71. },
  72. created() {
  73. if(this.site_info.integral&&this.site_info.integral.enable){
  74. this.initRouter();
  75. }
  76. },
  77. methods: {
  78. initRouter() {
  79. setTimeout(()=>{
  80. this.routers = [
  81. { name: '首页', children: this.returnRoutersArr('home'), icon: '#icon-shezhi_qiyexinxi' },
  82. { name: '工作台', children: this.returnRoutersArr('workbench'), icon: '#icon-biaoqian_guanlizhongxin' },
  83. { name: '基础设置', children: this.returnRoutersArr('basics'), icon: '#icon-shezhi_jichushezhi' },
  84. { name: '积分管理', children: this.returnRoutersArr('integral'), icon: '#icon-PC_gongzuotai_ABfen' },
  85. { name: '任务管理', children: this.returnRoutersArr('task'), icon: '#icon-tongji_jifenshijian1' },
  86. { name: '考勤管理', children: this.returnRoutersArr('attendance'), icon: '#icon-kaoqindaka_daka' },
  87. { name: '排名&统计', children: this.returnRoutersArr('statistics'), icon: '#icon-kaoqindaka_paiming' },
  88. // { name: 'A分', children: this.returnRoutersArr('aPoints'), icon: '#icon-kaoqin_kaoqinshenpi' },
  89. ];
  90. let point_path=this.$getCache('point_path');
  91. if (point_path) {
  92. this.defaultActive = point_path;
  93. if(point_path=='0-0'){
  94. this.$router.push({ path:'/pointHome'});
  95. }
  96. }
  97. let pointIndex=this.$getCache('pointIndex');
  98. if (pointIndex) {
  99. this.$router.push({ path:pointIndex});
  100. this.$removeCache('pointIndex')
  101. }
  102. },500)
  103. },
  104. //当刷新页面是控制左边导航栏的选中
  105. activeRouter(index, indexPath) {
  106. this.$setCache('point_path', indexPath[1] ? indexPath[1] : indexPath[0]);
  107. },
  108. routerAstrict(data) {
  109. //限制路由
  110. let obj = [];
  111. let supAuthority = this.$supremeAuthority(); //$supremeAuthority获取当前登录者的最高权限
  112. data.forEach(item => {
  113. if (!item.hidden) {
  114. if (!item.meta.jurisdiction) {
  115. obj.push(item);
  116. } else {
  117. if (item.meta.jurisdiction.indexOf(supAuthority) >= 0) {
  118. obj.push(item);
  119. }
  120. }
  121. }
  122. });
  123. return obj;
  124. },
  125. returnRoutersArr(str, bool) {
  126. let routers = [];
  127. this.$router.options.routes[0].children.some((item, i) => {
  128. if (item.name == 'pointIndex') {
  129. routers=item.children
  130. return true;
  131. }
  132. });
  133. var routersArr = [];
  134. routers.forEach(item => {
  135. if (item.meta.groupCode == str) {
  136. //获取对应模块的路由
  137. routersArr.push(item);
  138. }
  139. });
  140. if (bool) {
  141. return routersArr;
  142. }
  143. return this.routerAstrict(routersArr);
  144. },
  145. returnIndex(str, str2) {
  146. return str + '-' + str2;
  147. }
  148. }
  149. };
  150. </script>
  151. <style scoped="scoped" lang="scss">
  152. .announDetails {
  153. ::v-deep img {
  154. width: 100%;
  155. }
  156. }
  157. .updateNotice ::v-deep .el-dialog {
  158. border-radius: 10px;
  159. .el-dialog__header {
  160. padding: 13px 20px;
  161. text-align: center;
  162. background-color: #3193fc;
  163. border-radius: 8px 8px 0 0;
  164. .el-dialog__title {
  165. font-size: 16px;
  166. color: #fff;
  167. }
  168. .el-icon-close {
  169. color: #fff;
  170. }
  171. }
  172. .el-dialog__body {
  173. padding: 20px 20px 30px 20px;
  174. }
  175. .el-dialog__footer {
  176. .dialog-footer {
  177. .is-round {
  178. padding: 10px 19px;
  179. border-radius: 15px;
  180. }
  181. }
  182. }
  183. }
  184. /deep/ .el-aside {
  185. transition: width 0.28s;
  186. width: 180px !important;
  187. height: calc(100vh - 80px);
  188. background-color: #fff;
  189. }
  190. /deep/ .el-aside::-webkit-scrollbar {
  191. width: 0px;
  192. background-color: #fff;
  193. }
  194. /deep/ .el-aside::-webkit-scrollbar-thumb {
  195. background-color: #ccc;
  196. }
  197. .navigation {
  198. position: fixed;
  199. right: 20px;
  200. bottom: 100px;
  201. z-index: 999;
  202. }
  203. .navigationBox {
  204. background-color: #409eff;
  205. color: #fff;
  206. font-size: 12px;
  207. margin-top: 20px;
  208. text-align: center;
  209. }
  210. .navigationItem {
  211. padding: 6px;
  212. cursor: pointer;
  213. }
  214. .navigationItem:hover {
  215. background-color: #005bea;
  216. }
  217. .svgIcon {
  218. font-size: 20px;
  219. color: #99a9bf;
  220. }
  221. .money {
  222. line-height: 32px;
  223. text-align: center;
  224. height: 32px;
  225. color: #ff9600;
  226. width: 88px;
  227. background: #ffffff;
  228. border: 1px solid #ff9600;
  229. opacity: 1;
  230. border-radius: 3px;
  231. cursor: pointer;
  232. margin-left: 20px;
  233. }
  234. .money2 {
  235. line-height: 32px;
  236. text-align: center;
  237. height: 32px;
  238. color: #409eff;
  239. width: 120px;
  240. background: #ffffff;
  241. border: 1px solid #409eff;
  242. opacity: 1;
  243. border-radius: 3px;
  244. cursor: pointer;
  245. margin: 0 20px;
  246. padding-left: 10px;
  247. }
  248. .megData div:nth-child(1) {
  249. background-image: linear-gradient(to bottom, #5e6e9b 0%, #232d48 100%);
  250. text-align: center;
  251. color: #e1bf66;
  252. border-top-left-radius: 25px;
  253. border-bottom-left-radius: 25px;
  254. line-height: 35px;
  255. height: 35px;
  256. padding: 0 10px;
  257. }
  258. .megData div:nth-child(2) {
  259. background-image: linear-gradient(to bottom, #ffeab2 0%, #e1bf66 100%);
  260. text-align: center;
  261. color: #232d48;
  262. border-top-right-radius: 25px;
  263. border-bottom-right-radius: 25px;
  264. line-height: 35px;
  265. height: 35px;
  266. padding: 0 10px;
  267. }
  268. .routerActive {
  269. background-color: #199afb !important;
  270. }
  271. .active {
  272. color: #409eff;
  273. background-color: rgba(38, 162, 255, 0.1);
  274. }
  275. .right-menu {
  276. float: right;
  277. height: 100%;
  278. display: flex;
  279. align-items: center;
  280. &:focus {
  281. outline: none;
  282. }
  283. .right-menu-item {
  284. display: inline-block;
  285. margin: 0 8px;
  286. }
  287. .screenfull {
  288. height: 20px;
  289. }
  290. .international {
  291. vertical-align: top;
  292. }
  293. .theme-switch {
  294. vertical-align: 15px;
  295. }
  296. .avatar-container {
  297. height: 60px;
  298. margin-right: 30px;
  299. .avatar-wrapper {
  300. cursor: pointer;
  301. margin-top: 5px;
  302. position: relative;
  303. .user-avatar {
  304. width: 40px;
  305. height: 40px;
  306. border-radius: 10px;
  307. }
  308. .el-icon-caret-bottom {
  309. position: absolute;
  310. right: -20px;
  311. top: 25px;
  312. font-size: 12px;
  313. }
  314. }
  315. }
  316. }
  317. .el-menu-vertical-demo:not(.el-menu--collapse) {
  318. width: 180px;
  319. }
  320. .el-header {
  321. background-color: #fff;
  322. padding: 0 !important;
  323. border-bottom: 1px solid #f1f1f1;
  324. min-width: 1100px;
  325. }
  326. .el-menu {
  327. overflow: hidden;
  328. border: none;
  329. }
  330. .con_nav_left {
  331. background: #fff;
  332. overflow-y: scroll;
  333. }
  334. .box-all {
  335. height: 100%;
  336. overflow: hidden;
  337. }
  338. .el-main {
  339. background-color: #f0f4fa;
  340. height: calc(100vh - 80px);
  341. overflow-y: scroll;
  342. padding:0 10px;
  343. min-width: 1100px;
  344. }
  345. .logo-box {
  346. width: 180px;
  347. cursor: pointer;
  348. }
  349. .logo-box .logo {
  350. width: 30px;
  351. height: 30px;
  352. margin-right: 5px;
  353. border-radius: 6px;
  354. }
  355. .logo-box div {
  356. font-size: 16px;
  357. font-weight: 600;
  358. }
  359. .wn {
  360. height: 26px;
  361. width: 26px;
  362. margin-right: 12px;
  363. cursor: pointer;
  364. }
  365. .hea-right {
  366. padding: 0 20px;
  367. }
  368. .upgrade {
  369. margin-left: 10px;
  370. margin-right: 10px;
  371. }
  372. /deep/ .el-menu-item {
  373. padding-right: 10px !important;
  374. }
  375. /deep/ .el-menu-item.is-active {
  376. color: #409eff;
  377. background-color: #ecf5ff;
  378. }
  379. /deep/ .el-submenu .el-menu-item {
  380. min-width: 180px;
  381. box-sizing: border-box;
  382. }
  383. .main-left {
  384. position: relative;
  385. .el-main-left-aside {
  386. // padding-bottom: 90px;
  387. }
  388. .menu-bot-but {
  389. position: absolute;
  390. bottom: 0;
  391. width: 100%;
  392. background-color: #fff;
  393. text-align: center;
  394. padding-bottom: 30px;
  395. span {
  396. width: 86%;
  397. display: inline-block;
  398. height: 50px;
  399. background-color: #ecf5ff;
  400. line-height: 50px;
  401. text-align: center;
  402. color: #409eff;
  403. border: 1px solid #409eff;
  404. border-radius: 3px;
  405. cursor: pointer;
  406. transition: all 0.5s;
  407. }
  408. span:hover {
  409. background-color: #e0eeff;
  410. color: #2892e2;
  411. }
  412. }
  413. }
  414. </style>