ce4c83ff
wxy
初始提交
|
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
|
}
module.hot.dispose(function (data) {
disposed = true
})
})()}
/* harmony default export */ __webpack_exports__["default"] = (Component.exports);
/***/ }),
/***/ 335:
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/***/ 336:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _stringify = __webpack_require__(35);
var _stringify2 = _interopRequireDefault(_stringify);
var _promise = __webpack_require__(12);
var _promise2 = _interopRequireDefault(_promise);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
exports.default = {
data: function data() {
return {
text: '',
hasHandleAuth: false,
street: {
columnOne: [],
index: 0,
arrStruct: [],
label: '点击选择街道'
},
community: {
columnOne: [],
index: 0,
arrStruct: [],
label: '点击选择社区'
}
};
},
methods: {
canIGetPos: function canIGetPos() {
var _this = this;
return new _promise2.default(function (resolve) {
wx.showLoading({ title: '加载中' });
wx.request({
url: _this.rootUrl + '/law/position',
success: function success(res) {
wx.hideLoading();
resolve(res.data);
}
});
});
},
canICheckin: function canICheckin() {
var _this2 = this;
this.canIGetPos().then(function (res) {
if (res === 0) {
wx.showModal({ title: '您已进行过定位', icon: 'none' });
wx.navigateBack({ delta: 1 });
} else {
wx.showModal({
title: '',
content: '若之前已经完成过收集,则不需要重新收集,请点击取消!\n 若未完成过收集,请点击确认',
success: function success(res) {
if (res.confirm) {
wx.showModal({
title: '',
content: '确定要定位吗?',
success: function success(res) {
if (res.confirm) {
if (_this2.community.label == '点击选择社区') {
wx.showModal({
title: '定位失败',
content: '请选择您当前所在的街道和社区',
showCancel: false
});
} else {
_this2.getLocation();
}
}
}
});
}
}
});
}
});
},
getLocation: function getLocation() {
var _this3 = this;
wx.showLoading({ title: '正在定位' });
var lat = void 0,
lng = void 0;
wx.getLocation({
type: 'gcj02',
success: function success(res) {
lat = res.latitude;
lng = res.longitude;
wx.request({
url: _this3.rootUrl + '/local/add',
header: { 'content-type': 'application/x-www-form-urlencoded' },
method: 'POST',
data: {
// sessionID: wx.getStorageSync('sessionID'),
SCID: _this3.community.arrStruct[_this3.community.index].value,
latit: lat,
longi: lng
// localName: formatted_address,
// remark: this.text
},
success: function success(res) {
if (res.statusCode == '500') {
_this3.service.getUnionId(_this3.rootAvatar, _this3.rootUrl).then(function (res) {
_this3.getLocation();
});
} else {
wx.hideLoading();
if (res.data != -2) {
wx.showToast({ title: '定位成功' });
wx.navigateBack({ delta: 1 });
} else {
wx.showModal({
title: '定位失败',
content: '已超过当日定位次数上限',
showCancel: false
});
}
}
}
});
// wx.request({
// url: 'https://api.map.baidu.com/geocoder/v2/',
// data: {
// ak: 'AnWpq9Kc3C8cq5CCGAzsq3NxpBkxRnl0',
// location: `${lat},${lng}`,
// coordtype: 'gcj02ll',
// output: 'json'
// },
// success: res => {
// const formatted_address = res.data.result.formatted_address
// wx.request({
// url: this.rootUrl + '/local/add',
// header: {'content-type': 'application/x-www-form-urlencoded'},
// method: 'POST',
// data: {
// // sessionID: wx.getStorageSync('sessionID'),
// SCID: this.community.arrStruct[this.community.index].value,
// latit: lat,
// longi: lng,
// // localName: formatted_address,
// // remark: this.text
// },
// success: res => {
// if (res.statusCode == '500') {
// this.service.getUnionId(this.rootAvatar, this.rootUrl).then(res => {
// this.getLocation()
// })
// } else {
// wx.hideLoading()
// if (res.data != -2) {
// wx.showToast({title: '定位成功'})
// } else {
// wx.showModal({
// title: '定位失败',
// content: '已超过当日定位次数上限',
// showCancel: false
// })
// }
// }
// }
// })
// }
// })
},
fail: function fail(err) {
var authSetting = void 0;
wx.getSetting({
success: function success(res) {
authSetting = res.authSetting['scope.userLocation'];
console.log(authSetting);
},
complete: function complete() {
if (authSetting) {
if (_this3.hasHandleAuth) {
_this3.getLocation();
} else {
var realName = wx.getStorageSync('userInfo').nickName;
_this3.service.UploadBug(_this3.rootUrl, 'test/getLocation/' + realName, (0, _stringify2.default)(err));
wx.showModal({
title: '定位失败',
content: '微信未获得位置权限\n请在您手机的系统设置-权限管理中,打开微信的位置信息获取权限',
showCancel: false,
success: function success(res) {
if (res.confirm) {
wx.hideLoading();
}
}
});
}
} else {
wx.hideLoading();
wx.showModal({
title: '授权请求',
content: '您已拒绝小程序获取地理位置,若要使用定位功能,请重新授权',
showCancel: false,
success: function success(res) {
if (res.confirm) {
wx.openSetting({
success: function success(res) {
if (res.authSetting['scope.userLocation']) {
_this3.hasHandleAuth = true;
_this3.getLocation();
}
}
});
}
}
});
}
}
});
}
});
},
getCommunity: function getCommunity() {
var _this4 = this;
if (arguments[0] !== 'first') {
wx.showLoading({ title: '加载社区列表' });
}
wx.request({
url: this.rootUrl + '/comm/getbyid/' + this.street.arrStruct[this.street.index].value,
success: function success(res) {
_this4.community.columnOne = res.data.map(function (v) {
return v.comm_Name;
});
_this4.community.arrStruct = res.data.map(function (v) {
return { label: v.comm_Name, value: v.scid };
});
wx.hideLoading();
}
});
},
pickerConfirm: function pickerConfirm(e, s) {
switch (s) {
case 'street':
{
this.street.index = e.mp.detail.value;
this.street.label = this.street.columnOne[this.street.index];
this.getCommunity();
break;
}
case 'community':
{
this.community.index = e.mp.detail.value;
this.community.label = this.community.columnOne[this.community.index];
break;
}
}
}
},
onLoad: function onLoad() {
var _this5 = this;
wx.request({
url: this.rootUrl + '/street/all',
success: function success(res) {
_this5.street.columnOne = res.data.map(function (v) {
return v.street_Name;
});
_this5.street.arrStruct = res.data.map(function (v) {
return { label: v.street_Name, value: v.ssid };
});
_this5.getCommunity('first');
}
});
}
};
/***/ }),
/***/ 337:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', {
staticClass: "root"
}, [_c('div', {
staticClass: "baseinfo-box"
}, [_c('div', {
staticClass: "list-input between"
}, [_c('span', [_vm._v("当前街道")]), _vm._v(" "), _c('picker', {
attrs: {
"value": _vm.street.index,
"range": _vm.street.columnOne,
"eventid": '0'
},
on: {
"change": function($event) {
_vm.pickerConfirm($event, 'street')
}
}
}, [_c('div', {
attrs: {
"hover-class": "hover"
}
}, [_vm._v(_vm._s(_vm.street.label))])])], 1), _vm._v(" "), _c('div', {
staticClass: "list-input between"
}, [_c('span', [_vm._v("当前社区")]), _vm._v(" "), _c('picker', {
attrs: {
"value": _vm.community.index,
"range": _vm.community.columnOne,
"eventid": '1'
},
on: {
"change": function($event) {
_vm.pickerConfirm($event, 'community')
}
}
}, [_c('div', {
attrs: {
"hover-class": "hover"
}
}, [_vm._v(_vm._s(_vm.community.label))])])], 1), _vm._v(" "), _c('div', {
staticClass: "tip"
}, [_vm._v("社区定位功能用于收集社区经纬定信息,为本社区打卡提供定位数据。此菜单仅在以下条件下才开启,并只收集一次即可:"), _c('br'), _vm._v("a. 新加入的社区需要定位数据。"), _c('br'), _vm._v("b. 社区定位不准确,需要重新定位。"), _c('br'), _vm._v("c. 社区搬家需要重新定位经纬度。")], 1), _vm._v(" "), _c('div', {
staticClass: "tip strong"
}, [_vm._v("定位时请确认您正在所选社区的办公室门口或方圆50米内。")]), _vm._v(" "), _c('div', {
staticClass: "commit",
attrs: {
"eventid": '2'
},
on: {
"tap": _vm.canICheckin
}
}, [_c('div', [_vm._v("定位")])])])])
}
var staticRenderFns = []
render._withStripped = true
var esExports = { render: render, staticRenderFns: staticRenderFns }
/* harmony default export */ __webpack_exports__["a"] = (esExports);
if (false) {
module.hot.accept()
if (module.hot.data) {
|