"use strict";const e=require("../../common/vendor.js"),l=require("../../common/libraries/watermark.js"),o=require("../../common/libraries/upload.js");if(require("../../gen/Apis.js"),require("../../common/libraries/request.js"),require("../../common/store/useWeAppAuthStore.js"),require("../../common/libraries/apiLoading.js"),require("../../common/store/useWatermarkStore.js"),require("../../common/store/useWorkStore.js"),!Array){(e.resolveComponent("up-icon")+e.resolveComponent("uni-icons"))()}Math||((()=>"../../node-modules/uview-plus/components/u-icon/u-icon.js")+(()=>"../../uni_modules/uni-icons/components/uni-icons/uni-icons.js"))();const i=e.defineComponent({__name:"hs-upload",props:["valueModel","size","display","length","borderTop","mediaType","labelTitle","count","styles","hasCover","iconName","iconSize","required","title"],emits:["update:valueModel"],setup(i,{emit:n}){const u=i,a=e.ref([]),r=async()=>{const e=await o.upload(u.count||1,null==u?void 0:u.size,(null==u?void 0:u.mediaType)||["image"]);console.log(e,"res"),a.value=[...a.value,...e],n("update:valueModel",a.value)},s=e=>{if(null==u?void 0:u.display)return!1;a.value.splice(e,1)};e.watch(()=>null==u?void 0:u.valueModel,()=>{u.valueModel&&(a.value=u.valueModel||[])});return e.onMounted(()=>{u.valueModel&&(a.value=u.valueModel||[])}),(o,i)=>{var n,d,t,v;return e.e({a:e.t((null==u?void 0:u.title)||"上传"),b:null==u?void 0:u.required},(null==u||u.required,{}),{c:e.t((null==u?void 0:u.count)||1),d:e.f(a.value,(o,i,n)=>{var a,r;return e.e({a:null==(a=null==o?void 0:o.type)?void 0:a.includes("video")},(null==(r=null==o?void 0:o.type)?void 0:r.includes("video"))?{b:"f651c7a0-0-"+n,c:e.p({name:"play-circle-fill",size:"30"})}:{d:null==o?void 0:o.url,e:e.o(i=>{return n=null==o?void 0:o.url,console.log(n,"url1"),void(n&&(e.index.showLoading({title:"获取图片中...",mask:!0}),console.log(n,"url2"),e.index.downloadFile({url:n,success:e=>{const o=e.tempFilePath;console.log(o,"imagePath"),l.watermark.addWatermark(o,"仅用于内部查看，请勿外传")},fail:l=>{e.index.showToast({title:"获取失败",duration:1e3}),console.error("下载图片失败:",l)}})));var n},i)},{f:"f651c7a0-1-"+n,g:e.o(e=>s(i),i),h:0===i&&(null==u?void 0:u.hasCover)},0===i&&(null==u?void 0:u.hasCover)?{i:e.o(e=>s(i),i)}:{},{j:i})}),e:e.p({type:"clear",color:"#f00",size:"25"}),f:e.s(null==u?void 0:u.styles),g:!(null==u?void 0:u.display)&&(null==(n=a.value)?void 0:n.length)<((null==u?void 0:u.count)||1)},!(null==u?void 0:u.display)&&(null==(d=a.value)?void 0:d.length)<((null==u?void 0:u.count)||1)?e.e({h:null==u?void 0:u.iconName},(null==u?void 0:u.iconName)?{i:e.p({name:null==u?void 0:u.iconName,label:u.labelTitle||"",color:"#333",size:(null==u?void 0:u.iconSize)||50})}:{j:e.p({name:(null==u?void 0:u.iconName)||"plus",label:u.labelTitle||"",labelPos:"bottom",labelSize:"20rpx",lableColor:"#666",color:"#333",size:"20",space:"6px"})},{k:e.o(r),l:e.s(null==u?void 0:u.styles)}):{},{m:(null==u?void 0:u.display)&&!(null==(t=a.value)?void 0:t.length)},((null==u?void 0:u.display)&&(null==(v=a.value)||v.length),{}),{n:u.borderTop?"1rpx solid #eee":""})}}}),n=e._export_sfc(i,[["__scopeId","data-v-f651c7a0"]]);wx.createComponent(n);
