Browse Source

首页,常用应用

dev
0.0 2 years ago
parent
commit
9b9128a7d6
  1. 12
      common/common.js
  2. 5
      src/permission.js
  3. 70
      src/views/dashboard/HomePage.vue

12
common/common.js

@ -0,0 +1,12 @@
export function cachePage(e) {
let page = {}
if (JSON.parse(localStorage.getItem(e))) {
page = JSON.parse(localStorage.getItem(e))
page.sum += 1
localStorage.setItem(e, JSON.stringify(page))
} else {
page.name = e
page.sum = 1
localStorage.setItem(e, JSON.stringify(page))
}
}

5
src/permission.js

@ -6,6 +6,7 @@ import 'nprogress/nprogress.css' // progress bar style
import notification from 'ant-design-vue/es/notification'
import { ACCESS_TOKEN,INDEX_MAIN_PAGE_PATH } from '@/store/mutation-types'
import { generateIndexRouter } from "@/utils/util"
import { cachePage } from '../common/common'
NProgress.configure({ showSpinner: false }) // NProgress Configuration
@ -13,7 +14,9 @@ const whiteList = ['/test/cesium','/user/login', '/user/register', '/user/regist
router.beforeEach((to, from, next) => {
NProgress.start() // start progress bar
console.log("to>>>>>>>>>",to)
console.log("from>>>>>>>>>",from)
cachePage(from.name);
if (Vue.ls.get(ACCESS_TOKEN)) {
/* has token */
if (to.path === '/user/login') {

70
src/views/dashboard/HomePage.vue

@ -115,28 +115,53 @@
<!--全部应用-->
<div style="width: 100%; height:70%; margin-top: 11px; overflow-y: hidden" :headStyle="{}" :bodyStyle="{height:'100%' , overflow:'hidden'}">
<a-row :gutter="24">
<a-col :span="12">
<a-card class="bottom-card" title="常用应用" style="width: 100%; height:478px; margin-top: 11px; overflow-y: hidden" :headStyle="{}" :bodyStyle="{height:'100%' , overflow:'hidden'}" >
<a slot="extra" @click="keyApp" v-has="'dashboard:addKey'" >添加常用应用</a>
<div style="max-height: 420px;overflow-y: auto;">
<a-col :span="24">
<a-card class="bottom-card" title="快捷" style="width: 100%; height:478px; margin-top: 11px; overflow-y: hidden" :headStyle="{}" :bodyStyle="{height:'100%' , overflow:'hidden'}" >
<!-- <a slot="extra" @click="keyApp" v-has="'dashboard:addKey'" >添加常用应用</a>-->
<!-- <div style="max-height: 420px;overflow-y: auto;">-->
<!-- <span class="ant-col-md-4" v-for="(item,index) in keyChildren" @click="goRouteView(item.path)" :title="item.meta.title"-->
<!-- style="display: inline-block; margin: 20px;">-->
<!-- <a-icon :type="item.meta.icon" :style="{'color':item.color}" style="font-size: 25px"></a-icon> &nbsp;&nbsp;{{ item.meta.title }}-->
<!-- </span>-->
<!-- </div>-->
<!-- </a-card>-->
<!-- <a-card class="bottom-card" title="全部应用" style="width: 100%; height:478px; margin-top: 11px; overflow-y: hidden" :headStyle="{}" :bodyStyle="{height:'100%' , overflow:'hidden'}" >-->
<!-- <div style="max-height: 420px;overflow-y: auto;">-->
<!-- <span class="ant-col-md-4" v-for="(item,index) in userChildren" @click="goRouteView(item.path)" :title="item.meta.title"-->
<!-- style="display: inline-block; margin: 25px;">-->
<!-- <a-icon :type="item.meta.icon" :style="{'color':item.color}" style="font-size: 25px"></a-icon> &nbsp;&nbsp;{{ item.meta.title }}-->
<!-- </span>-->
<!-- </div>-->
<!-- </a-card>-->
<a-tabs>
<a-tab-pane tab="常用应用" key="1" forceRender >
<div style="max-height: 420px;overflow-y: auto; width: 100%" >
<!-- <div> <a slot="extra" @click="keyApp">添加常用应用</a></div>-->
<span class="ant-col-md-4" v-for="(item,index) in keyChildren" @click="goRouteView(item.path)" :title="item.meta.title"
style="display: inline-block; margin: 20px;">
<a-icon :type="item.meta.icon" :style="{'color':item.color}" style="font-size: 25px"></a-icon> &nbsp;&nbsp;{{ item.meta.title }}
</span>
</div>
</a-card>
</a-col>
<a-col :span="12">
<a-card class="bottom-card" title="全部应用" style="width: 100%; height:478px; margin-top: 11px; overflow-y: hidden" :headStyle="{}" :bodyStyle="{height:'100%' , overflow:'hidden'}" >
<div style="max-height: 420px;overflow-y: auto;">
</div>
</a-tab-pane>
<a-tab-pane tab="全部应用" key="2" forceRender>
<div style="max-height: 420px;overflow-y: auto; width: 100%">
<span class="ant-col-md-4" v-for="(item,index) in userChildren" @click="goRouteView(item.path)" :title="item.meta.title"
style="display: inline-block; margin: 25px;">
<a-icon :type="item.meta.icon" :style="{'color':item.color}" style="font-size: 25px"></a-icon> &nbsp;&nbsp;{{ item.meta.title }}
</span>
</div>
</div>
</a-tab-pane>
</a-tabs>
</a-card>
</a-col>
<!-- <a-col :span="12">-->
<!-- -->
<!-- </a-col>-->
</a-row>
<a-modal v-model="keyApplic" width="50%" title="添加常用应用" @ok="handleOk" :destroyOnClose= true @cancel = "handleCole" :maskClosable=true >
<KeyApplications :userChildren = this.userChildren :keyChildren = this.keyChildren @expandedRow = expandedRowKeys></KeyApplications>
<!-- <template slot="footer">-->
@ -259,6 +284,7 @@ export default {
//
userChildren:[],
keyChildren:[],
cachelist:[],
KeyApplicationsChildren:[],
selectRowKeys:[],
routerGo:"",
@ -464,10 +490,15 @@ export default {
// }
// }
childrenMean.forEach(it =>{
if(item.permissionId == it.id){
if(JSON.parse(localStorage.getItem(it.name))){
it.sum = JSON.parse(localStorage.getItem(it.name)).sum
this.keyChildren.push(it);
}
})
this.deWeight(this.keyChildren)
this.keyChildren.sort((a, b) => {
return b.sum - a.sum
})
})
}
@ -479,6 +510,21 @@ export default {
// console.log("this.userChildren")
// console.log(this.userChildren)
},
//
deWeight(arr) {
for (var i = 0; i < arr.length - 1; i++) {
for (var j = i + 1; j < arr.length; j++) {
if (arr[i].id == arr[j].id) { // id
arr.splice(j, 1);
//1 j++ j--
j--;
}
}
}
return arr;
},
//()
rowClick: function(record, index) {
return {

Loading…
Cancel
Save