"use strict";const common_vendor=require("../common/vendor.js");const api_api=require("../api/api.js");const lookImg=e=>{common_vendor.index.previewImage({urls:e})};const call=e=>common_vendor.index.makePhoneCall({phoneNumber:e});const copy=e=>common_vendor.index.setClipboardData({data:e,success:function(){console.log("success")}});const urlQuery=e=>{let search=e;search=search.split("?")[1];const pairs=search?search.split("&"):[];const query={};for(let i=0;i<pairs.length;++i){const[key,value]=pairs[i].split("=");query[key]=query[key]||decodeURIComponent(value)}return query};const uploadFiles=urls=>new Promise((async(resolve,reject)=>{let res=await api_api.getOssUploadParams();const fd={policy:res.policy,OSSAccessKeyId:res.accessId,success_action_status:200,signature:res.signature,key:res.dir+Date.now()+Math.floor(1e5+Math.random()*9e5)+"."+urls.substring(urls.lastIndexOf(".")+1)};common_vendor.index.uploadFile({url:res.host,filePath:urls,header:{"content-type":"multipart/form-data"},name:"file",formData:fd,success:_res=>{resolve(fd.key)},fail:err=>{console.log(err);reject(err)}});console.log()}));exports.call=call;exports.copy=copy;exports.lookImg=lookImg;exports.uploadFiles=uploadFiles;exports.urlQuery=urlQuery;
