|
|
@ -26,7 +26,7 @@ |
|
|
|
<view class="thumb-box" v-for="(item1, index1) in item.children" :key="index1" |
|
|
|
@click="openCheck(item1.path)"> |
|
|
|
<view class="" style="position: relative; "> |
|
|
|
<u-badge v-if='index1==0' type="error" :count="count" :offset="position"></u-badge> |
|
|
|
<u-badge v-if="item1.count>0" type="error" :count="item1.count" :offset="position" :showZero ="false"></u-badge> |
|
|
|
<image class="item-menu-image" :src="'/static/menus/'+item1.componentName" mode=""> |
|
|
|
</image> |
|
|
|
<view class=""> |
|
|
@ -48,6 +48,7 @@ |
|
|
|
<script> |
|
|
|
import { |
|
|
|
getDictionaryItem, |
|
|
|
getMainMessage |
|
|
|
} from '@/api/request2.js'; |
|
|
|
import comMessage from '@/mycomponents/common/comMessage.vue' |
|
|
|
import classifyData from '@/common/classify.data.js'; |
|
|
@ -75,7 +76,9 @@ |
|
|
|
timer: null, // 定时器 |
|
|
|
forcedLogin: false, |
|
|
|
count: 1, |
|
|
|
position: [-10, -10] |
|
|
|
position: [-10, -10], |
|
|
|
timer: null, |
|
|
|
menusCount: {} |
|
|
|
} |
|
|
|
}, |
|
|
|
onLoad() { |
|
|
@ -106,6 +109,7 @@ |
|
|
|
}) |
|
|
|
}) |
|
|
|
this.getDictory() |
|
|
|
this.timerRefresh(); |
|
|
|
} else { |
|
|
|
this.showMessage("获取菜单失败") |
|
|
|
} |
|
|
@ -124,7 +128,9 @@ |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
onHide() {}, |
|
|
|
onHide() { |
|
|
|
this.stopRefresh(); |
|
|
|
}, |
|
|
|
onShow() { |
|
|
|
if (sessionStorage.getItem("hasLogin") == null || sessionStorage.getItem("hasLogin") == false) { |
|
|
|
uni.showModal({ |
|
|
@ -146,10 +152,47 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
} else { |
|
|
|
this.timerRefresh(); |
|
|
|
} |
|
|
|
}, |
|
|
|
onUnload() { |
|
|
|
this.stopRefresh(); |
|
|
|
}, |
|
|
|
|
|
|
|
mounted() {}, |
|
|
|
methods: { |
|
|
|
timerRefresh() { |
|
|
|
this.getMainMessage(); |
|
|
|
this.stopRefresh(); |
|
|
|
var that = this; |
|
|
|
this.timer = setInterval(function() { |
|
|
|
that.getMainMessage(); |
|
|
|
console.log('刷新菜单'); |
|
|
|
}, 1000*60) |
|
|
|
}, |
|
|
|
stopRefresh(){ |
|
|
|
if (this.timer) { |
|
|
|
clearInterval(this.timer); |
|
|
|
this.timer = null; |
|
|
|
} |
|
|
|
}, |
|
|
|
getMainMessage(){ |
|
|
|
getMainMessage().then(res => { |
|
|
|
this.menusCount = res.data; |
|
|
|
this.tabbar.forEach(item=>{ |
|
|
|
item.children.forEach(rightItem=>{ |
|
|
|
var count = this.menusCount[rightItem.component] |
|
|
|
if(count!=undefined){ |
|
|
|
rightItem.count =count; |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
this.$forceUpdate() |
|
|
|
|
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
findList(tab) { |
|
|
|
let res = null |
|
|
|
for (let i = 0; i < tab.length; i++) { |
|
|
@ -284,6 +327,7 @@ |
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
openCheck(url) { |
|
|
|
uni.navigateTo({ |
|
|
|
url: "/" + url |
|
|
|