|
|
|
@ -101,8 +101,8 @@ class Anticorrosive { |
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
|
Anticorrosive, |
|
|
|
|
getPhone(e){ |
|
|
|
|
return new Promise((re,rj)=>{ |
|
|
|
|
getPhone(e) { |
|
|
|
|
return new Promise((re, rj) => { |
|
|
|
|
const data1 = { |
|
|
|
|
...e.detail, |
|
|
|
|
sessionKey: uni.getStorageSync('sessionKey'), |
|
|
|
@ -216,11 +216,12 @@ export default { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
userLocationChenk(){ |
|
|
|
|
return new Promise((re,rj)=>{ |
|
|
|
|
userLocationChenk() { |
|
|
|
|
return new Promise((re, rj) => { |
|
|
|
|
wx.getSetting({ |
|
|
|
|
success(res) { |
|
|
|
|
if (typeof(res.authSetting['scope.userLocation']) != 'undefined' && !res.authSetting[ |
|
|
|
|
if (typeof(res.authSetting['scope.userLocation']) != 'undefined' && !res |
|
|
|
|
.authSetting[ |
|
|
|
|
'scope.userLocation']) { |
|
|
|
|
// 用户没有授权
|
|
|
|
|
uni.showModal({ |
|
|
|
@ -246,35 +247,35 @@ export default { |
|
|
|
|
rj('openSetting调用失败') |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}else{ |
|
|
|
|
} else { |
|
|
|
|
rj('取消授权') |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}else{ |
|
|
|
|
} else { |
|
|
|
|
re() |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
fail(err){ |
|
|
|
|
fail(err) { |
|
|
|
|
rj(err) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
ReverseAddress(latitude,longitude){ |
|
|
|
|
ReverseAddress(latitude, longitude) { |
|
|
|
|
const qqmapsdk = new QQMapWX({ |
|
|
|
|
key: 'NYEBZ-YURY3-XTU3N-YBR54-PKW6E-ROB2F' |
|
|
|
|
}); |
|
|
|
|
return new Promise((re,rj)=>{ |
|
|
|
|
return new Promise((re, rj) => { |
|
|
|
|
qqmapsdk.reverseGeocoder({ |
|
|
|
|
location: { |
|
|
|
|
latitude:latitude, |
|
|
|
|
latitude: latitude, |
|
|
|
|
longitude: longitude |
|
|
|
|
}, |
|
|
|
|
success(addressRes){ |
|
|
|
|
success(addressRes) { |
|
|
|
|
re(addressRes) |
|
|
|
|
}, |
|
|
|
|
fail(err){ |
|
|
|
|
fail(err) { |
|
|
|
|
rj(err) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
@ -296,16 +297,16 @@ export default { |
|
|
|
|
latitude: res.latitude, |
|
|
|
|
longitude: res.longitude |
|
|
|
|
}, |
|
|
|
|
success(addressRes){ |
|
|
|
|
success(addressRes) { |
|
|
|
|
var address = addressRes.result.formatted_addresses.recommend; |
|
|
|
|
let location = { |
|
|
|
|
...res, |
|
|
|
|
address |
|
|
|
|
} |
|
|
|
|
uni.setStorageSync('location',location ); |
|
|
|
|
uni.setStorageSync('location', location); |
|
|
|
|
re(location) |
|
|
|
|
}, |
|
|
|
|
fail(err){ |
|
|
|
|
fail(err) { |
|
|
|
|
rj(err) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
@ -318,30 +319,30 @@ export default { |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
routingParameterGeneration(parameter){ |
|
|
|
|
if(parameter==null||parameter==undefined) return; |
|
|
|
|
routingParameterGeneration(parameter) { |
|
|
|
|
if (parameter == null || parameter == undefined) return; |
|
|
|
|
const parameterType = typeof parameter; |
|
|
|
|
if( parameterType== 'string'){ |
|
|
|
|
if (parameterType == 'string') { |
|
|
|
|
let obj = {}; |
|
|
|
|
let splitParameter = parameter.split('?'); |
|
|
|
|
if(splitParameter.length<=1){ |
|
|
|
|
if (splitParameter.length <= 1) { |
|
|
|
|
console.warn("暂无路径参数"); |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
splitParameter[1].split('&').forEach(item=>{ |
|
|
|
|
if(item.indexOf('=')!==-1){ |
|
|
|
|
splitParameter[1].split('&').forEach(item => { |
|
|
|
|
if (item.indexOf('=') !== -1) { |
|
|
|
|
let splitItem = item.split('=') |
|
|
|
|
obj[splitItem[0]] = splitItem[1] |
|
|
|
|
}else{ |
|
|
|
|
console.warn("error"); |
|
|
|
|
console.log(item) |
|
|
|
|
} else { |
|
|
|
|
console.warn("routingParameterGeneration error", item); |
|
|
|
|
// console.log(item)
|
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
return obj |
|
|
|
|
}else if(parameterType == 'object'){ |
|
|
|
|
} else if (parameterType == 'object') { |
|
|
|
|
let stringParameter = '?' |
|
|
|
|
let parameterEntries = Object.entries(parameter); |
|
|
|
|
parameterEntries.forEach((key,index)=>{ |
|
|
|
|
parameterEntries.forEach((key, index) => { |
|
|
|
|
let itemString = `${key[0]}=${key[1]}${ parameterEntries.length-1==index?'':'&' }`; |
|
|
|
|
stringParameter += itemString |
|
|
|
|
}) |
|
|
|
|