acdr-ui/dist/build/mp-weixin/utils/commUtils.js

2 lines
1.5 KiB
JavaScript
Raw Normal View History

2024-10-01 09:15:35 +08:00
"use strict";var e=Object.defineProperty,t=Object.defineProperties,r=Object.getOwnPropertyDescriptors,s=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable,o=(t,r,s)=>r in t?e(t,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[r]=s;const n=require("../common/vendor.js");exports.baseUrl="http://116.204.119.171:48080/app-api",exports.imgUrl=(e,t,r)=>{if("local"===r)return e;if(e.startsWith("@/"))return e.replace("@","http://116.204.119.171:9000/linghe");if(!e)return"https://via.placeholder.com/150";return e.startsWith("http://")||e.startsWith("https://")?e:""+("http://116.204.119.171:48080/app-api"+e)},exports.isCancelOrder=e=>"待支付"===e||"已支付"===e,exports.isTakeCancelOrder=e=>"待接单"===e,exports.scanCodeAsync=()=>new Promise(((e,t)=>{n.index.scanCode({onlyFromCamera:!0,success:t=>{e(t)},fail:e=>{t(e)}})})),exports.showModalAsync=e=>new Promise(((p,c)=>{var l;n.index.showModal((l=((e,t)=>{for(var r in t||(t={}))i.call(t,r)&&o(e,r,t[r]);if(s)for(var r of s(t))a.call(t,r)&&o(e,r,t[r]);return e})({},e),t(l,r({success:e=>{(e.confirm||e.cancel)&&p(e)},fail:e=>{c(e)}}))))})),exports.toPath=e=>{if(-1==e&&n.index.navigateBack(),"/"===e)return void n.index.switchTab({url:"/pages/index/index"});if(!e)return void n.index.switchTab({url:"/pages/index/index"});if(e.startsWith("http://")||e.startsWith("https://"))return;e.includes("/pages/mall"),n.index.navigateTo({url:e})},exports.toast=e=>{n.index.showToast({title:e,icon:"none"})};