|
|
|
@ -15,7 +15,7 @@ class Anticorrosive { |
|
|
|
|
this.configure = configure; |
|
|
|
|
return this.chenk(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 递归 生成数据结构
|
|
|
|
|
generate(data, configure) { |
|
|
|
|
// 通过传入的源数据生成相应的数据结构
|
|
|
|
@ -101,19 +101,19 @@ 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'), |
|
|
|
|
unionId: uni.getStorageSync('unionid'), |
|
|
|
|
openId: uni.getStorageSync('openid'), |
|
|
|
|
appId: 'wxed3e2914d6aa4d52' |
|
|
|
|
};
|
|
|
|
|
oilIdentityApi.ackPhone(data1).then(resj => {
|
|
|
|
|
}; |
|
|
|
|
oilIdentityApi.ackPhone(data1).then(resj => { |
|
|
|
|
re(resj.data) |
|
|
|
|
}); |
|
|
|
|
})
|
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
async WXlogin(e) { |
|
|
|
|
return new Promise((re, rj) => { |
|
|
|
@ -141,16 +141,16 @@ export default { |
|
|
|
|
title: '微信登录失败提醒', |
|
|
|
|
content: `${res.msg}如有疑问,请联系客服处理` |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
}).catch(err => { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: '登陆失败', |
|
|
|
|
icon: 'none' |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
fail: err => {}, |
|
|
|
|
}) |
|
|
|
@ -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,41 +247,41 @@ 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){ |
|
|
|
|
re(addressRes) |
|
|
|
|
success(addressRes) { |
|
|
|
|
re(addressRes) |
|
|
|
|
}, |
|
|
|
|
fail(err){ |
|
|
|
|
fail(err) { |
|
|
|
|
rj(err) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
getLocation() { |
|
|
|
|
return new Promise((re, rj) => { |
|
|
|
@ -296,16 +297,16 @@ export default { |
|
|
|
|
latitude: res.latitude, |
|
|
|
|
longitude: res.longitude |
|
|
|
|
}, |
|
|
|
|
success(addressRes){ |
|
|
|
|
var address = addressRes.result.formatted_addresses.recommend; |
|
|
|
|
let location = { |
|
|
|
|
...res, |
|
|
|
|
address |
|
|
|
|
} |
|
|
|
|
uni.setStorageSync('location',location ); |
|
|
|
|
re(location) |
|
|
|
|
success(addressRes) { |
|
|
|
|
var address = addressRes.result.formatted_addresses.recommend; |
|
|
|
|
let location = { |
|
|
|
|
...res, |
|
|
|
|
address |
|
|
|
|
} |
|
|
|
|
uni.setStorageSync('location', location); |
|
|
|
|
re(location) |
|
|
|
|
}, |
|
|
|
|
fail(err){ |
|
|
|
|
fail(err) { |
|
|
|
|
rj(err) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
@ -318,33 +319,33 @@ 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){ |
|
|
|
|
let splitParameter = parameter.split('?'); |
|
|
|
|
if (splitParameter.length <= 1) { |
|
|
|
|
console.warn("暂无路径参数"); |
|
|
|
|
return |
|
|
|
|
}
|
|
|
|
|
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) |
|
|
|
|
} |
|
|
|
|
splitParameter[1].split('&').forEach(item => { |
|
|
|
|
if (item.indexOf('=') !== -1) { |
|
|
|
|
let splitItem = item.split('=') |
|
|
|
|
obj[splitItem[0]] = splitItem[1] |
|
|
|
|
} else { |
|
|
|
|
console.warn("routingParameterGeneration error", item); |
|
|
|
|
// console.log(item)
|
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
return obj |
|
|
|
|
}else if(parameterType == 'object'){ |
|
|
|
|
let stringParameter = '?'
|
|
|
|
|
return obj |
|
|
|
|
} 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 |
|
|
|
|
})
|
|
|
|
|
}) |
|
|
|
|
return stringParameter |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
@ -359,7 +360,7 @@ export default { |
|
|
|
|
rj(err) |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
})
|
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
loginOut() { |
|
|
|
|
return new Promise((re, rj) => { |
|
|
|
@ -523,7 +524,7 @@ export default { |
|
|
|
|
getnum(num, size = 2) { |
|
|
|
|
if (String(num).indexOf('.') == -1 || String(num).split('.')[1].length < 2) return Number(num).toFixed(size); |
|
|
|
|
var s = num.toString(); |
|
|
|
|
var result = s.substring(0, s.indexOf(".") + 1 + size);
|
|
|
|
|
var result = s.substring(0, s.indexOf(".") + 1 + size); |
|
|
|
|
return result |
|
|
|
|
}, |
|
|
|
|
//数据转为两位小数
|
|
|
|
|