"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"); const baseUrl = "http://47.99.70.12:48080/app-api"; const uploadUrl = "http://47.99.70.12:48080/app-api"; const ossUrl = "http://116.204.119.171:9000/linghe"; const toast = (message) => { common_vendor.index.showToast({ title: message, icon: "none" }); }; const imgUrl = (img, isOss, mode) => { if (mode === "local") return img; 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) => { if (path == -1) { common_vendor.index.navigateBack(); } 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) { common_vendor.index.navigateTo({ url: path }); return; } common_vendor.index.navigateTo({ url: path }); }; const isCancelOrder = (state) => { return state === "待支付" || state === "已支付"; }; const isTakeCancelOrder = (state) => { return state === "待接单"; }; exports.baseUrl = baseUrl; exports.imgUrl = imgUrl; exports.isCancelOrder = isCancelOrder; exports.isTakeCancelOrder = isTakeCancelOrder; exports.scanCodeAsync = scanCodeAsync; exports.showModalAsync = showModalAsync; exports.toPath = toPath; exports.toast = toast;