|
|
@ -49,6 +49,7 @@ |
|
|
|
border-radius: 50%; |
|
|
|
position:relative; |
|
|
|
margin-right:16rpx; |
|
|
|
&.noRead{ |
|
|
|
&:after{ |
|
|
|
content:""; |
|
|
|
position:absolute; |
|
|
@ -60,6 +61,7 @@ |
|
|
|
right:9rpx; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
&>view{ |
|
|
|
flex-grow: 1; |
|
|
|
width:1rpx; |
|
|
@ -129,7 +131,6 @@ |
|
|
|
align-items: center; |
|
|
|
margin-top:10rpx; |
|
|
|
.fruit,.food{ |
|
|
|
margin-right:16rpx; |
|
|
|
border-radius: 8rpx; |
|
|
|
flex-shrink: 0; |
|
|
|
height:44rpx; |
|
|
@ -173,6 +174,7 @@ |
|
|
|
.cause,.date{ |
|
|
|
color:#999; |
|
|
|
font-size:24rpx; |
|
|
|
margin-left:16rpx; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -181,47 +183,112 @@ |
|
|
|
</style> |
|
|
|
<template> |
|
|
|
<view class="container flex"> |
|
|
|
<d-search :btn="false" popup> |
|
|
|
<u-tabs :list="[{name:'消息类型'},{name:'作物类型'}]" lineColor="#10C176" :activeStyle="{color:'#10C176'}" :inactiveStyle="{color:'#999'}" :itemStyle="{height:'60rpx'}" lineHeight="6rpx" lineWidth="96rpx"/> |
|
|
|
<view class="tabs"> |
|
|
|
<text>害虫</text> |
|
|
|
<text class="active">害虫</text> |
|
|
|
|
|
|
|
<d-search :btn="false" popup ref="dSearch" @search="clean();"> |
|
|
|
<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" v-if="tabIndex==0"> |
|
|
|
<text :class="{active:searchVal.cropType=='病害'}" @click="clean({cropType:'',mesType:'病害'})">病害</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> |
|
|
|
</d-search> |
|
|
|
<scroll-view scroll-y> |
|
|
|
<view class="card" @click="$u.route({url:'/pages/home/newsDetail',params:{intoPage:'news'}})"> |
|
|
|
<scroll-view scroll-y @scrolltolower="search"> |
|
|
|
<view class="card" v-for="(v,k) in list" :key="k" @click="toDetail(k)"> |
|
|
|
<view class="info"> |
|
|
|
<text class="plant-xitongxiaoxi"/> |
|
|
|
<text class="plant-xitongxiaoxi" :class="{noRead:v.readStatus=='未读'}"/> |
|
|
|
<view> |
|
|
|
<view class="title"> |
|
|
|
<text class="over">阳光玫瑰</text> |
|
|
|
<text>病害</text> |
|
|
|
<text class="over">{{v.cropName}}</text> |
|
|
|
<text>{{v.messageType}}</text> |
|
|
|
<text class="plant-youbian"/> |
|
|
|
</view> |
|
|
|
<view class="tabs"> |
|
|
|
<text class="germinate">发芽</text> |
|
|
|
<text class="organ">根、茎</text> |
|
|
|
<text class="type">变色</text> |
|
|
|
<text class="germinate">{{v.growthProcess_dictText}}</text> |
|
|
|
<text class="organ">{{v.pestSite_dictText}}</text> |
|
|
|
<text class="type">{{v.symptom_dictText}}</text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="content"> |
|
|
|
<text class="fruit"/> |
|
|
|
<text class="food"/> |
|
|
|
<text class="cause over">由于叶子部位病变需要使用水溶肥部位病变需要使用水溶肥</text> |
|
|
|
<text class="date">2023/2/27</text> |
|
|
|
<text v-if="v.cropType=='水果'" class="fruit"/> |
|
|
|
<text v-if="v.cropType=='蔬菜'" class="food"/> |
|
|
|
<text class="cause over">{{v.content}}</text> |
|
|
|
<text class="date">{{new Date(v.sendTime).format('yyyy/MM/dd')}}</text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</scroll-view> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
<script> |
|
|
|
import request from '@/common/request' |
|
|
|
export default { |
|
|
|
data(){ |
|
|
|
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> |