Bläddra i källkod

提交 专家分析

李程龙 3 år sedan
förälder
incheckning
a479b63fcb

+ 3 - 1
README.md

@@ -15,9 +15,11 @@
 		|-- ui-tabs						// 全局tab选项组件
 	--|
     |-- pages  //主包
-        |-- aftersale    				    // 故障上报
+        |-- aftersale    				// 故障上报
 			|-- index.vue					// 上报故障提交
 			|-- list.vue					// 设备列表
+		|-- aftersale    				// 文章列表
+			|-- index.vue					// 专家分析
         |-- camera     					// 可视监控模块
 			|-- index.vue					// 可视监控列表
 			|-- details.vue					// 可视监控详情

+ 6 - 0
api/common.js

@@ -12,3 +12,9 @@ export const userLogin = async (params) => {
 	return res?.data;
 }
 
+
+// 专家建议列表
+export const getArticleList = async (params) => {
+	const res = await request.post(`api/api_gateway?method=article.article.list_article`, params);
+	return res?.data;
+}

+ 9 - 0
pages.json

@@ -160,6 +160,15 @@
             }
             
         }
+        ,{
+            "path" : "pages/article/index",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "专家分析",
+                "enablePullDownRefresh": true
+            }
+            
+        }
     ],
 	"globalStyle": {
 		"navigationBarTextStyle": "black",

+ 111 - 0
pages/article/index.vue

@@ -0,0 +1,111 @@
+<template>
+	<!-- 专家分析列表 -->
+	<view>
+		<ui-sticky>
+			<ui-search placeholder="搜索" @confirm="searchArticle"></ui-search>
+		</ui-sticky>
+		<view class="ui-card article-item" v-for="(item,index) in articleList" :key="index">
+			<view class="row-between">
+				<view class="title">分析人:{{item.user_name}}</view>
+				<view class="time">{{item.create_time }}</view>
+			</view>
+			<!-- <view class="">
+				{{item.foreword}}
+			</view> -->
+			<view class="text">
+				<rich-text :nodes="item.content"></rich-text>
+			</view>
+		</view>
+		<ui-empty v-if="articleList.length==0" text="暂无分析信息"></ui-empty>
+	</view>
+</template>
+
+<script>
+	import {
+		getArticleList,
+	} from '@/api/common.js'
+	export default {
+		data() {
+			return {
+				// 专家分析列表
+				articleList: [],
+				params: {
+					key_word: '',
+					start_time: '',
+					end_time: '',
+					article_type: 3, //  3 表示虫情,5 表示气象, 8 表示墒情
+					page: 1, //页数 默认为1
+					page_size: 10, //数据条数据 默认为10
+				},
+				total: 0,
+			}
+		},
+		async onLoad(options) {
+			await this.$onLaunched;
+			this.params.article_type = options.type ?? 3;
+			this.getArticleList();
+		},
+		// 触底请求
+		onReachBottom(e) {
+			if (this.articleList.length >= this.total) {
+				return;
+			}
+			this.params.page += 1;
+			this.getArticleList();
+		},
+		//下拉刷新
+		onPullDownRefresh() {
+			this.refreshArticleList();
+			uni.stopPullDownRefresh()
+		},
+		methods: {
+			searchArticle(e) {
+				this.params.key_word = e;
+				this.refreshArticleList();
+			},
+			// 刷新列表
+			refreshArticleList() {
+				this.params.page = 1;
+				this.articleList = [];
+				this.getArticleList();
+			},
+			// 获取分析列表
+			async getArticleList() {
+				const {
+					total_num,
+					data
+				} = await getArticleList(this.params);
+				this.articleList = [...this.articleList, ...data];
+				this.total = total_num ?? 0;
+			},
+		}
+	}
+</script>
+
+<style lang="scss">
+	.article-item {
+		padding: 26rpx 24rpx;
+
+		.title {
+			font-size: $font-size-title;
+			font-weight: bold;
+			color: $color-primary;
+			line-height: $line-height-title;
+		}
+
+		.text {
+			margin-top: 10rpx;
+			font-size: $font-size-subtitle;
+			color: $color-subtitle;
+			line-height: $line-height-subtitle;
+		}
+
+		.time {
+			padding: 6rpx 15rpx;
+			font-size: 28rpx;
+			color: #333;
+			line-height: 1;
+			border-radius: 4rpx;
+		}
+	}
+</style>

+ 1 - 1
pages/weather/components/w-line-charts.vue

@@ -27,7 +27,7 @@
 					},
 					dataLabel: false,
 					// dataPointShape: false,
-					dataPointShapeType: 'hollow',
+					// dataPointShapeType: 'hollow',
 					xAxis: {
 						disableGrid: true,
 						fontColor: '#999',

+ 2 - 1
pages/weather/details.vue

@@ -15,6 +15,8 @@
 		<view class="row-between m-12">
 			<view class="font-16 mr">实时数据</view>
 			<view class="flex-1 font-10 text-sub">(可点击查看24小时数据)</view>
+			<navigator :url="`/pages/article/index?type=${deviceInfo.device_type}`" class="font-14 text-primary mr" hover-class="none">专家分析
+			 </navigator>
 			<navigator :url="`history?id=${deviceInfo.equip_id}`" class="font-14 text-primary" hover-class="none">历史数据
 			</navigator>
 		</view>
@@ -140,7 +142,6 @@
 					end: this.$util.timeFrame('end'),
 				});
 				this.chartData = charts; // 统计数据集合
-				console.log(this.chartData);
 				// 统计图显示数据
 				this.chartShowData.categories = times;
 			}

+ 0 - 1
pages/weather/index.vue

@@ -41,7 +41,6 @@
 			};
 		},
 		async onLoad(options) {
-			console.log("sds");
 			await this.$onLaunched;
 			//获取类型 5气象站 8墒情站
 			this.params.device_type=options.type ?? 5;

+ 16 - 10
pages/worm/details.vue

@@ -10,7 +10,7 @@
 				<view class="text text-ellipsis">地址:{{lampDetails.address}}</view>
 				<view class="text">最新上报时间:{{uptime | timeFrom}}</view>
 			</view>
-			<navigator :url="`warn`" class="font-12 state"  hover-class="none">预警</navigator>
+			<navigator :url="`warn`" class="font-12 state" hover-class="none">预警</navigator>
 		</view>
 		<!-- 设备卡片end -->
 		<!-- 导航选项 -->
@@ -27,6 +27,10 @@
 				<image src="@/static/img/worm-nav-3.png" class="icon" mode="aspectFill"></image>
 				<view class="text">历史数据</view>
 			</navigator>
+			<navigator url="/pages/article/index?type=3" class="worm-nav-item" hover-class="none">
+				<image src="@/static/img/worm-nav-4.png" class="icon" mode="aspectFill"></image>
+				<view class="text">专家分析</view>
+			</navigator>
 
 		</view>
 		<!-- 导航选项end -->
@@ -82,7 +86,7 @@
 			</view>
 			<view class="ui-card latest-item">
 				<view class="icon">
-						<image src="@/static/worm/ah.png"></image>
+					<image src="@/static/worm/ah.png"></image>
 				</view>
 				<view class="column-between text-info font-12">
 					<view class="text">环境湿度(%)</view>
@@ -90,7 +94,9 @@
 				</view>
 			</view>
 			<view class="ui-card latest-item">
-				<view class="icon"><image src="@/static/worm/csq.png"></image></view>
+				<view class="icon">
+					<image src="@/static/worm/csq.png"></image>
+				</view>
 				<view class="column-between text-info font-12">
 					<view class="text">信号强度</view>
 					<view class="text">{{lampDetails.csq}}</view>
@@ -173,16 +179,16 @@
 		data() {
 			return {
 				deviceId: '', // 设备id
-				deviceImei:'',// 设备号
-				uptime:0,//上报时间
-				lampDetails:{},//设备详情
-				latestList:[],//实时列表
+				deviceImei: '', // 设备号
+				uptime: 0, //上报时间
+				lampDetails: {}, //设备详情
+				latestList: [], //实时列表
 			};
 		},
 		onLoad(options) {
 			this.deviceId = options.id; // 设备id;
-			this.deviceImei = options.imei;// 设备号
-			this.uptime=options.uptime;
+			this.deviceImei = options.imei; // 设备号
+			this.uptime = options.uptime;
 			this.getLampDetails();
 		},
 		methods: {
@@ -191,7 +197,7 @@
 				let res = await getWormLampDetails({
 					device_id: this.deviceImei
 				});
-				this.lampDetails=res;
+				this.lampDetails = res;
 				// "is_online": 1, //在线状态   1在线 0离线
 				// "ts": "1", //定时模式 0光控,1时控
 				// "hs": "0", //加热状态 1加热,0正常

BIN
static/img/worm-nav-4.png