shuishen
2022-02-21 ed9709a6e101a7f2eca4403f93e7aa4f71a78220
Merge branch 'master' of http://192.168.0.105:10010/r/qfqk-android
8 files modified
241 ■■■■■ changed files
App.vue 6 ●●●● patch | view | raw | blame | history
leafletMapOur/grabOrdersMap/js/getPosition.js 72 ●●●● patch | view | raw | blame | history
leafletMapOur/grabOrdersMap/js/vueMain.js 42 ●●●●● patch | view | raw | blame | history
pages/grabOrders/feedback.vue 54 ●●●● patch | view | raw | blame | history
pages/grabOrders/map.vue 48 ●●●●● patch | view | raw | blame | history
store/lid/getPosition.js 4 ●●●● patch | view | raw | blame | history
store/positions.js 12 ●●●● patch | view | raw | blame | history
store/websocket.js 3 ●●●● patch | view | raw | blame | history
App.vue
@@ -34,13 +34,13 @@
        },
        watch: {
            socketValue() {
                console.log(this.socketValue);
                // console.log(this.socketValue);
                let that = this;
                if (that.socketValue.type === "start") {
                    console.log("任务开启")
                    // console.log("任务开启")
                    this.$store.commit("addTask", this.socketValue.rid);
                } else if (that.socketValue.type === "stop") {
                    console.log("任务结束")
                    // console.log("任务结束")
                    this.$store.commit("stopTask", this.socketValue.rid);
                }
            }
leafletMapOur/grabOrdersMap/js/getPosition.js
@@ -50,7 +50,7 @@
        //开始持续获取定位
        let that = this;
        if (val != 1) {
            console.log("开始持续定位")
            // console.log(that.id,"开始持续定位")
            this.isContinued = true;
            that.once(function(res) {
                if (res.state == false) {
@@ -59,7 +59,7 @@
                }
            })
            if (this.isContinuedTimeOut) {
                console.log("重复开始持续定位")
                // console.log("重复开始持续定位")
                return;
            }
        }
@@ -77,11 +77,11 @@
                    }
                }
            })
        }, 5000)
        }, 3000)
    }
    overContinued() {
        console.log("结束持续定位")
        // console.log("结束持续定位")
        let that = this;
        if (this.isContinued) {
            this.isContinued = false;
@@ -94,22 +94,15 @@
                this.isContinuedTimeOut = null;
            }
        }
        this.isContinued = false;
        that.outData('out');
    }
    // overContinued() {
    //     console.log("结束持续定位")
    //     let that = this;
    //     if (this.isContinued) {
    //         this.isContinued = false;
    //         clearInterval(that.isContinuedTimeInt);
    //         this.isContinuedTimeInt = null;
    //     }
    // }
    once(fn) {
        console.log("开始获取一次定位");
        // console.log("开始获取一次定位");
        this.state = true;
        let ok = true;
        let that = this,
            fns = fn,
            fns = fn || '',
            outit = function() {
                if (fns) {
                    fns({
@@ -124,8 +117,8 @@
        outit();
        let success = function(position) {
            // console.log(position);
            var lat = position.coords.latitude;
            var lon = position.coords.longitude;
            var lat = position.coords.longitude;//经度
            var lon = position.coords.latitude;//纬度
            // console.log("成功返回经纬度信息");
            // console.log(lon, lat, "成功");
            that.onceNowPosition = [lat, lon];
@@ -152,7 +145,7 @@
            }
            that.onceNowPosition = msg;
            that.state = false;
            ok = true;
            ok = false;
            outit();
        };
        let options = {
@@ -166,53 +159,22 @@
            error,
            options
        );
        //高德定位
        // console.log("开始获取一次定位");
        // this.state = true;
        // let that = this;
        // that.outData();
        // AMap.plugin("AMap.Geolocation", function() {
        //     var geolocation = new AMap.Geolocation({
        //         // 是否使用高精度定位,默认:true
        //         enableHighAccuracy: true,
        //         // 设置定位超时时间,默认:无穷大
        //         // timeout: 10000,
        //     });
        //     geolocation.getCurrentPosition();
        //     AMap.event.addListener(geolocation, "complete", onComplete);
        //     AMap.event.addListener(geolocation, "error", onError);
        //     function onComplete(data) {
        //         // data是具体的定位信息
        //         // console.log(data);
        //         var lat = data.position.lat;
        //         var lon = data.position.lng;
        //         // console.log("成功返回经纬度信息");
        //         // console.log(lon, lat, "成功");
        //         that.onceNowPosition = [lon, lat];
        //         this.state = false;
        //         that.outData();
        //     }
        //     function onError(data) {
        //         // 定位出错
        //         // console.log(data);
        //         that.onceNowPosition = data;
        //         this.state = false;
        //         that.outData();
        //     }
        // });
    }
    //结束获取
    outInit() {
    }
    //抛出数据
    outData() {
    outData(val) {
        let d = {
            state: this.state,
            intlat: this.onceNowPosition
        }
        if (val) {
            d[val] = val
        }
        this.fn(d)
    }
}
// export default $getPositions;
leafletMapOur/grabOrdersMap/js/vueMain.js
@@ -54,7 +54,7 @@
                    });
                } else if (that.data.butCT == "begin") {
                    // 开始任务
                    this.setUniAppMsg({
                    that.setUniAppMsg({
                        type: "start",
                        data: {
                            id: that.data.id,
@@ -62,10 +62,10 @@
                        },
                        fn: function(val) {
                            if (val == "success") {
                                console.log("成功开启任务")
                                this.data.butCT = "beginUp";
                                this.data.rtype = '0';
                                this.data.type = "0";
                                // console.log("成功开启任务")
                                that.data.butCT = "beginUp";
                                that.data.rtype = '0';
                                that.data.type = "0";
                            }
                        }
                    })
@@ -354,21 +354,30 @@
                this.oncePosition = new $getPositions({
                    id: 1,
                    fn: function(res) {
                        console.log(res);
                        // console.log(res);
                        that.mapPositionLoding = res.state;
                        if (!res.state) {
                            that.addIcon(res.intlat);
                            console.log(res)
                            if (typeof res.intlat === "string") {
                                window.parent.showTip("获取定位失败")
                            } else {
                                that.addIcon([res.intlat[1], res.intlat[0]]);
                            }
                        }
                    }
                }).init();
            }
            if (!this.onPosition) {
                this.oncePosition.continuedTime();
                this.onPosition = !this.onPosition;
                this.oncePosition.once();
            } else {
                this.oncePosition.overContinued();
                this.onPosition = !this.onPosition;
                this.oncePosition.once();
            }
            // if (!this.onPosition) {
            //     this.oncePosition.continuedTime();
            //     this.onPosition = !this.onPosition;
            // } else {
            //     this.oncePosition.overContinued();
            //     this.onPosition = !this.onPosition;
            // }
        },
        //添加图标
        addIcon(intlat) {
@@ -654,12 +663,13 @@
            },
        });
        this.domMove.init();
        // console.log(window.parent.setIntLat)
        window.parent.setIntLat({
            rid: this.data.id,
            fn: (out) => {
                console.log(out);
                that.addIcon(out);
                // console.log(out,"1111");
                // that.addIcon(out);
                that.addIcon([out[1], out[0]]);
            }
        })
    },
pages/grabOrders/feedback.vue
@@ -42,7 +42,8 @@
                </view>
            </view>
            <view class="butb">
                <u-button class="custom-style" type="primary" @click="upData">我反馈</u-button>
                <!-- custom-style -->
                <u-button class="submits" type="primary" @click="upData">我反馈</u-button>
            </view>
        </view>
    </view>
@@ -114,22 +115,11 @@
                    serid: uni.getStorageSync("ids")
                    // result: this.content,
                };
                let ds = {
                }
                wx.showLoading({
                    title: "提交中...",
                    mask: true
                })
                // console.log(dataList);
                let d = {
                    rid: this.data.id,
                    serid: this.data.serid,
                    type: "stop",
                    that: that
                }
                that.$store.commit('useWebScoketApi', d);
                wx.request({
                    url: this.$store.state.piAPI + 'taskfk/save', //仅为示例,并非真实接口地址。
                    data: dataList,
@@ -159,7 +149,13 @@
                        });
                    }
                });
                let d = {
                    rid: this.data.id,
                    serid: this.data.serid,
                    type: "stop",
                    that: that
                }
                that.$store.commit('useWebScoketApi', d);
            },
            takePhoto() {
                var that = this;
@@ -342,8 +338,8 @@
        }
        .butb {
            margin: 1rem auto;
            width: 6rem;
            // margin: 1rem auto;
            // width: 6rem;
            height: 3rem;
            // // border: 1px solid rgb(46, 118, 228);
            // border-radius: 1rem;
@@ -372,4 +368,32 @@
        background-image: linear-gradient(to right, #08EFF6, #0693FD);
        border-radius: 20px;
    }
    .submits {
        margin: 60rpx 90rpx 0;
        border: none;
        width: 572rpx;
        height: 86rpx;
        // line-height: 86rpx;
        box-sizing: border-box;
        border-radius: 15rpx;
        background-color: #103289;
        color: #ffffff;
        &::after {
            content: none;
        }
        &::before {
            content: none;
        }
        &[disabled='true'] {
            background: #e4e4e4;
            font-size: 36rpx;
            font-family: Source Han Sans CN;
            font-weight: 500;
            color: #ffffff;
        }
    }
</style>
pages/grabOrders/map.vue
@@ -1,6 +1,7 @@
<template>
    <view class="content">
        <u-top-tips ref="uTips"></u-top-tips>
        <!-- <u-button type="info" @click="acc">测试</u-button> -->
        <web-view :src="urls"></web-view>
    </view>
</template>
@@ -11,15 +12,40 @@
            return {
                urls: '',
                // dataList: [],
                fn: null,
                rid: ''
            }
        },
        methods: {
        methods: {},
        computed: {
            isOnTaskValue() {
                if (this.$store.state.changes) {
                    return this.$store.state.isOnTaskValue;
                } else {
                    return this.$store.state.isOnTaskValue;
                }
            }
        },
        watch: {
            isOnTaskValue: {
                handler(newName, oldName) {
                    // console.log("map", this.isOnTaskValue);
                    for (let k in this.isOnTaskValue) {
                        if (this.isOnTaskValue[k].id == this.rid) {
                            if (this.fn) {
                                this.fn(this.isOnTaskValue[k].intlat);
                            }
                        }
                    }
                },
                deep: true
            }
        },
        mounted() {},
        onReady() {
            let that = this;
            window.hBackMsg = (val) => {
                // console.log(val)
                let d = {
                    rid: val.data.id,
                    serid: val.data.serid,
@@ -27,10 +53,25 @@
                    that: that,
                    fn: () => {
                        // that.getGrabOrders(that.current); //重获取数据
                        val.fn();
                        if (val.fn) {
                            // console.log(111)
                            val.fn("success");
                        }
                    }
                }
                that.$store.commit('useWebScoketApi', d);
            }
            window.setIntLat = (val) => {
                // console.log(fn);
                that.fn = val.fn || '';
                that.rid = val.rid || '';
            }
            window.showTip = (val) => {
                that.$refs.uTips.show({
                    title: val,
                    type: "warning",
                    duration: '2300'
                })
            }
        },
        onLoad: function(options) {
@@ -79,6 +120,7 @@
            if (b == '/api') {
                name = 1;
            }
            // "E:\liumy\qfqk\qfqks\qfqk-android\leafletMapOur\grabOrdersMap\xcxmap.html"
            let a = name == 1 ? "http://127.0.0.1:8848/qfqk-android/leafletMapOur/" : b.slice(0, b.indexOf('api'));
            // this.urls = a + "grabOrdersMap/xcxmap.html?data=" + data;
            // a = a.slice(0, a.indexOf('api'));
store/lid/getPosition.js
@@ -117,8 +117,8 @@
        outit();
        let success = function(position) {
            // console.log(position);
            var lat = position.coords.latitude;
            var lon = position.coords.longitude;
            var lat = position.coords.longitude;//经度
            var lon = position.coords.latitude;//纬度
            // console.log("成功返回经纬度信息");
            // console.log(lon, lat, "成功");
            that.onceNowPosition = [lat, lon];
store/positions.js
@@ -8,6 +8,8 @@
    state: {
        isBeginTask: {},
        isOnTask: {},
        isOnTaskValue: {},
        changes: true
    },
    actions: {
        // connectws({
@@ -26,10 +28,16 @@
                    id: id,
                    fn: function(res) {
                        // console.log(res);
                        $store.commit("setMsg", {
                        state.isOnTaskValue[id] = {
                            id: id,
                            intlat: res.intlat
                        })
                        }
                        state.changes = !state.changes;
                        console.log(state.isOnTaskValue)
                        // $store.commit("setMsg", {
                        //     id: id,
                        //     intlat: res.intlat
                        // })
                    }
                })
            }
store/websocket.js
@@ -4,8 +4,9 @@
import WxStorage from "../static/lib/wxStorage.js" //微信Storage
// var url = 'ws://' + vueconfig.devServer.proxy["/cloud"].target.substring(5) + '/websocket';
import $store from './index.js'
let url = 'ws://192.168.0.108:9034/websocket';
// let url = 'ws://223.82.109.183:2082/websocket';
const webSockets = new Wst(url);