2 lines
11 KiB
JavaScript
2 lines
11 KiB
JavaScript
![]() |
import{T as e,a,b9 as t,G as s,H as o,o as l,j as i,w as n,h as u,Q as r,I as c,z as d,ac as v,ba as f,a2 as p,aX as m,aT as _,ae as y,bb as g,p as h,B as k,bc as w,O as x,M as b,x as I,W as T,X as j,u as S,i as C,f as P,l as D,e as F,k as G,F as A,A as B}from"./index-9bec188e.js";import{_ as R}from"./uv-icon.27c7246d.js";import{H as $}from"./index.bdca3eba.js";import{u as q}from"./useScroll.c0a86152.js";import{G as H}from"./Goods.7dc38957.js";import{I as O}from"./InviteFriends.f3f3747d.js";import{_ as W}from"./uv-overlay.6fe03ce8.js";import{u as E}from"./useImage.9f5391d3.js";import{_ as N}from"./_plugin-vue_export-helper.1b428a4d.js";import{S as z,u as M}from"./useShare.d249e156.js";import{a as U}from"./goods.a5bf24e1.js";import{g as X}from"./utils.3f9740a5.js";import{G as Y}from"./good-attr-select.96595f56.js";import{a as J}from"./product.0ff691f6.js";import{u as Q}from"./useInterface.982c71ba.js";import{e as V}from"./cart.a9ddf436.js";import"./uv-icon.vue_vue_type_style_index_0_scoped_23936b10_lang.7145f5b2.js";import"./index.2f3cf70a.js";import"./images.52fc6216.js";import"./Popup.08c50cc2.js";import"./uv-transition.b971e856.js";import"./createAnimation.e5fefaf6.js";import"./useShearPlate.19498da6.js";import"./uv-image.6bda10b1.js";import"./space.a9e7e18e.js";import"./uv-button.9242bdc2.js";import"./uv-loading-icon.bfbe6dc1.js";import"./uv-loading-icon.vue_vue_type_style_index_0_scoped_bad0efbf_lang.8998f762.js";import"./uv-button.vue_vue_type_style_index_0_scoped_bc0e850d_lang.79bfdc50.js";import"./index.9b540af7.js";const K=N({__name:"GroupBy",setup(x,{expose:b}){const I=e(),{getImageInfo:T,base64ToUrl:j,saveImageToPhotosAlbum:S}=E(),C=a(!1),P=a(void 0),D=a("");function F(){P.value=G.value=void 0,C.value=!1}b({open:async function(e,a){P.value=e,C.value=!0,v({title:"获取数据中..."}),D.value=await f({path:"pages/share/index",name:a.query}),await p((()=>{!function(){v({title:"海报生成中"});_().in(A).select("#goods-canvas").boundingClientRect().exec((async e=>{try{const{width:a,height:t}=e[0];!function(e={}){R.save();e={x:0,y:0,width:0,height:0,round:0,stroke:!1,strokeStyle:"rgb(255,255,255)",fillStyle:"rgb(255,255,255)",...e};const{x:a,y:t,width:s,height:o,round:l,stroke:i,strokeStyle:n,fillStyle:u}=e;R.beginPath(),R.moveTo(a+l,t),R.arcTo(a+s,t,a+s,t+l,l),R.lineTo(a+s,t+o-l),R.arcTo(a+s,t+o,a+s-l,t+o,l),R.lineTo(a+l,t+o),R.arcTo(a,t+o,a,t+o-l,l),R.lineTo(a,t+l),R.arcTo(a,t,a+l,t,l),R.closePath(),R.fillStyle=u,R.strokeStyle=n,R.fill(),i&&R.stroke(),R.restore()}({width:a,height:t,round:10}),await async function(){await $({x:15,y:15,width:32,height:32,src:I.user.avatar}),R.save(),R.font="normal 16px sans-serif",R.fillStyle="#000000",R.translate(68,32),R.fillText(I.user.nickname+"邀请您来拼团啦~",0,8),R.restore()}(),await async function(e){const a=e-48,t=P.value.image;await $({x:24,y:72,width:a,height:a,src:t});const s=P.value.storeName,o=P.value.price,l="快来和我拼团",i=R.measureText(s)>=e/1.5?s:s.slice(0,17)+"...";R.save(),R.translate(24,e+58),R.font="normal bold 16px sans-serif",R.fillStyle="#000000",R.fillText(i,0,0),R.restore(),R.save(),R.translate(24,e+58+36),R.font="normal bold 24px sans-serif",R.fillStyle="#EE6D46",R.fillText(`¥${o}`,0,0);const n=R.measureText(`¥${o}`);R.font="normal normal 16px sans-serif",R.fillStyle="#999999",R.fillText(`${l}`,n.width+10,0),R.restore(),R.save(),R.beginPath(),R.strokeStyle="#F0F0F0",R.translate(24,e+58+36+15),R.moveTo(0,0),R.lineWidth=1,R.lineTo(a,0),R.stroke(),R.closePath(),R.restore()}(a),await async function(e){R.save(),R.translate(24,e+58+36+15+25);const a="长按识别图中二维码",t="来自「Yshop商城」小程序";R.font="normal bold 16px sans-serif",R.fillStyle="#000000",R.fillText(a,0,0),R.font="normal normal 14px sans-serif",R.fillStyle="#8C8C8C",R.fillText(t,0,25);const s=await j(D.value);await $({x:e-48-50,y:-18,width:50,height:50,src:s}),R.restore()}(a),console.log("画布绘画完毕"),R.draw(!1,(()=>{!async function(){console.log("开始生成画布"),g({canvasId:"goods-canvas",success:async e=>{G.value=await j(e.tempFilePath),y()
|