- 自定义 TabBar 增加弯月面聚光带与银丝边缘,玻璃参数升级 - 全局返回按钮与 ScrollTopMask 返回按钮升级 135° 液态玻璃渐变 - 激活态升级为玻璃透镜,浅色/深色主题同步 - 新增 tools/liquid-glass.test.mjs 回归断言 - 同步构建产物 dist/,并合并此前未提交的 .claude 配置与 dist 变更
1 line
9.7 KiB
JavaScript
1 line
9.7 KiB
JavaScript
"use strict";(wx["webpackJsonp"]=wx["webpackJsonp"]||[]).push([[95],{8955:function(e,a,s){var t=s(7842),c=s(1212),n=s(467),i=s(9379),r=s(436),l=s(5544),o=s(118),d=s(758),u=s.n(d),h=s(6540),m=s(5234),p=s(1457),x=s(5787),g=s(9703),f=s(9201),v=s(5414),j=s(9674),N=s(3053),S=s(9513),y=s(4848);function w(){var e=(0,g.wR)(),a=(e.theme,e.resolvedTheme),s=(0,f.c)();(0,v.l)(a);var t=(0,h.useState)(null),d=(0,l.A)(t,2),w=d[0],b=d[1],k=(0,h.useState)(1),A=(0,l.A)(k,2),E=(A[0],A[1],(0,h.useState)("")),T=(0,l.A)(E,2),Y=T[0],D=T[1],I=(0,h.useState)(1),O=(0,l.A)(I,2),P=(O[0],O[1]),_=(0,h.useState)([]),F=(0,l.A)(_,2),M=F[0],B=F[1],R=(0,h.useState)(null),z=(0,l.A)(R,2),V=z[0],q=z[1],C=(0,h.useState)(!1),G=(0,l.A)(C,2),J=G[0],X=G[1],H=(0,h.useState)({x:0,y:0}),L=(0,l.A)(H,2),K=L[0],Q=L[1],U=(0,h.useState)(!1),W=(0,l.A)(U,2),Z=W[0],$=W[1],ee=(0,h.useState)(!1),ae=(0,l.A)(ee,2),se=ae[0],te=ae[1];(0,h.useEffect)(function(){var e=u().getCurrentInstance().router,a=e?e.params:void 0,s=a?a.source:void 0,t=a&&a.productId||a&&a.category;if("product"===s&&t){var c=(0,m.y9)(t);if(c){b(c),P(Number(a?a.quantity:void 0)||1);var n={id:"DSG"+Date.now(),productId:c.id,productName:c.name,productIcon:c.icon,unitPrice:c.price,count:Number(a?a.quantity:void 0)||1,status:"designing",createdAt:(new Date).toISOString().slice(0,10)},i=(0,p.p_)();(0,p.Fu)([].concat((0,r.A)(i),[n])),D(n.id)}}else if("designList"===s&&a&&a.designId){var l=a.designId,o=(0,p.p_)(),d=o.find(function(e){return e.id===l});if(d){D(l),P(d.count);var h=(0,m.y9)(d.productId);if(h&&b(h),d.designData?d.designData.stickers:void 0)B(d.designData.stickers);else if(d.designData?d.designData.imageSrc:void 0){var x={id:"legacy_"+Date.now(),src:d.designData.imageSrc,x:d.designData.imagePos&&d.designData.imagePos.x||0,y:d.designData.imagePos&&d.designData.imagePos.y||0,scale:d.designData.imagePos&&d.designData.imagePos.scale||1,width:200,height:200,isOverlapping:!1};B([x])}}}else if(t){var g=(0,m.y9)(t);if(g){b(g);var f={id:"DSG"+Date.now(),productId:g.id,productName:g.name,productIcon:g.icon,unitPrice:g.price,count:1,status:"designing",createdAt:(new Date).toISOString().slice(0,10)},v=(0,p.p_)();(0,p.Fu)([].concat((0,r.A)(v),[f])),D(f.id)}}},[]);var ce=function(e){for(var a=e.map(function(e){return(0,i.A)((0,i.A)({},e),{},{isOverlapping:!1})}),s=0;s<a.length;s++)for(var t=s+1;t<a.length;t++){var c=a[s],n=a[t],r=c.width*c.scale,l=c.height*c.scale,o=n.width*n.scale,d=n.height*n.scale;c.x<n.x+o&&c.x+r>n.x&&c.y<n.y+d&&c.y+l>n.y&&(a[s].isOverlapping=!0,a[t].isOverlapping=!0)}var u=a.some(function(e){return e.isOverlapping});return te(u),a},ne=function(){u().chooseImage({count:1,sizeType:["compressed"],sourceType:["album","camera"],success:function(e){var a=e.tempFilePaths[0];u().getImageInfo({src:a,success:function(e){var s={id:"stk_"+Date.now(),src:a,x:0,y:0,scale:1,width:e.width,height:e.height,isOverlapping:!1},t=[].concat((0,r.A)(M),[s]),c=ce(t);B(c),q(s.id)},fail:function(){var e={id:"stk_"+Date.now(),src:a,x:0,y:0,scale:1,width:200,height:200,isOverlapping:!1},s=[].concat((0,r.A)(M),[e]),t=ce(s);B(t),q(e.id)}})}})},ie=function(e){var a=M.filter(function(a){return a.id!==e}),s=ce(a);B(s),V===e&&q(null)},re=function(e,a){var s=e.touches[0],t=M.find(function(e){return e.id===a});t&&(q(a),X(!0),Q({x:s.clientX-t.x,y:s.clientY-t.y}))},le=function(e){if(J&&V){var a=e.touches[0],s=M.map(function(e){return e.id!==V?e:(0,i.A)((0,i.A)({},e),{},{x:a.clientX-K.x,y:a.clientY-K.y})}),t=ce(s);B(t)}},oe=function(){return X(!1)},de=function(){V&&Y&&u().navigateTo({url:"/pages/diy/stickerEdit/index?designId=".concat(Y,"&stickerId=").concat(V)})},ue=function(e,a){var s=M.map(function(s){return s.id!==e?s:(0,i.A)((0,i.A)({},s),{},{scale:Math.max(.3,Math.min(3,s.scale+a))})}),t=ce(s);B(t)},he=function(){u().navigateBack()},me=function(){if(!w)return{width:300,height:420};var e={width:w.mask.width,height:w.mask.height};return"rect"===w.mask.shape&&(e.borderRadius=w.mask.borderRadius||0),"circle"===w.mask.shape&&(e.borderRadius="50%"),e},pe=function(){var e=(0,n.A)((0,c.A)().m(function e(){var a;return(0,c.A)().w(function(e){while(1)switch(e.n){case 0:if(!se){e.n=1;break}return u().showToast({title:"\u8d34\u7eb8\u4e0d\u80fd\u91cd\u53e0",icon:"none"}),e.a(2);case 1:if(!Y){e.n=3;break}return e.n=2,(0,x.x5)({stickers:M,category:w,version:1});case 2:a=e.v,(0,p.i5)(Y,{designData:a});case 3:$(!1),u().navigateTo({url:"/pages/checkout/index?designId=".concat(Y)});case 4:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}(),xe=V?M.find(function(e){return e.id===V}):void 0,ge=xe?xe.scale:1;return w?(0,y.jsxs)(o.Ss,{className:"theme-".concat(a),children:[(0,y.jsx)(j.A,{}),(0,y.jsx)(N.A,{title:"\u8bbe\u8ba1\u5de5\u4f5c\u53f0",targetSelector:".page-header.surface-card",showBack:!0}),(0,y.jsxs)(o.Ss,{className:"diy-page",children:[(0,y.jsx)(o.Ss,{className:"page-header surface-card",style:{paddingTop:"".concat(s.statusBarHeight+12,"px")},children:(0,y.jsxs)(o.Ss,{className:"flex-between",style:{width:"100%"},children:[(0,y.jsx)(o.EY,{className:"back-btn",onTap:he,children:"\u2190"}),(0,y.jsx)(o.EY,{className:"page-title",children:"\u8bbe\u8ba1\u5de5\u4f5c\u53f0"}),(0,y.jsx)(o.Ss,{className:"header-spacer"})]})}),(0,y.jsx)(o.Ss,{className:"canvas-wrapper surface-card mt-20",catchMove:!0,children:(0,y.jsxs)(o.Ss,{className:"canvas-area",style:me(),children:[M.map(function(e){return(0,y.jsx)(o._V,{className:"canvas-image ".concat(e.isOverlapping?"overlap":""," ").concat(V===e.id?"active":""),src:e.src,style:{transform:"translate(".concat(e.x,"px, ").concat(e.y,"px) scale(").concat(e.scale,")"),opacity:J&&V===e.id?.8:1,zIndex:V===e.id?10:5,width:e.width||200,height:e.height||200},onTouchStart:function(a){return re(a,e.id)},onTouchMove:le,onTouchEnd:oe,onTap:function(){return q(e.id)},mode:"aspectFit"},e.id)}),(0,y.jsx)(o.Ss,{className:"mask-border",style:me()})]})}),(0,y.jsxs)(o.Ss,{className:"sticker-panel surface-card mt-20",children:[(0,y.jsx)(o.EY,{className:"section-title",children:"\u8d34\u7eb8"}),(0,y.jsxs)(o.Ss,{className:"sticker-list",children:[M.map(function(e){return(0,y.jsxs)(o.Ss,{className:"sticker-thumb ".concat(e.isOverlapping?"overlap":""," ").concat(V===e.id?"active":""),children:[(0,y.jsx)(o._V,{src:e.src,className:"sticker-thumb-img",mode:"aspectFit",onTap:function(){return q(e.id)}}),(0,y.jsx)(o.Ss,{className:"sticker-del",onTap:function(){return ie(e.id)},children:(0,y.jsx)(o.EY,{className:"del-icon",children:"\xd7"})})]},e.id)}),(0,y.jsxs)(o.Ss,{className:"sticker-add-btn",onTap:ne,children:[(0,y.jsx)(o.EY,{className:"add-icon",children:"+"}),(0,y.jsx)(o.EY,{className:"add-label",children:"\u6dfb\u52a0"})]})]}),se&&(0,y.jsx)(o.EY,{className:"overlap-hint",children:"\u6709\u8d34\u7eb8\u91cd\u53e0\uff0c\u8bf7\u8c03\u6574\u4f4d\u7f6e"})]}),V&&(0,y.jsxs)(o.Ss,{className:"toolbar surface-card mt-20",children:[(0,y.jsxs)(o.Ss,{className:"tool-row",children:[(0,y.jsx)(o.EY,{className:"tool-label",children:"\u7f29\u653e"}),(0,y.jsxs)(o.Ss,{className:"flex-center",style:{gap:"20px"},children:[(0,y.jsx)(o.Ss,{className:"tool-btn",onTap:function(){return ue(V,-.1)},children:"\uff0d"}),(0,y.jsxs)(o.EY,{className:"tool-value",children:[Math.round(100*ge),"%"]}),(0,y.jsx)(o.Ss,{className:"tool-btn",onTap:function(){return ue(V,.1)},children:"\uff0b"})]})]}),(0,y.jsxs)(o.Ss,{className:"tool-row",children:[(0,y.jsx)(o.EY,{className:"tool-label",children:"\u63d0\u793a"}),(0,y.jsx)(o.EY,{className:"tool-hint",children:"\u62d6\u52a8\u8c03\u6574\u4f4d\u7f6e\uff0c\u8d34\u7eb8\u4e0d\u53ef\u91cd\u53e0"})]})]}),(0,y.jsx)(o.Ss,{className:"edit-btn-bar mt-20",children:(0,y.jsx)(o.Ss,{className:"edit-btn ".concat(V?"active":"disabled"),onTap:de,children:(0,y.jsx)(o.EY,{children:"\u7f16\u8f91"})})}),(0,y.jsxs)(S.A,{children:[(0,y.jsx)(o.Ss,{className:"btn-primary",onTap:function(){return $(!0)},children:(0,y.jsx)(o.EY,{children:"\u9884\u89c8\u6548\u679c"})}),(0,y.jsx)(o.Ss,{className:"btn-secondary",onTap:ne,children:(0,y.jsx)(o.EY,{children:"\u6dfb\u52a0\u8d34\u7eb8"})})]}),Z&&(0,y.jsx)(o.Ss,{className:"preview-overlay",children:(0,y.jsxs)(o.Ss,{className:"preview-card surface-card",children:[(0,y.jsx)(o.EY,{className:"preview-title",children:"\u786e\u8ba4\u6548\u679c"}),(0,y.jsx)(o.Ss,{className:"preview-canvas",style:me(),children:M.map(function(e){return(0,y.jsx)(o._V,{className:"preview-image ".concat(e.isOverlapping?"overlap":""),src:e.src,style:{transform:"translate(".concat(e.x,"px, ").concat(e.y,"px) scale(").concat(e.scale,")"),width:e.width||200,height:e.height||200},mode:"aspectFit"},e.id)})}),(0,y.jsxs)(o.Ss,{className:"product-info",children:[(0,y.jsx)(o.EY,{className:"product-name",children:w.name}),(0,y.jsxs)(o.EY,{className:"product-size",children:["\u753b\u5e03\u5c3a\u5bf8: ",w.mask.width," \xd7 ",w.mask.height," px"]}),se&&(0,y.jsx)(o.EY,{className:"overlap-hint",children:"\u8d34\u7eb8\u6709\u91cd\u53e0\uff0c\u4e0d\u53ef\u63d0\u4ea4"})]}),(0,y.jsxs)(o.Ss,{className:"preview-actions",children:[(0,y.jsx)(o.Ss,{className:"btn-secondary",onTap:function(){return $(!1)},children:(0,y.jsx)(o.EY,{children:"\u8fd4\u56de\u4fee\u6539"})}),(0,y.jsx)(o.Ss,{className:"btn-primary ".concat(se?"disabled":""),onTap:pe,children:(0,y.jsx)(o.EY,{children:"\u786e\u8ba4\u5b8c\u6210"})})]})]})}),(0,y.jsx)(o.Ss,{className:"safe-bottom-placeholder"})]})]}):(0,y.jsxs)(o.Ss,{className:"theme-".concat(a),children:[(0,y.jsx)(j.A,{}),(0,y.jsx)(N.A,{title:"\u8bbe\u8ba1\u5de5\u4f5c\u53f0",targetSelector:".page-header.surface-card",showBack:!0}),(0,y.jsx)(o.Ss,{className:"diy-page",children:(0,y.jsx)(o.EY,{className:"page-title",children:"\u52a0\u8f7d\u4e2d..."})})]})}var b={navigationStyle:"custom",enablePageMeta:!0,navigationBarTitleText:"DIY\u5de5\u4f5c\u53f0"};Page((0,t.createPageConfig)(w,"pages/diy/index",{root:{cn:[]}},b||{}))}},function(e){var a=function(a){return e(e.s=a)};e.O(0,[907,96,76],function(){return a(8955)});e.O()}]); |