代码合并

This commit is contained in:
dzl 2025-05-23 17:57:08 +08:00
parent 899a6cdd2b
commit 28a371ddc2

View File

@ -1,6 +1,7 @@
import config from "./config.js";
import {
showModelMessage
showModelMessage,
jkcBaseDecode
} from "./tools.js";
import {
callOrdereApi
@ -8,7 +9,12 @@ import {
const imgPath = config.imgPath;
export const sdkKey = 'BECBZ-EJIEQ-LUU5N-B5ISQ-3TLMZ-BXFLG';
export const sdkKey = '1f8f159583f28dfba6eb06deb55e3b56';
export function getMap(mapid, instance) {
return uni.createMapContext(mapid, {
this: instance.proxy
});
}
//获取当前定位
export function getLoalcation(success, fail) {
@ -32,15 +38,33 @@ export function getLoalcation(success, fail) {
}
//逆解析地址
export function reverseGeocoder(qqmapsdk, longitude, latitude, success, fail) {
qqmapsdk.reverseGeocoder({
location: {
latitude: latitude,
longitude: longitude
},
success: (res) => {
if (success) success(res.result);
},
export function reverseGeocoder(mapsdk, longitude, latitude, success, fail) {
mapsdk.getRegeo({
location: `${longitude},${latitude}`,
success: (res) => {
const {
name,
regeocodeData
} = res[0];
const {
addressComponent: {
adcode,
province,
city,
district
},
formatted_address
} = regeocodeData;
if (success) success({
name,
formatted_address,
adcode,
province,
city,
district
});
},
fail: (res) => {
if (fail) success(fail);
}
@ -72,8 +96,8 @@ export function addLine(scolor, arrPoints) {
}
//创建订单
export function addOrder(bikeCode, callback) {
const oUser = uni.getStorageSync("wechat_user");
export function addOrder(bikeCode, callback) {
const oUser = JSON.parse(jkcBaseDecode(uni.getStorageSync("wechat_user")));
if (!oUser) {
uni.navigateTo({
url: "/pages/user/login/wx_login"
@ -95,22 +119,32 @@ function saveRide(params, icnt, callback) {
code,
message
} = res;
console.log("33333333333333333333333","userOrders/saveRide",res);
if (code != 200) {
if (icnt <= 3) {
saveRide(params, icnt + 1, callback);
return;
}
showModelMessage(message);
if(callback) callback(false);
if (callback) callback(false);
return;
}
if(callback)callback(true);
if (callback) callback(true);
setTimeout(() => {
uni.switchTab({
uni.navigateTo({
url: "/pages/user/home/home"
})
}, 1000)
})
}
//添加面
export function addPolygon(scolor, fcolor, arrPoints) {
return {
points: arrPoints,
fillColor: fcolor,
strokeWidth: 3,
strokeColor: scolor,
zIndex: 11
}
}