pointIndex.vue 10 KB

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