Files
wechat_wc/dist/pages/shop/index.js
T

1 line
7.6 KiB
JavaScript

"use strict";(wx["webpackJsonp"]=wx["webpackJsonp"]||[]).push([[205],{6296:function(s,e,a){var c=a(7842),o=a(5544),n=a(118),t=a(758),i=a.n(t),l=a(6540),r=a(5234),h=a(9703),p=a(4848),d=function(s,e,a){return Math.min(Math.max(s,e),a)},m=function(s,e,a){return s+(e-s)*a},x=function(s){return 1-Math.pow(1-s,3)};function u(){var s,e=(0,h.wR)(),a=e.theme,c=(0,l.useState)(667),u=(0,o.A)(c,2),j=u[0],N=u[1],g=(0,l.useState)(!1),b=(0,o.A)(g,2),f=b[0],v=b[1],S=(0,l.useState)(!1),y=(0,o.A)(S,2),Y=y[0],E=y[1],k=(0,l.useState)(null),w=(0,o.A)(k,2),C=w[0],O=w[1],P=(0,l.useState)(0),T=(0,o.A)(P,2),A=T[0],B=T[1];(0,l.useEffect)(function(){try{var s=i().getSystemInfoSync();N(s.windowHeight)}catch(s){}},[]),(0,l.useEffect)(function(){f&&C?(0,t.hideTabBar)({animation:!0}).catch(function(){}):(0,t.showTabBar)({animation:!0}).catch(function(){})},[f,C]);var M=(0,l.useCallback)(function(s){O(s),v(!0),B(0),setTimeout(function(){return E(!0)},50)},[]),I=(0,l.useCallback)(function(){E(!1),setTimeout(function(){v(!1),O(null),B(0)},350)},[]),F=(0,l.useCallback)(function(){C&&i().navigateTo({url:"/pages/product/index?id=".concat(C.id)})},[C]),H=(0,l.useCallback)(function(s){var e,a,c=null!==(e=null===(a=s.detail)||void 0===a?void 0:a.scrollTop)&&void 0!==e?e:0,o=1.2*j,n=d(c/o,0,1);B(n)},[j]),z=(0,l.useMemo)(function(){var s=A,e=0,a=0;if(s<=.4){var c=x(s/.4);e=m(0,32,c),a=m(0,38,c)}else if(s<=.55){var o=(s-.4)/.15;e=m(32,34,o),a=m(38,41,o)}else e=34,a=41;var n=0;n=s<=.4?0:s<=.7?m(0,-75,(s-.4)/.3):-75;var t=1;t=s<=.35?1:s<=.48?d(1-(s-.35)/.13,0,1):0;var i=0;i=s<=.55?0:s<=.7?(s-.55)/.15:1;var l=1,r=0;if(s<=.05)l=0,r=60;else if(s<=.22){var h=(s-.05)/.17;l=x(h),r=m(60,0,x(h))}var p=1;return s<=.15&&(p=d(1-s/.15,0,1)),{topCrop:e,bottomCrop:a,translateY:n,heroInfoOpacity:t,bandOpacity:i,contentOpacity:l,contentOffset:r,backBtnOpacity:p,visibleHeight:100-e-a}},[A]),J=(0,l.useMemo)(function(){return(null===C||void 0===C?void 0:C.tone)||[28,22,18]},[C]);return(0,p.jsxs)(n.Ss,{className:"shop-page theme-".concat(a),children:[(0,p.jsxs)(n.Ss,{className:"shop-list",children:[(0,p.jsxs)(n.Ss,{className:"shop-header",children:[(0,p.jsx)(n.EY,{className:"shop-header-title",children:"\u667a\u7ed8\u7cbe\u9009"}),(0,p.jsx)(n.EY,{className:"shop-header-sub",children:"\u6fc0\u5149\u5fae\u96d5\u5b9a\u5236\u597d\u7269"})]}),(0,p.jsx)(n.Ss,{className:"shop-grid",children:r.zv.map(function(s){var e,a,c,o;return(0,p.jsxs)(n.Ss,{className:"shop-card",onTap:function(){return M(s)},children:[(0,p.jsx)(n.Ss,{className:"shop-card-img-wrap",children:(0,p.jsx)(n._V,{className:"shop-card-img",src:(null===(e=s.images)||void 0===e?void 0:e[0])||s.iconImg||"",mode:"aspectFill",lazyLoad:!0})}),(0,p.jsxs)(n.Ss,{className:"shop-card-info",style:{backgroundColor:"rgba(".concat((null===(a=s.tone)||void 0===a?void 0:a[0])||28,", ").concat((null===(c=s.tone)||void 0===c?void 0:c[1])||22,", ").concat((null===(o=s.tone)||void 0===o?void 0:o[2])||18,", 0.92)")},children:[(0,p.jsx)(n.EY,{className:"shop-card-name",children:s.name}),(0,p.jsxs)(n.EY,{className:"shop-card-price",children:["\xa5",s.price]})]})]},s.id)})}),(0,p.jsx)(n.Ss,{style:{height:"160px"}})]}),C&&(0,p.jsxs)(n.Ss,{className:"shop-detail-view ".concat(Y?"show":""),style:{display:f?"block":"none"},children:[(0,p.jsxs)(n.Ss,{className:"shop-hero-fixed",children:[(0,p.jsx)(n.Ss,{className:"shop-hero-clip",style:{height:"".concat(j*z.visibleHeight/100,"px"),overflow:"hidden",transform:"translateY(".concat(j*z.translateY/100,"px)")},children:(0,p.jsx)(n._V,{className:"shop-hero-img",src:(null===(s=C.images)||void 0===s?void 0:s[0])||C.iconImg||"",mode:"aspectFill",style:{width:"100%",height:"".concat(j,"px"),position:"absolute",top:"".concat(-j*z.topCrop/100,"px"),left:0}})}),(0,p.jsx)(n.Ss,{className:"shop-hero-overlay",style:{background:"linear-gradient(to bottom, rgba(".concat(J[0],", ").concat(J[1],", ").concat(J[2],", 0) 0%, rgba(").concat(J[0],", ").concat(J[1],", ").concat(J[2],", 0.55) 40%, rgba(").concat(J[0],", ").concat(J[1],", ").concat(J[2],", 0.95) 100%)")}}),(0,p.jsxs)(n.Ss,{className:"shop-hero-info",style:{opacity:z.heroInfoOpacity},children:[(0,p.jsx)(n.EY,{className:"shop-hero-title",children:C.name}),(0,p.jsx)(n.EY,{className:"shop-hero-subtitle",children:C.subtitle||C.desc}),(0,p.jsxs)(n.Ss,{className:"shop-hero-price-row",children:[(0,p.jsxs)(n.EY,{className:"shop-hero-price",children:["\xa5",C.price]}),C.originalPrice&&C.originalPrice>C.price&&(0,p.jsxs)(n.EY,{className:"shop-hero-original",children:["\xa5",C.originalPrice]})]})]})]}),(0,p.jsxs)(n.BM,{className:"shop-scroll",scrollY:!0,scrollEventThrottle:16,style:{height:"".concat(j,"px")},onScroll:H,children:[(0,p.jsx)(n.Ss,{style:{height:"".concat(.65*j,"px")}}),(0,p.jsxs)(n.Ss,{className:"shop-content",style:{backgroundColor:"rgb(".concat(J[0],", ").concat(J[1],", ").concat(J[2],")")},children:[(0,p.jsxs)(n.Ss,{className:"shop-band",style:{opacity:z.bandOpacity,backgroundColor:"rgba(".concat(J[0],", ").concat(J[1],", ").concat(J[2],", 0.88)"),backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)"},children:[(0,p.jsx)(n.EY,{className:"shop-band-title",children:C.name}),(0,p.jsx)(n.EY,{className:"shop-band-subtitle",children:C.subtitle||C.desc}),(0,p.jsxs)(n.Ss,{className:"shop-band-price-row",children:[(0,p.jsxs)(n.EY,{className:"shop-band-price",children:["\xa5",C.price]}),C.originalPrice&&C.originalPrice>C.price&&(0,p.jsxs)(n.EY,{className:"shop-band-original",children:["\xa5",C.originalPrice]})]})]}),(0,p.jsxs)(n.Ss,{className:"shop-detail-body",style:{opacity:z.contentOpacity,transform:"translateY(".concat(z.contentOffset,"px)")},children:[C.story&&(0,p.jsxs)(n.Ss,{className:"shop-section",children:[(0,p.jsx)(n.EY,{className:"shop-section-title",children:"\u8bbe\u8ba1\u7406\u5ff5"}),(0,p.jsx)(n.EY,{className:"shop-section-text",children:C.story})]}),(0,p.jsx)(n.Ss,{className:"shop-divider"}),C.scene&&(0,p.jsxs)(n.Ss,{className:"shop-section",children:[(0,p.jsx)(n.EY,{className:"shop-section-title",children:"\u4f7f\u7528\u573a\u666f"}),(0,p.jsx)(n.EY,{className:"shop-section-text",children:C.scene})]}),C.tags&&C.tags.length>0&&(0,p.jsx)(n.Ss,{className:"shop-section",children:(0,p.jsx)(n.Ss,{className:"shop-tag-row",children:C.tags.map(function(s){return(0,p.jsx)(n.Ss,{className:"shop-tag",children:(0,p.jsx)(n.EY,{className:"shop-tag-text",children:s})},s)})})}),(0,p.jsx)(n.Ss,{className:"shop-divider"}),C.specs&&C.specs.length>0&&(0,p.jsxs)(n.Ss,{className:"shop-section",children:[(0,p.jsx)(n.EY,{className:"shop-section-title",children:"\u89c4\u683c\u53c2\u6570"}),(0,p.jsx)(n.Ss,{className:"shop-spec-table",children:C.specs.map(function(s){var e=(0,o.A)(s,2),a=e[0],c=e[1];return(0,p.jsxs)(n.Ss,{className:"shop-spec-row",children:[(0,p.jsx)(n.EY,{className:"shop-spec-key",children:a}),(0,p.jsx)(n.EY,{className:"shop-spec-val",children:c})]},a)})})]}),(0,p.jsx)(n.Ss,{className:"shop-bottom-spacer"})]})]})]},C.id),(0,p.jsx)(n.Ss,{className:"shop-back-btn",onTap:I,style:{opacity:z.backBtnOpacity},children:(0,p.jsx)(n.EY,{className:"shop-back-arrow",children:"\u2190"})}),(0,p.jsxs)(n.Ss,{className:"shop-cta-bar",style:{backgroundColor:"rgba(".concat(J[0],", ").concat(J[1],", ").concat(J[2],", 0.92)")},children:[(0,p.jsxs)(n.Ss,{className:"shop-cta-price-col",children:[(0,p.jsxs)(n.EY,{className:"shop-cta-price",children:["\xa5",C.price]}),C.originalPrice&&C.originalPrice>C.price&&(0,p.jsxs)(n.EY,{className:"shop-cta-original",children:["\xa5",C.originalPrice]})]}),(0,p.jsx)(n.Ss,{className:"shop-cta-btn",onTap:F,children:(0,p.jsx)(n.EY,{className:"shop-cta-btn-text",children:"\u7acb\u5373\u5b9a\u5236"})})]})]})]})}var j={};Page((0,c.createPageConfig)(u,"pages/shop/index",{root:{cn:[]}},j||{}))}},function(s){var e=function(e){return s(s.s=e)};s.O(0,[907,96,76],function(){return e(6296)});s.O()}]);