2024-09-19 07:20:14 +08:00
|
|
|
"use strict";
|
|
|
|
var __defProp = Object.defineProperty;
|
|
|
|
var __defProps = Object.defineProperties;
|
|
|
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
|
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
|
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
|
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
|
|
var __spreadValues = (a, b) => {
|
|
|
|
for (var prop in b || (b = {}))
|
|
|
|
if (__hasOwnProp.call(b, prop))
|
|
|
|
__defNormalProp(a, prop, b[prop]);
|
|
|
|
if (__getOwnPropSymbols)
|
|
|
|
for (var prop of __getOwnPropSymbols(b)) {
|
|
|
|
if (__propIsEnum.call(b, prop))
|
|
|
|
__defNormalProp(a, prop, b[prop]);
|
|
|
|
}
|
|
|
|
return a;
|
|
|
|
};
|
|
|
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
|
const common_vendor = require("../common/vendor.js");
|
2024-10-01 09:15:35 +08:00
|
|
|
const baseUrl = "http://47.99.70.12:48080/app-api";
|
|
|
|
const uploadUrl = "http://47.99.70.12:48080/app-api";
|
2024-09-19 07:20:14 +08:00
|
|
|
const ossUrl = "http://116.204.119.171:9000/linghe";
|
|
|
|
const toast = (message) => {
|
|
|
|
common_vendor.index.showToast({ title: message, icon: "none" });
|
|
|
|
};
|
2024-10-01 09:15:35 +08:00
|
|
|
const imgUrl = (img, isOss, mode) => {
|
|
|
|
if (mode === "local")
|
|
|
|
return img;
|
2024-09-19 07:20:14 +08:00
|
|
|
const placeholder = "https://via.placeholder.com/150";
|
|
|
|
const isLocation = img.startsWith("@/");
|
|
|
|
if (isLocation)
|
|
|
|
return img.replace("@", ossUrl);
|
|
|
|
if (!img)
|
|
|
|
return placeholder;
|
|
|
|
const isNetworkImage = img.startsWith("http://") || img.startsWith("https://");
|
|
|
|
return isNetworkImage ? img : `${uploadUrl + img}`;
|
|
|
|
};
|
|
|
|
const showModalAsync = (options) => {
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
common_vendor.index.showModal(__spreadProps(__spreadValues({}, options), {
|
|
|
|
success: (res) => {
|
|
|
|
if (res.confirm) {
|
|
|
|
resolve(res);
|
|
|
|
} else if (res.cancel) {
|
|
|
|
resolve(res);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
fail: (err) => {
|
|
|
|
reject(err);
|
|
|
|
}
|
|
|
|
}));
|
|
|
|
});
|
|
|
|
};
|
|
|
|
const scanCodeAsync = () => {
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
common_vendor.index.scanCode({
|
|
|
|
onlyFromCamera: true,
|
|
|
|
// 是否只能从相机扫码
|
|
|
|
success: (res) => {
|
|
|
|
resolve(res);
|
|
|
|
},
|
|
|
|
fail: (err) => {
|
|
|
|
reject(err);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
const toPath = (path) => {
|
2024-10-01 09:15:35 +08:00
|
|
|
if (path == -1) {
|
|
|
|
common_vendor.index.navigateBack();
|
|
|
|
}
|
2024-09-19 07:20:14 +08:00
|
|
|
if (path === "/") {
|
|
|
|
common_vendor.index.switchTab({ url: "/pages/index/index" });
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (!path) {
|
|
|
|
common_vendor.index.switchTab({ url: "/pages/index/index" });
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
const isWebUrl = path.startsWith("http://") || path.startsWith("https://");
|
|
|
|
if (isWebUrl) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
const isMallPath = path.includes("/pages/mall") !== -1;
|
|
|
|
if (isMallPath) {
|
2024-10-01 09:15:35 +08:00
|
|
|
common_vendor.index.navigateTo({ url: path });
|
2024-09-19 07:20:14 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
common_vendor.index.navigateTo({ url: path });
|
|
|
|
};
|
2024-10-01 09:15:35 +08:00
|
|
|
const isCancelOrder = (state) => {
|
|
|
|
return state === "待支付" || state === "已支付";
|
|
|
|
};
|
|
|
|
const isTakeCancelOrder = (state) => {
|
|
|
|
return state === "待接单";
|
|
|
|
};
|
2024-09-19 07:20:14 +08:00
|
|
|
exports.baseUrl = baseUrl;
|
|
|
|
exports.imgUrl = imgUrl;
|
2024-10-01 09:15:35 +08:00
|
|
|
exports.isCancelOrder = isCancelOrder;
|
|
|
|
exports.isTakeCancelOrder = isTakeCancelOrder;
|
2024-09-19 07:20:14 +08:00
|
|
|
exports.scanCodeAsync = scanCodeAsync;
|
|
|
|
exports.showModalAsync = showModalAsync;
|
|
|
|
exports.toPath = toPath;
|
|
|
|
exports.toast = toast;
|