Przeglądaj źródła

任务功能完成

yf_zhb 2 lat temu
rodzic
commit
3fce8dad4b

+ 14 - 2
MingGaoApp/App.vue

@@ -1,5 +1,6 @@
 <script>
-	import config from '@/util/url.js'
+	import config from '@/util/url.js';
+	
 	export default {
 		globalData: {
 			token: "",
@@ -36,7 +37,7 @@
 			// App启动
 
 			var that = this
-			
+
 			// #ifdef APP-PLUS
 			this.wakeLock()
 			// #endif
@@ -55,6 +56,7 @@
 		},
 		onShow: function() {
 			var that = this
+			this.$store.dispatch('updateTaskRecordRatio')
 			// App展示在前台
 			console.log('+++++++++++++++++++App Show-------------------------------------')
 			// this.msgInit(); // 再进行请求
@@ -221,6 +223,16 @@
 						this.$store.commit('updateIsRefusedCall', true)
 					} else if (val.action == 'ok') {
 						this.start(); // 心跳机制
+					} else if (val.action == 'error') {
+						if (val.data.errorCode == 403) {
+							uni.setStorageSync('session_key', '')
+							uni.$u.totast('用户在其他地方登陆,请重新登陆')
+							setTimeout(() => {
+								uni.navigateTo({
+									url: "/pages/login/login"
+								})
+							}, 2000)
+						}
 					}
 
 					// this.reset();

+ 22 - 13
MingGaoApp/components/task-tabs/task-tabs.vue

@@ -9,19 +9,26 @@
 
 <script>
 	export default {
+		props: {
+			tabList: {
+				type: Array,
+				default: () => {
+					return [{
+						id: 1,
+						name: '签到记录',
+					}, {
+						id: 2,
+						name: '诱捕器',
+					}, {
+						id: 3,
+						name: '行驶轨迹'
+					}]
+				}
+			}
+		},
 		data() {
 			return {
 				currentIndex: 1,
-				tabList: [{
-					id: 1,
-					name: '签到记录',
-				}, {
-					id: 2,
-					name: '诱捕器',
-				}, {
-					id: 3,
-					name: '行驶轨迹'
-				}]
 			};
 		},
 		methods: {
@@ -31,8 +38,8 @@
 				}
 
 				this.currentIndex = tabItem.id
-				
-				this.$emit('tabClick',tabItem.id)
+
+				this.$emit('tabClick', tabItem.id)
 			},
 		}
 	}
@@ -45,6 +52,7 @@
 		align-items: center;
 		justify-content: space-between;
 		padding: 0 14rpx;
+		margin-left: -80rpx;
 
 		&::before {
 			content: '';
@@ -57,12 +65,13 @@
 
 		&__item {
 			position: relative;
-			width: 200rpx;
+			flex: 1 1 auto;
 			height: 60rpx;
 			font-weight: 400;
 			text-align: center;
 			font-size: 14px;
 			line-height: 60rpx;
+			margin-left: 80rpx;
 			color: #7489A9;
 			border-radius: 8rpx;
 			background: #F4F7FC;

+ 15 - 7
MingGaoApp/pages/index/clockDetail.vue

@@ -18,12 +18,12 @@
 			<view class="clock-details__img-container">
 				<view class="clock-details__imgs">
 					<view class="clock-details__img" v-for="item,index in urllist" :key="index+item">
-						<view class="icon">
+						<view class="icon" @click="handleRemove(index)">
 							<u-icon name="close" color="#fff"></u-icon>
 						</view>
 						<image :src="baseUrl+item" mode="" class="img"></image>
 					</view>
-					<view class="clock-details__upload" @click="chooseImage">
+					<view class="clock-details__upload" @click="chooseImage" v-if="urllist.length<3">
 						<u-icon size="20" name="plus" color="#409eff"></u-icon>
 					</view>
 				</view>
@@ -50,7 +50,10 @@
 	import * as taskService from '@/service/task.js';
 	import {
 		Debounce
-	} from "@/util/anitthro.js"
+	} from "@/util/anitthro.js";
+	import {
+		pullAt
+	} from 'lodash-es';
 
 	export default {
 		data() {
@@ -150,7 +153,7 @@
 				const payload = {
 					task_id: this.taskID,
 					message: this.message,
-					img_list: this.urllist,
+					img_list: JSON.stringify(this.urllist),
 					address: this.address,
 					lng: this.longitude,
 					lat: this.latitude
@@ -160,8 +163,8 @@
 					uni.$u.toast('打卡成功');
 					// TODO 返回上一页
 					setTimeout(() => {
-						uni.navigateBack({
-							delta: 1
+						uni.switchTab({
+							url: '/pages/index/index'
 						})
 					})
 				}).finally(() => {
@@ -172,7 +175,7 @@
 				uni.chooseImage({
 					count: 1, //默认9
 					sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
-					sourceType: ['camera'], //从相册选择
+					sourceType: ['camera', 'album'], //从相册选择
 					success: (res) => {
 						console.log(res)
 						// this.urllist.push(res.tempFilePaths[0])
@@ -180,6 +183,11 @@
 					}
 				});
 			},
+			handleRemove(index) {
+				if (index !== undefined) {
+					pullAt(this.urllist, index)
+				}
+			},
 			oncancle() {
 				this.kpsurlL = ""
 			},

+ 5 - 1
MingGaoApp/pages/index/components/ClockInRecord.vue

@@ -1,6 +1,6 @@
 <template>
 	<view class="clock-record">
-		<view class="clock-record__action">
+		<view class="clock-record__action" v-if="isEdit">
 			<u-button type="primary" :plain="true" text="打卡" size="mini" @click="handleClockIn"></u-button>
 		</view>
 		<view class="clock-record__body">
@@ -34,6 +34,10 @@
 			dataSource: {
 				type: Object,
 				default: () => ({})
+			},
+			isEdit: {
+				type: Boolean,
+				default: false,
 			}
 		},
 		data() {

+ 11 - 2
MingGaoApp/pages/index/components/Entrapment.vue

@@ -12,7 +12,7 @@
 				<view class="entrapment-card__item" v-for="item in dataSource.trap_record_list" :key="item.id">
 					<view class="entrapment-card__text">{{item.trap_number}}<text
 							class="status">{{item.report_status?`(${item.report_status})`:''}}</text></view>
-					<view class="entrapment-card__btn">
+					<view class="entrapment-card__btn" v-if="isEdit">
 						<u-button v-if="!item.report_status" type="primary" text="填写" size="small"
 							@click="handleEditEntrapmentInfo(item)">
 						</u-button>
@@ -21,6 +21,11 @@
 							<text class="text">更新</text>
 						</view>
 					</view>
+					<view class="entrapment-card__btn" v-else>
+						<u-button type="primary" text="查看" size="small"
+							@click="handleEditEntrapmentInfo(item)">
+						</u-button>
+					</view>
 					<!--  -->
 				</view>
 			</view>
@@ -91,6 +96,10 @@
 			dataSource: {
 				type: Object,
 				default: () => ({})
+			},
+			isEdit: {
+				type: Boolean,
+				default: false,
 			}
 		},
 		components: {
@@ -121,7 +130,7 @@
 				this.entrapmentBaseInfo = {
 					id: row.id,
 					trap_number: row.trap_number,
-					comtype: true
+					comtype: this.isEdit
 				};
 			}
 		}

+ 3 - 3
MingGaoApp/pages/index/components/EntrapmentAdd.vue

@@ -13,7 +13,7 @@
 						<uni-icons type="arrowright" size="12" color="#fff"></uni-icons>
 					</view>
 				</view>
-				<u--input border="none" type="number" v-model="item.pest_number">
+				<u--input border="none" type="number" v-model="item.pest_number" :disabled="!baseinfo.comtype">
 					<template slot="prefix">
 						<image src="@/static/image/task/pest/statistics.png" mode="aspectFit" class="icon">
 						</image>
@@ -113,7 +113,7 @@
 				</u-form-item>
 			</u--form> -->
 		</view>
-		<view class="entrapment-form__content">
+		<view class="entrapment-form__content" v-if="baseinfo.comtype">
 			<view class="entrapment-form__content__btn">
 				<u-button type="primary" :plain="true" icon="plus" text="增加" size="small" @click="addnotwornlistnum">
 				</u-button>
@@ -585,7 +585,7 @@
 			height: 144rpx;
 			border-radius: 70rpx;
 			margin: 0 auto;
-			margin-top: -72rpx;
+			margin-top: -122rpx;
 			background-image: url(~@/static/image/task/pest/bg.png);
 			background-repeat: no-repeat;
 			background-size: 100% 100%;

+ 10 - 15
MingGaoApp/pages/index/components/Gis.vue

@@ -3,12 +3,12 @@
 		<map id="map" ref="map" :show-location="true" :style="{height:contentHeight+'px'}" class="gis-card__content"
 			:latitude="latitude" :longitude="longitude" :markers="covers" :polyline="polylines">
 		</map>
-		<view v-for="(item,index) in logs" :key="index+item">
+		<!-- <view v-for="(item,index) in logs" :key="index+item">
 			{{item}}
 		</view>
 		<view class="gis-card__action">
 			<u-button text="回放" @click="handleTransformHistory" type="primary" size="mini"></u-button>
-		</view>
+		</view> -->
 	</view>
 </template>
 
@@ -39,15 +39,10 @@
 					id: 1,
 					latitude: 34.809478,
 					longitude: 113.666798,
-					iconPath: '../../../static/location.png'
+					iconPath: markerIcon
 				}
 				 */
-				covers: [{
-					id: 1,
-					latitude: 34.809478,
-					longitude: 113.666798,
-					iconPath: markerIcon
-				}],
+				covers: [],
 				allLocationDatasource: {
 					'20230211': []
 				},
@@ -120,12 +115,12 @@
 					longitude: lng
 				})
 
-				this.covers = [{
-					id: 1,
-					latitude: lat,
-					longitude: lng,
-					iconPath: markerIcon
-				}]
+				// this.covers = [{
+				// 	id: 1,
+				// 	latitude: lat,
+				// 	longitude: lng,
+				// 	iconPath: markerIcon
+				// }]
 			},
 			setCenterPosition() {
 				uni.getLocation({

+ 40 - 14
MingGaoApp/pages/index/details.vue

@@ -5,11 +5,11 @@
 		</view>
 		<view class="task-details__body">
 			<u-sticky>
-				<task-tabs @tabClick="handleTabClick"></task-tabs>
+				<task-tabs @tabClick="handleTabClick" :tabList="tabList"></task-tabs>
 			</u-sticky>
 			<view class="task-details__content">
 				<transition name="slide-fade" mode="out-in" appear>
-					<component :is="currentComponent" :dataSource="taskDetail"></component>
+					<component :is="currentComponent" :dataSource="taskDetail" :isEdit="isEdit"></component>
 				</transition>
 			</view>
 		</view>
@@ -35,7 +35,29 @@
 		computed: {
 			...mapState({
 				wornlist: state => state.wornlist
-			})
+			}),
+			tabList() {
+				if (this.task_type) {
+					return [{
+						id: 1,
+						name: '签到记录',
+					}, {
+						id: 2,
+						name: '诱捕器',
+					}, {
+						id: 3,
+						name: '行驶轨迹'
+					}]
+				} else {
+					return [{
+						id: 1,
+						name: '签到记录',
+					}, {
+						id: 3,
+						name: '行驶轨迹'
+					}]
+				}
+			}
 		},
 		data() {
 			return {
@@ -46,6 +68,7 @@
 				draft: [],
 				taskinfo: {},
 				task_type: false,
+				isEdit: false,
 				istask: 1 // 任务模块
 			}
 		},
@@ -105,14 +128,17 @@
 				taskService.getTaskDetailByTaskID(this.taskID).then(res => {
 					console.warn(res, 'get task detail')
 					this.taskDetail = this.taskinfo = res;
+					this.isEdit = res.task_status === '处理中';
+					this.task_id = res.task_id;
 
-					if (this.taskinfo.img_list == "" || this.taskinfo.img_list.length == 0) {
-						this.taskinfo.img_list = []
-					} else {
-						this.taskinfo.img_list = JSON.parse(this.taskinfo.img_list)
-					}
-
-					if (this.taskinfo.task_type == "有害生物监测") {
+					console.log(this.taskinfo, '------------------------------- task info', this.taskDetail)
+					// if (this.taskinfo.img_list == "" || this.taskinfo.img_list.length == 0) {
+					// 	this.taskinfo.img_list = []
+					// } else {
+					// 	this.taskinfo.img_list = JSON.parse(this.taskinfo.img_list)
+					// }
+					console.warn(this.taskinfo.task_type, 'get task detail --1213144')
+					if (res.task_type == "有害生物监测") {
 						this.task_type = true
 					} else {
 						this.task_type = false
@@ -140,8 +166,8 @@
 				// this.gettaskinfo()
 
 				var arr = JSON.parse(JSON.stringify(this.$store.state.worndatabase))
-				console.log(this.draft)
-				console.log(arr)
+				console.warn(this.draft,'draft')
+				console.log(arr,'arr draft')
 				for (var i = 0; i < arr.length; i++) {
 					for (var j = 0; j < this.draft.length; j++) {
 						if (arr[i].id == this.draft[j].record_id) {
@@ -170,8 +196,8 @@
 				if (this.task_type) {
 					data = {
 						task_id: this.task_id, //            是       任务id
-						report_msg: this.textareavalue, //            是       任务汇报内容
-						img_list: JSON.stringify(this.urllist), //            是       图片列表					['http://www.c.com']
+						// report_msg: this.textareavalue, //            是       任务汇报内容
+						// img_list: JSON.stringify(this.urllist), //            是       图片列表					['http://www.c.com']
 						trap_record_list: JSON.stringify(this.draft),
 					}
 					console.log("有数据", data)

+ 8 - 6
MingGaoApp/pages/index/index.vue

@@ -1,6 +1,6 @@
 <template>
 	<view class="task-page">
-		<u-loading-page loading-text="加载中..." :loading="loading" font-size="16"></u-loading-page>
+		<u-loading-page loading-text="加载中..." bgColor="transparent" :loading="loading" font-size="16"></u-loading-page>
 		<view class="task__header">
 			<view class="task__header-container">
 				<view class="search-form">
@@ -97,8 +97,9 @@
 		},
 		onLoad() {},
 		onReachBottom() {
-			const hasMore = this.total > 0 && this.toal > this.page * this.pageSize
-
+			console.warn('each bottom -------- ')
+			const hasMore = this.total > 0 && this.total > this.page * this.pageSize
+			console.warn('each bottom -------- has more', hasMore, this.total, this.page, this.pageSize)
 			if (hasMore) {
 				this.page++;
 				this.getTaskList();
@@ -213,6 +214,7 @@
 						message,
 						duration: 1000 * 3,
 						fontSize: 16,
+						bgColor: '#1B76FF',
 						safeAreaInsetTop: true
 					})
 					this.getTaskList();
@@ -300,7 +302,7 @@
 				taskService.getTaskList(payload).then(res => {
 					console.log(res, 'get task list')
 					this.taskList = this.page === 1 ? res.page_list : concat(this.taskList, res.page_list);
-					this.total = this.total_item;
+					this.total = res.total_item;
 
 					res.page_list.forEach(item => {
 						if (item.walk_status === TASK_WALK_TYPE.IS_RECORDING) {
@@ -360,12 +362,12 @@
 				taskService.taskSubmit({
 					task_id: this.currentTaskID,
 					report_msg: this.report_msg
-				}).then(res=>{
+				}).then(res => {
 					uni.$u.toast('提交成功');
 					// this.updateWalkStatus(TASK_ACTION_TYPE.FINISHED,this.currentTaskID);
 					this.getTaskList();
 					this.currentTaskID = '';
-				}).finally(()=>{
+				}).finally(() => {
 					this.show = false;
 					this.loading = false
 				})

+ 13 - 0
MingGaoApp/store/modules/task.js

@@ -49,6 +49,9 @@ export default {
 				key: locationKey,
 				data: state.locationDataSource,
 			})
+		},
+		updateTaskRecordRatio(state, value) {
+			state.ratio = value * 60 * 1000;
 		}
 	},
 	actions: {
@@ -65,6 +68,16 @@ export default {
 			commit('updateLocationData', data);
 			console.warn('add record location', payload)
 			taskService.addTaskRecordLocation(payload)
+		},
+		updateTaskRecordRatio({
+			commit,
+			dispatch
+		}, ) {
+			taskService.fetchTaskRecordRatio().then(res=>{
+				console.warn('task record ratio',res)
+				// commit('updateTaskRecordRatio', data);
+				// console.warn('add record location', payload)
+			})
 		}
 	}
 }

Plik diff jest za duży
+ 11835 - 11828
MingGaoApp/unpackage/dist/dev/app-plus/app-service.js


Plik diff jest za duży
+ 3214 - 3218
MingGaoApp/unpackage/dist/dev/app-plus/app-view.js


Plik diff jest za duży
+ 2 - 2
MingGaoApp/unpackage/dist/dev/app-plus/pages/response/video.js


+ 4 - 4
MingGaoApp/util/url.js

@@ -4,10 +4,10 @@ export default {
 	// baseUrl:"https://yfznscd.com"
 	// baseUrl:"https://www.toreskj.com"
 	// baseUrl:"https://www.yhswjc.com"
-	// baseUrl:"http://192.168.1.52:12345",
-	// wsUrl:"ws://192.168.1.52:12345",
+	baseUrl:"http://192.168.1.52:12345",
+	wsUrl:"ws://192.168.1.52:12345",
 	// baseUrl:"http://192.168.1.77:12345",
 	// baseUrl:"https://www.toreskj.com",
-	baseUrl:"http://114.115.147.140:12345",
-	wsUrl:"ws://114.115.147.140:12345",
+	// baseUrl:"http://114.115.147.140:12345",
+	// wsUrl:"ws://114.115.147.140:12345",
 }