test_lgq/niucloud/public/wap/assets/app-pages-member-personal.5a06db94.js

2 lines
30 KiB
JavaScript
Raw Normal View History

2024-01-24 17:36:08 +08:00
import{aM as e,aN as t,aO as a,U as i,V as n,W as r,A as s,p as l,q as o,h as u,i as c,w as d,j as m,E as h,F as f,G as p,n as y,J as g,K as _,l as v,I as x,S as $,H as b,L as k,M as C,t as w,aP as I,aQ as S,d as D,X as M,c as T,a as O,r as H,m as P,a9 as j,Y as V,aR as F,aS as B,an as z,x as N,aT as A}from"./index-849cf30e.js";import{_ as L}from"./u-avatar.2111318d.js";import{_ as R}from"./u-icon.e3aa4770.js";import{_ as Y}from"./u-loading-icon.d012ecbf.js";import{_ as U}from"./_plugin-vue_export-helper.1b428a4d.js";import{_ as W,a as Z,b as J}from"./u-action-sheet.27d0ae04.js";import{_ as E}from"./u-button.9fa3f2a0.js";import{_ as q}from"./app-link.vue_vue_type_script_setup_true_lang.d62f9cf3.js";import{_ as Q}from"./u-modal.081e9589.js";import{_ as X}from"./u-popup.e01742d2.js";import"./u-line.19eb5c40.js";import"./u-transition.75065529.js";import"./u-safe-bottom.2f6af56c.js";function G(e,t){return["[object Object]","[object File]"].includes(Object.prototype.toString.call(e))?Object.keys(e).reduce(((a,i)=>(t.includes(i)||(a[i]=e[i]),a)),{}):{}}function K(e){return e.tempFiles.map((e=>({...G(e,["path"]),url:e.path,size:e.size,name:e.name,type:e.type})))}function ee({accept:i,multiple:n,capture:r,compressed:s,maxDuration:l,sizeType:o,camera:u,maxCount:c}){return new Promise(((d,m)=>{switch(i){case"image":a({count:n?Math.min(c,9):1,sourceType:r,sizeType:o,success:e=>d(function(e){return e.tempFiles.map((e=>({...G(e,["path"]),type:"image",url:e.path,thumb:e.path,size:e.size,name:e.name})))}(e)),fail:m});break;case"video":t({sourceType:r,compressed:s,maxDuration:l,camera:u,success:e=>d(function(e){return[{...G(e,["tempFilePath","thumbTempFilePath","errMsg"]),type:"video",url:e.tempFilePath,thumb:e.thumbTempFilePath,size:e.size,name:e.name}]}(e)),fail:m});break;case"file":e({count:n?c:1,type:i,success:e=>d(K(e)),fail:m});break;default:e({count:n?c:1,type:"all",success:e=>d(K(e)),fail:m})}}))}const te=U({name:"u-upload",mixins:[n,r,{watch:{accept:{immediate:!0,handler(e){"all"!==e&&"media"!==e||uni.$u.error("只有微信小程序才支持把accept配置为all、media之一")}}}},{props:{accept:{type:String,default:i.upload.accept},capture:{type:[String,Array],default:i.upload.capture},compressed:{type:Boolean,default:i.upload.compressed},camera:{type:String,default:i.upload.camera},maxDuration:{type:Number,default:i.upload.maxDuration},uploadIcon:{type:String,default:i.upload.uploadIcon},uploadIconColor:{type:String,default:i.upload.uploadIconColor},useBeforeRead:{type:Boolean,default:i.upload.useBeforeRead},afterRead:{type:Function,default:null},beforeRead:{type:Function,default:null},previewFullImage:{type:Boolean,default:i.upload.previewFullImage},maxCount:{type:[String,Number],default:i.upload.maxCount},disabled:{type:Boolean,default:i.upload.disabled},imageMode:{type:String,default:i.upload.imageMode},name:{type:String,default:i.upload.name},sizeType:{type:Array,default:i.upload.sizeType},multiple:{type:Boolean,default:i.upload.multiple},deletable:{type:Boolean,default:i.upload.deletable},maxSize:{type:[String,Number],default:i.upload.maxSize},fileList:{type:Array,default:i.upload.fileList},uploadText:{type:String,default:i.upload.uploadText},width:{type:[String,Number],default:i.upload.width},height:{type:[String,Number],default:i.upload.height},previewImage:{type:Boolean,default:i.upload.previewImage}}}],data:()=>({lists:[],isInCount:!0}),watch:{fileList:{handler(){this.formatFileList()},immediate:!0,deep:!0}},emits:["error","beforeRead","oversize","afterRead","delete","clickPreview"],methods:{formatFileList(){const{fileList:e=[],maxCount:t}=this,a=e.map((e=>Object.assign(Object.assign({},e),{isImage:"image"===this.accept||uni.$u.test.image(e.url||e.thumb),isVideo:"video"===this.accept||uni.$u.test.video(e.url||e.thumb),deletable:"boolean"==typeof e.deletable?e.deletable:this.deletable})));this.lists=a,this.isInCount=a.length<t},chooseFile(){const{maxCount:e,multiple:t,lists:a,disabled:i}=this;if(i)return;let n;try{n=uni.$u.test.array(this.capture)?this.capture:this.capture.split(",")}catch(r){n=[]}ee(Object.assign({