xiebin
2022-09-29 ea1a4d37df8f0714008d5857cf40059af83620ee
增加任务详情功能
3 files modified
108 ■■■■■ changed files
manifest.json 11 ●●●● patch | view | raw | blame | history
pages/taskinfo/detail.vue 96 ●●●●● patch | view | raw | blame | history
utils/func.js 1 ●●●● patch | view | raw | blame | history
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"]
                    }
                }
            }
        }
    },
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()
            }
        }
    }
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'
        })