2 lines
855 B
JavaScript
2 lines
855 B
JavaScript
"use strict";var e=(e,t,o)=>new Promise(((n,r)=>{var s=e=>{try{a(o.next(e))}catch(t){r(t)}},i=e=>{try{a(o.throw(e))}catch(t){r(t)}},a=e=>e.done?n(e.value):Promise.resolve(e.value).then(s,i);a((o=o.apply(e,t)).next())}));const t=require("../common/vendor.js"),o=require("../utils/http.js"),n=n=>e(exports,null,(function*(){try{const e=yield o.httpUploadFile("/file/upload",n);return e&&e.data&&e.data.url?e.data.url:(t.index.showToast({title:"图片上传失败",icon:"none"}),"")}catch(e){return t.index.showToast({title:"图片上传失败",icon:"none"}),""}}));exports.chooseImage=()=>new Promise(((o,r)=>{t.index.chooseImage({count:1,success:t=>e(exports,null,(function*(){try{const e=t.tempFilePaths[0],r=yield n(e);o(r)}catch(e){r(e)}})),fail:()=>{t.index.showToast({title:"图片选择失败",icon:"none"}),r(new Error("图片选择失败"))}})}));
|