|
|
@ -12,6 +12,8 @@ export default new Vuex.Store({ |
|
|
|
id:"", |
|
|
|
name:"", |
|
|
|
}, |
|
|
|
sysMsgNum:'',//系统信息数量
|
|
|
|
isShowSysNum:true, |
|
|
|
}, |
|
|
|
getters:{ |
|
|
|
userInfo: state=>state.userInfo, |
|
|
@ -29,6 +31,7 @@ export default new Vuex.Store({ |
|
|
|
outLogin(state){ |
|
|
|
state.userInfo={} |
|
|
|
state.token='' |
|
|
|
clearTimeout(timer) |
|
|
|
uni.reLaunch({ |
|
|
|
url:"/pages/home/login", |
|
|
|
}) |
|
|
@ -39,10 +42,25 @@ export default new Vuex.Store({ |
|
|
|
setBaseId(state, val){//基地id
|
|
|
|
state.baseInfo={...state.baseInfo,...val} |
|
|
|
}, |
|
|
|
setSysMsgNum(state,val){ |
|
|
|
state.sysMsgNum=val |
|
|
|
if(val>0 && state.isShowSysNum){ |
|
|
|
uni.setTabBarBadge({ index:2, text:`${val}` }) |
|
|
|
} |
|
|
|
}, |
|
|
|
setSysMsgShow(state,val){ |
|
|
|
state.isShowSysNum=val |
|
|
|
}, |
|
|
|
}, |
|
|
|
actions:{ |
|
|
|
async getSysMsg(a,b,c){ |
|
|
|
console.log(a,b,c,'-------ddd---') |
|
|
|
async getSysMsg({commit,dispatch}){ |
|
|
|
var res=await request("/api/message/readNum",{disabledLoad:true}) |
|
|
|
if(res.statu){ |
|
|
|
commit("setSysMsgNum",res.data) |
|
|
|
}else{ |
|
|
|
commit("setSysMsgNum",'') |
|
|
|
} |
|
|
|
timer=setTimeout(()=>dispatch('getSysMsg'),10*60*1000) |
|
|
|
}, |
|
|
|
} |
|
|
|
}) |
|
|
|