You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
yanzong/public/assets/Comment.4c49b5d2.js

2 lines
8.6 KiB

11 months ago
import{x as e,o as a,c as t,w as l,a as s,e as o,f as n,g as i,i as r,ab as d,B as c,ac as u,K as p,ad as m,t as h,j as f,k as _,r as g,b as C,d as y,F as v,P as w,N as k,O as b}from"./index-ae8bbb19.js";import{_ as P}from"./u-popup.d74d5514.js";import{r as x}from"./uni-app.es.ee1d5b08.js";import{_ as I}from"./_plugin-vue_export-helper.1b428a4d.js";import{a as S,_ as V}from"./comment.92b0fbb1.js";import{A as L}from"./index.0c0be40a.js";const A=I({name:"ShareSheet",components:{GoodsPosterPopup:I({name:"goods-poster-popup",emits:["update:modelValue"],props:{modelValue:{Type:Boolean,default:!1},apiCall:{type:Function,default:()=>{}},apiParam:{type:Object,default:()=>{}}},watch:{modelValue:{immediate:!0,handler(e){e?this.onShowPopup():this.show=!1}}},data:()=>({show:!1,imageUrl:""}),methods:{onShowPopup(){const e=this;e.apiCall({...e.apiParam,channel:e.platform}).then((a=>{e.imageUrl=a.data.imageUrl,e.show=!0})).catch((a=>e.onClose()))},onClose(){this.$emit("update:modelValue",!1)},handlePreviewImage(){uni.previewImage({urls:[this.imageUrl]})},handleDownload(){const e=this;uni.showLoading({title:"加载中"}),uni.downloadFile({url:e.imageUrl,success(a){console.log(a),uni.hideLoading(),e.onSaveImage(a.tempFilePath)},fail(a){console.log("fail",a),uni.hideLoading(),e.$toast("很抱歉,自动保存失败 请点击图片后长按手动保存",3e3)}})},onSaveImage(e){const a=e.split("/"),t=a[a.length-1];this.fileDownLoadForH5({name:t,blob:e}),this.onClose()},fileDownLoadForH5({name:e,blob:a}){const t=document.createElement("a");t.setAttribute("href",a),t.setAttribute("downLoad",e),t.click()}}},[["render",function(d,c,u,p,m,h){const f=i,_=r,g=x(e("u-popup"),P);return a(),t(g,{modelValue:m.show,"onUpdate:modelValue":c[2]||(c[2]=e=>m.show=e),mode:"center",maskCloseAble:!1,closeable:!0,maskCustomStyle:{background:"rgba(0, 0, 0, 0.5)"},"border-radius":"18","z-index":12,onClose:c[3]||(c[3]=e=>h.onClose())},{default:l((()=>[s(_,{class:"pop-poster pop-example__container"},{default:l((()=>[s(_,{class:"image__container",onClick:c[0]||(c[0]=e=>h.handlePreviewImage())},{default:l((()=>[m.imageUrl?(a(),t(f,{key:0,class:"image",mode:"scaleToFill",src:m.imageUrl},null,8,["src"])):o("",!0)])),_:1}),s(_,{class:"save-btn__container"},{default:l((()=>[s(_,{class:"save-btn",onClick:c[1]||(c[1]=e=>h.handleDownload())},{default:l((()=>[n("保存海报图")])),_:1})])),_:1})])),_:1})])),_:1},8,["modelValue","maskCustomStyle"])}],["__scopeId","data-v-434e9104"]])},emits:["update:modelValue"],props:{modelValue:{Type:Boolean,default:!1},cancelWithMask:{type:Boolean,default:!0},shareTitle:{type:String,default:"商品分享"},shareImageUrl:{type:String,default:""},cancelText:{type:String,default:"关闭"},posterApiCall:{type:Function,default:()=>{}},posterApiParam:{type:Object,default:()=>{}}},data:()=>({enabledAppShareWeixin:d.get("enabledAppShareWeixin"),showGoodsPosterPopup:!1}),created(){this.initSharesheet()},methods:{initSharesheet(){const e=this;uni.getProvider({service:"share",success({provider:a}){c("weixin",a)||(e.enabledAppShareWeixin=!1)}})},onMaskClick(){this.cancelWithMask&&this.handleCancel()},getShareUrl(){const{path:e,query:a}=u();return new Promise(((t,l)=>{p.h5Url().then((l=>{const s=m(l,e,a);t(s)}))}))},handleCopyLink(){const e=this;e.getShareUrl().then((a=>{uni.setClipboardData({data:a,success:()=>e.$toast("链接复制成功,快去发送给朋友吧~"),fail:a=>e.$toast("很遗憾,复制失败"),complete:()=>e.handleCancel()})}))},handleCancel(){this.$emit("update:modelValue",!1)},handlePoster(){this.showGoodsPosterPopup=!0,this.handleCancel()}}},[["render",function(e,i,d,c,u,p){const m=r,C=_,y=g("goods-poster-popup");return a(),t(m,{class:f(["sharesheet",{show:d.modelValue}])},{default:l((()=>[s(m,{class:"mask-class sharesheet__mask",onClick:p.onMaskClick},null,8,["onClick"]),s(m,{class:"sharesheet__container"},{default:l((()=>[s(m,{class:"sharesheet__list"},{default:l((()=>[s(m,{class:"share-item",onClick:i[0]||(i[0]=e=>p.handlePoster())},{default:l((()=>[s(m,{class:"item-image",style:{backgroundColor:"#38beec"}},{default:l((()=