Browse Source

系统信息 联调接口

master
邓宏 2 years ago
parent
commit
ff987f3cd1
  1. 12
      pages/home/index.vue
  2. 23
      pages/home/my.vue
  3. 1
      pages/home/news.vue
  4. 22
      store/index.js

12
pages/home/index.vue

@ -310,11 +310,18 @@
<view class="area card"> <view class="area card">
<table> <table>
<tr class="title"> <td>地块个数()</td><td>地块面积()</td><td>在种品种()</td><td>在种面积()</td> </tr> <tr class="title"> <td>地块个数()</td><td>地块面积()</td><td>在种品种()</td><td>在种面积()</td> </tr>
<tr class="value"> <td>{{massif.plotNum}}</td><td>{{massif.totalArea}}</td><td>{{massif.plantArea}}</td><td>{{massif.productCount}}</td> </tr> <tr class="value"> <td>{{massif.plotNum||0}}</td><td>{{massif.totalArea||0}}</td><td>{{massif.plantArea||0}}</td><td>{{massif.productCount||0}}</td> </tr>
</table> </table>
<view class="article"> <view class="article">
<text class="plant-bijibenjilutongxunlu" @click="$u.route({url:'pages/massif/myPlant'})"/> <text class="plant-bijibenjilutongxunlu" @click="$u.route({url:'pages/massif/myPlant'})"/>
<u-image
v-for="(v,k) in massif.images||[]" :key="k"
:title="`${host}/${massif.images[k]}`"
width="56rpx"
height="46rpx"
radius="8rpx"
:src="`${host}/${massif.images[k]}`"/>
<text class="line"/> <text class="line"/>
<text class="plant-nongzi" style="margin-right:64rpx;" @click="$u.route({url:'pages/stock/mana'})">库存</text> <text class="plant-nongzi" style="margin-right:64rpx;" @click="$u.route({url:'pages/stock/mana'})">库存</text>
<text class="plant-caigou" @click="$u.route({url:'pages/purchase/apply'})">采购</text> <text class="plant-caigou" @click="$u.route({url:'pages/purchase/apply'})">采购</text>
@ -448,7 +455,6 @@ import request,{host} from '@/common/request'
// index:0, // index:0,
// pagePath:"/pages/home/rePassword" // pagePath:"/pages/home/rePassword"
// }) // })
uni.setTabBarBadge({ index:2, text:'2' })//
this.getHeadImg() this.getHeadImg()
if(this.isAdmin){ if(this.isAdmin){
this.getPlantBase() this.getPlantBase()

23
pages/home/my.vue

@ -40,8 +40,14 @@
font-size:36rpx; font-size:36rpx;
margin-right:32rpx; margin-right:32rpx;
} }
&:nth-child(3){ &:nth-child(2){
margin-left:auto; margin-right:auto;
}
&.number{
margin-right:10rpx;
color:#999;
font-weight: bold;
font-size:30rpx;
} }
} }
} }
@ -71,7 +77,7 @@
<text class="plant-kufangguanli-lingyongguihuan"/> <text>领用记录</text> <text class="plant-youbian"/> <text class="plant-kufangguanli-lingyongguihuan"/> <text>领用记录</text> <text class="plant-youbian"/>
</view> </view>
<view class="item" @click="$u.route({url:'/pages/home/news'})"> <view class="item" @click="$u.route({url:'/pages/home/news'})">
<text class="plant-xitongxiaoxi"/> <text>系统消息</text> <text class="plant-youbian"/> <text class="plant-xitongxiaoxi"/> <text>系统消息</text> <text class="number">{{$store.state.sysMsgNum}}</text> <text class="plant-youbian"/>
</view> </view>
<view class="item" @click="$store.commit('outLogin')"> <view class="item" @click="$store.commit('outLogin')">
<text class="plant-tuichu"/> <text>退出</text> <text class="plant-youbian"/> <text class="plant-tuichu"/> <text>退出</text> <text class="plant-youbian"/>
@ -88,7 +94,6 @@ import {host} from '@/common/request'
} }
}, },
onLoad(options){ onLoad(options){
console.log('--my-----onLoad-----------')
this.$nextTick(()=>{ this.$nextTick(()=>{
if(options.toPage){ if(options.toPage){
uni.navigateTo({url:`/pages/purchase/${options.toPage}`}) uni.navigateTo({url:`/pages/purchase/${options.toPage}`})
@ -96,13 +101,13 @@ import {host} from '@/common/request'
}) })
}, },
onShow(){ onShow(){
console.log('------my-----onShow---------------') this.$store.commit("setSysMsgShow",false)
// uni.setTabBarBadge({ index:2, text:'' })// setTimeout(()=>{
uni.hideTabBarRedDot({index:2}) uni.hideTabBarRedDot({index:2})
})
}, },
onHide(){ onHide(){
console.log('------my-----onHide---------------') this.$store.commit("setSysMsgShow",true)
}, },
methods:{ methods:{

1
pages/home/news.vue

@ -275,6 +275,7 @@ export default {
var res=await request("/api/message/getById",{params:{id:this.list[index].id}}) var res=await request("/api/message/getById",{params:{id:this.list[index].id}})
if(res.statu){ if(res.statu){
this.list[index].readStatus='已读' this.list[index].readStatus='已读'
this.$store.state.sysMsgNum-=1
uni.navigateTo({ uni.navigateTo({
url:`/pages/home/newsDetail?intoPage=news`, url:`/pages/home/newsDetail?intoPage=news`,
success(e){ success(e){

22
store/index.js

@ -12,6 +12,8 @@ export default new Vuex.Store({
id:"", id:"",
name:"", name:"",
}, },
sysMsgNum:'',//系统信息数量
isShowSysNum:true,
}, },
getters:{ getters:{
userInfo: state=>state.userInfo, userInfo: state=>state.userInfo,
@ -29,6 +31,7 @@ export default new Vuex.Store({
outLogin(state){ outLogin(state){
state.userInfo={} state.userInfo={}
state.token='' state.token=''
clearTimeout(timer)
uni.reLaunch({ uni.reLaunch({
url:"/pages/home/login", url:"/pages/home/login",
}) })
@ -39,10 +42,25 @@ export default new Vuex.Store({
setBaseId(state, val){//基地id setBaseId(state, val){//基地id
state.baseInfo={...state.baseInfo,...val} 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:{ actions:{
async getSysMsg(a,b,c){ async getSysMsg({commit,dispatch}){
console.log(a,b,c,'-------ddd---') 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)
}, },
} }
}) })

Loading…
Cancel
Save