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