Browse Source

联调系统信息

master
邓宏 2 years ago
parent
commit
c8779f87a4
  1. 4
      pages/home/my.vue
  2. 127
      pages/home/news.vue
  3. 20
      pages/home/newsDetail.vue
  4. 11
      store/index.js

4
pages/home/my.vue

@ -100,6 +100,10 @@ import {host} from '@/common/request'
// uni.setTabBarBadge({ index:2, text:'' })// // uni.setTabBarBadge({ index:2, text:'' })//
uni.hideTabBarRedDot({index:2}) uni.hideTabBarRedDot({index:2})
}, },
onHide(){
console.log('------my-----onHide---------------')
},
methods:{ methods:{
} }

127
pages/home/news.vue

@ -49,15 +49,17 @@
border-radius: 50%; border-radius: 50%;
position:relative; position:relative;
margin-right:16rpx; margin-right:16rpx;
&:after{ &.noRead{
content:""; &:after{
position:absolute; content:"";
background:red; position:absolute;
width:12rpx; background:red;
height:12rpx; width:12rpx;
border-radius: 50%; height:12rpx;
top:9rpx; border-radius: 50%;
right:9rpx; top:9rpx;
right:9rpx;
}
} }
} }
&>view{ &>view{
@ -129,7 +131,6 @@
align-items: center; align-items: center;
margin-top:10rpx; margin-top:10rpx;
.fruit,.food{ .fruit,.food{
margin-right:16rpx;
border-radius: 8rpx; border-radius: 8rpx;
flex-shrink: 0; flex-shrink: 0;
height:44rpx; height:44rpx;
@ -173,6 +174,7 @@
.cause,.date{ .cause,.date{
color:#999; color:#999;
font-size:24rpx; font-size:24rpx;
margin-left:16rpx;
} }
} }
} }
@ -181,47 +183,112 @@
</style> </style>
<template> <template>
<view class="container flex"> <view class="container flex">
<d-search :btn="false" popup> <d-search :btn="false" popup ref="dSearch" @search="clean();">
<u-tabs :list="[{name:'消息类型'},{name:'作物类型'}]" lineColor="#10C176" :activeStyle="{color:'#10C176'}" :inactiveStyle="{color:'#999'}" :itemStyle="{height:'60rpx'}" lineHeight="6rpx" lineWidth="96rpx"/> <u-tabs :current="tabIndex" @change="tabIndex=$event.index" :list="[{name:'消息类型'},{name:'作物类型'}]" lineColor="#10C176" :activeStyle="{color:'#10C176'}" :inactiveStyle="{color:'#999'}" :itemStyle="{height:'60rpx'}" lineHeight="6rpx" lineWidth="96rpx"/>
<view class="tabs"> <view class="tabs" v-if="tabIndex==0">
<text>害虫</text> <text :class="{active:searchVal.cropType=='病害'}" @click="clean({cropType:'',mesType:'病害'})">病害</text>
<text class="active">害虫</text> <text :class="{active:searchVal.cropType=='虫害'}" @click="clean({cropType:'',mesType:'虫害'})">虫害</text>
</view>
<view class="tabs" v-else>
<text :class="{active:searchVal.cropType=='1610539208847142914'}" @click="clean({cropType:'1610539208847142914',mesType:''});$refs.dSearch.show=false">水果</text>
<text :class="{active:searchVal.cropType=='1610539232360411138'}" @click="clean({cropType:'1610539232360411138',mesType:''});$refs.dSearch.show=false">蔬菜</text>
</view> </view>
</d-search> </d-search>
<scroll-view scroll-y> <scroll-view scroll-y @scrolltolower="search">
<view class="card" @click="$u.route({url:'/pages/home/newsDetail',params:{intoPage:'news'}})"> <view class="card" v-for="(v,k) in list" :key="k" @click="toDetail(k)">
<view class="info"> <view class="info">
<text class="plant-xitongxiaoxi"/> <text class="plant-xitongxiaoxi" :class="{noRead:v.readStatus=='未读'}"/>
<view> <view>
<view class="title"> <view class="title">
<text class="over">阳光玫瑰</text> <text class="over">{{v.cropName}}</text>
<text>病害</text> <text>{{v.messageType}}</text>
<text class="plant-youbian"/> <text class="plant-youbian"/>
</view> </view>
<view class="tabs"> <view class="tabs">
<text class="germinate">发芽</text> <text class="germinate">{{v.growthProcess_dictText}}</text>
<text class="organ"></text> <text class="organ">{{v.pestSite_dictText}}</text>
<text class="type">变色</text> <text class="type">{{v.symptom_dictText}}</text>
</view> </view>
</view> </view>
</view> </view>
<view class="content"> <view class="content">
<text class="fruit"/> <text v-if="v.cropType=='水果'" class="fruit"/>
<text class="food"/> <text v-if="v.cropType=='蔬菜'" class="food"/>
<text class="cause over">由于叶子部位病变需要使用水溶肥部位病变需要使用水溶肥</text> <text class="cause over">{{v.content}}</text>
<text class="date">2023/2/27</text> <text class="date">{{new Date(v.sendTime).format('yyyy/MM/dd')}}</text>
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
</view> </view>
</template> </template>
<script> <script>
import request from '@/common/request'
export default { export default {
data(){ data(){
return{ return{
tabIndex:0,
searchVal:{
pageNo:1,
pageSize:7,
search:"",
cropType:"",
mesType:"",
},
list:[],
total:0,
} }
} },
onLoad(){
this.search()
},
methods:{
clean(e){
this.total=0
this.list=[]
this.searchVal.pageNo=1
if(e){
this.searchVal.cropType=this.searchVal.cropType==e.cropType?'':e.cropType
this.searchVal.mesType=this.searchVal.mesType==e.mesType?'':e.mesType
}
this.search()
},
async search(){
if(this.total==0||this.list.length<this.total){
var res=await request('/api/message/list',{
params: this.searchVal
})
if(res.statu){
this.list=this.list.concat(res.data.records)
this.total=res.data.total
this.searchVal.pageNo++
if(this.list.length==this.total)uni.showToast({title:"加载完成!",icon:"none"})
}else{
uni.showModal({
title:"提示",
content:res.msg||"获取信息失败!",
showCancel:false,
})
}
}
},
async toDetail(index){
var res=await request("/api/message/getById",{params:{id:this.list[index].id}})
if(res.statu){
this.list[index].readStatus='已读'
uni.navigateTo({
url:`/pages/home/newsDetail?intoPage=news`,
success(e){
e.eventChannel.emit("detail",res.data)
}
})
}else{
uni.showModal({
title:"提示",
content:res.msg||"获取信息详情失败!",
showCancel:false,
})
}
}
},
} }
</script> </script>

20
pages/home/newsDetail.vue

@ -27,6 +27,7 @@
border-radius: 24rpx; border-radius: 24rpx;
color:#999; color:#999;
background: #F7F7F7; background: #F7F7F7;
width:calc(100% - 60rpx);
} }
} }
} }
@ -45,28 +46,28 @@
<template> <template>
<view class="container"> <view class="container">
<view class="info"> <view class="info">
<text>基本信息</text> <text>推送时间2023-02-28 10:23:56</text> <text>基本信息</text> <text>推送时间{{detail.sendTime}}</text>
</view> </view>
<view> <view>
<text>品种名称</text> <text class="over">阳光玫瑰</text> <text>品种名称</text> <text class="over">{{detail.cropName}}</text>
</view> </view>
<view> <view>
<text>作物类型</text> <text class="over">葡萄</text> <text>作物类型</text> <text class="over">{{detail.cropType}}</text>
</view> </view>
<view> <view>
<text>生长过程</text> <text class="over">发芽</text> <text>生长过程</text> <text class="over">{{detail.growthProcess}}</text>
</view> </view>
<view> <view>
<text>病虫害部位</text> <text class="over"></text> <text>病虫害部位</text> <text class="over">{{detail.pestSite}}</text>
</view> </view>
<view> <view>
<text>显著症状</text> <text class="over">变色</text> <text>显著症状</text> <text class="over">{{detail.symptom}}</text>
</view> </view>
<view class="vertical"> <view class="vertical">
<text>推荐农资</text> <text class="agr">水溶肥复合肥氮肥</text> <text>推荐农资</text> <text class="agr">{{detail.agrMaterialsName}}</text>
</view> </view>
<view class="vertical"> <view class="vertical">
<text>推荐理由</text> <text class="account">由于叶子部位病变需要使用水溶肥内容这里是产品介绍内容这里是产品介绍内容这里是产品介绍内容这里是产品介绍内容这里是产品介绍内容</text> <text>推荐理由</text> <text class="account">{{detail.content}}</text>
</view> </view>
</view> </view>
</template> </template>
@ -74,12 +75,13 @@
export default { export default {
data(){ data(){
return{ return{
detail:{},
eventChannel:null, eventChannel:null,
} }
}, },
onLoad(options){ onLoad(options){
this.eventChannel=this.getOpenerEventChannel() this.eventChannel=this.getOpenerEventChannel()
this.eventChannel.on("detail",e=>this.detail=e)
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title:({farming:"农事记录",news:"消息详情"})[options.intoPage] title:({farming:"农事记录",news:"消息详情"})[options.intoPage]
}) })

11
store/index.js

@ -1,12 +1,14 @@
import Vue from 'vue' import Vue from 'vue'
import Vuex from 'vuex' import Vuex from 'vuex'
import request from '@/common/request'
Vue.use(Vuex) Vue.use(Vuex)
var timer=null
export default new Vuex.Store({ export default new Vuex.Store({
state:{ state:{
userInfo:{}, userInfo:{},
token:"", token:"",
baseInfo:{ baseInfo:{//地块信息
id:"", id:"",
name:"", name:"",
}, },
@ -22,6 +24,7 @@ export default new Vuex.Store({
companyName:val.departs[0].departName companyName:val.departs[0].departName
} }
state.token=val.token state.token=val.token
this.dispatch('getSysMsg')
}, },
outLogin(state){ outLogin(state){
state.userInfo={} state.userInfo={}
@ -38,6 +41,8 @@ export default new Vuex.Store({
}, },
}, },
actions:{ actions:{
async getSysMsg(a,b,c){
console.log(a,b,c,'-------ddd---')
},
} }
}) })

Loading…
Cancel
Save