From 6dab222b7f527fa16db89930bbe028d41b21bd0a Mon Sep 17 00:00:00 2001
From: liuyg <liuyg@qq.com>
Date: Tue, 22 Feb 2022 20:58:33 +0800
Subject: [PATCH] +地图应用
---
pages/grabOrders/feedback.vue | 1
pages/grabOrders/grabOrders.vue | 43 +++---
pages/grabOrders/map.vue | 293 +++++++++++++++++++++++++++++++++++++++++-------
store/apiConfig.js | 4
App.vue | 5
5 files changed, 276 insertions(+), 70 deletions(-)
diff --git a/App.vue b/App.vue
index cb154b8..4a87d6b 100644
--- a/App.vue
+++ b/App.vue
@@ -65,13 +65,14 @@
if (data[k].id == that.socketValue.rid) {
let val = JSON.stringify({
...data[k],
- butCT: "begin",
+ butCT: "beginUp",
buttype: 0,
myid: d.serid,
+ myName: uni.getStorageSync("name") || that.$store.state.puserName,
appenUrl: that.$store.state.piAPI,
isOn: true
});
- uni.navigateTo({
+ uni.redirectTo({
url: "/pages/grabOrders/map?data=" + JSON.stringify(val),
});
} else {
diff --git a/pages/grabOrders/feedback.vue b/pages/grabOrders/feedback.vue
index 1df3499..83d7952 100644
--- a/pages/grabOrders/feedback.vue
+++ b/pages/grabOrders/feedback.vue
@@ -87,6 +87,7 @@
//TODO handle the exception
}
// console.log(b);
+ console.log(b,"bbbbbbbb")
this.data = b;
},
upData() {
diff --git a/pages/grabOrders/grabOrders.vue b/pages/grabOrders/grabOrders.vue
index a23f2cf..48fddcc 100644
--- a/pages/grabOrders/grabOrders.vue
+++ b/pages/grabOrders/grabOrders.vue
@@ -132,30 +132,31 @@
val["appenUrl"] = this.$store.state.piAPI;
//打开地图
- if (val.iscation == 1) {
- if (val.type == 0) {
- //是队长-上传反馈
- val["butCT"] = "beginUp";
- } else if (val.type == 2) {
- //是队长-开始任务
- val["butCT"] = "begin";
- } else {
- //是队长-完成任务任务
- val["butCT"] = "over";
- }
+ // if (val.iscation == 1) {
+ if (val.type == 0) {
+ //是队长-上传反馈
+ val["butCT"] = "beginUp";
+ } else if (val.type == 2) {
+ //是队长-开始任务
+ val["butCT"] = "begin";
} else {
- if (val.type == 0) {
- //不是队长-上传反馈
- val["butCT"] = "over";
- } else if (val.type == 2) {
- //不是队长-开始任务
- val["butCT"] = "over";
- } else {
- //不是队长-完成任务任务
- val["butCT"] = "over";
- }
+ //是队长-完成任务任务
+ val["butCT"] = "over";
}
+ // } else {
+ // if (val.type == 0) {
+ // //不是队长-上传反馈
+ // val["butCT"] = "over";
+ // } else if (val.type == 2) {
+ // //不是队长-开始任务
+ // val["butCT"] = "over";
+ // } else {
+ // //不是队长-完成任务任务
+ // val["butCT"] = "over";
+ // }
+ // }
val["myid"] = uni.getStorageSync("ids") || this.$store.state.puserID;
+ val["myName"] = uni.getStorageSync("name") || this.$store.state.puserName;
console.log(val);
// return
uni.navigateTo({
diff --git a/pages/grabOrders/map.vue b/pages/grabOrders/map.vue
index d7b398e..e609694 100644
--- a/pages/grabOrders/map.vue
+++ b/pages/grabOrders/map.vue
@@ -70,7 +70,7 @@
参与者
</span>
<span class="once-right">
- <span v-for="(item,index) in ourData.team">{{item}}</span>
+ <span v-for="(item,index) in ourData.teams">{{item}}</span>
</span>
</view>
<view class="once-c" v-if="ourData.buttype == 0">
@@ -86,6 +86,15 @@
</u-button>
</view>
</view>
+ <u-popup v-model="showIn" mode="center" border-radius="14" z-index='1000001'>
+ <view class="Info2">
+ <view class="Info4">是否参加活动</view>
+ <view class="Info3">
+ <u-button type="primary" @click="openAPP('oks')">参加</u-button>
+ <u-button type="error" @click="openAPP('nos')">取消</u-button>
+ </view>
+ </view>
+ </u-popup>
</view>
</template>
@@ -127,30 +136,190 @@
map: null,
domMove: null,
query: null,
+ showIn: false,
+ customStyle: {
+ backgroundColor: "#FFF",
+ },
+ bye: true,
}
},
methods: {
- openAPP(val) {
-
- },
- message(event) {
- let data = event.detail.data;
-
- console.log(data);
- },
- sendRequestData(res, plt = 0) {
- let param = JSON.stringify(res)
- console.log(param);
- if (plt == 1) {
- this.webV.postMessage({
- type: 'new',
- data: param
+ openAPP(type) {
+ let that = this;
+ if (type == "oks") {
+ let dataAppend = that.ourData;
+ dataAppend["serid"] = (uni.getStorageSync("ids") || that.$store.state.puserID) + ",";
+ dataAppend["captain"] = uni.getStorageSync("name") || that.$store.state.puserName;
+ uni.request({
+ url: that.$store.state.piAPI + "taskqd/Graborder",
+ method: "POST",
+ data: dataAppend,
+ header: {
+ "content-type": "application/json",
+ },
+ success(res) {
+ if (res.data.msg == "抢单成功") {
+ // appenUrl: "http://192.168.0.108:83/",
+ // butCT: "beginUp",
+ // buttype: 0,
+ // captain: "我",
+ // city: "南昌市",
+ // content: "测试",
+ // district: "西湖区",
+ // id: 37,
+ // integral: "222",
+ // iscation: "1",
+ // jnum: 3,
+ // line: "LINESTRING(115.8995839881188 28.687205773173343,115.89391916267935 28.678966027079593,115.90404718391959 28.673644524394046,115.91211526863638 28.681369286356936)",
+ // num: 1,
+ // nums: 0,
+ // province: "江西省",
+ // publisher: "管理",
+ // raddress: null,
+ // rname: "测试1",
+ // rtype: "0",
+ // serid: "1123598821738675201,",
+ // team: "你,他,它",
+ // time: "2022-02-18 14:15:52",
+ // type: "2",
+ // fname: "管理者",
+ // url: "http://2
+ // myid:111
+ //myName:222
+ that.ourData.rtype = 2;
+ that.ourData.type = 2;
+ that.ourData.buttype = 0;
+ that.ourData.butCT = "begin";
+ if (that.ourData.num == 0) {
+ that.ourData.iscation = "1";
+ that.ourData.serid += that.ourData.myid + ',';
+ that.ourData.captain = that.ourData.myName;
+ } else {
+ that.ourData.iscation = "0";
+ that.ourData.serid += that.ourData.myid + ',';
+ that.ourData.team += ',' + that.ourData.myid;
+ }
+ that.ourData.butCT = "begin";
+ uni.showToast({
+ title: res.data.msg,
+ duration: 2000,
+ });
+ }
+ },
+ complete() {
+ that.showIn = false;
+ }
})
+ return
+ } else if (type == "nos") {
+ this.showIn = false;
+ return
+ }
+ // console.log(type)
+ if (type != 1) {
+ if (that.ourData.butCT == "beginUp") {
+ // 反馈
+ // if (that.onPosition) {
+ // that.onPosition.overContinued();
+ // }
+ this.bye = true;
+ uni.redirectTo({
+ url: '/pages/grabOrders/feedback?data=' + JSON.stringify(this.ourData) +
+ '&other="11111"'
+ });
+ } else if (that.ourData.butCT == "begin") {
+ that.bye = true;//点击开始 这个页面就不用了
+ // 开始任务
+ // that.setUniAppMsg("hBackMsg", {
+ // type: "start",
+ // ourData: {
+ // id: that.ourData.id,
+ // serid: that.ourData.serid
+ // },
+ // fn: function(val) {
+ // if (val == "success") {
+ // // console.log("成功开启任务")
+ // that.ourData.butCT = "beginUp";
+ // that.ourData.rtype = '0';
+ // that.ourData.type = "0";
+ // }
+ // }
+ // })
+ let rid = that.ourData.id,
+ serid = that.ourData.serid,
+ type = 'start',
+ url = that.$store.state.piAPI + "taskqd/startTask?" +
+ `rid=${rid}&serid=${serid}&type=${type}`;
+ uni.request({
+ url: url,
+ method: "get",
+ // header: {
+ // "content-type": "application/json",
+ // },
+ success(res) {
+ // that.timeBegin(1);
+ // that.ourData.butCT = "beginUp";
+ // that.ourData.rtype = '0';
+ // that.ourData.type = "0";
+ },
+ complete() {
+ that.showIn = false;
+ }
+ })
+ // axios.get(url).then((res) => {
+ // // console.log(res);
+
+ // })
+ }
} else {
- this.wv.evalJS(`requestData(${param})`);
+ this.showIn = true;
+ // this.$confirm('是否参与活动:' + this.ourData.rname + "?", '提示', {
+ // confirmButtonText: '确定',
+ // cancelButtonText: '取消',
+ // type: 'success',
+ // center: true,
+ // customClass: "customClass"
+ // }).then(() => {
+ // let url = that.ourData.appenUrl + "taskqd/Graborder",
+ // ourDataAppend = that.ourData;
+ // console.log(url, ourDataAppend)
+
+ // }).catch(() => {
+
+ // });
}
},
+ // message(event) {
+ // let data = event.detail.data;
+
+ // console.log(data);
+ // },
+ // sendRequestData(res, plt = 0) {
+ // let param = JSON.stringify(res)
+ // console.log(param);
+ // if (plt == 1) {
+ // this.webV.postMessage({
+ // type: 'new',
+ // data: param
+ // })
+ // } else {
+ // this.wv.evalJS(`requestData(${param})`);
+ // }
+ // },
timeBegin(val) {
+ console.log(this.bye)
+ if (this.bye) {
+ console.log("再见")
+ if (that.useTime) {
+ clearTimeout(that.useTime);
+ that.useTime = null;
+ }
+ if (that.useTimeSet) {
+ clearTimeout(that.useTimeSet);
+ that.useTimeSet = null;
+ }
+ return
+ }
let that = this;
if (this.useTime) {
return
@@ -171,8 +340,8 @@
if (this.useTimeSet) {
return
} else {
+ that.$store.commit("setMsg", d)
this.useTimeSet = setTimeout(() => {
- that.$store.commit("setMsg", d)
clearTimeout(this.useTimeSet);
that.useTimeSet = null;
}, that.setTimes)
@@ -251,23 +420,7 @@
}
}).exec()
return;
- if (useData) {
- // 执行dom加载完成后的操作
- // 清除定时器
- if (!timer) {
- clearTimeout(timer);
- }
- if (data.fn) {
- //回调函数
- data.fn(useData);
- return;
- } else {
- return dom;
- }
- } else {
- // 自我调用
- timer = setTimeout(checkDom, 200);
- }
+
}
// 首次执行
checkDom();
@@ -331,12 +484,17 @@
// })
// }
},
+ //监听返回
+ onBackPress(event) {
+ this.bye = true;
+ },
onLoad: function(options) {
- var data = [],
+ var datas = {},
+ data = {},
that = this;
if (options.data == undefined) {
// data = JSON.stringify({
- data = {
+ datas = {
appenUrl: "http://192.168.0.108:83/",
butCT: "beginUp",
buttype: 0,
@@ -361,18 +519,38 @@
time: "2022-02-18 14:15:52",
type: "2",
fname: "管理者",
+ myid: 111,
+ myName: 222,
url: "http://223.82.109.183:2081/zhba/upload/20220218/67f0c8bf3e7b5024c64133691f265072.ico",
// })
}
} else {
- data = options.data;
+ datas = options.data;
}
- if (typeof data == "string") {
- data = JSON.parse(data)
+ // if (typeof data == "string") {
+ let i = 0;
+ let toStrings = (val) => {
+ // console.log(i++)
+ // console.log(val)
+ let d = {}
+ if (typeof val == "string") {
+ d = JSON.parse(val)
+ } else {
+ console.log(typeof val == "string")
+ // console.log(val)
+ data = val;
+ return
+ }
+ toStrings(d);
}
- this.ourData = data;
+ toStrings(datas);
+ console.log(data)
+ if (data.team) {
+ data["teams"] = data.team.split(",");
+ }
+ that.ourData = data;
- console.log(data);
+ // console.log(data);
// return
// console.log(options.html)
// var a = options.html != undefined ? options.html : "xcxMapJQ/xcxmap.html";
@@ -420,8 +598,8 @@
// _this.mapHeight = res.screenHeight - res.statusBarHeight
// setTimeout(() => {
// that.getDom('#Umain', data => {
- console.log(res.screenHeight - res.statusBarHeight -420)
- _this.mapHeight = res.screenHeight - res.statusBarHeight -420
+ console.log(res.screenHeight - res.statusBarHeight - 420)
+ _this.mapHeight = res.screenHeight - res.statusBarHeight - 420
_this.mapHeight = _this.mapHeight
// })
// }, 1000)
@@ -517,6 +695,7 @@
//画线
+ console.log(data)
let line = data.line.split("(")[1].split(")")[0].split(",");
let ourline = [];
for (let k in line) {
@@ -528,7 +707,8 @@
}
this.polylines[0].points = ourline;
// this.getLocationInfo(data);
- if (data.butCT == "beginUp") {
+ if (data.butCT == "beginUp" && data.buttype == 0) {
+ this.bye = false;
this.timeBegin(1);
}
},
@@ -644,4 +824,27 @@
color: #ffffff;
}
}
+
+
+ .Info2 {
+ width: 200px;
+ height: 100px;
+ padding: 0 10px;
+
+ .Info3 {
+ width: 100%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ height: 50px;
+ }
+
+ .Info4 {
+ width: 100%;
+ line-height: 50px;
+ font-size: 18px;
+ text-align: center;
+ height: 50px;
+ }
+ }
</style>
diff --git a/store/apiConfig.js b/store/apiConfig.js
index 0e8db88..00b8b68 100644
--- a/store/apiConfig.js
+++ b/store/apiConfig.js
@@ -7,8 +7,8 @@
var wsapi = 'ws://192.168.0.108:9034/websocket';
}
-// var api = 'http://192.168.0.222:5500';
-// var wsapi = 'ws://192.168.0.222:5500';
+// var api = 'http://192.168.0.222:83/';
+// var wsapi = 'ws://192.168.0.222:9034/websocket';
export default {
api: api,
--
Gitblit v1.9.3