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

2 lines
1.4 KiB
JavaScript
Raw Normal View History

2024-09-19 07:20:14 +08:00
"use strict";var e=Object.defineProperty,t=Object.defineProperties,r=Object.getOwnPropertyDescriptors,s=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,n=(t,r,s)=>r in t?e(t,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[r]=s;const a=require("../common/vendor.js"),p=require("../sheep/index.js");exports.baseUrl="http://47.99.70.12:28184/api",exports.imgUrl=(e,t)=>{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://47.99.70.12:28184/api"+e)},exports.scanCodeAsync=()=>new Promise(((e,t)=>{a.index.scanCode({onlyFromCamera:!0,success:t=>{e(t)},fail:e=>{t(e)}})})),exports.showModalAsync=e=>new Promise(((p,c)=>{var l;a.index.showModal((l=((e,t)=>{for(var r in t||(t={}))i.call(t,r)&&n(e,r,t[r]);if(s)for(var r of s(t))o.call(t,r)&&n(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("/"===e)return void a.index.switchTab({url:"/pages/index/index"});if(!e)return void a.index.switchTab({url:"/pages/index/index"});if(e.startsWith("http://")||e.startsWith("https://"))return;-1!==e.includes("/pages/mall")?p.sheep.$router.go(e):a.index.navigateTo({url:e})},exports.toast=e=>{a.index.showToast({title:e,icon:"none"})};