|
|
|
|
@ -361,6 +361,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
var _default = {
|
|
|
|
|
data: function data() {
|
|
|
|
|
return {
|
|
|
|
|
@ -396,9 +397,104 @@ var _default = {
|
|
|
|
|
selectChange: function selectChange(e, type) {
|
|
|
|
|
console.log(e, type);
|
|
|
|
|
},
|
|
|
|
|
// getLocationInfo方法为用户点击后调用
|
|
|
|
|
getLocationInfo: function getLocationInfo() {
|
|
|
|
|
var _this = this;
|
|
|
|
|
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
|
|
|
var that;
|
|
|
|
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
|
|
|
while (1) {
|
|
|
|
|
switch (_context.prev = _context.next) {
|
|
|
|
|
case 0:
|
|
|
|
|
that = _this; // 获取用户是否开启 授权获取当前的地理位置、速度的权限。
|
|
|
|
|
uni.getSetting({
|
|
|
|
|
success: function success(res) {
|
|
|
|
|
console.log(res);
|
|
|
|
|
// 如果没有授权
|
|
|
|
|
if (!res.authSetting['scope.userLocation']) {
|
|
|
|
|
// 则拉起授权窗口
|
|
|
|
|
uni.authorize({
|
|
|
|
|
scope: 'scope.userLocation',
|
|
|
|
|
success: function success() {
|
|
|
|
|
//点击允许后--就一直会进入成功授权的回调 就可以使用获取的方法了
|
|
|
|
|
uni.getLocation({
|
|
|
|
|
type: 'wgs84',
|
|
|
|
|
success: function success(res) {
|
|
|
|
|
console.log(res);
|
|
|
|
|
console.log('当前位置的经度1:' + res.longitude);
|
|
|
|
|
console.log('当前位置的纬度1:' + res.latitude);
|
|
|
|
|
},
|
|
|
|
|
fail: function fail(error) {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: '获取地址失败,请检查手机是否打开定位功能,未打开将导致部分功能不可用',
|
|
|
|
|
icon: 'none'
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
fail: function fail(error) {
|
|
|
|
|
//点击了拒绝授权后--就一直会进入失败回调函数--此时就可以在这里重新拉起授权窗口
|
|
|
|
|
console.log('拒绝授权', error);
|
|
|
|
|
uni.showModal({
|
|
|
|
|
title: '提示',
|
|
|
|
|
content: '若点击不授权,将无法使用位置功能',
|
|
|
|
|
showCancel: false,
|
|
|
|
|
// cancelText: '不授权',
|
|
|
|
|
// cancelColor: '#999',
|
|
|
|
|
confirmText: '授权',
|
|
|
|
|
confirmColor: '#f94218',
|
|
|
|
|
success: function success(res) {
|
|
|
|
|
console.log(res);
|
|
|
|
|
if (res.confirm) {
|
|
|
|
|
// 选择弹框内授权
|
|
|
|
|
uni.openSetting({
|
|
|
|
|
success: function success(res) {
|
|
|
|
|
console.log(res.authSetting);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} else if (res.cancel) {
|
|
|
|
|
// 选择弹框内 不授权
|
|
|
|
|
console.log('用户点击不授权');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
// 有权限则直接获取
|
|
|
|
|
uni.getLocation({
|
|
|
|
|
type: 'wgs84',
|
|
|
|
|
success: function success(res) {
|
|
|
|
|
console.log(res);
|
|
|
|
|
console.log('当前位置的经度1:' + res.longitude);
|
|
|
|
|
console.log('当前位置的纬度1:' + res.latitude);
|
|
|
|
|
},
|
|
|
|
|
fail: function fail(error) {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: '获取地址失败,请检查手机是否打开定位功能,未打开将导致部分功能不可用',
|
|
|
|
|
icon: 'none'
|
|
|
|
|
});
|
|
|
|
|
console.log('失败', error);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
case 2:
|
|
|
|
|
case "end":
|
|
|
|
|
return _context.stop();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}, _callee);
|
|
|
|
|
}))();
|
|
|
|
|
},
|
|
|
|
|
chooseReside: function chooseReside() {
|
|
|
|
|
var that = this;
|
|
|
|
|
console.log(parseFloat(that.form.latitude), parseFloat(that.form.longitude));
|
|
|
|
|
// let _latlog= {
|
|
|
|
|
// longitude:that.form.longitude,
|
|
|
|
|
// latitude: that.form.latitude,
|
|
|
|
|
// }
|
|
|
|
|
var _latlog = that.gcoord.transformFromWGSToGCJ(parseFloat(that.form.latitude), parseFloat(that.form.longitude));
|
|
|
|
|
uni.chooseLocation({
|
|
|
|
|
longitude: _latlog.longitude,
|
|
|
|
|
@ -463,21 +559,21 @@ var _default = {
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
loadDetail: function loadDetail() {
|
|
|
|
|
var _this = this;
|
|
|
|
|
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
|
|
|
var _this2 = this;
|
|
|
|
|
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
|
|
|
var that;
|
|
|
|
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
|
|
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
|
|
|
while (1) {
|
|
|
|
|
switch (_context.prev = _context.next) {
|
|
|
|
|
switch (_context2.prev = _context2.next) {
|
|
|
|
|
case 0:
|
|
|
|
|
that = _this;
|
|
|
|
|
_this.util.request({
|
|
|
|
|
that = _this2;
|
|
|
|
|
_this2.util.request({
|
|
|
|
|
api: '/api/admin/base-form/show',
|
|
|
|
|
method: "get",
|
|
|
|
|
data: {
|
|
|
|
|
id: _this.select.id,
|
|
|
|
|
table_name: _this.select.tableName,
|
|
|
|
|
show_relation: _this.select.show_relation
|
|
|
|
|
id: _this2.select.id,
|
|
|
|
|
table_name: _this2.select.tableName,
|
|
|
|
|
show_relation: _this2.select.show_relation
|
|
|
|
|
},
|
|
|
|
|
utilSuccess: function utilSuccess(res) {
|
|
|
|
|
that.form = res;
|
|
|
|
|
@ -493,23 +589,23 @@ var _default = {
|
|
|
|
|
});
|
|
|
|
|
case 2:
|
|
|
|
|
case "end":
|
|
|
|
|
return _context.stop();
|
|
|
|
|
return _context2.stop();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}, _callee);
|
|
|
|
|
}, _callee2);
|
|
|
|
|
}))();
|
|
|
|
|
},
|
|
|
|
|
submit: function submit() {
|
|
|
|
|
var _this2 = this;
|
|
|
|
|
var _this3 = this;
|
|
|
|
|
this.form.checkstatus = '待审核';
|
|
|
|
|
this.form.id = '';
|
|
|
|
|
this.$refs['form'].validate().then(function (res) {
|
|
|
|
|
_this2.util.request({
|
|
|
|
|
_this3.util.request({
|
|
|
|
|
api: '/api/admin/base-form/save',
|
|
|
|
|
method: "post",
|
|
|
|
|
data: _objectSpread({
|
|
|
|
|
table_name: _this2.select.submitName
|
|
|
|
|
}, _this2.form),
|
|
|
|
|
table_name: _this3.select.submitName
|
|
|
|
|
}, _this3.form),
|
|
|
|
|
utilSuccess: function utilSuccess(res) {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: "提交成功",
|
|
|
|
|
|