Browse Source

联调系统信息

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

4
pages/home/my.vue

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

111
pages/home/news.vue

@ -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>

20
pages/home/newsDetail.vue

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

9
store/index.js

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