From ea1a4d37df8f0714008d5857cf40059af83620ee Mon Sep 17 00:00:00 2001
From: xiebin <123456>
Date: Thu, 29 Sep 2022 18:06:38 +0800
Subject: [PATCH] 增加任务详情功能
---
pages/taskinfo/detail.vue | 96 +++++++++++++++++++++++++++--------------------
manifest.json | 11 ++++-
utils/func.js | 1
3 files changed, 64 insertions(+), 44 deletions(-)
diff --git a/manifest.json b/manifest.json
index 44a4892..4b85fc6 100644
--- a/manifest.json
+++ b/manifest.json
@@ -22,7 +22,9 @@
"delay": 0
},
/* 模块配置 */
- "modules": {},
+ "modules": {
+ "Geolocation": {}
+ },
/* 应用发布信息 */
"distribute": {
/* android打包配置 */
@@ -55,7 +57,12 @@
"ios": {},
/* SDK配置 */
"sdkConfigs": {
- "ad": {}
+ "ad": {},
+ "geolocation": {
+ "system": {
+ "__platform__": ["ios", "android"]
+ }
+ }
}
}
},
diff --git a/pages/taskinfo/detail.vue b/pages/taskinfo/detail.vue
index 5ae9429..29dc7c0 100644
--- a/pages/taskinfo/detail.vue
+++ b/pages/taskinfo/detail.vue
@@ -2,12 +2,10 @@
<view class="content">
<u-top-tips ref="uTips"></u-top-tips>
<map style="width: 100%; height: 30vh;" scale="14" :latitude="latitude" :longitude="longitude"
- :polyline="polyline" show-location="true">
- <cover-view class="dingwBut" @click="getSelfLocation">
-
- <cover-image src="../../static/images/taskinfo/map/img/dingwei.png" @click="getSelfLocation">
- </cover-image>
- </cover-view>
+ :polyline="polyline">
+ <!-- <cover-view class="dingwBut" @click="getSelfLocation">
+ <cover-image src="../../static/images/taskinfo/map/img/dingwei.png"></cover-image>
+ </cover-view> -->
</map>
<view id="Umain" style="height: 71%;z-index: 9999;">
<view class="once-b">
@@ -18,7 +16,7 @@
巡查标题
</span>
<span class="once-right">
- {{data.title}}
+ {{taskinfoData.title}}
</span>
</view>
<view class="once">
@@ -26,7 +24,7 @@
巡查内容
</span>
<span class="once-right">
- {{data.content}}
+ {{taskinfoData.content}}
</span>
</view>
<view class="once">
@@ -34,7 +32,7 @@
开始时间
</span>
<span class="once-right">
- {{data.startTime}}
+ {{taskinfoData.startTime}}
</span>
</view>
<view class="once">
@@ -42,7 +40,7 @@
预计结束
</span>
<span class="once-right">
- {{data.endTime}}
+ {{taskinfoData.endTime}}
</span>
</view>
<view class="once">
@@ -50,7 +48,7 @@
状态
</span>
<span class="once-right">
- {{data.state == 0?'待开始':data.state == 1?'正在进行':'已完成'}}
+ {{taskinfoData.state == 0?'待开始':taskinfoData.state == 1?'正在进行':'已完成'}}
</span>
</view>
<view class="once-c">
@@ -63,29 +61,30 @@
<script>
import {
getDetail
- } from "@/api/taskinfo/taskinfo";
+ } from "@/api/taskinfo/taskinfo"
export default {
data() {
return {
id: 0,
- data: {},
- latitude: 28.6741777439167,
- longitude: 115.91024735502,
+ taskinfoData: {},
+ latitude: '',
+ longitude: '',
polyline: [{
// LINESTRING(115.91024735502 28.6783047633229, 115.916073731654 28.6741777439167,
// 115.908426611165 28.6739956695312)
- points: [{
- latitude: 28.6783047633229,
- longitude: 115.91024735502
- },
- {
- latitude: 28.6741777439167,
- longitude: 115.916073731654
- },
- {
- latitude: 28.6739956695312,
- longitude: 115.908426611165
- }
+ points: [
+ // {
+ // latitude: 28.6783047633229,
+ // longitude: 115.91024735502
+ // },
+ // {
+ // latitude: 28.6741777439167,
+ // longitude: 115.916073731654
+ // },
+ // {
+ // latitude: 28.6739956695312,
+ // longitude: 115.908426611165
+ // }
],
color: "#10a4ff", //线的颜色
width: 10, //线的宽度
@@ -96,26 +95,41 @@
},
methods: {
getSelfLocation() {
- // var that = this;
- // uni.getLocation({
- // type: 'gcj02',
- // isHighAccuracy: true,
- // success(res) {
- // that.latitude = res.latitude
- // that.longitude = res.longitude
- // }
- // })
- },
- getDetail() {
- getDetail(this.id).then(res => {
- this.data = res.data;
+ var that = this;
+ uni.getLocation({
+ type: 'gcj02',
+ isHighAccuracy: true,
+ success(res) {
+ that.latitude = res.latitude
+ that.longitude = res.longitude
+ }
})
+ },
+ getTaskinfoDetail() {
+ var _that = this
+ getDetail(_that.id).then(res => {
+ _that.taskinfoData = res.data;
+ //处理地图路线 //
+ let routeRange = _that.taskinfoData.routeRange.replace('LINESTRING', '')
+ .replace('\(', '').replace('\)', '')
+ let ranges = routeRange.split(',')
+ for (var i = 0; i < ranges.length; i++) {
+ let postion = ranges[i].split(' ')
+ _that.polyline[0].points.push({
+ longitude: postion[0],
+ latitude: postion[1]
+ })
+ }
+ _that.longitude = _that.polyline[0].points[0].longitude
+ _that.latitude = _that.polyline[0].points[0].latitude
+ })
+
}
},
onLoad: function(options) {
if (options.id) {
this.id = options.id
- this.getDetail()
+ this.getTaskinfoDetail()
}
}
}
diff --git a/utils/func.js b/utils/func.js
index d40408b..a853946 100644
--- a/utils/func.js
+++ b/utils/func.js
@@ -6,7 +6,6 @@
vm.$u.vuex('userInfo', userInfo)
vm.$u.vuex('accessToken', userInfo.access_token)
vm.$u.vuex('isLogin', true)
- console.log(111111)
uni.switchTab({
url: '/pages/service/service'
})
--
Gitblit v1.9.3