From 2968a4b20f1f9a6634490d06ac6bdfc0ddc5b0d2 Mon Sep 17 00:00:00 2001 From: lai_hong Date: Sun, 13 Sep 2026 11:06:03 +0800 Subject: [PATCH] feat(catalog): connect product pages to backend --- .env.example | 4 + config/index.js | 2 + dist/common.js | 2 +- dist/pages/address/index.js | 2 +- dist/pages/designList/index.js | 2 +- dist/pages/diy/index.js | 2 +- dist/pages/diy/stickerEdit/index.js | 2 +- dist/pages/index/index.js | 2 +- dist/pages/product/index.js | 2 +- dist/pages/profile/index.js | 2 +- dist/pages/shop/detail/index.js | 2 +- dist/pages/shop/index.js | 2 +- dist/pages/shop/index.wxss | 2 +- dist/pages/wordcloud/index.js | 2 +- src/pages/index/index.tsx | 147 +++++++++++----------------- src/pages/product/index.tsx | 44 ++++++++- src/pages/shop/detail/index.tsx | 41 +++++++- src/pages/shop/index.scss | 12 +++ src/pages/shop/index.tsx | 37 ++++++- src/types/index.ts | 4 + src/utils/api/product.ts | 85 ++++++++++++++-- src/utils/productAdapter.ts | 31 ++++++ src/utils/request.ts | 7 +- 23 files changed, 315 insertions(+), 123 deletions(-) create mode 100644 src/utils/productAdapter.ts diff --git a/.env.example b/.env.example index d39a03e..f80f15a 100644 --- a/.env.example +++ b/.env.example @@ -1,2 +1,6 @@ # 阿里云 OSS 资源桶基址,迁移时只改这一个变量 OSS_BASE_URL=https://wordcloudwechat.oss-cn-hangzhou.aliyuncs.com + +# 后端接口基址:本机 Docker 联调时使用 http://127.0.0.1:3090 +# 不配置时会继续使用线上测试接口。 +TARO_APP_API_BASE_URL=http://127.0.0.1:3090 diff --git a/config/index.js b/config/index.js index 23216fc..eb132df 100644 --- a/config/index.js +++ b/config/index.js @@ -14,6 +14,8 @@ const config = { plugins: [], defineConstants: { __OSS_BASE_URL__: JSON.stringify(process.env.OSS_BASE_URL || ''), + // 接口基址由本机 .env 注入;不写则继续使用已部署的测试服务。 + __API_BASE_URL__: JSON.stringify(process.env.TARO_APP_API_BASE_URL || 'https://wxbackend.tokenleaping.com'), }, copy: { patterns: [ diff --git a/dist/common.js b/dist/common.js index f764140..d52b78d 100644 --- a/dist/common.js +++ b/dist/common.js @@ -1 +1 @@ -"use strict";(wx["webpackJsonp"]=wx["webpackJsonp"]||[]).push([[76],{9513:function(n,t,e){e.d(t,{A:function(){return o}});var r=e(118),i=e(4848);function o(n){var t=n.children,e=n.className,o=n.style;return(0,i.jsx)(r.Ss,{className:"bottom-action-bar ".concat(e||""),style:o,children:t})}},7723:function(n,t,e){e.d(t,{A:function(){return f}});var r=e(5544),i=e(758),o=e.n(i),u=e(6540),c=e(118),a=e(6764),s=e(9703),l=e(8199),d=e(4848);function f(n){var t=(0,u.useState)("checking"),e=(0,r.A)(t,2),i=e[0],f=e[1],p=(0,u.useCallback)(function(){var n=!1;return(0,a.d)().then(function(t){n||f(t?"ok":"denied")}).catch(function(){n||f("denied")}),function(){n=!0}},[]);return(0,u.useEffect)(function(){var n=p(),t=function(){p()},e=function(){p()};return o().eventCenter.on("tabBarChange",t),o().eventCenter.on(s.Wo,e),o().eventCenter.on("authStateChanged",t),function(){n(),o().eventCenter.off("tabBarChange",t),o().eventCenter.off(s.Wo,e),o().eventCenter.off("authStateChanged",t)}},[p]),"checking"===i?(0,d.jsx)(c.Ss,{className:"login-guard",children:(0,d.jsxs)(c.Ss,{className:"login-guard-inner",children:[(0,d.jsx)(c._V,{className:"login-guard-icon",src:(0,l.uq)("/icon/\u8bbe\u7f6e.png"),mode:"aspectFit"}),(0,d.jsx)(c.EY,{className:"login-guard-title",children:"\u6821\u9a8c\u767b\u5f55\u72b6\u6001"})]})}):"denied"===i?(0,d.jsx)(c.Ss,{className:"login-guard",children:(0,d.jsxs)(c.Ss,{className:"login-guard-inner",children:[(0,d.jsx)(c._V,{className:"login-guard-icon",src:(0,l.uq)("/icon/\u4e2a\u4eba.png"),mode:"aspectFit"}),(0,d.jsx)(c.EY,{className:"login-guard-title",children:"\u8bf7\u5148\u767b\u5f55"}),(0,d.jsx)(c.EY,{className:"login-guard-desc",children:"\u767b\u5f55\u540e\u67e5\u770b\u60a8\u7684\u4e13\u5c5e\u5185\u5bb9"}),(0,d.jsx)(c.Ss,{className:"btn-primary login-guard-btn",onTap:function(){return o().switchTab({url:"/pages/profile/index"})},children:(0,d.jsx)(c.EY,{children:"\u53bb\u767b\u5f55"})})]})}):n.children}},3053:function(n,t,e){e.d(t,{A:function(){return f}});var r=e(5544),i=e(118),o=e(758),u=e.n(o),c=e(6540),a=e(9201);function s(n){var t=n.viewportBottom,e=n.scrollTop,r=n.statusBarHeight,i=Number.isFinite(t)?t:0,o=Number.isFinite(e)?e:0,u=Number.isFinite(r)?r:0;return Math.max(0,i+o-u-8)}function l(n){var t=n.scrollTop,e=n.startY,r=n.rangeY,i=Number.isFinite(t)?t:0,o=Math.max(0,Number.isFinite(e)?e:0),u=Math.max(1,Number.isFinite(r)?r:1);return i<=o?0:Math.min(1,(i-o)/u)}var d=e(4848);function f(n){var t=n.title,e=n.targetSelector,o=void 0===e?".page-header":e,f=n.showBack,p=void 0!==f&&f,g=(0,a.c)(),h=(0,c.useState)(0),m=(0,r.A)(h,2),v=m[0],y=m[1],A=(0,c.useMemo)(function(){return{startY:Math.max(0,g.headerPaddingTop-g.statusBarHeight),rangeY:Math.max(48,.45*g.headerPaddingTop)}},[g.headerPaddingTop,g.statusBarHeight]),S=(0,c.useRef)(A),k=(0,c.useRef)(null),b=(0,c.useRef)(0),w=(0,c.useCallback)(function(n){b.current=n,null===k.current&&(k.current=setTimeout(function(){k.current=null;var n=S.current,t=n.startY,e=n.rangeY;y(l({scrollTop:b.current,startY:t,rangeY:e}))},16))},[]);return(0,c.useEffect)(function(){var n=!1,t=null;S.current=A;var e=function(){n||u().createSelectorQuery().select(o).boundingClientRect(function(t){if(!n){if(!t||Array.isArray(t)||"number"!==typeof t.bottom||"number"!==typeof t.height)return S.current=A,void w(b.current);var e=s({viewportBottom:t.bottom,scrollTop:b.current,statusBarHeight:g.statusBarHeight}),r=Math.max(32,.7*t.height);S.current={startY:e,rangeY:r},w(b.current)}}).exec()};return u().nextTick(function(){n||(t=setTimeout(e,80))}),function(){n=!0,null!==t&&clearTimeout(t),null!==k.current&&clearTimeout(k.current),k.current=null}},[w,A,o]),u().usePageScroll(function(n){w(n.scrollTop)}),(0,d.jsxs)(i.Ss,{className:"scroll-top-mask",style:{height:"".concat(Math.max(g.menuButtonTop+g.menuButtonHeight+18,g.statusBarHeight+52)+24,"px"),opacity:v},children:[(0,d.jsx)(i.Ss,{className:"scroll-top-blur scroll-top-blur-mid"}),(0,d.jsx)(i.Ss,{className:"scroll-top-blur scroll-top-blur-soft"}),(0,d.jsx)(i.Ss,{className:"scroll-top-gradient"}),p&&(0,d.jsx)(i.Ss,{className:"scroll-top-back",style:{top:"".concat(g.menuButtonTop,"px")},onTap:function(){return u().navigateBack()},children:(0,d.jsx)(i.EY,{className:"scroll-top-back-arrow",children:"\u2190"})}),(0,d.jsx)(i.EY,{className:"scroll-top-title",style:{top:"calc(".concat(g.menuButtonTop,"px + 40rpx)"),transform:"translateY(-50%)",opacity:Math.max(0,Math.min(1,(v-.5)/.5))},children:t})]})}},9674:function(n,t,e){e.d(t,{A:function(){return u}});var r=e(118),i=e(9703),o=e(4848);function u(n){var t=n.darkTop,e=void 0!==t&&t,u=(0,i.wR)(),c=u.resolvedTheme,a="dark"===c||e,s=a?"#191919":"#faf7f2",l=a?"#ffffff":"#000000";return(0,o.jsx)(r.tf,{backgroundColor:s,backgroundColorTop:s,backgroundColorBottom:s,backgroundTextStyle:a?"light":"dark",rootBackgroundColor:s,children:(0,o.jsx)(r.yk,{frontColor:l,backgroundColor:s})})}},9703:function(n,t,e){e.d(t,{NP:function(){return p},Wo:function(){return f},wR:function(){return g}});var r=e(5544),i=e(6540),o=e(758),u=e.n(o),c=e(118),a=e(1457),s=e(6606),l=e(4848),d=(0,i.createContext)({theme:"auto",resolvedTheme:"light",toggleTheme:function(){},setTheme:function(){}}),f="themeChange";function p(n){var t=n.children,e=(0,i.useState)((0,a.O4)()),p=(0,r.A)(e,2),g=p[0],h=p[1],m=(0,i.useState)((0,a.eW)((0,a.O4)())),v=(0,r.A)(m,2),y=v[0],A=v[1],S=(0,i.useRef)(null),k=(0,i.useCallback)(function(n){A((0,a.eW)(n))},[]),b=(0,i.useCallback)(function(n){(0,a.Rq)(n),S.current=n,"auto"===(0,a.O4)()&&A(n)},[]),w=(0,i.useCallback)(function(){try{var n=u().getAppBaseInfo();b("dark"===n.theme?"dark":"light")}catch(n){}try{u().createSelectorQuery().select(".system-theme-detector").fields({computedStyle:["opacity"]}).exec(function(n){var t=n&&n[0]&&n[0].computedStyle&&n[0].computedStyle.opacity;b("1"===t?"dark":"light")})}catch(n){}},[b]),T=(0,i.useCallback)(function(n){(0,a.F0)(n),h(n),"auto"===n?w():k(n)},[w,k]),C=(0,i.useCallback)(function(){var n="light"===y?"dark":"light";T(n)},[y,T]);return(0,i.useEffect)(function(){w()},[w]),(0,i.useEffect)(function(){var n,t=function(n){!n||"dark"!==n.theme&&"light"!==n.theme||b(n.theme)},e=u();return null===(n=e.onThemeChange)||void 0===n||n.call(e,t),function(){var n;null===(n=e.offThemeChange)||void 0===n||n.call(e,t)}},[b]),(0,i.useEffect)(function(){if("auto"===g){var n=setInterval(function(){try{var n=u().getAppBaseInfo(),t="dark"===n.theme?"dark":"light";t!==S.current&&b(t)}catch(n){}},2e3);return function(){return clearInterval(n)}}},[g,b]),(0,i.useEffect)(function(){u().eventCenter.trigger(f,y)},[y]),(0,i.useEffect)(function(){(0,s.G)(y)},[y]),(0,o.useDidShow)(function(){"auto"===g&&w()}),(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(c.Ss,{className:"system-theme-detector"}),(0,l.jsx)(d.Provider,{value:{theme:g,resolvedTheme:y,toggleTheme:C,setTheme:T},children:t})]})}function g(){return(0,i.useContext)(d)}},9201:function(n,t,e){e.d(t,{c:function(){return a}});var r=e(5544),i=e(6540),o=e(758),u=e.n(o),c=null;function a(){var n=(0,i.useState)(null!==c&&void 0!==c?c:{statusBarHeight:20,menuButtonTop:26,menuButtonHeight:32,capsuleRight:368,safeInsetTop:20,safeInsetBottom:0,headerPaddingTop:66,backBtnPaddingTop:20}),t=(0,r.A)(n,2),e=t[0],o=t[1];return(0,i.useEffect)(function(){if(c)o(c);else try{var n,t,e,r,i,a,s,l,d=u().getSystemInfoSync(),f=u().getMenuButtonBoundingClientRect(),p=d.statusBarHeight||20,g=null!==(n=f.top)&&void 0!==n?n:p+4,h=null!==(t=f.height)&&void 0!==t?t:32,m=null!==(e=f.right)&&void 0!==e?e:d.windowWidth-7,v=null!==(r=null===(i=d.safeArea)||void 0===i?void 0:i.top)&&void 0!==r?r:p,y=null!==(a=d.safeAreaInsetBottom)&&void 0!==a?a:d.screenHeight-(null!==(s=null===(l=d.safeArea)||void 0===l?void 0:l.bottom)&&void 0!==s?s:d.screenHeight),A=Math.max(g+h+6,p+44),S=Math.max(p,g-4),k={statusBarHeight:p,menuButtonTop:g,menuButtonHeight:h,capsuleRight:m,safeInsetTop:v,safeInsetBottom:y,headerPaddingTop:A,backBtnPaddingTop:S};c=k,o(k)}catch(n){}},[]),e}},5414:function(n,t,e){e.d(t,{l:function(){return c}});var r=e(6540),i=e(758),o=e.n(i),u=e(6606);function c(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=t.mode,c=void 0===e?"auto":e,a=(0,r.useCallback)(function(){var t="dark"===c||"auto"===c&&"light"===n,e=t?"#000000":"#ffffff",r=t?"#faf7f2":"#191919";o().setNavigationBarColor({frontColor:e,backgroundColor:r}),(0,u.G)(n,r)},[c,n]);(0,r.useEffect)(a,[a]),(0,i.useDidShow)(a)}},6845:function(n,t,e){e.d(t,{FR:function(){return y},x9:function(){return I},l8:function(){return W},ab:function(){return b},p8:function(){return E},ls:function(){return m},rP:function(){return N},jp:function(){return d},gf:function(){return o.gf},xZ:function(){return L},iD:function(){return u},ri:function(){return a},x5:function(){return V},W$:function(){return O},yU:function(){return S},i5:function(){return D},r7:function(){return s}});var r=e(1212),i=e(467),o=e(3246);function u(n){return c.apply(this,arguments)}function c(){return c=(0,i.A)((0,r.A)().m(function n(t){var e;return(0,r.A)().w(function(n){while(1)switch(n.n){case 0:return n.n=1,o.Ay.post("/api/auth/login",{code:t},{auth:!1});case 1:return e=n.v,null!==e&&void 0!==e&&e.accessToken&&(0,o.WG)(e.accessToken),n.a(2,e)}},n)})),c.apply(this,arguments)}function a(){(0,o.L)()}function s(n){return l.apply(this,arguments)}function l(){return l=(0,i.A)((0,r.A)().m(function n(t){return(0,r.A)().w(function(n){while(1)switch(n.n){case 0:return n.a(2,o.Ay.patch("/api/users/me",t))}},n)})),l.apply(this,arguments)}function d(){return f.apply(this,arguments)}function f(){return f=(0,i.A)((0,r.A)().m(function n(){return(0,r.A)().w(function(n){while(1)switch(n.n){case 0:return n.a(2,o.Ay.get("/api/users/me"))}},n)})),f.apply(this,arguments)}var p=e(5544);function g(n){return{id:n.id,name:n.name,phone:n.phone,region:[n.province,n.city,n.district],detail:n.detail,isDefault:n.isDefault,createdAt:n.createdAt}}function h(n){var t={};if(void 0!==n.name&&(t.name=n.name),void 0!==n.phone&&(t.phone=n.phone),void 0!==n.region){var e=(0,p.A)(n.region,3),r=e[0],i=void 0===r?"":r,o=e[1],u=void 0===o?"":o,c=e[2],a=void 0===c?"":c;t.province=i,t.city=u,t.district=a}return void 0!==n.detail&&(t.detail=n.detail),void 0!==n.isDefault&&(t.isDefault=n.isDefault),t}function m(){return v.apply(this,arguments)}function v(){return v=(0,i.A)((0,r.A)().m(function n(){var t;return(0,r.A)().w(function(n){while(1)switch(n.n){case 0:return n.n=1,o.Ay.get("/api/addresses");case 1:return t=n.v,n.a(2,(t||[]).map(g))}},n)})),v.apply(this,arguments)}function y(n){return A.apply(this,arguments)}function A(){return A=(0,i.A)((0,r.A)().m(function n(t){var e;return(0,r.A)().w(function(n){while(1)switch(n.n){case 0:return n.n=1,o.Ay.post("/api/addresses",h(t));case 1:return e=n.v,n.a(2,g(e))}},n)})),A.apply(this,arguments)}function S(n,t){return k.apply(this,arguments)}function k(){return k=(0,i.A)((0,r.A)().m(function n(t,e){var i;return(0,r.A)().w(function(n){while(1)switch(n.n){case 0:return n.n=1,o.Ay.patch("/api/addresses/".concat(t),h(e));case 1:return i=n.v,n.a(2,g(i))}},n)})),k.apply(this,arguments)}function b(n){return w.apply(this,arguments)}function w(){return w=(0,i.A)((0,r.A)().m(function n(t){return(0,r.A)().w(function(n){while(1)switch(n.n){case 0:return n.n=1,o.Ay.del("/api/addresses/".concat(t));case 1:return n.a(2)}},n)})),w.apply(this,arguments)}var T=e(9379),C={DRAFT:"undesigned",SUBMITTED:"designing",PROCESSING:"processing",DONE:"ordered"};function x(n){var t,e,r,i,o=n.items&&n.items[0];return{id:n.id,productId:null!==(t=null===o||void 0===o?void 0:o.productId)&&void 0!==t?t:"",productName:(null===o||void 0===o?void 0:o.productName)||n.title,unitPrice:null!==(e=null===o||void 0===o?void 0:o.unitPrice)&&void 0!==e?e:0,count:null!==(r=null===o||void 0===o?void 0:o.count)&&void 0!==r?r:1,status:null!==(i=C[n.status])&&void 0!==i?i:"undesigned",designData:null===o||void 0===o?void 0:o.designData,createdAt:(n.createdAt||"").slice(0,10)}}function N(){return _.apply(this,arguments)}function _(){return _=(0,i.A)((0,r.A)().m(function n(){var t;return(0,r.A)().w(function(n){while(1)switch(n.n){case 0:return n.n=1,o.Ay.get("/api/design-list");case 1:return t=n.v,n.a(2,(t||[]).map(x))}},n)})),_.apply(this,arguments)}function I(n){return B.apply(this,arguments)}function B(){return B=(0,i.A)((0,r.A)().m(function n(t){var e;return(0,r.A)().w(function(n){while(1)switch(n.n){case 0:return n.n=1,o.Ay.post("/api/design-list",{title:t.productName,items:[(0,T.A)({productId:t.productId,productName:t.productName,unitPrice:t.unitPrice,count:t.count},void 0!==t.designData?{designData:t.designData}:{})]});case 1:return e=n.v,n.a(2,x(e))}},n)})),B.apply(this,arguments)}function D(n,t){return j.apply(this,arguments)}function j(){return j=(0,i.A)((0,r.A)().m(function n(t,e){var i,u;return(0,r.A)().w(function(n){while(1)switch(n.n){case 0:return i={},void 0!==e.title&&(i.title=e.title),void 0!==e.status&&(i.status="SUBMITTED"),void 0!==e.item&&(i.items=[(0,T.A)({productId:e.item.productId,productName:e.item.productName,unitPrice:e.item.unitPrice,count:e.item.count},void 0!==e.item.designData?{designData:e.item.designData}:{})]),n.n=1,o.Ay.patch("/api/design-list/".concat(t),i);case 1:return u=n.v,n.a(2,x(u))}},n)})),j.apply(this,arguments)}function E(n){return P.apply(this,arguments)}function P(){return P=(0,i.A)((0,r.A)().m(function n(t){var e,i;return(0,r.A)().w(function(n){while(1)switch(n.n){case 0:return n.n=1,o.Ay.post("/api/design-list/batch-delete",{ids:t});case 1:return i=n.v,n.a(2,null!==(e=null===i||void 0===i?void 0:i.deleted)&&void 0!==e?e:0)}},n)})),P.apply(this,arguments)}var R=e(4765),M=e(758),q=e.n(M);function F(n,t,e,r){return H.apply(this,arguments)}function H(){return H=(0,i.A)((0,r.A)().m(function n(t,e,i,u){var c,a;return(0,r.A)().w(function(n){while(1)switch(n.p=n.n){case 0:return n.n=1,q().uploadFile({url:"".concat(o.C1).concat(t),filePath:e,name:i,formData:u,header:{Authorization:"Bearer ".concat((0,o.gf)())}});case 1:c=n.v,n.p=2,a=JSON.parse(c.data),n.n=4;break;case 3:throw n.p=3,n.v,new Error("\u7f51\u7edc\u5f02\u5e38\uff0c\u8bf7\u7a0d\u540e\u91cd\u8bd5");case 4:if(!a||"number"!==typeof a.code||0===a.code){n.n=5;break}throw new Error(a.message||"\u8bf7\u6c42\u5931\u8d25");case 5:return n.a(2,a&&"number"===typeof a.code?a.data:a)}},n,null,[[2,3]])})),H.apply(this,arguments)}function U(n){return o.Ay.get("/api/upload/credentials?key=".concat(encodeURIComponent(n)))}function Y(n,t){return G.apply(this,arguments)}function G(){return G=(0,i.A)((0,r.A)().m(function n(t,e){var i,o;return(0,r.A)().w(function(n){while(1)switch(n.n){case 0:if(e.presignedUrl){n.n=1;break}throw new Error("\u83b7\u53d6 COS \u76f4\u4f20\u5730\u5740\u5931\u8d25");case 1:return i=q().getFileSystemManager(),o=i.readFileSync(t),n.n=2,q().request({url:e.presignedUrl,method:"PUT",data:o,header:{"Content-Type":"application/octet-stream"}});case 2:return n.a(2,e.presignedUrl.split("?")[0])}},n)})),G.apply(this,arguments)}function O(n){return F("/api/sketch",n,"image")}function W(n,t,e){return F("/api/wordcloud/generate",n,"image",(0,T.A)({names:t},e?{params:JSON.stringify(e)}:{}))}function L(n){return o.Ay.get("/api/wordcloud/jobs/".concat(n))}function Q(n){return!!n&&/^(wxfile:|http:\/\/tmp\/|tmp\/)/i.test(n)}function z(n){return J.apply(this,arguments)}function J(){return J=(0,i.A)((0,r.A)().m(function n(t){var e,i;return(0,r.A)().w(function(n){while(1)switch(n.p=n.n){case 0:return n.p=0,e="uploads/sticker/".concat(Date.now(),"_").concat(Math.floor(1e6*Math.random()),".jpg"),n.n=1,U(e);case 1:return i=n.v,n.n=2,Y(t,i);case 2:return n.a(2,n.v);case 3:return n.p=3,n.v,n.a(2,t)}},n,null,[[0,3]])})),J.apply(this,arguments)}function V(n){return Z.apply(this,arguments)}function Z(){return Z=(0,i.A)((0,r.A)().m(function n(t){var e,i,o,u,c,a,s,l,d,f,p,g,h,m,v,y;return(0,r.A)().w(function(n){while(1)switch(n.p=n.n){case 0:if(t){n.n=1;break}return n.a(2,t);case 1:if(e=(0,T.A)({},t),!t.background||!Q(t.background.src)){n.n=3;break}return a=T.A,s=(0,T.A)({},t.background),l={},n.n=2,z(t.background.src);case 2:d=n.v,e.background=a(s,l,{src:d});case 3:if(!t.stickers||!t.stickers.length){n.n=14;break}i=[],o=(0,R.A)(t.stickers),n.p=4,o.s();case 5:if((u=o.n()).done){n.n=10;break}if(c=u.value,f=i,!Q(c.src)){n.n=7;break}return g=T.A,h=(0,T.A)({},c),m={},n.n=6,z(c.src);case 6:v=n.v,p=g(h,m,{src:v}),n.n=8;break;case 7:p=c;case 8:f.push.call(f,p);case 9:n.n=5;break;case 10:n.n=12;break;case 11:n.p=11,y=n.v,o.e(y);case 12:return n.p=12,o.f(),n.f(12);case 13:e.stickers=i;case 14:return n.a(2,e)}},n,null,[[4,11,12,13]])})),Z.apply(this,arguments)}},8199:function(n,t,e){e.d(t,{uq:function(){return i}});var r="https://wordcloudwechat.oss-cn-hangzhou.aliyuncs.com";function i(n){if(!n)return"";if(/^(https?:|wxfile:|data:)/i.test(n))return n;if(!r)return n;var t=r.replace(/\/+$/,"");if(!n.startsWith("/img/"))return n;var e=n.startsWith("/")?n:"/".concat(n);return"".concat(t).concat(e)}},6764:function(n,t,e){e.d(t,{d:function(){return y},m:function(){return g}});var r=e(1212),i=e(467),o=e(2284),u=e(758),c=e.n(u),a=e(6845),s=e(1457),l="smart_auth_verified",d=18e5,f=null,p=null;function g(){f=null,p=null;try{c().removeStorageSync(l)}catch(n){}}function h(n){var t=f||function(){try{var n=c().getStorageSync(l);return n&&"object"===(0,o.A)(n)?n:null}catch(n){return null}}();return t&&t.openid===n?Date.now()-t.at>d?null:(f=t,t.ok):null}function m(n,t){var e={openid:n,ok:t,at:Date.now()};f=e;try{c().setStorageSync(l,e)}catch(n){}}function v(){var n=(0,s.Q4)();return!(null===n||void 0===n||!n.openid)&&!(0,s.Ic)(n.openid)&&!!n.accessToken&&!!(0,a.gf)()}function y(){return A.apply(this,arguments)}function A(){return A=(0,i.A)((0,r.A)().m(function n(){var t,e;return(0,r.A)().w(function(n){while(1)switch(n.n){case 0:if(t=(0,s.Q4)(),null!==t&&void 0!==t&&t.openid){n.n=1;break}return console.log("[AuthGuard] \u65e0\u672c\u5730\u7528\u6237\uff0c\u5224\u5b9a\u672a\u767b\u5f55"),n.a(2,!1);case 1:if(console.log("[AuthGuard] \u672c\u5730\u7528\u6237 openid=",t.openid),!(0,s.Ic)(t.openid)){n.n=2;break}return(0,s.Hf)(),(0,a.ri)(),g(),n.a(2,!1);case 2:if(e=h(t.openid),null===e){n.n=3;break}return console.log("[AuthGuard] \u547d\u4e2d\u672c\u5730\u7f13\u5b58 ok=",e),n.a(2,e);case 3:return p||(p=(0,a.jp)().then(function(n){console.log("[AuthGuard] getMe \u8fd4\u56de:",JSON.stringify(n));var e=!!n&&!!n.id&&n.openid===t.openid;return console.log("[AuthGuard] \u4e00\u81f4\u6027=",e),e?(m(t.openid,!0),!0):((0,s.Hf)(),(0,a.ri)(),g(),!1)}).catch(function(n){return console.error("[AuthGuard] getMe \u5931\u8d25\uff0c\u8d70\u672c\u5730\u4f1a\u8bdd\u515c\u5e95:",n),v()}).finally(function(){p=null})),n.a(2,p)}},n)})),A.apply(this,arguments)}},5234:function(n,t,e){e.d(t,{QE:function(){return l},R6:function(){return c},rj:function(){return s},y9:function(){return a},zv:function(){return u}});var r=e(9379),i=e(8199),o=[{id:"notebook-small",name:"\u5fae\u96d5\u7b14\u8bb0\u672c\uff08\u5c0f\uff09",desc:"\u4fbf\u643a\u968f\u884c\uff0c\u8bb0\u5f55\u70b9\u6ef4",icon:"/icon/\u4e66\u672c.png",iconImg:"/icon/\u4e66\u672c.png",price:12,originalPrice:18,leadTime:"3-5\u4e2a\u5de5\u4f5c\u65e5",description:"\u7cbe\u9009\u4f18\u8d28\u7eb8\u5f20\uff0c\u5c01\u9762\u91c7\u7528\u9ad8\u6863PU\u6750\u8d28\uff0c\u624b\u611f\u7ec6\u817b\u3002\u5185\u9875\u53ef\u5b9a\u5236\u6a2a\u7ebf\u3001\u65b9\u683c\u6216\u7a7a\u767d\u4e09\u79cd\u7248\u5f0f\u3002\u6fc0\u5149\u5fae\u96d5\u5de5\u827a\u5c06\u540d\u5b57\u6216\u56fe\u6848\u7cbe\u51c6\u523b\u5370\u5728\u5c01\u9762\uff0c\u6c38\u4e0d\u892a\u8272\u3002\u5c0f\u5de7\u8f7b\u4fbf\uff0c\u9002\u5408\u968f\u8eab\u643a\u5e26\uff0c\u65e0\u8bba\u662f\u8bfe\u5802\u7b14\u8bb0\u8fd8\u662f\u65e5\u5e38\u5907\u5fd8\uff0c\u90fd\u662f\u4f60\u7684\u4e13\u5c5e\u4f34\u4fa3\u3002",subtitle:"\u638c\u5fc3\u95f4\u7684\u4e13\u5c5e\u5370\u8bb0 \xb7 \u6fc0\u5149\u5fae\u96d5 \xb7 \u4e09\u8272\u5185\u9875\u53ef\u9009",tone:[28,22,18],story:"\u7075\u611f\u6e90\u81ea\u624b\u8d26\u6587\u5316\u4e2d\u5bf9\u4e66\u5199\u4eea\u5f0f\u611f\u7684\u8ffd\u6c42\u3002\u6211\u4eec\u76f8\u4fe1\uff0c\u5728\u6570\u5b57\u6d2a\u6d41\u7684\u65f6\u4ee3\uff0c\u7eb8\u7b14\u7684\u6e29\u5ea6\u4f9d\u7136\u4e0d\u53ef\u66ff\u4ee3\u3002\u5f53\u6fc0\u5149\u5fae\u96d5\u5728PU\u5c01\u9762\u4e0a\u7559\u4e0b\u4e13\u5c5e\u5370\u8bb0\uff0c\u6bcf\u4e00\u7b14\u4e66\u5199\u90fd\u5728\u4e0e\u8fc7\u53bb\u5bf9\u8bdd\u3002\u7b14\u8bb0\u672c\u5c0f\u5de7\u5230\u8db3\u4ee5\u653e\u5165\u4efb\u4f55\u53e3\u888b\uff0c\u5374\u627f\u8f7d\u7740\u72ec\u4e00\u65e0\u4e8c\u7684\u8bb0\u5fc6\u3002",scene:"\u8bfe\u5802\u7b14\u8bb0\u3001\u65e5\u5e38\u5907\u5fd8\u3001\u65c5\u884c\u624b\u8d26\u3001\u5fc3\u60c5\u65e5\u8bb0\u3002\u9002\u5408\u9001\u7ed9\u540c\u5b66\u3001\u4f34\u4fa3\u6216\u4f5c\u4e3a\u6d3b\u52a8\u4f34\u624b\u793c\u2014\u2014\u8ba9\u6bcf\u4e00\u4e2a\u4eba\u90fd\u62e5\u6709\u523b\u7740\u81ea\u5df1\u540d\u5b57\u7684\u4e13\u5c5e\u7b14\u8bb0\u672c\u3002",tags:["\u4f34\u624b\u793c","\u5b66\u751f","\u624b\u8d26","\u4fbf\u643a","\u6fc0\u5149\u5fae\u96d5"],specs:[["\u5c3a\u5bf8","105 \xd7 148mm\uff08A6\uff09"],["\u9875\u6570","120\u5f20/240\u9875"],["\u5185\u9875\u7248\u5f0f","\u6a2a\u7ebf / \u65b9\u683c / \u7a7a\u767d \u53ef\u9009"],["\u5c01\u9762\u6750\u8d28","\u9ad8\u6863PU\u76ae\u9769"],["\u96d5\u523b\u5de5\u827a","CO2 \u6fc0\u5149\u5fae\u96d5\uff08\u6c38\u4e0d\u892a\u8272\uff09"],["\u9002\u7528\u573a\u666f","\u8bfe\u5802\u3001\u65c5\u884c\u3001\u65e5\u5e38\u5907\u5fd8"]],images:["/img/book_small/The1.jpg"],mask:{shape:"rect",width:300,height:420,borderRadius:8}},{id:"notebook-large",name:"\u5fae\u96d5\u7b14\u8bb0\u672c\uff08\u5927\uff09",desc:"\u5927\u5f00\u672c\uff0c\u66f4\u591a\u521b\u4f5c\u7a7a\u95f4",icon:"/icon/\u4e66\u672c_\u5927.png",iconImg:"/icon/\u4e66\u672c_\u5927.png",price:45,originalPrice:58,leadTime:"3-5\u4e2a\u5de5\u4f5c\u65e5",description:"A4\u5c3a\u5bf8\u5927\u5f00\u672c\uff0c180\xb0\u5e73\u644a\u8bbe\u8ba1\uff0c\u4e66\u5199\u66f4\u81ea\u7531\u3002\u5c01\u9762\u53ef\u9009\u771f\u76ae\u3001\u4eff\u5e03\u7eb9\u6216\u78e8\u7802\u6750\u8d28\uff0c\u6fc0\u5149\u5fae\u96d5\u533a\u57df\u66f4\u5927\uff0c\u9002\u5408\u5448\u73b0\u5168\u73ed\u540d\u5b57\u3001\u56e2\u961f\u53e3\u53f7\u6216\u516c\u53f8Logo\u7b49\u5927\u7bc7\u5e45\u5185\u5bb9\u3002\u662f\u6bd5\u4e1a\u7eaa\u5ff5\u3001\u4f01\u4e1a\u5e74\u4f1a\u793c\u54c1\u7684\u9996\u9009\u3002",subtitle:"\u5927\u7bc7\u5e45\u5b9a\u5236\u9996\u9009 \xb7 180\xb0\u5e73\u644a \xb7 \u6bd5\u4e1a/\u56e2\u5efa\u5fc5\u5907",tone:[35,28,22],story:"\u6bcf\u4e00\u6b21\u544a\u522b\u90fd\u503c\u5f97\u88ab\u90d1\u91cd\u4e66\u5199\u3002\u6bd5\u4e1a\u5b63\u7684\u6559\u5ba4\u91cc\uff0c\u7b14\u8bb0\u672c\u644a\u5f00\u5728\u8bfe\u684c\u4e0a\uff0c\u5168\u73ed\u7684\u540d\u5b57\u88ab\u6fc0\u5149\u523b\u5370\u5728\u5c01\u9762\u4e2d\u592e\uff0c\u6210\u4e3a\u6c38\u6052\u7684\u540c\u5b66\u5f55\u3002180\xb0\u5e73\u644a\u8bbe\u8ba1\u8ba9\u4e66\u5199\u4e0d\u518d\u88ab\u8ba2\u88c5\u675f\u7f1a\uff0cA4\u5927\u5c3a\u5bf8\u7ed9\u4f60\u5c3d\u60c5\u6325\u6d12\u7684\u5929\u5730\u3002\u8fd9\u662f\u9001\u7ed9\u4e00\u7fa4\u4eba\u6700\u597d\u7684\u544a\u522b\u793c\u7269\u3002",scene:"\u6bd5\u4e1a\u7eaa\u5ff5\u518c\u3001\u516c\u53f8\u5e74\u4f1a\u793c\u54c1\u3001\u56e2\u961f\u5efa\u8bbe\u4f34\u624b\u793c\u3001\u5ba2\u6237\u7b54\u8c22\u3002\u7279\u522b\u9002\u5408\u9700\u8981\u5728\u5c01\u9762\u5448\u73b0\u5927\u91cf\u6587\u5b57\u6216\u56fe\u6848\u7684\u5b9a\u5236\u9700\u6c42\u2014\u2014\u73ed\u7ea7\u540d\u5355\u3001\u516c\u53f8\u613f\u666f\u3001\u56e2\u961f\u53e3\u53f7\u4e00\u7f51\u6253\u5c3d\u3002",tags:["\u6bd5\u4e1a\u793c","\u56e2\u5efa","\u4f01\u4e1a\u5b9a\u5236","\u5927\u7bc7\u5e45","\u5e73\u644a\u8bbe\u8ba1"],specs:[["\u5c3a\u5bf8","210 \xd7 297mm\uff08A4\uff09"],["\u9875\u6570","100\u5f20/200\u9875"],["\u5c01\u9762\u6750\u8d28","\u771f\u76ae / \u4eff\u5e03\u7eb9 / \u78e8\u7802 \u53ef\u9009"],["\u5f00\u5408\u9002\u7528","180\xb0\u5e73\u644a\u8bbe\u8ba1"],["\u96d5\u523b\u5de5\u827a","CO2 \u6fc0\u5149\u5fae\u96d5\uff08\u9ad8\u6e05\u6670\u5ea6\uff09"],["\u5b9a\u5236\u9762\u79ef","\u5c01\u9762\u6574\u9762\u53ef\u96d5"]],images:["/img/book_big/The1.jpg","/img/book_big/The2.jpg"],mask:{shape:"rect",width:340,height:480,borderRadius:8}},{id:"coaster",name:"\u94dc\u8d28\u676f\u57ab",desc:"\u91d1\u5c5e\u8d28\u611f\uff0c\u684c\u9762\u827a\u672f",icon:"/icon/\u676f\u5b50.png",iconImg:"/icon/\u676f\u5b50.png",price:25,originalPrice:35,leadTime:"5-7\u4e2a\u5de5\u4f5c\u65e5",description:"\u91c7\u7528\u4f18\u8d28\u9ec4\u94dc\u6750\u8d28\uff0c\u8868\u9762\u7ecf\u62c9\u4e1d\u5de5\u827a\u5904\u7406\uff0c\u5448\u73b0\u54d1\u5149\u91d1\u5c5e\u8d28\u611f\u3002\u80cc\u9762\u914d\u6709\u9632\u6ed1\u8f6f\u6728\u57ab\uff0c\u4fdd\u62a4\u684c\u9762\u540c\u65f6\u9632\u6b62\u6ed1\u52a8\u3002\u6fc0\u5149\u5fae\u96d5\u53ef\u5728\u8868\u9762\u523b\u5370\u540d\u5b57\u3001\u65e5\u671f\u6216\u795d\u798f\u8bed\uff0c\u662f\u4e54\u8fc1\u65b0\u5c45\u3001\u65b0\u5a5a\u8d3a\u793c\u7684\u7cbe\u81f4\u4e4b\u9009\u3002",subtitle:"\u9ec4\u94dc\u8d28\u611f \xb7 \u62c9\u4e1d\u54d1\u5149 \xb7 \u684c\u9762\u4e0a\u7684\u5fae\u578b\u96d5\u5851",tone:[42,30,18],story:"\u8bbe\u8ba1\u7075\u611f\u6765\u81ea\u65e5\u5f0f\u4f98\u5bc2\u7f8e\u5b66\u3002\u5c81\u6708\u4f1a\u5728\u9ec4\u94dc\u8868\u9762\u7559\u4e0b\u6e29\u67d4\u7684\u6c27\u5316\u75d5\u8ff9\uff0c\u5c31\u5982\u540c\u4e00\u676f\u8336\u4ece\u70ed\u5230\u51c9\u7684\u8fc7\u7a0b\u3002\u62c9\u4e1d\u5904\u7406\u540e\u7684\u54d1\u5149\u8868\u9762\u5728\u706f\u5149\u4e0b\u5448\u73b0\u7ec6\u817b\u7684\u91d1\u5c5e\u7eb9\u7406\uff0c\u6fc0\u5149\u5fae\u96d5\u7684\u540d\u5b57\u6210\u4e3a\u8fd9\u4ef6\u5668\u7269\u4e0a\u6700\u51b7\u9759\u7684\u6ce8\u811a\u3002\u5b83\u4e0d\u53ea\u662f\u676f\u57ab\uff0c\u66f4\u662f\u684c\u9762\u4e0a\u7684\u5fae\u578b\u96d5\u5851\u3002",scene:"\u4e54\u8fc1\u9001\u793c\u3001\u65b0\u5a5a\u8d3a\u793c\u3001\u5496\u5561\u89d2\u5e03\u7f6e\u3001\u529e\u516c\u684c\u7f8e\u5b66\u3002\u9002\u5408\u9001\u7ed9\u559c\u6b22\u624b\u51b2\u5496\u5561\u7684\u670b\u53cb\uff0c\u6216\u4f5c\u4e3a\u5a5a\u793c\u5bbe\u5ba2\u7684\u56de\u793c\u2014\u2014\u6bcf\u4e00\u53ea\u676f\u57ab\u4e0a\u90fd\u523b\u7740\u5bbe\u5ba2\u7684\u540d\u5b57\uff0c\u8ba9\u793c\u7269\u672c\u8eab\u6210\u4e3a\u5ea7\u4f4d\u5361\u3002",tags:["\u4e54\u8fc1\u793c","\u65b0\u5a5a\u8d3a\u793c","\u684c\u9762\u7f8e\u5b66","\u9ec4\u94dc","\u624b\u51b2\u5496\u5561"],specs:[["\u6750\u8d28","\u9ec4\u94dc + \u80cc\u9762\u8f6f\u6728\u9632\u6ed1\u57ab"],["\u8868\u9762\u5904\u7406","\u62c9\u4e1d\u54d1\u5149"],["\u76f4\u5f84","100mm"],["\u539a\u5ea6","3mm"],["\u96d5\u523b\u5de5\u827a","\u5149\u7ea4\u6fc0\u5149\u7cbe\u7ec6\u5fae\u96d5"],["\u8010\u6e29","\u2264120\xb0C"]],images:["/img/cup/The1.jpg"],mask:{shape:"circle",width:280,height:280}},{id:"penbox",name:"\u7af9\u5236\u7b14\u76d2",desc:"\u81ea\u7136\u7af9\u7eb9\uff0c\u6587\u623f\u96c5\u5668",icon:"/icon/\u7b14\u76d2.png",iconImg:"/icon/\u7b14\u76d2.png",price:75,originalPrice:98,leadTime:"7-10\u4e2a\u5de5\u4f5c\u65e5",description:"\u7cbe\u9009\u5929\u7136\u6960\u7af9\uff0c\u7ecf\u591a\u9053\u5de5\u5e8f\u6253\u78e8\u629b\u5149\uff0c\u4fdd\u7559\u5929\u7136\u7af9\u7eb9\u808c\u7406\u3002\u76d2\u76d6\u91c7\u7528\u78c1\u5438\u5f00\u5408\uff0c\u5185\u90e8\u8bbe\u6709\u5206\u5c42\u9694\u677f\u3002\u6fc0\u5149\u5fae\u96d5\u5728\u7af9\u9762\u4e0a\u5448\u73b0\u6df1\u6d45\u4e0d\u4e00\u7684\u96d5\u523b\u6548\u679c\uff0c\u878d\u5165\u58a8\u9999\u6c14\u8d28\u3002\u9002\u5408\u4e66\u623f\u6848\u5934\u3001\u4e66\u6cd5\u7231\u597d\u8005\u7684\u6587\u623f\u4f34\u4fa3\u3002",subtitle:"\u5929\u7136\u6960\u7af9 \xb7 \u78c1\u5438\u5f00\u5408 \xb7 \u6587\u623f\u96c5\u5668\u4e4b\u9009",tone:[30,24,16],story:"\u6bcf\u4e00\u53ea\u7b14\u76d2\u90fd\u6765\u81ea\u540c\u4e00\u7247\u7af9\u6797\u7684\u4e0d\u540c\u90e8\u4f4d\uff0c\u56e0\u6b64\u7eb9\u8def\u7edd\u4e0d\u91cd\u590d\u2014\u2014\u6b63\u5982\u6ca1\u6709\u4e24\u4e2a\u4eba\u7684\u4e66\u6cd5\u98ce\u683c\u5b8c\u5168\u76f8\u540c\u3002\u6211\u4eec\u4fdd\u7559\u4e86\u6960\u7af9\u5929\u7136\u7684\u6e29\u6da6\u89e6\u611f\uff0c\u53ea\u5728\u8868\u9762\u4ee5\u6fc0\u5149\u523b\u4e0b\u540d\u5b57\u6216\u4e00\u53e5\u7bb4\u8a00\u3002\u6253\u5f00\u78c1\u5438\u76d2\u76d6\u65f6\u7684\u6e05\u8106\u58f0\u54cd\uff0c\u662f\u6587\u623f\u4e2d\u7684\u5c0f\u5c0f\u4eea\u5f0f\u3002",scene:"\u4e66\u623f\u6848\u5934\u3001\u4e66\u6cd5\u7231\u597d\u8005\u88c5\u5907\u3001\u6559\u5e08\u8282\u793c\u7269\u3001\u4e66\u623f\u6696\u623f\u793c\u3002\u9002\u5408\u9001\u7ed9\u5199\u5b57\u597d\u770b\u7684\u4eba\u2014\u2014\u56e0\u4e3a\u61c2\u4e66\u5199\u7684\u4eba\uff0c\u624d\u61c2\u4e00\u53ea\u597d\u7b14\u76d2\u7684\u5206\u91cf\u3002",tags:["\u6587\u623f","\u4e66\u6cd5","\u6559\u5e08\u8282","\u4e66\u623f","\u5929\u7136\u6750\u8d28"],specs:[["\u6750\u8d28","\u5929\u7136\u6960\u7af9"],["\u5f00\u5408\u65b9\u5f0f","\u78c1\u5438\u5f0f\u76d2\u76d6"],["\u5185\u90e8\u7ed3\u6784","\u5206\u5c42\u9694\u677f\uff08\u53ef\u8c03\u8282\uff09"],["\u5c3a\u5bf8","200 \xd7 65 \xd7 30mm"],["\u8868\u9762\u5904\u7406","\u624b\u5de5\u6253\u78e8\u629b\u5149\uff0c\u65e0\u6f06"],["\u96d5\u523b\u5de5\u827a","CO2 \u6fc0\u5149\u70e7\u8680\uff08\u6df1\u6d45\u53ef\u8c03\uff09"]],images:["/img/penbox/The1.jpg","/img/penbox/The2.jpg","/img/penbox/The3.jpg"],mask:{shape:"rect",width:320,height:160,borderRadius:12}},{id:"booklamp",name:"\u4e66\u672c\u578b\u706f",desc:"\u6e29\u6696\u5149\u5f71\uff0c\u70b9\u4eae\u5fc3\u610f",icon:"/icon/\u4e66\u706f.png",iconImg:"/icon/\u4e66\u706f.png",price:45,originalPrice:68,leadTime:"5-7\u4e2a\u5de5\u4f5c\u65e5",description:"\u5f00\u5408\u5f0f\u8bbe\u8ba1\uff0c\u6253\u5f00\u5373\u4eae\uff0c\u5408\u62e2\u5373\u706d\uff0c\u5982\u9b54\u6cd5\u4e66\u822c\u5145\u6ee1\u60ca\u559c\u3002\u91c7\u7528LED\u6696\u5149\u706f\u6e90\uff0c\u5149\u7ebf\u67d4\u548c\u4e0d\u523a\u773c\uff0c\u53ef\u6301\u7eed\u70b9\u4eae6-8\u5c0f\u65f6\u3002\u5c01\u9762\u6fc0\u5149\u5fae\u96d5\u53ef\u5b9a\u5236\u6587\u5b57\u3001\u56fe\u6848\u6216\u7167\u7247\uff0c\u8ba9\u6e29\u6696\u7684\u706f\u5149\u627f\u8f7d\u4e13\u5c5e\u8bb0\u5fc6\u3002\u662f\u60c5\u4fa3\u793c\u7269\u3001\u6bd5\u4e1a\u793c\u7269\u7684\u521b\u610f\u4e4b\u9009\u3002",subtitle:"\u5f00\u5408\u5373\u4eae \xb7 LED\u6696\u5149 \xb7 \u9b54\u6cd5\u4e66\u822c\u7684\u60ca\u559c",tone:[25,20,15],story:"\u7075\u611f\u6765\u81ea\u300a\u54c8\u5229\xb7\u6ce2\u7279\u300b\u4e2d\u7684\u9b54\u6cd5\u8bfe\u672c\u2014\u2014\u6253\u5f00\u4e00\u672c\u4e66\uff0c\u5149\u8292\u503e\u6cfb\u800c\u51fa\u3002\u6211\u4eec\u91c7\u7528\u675c\u90a6\u7eb8\u4e0e\u5b9e\u6728\u5c01\u9762\u7ed3\u5408\uff0c\u8ba9\u706f\u4f53\u65e2\u8f7b\u8584\u53c8\u575a\u56fa\u3002\u6fc0\u5149\u5fae\u96d5\u5728\u5c01\u9762\u7559\u4e0b\u4f60\u7684\u540d\u5b57\u6216\u4e00\u5e45\u5c0f\u753b\uff0c\u5f53\u706f\u5728\u6df1\u591c\u4eae\u8d77\uff0c\u90a3\u662f\u4e13\u5c5e\u4e8e\u4f60\u7684\u6e29\u6696\u89d2\u843d\u3002",scene:"\u60c5\u4fa3\u793c\u7269\u3001\u6bd5\u4e1a\u7eaa\u5ff5\u3001\u5e8a\u5934\u591c\u706f\u3001\u9732\u8425\u6c1b\u56f4\u706f\u3001\u513f\u7ae5\u623f\u3002\u7279\u522b\u9002\u5408\u5728\u5c01\u9762\u523b\u4e0a\u4e24\u4e2a\u4eba\u7684\u540d\u5b57\u548c\u4e00\u53e5\u60c5\u8bdd\uff0c\u5728\u60c5\u4eba\u8282\u6216\u7eaa\u5ff5\u65e5\u9001\u51fa\u2014\u2014\u6253\u5f00\u4e66\u706f\uff0c\u5c31\u50cf\u6253\u5f00\u4e00\u5c01\u4f1a\u53d1\u5149\u7684\u60c5\u4e66\u3002",tags:["\u60c5\u4fa3\u793c","\u6bd5\u4e1a\u7eaa\u5ff5","\u591c\u706f","\u6c1b\u56f4\u706f","\u521b\u610f\u793c\u7269"],specs:[["\u5149\u6e90","LED \u6696\u767d\u5149\uff083000K\uff09"],["\u7eed\u822a","6-8\u5c0f\u65f6\uff08\u5185\u7f6e\u53ef\u5145\u7535\u9502\u7535\u6c60\uff09"],["\u5145\u7535","USB Type-C \u63a5\u53e3"],["\u5c01\u9762\u6750\u8d28","\u675c\u90a6\u7eb8 + \u5b9e\u6728\u5c01\u9762"],["\u5c55\u5f00\u5c3a\u5bf8","210 \xd7 150mm"],["\u96d5\u523b\u5de5\u827a","\u6fc0\u5149\u5fae\u96d5\uff08\u652f\u6301\u6587\u5b57+\u7b80\u5355\u56fe\u6848\uff09"]],images:["/img/booklight/The1.jpg","/img/booklight/The2.jpg"],mask:{shape:"rect",width:320,height:240,borderRadius:4}}],u=o.map(function(n){return(0,r.A)((0,r.A)({},n),{},{images:(n.images||[]).map(function(n){return(0,i.uq)(n)}),iconImg:(0,i.uq)(n.iconImg)})}),c=u,a=function(n){return u.find(function(t){return t.id===n})},s={"notebook-small":(0,i.uq)("/icon/\u4e66\u672c.png"),"notebook-large":(0,i.uq)("/icon/\u4e66\u672c_\u5927.png"),coaster:(0,i.uq)("/icon/\u676f\u5b50.png"),penbox:(0,i.uq)("/icon/\u7b14\u76d2.png"),booklamp:(0,i.uq)("/icon/\u4e66\u706f.png")};function l(n){return null!==n&&void 0!==n&&n.iconImg?(0,i.uq)(n.iconImg):null!==n&&void 0!==n&&n.id?(0,i.uq)(s[n.id]||"/icon/\u56db\u89d2\u661f.svg"):(0,i.uq)("/icon/\u56db\u89d2\u661f.svg")}},3246:function(n,t,e){e.d(t,{C1:function(){return a},L:function(){return p},Sy:function(){return l},WG:function(){return f},gf:function(){return d},q:function(){return m}});var r=e(1212),i=e(9379),o=e(467),u=e(758),c=e.n(u),a="https://wxbackend.tokenleaping.com",s="smart_access_token";function l(){try{c().hideLoading()}catch(n){}}function d(){try{return c().getStorageSync(s)||""}catch(n){return""}}function f(n){c().setStorageSync(s,n)}function p(){try{c().removeStorageSync(s)}catch(n){}}var g=null;var h=null;function m(n){h=n}function v(n,t,e,r){return y.apply(this,arguments)}function y(){return y=(0,o.A)((0,r.A)().m(function n(t,e,i,o){return(0,r.A)().w(function(n){while(1)switch(n.n){case 0:return n.a(2,c().request({url:"".concat(a).concat(t),method:e,data:i,header:o}))}},n)})),y.apply(this,arguments)}function A(n){return S.apply(this,arguments)}function S(){return S=(0,o.A)((0,r.A)().m(function n(t){var e,o,u,c,a,s,l,f,m,y,A,S,k,b,w,T,C,x,N=arguments;return(0,r.A)().w(function(n){while(1)switch(n.p=n.n){case 0:return e=N.length>1&&void 0!==N[1]?N[1]:{},o=e.method,u=void 0===o?"GET":o,c=e.data,a=e.headers,s=void 0===a?{}:a,l=e.auth,f=void 0===l||l,m=e.skipAuthRefresh,y=void 0!==m&&m,A=function(){var n=d();return(0,i.A)((0,i.A)({"Content-Type":"application/json"},f&&n?{Authorization:"Bearer ".concat(n)}:{}),s)},n.p=1,n.n=2,v(t,u,c,A());case 2:S=n.v,n.n=4;break;case 3:throw n.p=3,n.v,k=new Error("\u7f51\u7edc\u5f02\u5e38\uff0c\u8bf7\u7a0d\u540e\u91cd\u8bd5"),k.statusCode=-1,k;case 4:if(401!==S.statusCode||y||!h){n.n=9;break}return n.n=5,h();case 5:if(b=n.v,!b){n.n=9;break}return n.p=6,n.n=7,v(t,u,c,A());case 7:S=n.v,n.n=9;break;case 8:throw n.p=8,n.v,w=new Error("\u7f51\u7edc\u5f02\u5e38\uff0c\u8bf7\u7a0d\u540e\u91cd\u8bd5"),w.statusCode=-1,w;case 9:if(401!==S.statusCode){n.n=10;break}throw p(),null===(T=g)||void 0===T||T(),C=new Error("\u767b\u5f55\u5df2\u8fc7\u671f\uff0c\u8bf7\u91cd\u65b0\u767b\u5f55"),C.statusCode=401,C;case 10:if(x=S.data,!x||"number"!==typeof x.code||0===x.code){n.n=11;break}throw new Error(x.message||"\u8bf7\u6c42\u5931\u8d25");case 11:return n.a(2,x&&"number"===typeof x.code?x.data:x)}},n,null,[[6,8],[1,3]])})),S.apply(this,arguments)}var k={get:function(n,t){return A(n,(0,i.A)((0,i.A)({},t),{},{method:"GET"}))},post:function(n,t,e){return A(n,(0,i.A)((0,i.A)({},e),{},{method:"POST",data:t}))},put:function(n,t,e){return A(n,(0,i.A)((0,i.A)({},e),{},{method:"PUT",data:t}))},patch:function(n,t,e){return A(n,(0,i.A)((0,i.A)({},e),{},{method:"PATCH",data:t}))},del:function(n,t){return A(n,(0,i.A)((0,i.A)({},t),{},{method:"DELETE"}))}};t.Ay=k},1457:function(n,t,e){e.d(t,{E1:function(){return W},cY:function(){return A},Hf:function(){return P},kg:function(){return F},ab:function(){return Q},hG:function(){return U},IU:function(){return C},Re:function(){return G},EB:function(){return z},p_:function(){return v},n7:function(){return w},O4:function(){return V},ug:function(){return M},Q4:function(){return D},Ic:function(){return c},Q1:function(){return q},kh:function(){return k},eW:function(){return X},Rc:function(){return O},Fu:function(){return y},Rq:function(){return K},F0:function(){return Z},iA:function(){return R},iZ:function(){return H},yU:function(){return L},i5:function(){return S},uF:function(){return Y}});var r=e(758),i=e.n(r),o="smart_user_info",u="smart_active_openid";function c(n){return!!n&&(n.startsWith("mock_")||n.startsWith("mock-"))}function a(){var n,t=null;try{t=i().getStorageSync(o)}catch(n){t=null}var e=(null===(n=t)||void 0===n?void 0:n.openid)||i().getStorageSync(u)||"_guest_";return i().setStorageSync(u,e),e}function s(n){var t=a();return"".concat(n,"_").concat(t)}function l(n,t){return"".concat(n,"_").concat(t)}var d=e(6764),f=e(9379),p=e(436),g=e(8199),h=e(5234);function m(n){try{return i().getStorageSync(l("design_list",n))||[]}catch(n){return[]}}function v(){try{return i().getStorageSync(s("design_list"))||[]}catch(n){return[]}}function y(n){i().setStorageSync(s("design_list"),n)}function A(n,t){var e=v(),r=(0,g.uq)((null===n||void 0===n?void 0:n.iconImg)||h.rj[null===n||void 0===n?void 0:n.id]||"/icon/\u56db\u89d2\u661f.svg"),i={id:"DSG"+Date.now(),productId:n.id,productName:n.name,productIcon:r,unitPrice:n.price,count:t,status:"undesigned",createdAt:(new Date).toISOString().slice(0,10)};return y([].concat((0,p.A)(e),[i])),i}function S(n,t){var e=v(),r=e.findIndex(function(t){return t.id===n});-1!==r&&(e[r]=(0,f.A)((0,f.A)({},e[r]),t),y(e))}function k(n){var t=v().filter(function(t){return!n.includes(t.id)});y(t)}function b(n){try{return i().getStorageSync(l("order_list",n))||[]}catch(n){return[]}}function w(){try{return i().getStorageSync(s("order_list"))||[]}catch(n){return[]}}function T(n){i().setStorageSync(s("order_list"),n)}function C(n){var t,e=v(),r=w(),i=e.find(function(t){return t.id===n});if(!i)return null;var o=null!==(t=i.productIcon)&&void 0!==t&&t.startsWith("/icon/")||/^https?:/i.test(i.productIcon||"")?i.productIcon:h.rj[i.productId]||"/icon/\u56db\u89d2\u661f.svg",u=(0,g.uq)(o),c={id:"ORD"+Date.now().toString().slice(-9),productName:i.productName,productIcon:u,statusCode:"pending",date:(new Date).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).replace(/\//g,"-"),price:"\xa5"+(i.unitPrice*i.count).toFixed(2),count:i.count,sku:"".concat(i.productName," \xd7 ").concat(i.count)},a=e.findIndex(function(t){return t.id===n});return-1!==a&&(e[a].status="ordered",e[a].orderId=c.id),y(e),T([c].concat((0,p.A)(r))),c}var x="smart_user_registry",N="zhihui2024";function _(){try{return i().getStorageSync(x)||[]}catch(n){return[]}}function I(n){var t=_();t.includes(n)||(t.push(n),i().setStorageSync(x,t))}function B(n){var t=_().filter(function(t){return t!==n});i().setStorageSync(x,t)}function D(){try{return i().getStorageSync(o)}catch(n){return null}}function j(n){var t;i().setStorageSync(o,n),null!==n&&void 0!==n&&n.openid&&(i().setStorageSync(u,n.openid),i().setStorageSync("user_info_".concat(n.openid),n),I(n.openid)),(0,d.m)(),null===(t=i().eventCenter)||void 0===t||t.trigger("authStateChanged",{openid:(null===n||void 0===n?void 0:n.openid)||""})}function E(n){try{var t=i().getStorageSync("user_info_".concat(n));if(t)return t}catch(n){}var e=D();return(null===e||void 0===e?void 0:e.openid)===n?e:null}function P(){var n;i().removeStorageSync(o),i().removeStorageSync(u),(0,d.m)(),null===(n=i().eventCenter)||void 0===n||n.trigger("authStateChanged",{openid:""})}function R(n){j(n)}function M(){return D()}function q(){var n=_();return n.map(function(n){var t=E(n),e=m(n),r=b(n);return{openid:n,nickName:(null===t||void 0===t?void 0:t.nickName)||"\u672a\u77e5\u7528\u6237",avatarUrl:(null===t||void 0===t?void 0:t.avatarUrl)||"",loginAt:(null===t||void 0===t?void 0:t.loginAt)||0,designCount:e.length,orderCount:r.length}})}function F(n,t){var e="mock_"+Date.now().toString(36)+"_"+Math.random().toString(36).slice(2,6),r={openid:e,nickName:n||"\u5fae\u4fe1\u7528\u6237",avatarUrl:t||"",loginAt:Date.now()};return j(r),r}function H(n){var t=E(n);return!!t&&(i().setStorageSync(o,t),i().setStorageSync(u,n),!0)}function U(n){i().removeStorageSync("user_info_".concat(n)),i().removeStorageSync("design_list_".concat(n)),i().removeStorageSync("order_list_".concat(n)),i().removeStorageSync("address_list_".concat(n)),B(n);var t=D();(null===t||void 0===t?void 0:t.openid)===n&&P()}function Y(n){return n===N}function G(){try{return i().getStorageSync(s("address_list"))||[]}catch(n){return[]}}function O(n){i().setStorageSync(s("address_list"),n)}function W(n){var t=G(),e=(0,f.A)((0,f.A)({},n),{},{id:"ADR"+Date.now()});return e.isDefault&&t.forEach(function(n){n.isDefault=!1}),O([e].concat((0,p.A)(t))),e}function L(n,t){var e=G(),r=e.findIndex(function(t){return t.id===n});-1!==r&&(t.isDefault&&e.forEach(function(n){n.isDefault=!1}),e[r]=(0,f.A)((0,f.A)({},e[r]),t),O(e))}function Q(n){var t=G().filter(function(t){return t.id!==n});O(t)}function z(){return G().find(function(n){return n.isDefault})}var J="smart_theme";function V(){try{return i().getStorageSync(J)||"auto"}catch(n){return"auto"}}function Z(n){i().setStorageSync(J,n)}var $=null;function K(n){$=n}function X(n){if("auto"===n){if($)return $;try{var t=i().getAppBaseInfo();if("dark"===t.theme||"light"===t.theme)return t.theme}catch(n){}return"light"}return n}},6606:function(n,t,e){e.d(t,{G:function(){return u}});var r=e(758),i=e.n(r);function o(n){return"dark"===n?"#191919":"#faf7f2"}function u(n,t){var e=null!==t&&void 0!==t?t:o(n);i().setBackgroundColor({backgroundColor:e,backgroundColorTop:e,backgroundColorBottom:e}),i().setBackgroundTextStyle({textStyle:"dark"===n?"light":"dark"})}}}]); \ No newline at end of file +"use strict";(wx["webpackJsonp"]=wx["webpackJsonp"]||[]).push([[76],{9513:function(n,t,e){e.d(t,{A:function(){return o}});var r=e(118),i=e(4848);function o(n){var t=n.children,e=n.className,o=n.style;return(0,i.jsx)(r.Ss,{className:"bottom-action-bar ".concat(e||""),style:o,children:t})}},7723:function(n,t,e){e.d(t,{A:function(){return f}});var r=e(5544),i=e(758),o=e.n(i),u=e(6540),c=e(118),a=e(6764),s=e(9703),l=e(8199),d=e(4848);function f(n){var t=(0,u.useState)("checking"),e=(0,r.A)(t,2),i=e[0],f=e[1],p=(0,u.useCallback)(function(){var n=!1;return(0,a.d)().then(function(t){n||f(t?"ok":"denied")}).catch(function(){n||f("denied")}),function(){n=!0}},[]);return(0,u.useEffect)(function(){var n=p(),t=function(){p()},e=function(){p()};return o().eventCenter.on("tabBarChange",t),o().eventCenter.on(s.Wo,e),o().eventCenter.on("authStateChanged",t),function(){n(),o().eventCenter.off("tabBarChange",t),o().eventCenter.off(s.Wo,e),o().eventCenter.off("authStateChanged",t)}},[p]),"checking"===i?(0,d.jsx)(c.Ss,{className:"login-guard",children:(0,d.jsxs)(c.Ss,{className:"login-guard-inner",children:[(0,d.jsx)(c._V,{className:"login-guard-icon",src:(0,l.uq)("/icon/\u8bbe\u7f6e.png"),mode:"aspectFit"}),(0,d.jsx)(c.EY,{className:"login-guard-title",children:"\u6821\u9a8c\u767b\u5f55\u72b6\u6001"})]})}):"denied"===i?(0,d.jsx)(c.Ss,{className:"login-guard",children:(0,d.jsxs)(c.Ss,{className:"login-guard-inner",children:[(0,d.jsx)(c._V,{className:"login-guard-icon",src:(0,l.uq)("/icon/\u4e2a\u4eba.png"),mode:"aspectFit"}),(0,d.jsx)(c.EY,{className:"login-guard-title",children:"\u8bf7\u5148\u767b\u5f55"}),(0,d.jsx)(c.EY,{className:"login-guard-desc",children:"\u767b\u5f55\u540e\u67e5\u770b\u60a8\u7684\u4e13\u5c5e\u5185\u5bb9"}),(0,d.jsx)(c.Ss,{className:"btn-primary login-guard-btn",onTap:function(){return o().switchTab({url:"/pages/profile/index"})},children:(0,d.jsx)(c.EY,{children:"\u53bb\u767b\u5f55"})})]})}):n.children}},3053:function(n,t,e){e.d(t,{A:function(){return f}});var r=e(5544),i=e(118),o=e(758),u=e.n(o),c=e(6540),a=e(9201);function s(n){var t=n.viewportBottom,e=n.scrollTop,r=n.statusBarHeight,i=Number.isFinite(t)?t:0,o=Number.isFinite(e)?e:0,u=Number.isFinite(r)?r:0;return Math.max(0,i+o-u-8)}function l(n){var t=n.scrollTop,e=n.startY,r=n.rangeY,i=Number.isFinite(t)?t:0,o=Math.max(0,Number.isFinite(e)?e:0),u=Math.max(1,Number.isFinite(r)?r:1);return i<=o?0:Math.min(1,(i-o)/u)}var d=e(4848);function f(n){var t=n.title,e=n.targetSelector,o=void 0===e?".page-header":e,f=n.showBack,p=void 0!==f&&f,g=(0,a.c)(),h=(0,c.useState)(0),m=(0,r.A)(h,2),v=m[0],y=m[1],A=(0,c.useMemo)(function(){return{startY:Math.max(0,g.headerPaddingTop-g.statusBarHeight),rangeY:Math.max(48,.45*g.headerPaddingTop)}},[g.headerPaddingTop,g.statusBarHeight]),S=(0,c.useRef)(A),k=(0,c.useRef)(null),b=(0,c.useRef)(0),w=(0,c.useCallback)(function(n){b.current=n,null===k.current&&(k.current=setTimeout(function(){k.current=null;var n=S.current,t=n.startY,e=n.rangeY;y(l({scrollTop:b.current,startY:t,rangeY:e}))},16))},[]);return(0,c.useEffect)(function(){var n=!1,t=null;S.current=A;var e=function(){n||u().createSelectorQuery().select(o).boundingClientRect(function(t){if(!n){if(!t||Array.isArray(t)||"number"!==typeof t.bottom||"number"!==typeof t.height)return S.current=A,void w(b.current);var e=s({viewportBottom:t.bottom,scrollTop:b.current,statusBarHeight:g.statusBarHeight}),r=Math.max(32,.7*t.height);S.current={startY:e,rangeY:r},w(b.current)}}).exec()};return u().nextTick(function(){n||(t=setTimeout(e,80))}),function(){n=!0,null!==t&&clearTimeout(t),null!==k.current&&clearTimeout(k.current),k.current=null}},[w,A,o]),u().usePageScroll(function(n){w(n.scrollTop)}),(0,d.jsxs)(i.Ss,{className:"scroll-top-mask",style:{height:"".concat(Math.max(g.menuButtonTop+g.menuButtonHeight+18,g.statusBarHeight+52)+24,"px"),opacity:v},children:[(0,d.jsx)(i.Ss,{className:"scroll-top-blur scroll-top-blur-mid"}),(0,d.jsx)(i.Ss,{className:"scroll-top-blur scroll-top-blur-soft"}),(0,d.jsx)(i.Ss,{className:"scroll-top-gradient"}),p&&(0,d.jsx)(i.Ss,{className:"scroll-top-back",style:{top:"".concat(g.menuButtonTop,"px")},onTap:function(){return u().navigateBack()},children:(0,d.jsx)(i.EY,{className:"scroll-top-back-arrow",children:"\u2190"})}),(0,d.jsx)(i.EY,{className:"scroll-top-title",style:{top:"calc(".concat(g.menuButtonTop,"px + 40rpx)"),transform:"translateY(-50%)",opacity:Math.max(0,Math.min(1,(v-.5)/.5))},children:t})]})}},9674:function(n,t,e){e.d(t,{A:function(){return u}});var r=e(118),i=e(9703),o=e(4848);function u(n){var t=n.darkTop,e=void 0!==t&&t,u=(0,i.wR)(),c=u.resolvedTheme,a="dark"===c||e,s=a?"#191919":"#faf7f2",l=a?"#ffffff":"#000000";return(0,o.jsx)(r.tf,{backgroundColor:s,backgroundColorTop:s,backgroundColorBottom:s,backgroundTextStyle:a?"light":"dark",rootBackgroundColor:s,children:(0,o.jsx)(r.yk,{frontColor:l,backgroundColor:s})})}},9703:function(n,t,e){e.d(t,{NP:function(){return p},Wo:function(){return f},wR:function(){return g}});var r=e(5544),i=e(6540),o=e(758),u=e.n(o),c=e(118),a=e(1457),s=e(6606),l=e(4848),d=(0,i.createContext)({theme:"auto",resolvedTheme:"light",toggleTheme:function(){},setTheme:function(){}}),f="themeChange";function p(n){var t=n.children,e=(0,i.useState)((0,a.O4)()),p=(0,r.A)(e,2),g=p[0],h=p[1],m=(0,i.useState)((0,a.eW)((0,a.O4)())),v=(0,r.A)(m,2),y=v[0],A=v[1],S=(0,i.useRef)(null),k=(0,i.useCallback)(function(n){A((0,a.eW)(n))},[]),b=(0,i.useCallback)(function(n){(0,a.Rq)(n),S.current=n,"auto"===(0,a.O4)()&&A(n)},[]),w=(0,i.useCallback)(function(){try{var n=u().getAppBaseInfo();b("dark"===n.theme?"dark":"light")}catch(n){}try{u().createSelectorQuery().select(".system-theme-detector").fields({computedStyle:["opacity"]}).exec(function(n){var t=n&&n[0]&&n[0].computedStyle&&n[0].computedStyle.opacity;b("1"===t?"dark":"light")})}catch(n){}},[b]),T=(0,i.useCallback)(function(n){(0,a.F0)(n),h(n),"auto"===n?w():k(n)},[w,k]),C=(0,i.useCallback)(function(){var n="light"===y?"dark":"light";T(n)},[y,T]);return(0,i.useEffect)(function(){w()},[w]),(0,i.useEffect)(function(){var n,t=function(n){!n||"dark"!==n.theme&&"light"!==n.theme||b(n.theme)},e=u();return null===(n=e.onThemeChange)||void 0===n||n.call(e,t),function(){var n;null===(n=e.offThemeChange)||void 0===n||n.call(e,t)}},[b]),(0,i.useEffect)(function(){if("auto"===g){var n=setInterval(function(){try{var n=u().getAppBaseInfo(),t="dark"===n.theme?"dark":"light";t!==S.current&&b(t)}catch(n){}},2e3);return function(){return clearInterval(n)}}},[g,b]),(0,i.useEffect)(function(){u().eventCenter.trigger(f,y)},[y]),(0,i.useEffect)(function(){(0,s.G)(y)},[y]),(0,o.useDidShow)(function(){"auto"===g&&w()}),(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(c.Ss,{className:"system-theme-detector"}),(0,l.jsx)(d.Provider,{value:{theme:g,resolvedTheme:y,toggleTheme:C,setTheme:T},children:t})]})}function g(){return(0,i.useContext)(d)}},9201:function(n,t,e){e.d(t,{c:function(){return a}});var r=e(5544),i=e(6540),o=e(758),u=e.n(o),c=null;function a(){var n=(0,i.useState)(null!==c&&void 0!==c?c:{statusBarHeight:20,menuButtonTop:26,menuButtonHeight:32,capsuleRight:368,safeInsetTop:20,safeInsetBottom:0,headerPaddingTop:66,backBtnPaddingTop:20}),t=(0,r.A)(n,2),e=t[0],o=t[1];return(0,i.useEffect)(function(){if(c)o(c);else try{var n,t,e,r,i,a,s,l,d=u().getSystemInfoSync(),f=u().getMenuButtonBoundingClientRect(),p=d.statusBarHeight||20,g=null!==(n=f.top)&&void 0!==n?n:p+4,h=null!==(t=f.height)&&void 0!==t?t:32,m=null!==(e=f.right)&&void 0!==e?e:d.windowWidth-7,v=null!==(r=null===(i=d.safeArea)||void 0===i?void 0:i.top)&&void 0!==r?r:p,y=null!==(a=d.safeAreaInsetBottom)&&void 0!==a?a:d.screenHeight-(null!==(s=null===(l=d.safeArea)||void 0===l?void 0:l.bottom)&&void 0!==s?s:d.screenHeight),A=Math.max(g+h+6,p+44),S=Math.max(p,g-4),k={statusBarHeight:p,menuButtonTop:g,menuButtonHeight:h,capsuleRight:m,safeInsetTop:v,safeInsetBottom:y,headerPaddingTop:A,backBtnPaddingTop:S};c=k,o(k)}catch(n){}},[]),e}},5414:function(n,t,e){e.d(t,{l:function(){return c}});var r=e(6540),i=e(758),o=e.n(i),u=e(6606);function c(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=t.mode,c=void 0===e?"auto":e,a=(0,r.useCallback)(function(){var t="dark"===c||"auto"===c&&"light"===n,e=t?"#000000":"#ffffff",r=t?"#faf7f2":"#191919";o().setNavigationBarColor({frontColor:e,backgroundColor:r}),(0,u.G)(n,r)},[c,n]);(0,r.useEffect)(a,[a]),(0,i.useDidShow)(a)}},9972:function(n,t,e){e.d(t,{FR:function(){return y},x9:function(){return _},l8:function(){return W},ab:function(){return b},p8:function(){return E},ls:function(){return m},rP:function(){return I},jp:function(){return d},gf:function(){return o.gf},xZ:function(){return L},iD:function(){return u},ri:function(){return a},x5:function(){return V},W$:function(){return G},yU:function(){return S},i5:function(){return B},r7:function(){return s}});var r=e(1212),i=e(467),o=e(3246);function u(n){return c.apply(this,arguments)}function c(){return c=(0,i.A)((0,r.A)().m(function n(t){var e;return(0,r.A)().w(function(n){while(1)switch(n.n){case 0:return n.n=1,o.Ay.post("/api/auth/login",{code:t},{auth:!1});case 1:return e=n.v,null!==e&&void 0!==e&&e.accessToken&&(0,o.WG)(e.accessToken),n.a(2,e)}},n)})),c.apply(this,arguments)}function a(){(0,o.L)()}function s(n){return l.apply(this,arguments)}function l(){return l=(0,i.A)((0,r.A)().m(function n(t){return(0,r.A)().w(function(n){while(1)switch(n.n){case 0:return n.a(2,o.Ay.patch("/api/users/me",t))}},n)})),l.apply(this,arguments)}function d(){return f.apply(this,arguments)}function f(){return f=(0,i.A)((0,r.A)().m(function n(){return(0,r.A)().w(function(n){while(1)switch(n.n){case 0:return n.a(2,o.Ay.get("/api/users/me"))}},n)})),f.apply(this,arguments)}e(2371);var p=e(5544);function g(n){return{id:n.id,name:n.name,phone:n.phone,region:[n.province,n.city,n.district],detail:n.detail,isDefault:n.isDefault,createdAt:n.createdAt}}function h(n){var t={};if(void 0!==n.name&&(t.name=n.name),void 0!==n.phone&&(t.phone=n.phone),void 0!==n.region){var e=(0,p.A)(n.region,3),r=e[0],i=void 0===r?"":r,o=e[1],u=void 0===o?"":o,c=e[2],a=void 0===c?"":c;t.province=i,t.city=u,t.district=a}return void 0!==n.detail&&(t.detail=n.detail),void 0!==n.isDefault&&(t.isDefault=n.isDefault),t}function m(){return v.apply(this,arguments)}function v(){return v=(0,i.A)((0,r.A)().m(function n(){var t;return(0,r.A)().w(function(n){while(1)switch(n.n){case 0:return n.n=1,o.Ay.get("/api/addresses");case 1:return t=n.v,n.a(2,(t||[]).map(g))}},n)})),v.apply(this,arguments)}function y(n){return A.apply(this,arguments)}function A(){return A=(0,i.A)((0,r.A)().m(function n(t){var e;return(0,r.A)().w(function(n){while(1)switch(n.n){case 0:return n.n=1,o.Ay.post("/api/addresses",h(t));case 1:return e=n.v,n.a(2,g(e))}},n)})),A.apply(this,arguments)}function S(n,t){return k.apply(this,arguments)}function k(){return k=(0,i.A)((0,r.A)().m(function n(t,e){var i;return(0,r.A)().w(function(n){while(1)switch(n.n){case 0:return n.n=1,o.Ay.patch("/api/addresses/".concat(t),h(e));case 1:return i=n.v,n.a(2,g(i))}},n)})),k.apply(this,arguments)}function b(n){return w.apply(this,arguments)}function w(){return w=(0,i.A)((0,r.A)().m(function n(t){return(0,r.A)().w(function(n){while(1)switch(n.n){case 0:return n.n=1,o.Ay.del("/api/addresses/".concat(t));case 1:return n.a(2)}},n)})),w.apply(this,arguments)}var T=e(9379),C={DRAFT:"undesigned",SUBMITTED:"designing",PROCESSING:"processing",DONE:"ordered"};function x(n){var t,e,r,i,o=n.items&&n.items[0];return{id:n.id,productId:null!==(t=null===o||void 0===o?void 0:o.productId)&&void 0!==t?t:"",productName:(null===o||void 0===o?void 0:o.productName)||n.title,unitPrice:null!==(e=null===o||void 0===o?void 0:o.unitPrice)&&void 0!==e?e:0,count:null!==(r=null===o||void 0===o?void 0:o.count)&&void 0!==r?r:1,status:null!==(i=C[n.status])&&void 0!==i?i:"undesigned",designData:null===o||void 0===o?void 0:o.designData,createdAt:(n.createdAt||"").slice(0,10)}}function I(){return N.apply(this,arguments)}function N(){return N=(0,i.A)((0,r.A)().m(function n(){var t;return(0,r.A)().w(function(n){while(1)switch(n.n){case 0:return n.n=1,o.Ay.get("/api/design-list");case 1:return t=n.v,n.a(2,(t||[]).map(x))}},n)})),N.apply(this,arguments)}function _(n){return j.apply(this,arguments)}function j(){return j=(0,i.A)((0,r.A)().m(function n(t){var e;return(0,r.A)().w(function(n){while(1)switch(n.n){case 0:return n.n=1,o.Ay.post("/api/design-list",{title:t.productName,items:[(0,T.A)({productId:t.productId,productName:t.productName,unitPrice:t.unitPrice,count:t.count},void 0!==t.designData?{designData:t.designData}:{})]});case 1:return e=n.v,n.a(2,x(e))}},n)})),j.apply(this,arguments)}function B(n,t){return D.apply(this,arguments)}function D(){return D=(0,i.A)((0,r.A)().m(function n(t,e){var i,u;return(0,r.A)().w(function(n){while(1)switch(n.n){case 0:return i={},void 0!==e.title&&(i.title=e.title),void 0!==e.status&&(i.status="SUBMITTED"),void 0!==e.item&&(i.items=[(0,T.A)({productId:e.item.productId,productName:e.item.productName,unitPrice:e.item.unitPrice,count:e.item.count},void 0!==e.item.designData?{designData:e.item.designData}:{})]),n.n=1,o.Ay.patch("/api/design-list/".concat(t),i);case 1:return u=n.v,n.a(2,x(u))}},n)})),D.apply(this,arguments)}function E(n){return P.apply(this,arguments)}function P(){return P=(0,i.A)((0,r.A)().m(function n(t){var e,i;return(0,r.A)().w(function(n){while(1)switch(n.n){case 0:return n.n=1,o.Ay.post("/api/design-list/batch-delete",{ids:t});case 1:return i=n.v,n.a(2,null!==(e=null===i||void 0===i?void 0:i.deleted)&&void 0!==e?e:0)}},n)})),P.apply(this,arguments)}var R=e(4765),M=e(758),U=e.n(M);function q(n,t,e,r){return F.apply(this,arguments)}function F(){return F=(0,i.A)((0,r.A)().m(function n(t,e,i,u){var c,a;return(0,r.A)().w(function(n){while(1)switch(n.p=n.n){case 0:return n.n=1,U().uploadFile({url:"".concat(o.C1).concat(t),filePath:e,name:i,formData:u,header:{Authorization:"Bearer ".concat((0,o.gf)())}});case 1:c=n.v,n.p=2,a=JSON.parse(c.data),n.n=4;break;case 3:throw n.p=3,n.v,new Error("\u7f51\u7edc\u5f02\u5e38\uff0c\u8bf7\u7a0d\u540e\u91cd\u8bd5");case 4:if(!a||"number"!==typeof a.code||0===a.code){n.n=5;break}throw new Error(a.message||"\u8bf7\u6c42\u5931\u8d25");case 5:return n.a(2,a&&"number"===typeof a.code?a.data:a)}},n,null,[[2,3]])})),F.apply(this,arguments)}function H(n){return o.Ay.get("/api/upload/credentials?key=".concat(encodeURIComponent(n)))}function Y(n,t){return O.apply(this,arguments)}function O(){return O=(0,i.A)((0,r.A)().m(function n(t,e){var i,o;return(0,r.A)().w(function(n){while(1)switch(n.n){case 0:if(e.presignedUrl){n.n=1;break}throw new Error("\u83b7\u53d6 COS \u76f4\u4f20\u5730\u5740\u5931\u8d25");case 1:return i=U().getFileSystemManager(),o=i.readFileSync(t),n.n=2,U().request({url:e.presignedUrl,method:"PUT",data:o,header:{"Content-Type":"application/octet-stream"}});case 2:return n.a(2,e.presignedUrl.split("?")[0])}},n)})),O.apply(this,arguments)}function G(n){return q("/api/sketch",n,"image")}function W(n,t,e){return q("/api/wordcloud/generate",n,"image",(0,T.A)({names:t},e?{params:JSON.stringify(e)}:{}))}function L(n){return o.Ay.get("/api/wordcloud/jobs/".concat(n))}function Q(n){return!!n&&/^(wxfile:|http:\/\/tmp\/|tmp\/)/i.test(n)}function z(n){return J.apply(this,arguments)}function J(){return J=(0,i.A)((0,r.A)().m(function n(t){var e,i;return(0,r.A)().w(function(n){while(1)switch(n.p=n.n){case 0:return n.p=0,e="uploads/sticker/".concat(Date.now(),"_").concat(Math.floor(1e6*Math.random()),".jpg"),n.n=1,H(e);case 1:return i=n.v,n.n=2,Y(t,i);case 2:return n.a(2,n.v);case 3:return n.p=3,n.v,n.a(2,t)}},n,null,[[0,3]])})),J.apply(this,arguments)}function V(n){return Z.apply(this,arguments)}function Z(){return Z=(0,i.A)((0,r.A)().m(function n(t){var e,i,o,u,c,a,s,l,d,f,p,g,h,m,v,y;return(0,r.A)().w(function(n){while(1)switch(n.p=n.n){case 0:if(t){n.n=1;break}return n.a(2,t);case 1:if(e=(0,T.A)({},t),!t.background||!Q(t.background.src)){n.n=3;break}return a=T.A,s=(0,T.A)({},t.background),l={},n.n=2,z(t.background.src);case 2:d=n.v,e.background=a(s,l,{src:d});case 3:if(!t.stickers||!t.stickers.length){n.n=14;break}i=[],o=(0,R.A)(t.stickers),n.p=4,o.s();case 5:if((u=o.n()).done){n.n=10;break}if(c=u.value,f=i,!Q(c.src)){n.n=7;break}return g=T.A,h=(0,T.A)({},c),m={},n.n=6,z(c.src);case 6:v=n.v,p=g(h,m,{src:v}),n.n=8;break;case 7:p=c;case 8:f.push.call(f,p);case 9:n.n=5;break;case 10:n.n=12;break;case 11:n.p=11,y=n.v,o.e(y);case 12:return n.p=12,o.f(),n.f(12);case 13:e.stickers=i;case 14:return n.a(2,e)}},n,null,[[4,11,12,13]])})),Z.apply(this,arguments)}},2371:function(n,t,e){e.d(t,{j0:function(){return l},yj:function(){return f}});var r=e(1212),i=e(5544),o=e(467),u=e(9379),c=e(3246);function a(n){if(void 0!==n){var t=Number(n);return Number.isFinite(t)?t:void 0}}function s(n){var t,e=a(n.originalPrice);return(0,u.A)((0,u.A)((0,u.A)({},n),{},{price:null!==(t=a(n.price))&&void 0!==t?t:0},void 0!==e?{originalPrice:e}:{}),{},{tags:n.tags||[],specs:n.specs||[],tone:n.tone||[28,22,18],images:n.images||[]})}function l(){return d.apply(this,arguments)}function d(){return d=(0,o.A)((0,r.A)().m(function n(){var t,e,o,a=arguments;return(0,r.A)().w(function(n){while(1)switch(n.n){case 0:return t=a.length>0&&void 0!==a[0]?a[0]:{},e=Object.entries(t).filter(function(n){var t=(0,i.A)(n,2),e=t[1];return void 0!==e&&""!==e}).map(function(n){var t=(0,i.A)(n,2),e=t[0],r=t[1];return"".concat(encodeURIComponent(e),"=").concat(encodeURIComponent(String(r)))}).join("&"),n.n=1,c.Ay.get("/api/products".concat(e?"?".concat(e):""),{auth:!1});case 1:return o=n.v,n.a(2,(0,u.A)((0,u.A)({},o),{},{list:(o.list||[]).map(s)}))}},n)})),d.apply(this,arguments)}function f(n){return p.apply(this,arguments)}function p(){return p=(0,o.A)((0,r.A)().m(function n(t){var e;return(0,r.A)().w(function(n){while(1)switch(n.n){case 0:return n.n=1,c.Ay.get("/api/products/".concat(encodeURIComponent(t)),{auth:!1});case 1:return e=n.v,n.a(2,s(e))}},n)})),p.apply(this,arguments)}},8199:function(n,t,e){e.d(t,{uq:function(){return i}});var r="https://wordcloudwechat.oss-cn-hangzhou.aliyuncs.com";function i(n){if(!n)return"";if(/^(https?:|wxfile:|data:)/i.test(n))return n;if(!r)return n;var t=r.replace(/\/+$/,"");if(!n.startsWith("/img/"))return n;var e=n.startsWith("/")?n:"/".concat(n);return"".concat(t).concat(e)}},6764:function(n,t,e){e.d(t,{d:function(){return y},m:function(){return g}});var r=e(1212),i=e(467),o=e(2284),u=e(758),c=e.n(u),a=e(9972),s=e(1457),l="smart_auth_verified",d=18e5,f=null,p=null;function g(){f=null,p=null;try{c().removeStorageSync(l)}catch(n){}}function h(n){var t=f||function(){try{var n=c().getStorageSync(l);return n&&"object"===(0,o.A)(n)?n:null}catch(n){return null}}();return t&&t.openid===n?Date.now()-t.at>d?null:(f=t,t.ok):null}function m(n,t){var e={openid:n,ok:t,at:Date.now()};f=e;try{c().setStorageSync(l,e)}catch(n){}}function v(){var n=(0,s.Q4)();return!(null===n||void 0===n||!n.openid)&&!(0,s.Ic)(n.openid)&&!!n.accessToken&&!!(0,a.gf)()}function y(){return A.apply(this,arguments)}function A(){return A=(0,i.A)((0,r.A)().m(function n(){var t,e;return(0,r.A)().w(function(n){while(1)switch(n.n){case 0:if(t=(0,s.Q4)(),null!==t&&void 0!==t&&t.openid){n.n=1;break}return console.log("[AuthGuard] \u65e0\u672c\u5730\u7528\u6237\uff0c\u5224\u5b9a\u672a\u767b\u5f55"),n.a(2,!1);case 1:if(console.log("[AuthGuard] \u672c\u5730\u7528\u6237 openid=",t.openid),!(0,s.Ic)(t.openid)){n.n=2;break}return(0,s.Hf)(),(0,a.ri)(),g(),n.a(2,!1);case 2:if(e=h(t.openid),null===e){n.n=3;break}return console.log("[AuthGuard] \u547d\u4e2d\u672c\u5730\u7f13\u5b58 ok=",e),n.a(2,e);case 3:return p||(p=(0,a.jp)().then(function(n){console.log("[AuthGuard] getMe \u8fd4\u56de:",JSON.stringify(n));var e=!!n&&!!n.id&&n.openid===t.openid;return console.log("[AuthGuard] \u4e00\u81f4\u6027=",e),e?(m(t.openid,!0),!0):((0,s.Hf)(),(0,a.ri)(),g(),!1)}).catch(function(n){return console.error("[AuthGuard] getMe \u5931\u8d25\uff0c\u8d70\u672c\u5730\u4f1a\u8bdd\u515c\u5e95:",n),v()}).finally(function(){p=null})),n.a(2,p)}},n)})),A.apply(this,arguments)}},8633:function(n,t,e){function r(n){return{id:n.id,name:n.name,desc:n.subtitle||n.description||"",icon:n.iconImg||"",iconImg:n.iconImg,price:n.price,originalPrice:n.originalPrice,leadTime:n.leadTime,description:n.description||n.subtitle||"",subtitle:n.subtitle,tone:n.tone,story:n.story,scene:n.scene,tags:n.tags,specs:n.specs,mask:n.mask,images:n.images,status:n.status,sort:n.sort,categoryId:n.categoryId}}e.d(t,{D:function(){return r}})},5234:function(n,t,e){e.d(t,{QE:function(){return s},rj:function(){return a},y9:function(){return c}});var r=e(9379),i=e(8199),o=[{id:"notebook-small",name:"\u5fae\u96d5\u7b14\u8bb0\u672c\uff08\u5c0f\uff09",desc:"\u4fbf\u643a\u968f\u884c\uff0c\u8bb0\u5f55\u70b9\u6ef4",icon:"/icon/\u4e66\u672c.png",iconImg:"/icon/\u4e66\u672c.png",price:12,originalPrice:18,leadTime:"3-5\u4e2a\u5de5\u4f5c\u65e5",description:"\u7cbe\u9009\u4f18\u8d28\u7eb8\u5f20\uff0c\u5c01\u9762\u91c7\u7528\u9ad8\u6863PU\u6750\u8d28\uff0c\u624b\u611f\u7ec6\u817b\u3002\u5185\u9875\u53ef\u5b9a\u5236\u6a2a\u7ebf\u3001\u65b9\u683c\u6216\u7a7a\u767d\u4e09\u79cd\u7248\u5f0f\u3002\u6fc0\u5149\u5fae\u96d5\u5de5\u827a\u5c06\u540d\u5b57\u6216\u56fe\u6848\u7cbe\u51c6\u523b\u5370\u5728\u5c01\u9762\uff0c\u6c38\u4e0d\u892a\u8272\u3002\u5c0f\u5de7\u8f7b\u4fbf\uff0c\u9002\u5408\u968f\u8eab\u643a\u5e26\uff0c\u65e0\u8bba\u662f\u8bfe\u5802\u7b14\u8bb0\u8fd8\u662f\u65e5\u5e38\u5907\u5fd8\uff0c\u90fd\u662f\u4f60\u7684\u4e13\u5c5e\u4f34\u4fa3\u3002",subtitle:"\u638c\u5fc3\u95f4\u7684\u4e13\u5c5e\u5370\u8bb0 \xb7 \u6fc0\u5149\u5fae\u96d5 \xb7 \u4e09\u8272\u5185\u9875\u53ef\u9009",tone:[28,22,18],story:"\u7075\u611f\u6e90\u81ea\u624b\u8d26\u6587\u5316\u4e2d\u5bf9\u4e66\u5199\u4eea\u5f0f\u611f\u7684\u8ffd\u6c42\u3002\u6211\u4eec\u76f8\u4fe1\uff0c\u5728\u6570\u5b57\u6d2a\u6d41\u7684\u65f6\u4ee3\uff0c\u7eb8\u7b14\u7684\u6e29\u5ea6\u4f9d\u7136\u4e0d\u53ef\u66ff\u4ee3\u3002\u5f53\u6fc0\u5149\u5fae\u96d5\u5728PU\u5c01\u9762\u4e0a\u7559\u4e0b\u4e13\u5c5e\u5370\u8bb0\uff0c\u6bcf\u4e00\u7b14\u4e66\u5199\u90fd\u5728\u4e0e\u8fc7\u53bb\u5bf9\u8bdd\u3002\u7b14\u8bb0\u672c\u5c0f\u5de7\u5230\u8db3\u4ee5\u653e\u5165\u4efb\u4f55\u53e3\u888b\uff0c\u5374\u627f\u8f7d\u7740\u72ec\u4e00\u65e0\u4e8c\u7684\u8bb0\u5fc6\u3002",scene:"\u8bfe\u5802\u7b14\u8bb0\u3001\u65e5\u5e38\u5907\u5fd8\u3001\u65c5\u884c\u624b\u8d26\u3001\u5fc3\u60c5\u65e5\u8bb0\u3002\u9002\u5408\u9001\u7ed9\u540c\u5b66\u3001\u4f34\u4fa3\u6216\u4f5c\u4e3a\u6d3b\u52a8\u4f34\u624b\u793c\u2014\u2014\u8ba9\u6bcf\u4e00\u4e2a\u4eba\u90fd\u62e5\u6709\u523b\u7740\u81ea\u5df1\u540d\u5b57\u7684\u4e13\u5c5e\u7b14\u8bb0\u672c\u3002",tags:["\u4f34\u624b\u793c","\u5b66\u751f","\u624b\u8d26","\u4fbf\u643a","\u6fc0\u5149\u5fae\u96d5"],specs:[["\u5c3a\u5bf8","105 \xd7 148mm\uff08A6\uff09"],["\u9875\u6570","120\u5f20/240\u9875"],["\u5185\u9875\u7248\u5f0f","\u6a2a\u7ebf / \u65b9\u683c / \u7a7a\u767d \u53ef\u9009"],["\u5c01\u9762\u6750\u8d28","\u9ad8\u6863PU\u76ae\u9769"],["\u96d5\u523b\u5de5\u827a","CO2 \u6fc0\u5149\u5fae\u96d5\uff08\u6c38\u4e0d\u892a\u8272\uff09"],["\u9002\u7528\u573a\u666f","\u8bfe\u5802\u3001\u65c5\u884c\u3001\u65e5\u5e38\u5907\u5fd8"]],images:["/img/book_small/The1.jpg"],mask:{shape:"rect",width:300,height:420,borderRadius:8}},{id:"notebook-large",name:"\u5fae\u96d5\u7b14\u8bb0\u672c\uff08\u5927\uff09",desc:"\u5927\u5f00\u672c\uff0c\u66f4\u591a\u521b\u4f5c\u7a7a\u95f4",icon:"/icon/\u4e66\u672c_\u5927.png",iconImg:"/icon/\u4e66\u672c_\u5927.png",price:45,originalPrice:58,leadTime:"3-5\u4e2a\u5de5\u4f5c\u65e5",description:"A4\u5c3a\u5bf8\u5927\u5f00\u672c\uff0c180\xb0\u5e73\u644a\u8bbe\u8ba1\uff0c\u4e66\u5199\u66f4\u81ea\u7531\u3002\u5c01\u9762\u53ef\u9009\u771f\u76ae\u3001\u4eff\u5e03\u7eb9\u6216\u78e8\u7802\u6750\u8d28\uff0c\u6fc0\u5149\u5fae\u96d5\u533a\u57df\u66f4\u5927\uff0c\u9002\u5408\u5448\u73b0\u5168\u73ed\u540d\u5b57\u3001\u56e2\u961f\u53e3\u53f7\u6216\u516c\u53f8Logo\u7b49\u5927\u7bc7\u5e45\u5185\u5bb9\u3002\u662f\u6bd5\u4e1a\u7eaa\u5ff5\u3001\u4f01\u4e1a\u5e74\u4f1a\u793c\u54c1\u7684\u9996\u9009\u3002",subtitle:"\u5927\u7bc7\u5e45\u5b9a\u5236\u9996\u9009 \xb7 180\xb0\u5e73\u644a \xb7 \u6bd5\u4e1a/\u56e2\u5efa\u5fc5\u5907",tone:[35,28,22],story:"\u6bcf\u4e00\u6b21\u544a\u522b\u90fd\u503c\u5f97\u88ab\u90d1\u91cd\u4e66\u5199\u3002\u6bd5\u4e1a\u5b63\u7684\u6559\u5ba4\u91cc\uff0c\u7b14\u8bb0\u672c\u644a\u5f00\u5728\u8bfe\u684c\u4e0a\uff0c\u5168\u73ed\u7684\u540d\u5b57\u88ab\u6fc0\u5149\u523b\u5370\u5728\u5c01\u9762\u4e2d\u592e\uff0c\u6210\u4e3a\u6c38\u6052\u7684\u540c\u5b66\u5f55\u3002180\xb0\u5e73\u644a\u8bbe\u8ba1\u8ba9\u4e66\u5199\u4e0d\u518d\u88ab\u8ba2\u88c5\u675f\u7f1a\uff0cA4\u5927\u5c3a\u5bf8\u7ed9\u4f60\u5c3d\u60c5\u6325\u6d12\u7684\u5929\u5730\u3002\u8fd9\u662f\u9001\u7ed9\u4e00\u7fa4\u4eba\u6700\u597d\u7684\u544a\u522b\u793c\u7269\u3002",scene:"\u6bd5\u4e1a\u7eaa\u5ff5\u518c\u3001\u516c\u53f8\u5e74\u4f1a\u793c\u54c1\u3001\u56e2\u961f\u5efa\u8bbe\u4f34\u624b\u793c\u3001\u5ba2\u6237\u7b54\u8c22\u3002\u7279\u522b\u9002\u5408\u9700\u8981\u5728\u5c01\u9762\u5448\u73b0\u5927\u91cf\u6587\u5b57\u6216\u56fe\u6848\u7684\u5b9a\u5236\u9700\u6c42\u2014\u2014\u73ed\u7ea7\u540d\u5355\u3001\u516c\u53f8\u613f\u666f\u3001\u56e2\u961f\u53e3\u53f7\u4e00\u7f51\u6253\u5c3d\u3002",tags:["\u6bd5\u4e1a\u793c","\u56e2\u5efa","\u4f01\u4e1a\u5b9a\u5236","\u5927\u7bc7\u5e45","\u5e73\u644a\u8bbe\u8ba1"],specs:[["\u5c3a\u5bf8","210 \xd7 297mm\uff08A4\uff09"],["\u9875\u6570","100\u5f20/200\u9875"],["\u5c01\u9762\u6750\u8d28","\u771f\u76ae / \u4eff\u5e03\u7eb9 / \u78e8\u7802 \u53ef\u9009"],["\u5f00\u5408\u9002\u7528","180\xb0\u5e73\u644a\u8bbe\u8ba1"],["\u96d5\u523b\u5de5\u827a","CO2 \u6fc0\u5149\u5fae\u96d5\uff08\u9ad8\u6e05\u6670\u5ea6\uff09"],["\u5b9a\u5236\u9762\u79ef","\u5c01\u9762\u6574\u9762\u53ef\u96d5"]],images:["/img/book_big/The1.jpg","/img/book_big/The2.jpg"],mask:{shape:"rect",width:340,height:480,borderRadius:8}},{id:"coaster",name:"\u94dc\u8d28\u676f\u57ab",desc:"\u91d1\u5c5e\u8d28\u611f\uff0c\u684c\u9762\u827a\u672f",icon:"/icon/\u676f\u5b50.png",iconImg:"/icon/\u676f\u5b50.png",price:25,originalPrice:35,leadTime:"5-7\u4e2a\u5de5\u4f5c\u65e5",description:"\u91c7\u7528\u4f18\u8d28\u9ec4\u94dc\u6750\u8d28\uff0c\u8868\u9762\u7ecf\u62c9\u4e1d\u5de5\u827a\u5904\u7406\uff0c\u5448\u73b0\u54d1\u5149\u91d1\u5c5e\u8d28\u611f\u3002\u80cc\u9762\u914d\u6709\u9632\u6ed1\u8f6f\u6728\u57ab\uff0c\u4fdd\u62a4\u684c\u9762\u540c\u65f6\u9632\u6b62\u6ed1\u52a8\u3002\u6fc0\u5149\u5fae\u96d5\u53ef\u5728\u8868\u9762\u523b\u5370\u540d\u5b57\u3001\u65e5\u671f\u6216\u795d\u798f\u8bed\uff0c\u662f\u4e54\u8fc1\u65b0\u5c45\u3001\u65b0\u5a5a\u8d3a\u793c\u7684\u7cbe\u81f4\u4e4b\u9009\u3002",subtitle:"\u9ec4\u94dc\u8d28\u611f \xb7 \u62c9\u4e1d\u54d1\u5149 \xb7 \u684c\u9762\u4e0a\u7684\u5fae\u578b\u96d5\u5851",tone:[42,30,18],story:"\u8bbe\u8ba1\u7075\u611f\u6765\u81ea\u65e5\u5f0f\u4f98\u5bc2\u7f8e\u5b66\u3002\u5c81\u6708\u4f1a\u5728\u9ec4\u94dc\u8868\u9762\u7559\u4e0b\u6e29\u67d4\u7684\u6c27\u5316\u75d5\u8ff9\uff0c\u5c31\u5982\u540c\u4e00\u676f\u8336\u4ece\u70ed\u5230\u51c9\u7684\u8fc7\u7a0b\u3002\u62c9\u4e1d\u5904\u7406\u540e\u7684\u54d1\u5149\u8868\u9762\u5728\u706f\u5149\u4e0b\u5448\u73b0\u7ec6\u817b\u7684\u91d1\u5c5e\u7eb9\u7406\uff0c\u6fc0\u5149\u5fae\u96d5\u7684\u540d\u5b57\u6210\u4e3a\u8fd9\u4ef6\u5668\u7269\u4e0a\u6700\u51b7\u9759\u7684\u6ce8\u811a\u3002\u5b83\u4e0d\u53ea\u662f\u676f\u57ab\uff0c\u66f4\u662f\u684c\u9762\u4e0a\u7684\u5fae\u578b\u96d5\u5851\u3002",scene:"\u4e54\u8fc1\u9001\u793c\u3001\u65b0\u5a5a\u8d3a\u793c\u3001\u5496\u5561\u89d2\u5e03\u7f6e\u3001\u529e\u516c\u684c\u7f8e\u5b66\u3002\u9002\u5408\u9001\u7ed9\u559c\u6b22\u624b\u51b2\u5496\u5561\u7684\u670b\u53cb\uff0c\u6216\u4f5c\u4e3a\u5a5a\u793c\u5bbe\u5ba2\u7684\u56de\u793c\u2014\u2014\u6bcf\u4e00\u53ea\u676f\u57ab\u4e0a\u90fd\u523b\u7740\u5bbe\u5ba2\u7684\u540d\u5b57\uff0c\u8ba9\u793c\u7269\u672c\u8eab\u6210\u4e3a\u5ea7\u4f4d\u5361\u3002",tags:["\u4e54\u8fc1\u793c","\u65b0\u5a5a\u8d3a\u793c","\u684c\u9762\u7f8e\u5b66","\u9ec4\u94dc","\u624b\u51b2\u5496\u5561"],specs:[["\u6750\u8d28","\u9ec4\u94dc + \u80cc\u9762\u8f6f\u6728\u9632\u6ed1\u57ab"],["\u8868\u9762\u5904\u7406","\u62c9\u4e1d\u54d1\u5149"],["\u76f4\u5f84","100mm"],["\u539a\u5ea6","3mm"],["\u96d5\u523b\u5de5\u827a","\u5149\u7ea4\u6fc0\u5149\u7cbe\u7ec6\u5fae\u96d5"],["\u8010\u6e29","\u2264120\xb0C"]],images:["/img/cup/The1.jpg"],mask:{shape:"circle",width:280,height:280}},{id:"penbox",name:"\u7af9\u5236\u7b14\u76d2",desc:"\u81ea\u7136\u7af9\u7eb9\uff0c\u6587\u623f\u96c5\u5668",icon:"/icon/\u7b14\u76d2.png",iconImg:"/icon/\u7b14\u76d2.png",price:75,originalPrice:98,leadTime:"7-10\u4e2a\u5de5\u4f5c\u65e5",description:"\u7cbe\u9009\u5929\u7136\u6960\u7af9\uff0c\u7ecf\u591a\u9053\u5de5\u5e8f\u6253\u78e8\u629b\u5149\uff0c\u4fdd\u7559\u5929\u7136\u7af9\u7eb9\u808c\u7406\u3002\u76d2\u76d6\u91c7\u7528\u78c1\u5438\u5f00\u5408\uff0c\u5185\u90e8\u8bbe\u6709\u5206\u5c42\u9694\u677f\u3002\u6fc0\u5149\u5fae\u96d5\u5728\u7af9\u9762\u4e0a\u5448\u73b0\u6df1\u6d45\u4e0d\u4e00\u7684\u96d5\u523b\u6548\u679c\uff0c\u878d\u5165\u58a8\u9999\u6c14\u8d28\u3002\u9002\u5408\u4e66\u623f\u6848\u5934\u3001\u4e66\u6cd5\u7231\u597d\u8005\u7684\u6587\u623f\u4f34\u4fa3\u3002",subtitle:"\u5929\u7136\u6960\u7af9 \xb7 \u78c1\u5438\u5f00\u5408 \xb7 \u6587\u623f\u96c5\u5668\u4e4b\u9009",tone:[30,24,16],story:"\u6bcf\u4e00\u53ea\u7b14\u76d2\u90fd\u6765\u81ea\u540c\u4e00\u7247\u7af9\u6797\u7684\u4e0d\u540c\u90e8\u4f4d\uff0c\u56e0\u6b64\u7eb9\u8def\u7edd\u4e0d\u91cd\u590d\u2014\u2014\u6b63\u5982\u6ca1\u6709\u4e24\u4e2a\u4eba\u7684\u4e66\u6cd5\u98ce\u683c\u5b8c\u5168\u76f8\u540c\u3002\u6211\u4eec\u4fdd\u7559\u4e86\u6960\u7af9\u5929\u7136\u7684\u6e29\u6da6\u89e6\u611f\uff0c\u53ea\u5728\u8868\u9762\u4ee5\u6fc0\u5149\u523b\u4e0b\u540d\u5b57\u6216\u4e00\u53e5\u7bb4\u8a00\u3002\u6253\u5f00\u78c1\u5438\u76d2\u76d6\u65f6\u7684\u6e05\u8106\u58f0\u54cd\uff0c\u662f\u6587\u623f\u4e2d\u7684\u5c0f\u5c0f\u4eea\u5f0f\u3002",scene:"\u4e66\u623f\u6848\u5934\u3001\u4e66\u6cd5\u7231\u597d\u8005\u88c5\u5907\u3001\u6559\u5e08\u8282\u793c\u7269\u3001\u4e66\u623f\u6696\u623f\u793c\u3002\u9002\u5408\u9001\u7ed9\u5199\u5b57\u597d\u770b\u7684\u4eba\u2014\u2014\u56e0\u4e3a\u61c2\u4e66\u5199\u7684\u4eba\uff0c\u624d\u61c2\u4e00\u53ea\u597d\u7b14\u76d2\u7684\u5206\u91cf\u3002",tags:["\u6587\u623f","\u4e66\u6cd5","\u6559\u5e08\u8282","\u4e66\u623f","\u5929\u7136\u6750\u8d28"],specs:[["\u6750\u8d28","\u5929\u7136\u6960\u7af9"],["\u5f00\u5408\u65b9\u5f0f","\u78c1\u5438\u5f0f\u76d2\u76d6"],["\u5185\u90e8\u7ed3\u6784","\u5206\u5c42\u9694\u677f\uff08\u53ef\u8c03\u8282\uff09"],["\u5c3a\u5bf8","200 \xd7 65 \xd7 30mm"],["\u8868\u9762\u5904\u7406","\u624b\u5de5\u6253\u78e8\u629b\u5149\uff0c\u65e0\u6f06"],["\u96d5\u523b\u5de5\u827a","CO2 \u6fc0\u5149\u70e7\u8680\uff08\u6df1\u6d45\u53ef\u8c03\uff09"]],images:["/img/penbox/The1.jpg","/img/penbox/The2.jpg","/img/penbox/The3.jpg"],mask:{shape:"rect",width:320,height:160,borderRadius:12}},{id:"booklamp",name:"\u4e66\u672c\u578b\u706f",desc:"\u6e29\u6696\u5149\u5f71\uff0c\u70b9\u4eae\u5fc3\u610f",icon:"/icon/\u4e66\u706f.png",iconImg:"/icon/\u4e66\u706f.png",price:45,originalPrice:68,leadTime:"5-7\u4e2a\u5de5\u4f5c\u65e5",description:"\u5f00\u5408\u5f0f\u8bbe\u8ba1\uff0c\u6253\u5f00\u5373\u4eae\uff0c\u5408\u62e2\u5373\u706d\uff0c\u5982\u9b54\u6cd5\u4e66\u822c\u5145\u6ee1\u60ca\u559c\u3002\u91c7\u7528LED\u6696\u5149\u706f\u6e90\uff0c\u5149\u7ebf\u67d4\u548c\u4e0d\u523a\u773c\uff0c\u53ef\u6301\u7eed\u70b9\u4eae6-8\u5c0f\u65f6\u3002\u5c01\u9762\u6fc0\u5149\u5fae\u96d5\u53ef\u5b9a\u5236\u6587\u5b57\u3001\u56fe\u6848\u6216\u7167\u7247\uff0c\u8ba9\u6e29\u6696\u7684\u706f\u5149\u627f\u8f7d\u4e13\u5c5e\u8bb0\u5fc6\u3002\u662f\u60c5\u4fa3\u793c\u7269\u3001\u6bd5\u4e1a\u793c\u7269\u7684\u521b\u610f\u4e4b\u9009\u3002",subtitle:"\u5f00\u5408\u5373\u4eae \xb7 LED\u6696\u5149 \xb7 \u9b54\u6cd5\u4e66\u822c\u7684\u60ca\u559c",tone:[25,20,15],story:"\u7075\u611f\u6765\u81ea\u300a\u54c8\u5229\xb7\u6ce2\u7279\u300b\u4e2d\u7684\u9b54\u6cd5\u8bfe\u672c\u2014\u2014\u6253\u5f00\u4e00\u672c\u4e66\uff0c\u5149\u8292\u503e\u6cfb\u800c\u51fa\u3002\u6211\u4eec\u91c7\u7528\u675c\u90a6\u7eb8\u4e0e\u5b9e\u6728\u5c01\u9762\u7ed3\u5408\uff0c\u8ba9\u706f\u4f53\u65e2\u8f7b\u8584\u53c8\u575a\u56fa\u3002\u6fc0\u5149\u5fae\u96d5\u5728\u5c01\u9762\u7559\u4e0b\u4f60\u7684\u540d\u5b57\u6216\u4e00\u5e45\u5c0f\u753b\uff0c\u5f53\u706f\u5728\u6df1\u591c\u4eae\u8d77\uff0c\u90a3\u662f\u4e13\u5c5e\u4e8e\u4f60\u7684\u6e29\u6696\u89d2\u843d\u3002",scene:"\u60c5\u4fa3\u793c\u7269\u3001\u6bd5\u4e1a\u7eaa\u5ff5\u3001\u5e8a\u5934\u591c\u706f\u3001\u9732\u8425\u6c1b\u56f4\u706f\u3001\u513f\u7ae5\u623f\u3002\u7279\u522b\u9002\u5408\u5728\u5c01\u9762\u523b\u4e0a\u4e24\u4e2a\u4eba\u7684\u540d\u5b57\u548c\u4e00\u53e5\u60c5\u8bdd\uff0c\u5728\u60c5\u4eba\u8282\u6216\u7eaa\u5ff5\u65e5\u9001\u51fa\u2014\u2014\u6253\u5f00\u4e66\u706f\uff0c\u5c31\u50cf\u6253\u5f00\u4e00\u5c01\u4f1a\u53d1\u5149\u7684\u60c5\u4e66\u3002",tags:["\u60c5\u4fa3\u793c","\u6bd5\u4e1a\u7eaa\u5ff5","\u591c\u706f","\u6c1b\u56f4\u706f","\u521b\u610f\u793c\u7269"],specs:[["\u5149\u6e90","LED \u6696\u767d\u5149\uff083000K\uff09"],["\u7eed\u822a","6-8\u5c0f\u65f6\uff08\u5185\u7f6e\u53ef\u5145\u7535\u9502\u7535\u6c60\uff09"],["\u5145\u7535","USB Type-C \u63a5\u53e3"],["\u5c01\u9762\u6750\u8d28","\u675c\u90a6\u7eb8 + \u5b9e\u6728\u5c01\u9762"],["\u5c55\u5f00\u5c3a\u5bf8","210 \xd7 150mm"],["\u96d5\u523b\u5de5\u827a","\u6fc0\u5149\u5fae\u96d5\uff08\u652f\u6301\u6587\u5b57+\u7b80\u5355\u56fe\u6848\uff09"]],images:["/img/booklight/The1.jpg","/img/booklight/The2.jpg"],mask:{shape:"rect",width:320,height:240,borderRadius:4}}],u=o.map(function(n){return(0,r.A)((0,r.A)({},n),{},{images:(n.images||[]).map(function(n){return(0,i.uq)(n)}),iconImg:(0,i.uq)(n.iconImg)})}),c=function(n){return u.find(function(t){return t.id===n})},a={"notebook-small":(0,i.uq)("/icon/\u4e66\u672c.png"),"notebook-large":(0,i.uq)("/icon/\u4e66\u672c_\u5927.png"),coaster:(0,i.uq)("/icon/\u676f\u5b50.png"),penbox:(0,i.uq)("/icon/\u7b14\u76d2.png"),booklamp:(0,i.uq)("/icon/\u4e66\u706f.png")};function s(n){return null!==n&&void 0!==n&&n.iconImg?(0,i.uq)(n.iconImg):null!==n&&void 0!==n&&n.id?(0,i.uq)(a[n.id]||"/icon/\u56db\u89d2\u661f.svg"):(0,i.uq)("/icon/\u56db\u89d2\u661f.svg")}},3246:function(n,t,e){e.d(t,{C1:function(){return a},L:function(){return p},Sy:function(){return l},WG:function(){return f},gf:function(){return d},q:function(){return m}});var r=e(1212),i=e(9379),o=e(467),u=e(758),c=e.n(u),a="https://wxbackend.tokenleaping.com",s="smart_access_token";function l(){try{c().hideLoading()}catch(n){}}function d(){try{return c().getStorageSync(s)||""}catch(n){return""}}function f(n){c().setStorageSync(s,n)}function p(){try{c().removeStorageSync(s)}catch(n){}}var g=null;var h=null;function m(n){h=n}function v(n,t,e,r){return y.apply(this,arguments)}function y(){return y=(0,o.A)((0,r.A)().m(function n(t,e,i,o){return(0,r.A)().w(function(n){while(1)switch(n.n){case 0:return n.a(2,c().request({url:"".concat(a).concat(t),method:e,data:i,header:o}))}},n)})),y.apply(this,arguments)}function A(n){return S.apply(this,arguments)}function S(){return S=(0,o.A)((0,r.A)().m(function n(t){var e,o,u,c,a,s,l,f,m,y,A,S,k,b,w,T,C,x,I=arguments;return(0,r.A)().w(function(n){while(1)switch(n.p=n.n){case 0:return e=I.length>1&&void 0!==I[1]?I[1]:{},o=e.method,u=void 0===o?"GET":o,c=e.data,a=e.headers,s=void 0===a?{}:a,l=e.auth,f=void 0===l||l,m=e.skipAuthRefresh,y=void 0!==m&&m,A=function(){var n=d();return(0,i.A)((0,i.A)({"Content-Type":"application/json"},f&&n?{Authorization:"Bearer ".concat(n)}:{}),s)},n.p=1,n.n=2,v(t,u,c,A());case 2:S=n.v,n.n=4;break;case 3:throw n.p=3,n.v,k=new Error("\u7f51\u7edc\u5f02\u5e38\uff0c\u8bf7\u7a0d\u540e\u91cd\u8bd5"),k.statusCode=-1,k;case 4:if(401!==S.statusCode||y||!h){n.n=9;break}return n.n=5,h();case 5:if(b=n.v,!b){n.n=9;break}return n.p=6,n.n=7,v(t,u,c,A());case 7:S=n.v,n.n=9;break;case 8:throw n.p=8,n.v,w=new Error("\u7f51\u7edc\u5f02\u5e38\uff0c\u8bf7\u7a0d\u540e\u91cd\u8bd5"),w.statusCode=-1,w;case 9:if(401!==S.statusCode){n.n=10;break}throw p(),null===(T=g)||void 0===T||T(),C=new Error("\u767b\u5f55\u5df2\u8fc7\u671f\uff0c\u8bf7\u91cd\u65b0\u767b\u5f55"),C.statusCode=401,C;case 10:if(x=S.data,!x||"number"!==typeof x.code||0===x.code){n.n=11;break}throw new Error(x.message||"\u8bf7\u6c42\u5931\u8d25");case 11:return n.a(2,x&&"number"===typeof x.code?x.data:x)}},n,null,[[6,8],[1,3]])})),S.apply(this,arguments)}var k={get:function(n,t){return A(n,(0,i.A)((0,i.A)({},t),{},{method:"GET"}))},post:function(n,t,e){return A(n,(0,i.A)((0,i.A)({},e),{},{method:"POST",data:t}))},put:function(n,t,e){return A(n,(0,i.A)((0,i.A)({},e),{},{method:"PUT",data:t}))},patch:function(n,t,e){return A(n,(0,i.A)((0,i.A)({},e),{},{method:"PATCH",data:t}))},del:function(n,t){return A(n,(0,i.A)((0,i.A)({},t),{},{method:"DELETE"}))}};t.Ay=k},1457:function(n,t,e){e.d(t,{E1:function(){return W},cY:function(){return A},Hf:function(){return P},kg:function(){return q},ab:function(){return Q},hG:function(){return H},IU:function(){return C},Re:function(){return O},EB:function(){return z},p_:function(){return v},n7:function(){return w},O4:function(){return V},ug:function(){return M},Q4:function(){return B},Ic:function(){return c},Q1:function(){return U},kh:function(){return k},eW:function(){return X},Rc:function(){return G},Fu:function(){return y},Rq:function(){return K},F0:function(){return Z},iA:function(){return R},iZ:function(){return F},yU:function(){return L},i5:function(){return S},uF:function(){return Y}});var r=e(758),i=e.n(r),o="smart_user_info",u="smart_active_openid";function c(n){return!!n&&(n.startsWith("mock_")||n.startsWith("mock-"))}function a(){var n,t=null;try{t=i().getStorageSync(o)}catch(n){t=null}var e=(null===(n=t)||void 0===n?void 0:n.openid)||i().getStorageSync(u)||"_guest_";return i().setStorageSync(u,e),e}function s(n){var t=a();return"".concat(n,"_").concat(t)}function l(n,t){return"".concat(n,"_").concat(t)}var d=e(6764),f=e(9379),p=e(436),g=e(8199),h=e(5234);function m(n){try{return i().getStorageSync(l("design_list",n))||[]}catch(n){return[]}}function v(){try{return i().getStorageSync(s("design_list"))||[]}catch(n){return[]}}function y(n){i().setStorageSync(s("design_list"),n)}function A(n,t){var e=v(),r=(0,g.uq)((null===n||void 0===n?void 0:n.iconImg)||h.rj[null===n||void 0===n?void 0:n.id]||"/icon/\u56db\u89d2\u661f.svg"),i={id:"DSG"+Date.now(),productId:n.id,productName:n.name,productIcon:r,unitPrice:n.price,count:t,status:"undesigned",createdAt:(new Date).toISOString().slice(0,10)};return y([].concat((0,p.A)(e),[i])),i}function S(n,t){var e=v(),r=e.findIndex(function(t){return t.id===n});-1!==r&&(e[r]=(0,f.A)((0,f.A)({},e[r]),t),y(e))}function k(n){var t=v().filter(function(t){return!n.includes(t.id)});y(t)}function b(n){try{return i().getStorageSync(l("order_list",n))||[]}catch(n){return[]}}function w(){try{return i().getStorageSync(s("order_list"))||[]}catch(n){return[]}}function T(n){i().setStorageSync(s("order_list"),n)}function C(n){var t,e=v(),r=w(),i=e.find(function(t){return t.id===n});if(!i)return null;var o=null!==(t=i.productIcon)&&void 0!==t&&t.startsWith("/icon/")||/^https?:/i.test(i.productIcon||"")?i.productIcon:h.rj[i.productId]||"/icon/\u56db\u89d2\u661f.svg",u=(0,g.uq)(o),c={id:"ORD"+Date.now().toString().slice(-9),productName:i.productName,productIcon:u,statusCode:"pending",date:(new Date).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).replace(/\//g,"-"),price:"\xa5"+(i.unitPrice*i.count).toFixed(2),count:i.count,sku:"".concat(i.productName," \xd7 ").concat(i.count)},a=e.findIndex(function(t){return t.id===n});return-1!==a&&(e[a].status="ordered",e[a].orderId=c.id),y(e),T([c].concat((0,p.A)(r))),c}var x="smart_user_registry",I="zhihui2024";function N(){try{return i().getStorageSync(x)||[]}catch(n){return[]}}function _(n){var t=N();t.includes(n)||(t.push(n),i().setStorageSync(x,t))}function j(n){var t=N().filter(function(t){return t!==n});i().setStorageSync(x,t)}function B(){try{return i().getStorageSync(o)}catch(n){return null}}function D(n){var t;i().setStorageSync(o,n),null!==n&&void 0!==n&&n.openid&&(i().setStorageSync(u,n.openid),i().setStorageSync("user_info_".concat(n.openid),n),_(n.openid)),(0,d.m)(),null===(t=i().eventCenter)||void 0===t||t.trigger("authStateChanged",{openid:(null===n||void 0===n?void 0:n.openid)||""})}function E(n){try{var t=i().getStorageSync("user_info_".concat(n));if(t)return t}catch(n){}var e=B();return(null===e||void 0===e?void 0:e.openid)===n?e:null}function P(){var n;i().removeStorageSync(o),i().removeStorageSync(u),(0,d.m)(),null===(n=i().eventCenter)||void 0===n||n.trigger("authStateChanged",{openid:""})}function R(n){D(n)}function M(){return B()}function U(){var n=N();return n.map(function(n){var t=E(n),e=m(n),r=b(n);return{openid:n,nickName:(null===t||void 0===t?void 0:t.nickName)||"\u672a\u77e5\u7528\u6237",avatarUrl:(null===t||void 0===t?void 0:t.avatarUrl)||"",loginAt:(null===t||void 0===t?void 0:t.loginAt)||0,designCount:e.length,orderCount:r.length}})}function q(n,t){var e="mock_"+Date.now().toString(36)+"_"+Math.random().toString(36).slice(2,6),r={openid:e,nickName:n||"\u5fae\u4fe1\u7528\u6237",avatarUrl:t||"",loginAt:Date.now()};return D(r),r}function F(n){var t=E(n);return!!t&&(i().setStorageSync(o,t),i().setStorageSync(u,n),!0)}function H(n){i().removeStorageSync("user_info_".concat(n)),i().removeStorageSync("design_list_".concat(n)),i().removeStorageSync("order_list_".concat(n)),i().removeStorageSync("address_list_".concat(n)),j(n);var t=B();(null===t||void 0===t?void 0:t.openid)===n&&P()}function Y(n){return n===I}function O(){try{return i().getStorageSync(s("address_list"))||[]}catch(n){return[]}}function G(n){i().setStorageSync(s("address_list"),n)}function W(n){var t=O(),e=(0,f.A)((0,f.A)({},n),{},{id:"ADR"+Date.now()});return e.isDefault&&t.forEach(function(n){n.isDefault=!1}),G([e].concat((0,p.A)(t))),e}function L(n,t){var e=O(),r=e.findIndex(function(t){return t.id===n});-1!==r&&(t.isDefault&&e.forEach(function(n){n.isDefault=!1}),e[r]=(0,f.A)((0,f.A)({},e[r]),t),G(e))}function Q(n){var t=O().filter(function(t){return t.id!==n});G(t)}function z(){return O().find(function(n){return n.isDefault})}var J="smart_theme";function V(){try{return i().getStorageSync(J)||"auto"}catch(n){return"auto"}}function Z(n){i().setStorageSync(J,n)}var $=null;function K(n){$=n}function X(n){if("auto"===n){if($)return $;try{var t=i().getAppBaseInfo();if("dark"===t.theme||"light"===t.theme)return t.theme}catch(n){}return"light"}return n}},6606:function(n,t,e){e.d(t,{G:function(){return u}});var r=e(758),i=e.n(r);function o(n){return"dark"===n?"#191919":"#faf7f2"}function u(n,t){var e=null!==t&&void 0!==t?t:o(n);i().setBackgroundColor({backgroundColor:e,backgroundColorTop:e,backgroundColorBottom:e}),i().setBackgroundTextStyle({textStyle:"dark"===n?"light":"dark"})}}}]); \ No newline at end of file diff --git a/dist/pages/address/index.js b/dist/pages/address/index.js index 4bc7d70..a79d484 100644 --- a/dist/pages/address/index.js +++ b/dist/pages/address/index.js @@ -1 +1 @@ -"use strict";(wx["webpackJsonp"]=wx["webpackJsonp"]||[]).push([[81],{8807:function(e,s,a){var n=a(7842),c=a(5544),t=a(118),l=a(758),r=a.n(l),i=a(6540),o=a(1457),d=a(6845),u=a(9703),m=a(9201),h=a(5414),f=a(9674),p=a(3053),x=a(9513),j=a(8199),N=a(4848);function S(){var e=(0,u.wR)(),s=(e.theme,e.resolvedTheme),a=(0,m.c)();(0,h.l)(s);var n=(0,i.useState)([]),l=(0,c.A)(n,2),S=l[0],g=l[1],v=(0,i.useState)(null),E=(0,c.A)(v,2),b=E[0],Y=E[1],y=(0,i.useState)(!1),T=(0,c.A)(y,2),w=T[0],k=T[1],A=(0,i.useState)(""),R=(0,c.A)(A,2),B=R[0],C=R[1],D=(0,i.useState)(""),I=(0,c.A)(D,2),P=I[0],F=I[1],J=(0,i.useState)([]),M=(0,c.A)(J,2),O=M[0],U=M[1],q=(0,i.useState)(""),H=(0,c.A)(q,2),L=H[0],V=H[1],_=(0,i.useState)(!1),z=(0,c.A)(_,2),G=z[0],K=z[1],Q=function(){g((0,o.Re)()),(0,d.ls)().then(function(e){g(e),(0,o.Rc)(e)}).catch(function(){return g((0,o.Re)())})};(0,i.useEffect)(function(){Q()},[]);var W=function(){C(""),F(""),U([]),V(""),K(!1),Y(null)},X=function(){W(),k(!0)},Z=function(e){Y(e),C(e.name),F(e.phone),U(e.region),V(e.detail),K(e.isDefault),k(!0)},$=function(e){r().showModal({title:"\u786e\u8ba4\u5220\u9664",content:"\u5220\u9664\u540e\u5c06\u65e0\u6cd5\u6062\u590d\u8be5\u5730\u5740",success:function(s){s.confirm&&(0,d.ab)(e).catch(function(){return(0,o.ab)(e)}).finally(Q)}})},ee=function(e){var s="".concat(e.name," ").concat(e.phone,"\n").concat(e.region.join(" ")," ").concat(e.detail);r().setClipboardData({data:s})},se=function(){if(B.trim()&&P.trim()&&0!==O.length&&L.trim()){var e={name:B,phone:P,region:O,detail:L,isDefault:G},s=b?(0,d.yU)(b.id,e):(0,d.FR)(e);s.then(function(){return r().showToast({title:"\u4fdd\u5b58\u6210\u529f",icon:"success"})}).catch(function(){b?(0,o.yU)(b.id,e):(0,o.E1)(e),r().showToast({title:"\u7f51\u7edc\u4e0d\u53ef\u7528\uff0c\u5df2\u6682\u5b58\u5230\u672c\u5730",icon:"none"})}).finally(function(){k(!1),W(),Q()})}else r().showToast({title:"\u8bf7\u586b\u5199\u5b8c\u6574\u4fe1\u606f",icon:"none"})},ae=function(e){U(e.detail.value||[])};return(0,N.jsxs)(t.Ss,{className:"theme-".concat(s),children:[(0,N.jsx)(f.A,{}),(0,N.jsx)(p.A,{title:"\u6536\u8d27\u5730\u5740",targetSelector:".page-header",showBack:!0}),(0,N.jsxs)(t.Ss,{className:"address-page",children:[(0,N.jsx)(t.Ss,{className:"page-header",style:{paddingTop:"".concat(a.statusBarHeight+12,"px")},children:(0,N.jsxs)(t.Ss,{className:"page-header-inner",children:[(0,N.jsx)(t.Ss,{className:"back-btn",onTap:function(){return r().navigateBack()},children:(0,N.jsx)(t.EY,{className:"back-arrow",children:"\u2190"})}),(0,N.jsx)(t.EY,{className:"nav-title",children:"\u6536\u8d27\u5730\u5740"}),(0,N.jsx)(t.Ss,{className:"nav-placeholder"})]})}),(0,N.jsxs)(t.Ss,{className:"address-list",children:[S.map(function(e){return(0,N.jsxs)(t.Ss,{className:"address-card surface-card",children:[(0,N.jsxs)(t.Ss,{className:"address-header",children:[(0,N.jsxs)(t.Ss,{className:"address-user",children:[(0,N.jsx)(t.EY,{className:"address-name",children:e.name}),(0,N.jsx)(t.EY,{className:"address-phone",children:e.phone}),e.isDefault&&(0,N.jsx)(t.Ss,{className:"default-tag",children:(0,N.jsx)(t.EY,{children:"\u9ed8\u8ba4"})})]}),(0,N.jsxs)(t.EY,{className:"address-full",children:[e.region.join(" ")," ",e.detail]})]}),(0,N.jsxs)(t.Ss,{className:"address-actions",children:[(0,N.jsx)(t.EY,{className:"address-act",onTap:function(){return Z(e)},children:"\u7f16\u8f91"}),(0,N.jsx)(t.EY,{className:"address-act",onTap:function(){return ee(e)},children:"\u590d\u5236"}),(0,N.jsx)(t.EY,{className:"address-act delete",onTap:function(){return $(e.id)},children:"\u5220\u9664"})]})]},e.id)}),0===S.length&&(0,N.jsxs)(t.Ss,{className:"empty-state",children:[(0,N.jsx)(t._V,{className:"empty-icon-img",src:(0,j.uq)("/icon/\u5730\u5740.png"),mode:"aspectFit"}),(0,N.jsx)(t.EY,{className:"empty-text",children:"\u8fd8\u6ca1\u6709\u6536\u8d27\u5730\u5740"}),(0,N.jsx)(t.EY,{className:"empty-sub",children:"\u70b9\u51fb\u4e0b\u65b9\u6309\u94ae\u6dfb\u52a0\u65b0\u5730\u5740"})]})]}),(0,N.jsx)(t.Ss,{className:"safe-bottom-placeholder"}),(0,N.jsx)(x.A,{children:(0,N.jsx)(t.Ss,{className:"btn-primary",onTap:X,children:(0,N.jsx)(t.EY,{children:"\u65b0\u589e\u6536\u8d27\u5730\u5740"})})}),w&&(0,N.jsx)(t.Ss,{className:"modal-overlay",children:(0,N.jsxs)(t.Ss,{className:"modal-card surface-card address-form",children:[(0,N.jsx)(t.EY,{className:"modal-title",children:b?"\u7f16\u8f91\u5730\u5740":"\u65b0\u589e\u5730\u5740"}),(0,N.jsx)(t.pd,{className:"form-input",placeholder:"\u6536\u8d27\u4eba\u59d3\u540d",value:B,onInput:function(e){return C(e.detail.value)}}),(0,N.jsx)(t.pd,{className:"form-input",placeholder:"\u624b\u673a\u53f7\u7801",type:"number",value:P,onInput:function(e){return F(e.detail.value)}}),(0,N.jsx)(t.LC,{mode:"region",value:O,onChange:ae,children:(0,N.jsx)(t.Ss,{className:"form-picker",children:(0,N.jsx)(t.EY,{className:O.length?"form-picker-val":"form-picker-ph",children:O.length?O.join(" / "):"\u9009\u62e9\u7701 / \u5e02 / \u533a"})})}),(0,N.jsx)(t.pd,{className:"form-input",placeholder:"\u8be6\u7ec6\u5730\u5740\uff1a\u8857\u9053\u3001\u95e8\u724c\u53f7",value:L,onInput:function(e){return V(e.detail.value)}}),(0,N.jsxs)(t.Ss,{className:"form-row",onTap:function(){return K(!G)},children:[(0,N.jsx)(t.EY,{className:"form-label",children:"\u8bbe\u4e3a\u9ed8\u8ba4\u5730\u5740"}),(0,N.jsx)(t.Ss,{className:"checkbox ".concat(G?"checked":"")})]}),(0,N.jsxs)(t.Ss,{className:"form-actions",children:[(0,N.jsx)(t.Ss,{className:"btn-secondary",onTap:function(){k(!1),W()},children:(0,N.jsx)(t.EY,{children:"\u53d6\u6d88"})}),(0,N.jsx)(t.Ss,{className:"btn-primary",onTap:se,children:(0,N.jsx)(t.EY,{children:"\u4fdd\u5b58"})})]})]})})]})]})}var g={navigationStyle:"custom",enablePageMeta:!0,navigationBarTitleText:"\u6536\u8d27\u5730\u5740"};Page((0,n.createPageConfig)(S,"pages/address/index",{root:{cn:[]}},g||{}))}},function(e){var s=function(s){return e(e.s=s)};e.O(0,[907,96,76],function(){return s(8807)});e.O()}]); \ No newline at end of file +"use strict";(wx["webpackJsonp"]=wx["webpackJsonp"]||[]).push([[81],{8807:function(e,s,a){var n=a(7842),c=a(5544),t=a(118),l=a(758),r=a.n(l),i=a(6540),o=a(1457),d=a(9972),u=a(9703),m=a(9201),h=a(5414),f=a(9674),p=a(3053),x=a(9513),j=a(8199),N=a(4848);function S(){var e=(0,u.wR)(),s=(e.theme,e.resolvedTheme),a=(0,m.c)();(0,h.l)(s);var n=(0,i.useState)([]),l=(0,c.A)(n,2),S=l[0],g=l[1],v=(0,i.useState)(null),E=(0,c.A)(v,2),b=E[0],Y=E[1],y=(0,i.useState)(!1),T=(0,c.A)(y,2),w=T[0],k=T[1],A=(0,i.useState)(""),R=(0,c.A)(A,2),B=R[0],C=R[1],D=(0,i.useState)(""),I=(0,c.A)(D,2),P=I[0],F=I[1],J=(0,i.useState)([]),M=(0,c.A)(J,2),O=M[0],U=M[1],q=(0,i.useState)(""),H=(0,c.A)(q,2),L=H[0],V=H[1],_=(0,i.useState)(!1),z=(0,c.A)(_,2),G=z[0],K=z[1],Q=function(){g((0,o.Re)()),(0,d.ls)().then(function(e){g(e),(0,o.Rc)(e)}).catch(function(){return g((0,o.Re)())})};(0,i.useEffect)(function(){Q()},[]);var W=function(){C(""),F(""),U([]),V(""),K(!1),Y(null)},X=function(){W(),k(!0)},Z=function(e){Y(e),C(e.name),F(e.phone),U(e.region),V(e.detail),K(e.isDefault),k(!0)},$=function(e){r().showModal({title:"\u786e\u8ba4\u5220\u9664",content:"\u5220\u9664\u540e\u5c06\u65e0\u6cd5\u6062\u590d\u8be5\u5730\u5740",success:function(s){s.confirm&&(0,d.ab)(e).catch(function(){return(0,o.ab)(e)}).finally(Q)}})},ee=function(e){var s="".concat(e.name," ").concat(e.phone,"\n").concat(e.region.join(" ")," ").concat(e.detail);r().setClipboardData({data:s})},se=function(){if(B.trim()&&P.trim()&&0!==O.length&&L.trim()){var e={name:B,phone:P,region:O,detail:L,isDefault:G},s=b?(0,d.yU)(b.id,e):(0,d.FR)(e);s.then(function(){return r().showToast({title:"\u4fdd\u5b58\u6210\u529f",icon:"success"})}).catch(function(){b?(0,o.yU)(b.id,e):(0,o.E1)(e),r().showToast({title:"\u7f51\u7edc\u4e0d\u53ef\u7528\uff0c\u5df2\u6682\u5b58\u5230\u672c\u5730",icon:"none"})}).finally(function(){k(!1),W(),Q()})}else r().showToast({title:"\u8bf7\u586b\u5199\u5b8c\u6574\u4fe1\u606f",icon:"none"})},ae=function(e){U(e.detail.value||[])};return(0,N.jsxs)(t.Ss,{className:"theme-".concat(s),children:[(0,N.jsx)(f.A,{}),(0,N.jsx)(p.A,{title:"\u6536\u8d27\u5730\u5740",targetSelector:".page-header",showBack:!0}),(0,N.jsxs)(t.Ss,{className:"address-page",children:[(0,N.jsx)(t.Ss,{className:"page-header",style:{paddingTop:"".concat(a.statusBarHeight+12,"px")},children:(0,N.jsxs)(t.Ss,{className:"page-header-inner",children:[(0,N.jsx)(t.Ss,{className:"back-btn",onTap:function(){return r().navigateBack()},children:(0,N.jsx)(t.EY,{className:"back-arrow",children:"\u2190"})}),(0,N.jsx)(t.EY,{className:"nav-title",children:"\u6536\u8d27\u5730\u5740"}),(0,N.jsx)(t.Ss,{className:"nav-placeholder"})]})}),(0,N.jsxs)(t.Ss,{className:"address-list",children:[S.map(function(e){return(0,N.jsxs)(t.Ss,{className:"address-card surface-card",children:[(0,N.jsxs)(t.Ss,{className:"address-header",children:[(0,N.jsxs)(t.Ss,{className:"address-user",children:[(0,N.jsx)(t.EY,{className:"address-name",children:e.name}),(0,N.jsx)(t.EY,{className:"address-phone",children:e.phone}),e.isDefault&&(0,N.jsx)(t.Ss,{className:"default-tag",children:(0,N.jsx)(t.EY,{children:"\u9ed8\u8ba4"})})]}),(0,N.jsxs)(t.EY,{className:"address-full",children:[e.region.join(" ")," ",e.detail]})]}),(0,N.jsxs)(t.Ss,{className:"address-actions",children:[(0,N.jsx)(t.EY,{className:"address-act",onTap:function(){return Z(e)},children:"\u7f16\u8f91"}),(0,N.jsx)(t.EY,{className:"address-act",onTap:function(){return ee(e)},children:"\u590d\u5236"}),(0,N.jsx)(t.EY,{className:"address-act delete",onTap:function(){return $(e.id)},children:"\u5220\u9664"})]})]},e.id)}),0===S.length&&(0,N.jsxs)(t.Ss,{className:"empty-state",children:[(0,N.jsx)(t._V,{className:"empty-icon-img",src:(0,j.uq)("/icon/\u5730\u5740.png"),mode:"aspectFit"}),(0,N.jsx)(t.EY,{className:"empty-text",children:"\u8fd8\u6ca1\u6709\u6536\u8d27\u5730\u5740"}),(0,N.jsx)(t.EY,{className:"empty-sub",children:"\u70b9\u51fb\u4e0b\u65b9\u6309\u94ae\u6dfb\u52a0\u65b0\u5730\u5740"})]})]}),(0,N.jsx)(t.Ss,{className:"safe-bottom-placeholder"}),(0,N.jsx)(x.A,{children:(0,N.jsx)(t.Ss,{className:"btn-primary",onTap:X,children:(0,N.jsx)(t.EY,{children:"\u65b0\u589e\u6536\u8d27\u5730\u5740"})})}),w&&(0,N.jsx)(t.Ss,{className:"modal-overlay",children:(0,N.jsxs)(t.Ss,{className:"modal-card surface-card address-form",children:[(0,N.jsx)(t.EY,{className:"modal-title",children:b?"\u7f16\u8f91\u5730\u5740":"\u65b0\u589e\u5730\u5740"}),(0,N.jsx)(t.pd,{className:"form-input",placeholder:"\u6536\u8d27\u4eba\u59d3\u540d",value:B,onInput:function(e){return C(e.detail.value)}}),(0,N.jsx)(t.pd,{className:"form-input",placeholder:"\u624b\u673a\u53f7\u7801",type:"number",value:P,onInput:function(e){return F(e.detail.value)}}),(0,N.jsx)(t.LC,{mode:"region",value:O,onChange:ae,children:(0,N.jsx)(t.Ss,{className:"form-picker",children:(0,N.jsx)(t.EY,{className:O.length?"form-picker-val":"form-picker-ph",children:O.length?O.join(" / "):"\u9009\u62e9\u7701 / \u5e02 / \u533a"})})}),(0,N.jsx)(t.pd,{className:"form-input",placeholder:"\u8be6\u7ec6\u5730\u5740\uff1a\u8857\u9053\u3001\u95e8\u724c\u53f7",value:L,onInput:function(e){return V(e.detail.value)}}),(0,N.jsxs)(t.Ss,{className:"form-row",onTap:function(){return K(!G)},children:[(0,N.jsx)(t.EY,{className:"form-label",children:"\u8bbe\u4e3a\u9ed8\u8ba4\u5730\u5740"}),(0,N.jsx)(t.Ss,{className:"checkbox ".concat(G?"checked":"")})]}),(0,N.jsxs)(t.Ss,{className:"form-actions",children:[(0,N.jsx)(t.Ss,{className:"btn-secondary",onTap:function(){k(!1),W()},children:(0,N.jsx)(t.EY,{children:"\u53d6\u6d88"})}),(0,N.jsx)(t.Ss,{className:"btn-primary",onTap:se,children:(0,N.jsx)(t.EY,{children:"\u4fdd\u5b58"})})]})]})})]})]})}var g={navigationStyle:"custom",enablePageMeta:!0,navigationBarTitleText:"\u6536\u8d27\u5730\u5740"};Page((0,n.createPageConfig)(S,"pages/address/index",{root:{cn:[]}},g||{}))}},function(e){var s=function(s){return e(e.s=s)};e.O(0,[907,96,76],function(){return s(8807)});e.O()}]); \ No newline at end of file diff --git a/dist/pages/designList/index.js b/dist/pages/designList/index.js index 261960b..32f36ac 100644 --- a/dist/pages/designList/index.js +++ b/dist/pages/designList/index.js @@ -1 +1 @@ -"use strict";(wx["webpackJsonp"]=wx["webpackJsonp"]||[]).push([[319],{3512:function(e,s,n){var a=n(7842),c=n(5544),t=n(118),i=n(758),l=n.n(i),r=n(6540),d=n(1457),o=n(6845),u=n(5234),h=n(8199),g=n(9703),m=n(9201),x=n(5414),p=n(7723),b=n(9674),f=n(3053),j=n(4848),S=[{code:"all",label:"\u5168\u90e8"},{code:"toDesign",label:"\u5f85\u8bbe\u8ba1"},{code:"undesigned",label:"\u672a\u8bbe\u8ba1"},{code:"designing",label:"\u8bbe\u8ba1\u4e2d"},{code:"processing",label:"\u751f\u4ea7\u4e2d"},{code:"ordered",label:"\u5df2\u4e0b\u5355"}],N=S.filter(function(e){return"undesigned"!==e.code}),v={undesigned:{label:"\u672a\u8bbe\u8ba1",cls:"badge-pink"},designing:{label:"\u8bbe\u8ba1\u4e2d",cls:"badge-blue"},processing:{label:"\u751f\u4ea7\u4e2d",cls:"badge-warning"},ordered:{label:"\u5df2\u4e0b\u5355",cls:"badge-green"}};function w(){var e=(0,g.wR)(),s=e.resolvedTheme,n=(0,m.c)();(0,x.l)(s);var a=(0,r.useState)("all"),i=(0,c.A)(a,2),w=i[0],y=i[1],T=(0,r.useState)([]),E=(0,c.A)(T,2),Y=E[0],k=E[1],A=(0,r.useState)(!1),z=(0,c.A)(A,2),I=z[0],P=z[1],B=(0,r.useState)(new Set),C=(0,c.A)(B,2),F=C[0],L=C[1],M=(0,r.useCallback)(function(){k((0,d.p_)()),(0,o.rP)().then(function(e){k(e),(0,d.Fu)(e)}).catch(function(){return k((0,d.p_)())})},[]),_=(0,r.useCallback)(function(){var e=l().getStorageSync("designList:filter");e&&S.some(function(s){return s.code===e})&&(y(e),l().removeStorageSync("designList:filter")),M()},[M]);(0,r.useEffect)(function(){var e=l().getCurrentInstance().page;if(e){var s=e.onShow;e.onShow=function(){_(),s&&s.apply(this)}}_()},[_]);var q="all"===w?Y:"toDesign"===w?Y.filter(function(e){return"undesigned"===e.status||"designing"===e.status}):Y.filter(function(e){return e.status===w}),D=function(e){"ordered"!==e.status?l().navigateTo({url:"/pages/diy/index?source=designList&designId=".concat(e.id)}):l().showToast({title:"\u8be5\u5546\u54c1\u5df2\u4e0b\u5355\uff0c\u8bf7\u67e5\u770b\u8ba2\u5355",icon:"none"})},J=function(e){var s=new Set(F);s.has(e)?s.delete(e):s.add(e),L(s)},O=function(){F.size===q.length?L(new Set):L(new Set(q.map(function(e){return e.id})))},V=function(){0!==F.size&&l().showModal({title:"\u786e\u8ba4\u5220\u9664",content:"\u786e\u5b9a\u5220\u9664\u9009\u4e2d\u7684 ".concat(F.size," \u4e2a\u6761\u76ee\u5417\uff1f"),success:function(e){if(e.confirm){var s=Array.from(F);L(new Set),P(!1),(0,o.p8)(s).catch(function(){return(0,d.kh)(s)}).finally(M)}}})},H=function(){I?(P(!1),L(new Set)):P(!0)};return(0,j.jsxs)(t.Ss,{className:"theme-".concat(s),children:[(0,j.jsx)(b.A,{}),(0,j.jsx)(f.A,{title:"\u6211\u7684\u8bbe\u8ba1\u6e05\u5355",targetSelector:".page-header.design-header"}),(0,j.jsx)(p.A,{children:(0,j.jsxs)(t.Ss,{className:"design-page",children:[(0,j.jsxs)(t.Ss,{className:"page-header design-header",style:{paddingTop:"".concat(n.statusBarHeight+12,"px")},children:[(0,j.jsx)(t.EY,{className:"header-title",children:"\u6211\u7684\u8bbe\u8ba1\u6e05\u5355"}),(0,j.jsx)(t.Ss,{className:"header-manage",onTap:H,children:(0,j.jsx)(t.EY,{children:I?"\u5b8c\u6210":"\u7ba1\u7406"})})]}),(0,j.jsx)(t.Ss,{className:"status-tabs",children:(0,j.jsx)(t.BM,{className:"tabs-scroll",scrollX:!0,children:N.map(function(e){return(0,j.jsx)(t.Ss,{className:"chip ".concat(w===e.code?"active":""),onTap:function(){return y(e.code)},children:(0,j.jsx)(t.EY,{className:"tab-label",children:e.label})},e.code)})})}),I&&(0,j.jsx)(t.Ss,{className:"batch-bar",children:(0,j.jsxs)(t.Ss,{className:"flex-between",style:{width:"100%"},children:[(0,j.jsxs)(t.Ss,{className:"batch-select-all",onTap:O,children:[(0,j.jsx)(t.Ss,{className:"batch-checkbox ".concat(F.size===q.length&&q.length>0?"checked":"")}),(0,j.jsxs)(t.EY,{className:"batch-text",children:["\u5168\u9009 (",F.size,"/",q.length,")"]})]}),(0,j.jsx)(t.Ss,{className:"batch-delete ".concat(F.size>0?"active":""),onTap:V,children:(0,j.jsx)(t.EY,{children:"\u5220\u9664"})})]})}),(0,j.jsxs)(t.BM,{className:"design-list",scrollY:!0,children:[q.map(function(e){var s=v[e.status]||v.undesigned,n=(e.productIcon||"").startsWith("/icon/")||/^https?:/i.test(e.productIcon||"")?e.productIcon:u.rj[e.productId]||"/icon/\u56db\u89d2\u661f.svg",a=(0,h.uq)(n),c=F.has(e.id);return(0,j.jsxs)(t.Ss,{className:"design-card ".concat(c?"selected":""),onTap:function(){return I?J(e.id):void 0},children:[(0,j.jsxs)(t.Ss,{className:"design-body",children:[I&&(0,j.jsx)(t.Ss,{className:"batch-checkbox ".concat(c?"checked":"")}),(0,j.jsx)(t._V,{className:"design-icon-img",src:a,mode:"aspectFit"}),(0,j.jsxs)(t.Ss,{className:"design-info",children:[(0,j.jsxs)(t.Ss,{className:"design-title-row",children:[(0,j.jsx)(t.EY,{className:"design-name",children:e.productName}),(0,j.jsx)(t.EY,{className:"badge ".concat(s.cls),children:s.label})]}),(0,j.jsxs)(t.EY,{className:"design-meta",children:["\u6570\u91cf: ",e.count," \u4ef6 | \u5355\u4ef7: \xa5",e.unitPrice]}),(0,j.jsxs)(t.EY,{className:"design-total",children:["\u5c0f\u8ba1: \xa5",(e.unitPrice*e.count).toFixed(2)]})]})]}),!I&&(0,j.jsxs)(t.Ss,{className:"design-actions",children:["ordered"!==e.status&&(0,j.jsx)(t.Ss,{className:"btn-primary design-btn",onTap:function(){return D(e)},children:(0,j.jsx)(t.EY,{children:"undesigned"===e.status?"\u5f00\u59cb\u8bbe\u8ba1":"\u7ee7\u7eed\u8bbe\u8ba1"})}),"ordered"===e.status&&(0,j.jsx)(t.Ss,{className:"btn-secondary design-btn",onTap:function(){return l().switchTab({url:"/pages/orders/index"})},children:(0,j.jsx)(t.EY,{children:"\u67e5\u770b\u8ba2\u5355"})})]})]},e.id)}),0===q.length&&(0,j.jsxs)(t.Ss,{className:"empty-state",children:[(0,j.jsx)(t._V,{className:"empty-icon-img",src:(0,h.uq)("/icon/\u8c03\u8272\u76d8.png"),mode:"aspectFit"}),(0,j.jsx)(t.EY,{className:"empty-text",children:"\u8fd8\u6ca1\u6709\u8bbe\u8ba1\u6e05\u5355"}),(0,j.jsx)(t.EY,{className:"empty-sub",children:"\u53bb\u9996\u9875\u901b\u901b\uff0c\u627e\u5230\u559c\u6b22\u7684\u5b9a\u5236\u54c1"}),(0,j.jsx)(t.Ss,{className:"btn-primary",onTap:function(){return l().switchTab({url:"/pages/index/index"})},children:(0,j.jsx)(t.EY,{children:"\u53bb\u901b\u901b"})})]})]})]})})]})}var y={navigationStyle:"custom",enablePageMeta:!0,navigationBarTitleText:"\u8bbe\u8ba1\u6e05\u5355"};Page((0,a.createPageConfig)(w,"pages/designList/index",{root:{cn:[]}},y||{}))}},function(e){var s=function(s){return e(e.s=s)};e.O(0,[907,96,76],function(){return s(3512)});e.O()}]); \ No newline at end of file +"use strict";(wx["webpackJsonp"]=wx["webpackJsonp"]||[]).push([[319],{3512:function(e,s,n){var a=n(7842),c=n(5544),t=n(118),i=n(758),l=n.n(i),r=n(6540),d=n(1457),o=n(9972),u=n(5234),h=n(8199),g=n(9703),m=n(9201),x=n(5414),p=n(7723),b=n(9674),f=n(3053),j=n(4848),S=[{code:"all",label:"\u5168\u90e8"},{code:"toDesign",label:"\u5f85\u8bbe\u8ba1"},{code:"undesigned",label:"\u672a\u8bbe\u8ba1"},{code:"designing",label:"\u8bbe\u8ba1\u4e2d"},{code:"processing",label:"\u751f\u4ea7\u4e2d"},{code:"ordered",label:"\u5df2\u4e0b\u5355"}],N=S.filter(function(e){return"undesigned"!==e.code}),v={undesigned:{label:"\u672a\u8bbe\u8ba1",cls:"badge-pink"},designing:{label:"\u8bbe\u8ba1\u4e2d",cls:"badge-blue"},processing:{label:"\u751f\u4ea7\u4e2d",cls:"badge-warning"},ordered:{label:"\u5df2\u4e0b\u5355",cls:"badge-green"}};function w(){var e=(0,g.wR)(),s=e.resolvedTheme,n=(0,m.c)();(0,x.l)(s);var a=(0,r.useState)("all"),i=(0,c.A)(a,2),w=i[0],y=i[1],T=(0,r.useState)([]),E=(0,c.A)(T,2),Y=E[0],k=E[1],A=(0,r.useState)(!1),z=(0,c.A)(A,2),I=z[0],P=z[1],B=(0,r.useState)(new Set),C=(0,c.A)(B,2),F=C[0],L=C[1],M=(0,r.useCallback)(function(){k((0,d.p_)()),(0,o.rP)().then(function(e){k(e),(0,d.Fu)(e)}).catch(function(){return k((0,d.p_)())})},[]),_=(0,r.useCallback)(function(){var e=l().getStorageSync("designList:filter");e&&S.some(function(s){return s.code===e})&&(y(e),l().removeStorageSync("designList:filter")),M()},[M]);(0,r.useEffect)(function(){var e=l().getCurrentInstance().page;if(e){var s=e.onShow;e.onShow=function(){_(),s&&s.apply(this)}}_()},[_]);var q="all"===w?Y:"toDesign"===w?Y.filter(function(e){return"undesigned"===e.status||"designing"===e.status}):Y.filter(function(e){return e.status===w}),D=function(e){"ordered"!==e.status?l().navigateTo({url:"/pages/diy/index?source=designList&designId=".concat(e.id)}):l().showToast({title:"\u8be5\u5546\u54c1\u5df2\u4e0b\u5355\uff0c\u8bf7\u67e5\u770b\u8ba2\u5355",icon:"none"})},J=function(e){var s=new Set(F);s.has(e)?s.delete(e):s.add(e),L(s)},O=function(){F.size===q.length?L(new Set):L(new Set(q.map(function(e){return e.id})))},V=function(){0!==F.size&&l().showModal({title:"\u786e\u8ba4\u5220\u9664",content:"\u786e\u5b9a\u5220\u9664\u9009\u4e2d\u7684 ".concat(F.size," \u4e2a\u6761\u76ee\u5417\uff1f"),success:function(e){if(e.confirm){var s=Array.from(F);L(new Set),P(!1),(0,o.p8)(s).catch(function(){return(0,d.kh)(s)}).finally(M)}}})},H=function(){I?(P(!1),L(new Set)):P(!0)};return(0,j.jsxs)(t.Ss,{className:"theme-".concat(s),children:[(0,j.jsx)(b.A,{}),(0,j.jsx)(f.A,{title:"\u6211\u7684\u8bbe\u8ba1\u6e05\u5355",targetSelector:".page-header.design-header"}),(0,j.jsx)(p.A,{children:(0,j.jsxs)(t.Ss,{className:"design-page",children:[(0,j.jsxs)(t.Ss,{className:"page-header design-header",style:{paddingTop:"".concat(n.statusBarHeight+12,"px")},children:[(0,j.jsx)(t.EY,{className:"header-title",children:"\u6211\u7684\u8bbe\u8ba1\u6e05\u5355"}),(0,j.jsx)(t.Ss,{className:"header-manage",onTap:H,children:(0,j.jsx)(t.EY,{children:I?"\u5b8c\u6210":"\u7ba1\u7406"})})]}),(0,j.jsx)(t.Ss,{className:"status-tabs",children:(0,j.jsx)(t.BM,{className:"tabs-scroll",scrollX:!0,children:N.map(function(e){return(0,j.jsx)(t.Ss,{className:"chip ".concat(w===e.code?"active":""),onTap:function(){return y(e.code)},children:(0,j.jsx)(t.EY,{className:"tab-label",children:e.label})},e.code)})})}),I&&(0,j.jsx)(t.Ss,{className:"batch-bar",children:(0,j.jsxs)(t.Ss,{className:"flex-between",style:{width:"100%"},children:[(0,j.jsxs)(t.Ss,{className:"batch-select-all",onTap:O,children:[(0,j.jsx)(t.Ss,{className:"batch-checkbox ".concat(F.size===q.length&&q.length>0?"checked":"")}),(0,j.jsxs)(t.EY,{className:"batch-text",children:["\u5168\u9009 (",F.size,"/",q.length,")"]})]}),(0,j.jsx)(t.Ss,{className:"batch-delete ".concat(F.size>0?"active":""),onTap:V,children:(0,j.jsx)(t.EY,{children:"\u5220\u9664"})})]})}),(0,j.jsxs)(t.BM,{className:"design-list",scrollY:!0,children:[q.map(function(e){var s=v[e.status]||v.undesigned,n=(e.productIcon||"").startsWith("/icon/")||/^https?:/i.test(e.productIcon||"")?e.productIcon:u.rj[e.productId]||"/icon/\u56db\u89d2\u661f.svg",a=(0,h.uq)(n),c=F.has(e.id);return(0,j.jsxs)(t.Ss,{className:"design-card ".concat(c?"selected":""),onTap:function(){return I?J(e.id):void 0},children:[(0,j.jsxs)(t.Ss,{className:"design-body",children:[I&&(0,j.jsx)(t.Ss,{className:"batch-checkbox ".concat(c?"checked":"")}),(0,j.jsx)(t._V,{className:"design-icon-img",src:a,mode:"aspectFit"}),(0,j.jsxs)(t.Ss,{className:"design-info",children:[(0,j.jsxs)(t.Ss,{className:"design-title-row",children:[(0,j.jsx)(t.EY,{className:"design-name",children:e.productName}),(0,j.jsx)(t.EY,{className:"badge ".concat(s.cls),children:s.label})]}),(0,j.jsxs)(t.EY,{className:"design-meta",children:["\u6570\u91cf: ",e.count," \u4ef6 | \u5355\u4ef7: \xa5",e.unitPrice]}),(0,j.jsxs)(t.EY,{className:"design-total",children:["\u5c0f\u8ba1: \xa5",(e.unitPrice*e.count).toFixed(2)]})]})]}),!I&&(0,j.jsxs)(t.Ss,{className:"design-actions",children:["ordered"!==e.status&&(0,j.jsx)(t.Ss,{className:"btn-primary design-btn",onTap:function(){return D(e)},children:(0,j.jsx)(t.EY,{children:"undesigned"===e.status?"\u5f00\u59cb\u8bbe\u8ba1":"\u7ee7\u7eed\u8bbe\u8ba1"})}),"ordered"===e.status&&(0,j.jsx)(t.Ss,{className:"btn-secondary design-btn",onTap:function(){return l().switchTab({url:"/pages/orders/index"})},children:(0,j.jsx)(t.EY,{children:"\u67e5\u770b\u8ba2\u5355"})})]})]},e.id)}),0===q.length&&(0,j.jsxs)(t.Ss,{className:"empty-state",children:[(0,j.jsx)(t._V,{className:"empty-icon-img",src:(0,h.uq)("/icon/\u8c03\u8272\u76d8.png"),mode:"aspectFit"}),(0,j.jsx)(t.EY,{className:"empty-text",children:"\u8fd8\u6ca1\u6709\u8bbe\u8ba1\u6e05\u5355"}),(0,j.jsx)(t.EY,{className:"empty-sub",children:"\u53bb\u9996\u9875\u901b\u901b\uff0c\u627e\u5230\u559c\u6b22\u7684\u5b9a\u5236\u54c1"}),(0,j.jsx)(t.Ss,{className:"btn-primary",onTap:function(){return l().switchTab({url:"/pages/index/index"})},children:(0,j.jsx)(t.EY,{children:"\u53bb\u901b\u901b"})})]})]})]})})]})}var y={navigationStyle:"custom",enablePageMeta:!0,navigationBarTitleText:"\u8bbe\u8ba1\u6e05\u5355"};Page((0,a.createPageConfig)(w,"pages/designList/index",{root:{cn:[]}},y||{}))}},function(e){var s=function(s){return e(e.s=s)};e.O(0,[907,96,76],function(){return s(3512)});e.O()}]); \ No newline at end of file diff --git a/dist/pages/diy/index.js b/dist/pages/diy/index.js index c2848b1..5123ef0 100644 --- a/dist/pages/diy/index.js +++ b/dist/pages/diy/index.js @@ -1 +1 @@ -"use strict";(wx["webpackJsonp"]=wx["webpackJsonp"]||[]).push([[95],{8955:function(e,t,a){var s=a(7842),n=a(1212),i=a(467),c=a(9379),r=a(436),o=a(5544),d=a(118),u=a(758),l=a.n(u),h=a(6540),m=a(5234),p=a(1457),g=a(6845),f=a(9703),x=a(9201),v=a(5414),j=a(9674),N=a(3053),y=a(9513),S=a(4848);function w(){var e=(0,f.wR)(),t=(e.theme,e.resolvedTheme),a=(0,x.c)();(0,v.l)(t);var s=(0,h.useState)(null),u=(0,o.A)(s,2),w=u[0],k=u[1],A=(0,h.useState)(1),b=(0,o.A)(A,2),T=(b[0],b[1],(0,h.useState)("")),E=(0,o.A)(T,2),Y=E[0],I=E[1],D=(0,h.useState)(1),M=(0,o.A)(D,2),P=M[0],_=M[1],O=(0,h.useState)([]),F=(0,o.A)(O,2),R=F[0],B=F[1],q=(0,h.useState)(null),z=(0,o.A)(q,2),V=z[0],C=z[1],H=(0,h.useState)(!1),J=(0,o.A)(H,2),X=J[0],G=J[1],L=(0,h.useState)({x:0,y:0}),K=(0,o.A)(L,2),Q=K[0],U=K[1],W=(0,h.useState)(!1),Z=(0,o.A)(W,2),$=Z[0],ee=Z[1],te=(0,h.useState)(!1),ae=(0,o.A)(te,2),se=ae[0],ne=ae[1],ie=function(e,t){(0,g.x9)({productId:e.id,productName:e.name,unitPrice:e.price,count:t}).then(function(e){return(0,p.Fu)([e].concat((0,r.A)((0,p.p_)()))),I(e.id),(0,g.i5)(e.id,{status:"designing"}).then(function(t){(0,p.Fu)((0,p.p_)().map(function(a){return a.id===e.id?(0,c.A)((0,c.A)({},a),{},{status:t.status}):a}))}).catch(function(){(0,p.Fu)((0,p.p_)().map(function(t){return t.id===e.id?(0,c.A)((0,c.A)({},t),{},{status:"designing"}):t}))})}).catch(function(){var a={id:"DSG"+Date.now(),productId:e.id,productName:e.name,productIcon:e.icon,unitPrice:e.price,count:t,status:"designing",createdAt:(new Date).toISOString().slice(0,10)};(0,p.Fu)([].concat((0,r.A)((0,p.p_)()),[a])),I(a.id)})};(0,h.useEffect)(function(){var e=l().getCurrentInstance().router,t=e?e.params:void 0,a=t?t.source:void 0,s=t&&t.productId||t&&t.category;if("product"===a&&s){var n=(0,m.y9)(s);if(n){k(n);var i=Number(t?t.quantity:void 0)||1;_(i),ie(n,i)}}else if("designList"===a&&t&&t.designId){var r=t.designId,o=(0,p.p_)(),d=o.find(function(e){return e.id===r});if(d){I(r),_(d.count);var u=(0,m.y9)(d.productId);u&&k(u);var h=d.designData,f=h?h.stickers:void 0;if(f){var x=h&&h.category&&h.category.mask||(u?u.mask:void 0),v=x?f.map(function(e){if(e.width>x.width||e.height>x.height){var t=.6*Math.min(x.width,x.height)/Math.max(e.width,e.height);return(0,c.A)((0,c.A)({},e),{},{width:Math.round(e.width*t),height:Math.round(e.height*t)})}return e}):f;B(v)}else if(h?h.imageSrc:void 0){var j={id:"legacy_"+Date.now(),src:h.imageSrc,x:h.imagePos&&h.imagePos.x||0,y:h.imagePos&&h.imagePos.y||0,scale:h.imagePos&&h.imagePos.scale||1,width:200,height:200,isOverlapping:!1};B([j])}"undesigned"===d.status&&((0,p.i5)(r,{status:"designing"}),(0,g.i5)(r,{status:"designing"}).catch(function(){}))}}else if(s){var N=(0,m.y9)(s);N&&(k(N),ie(N,1))}},[]);var ce=(0,h.useRef)(null),re=(0,h.useRef)({designId:"",quantity:1,category:null,stickers:[]});re.current={designId:Y,quantity:P,category:w,stickers:R};var oe=function(){var e=re.current,t=e.designId,a=e.quantity,s=e.category,n=e.stickers;if(t&&s){var i=(0,p.p_)().find(function(e){return e.id===t}),r=(0,c.A)((0,c.A)({},i&&i.designData?i.designData:{}),{},{version:1,category:(0,c.A)({id:s.id,mask:s.mask},s.tone?{tone:s.tone}:{}),stickers:n});(0,p.i5)(t,{designData:r}),(0,g.i5)(t,{item:{productId:s.id,productName:s.name,unitPrice:s.price,count:a,designData:r}}).catch(function(){})}},de=function(){ce.current&&(clearTimeout(ce.current),ce.current=null),oe()};l().useDidHide(de),(0,h.useEffect)(function(){return de},[]);var ue=(0,h.useRef)(!0);(0,h.useEffect)(function(){ue.current?ue.current=!1:(ce.current&&clearTimeout(ce.current),ce.current=setTimeout(oe,800))},[R]);var le=(0,h.useRef)(!0);l().useDidShow(function(){if(le.current)le.current=!1;else{var e=re.current.designId;if(e){var t=(0,p.p_)().find(function(t){return t.id===e}),a=t&&t.designData?t.designData.stickers:void 0;a&&a.length&&B(he(a))}}});var he=function(e){for(var t=e.map(function(e){return(0,c.A)((0,c.A)({},e),{},{isOverlapping:!1})}),a=0;ai.x&&n.yi.y&&(t[a].isOverlapping=!0,t[s].isOverlapping=!0)}var l=t.some(function(e){return e.isOverlapping});return ne(l),t},me=function(){l().chooseImage({count:1,sizeType:["compressed"],sourceType:["album","camera"],success:function(e){var t=e.tempFilePaths[0];l().getImageInfo({src:t,success:function(e){var a=Math.min(w.mask.width,w.mask.height),s=.6*a/Math.max(e.width,e.height),n={id:"stk_"+Date.now(),src:t,x:0,y:0,scale:1,width:Math.round(e.width*s),height:Math.round(e.height*s),isOverlapping:!1},i=[].concat((0,r.A)(R),[n]),c=he(i);B(c),C(n.id)},fail:function(){var e=Math.min(w.mask.width,w.mask.height),a=.6*e/200,s={id:"stk_"+Date.now(),src:t,x:0,y:0,scale:1,width:Math.round(200*a),height:Math.round(200*a),isOverlapping:!1},n=[].concat((0,r.A)(R),[s]),i=he(n);B(i),C(s.id)}})}})},pe=function(e){var t=R.filter(function(t){return t.id!==e}),a=he(t);B(a),V===e&&C(null)},ge=function(e,t){var a=e.touches[0],s=R.find(function(e){return e.id===t});s&&(C(t),G(!0),U({x:a.clientX-s.x,y:a.clientY-s.y}))},fe=function(e){if(X&&V){var t=e.touches[0],a=R.map(function(e){return e.id!==V?e:(0,c.A)((0,c.A)({},e),{},{x:t.clientX-Q.x,y:t.clientY-Q.y})}),s=he(a);B(s)}},xe=function(){return G(!1)},ve=function(){V&&Y&&(de(),l().navigateTo({url:"/pages/diy/stickerEdit/index?designId=".concat(Y,"&stickerId=").concat(V)}))},je=function(e,t){var a=R.map(function(a){return a.id!==e?a:(0,c.A)((0,c.A)({},a),{},{scale:Math.max(.3,Math.min(3,a.scale+t))})}),s=he(a);B(s)},Ne=function(e){var t=e.edits;if(t){var a=t.brightness||0,s=t.hue||0,n=t.contrast||0;if(0!==a||0!==s||0!==n)return"brightness(".concat(100+a,"%) hue-rotate(").concat(s,"deg) contrast(").concat(100+n,"%)")}},ye=function(){l().navigateBack()},Se=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},we=function(){var e=(0,i.A)((0,n.A)().m(function e(){var t,a,s,i;return(0,n.A)().w(function(e){while(1)switch(e.p=e.n){case 0:if(!se){e.n=1;break}return l().showToast({title:"\u8d34\u7eb8\u4e0d\u80fd\u91cd\u53e0",icon:"none"}),e.a(2);case 1:if(!Y||!w){e.n=6;break}return e.n=2,(0,g.x5)({stickers:R,category:w,version:1});case 2:return t=e.v,a=(0,c.A)({id:w.id,mask:w.mask},w.tone?{tone:w.tone}:{}),s=(0,p.p_)().find(function(e){return e.id===Y}),i=(0,c.A)((0,c.A)({},s&&s.designData?s.designData:{}),{},{version:1,category:a,stickers:t.stickers||R}),(0,p.i5)(Y,{status:"designing",designData:i}),e.p=3,e.n=4,(0,g.i5)(Y,{status:"designing",item:{productId:w.id,productName:w.name,unitPrice:w.price,count:P,designData:i}});case 4:e.n=6;break;case 5:e.p=5,e.v,l().showToast({title:"\u7f51\u7edc\u4e0d\u53ef\u7528\uff0c\u5df2\u6682\u5b58\u5230\u672c\u5730",icon:"none"});case 6:ee(!1),l().navigateTo({url:"/pages/checkout/index?designId=".concat(Y)});case 7:return e.a(2)}},e,null,[[3,5]])}));return function(){return e.apply(this,arguments)}}(),ke=V?R.find(function(e){return e.id===V}):void 0,Ae=ke?ke.scale:1;return w?(0,S.jsxs)(d.Ss,{className:"theme-".concat(t),children:[(0,S.jsx)(j.A,{}),(0,S.jsx)(N.A,{title:"\u8bbe\u8ba1\u5de5\u4f5c\u53f0",targetSelector:".page-header.surface-card",showBack:!0}),(0,S.jsxs)(d.Ss,{className:"diy-page",children:[(0,S.jsx)(d.Ss,{className:"page-header surface-card",style:{paddingTop:"".concat(a.statusBarHeight+12,"px")},children:(0,S.jsxs)(d.Ss,{className:"flex-between",style:{width:"100%"},children:[(0,S.jsx)(d.EY,{className:"back-btn",onTap:ye,children:"\u2190"}),(0,S.jsx)(d.EY,{className:"page-title",children:"\u8bbe\u8ba1\u5de5\u4f5c\u53f0"}),(0,S.jsx)(d.Ss,{className:"header-spacer"})]})}),(0,S.jsx)(d.Ss,{className:"canvas-wrapper surface-card mt-20",catchMove:!0,children:(0,S.jsxs)(d.Ss,{className:"canvas-area",style:Se(),children:[R.map(function(e){return(0,S.jsx)(d._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:X&&V===e.id?.8:1,zIndex:V===e.id?10:5,filter:Ne(e),width:e.width||200,height:e.height||200},onTouchStart:function(t){return ge(t,e.id)},onTouchMove:fe,onTouchEnd:xe,onTap:function(){return C(e.id)},mode:"aspectFit"},e.id)}),(0,S.jsx)(d.Ss,{className:"mask-border",style:Se()})]})}),(0,S.jsxs)(d.Ss,{className:"sticker-panel surface-card mt-20",children:[(0,S.jsx)(d.EY,{className:"section-title",children:"\u8d34\u7eb8"}),(0,S.jsxs)(d.Ss,{className:"sticker-list",children:[R.map(function(e){return(0,S.jsxs)(d.Ss,{className:"sticker-thumb ".concat(e.isOverlapping?"overlap":""," ").concat(V===e.id?"active":""),children:[(0,S.jsx)(d._V,{src:e.src,className:"sticker-thumb-img",mode:"aspectFit",onTap:function(){return C(e.id)}}),(0,S.jsx)(d.Ss,{className:"sticker-del",onTap:function(){return pe(e.id)},children:(0,S.jsx)(d.EY,{className:"del-icon",children:"\xd7"})})]},e.id)}),(0,S.jsxs)(d.Ss,{className:"sticker-add-btn",onTap:me,children:[(0,S.jsx)(d.EY,{className:"add-icon",children:"+"}),(0,S.jsx)(d.EY,{className:"add-label",children:"\u6dfb\u52a0"})]})]}),se&&(0,S.jsx)(d.EY,{className:"overlap-hint",children:"\u6709\u8d34\u7eb8\u91cd\u53e0\uff0c\u8bf7\u8c03\u6574\u4f4d\u7f6e"})]}),V&&(0,S.jsxs)(d.Ss,{className:"toolbar surface-card mt-20",children:[(0,S.jsxs)(d.Ss,{className:"tool-row",children:[(0,S.jsx)(d.EY,{className:"tool-label",children:"\u7f29\u653e"}),(0,S.jsxs)(d.Ss,{className:"flex-center",style:{gap:"20px"},children:[(0,S.jsx)(d.Ss,{className:"tool-btn",onTap:function(){return je(V,-.1)},children:"\uff0d"}),(0,S.jsxs)(d.EY,{className:"tool-value",children:[Math.round(100*Ae),"%"]}),(0,S.jsx)(d.Ss,{className:"tool-btn",onTap:function(){return je(V,.1)},children:"\uff0b"})]})]}),(0,S.jsxs)(d.Ss,{className:"tool-row",children:[(0,S.jsx)(d.EY,{className:"tool-label",children:"\u63d0\u793a"}),(0,S.jsx)(d.EY,{className:"tool-hint",children:"\u62d6\u52a8\u8c03\u6574\u4f4d\u7f6e\uff0c\u8d34\u7eb8\u4e0d\u53ef\u91cd\u53e0"})]})]}),(0,S.jsx)(d.Ss,{className:"edit-btn-bar mt-20",children:(0,S.jsx)(d.Ss,{className:"edit-btn ".concat(V?"active":"disabled"),onTap:ve,children:(0,S.jsx)(d.EY,{children:"\u7f16\u8f91"})})}),(0,S.jsxs)(y.A,{children:[(0,S.jsx)(d.Ss,{className:"btn-primary",onTap:function(){return ee(!0)},children:(0,S.jsx)(d.EY,{children:"\u9884\u89c8\u6548\u679c"})}),(0,S.jsx)(d.Ss,{className:"btn-secondary",onTap:me,children:(0,S.jsx)(d.EY,{children:"\u6dfb\u52a0\u8d34\u7eb8"})})]}),$&&(0,S.jsx)(d.Ss,{className:"preview-overlay",children:(0,S.jsxs)(d.Ss,{className:"preview-card surface-card",children:[(0,S.jsx)(d.EY,{className:"preview-title",children:"\u786e\u8ba4\u6548\u679c"}),(0,S.jsx)(d.Ss,{className:"preview-canvas",style:Se(),children:R.map(function(e){return(0,S.jsx)(d._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,")"),filter:Ne(e),width:e.width||200,height:e.height||200},mode:"aspectFit"},e.id)})}),(0,S.jsxs)(d.Ss,{className:"product-info",children:[(0,S.jsx)(d.EY,{className:"product-name",children:w.name}),(0,S.jsxs)(d.EY,{className:"product-size",children:["\u753b\u5e03\u5c3a\u5bf8: ",w.mask.width," \xd7 ",w.mask.height," px"]}),se&&(0,S.jsx)(d.EY,{className:"overlap-hint",children:"\u8d34\u7eb8\u6709\u91cd\u53e0\uff0c\u4e0d\u53ef\u63d0\u4ea4"})]}),(0,S.jsxs)(d.Ss,{className:"preview-actions",children:[(0,S.jsx)(d.Ss,{className:"btn-secondary",onTap:function(){return ee(!1)},children:(0,S.jsx)(d.EY,{children:"\u8fd4\u56de\u4fee\u6539"})}),(0,S.jsx)(d.Ss,{className:"btn-primary ".concat(se?"disabled":""),onTap:we,children:(0,S.jsx)(d.EY,{children:"\u786e\u8ba4\u5b8c\u6210"})})]})]})}),(0,S.jsx)(d.Ss,{className:"safe-bottom-placeholder"})]})]}):(0,S.jsxs)(d.Ss,{className:"theme-".concat(t),children:[(0,S.jsx)(j.A,{}),(0,S.jsx)(N.A,{title:"\u8bbe\u8ba1\u5de5\u4f5c\u53f0",targetSelector:".page-header.surface-card",showBack:!0}),(0,S.jsx)(d.Ss,{className:"diy-page",children:(0,S.jsx)(d.EY,{className:"page-title",children:"\u52a0\u8f7d\u4e2d..."})})]})}var k={navigationStyle:"custom",enablePageMeta:!0,navigationBarTitleText:"DIY\u5de5\u4f5c\u53f0"};Page((0,s.createPageConfig)(w,"pages/diy/index",{root:{cn:[]}},k||{}))}},function(e){var t=function(t){return e(e.s=t)};e.O(0,[907,96,76],function(){return t(8955)});e.O()}]); \ No newline at end of file +"use strict";(wx["webpackJsonp"]=wx["webpackJsonp"]||[]).push([[95],{8955:function(e,t,a){var s=a(7842),n=a(1212),i=a(467),c=a(9379),r=a(436),o=a(5544),d=a(118),u=a(758),l=a.n(u),h=a(6540),m=a(5234),p=a(1457),g=a(9972),f=a(9703),x=a(9201),v=a(5414),j=a(9674),N=a(3053),y=a(9513),S=a(4848);function w(){var e=(0,f.wR)(),t=(e.theme,e.resolvedTheme),a=(0,x.c)();(0,v.l)(t);var s=(0,h.useState)(null),u=(0,o.A)(s,2),w=u[0],k=u[1],A=(0,h.useState)(1),b=(0,o.A)(A,2),T=(b[0],b[1],(0,h.useState)("")),E=(0,o.A)(T,2),Y=E[0],I=E[1],D=(0,h.useState)(1),M=(0,o.A)(D,2),P=M[0],_=M[1],O=(0,h.useState)([]),F=(0,o.A)(O,2),R=F[0],B=F[1],q=(0,h.useState)(null),z=(0,o.A)(q,2),V=z[0],C=z[1],H=(0,h.useState)(!1),J=(0,o.A)(H,2),X=J[0],G=J[1],L=(0,h.useState)({x:0,y:0}),K=(0,o.A)(L,2),Q=K[0],U=K[1],W=(0,h.useState)(!1),Z=(0,o.A)(W,2),$=Z[0],ee=Z[1],te=(0,h.useState)(!1),ae=(0,o.A)(te,2),se=ae[0],ne=ae[1],ie=function(e,t){(0,g.x9)({productId:e.id,productName:e.name,unitPrice:e.price,count:t}).then(function(e){return(0,p.Fu)([e].concat((0,r.A)((0,p.p_)()))),I(e.id),(0,g.i5)(e.id,{status:"designing"}).then(function(t){(0,p.Fu)((0,p.p_)().map(function(a){return a.id===e.id?(0,c.A)((0,c.A)({},a),{},{status:t.status}):a}))}).catch(function(){(0,p.Fu)((0,p.p_)().map(function(t){return t.id===e.id?(0,c.A)((0,c.A)({},t),{},{status:"designing"}):t}))})}).catch(function(){var a={id:"DSG"+Date.now(),productId:e.id,productName:e.name,productIcon:e.icon,unitPrice:e.price,count:t,status:"designing",createdAt:(new Date).toISOString().slice(0,10)};(0,p.Fu)([].concat((0,r.A)((0,p.p_)()),[a])),I(a.id)})};(0,h.useEffect)(function(){var e=l().getCurrentInstance().router,t=e?e.params:void 0,a=t?t.source:void 0,s=t&&t.productId||t&&t.category;if("product"===a&&s){var n=(0,m.y9)(s);if(n){k(n);var i=Number(t?t.quantity:void 0)||1;_(i),ie(n,i)}}else if("designList"===a&&t&&t.designId){var r=t.designId,o=(0,p.p_)(),d=o.find(function(e){return e.id===r});if(d){I(r),_(d.count);var u=(0,m.y9)(d.productId);u&&k(u);var h=d.designData,f=h?h.stickers:void 0;if(f){var x=h&&h.category&&h.category.mask||(u?u.mask:void 0),v=x?f.map(function(e){if(e.width>x.width||e.height>x.height){var t=.6*Math.min(x.width,x.height)/Math.max(e.width,e.height);return(0,c.A)((0,c.A)({},e),{},{width:Math.round(e.width*t),height:Math.round(e.height*t)})}return e}):f;B(v)}else if(h?h.imageSrc:void 0){var j={id:"legacy_"+Date.now(),src:h.imageSrc,x:h.imagePos&&h.imagePos.x||0,y:h.imagePos&&h.imagePos.y||0,scale:h.imagePos&&h.imagePos.scale||1,width:200,height:200,isOverlapping:!1};B([j])}"undesigned"===d.status&&((0,p.i5)(r,{status:"designing"}),(0,g.i5)(r,{status:"designing"}).catch(function(){}))}}else if(s){var N=(0,m.y9)(s);N&&(k(N),ie(N,1))}},[]);var ce=(0,h.useRef)(null),re=(0,h.useRef)({designId:"",quantity:1,category:null,stickers:[]});re.current={designId:Y,quantity:P,category:w,stickers:R};var oe=function(){var e=re.current,t=e.designId,a=e.quantity,s=e.category,n=e.stickers;if(t&&s){var i=(0,p.p_)().find(function(e){return e.id===t}),r=(0,c.A)((0,c.A)({},i&&i.designData?i.designData:{}),{},{version:1,category:(0,c.A)({id:s.id,mask:s.mask},s.tone?{tone:s.tone}:{}),stickers:n});(0,p.i5)(t,{designData:r}),(0,g.i5)(t,{item:{productId:s.id,productName:s.name,unitPrice:s.price,count:a,designData:r}}).catch(function(){})}},de=function(){ce.current&&(clearTimeout(ce.current),ce.current=null),oe()};l().useDidHide(de),(0,h.useEffect)(function(){return de},[]);var ue=(0,h.useRef)(!0);(0,h.useEffect)(function(){ue.current?ue.current=!1:(ce.current&&clearTimeout(ce.current),ce.current=setTimeout(oe,800))},[R]);var le=(0,h.useRef)(!0);l().useDidShow(function(){if(le.current)le.current=!1;else{var e=re.current.designId;if(e){var t=(0,p.p_)().find(function(t){return t.id===e}),a=t&&t.designData?t.designData.stickers:void 0;a&&a.length&&B(he(a))}}});var he=function(e){for(var t=e.map(function(e){return(0,c.A)((0,c.A)({},e),{},{isOverlapping:!1})}),a=0;ai.x&&n.yi.y&&(t[a].isOverlapping=!0,t[s].isOverlapping=!0)}var l=t.some(function(e){return e.isOverlapping});return ne(l),t},me=function(){l().chooseImage({count:1,sizeType:["compressed"],sourceType:["album","camera"],success:function(e){var t=e.tempFilePaths[0];l().getImageInfo({src:t,success:function(e){var a=Math.min(w.mask.width,w.mask.height),s=.6*a/Math.max(e.width,e.height),n={id:"stk_"+Date.now(),src:t,x:0,y:0,scale:1,width:Math.round(e.width*s),height:Math.round(e.height*s),isOverlapping:!1},i=[].concat((0,r.A)(R),[n]),c=he(i);B(c),C(n.id)},fail:function(){var e=Math.min(w.mask.width,w.mask.height),a=.6*e/200,s={id:"stk_"+Date.now(),src:t,x:0,y:0,scale:1,width:Math.round(200*a),height:Math.round(200*a),isOverlapping:!1},n=[].concat((0,r.A)(R),[s]),i=he(n);B(i),C(s.id)}})}})},pe=function(e){var t=R.filter(function(t){return t.id!==e}),a=he(t);B(a),V===e&&C(null)},ge=function(e,t){var a=e.touches[0],s=R.find(function(e){return e.id===t});s&&(C(t),G(!0),U({x:a.clientX-s.x,y:a.clientY-s.y}))},fe=function(e){if(X&&V){var t=e.touches[0],a=R.map(function(e){return e.id!==V?e:(0,c.A)((0,c.A)({},e),{},{x:t.clientX-Q.x,y:t.clientY-Q.y})}),s=he(a);B(s)}},xe=function(){return G(!1)},ve=function(){V&&Y&&(de(),l().navigateTo({url:"/pages/diy/stickerEdit/index?designId=".concat(Y,"&stickerId=").concat(V)}))},je=function(e,t){var a=R.map(function(a){return a.id!==e?a:(0,c.A)((0,c.A)({},a),{},{scale:Math.max(.3,Math.min(3,a.scale+t))})}),s=he(a);B(s)},Ne=function(e){var t=e.edits;if(t){var a=t.brightness||0,s=t.hue||0,n=t.contrast||0;if(0!==a||0!==s||0!==n)return"brightness(".concat(100+a,"%) hue-rotate(").concat(s,"deg) contrast(").concat(100+n,"%)")}},ye=function(){l().navigateBack()},Se=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},we=function(){var e=(0,i.A)((0,n.A)().m(function e(){var t,a,s,i;return(0,n.A)().w(function(e){while(1)switch(e.p=e.n){case 0:if(!se){e.n=1;break}return l().showToast({title:"\u8d34\u7eb8\u4e0d\u80fd\u91cd\u53e0",icon:"none"}),e.a(2);case 1:if(!Y||!w){e.n=6;break}return e.n=2,(0,g.x5)({stickers:R,category:w,version:1});case 2:return t=e.v,a=(0,c.A)({id:w.id,mask:w.mask},w.tone?{tone:w.tone}:{}),s=(0,p.p_)().find(function(e){return e.id===Y}),i=(0,c.A)((0,c.A)({},s&&s.designData?s.designData:{}),{},{version:1,category:a,stickers:t.stickers||R}),(0,p.i5)(Y,{status:"designing",designData:i}),e.p=3,e.n=4,(0,g.i5)(Y,{status:"designing",item:{productId:w.id,productName:w.name,unitPrice:w.price,count:P,designData:i}});case 4:e.n=6;break;case 5:e.p=5,e.v,l().showToast({title:"\u7f51\u7edc\u4e0d\u53ef\u7528\uff0c\u5df2\u6682\u5b58\u5230\u672c\u5730",icon:"none"});case 6:ee(!1),l().navigateTo({url:"/pages/checkout/index?designId=".concat(Y)});case 7:return e.a(2)}},e,null,[[3,5]])}));return function(){return e.apply(this,arguments)}}(),ke=V?R.find(function(e){return e.id===V}):void 0,Ae=ke?ke.scale:1;return w?(0,S.jsxs)(d.Ss,{className:"theme-".concat(t),children:[(0,S.jsx)(j.A,{}),(0,S.jsx)(N.A,{title:"\u8bbe\u8ba1\u5de5\u4f5c\u53f0",targetSelector:".page-header.surface-card",showBack:!0}),(0,S.jsxs)(d.Ss,{className:"diy-page",children:[(0,S.jsx)(d.Ss,{className:"page-header surface-card",style:{paddingTop:"".concat(a.statusBarHeight+12,"px")},children:(0,S.jsxs)(d.Ss,{className:"flex-between",style:{width:"100%"},children:[(0,S.jsx)(d.EY,{className:"back-btn",onTap:ye,children:"\u2190"}),(0,S.jsx)(d.EY,{className:"page-title",children:"\u8bbe\u8ba1\u5de5\u4f5c\u53f0"}),(0,S.jsx)(d.Ss,{className:"header-spacer"})]})}),(0,S.jsx)(d.Ss,{className:"canvas-wrapper surface-card mt-20",catchMove:!0,children:(0,S.jsxs)(d.Ss,{className:"canvas-area",style:Se(),children:[R.map(function(e){return(0,S.jsx)(d._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:X&&V===e.id?.8:1,zIndex:V===e.id?10:5,filter:Ne(e),width:e.width||200,height:e.height||200},onTouchStart:function(t){return ge(t,e.id)},onTouchMove:fe,onTouchEnd:xe,onTap:function(){return C(e.id)},mode:"aspectFit"},e.id)}),(0,S.jsx)(d.Ss,{className:"mask-border",style:Se()})]})}),(0,S.jsxs)(d.Ss,{className:"sticker-panel surface-card mt-20",children:[(0,S.jsx)(d.EY,{className:"section-title",children:"\u8d34\u7eb8"}),(0,S.jsxs)(d.Ss,{className:"sticker-list",children:[R.map(function(e){return(0,S.jsxs)(d.Ss,{className:"sticker-thumb ".concat(e.isOverlapping?"overlap":""," ").concat(V===e.id?"active":""),children:[(0,S.jsx)(d._V,{src:e.src,className:"sticker-thumb-img",mode:"aspectFit",onTap:function(){return C(e.id)}}),(0,S.jsx)(d.Ss,{className:"sticker-del",onTap:function(){return pe(e.id)},children:(0,S.jsx)(d.EY,{className:"del-icon",children:"\xd7"})})]},e.id)}),(0,S.jsxs)(d.Ss,{className:"sticker-add-btn",onTap:me,children:[(0,S.jsx)(d.EY,{className:"add-icon",children:"+"}),(0,S.jsx)(d.EY,{className:"add-label",children:"\u6dfb\u52a0"})]})]}),se&&(0,S.jsx)(d.EY,{className:"overlap-hint",children:"\u6709\u8d34\u7eb8\u91cd\u53e0\uff0c\u8bf7\u8c03\u6574\u4f4d\u7f6e"})]}),V&&(0,S.jsxs)(d.Ss,{className:"toolbar surface-card mt-20",children:[(0,S.jsxs)(d.Ss,{className:"tool-row",children:[(0,S.jsx)(d.EY,{className:"tool-label",children:"\u7f29\u653e"}),(0,S.jsxs)(d.Ss,{className:"flex-center",style:{gap:"20px"},children:[(0,S.jsx)(d.Ss,{className:"tool-btn",onTap:function(){return je(V,-.1)},children:"\uff0d"}),(0,S.jsxs)(d.EY,{className:"tool-value",children:[Math.round(100*Ae),"%"]}),(0,S.jsx)(d.Ss,{className:"tool-btn",onTap:function(){return je(V,.1)},children:"\uff0b"})]})]}),(0,S.jsxs)(d.Ss,{className:"tool-row",children:[(0,S.jsx)(d.EY,{className:"tool-label",children:"\u63d0\u793a"}),(0,S.jsx)(d.EY,{className:"tool-hint",children:"\u62d6\u52a8\u8c03\u6574\u4f4d\u7f6e\uff0c\u8d34\u7eb8\u4e0d\u53ef\u91cd\u53e0"})]})]}),(0,S.jsx)(d.Ss,{className:"edit-btn-bar mt-20",children:(0,S.jsx)(d.Ss,{className:"edit-btn ".concat(V?"active":"disabled"),onTap:ve,children:(0,S.jsx)(d.EY,{children:"\u7f16\u8f91"})})}),(0,S.jsxs)(y.A,{children:[(0,S.jsx)(d.Ss,{className:"btn-primary",onTap:function(){return ee(!0)},children:(0,S.jsx)(d.EY,{children:"\u9884\u89c8\u6548\u679c"})}),(0,S.jsx)(d.Ss,{className:"btn-secondary",onTap:me,children:(0,S.jsx)(d.EY,{children:"\u6dfb\u52a0\u8d34\u7eb8"})})]}),$&&(0,S.jsx)(d.Ss,{className:"preview-overlay",children:(0,S.jsxs)(d.Ss,{className:"preview-card surface-card",children:[(0,S.jsx)(d.EY,{className:"preview-title",children:"\u786e\u8ba4\u6548\u679c"}),(0,S.jsx)(d.Ss,{className:"preview-canvas",style:Se(),children:R.map(function(e){return(0,S.jsx)(d._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,")"),filter:Ne(e),width:e.width||200,height:e.height||200},mode:"aspectFit"},e.id)})}),(0,S.jsxs)(d.Ss,{className:"product-info",children:[(0,S.jsx)(d.EY,{className:"product-name",children:w.name}),(0,S.jsxs)(d.EY,{className:"product-size",children:["\u753b\u5e03\u5c3a\u5bf8: ",w.mask.width," \xd7 ",w.mask.height," px"]}),se&&(0,S.jsx)(d.EY,{className:"overlap-hint",children:"\u8d34\u7eb8\u6709\u91cd\u53e0\uff0c\u4e0d\u53ef\u63d0\u4ea4"})]}),(0,S.jsxs)(d.Ss,{className:"preview-actions",children:[(0,S.jsx)(d.Ss,{className:"btn-secondary",onTap:function(){return ee(!1)},children:(0,S.jsx)(d.EY,{children:"\u8fd4\u56de\u4fee\u6539"})}),(0,S.jsx)(d.Ss,{className:"btn-primary ".concat(se?"disabled":""),onTap:we,children:(0,S.jsx)(d.EY,{children:"\u786e\u8ba4\u5b8c\u6210"})})]})]})}),(0,S.jsx)(d.Ss,{className:"safe-bottom-placeholder"})]})]}):(0,S.jsxs)(d.Ss,{className:"theme-".concat(t),children:[(0,S.jsx)(j.A,{}),(0,S.jsx)(N.A,{title:"\u8bbe\u8ba1\u5de5\u4f5c\u53f0",targetSelector:".page-header.surface-card",showBack:!0}),(0,S.jsx)(d.Ss,{className:"diy-page",children:(0,S.jsx)(d.EY,{className:"page-title",children:"\u52a0\u8f7d\u4e2d..."})})]})}var k={navigationStyle:"custom",enablePageMeta:!0,navigationBarTitleText:"DIY\u5de5\u4f5c\u53f0"};Page((0,s.createPageConfig)(w,"pages/diy/index",{root:{cn:[]}},k||{}))}},function(e){var t=function(t){return e(e.s=t)};e.O(0,[907,96,76],function(){return t(8955)});e.O()}]); \ No newline at end of file diff --git a/dist/pages/diy/stickerEdit/index.js b/dist/pages/diy/stickerEdit/index.js index ba33f6e..09e3f53 100644 --- a/dist/pages/diy/stickerEdit/index.js +++ b/dist/pages/diy/stickerEdit/index.js @@ -1 +1 @@ -"use strict";(wx["webpackJsonp"]=wx["webpackJsonp"]||[]).push([[339],{9519:function(e,s,t){var a=t(7842),n=t(1212),c=t(467),i=t(9379),r=t(5544),l=t(118),d=t(758),o=t.n(d),u=t(6540),h=t(1457),m=t(6845),x=t(9703),f=t(9201),j=t(5414),g=t(9674),p=t(3053),v=t(9513),N=t(4848),S=function(e,s,t){return Math.min(Math.max(e,s),t)};function w(e){var s=e.id,t=e.value,a=e.min,n=e.max,c=e.onChange,i=e.format,r=(0,u.useRef)(null),d=function(e){o().createSelectorQuery().select("#".concat(s)).boundingClientRect(function(s){s&&s.width>0&&(r.current={left:s.left,width:s.width}),e&&e()}).exec()},h=function(e){var s=r.current;if(!s||!s.width)return t;var c=S((e-s.left)/s.width,0,1);return S(a+(n-a)*c,a,n)},m=function(e){var s=e.touches&&e.touches[0];s&&d(function(){return c(h(s.clientX))})},x=function(e){var s=e.touches&&e.touches[0];s&&(r.current?c(h(s.clientX)):d(function(){return c(h(s.clientX))}))},f="".concat((t-a)/(n-a)*100,"%");return(0,N.jsxs)(l.Ss,{className:"slider-wrap",children:[(0,N.jsxs)(l.Ss,{id:s,className:"slider-track",onTouchStart:m,onTouchMove:x,onTouchEnd:function(){},children:[(0,N.jsx)(l.Ss,{className:"slider-fill",style:{width:f}}),(0,N.jsx)(l.Ss,{className:"slider-thumb",style:{left:f}})]}),(0,N.jsx)(l.EY,{className:"slider-value",children:i?i(t):t})]})}function k(){var e=(0,x.wR)(),s=e.resolvedTheme,t=(0,f.c)();(0,j.l)(s);var a=(0,u.useState)(""),d=(0,r.A)(a,2),S=d[0],k=d[1],A=(0,u.useState)(""),b=(0,r.A)(A,2),E=b[0],T=b[1],Y=(0,u.useState)(null),y=(0,r.A)(Y,2),B=y[0],I=y[1],D=(0,u.useState)(!1),C=(0,r.A)(D,2),P=C[0],M=C[1],U=(0,u.useState)(null),q=(0,r.A)(U,2),F=q[0],R=q[1],X=(0,u.useState)(0),_=(0,r.A)(X,2),H=_[0],J=_[1],O=(0,u.useState)(0),Q=(0,r.A)(O,2),V=Q[0],W=Q[1],$=(0,u.useState)(0),z=(0,r.A)($,2),G=z[0],K=z[1],L=(0,u.useState)(!1),Z=(0,r.A)(L,2),ee=Z[0],se=Z[1];(0,u.useEffect)(function(){var e=o().getCurrentInstance().router,s=e?e.params:void 0,t=s?s.designId:"",a=s?s.stickerId:"";k(t),T(a);var n=(0,h.p_)(),c=n.find(function(e){return e.id===t}),i=c&&c.designData&&c.designData.stickers?c.designData.stickers.find(function(e){return e.id===a}):void 0;i?(I(i),J(i.edits&&i.edits.brightness||0),W(i.edits&&i.edits.hue||0),K(i.edits&&i.edits.contrast||0)):M(!0)},[]);var te=function(){if(B&&S){se(!0);var e=(0,h.p_)(),s=e.findIndex(function(e){return e.id===S});if(-1===s)return se(!1),void M(!0);var t=e[s],a=t.designData&&t.designData.stickers||[],n=a.findIndex(function(e){return e.id===E});if(-1===n)return se(!1),void M(!0);a[n]=(0,i.A)((0,i.A)((0,i.A)({},a[n]),F?{src:F}:{}),{},{edits:{brightness:H,hue:V,contrast:G}});var c=(0,i.A)((0,i.A)({},t.designData),{},{stickers:a});(0,h.i5)(S,{designData:c}),(0,m.i5)(S,{item:{productId:t.productId,productName:t.productName,unitPrice:t.unitPrice,count:t.count,designData:c}}).catch(function(){return o().showToast({title:"\u7f51\u7edc\u4e0d\u53ef\u7528\uff0c\u5df2\u6682\u5b58\u5230\u672c\u5730",icon:"none"})}),se(!1),o().showToast({title:"\u4fdd\u5b58\u6210\u529f",icon:"success"}),o().navigateBack()}},ae=function(){B&&(o().cropImage?o().cropImage({src:B.src,cropScale:"1:1",success:function(e){var s=(0,i.A)((0,i.A)({},B),{},{src:e.tempFilePath});I(s),R(e.tempFilePath)}}):o().showToast({title:"\u5f53\u524d\u5fae\u4fe1\u7248\u672c\u4e0d\u652f\u6301\u88c1\u526a",icon:"none"}))},ne=function(){var e=(0,c.A)((0,n.A)().m(function e(){var s;return(0,n.A)().w(function(e){while(1)switch(e.p=e.n){case 0:if(B){e.n=1;break}return e.a(2);case 1:return se(!0),e.p=2,e.n=3,(0,m.W$)(B.src);case 3:if(s=e.v,null===s||void 0===s||!s.imageUrl){e.n=4;break}I((0,i.A)((0,i.A)({},B),{},{src:s.imageUrl})),R(s.imageUrl),se(!1),o().showToast({title:"\u7ebf\u7a3f\u751f\u6210\u6210\u529f",icon:"success"}),e.n=5;break;case 4:throw new Error("no imageUrl");case 5:e.n=7;break;case 6:e.p=6,e.v,o().showToast({title:"\u4f7f\u7528\u672c\u5730\u7ebf\u7a3f",icon:"none"}),J(20),K(80),W(0),se(!1);case 7:return e.a(2)}},e,null,[[2,6]])}));return function(){return e.apply(this,arguments)}}(),ce=0===H&&0===V&&0===G?"none":"brightness(".concat(100+H,"%) hue-rotate(").concat(V,"deg) contrast(").concat(100+G,"%)");return P?(0,N.jsxs)(l.Ss,{className:"theme-".concat(s),children:[(0,N.jsx)(g.A,{}),(0,N.jsx)(p.A,{title:"\u7f16\u8f91\u8d34\u7eb8",targetSelector:".edit-header",showBack:!0}),(0,N.jsxs)(l.Ss,{className:"sticker-edit-page",children:[(0,N.jsxs)(l.Ss,{className:"edit-header",style:{paddingTop:"".concat(t.statusBarHeight+12,"px")},children:[(0,N.jsx)(l.EY,{className:"edit-back",onTap:function(){return o().navigateBack()},children:"\u2190"}),(0,N.jsx)(l.EY,{className:"edit-title",children:"\u7f16\u8f91\u8d34\u7eb8"}),(0,N.jsx)(l.EY,{className:"edit-save"})]}),(0,N.jsxs)(l.Ss,{className:"edit-empty surface-card mt-20",children:[(0,N.jsx)(l.EY,{className:"edit-empty-title",children:"\u672a\u627e\u5230\u8be5\u8d34\u7eb8"}),(0,N.jsx)(l.EY,{className:"edit-empty-desc",children:"\u8d34\u7eb8\u53ef\u80fd\u5df2\u88ab\u5220\u9664\uff0c\u8bf7\u8fd4\u56de\u5de5\u4f5c\u53f0\u91cd\u65b0\u6dfb\u52a0"}),(0,N.jsx)(l.Ss,{className:"btn-primary",onTap:function(){return o().navigateBack()},children:(0,N.jsx)(l.EY,{children:"\u8fd4\u56de\u5de5\u4f5c\u53f0"})})]})]})]}):(0,N.jsxs)(l.Ss,{className:"theme-".concat(s),children:[(0,N.jsx)(g.A,{}),(0,N.jsx)(p.A,{title:"\u7f16\u8f91\u8d34\u7eb8",targetSelector:".edit-header",showBack:!0}),(0,N.jsxs)(l.Ss,{className:"sticker-edit-page",children:[(0,N.jsxs)(l.Ss,{className:"edit-header",style:{paddingTop:"".concat(t.statusBarHeight+12,"px")},children:[(0,N.jsx)(l.EY,{className:"edit-back",onTap:function(){return o().navigateBack()},children:"\u2190"}),(0,N.jsx)(l.EY,{className:"edit-title",children:"\u7f16\u8f91\u8d34\u7eb8"}),(0,N.jsx)(l.EY,{className:"edit-save",onTap:te,children:"\u4fdd\u5b58"})]}),(0,N.jsx)(l.Ss,{className:"edit-canvas-wrap",children:(0,N.jsx)(l._V,{className:"edit-preview-img",src:B?B.src:"",mode:"aspectFit",style:{filter:ce}})}),(0,N.jsxs)(l.Ss,{className:"edit-tools surface-card mt-20",children:[(0,N.jsxs)(l.Ss,{className:"edit-row",children:[(0,N.jsx)(l.EY,{className:"edit-label",children:"\u5feb\u901f\u64cd\u4f5c"}),(0,N.jsxs)(l.Ss,{className:"edit-quick-actions",children:[(0,N.jsx)(l.Ss,{className:"quick-btn",onTap:ae,children:(0,N.jsx)(l.EY,{children:"\u88c1\u526a"})}),(0,N.jsx)(l.Ss,{className:"quick-btn",onTap:ne,children:(0,N.jsx)(l.EY,{children:"\u8f6c\u7ebf\u7a3f"})})]})]}),(0,N.jsxs)(l.Ss,{className:"edit-row slider-row",children:[(0,N.jsx)(l.EY,{className:"edit-label",children:"\u4eae\u5ea6"}),(0,N.jsx)(w,{id:"slider-brightness",value:H,min:-100,max:100,onChange:J,format:function(e){return e>0?"+".concat(e):"".concat(e)}})]}),(0,N.jsxs)(l.Ss,{className:"edit-row slider-row",children:[(0,N.jsx)(l.EY,{className:"edit-label",children:"\u8272\u76f8"}),(0,N.jsx)(w,{id:"slider-hue",value:V,min:-180,max:180,onChange:W,format:function(e){return e>0?"+".concat(e):"".concat(e)}})]}),(0,N.jsxs)(l.Ss,{className:"edit-row slider-row",children:[(0,N.jsx)(l.EY,{className:"edit-label",children:"\u5bf9\u6bd4\u5ea6"}),(0,N.jsx)(w,{id:"slider-contrast",value:G,min:-100,max:100,onChange:K,format:function(e){return e>0?"+".concat(e):"".concat(e)}})]})]}),(0,N.jsx)(l.Ss,{style:{flex:1}}),(0,N.jsxs)(v.A,{className:"edit-footer",children:[(0,N.jsx)(l.Ss,{className:"btn-secondary",onTap:function(){return o().navigateBack()},children:(0,N.jsx)(l.EY,{children:"\u53d6\u6d88"})}),(0,N.jsx)(l.Ss,{className:"btn-primary",onTap:te,children:(0,N.jsx)(l.EY,{children:"\u4fdd\u5b58"})})]}),(0,N.jsx)(l.Ss,{className:"safe-bottom-placeholder"}),ee&&(0,N.jsx)(l.Ss,{className:"edit-loading",children:(0,N.jsx)(l.EY,{className:"edit-loading-text",children:"\u5904\u7406\u4e2d\u2026"})})]})]})}var A={navigationStyle:"custom",enablePageMeta:!0,navigationBarTitleText:"\u7f16\u8f91\u8d34\u7eb8"};Page((0,a.createPageConfig)(k,"pages/diy/stickerEdit/index",{root:{cn:[]}},A||{}))}},function(e){var s=function(s){return e(e.s=s)};e.O(0,[907,96,76],function(){return s(9519)});e.O()}]); \ No newline at end of file +"use strict";(wx["webpackJsonp"]=wx["webpackJsonp"]||[]).push([[339],{9519:function(e,s,t){var a=t(7842),n=t(1212),c=t(467),i=t(9379),r=t(5544),l=t(118),d=t(758),o=t.n(d),u=t(6540),h=t(1457),m=t(9972),x=t(9703),f=t(9201),j=t(5414),g=t(9674),p=t(3053),v=t(9513),N=t(4848),S=function(e,s,t){return Math.min(Math.max(e,s),t)};function w(e){var s=e.id,t=e.value,a=e.min,n=e.max,c=e.onChange,i=e.format,r=(0,u.useRef)(null),d=function(e){o().createSelectorQuery().select("#".concat(s)).boundingClientRect(function(s){s&&s.width>0&&(r.current={left:s.left,width:s.width}),e&&e()}).exec()},h=function(e){var s=r.current;if(!s||!s.width)return t;var c=S((e-s.left)/s.width,0,1);return S(a+(n-a)*c,a,n)},m=function(e){var s=e.touches&&e.touches[0];s&&d(function(){return c(h(s.clientX))})},x=function(e){var s=e.touches&&e.touches[0];s&&(r.current?c(h(s.clientX)):d(function(){return c(h(s.clientX))}))},f="".concat((t-a)/(n-a)*100,"%");return(0,N.jsxs)(l.Ss,{className:"slider-wrap",children:[(0,N.jsxs)(l.Ss,{id:s,className:"slider-track",onTouchStart:m,onTouchMove:x,onTouchEnd:function(){},children:[(0,N.jsx)(l.Ss,{className:"slider-fill",style:{width:f}}),(0,N.jsx)(l.Ss,{className:"slider-thumb",style:{left:f}})]}),(0,N.jsx)(l.EY,{className:"slider-value",children:i?i(t):t})]})}function k(){var e=(0,x.wR)(),s=e.resolvedTheme,t=(0,f.c)();(0,j.l)(s);var a=(0,u.useState)(""),d=(0,r.A)(a,2),S=d[0],k=d[1],A=(0,u.useState)(""),b=(0,r.A)(A,2),E=b[0],T=b[1],Y=(0,u.useState)(null),y=(0,r.A)(Y,2),B=y[0],I=y[1],D=(0,u.useState)(!1),C=(0,r.A)(D,2),P=C[0],M=C[1],U=(0,u.useState)(null),q=(0,r.A)(U,2),F=q[0],R=q[1],X=(0,u.useState)(0),_=(0,r.A)(X,2),H=_[0],J=_[1],O=(0,u.useState)(0),Q=(0,r.A)(O,2),V=Q[0],W=Q[1],$=(0,u.useState)(0),z=(0,r.A)($,2),G=z[0],K=z[1],L=(0,u.useState)(!1),Z=(0,r.A)(L,2),ee=Z[0],se=Z[1];(0,u.useEffect)(function(){var e=o().getCurrentInstance().router,s=e?e.params:void 0,t=s?s.designId:"",a=s?s.stickerId:"";k(t),T(a);var n=(0,h.p_)(),c=n.find(function(e){return e.id===t}),i=c&&c.designData&&c.designData.stickers?c.designData.stickers.find(function(e){return e.id===a}):void 0;i?(I(i),J(i.edits&&i.edits.brightness||0),W(i.edits&&i.edits.hue||0),K(i.edits&&i.edits.contrast||0)):M(!0)},[]);var te=function(){if(B&&S){se(!0);var e=(0,h.p_)(),s=e.findIndex(function(e){return e.id===S});if(-1===s)return se(!1),void M(!0);var t=e[s],a=t.designData&&t.designData.stickers||[],n=a.findIndex(function(e){return e.id===E});if(-1===n)return se(!1),void M(!0);a[n]=(0,i.A)((0,i.A)((0,i.A)({},a[n]),F?{src:F}:{}),{},{edits:{brightness:H,hue:V,contrast:G}});var c=(0,i.A)((0,i.A)({},t.designData),{},{stickers:a});(0,h.i5)(S,{designData:c}),(0,m.i5)(S,{item:{productId:t.productId,productName:t.productName,unitPrice:t.unitPrice,count:t.count,designData:c}}).catch(function(){return o().showToast({title:"\u7f51\u7edc\u4e0d\u53ef\u7528\uff0c\u5df2\u6682\u5b58\u5230\u672c\u5730",icon:"none"})}),se(!1),o().showToast({title:"\u4fdd\u5b58\u6210\u529f",icon:"success"}),o().navigateBack()}},ae=function(){B&&(o().cropImage?o().cropImage({src:B.src,cropScale:"1:1",success:function(e){var s=(0,i.A)((0,i.A)({},B),{},{src:e.tempFilePath});I(s),R(e.tempFilePath)}}):o().showToast({title:"\u5f53\u524d\u5fae\u4fe1\u7248\u672c\u4e0d\u652f\u6301\u88c1\u526a",icon:"none"}))},ne=function(){var e=(0,c.A)((0,n.A)().m(function e(){var s;return(0,n.A)().w(function(e){while(1)switch(e.p=e.n){case 0:if(B){e.n=1;break}return e.a(2);case 1:return se(!0),e.p=2,e.n=3,(0,m.W$)(B.src);case 3:if(s=e.v,null===s||void 0===s||!s.imageUrl){e.n=4;break}I((0,i.A)((0,i.A)({},B),{},{src:s.imageUrl})),R(s.imageUrl),se(!1),o().showToast({title:"\u7ebf\u7a3f\u751f\u6210\u6210\u529f",icon:"success"}),e.n=5;break;case 4:throw new Error("no imageUrl");case 5:e.n=7;break;case 6:e.p=6,e.v,o().showToast({title:"\u4f7f\u7528\u672c\u5730\u7ebf\u7a3f",icon:"none"}),J(20),K(80),W(0),se(!1);case 7:return e.a(2)}},e,null,[[2,6]])}));return function(){return e.apply(this,arguments)}}(),ce=0===H&&0===V&&0===G?"none":"brightness(".concat(100+H,"%) hue-rotate(").concat(V,"deg) contrast(").concat(100+G,"%)");return P?(0,N.jsxs)(l.Ss,{className:"theme-".concat(s),children:[(0,N.jsx)(g.A,{}),(0,N.jsx)(p.A,{title:"\u7f16\u8f91\u8d34\u7eb8",targetSelector:".edit-header",showBack:!0}),(0,N.jsxs)(l.Ss,{className:"sticker-edit-page",children:[(0,N.jsxs)(l.Ss,{className:"edit-header",style:{paddingTop:"".concat(t.statusBarHeight+12,"px")},children:[(0,N.jsx)(l.EY,{className:"edit-back",onTap:function(){return o().navigateBack()},children:"\u2190"}),(0,N.jsx)(l.EY,{className:"edit-title",children:"\u7f16\u8f91\u8d34\u7eb8"}),(0,N.jsx)(l.EY,{className:"edit-save"})]}),(0,N.jsxs)(l.Ss,{className:"edit-empty surface-card mt-20",children:[(0,N.jsx)(l.EY,{className:"edit-empty-title",children:"\u672a\u627e\u5230\u8be5\u8d34\u7eb8"}),(0,N.jsx)(l.EY,{className:"edit-empty-desc",children:"\u8d34\u7eb8\u53ef\u80fd\u5df2\u88ab\u5220\u9664\uff0c\u8bf7\u8fd4\u56de\u5de5\u4f5c\u53f0\u91cd\u65b0\u6dfb\u52a0"}),(0,N.jsx)(l.Ss,{className:"btn-primary",onTap:function(){return o().navigateBack()},children:(0,N.jsx)(l.EY,{children:"\u8fd4\u56de\u5de5\u4f5c\u53f0"})})]})]})]}):(0,N.jsxs)(l.Ss,{className:"theme-".concat(s),children:[(0,N.jsx)(g.A,{}),(0,N.jsx)(p.A,{title:"\u7f16\u8f91\u8d34\u7eb8",targetSelector:".edit-header",showBack:!0}),(0,N.jsxs)(l.Ss,{className:"sticker-edit-page",children:[(0,N.jsxs)(l.Ss,{className:"edit-header",style:{paddingTop:"".concat(t.statusBarHeight+12,"px")},children:[(0,N.jsx)(l.EY,{className:"edit-back",onTap:function(){return o().navigateBack()},children:"\u2190"}),(0,N.jsx)(l.EY,{className:"edit-title",children:"\u7f16\u8f91\u8d34\u7eb8"}),(0,N.jsx)(l.EY,{className:"edit-save",onTap:te,children:"\u4fdd\u5b58"})]}),(0,N.jsx)(l.Ss,{className:"edit-canvas-wrap",children:(0,N.jsx)(l._V,{className:"edit-preview-img",src:B?B.src:"",mode:"aspectFit",style:{filter:ce}})}),(0,N.jsxs)(l.Ss,{className:"edit-tools surface-card mt-20",children:[(0,N.jsxs)(l.Ss,{className:"edit-row",children:[(0,N.jsx)(l.EY,{className:"edit-label",children:"\u5feb\u901f\u64cd\u4f5c"}),(0,N.jsxs)(l.Ss,{className:"edit-quick-actions",children:[(0,N.jsx)(l.Ss,{className:"quick-btn",onTap:ae,children:(0,N.jsx)(l.EY,{children:"\u88c1\u526a"})}),(0,N.jsx)(l.Ss,{className:"quick-btn",onTap:ne,children:(0,N.jsx)(l.EY,{children:"\u8f6c\u7ebf\u7a3f"})})]})]}),(0,N.jsxs)(l.Ss,{className:"edit-row slider-row",children:[(0,N.jsx)(l.EY,{className:"edit-label",children:"\u4eae\u5ea6"}),(0,N.jsx)(w,{id:"slider-brightness",value:H,min:-100,max:100,onChange:J,format:function(e){return e>0?"+".concat(e):"".concat(e)}})]}),(0,N.jsxs)(l.Ss,{className:"edit-row slider-row",children:[(0,N.jsx)(l.EY,{className:"edit-label",children:"\u8272\u76f8"}),(0,N.jsx)(w,{id:"slider-hue",value:V,min:-180,max:180,onChange:W,format:function(e){return e>0?"+".concat(e):"".concat(e)}})]}),(0,N.jsxs)(l.Ss,{className:"edit-row slider-row",children:[(0,N.jsx)(l.EY,{className:"edit-label",children:"\u5bf9\u6bd4\u5ea6"}),(0,N.jsx)(w,{id:"slider-contrast",value:G,min:-100,max:100,onChange:K,format:function(e){return e>0?"+".concat(e):"".concat(e)}})]})]}),(0,N.jsx)(l.Ss,{style:{flex:1}}),(0,N.jsxs)(v.A,{className:"edit-footer",children:[(0,N.jsx)(l.Ss,{className:"btn-secondary",onTap:function(){return o().navigateBack()},children:(0,N.jsx)(l.EY,{children:"\u53d6\u6d88"})}),(0,N.jsx)(l.Ss,{className:"btn-primary",onTap:te,children:(0,N.jsx)(l.EY,{children:"\u4fdd\u5b58"})})]}),(0,N.jsx)(l.Ss,{className:"safe-bottom-placeholder"}),ee&&(0,N.jsx)(l.Ss,{className:"edit-loading",children:(0,N.jsx)(l.EY,{className:"edit-loading-text",children:"\u5904\u7406\u4e2d\u2026"})})]})]})}var A={navigationStyle:"custom",enablePageMeta:!0,navigationBarTitleText:"\u7f16\u8f91\u8d34\u7eb8"};Page((0,a.createPageConfig)(k,"pages/diy/stickerEdit/index",{root:{cn:[]}},A||{}))}},function(e){var s=function(s){return e(e.s=s)};e.O(0,[907,96,76],function(){return s(9519)});e.O()}]); \ No newline at end of file diff --git a/dist/pages/index/index.js b/dist/pages/index/index.js index 176a8f4..b82ca5f 100644 --- a/dist/pages/index/index.js +++ b/dist/pages/index/index.js @@ -1 +1 @@ -"use strict";(wx["webpackJsonp"]=wx["webpackJsonp"]||[]).push([[421],{7265:function(e,s,a){var c=a(7842),i=a(5544),t=a(118),l=a(758),r=a.n(l),n=a(6540),o=a(5234),d=a(8199),m=a(9703),h=a(9201),g=a(5414),p=a(9674),x=a(3053),u=a(4848),j=[{title:"\u6bd5\u4e1a\u7eaa\u5ff5\u7b14\u8bb0\u672c",desc:"\u5168\u73ed\u540d\u5b57\u7ec4\u6210\u6821\u5fbd",priceText:"\xa545 \u8d77",categoryId:"notebook-large",image:(0,d.uq)("/img/book_small/The1.jpg")},{title:"\u94dc\u8d28\u676f\u57ab",desc:"\u91d1\u5c5e\u8d28\u611f\u684c\u9762\u827a\u672f",priceText:"\xa525 \u8d77",categoryId:"coaster",image:(0,d.uq)("/img/cup/The1.jpg")},{title:"\u7af9\u5236\u7b14\u76d2",desc:"\u81ea\u7136\u7af9\u7eb9\u6587\u623f\u96c5\u5668",priceText:"\xa575 \u8d77",categoryId:"penbox",image:(0,d.uq)("/img/penbox/The1.jpg")},{title:"\u4e66\u672c\u578b\u706f",desc:"\u6e29\u6696\u5149\u5f71\u70b9\u4eae\u5fc3\u610f",priceText:"\xa545 \u8d77",categoryId:"booklamp",image:(0,d.uq)("/img/booklight/The1.jpg")},{title:"\u60c5\u4fa3\u5b9a\u5236\u793c",desc:"\u4e24\u4e2a\u4eba\u7684\u540d\u5b57\u4ea4\u7ec7",priceText:"\xa545 \u8d77",categoryId:"notebook-large",image:(0,d.uq)("/img/book_big/The1.jpg")},{title:"\u4f01\u4e1a\u5e74\u4f1a\u793c",desc:"\u5458\u5de5\u540d\u5b57\u7ec4\u6210Logo",priceText:"\xa575 \u8d77",categoryId:"penbox",image:(0,d.uq)("/img/penbox/The2.jpg")}],N={"notebook-small":(0,d.uq)("/img/book_small/The1.jpg"),"notebook-large":(0,d.uq)("/img/book_big/The1.jpg"),coaster:(0,d.uq)("/img/cup/The1.jpg"),penbox:(0,d.uq)("/img/penbox/The1.jpg"),booklamp:(0,d.uq)("/img/booklight/The1.jpg")};function b(){var e=(0,m.wR)(),s=(e.theme,e.resolvedTheme),a=(0,h.c)();(0,g.l)(s);var c=(0,n.useState)(""),l=(0,i.A)(c,2),b=l[0],T=l[1],y=function(e){r().navigateTo({url:"/pages/product/index?id=".concat(e)})},S=function(e){e.categoryId?y(e.categoryId):r().showToast({title:"\u201c".concat(e.title,"\u201d\u5b9a\u5236\u901a\u9053\u5373\u5c06\u5f00\u653e"),icon:"none"})},f=b.trim()?o.R6.filter(function(e){return e.name.includes(b)||e.desc.includes(b)}):o.R6,v=function(e){T(e.detail.value)};return(0,u.jsxs)(t.Ss,{className:"theme-".concat(s),children:[(0,u.jsx)(p.A,{}),(0,u.jsx)(x.A,{title:"\u667a\u7ed8\u5fae\u523b",targetSelector:".home-header"}),(0,u.jsxs)(t.Ss,{className:"index-page",children:[(0,u.jsx)(t.Ss,{className:"home-header",style:{paddingTop:"".concat(a.statusBarHeight+12,"px")},children:(0,u.jsx)(t.EY,{className:"home-title",children:"\u667a\u7ed8\u5fae\u523b"})}),(0,u.jsxs)(t.Ss,{className:"searchbox",children:[(0,u.jsx)(t._V,{className:"search-icon-img",src:(0,d.uq)("/icon/\u641c\u7d22.svg"),mode:"aspectFit"}),(0,u.jsx)(t.pd,{className:"search-input",type:"text",placeholder:"\u641c\u7d22\u5b9a\u5236\u54c1\u7c7b\uff0c\u5982\u7b14\u8bb0\u672c\u3001\u676f\u57ab\u3001\u4e66\u706f",placeholderClass:"search-input-placeholder",value:b,onInput:v,confirmType:"search"})]}),b.trim()&&(0,u.jsx)(t.Ss,{className:"search-result-hint",children:(0,u.jsx)(t.EY,{className:"hint-text",children:f.length>0?"\u627e\u5230 ".concat(f.length," \u4e2a\u76f8\u5173\u54c1\u7c7b"):"\u6ca1\u6709\u627e\u5230\u76f8\u5173\u54c1\u7c7b\uff0c\u8bd5\u8bd5\u770b\u5176\u4ed6\u5173\u952e\u8bcd"})}),(0,u.jsxs)(t.Ss,{className:"showcase-section",children:[(0,u.jsx)(t.EY,{className:"home-section-title",children:"\u5b9a\u5236\u6210\u54c1\u5c55\u793a"}),(0,u.jsx)(t.RC,{className:"showcase-swiper",circular:!0,autoplay:!0,interval:3e3,duration:500,indicatorDots:!0,children:j.map(function(e,s){return(0,u.jsx)(t.wu,{className:"showcase-swiper-item",children:(0,u.jsxs)(t.Ss,{className:"hero-block",children:[(0,u.jsx)(t._V,{className:"hero-media",src:e.image,mode:"aspectFill"}),(0,u.jsxs)(t.Ss,{className:"glass-overlay",children:[(0,u.jsx)(t.EY,{className:"hero-title",children:e.title}),(0,u.jsx)(t.EY,{className:"hero-desc",children:e.desc})]})]})},s)})})]}),(0,u.jsxs)(t.Ss,{className:"category-section",children:[(0,u.jsx)(t.EY,{className:"home-section-title",children:"\u70ed\u95e8\u54c1\u7c7b"}),(0,u.jsx)(t.Ss,{className:"home-grid",children:f.map(function(e){return(0,u.jsxs)(t.Ss,{className:"media-card",onTap:function(){return y(e.id)},children:[(0,u.jsx)(t.Ss,{className:"media-card-image",children:(0,u.jsx)(t._V,{className:"media-card-img",src:N[e.id]||(0,d.uq)("/icon/\u56db\u89d2\u661f.svg"),mode:"aspectFill"})}),(0,u.jsxs)(t.Ss,{className:"media-card-body",children:[(0,u.jsx)(t.EY,{className:"media-card-title",children:e.name}),(0,u.jsx)(t.EY,{className:"media-card-desc",children:e.desc}),(0,u.jsxs)(t.EY,{className:"media-card-price",children:["\xa5",e.price," \u8d77"]})]})]},e.id)})}),0===f.length&&(0,u.jsxs)(t.Ss,{className:"empty-category",children:[(0,u.jsx)(t._V,{className:"empty-icon-img",src:(0,d.uq)("/icon/\u641c\u7d22.svg"),mode:"aspectFit"}),(0,u.jsx)(t.EY,{className:"empty-text",children:"\u672a\u627e\u5230\u5339\u914d\u7684\u54c1\u7c7b"}),(0,u.jsx)(t.EY,{className:"empty-sub",children:"\u5c1d\u8bd5\u641c\u7d22\u201c\u7b14\u8bb0\u672c\u201d\u3001\u201c\u676f\u57ab\u201d\u7b49"})]})]}),(0,u.jsxs)(t.Ss,{className:"recommend-section",children:[(0,u.jsx)(t.EY,{className:"home-section-title",children:"\u4e3a\u4f60\u63a8\u8350"}),(0,u.jsx)(t.Ss,{className:"home-grid",children:j.slice(0,4).map(function(e,s){return(0,u.jsxs)(t.Ss,{className:"media-card",onTap:function(){return S(e)},children:[(0,u.jsx)(t.Ss,{className:"media-card-image",children:(0,u.jsx)(t._V,{className:"media-card-img",src:e.image,mode:"aspectFill"})}),(0,u.jsxs)(t.Ss,{className:"media-card-body",children:[(0,u.jsx)(t.EY,{className:"media-card-title",children:e.title}),(0,u.jsx)(t.EY,{className:"media-card-desc",children:e.desc}),(0,u.jsx)(t.EY,{className:"media-card-price",children:e.priceText})]})]},s)})})]})]})]})}var T={navigationStyle:"custom",enablePageMeta:!0,navigationBarTitleText:"\u667a\u7ed8\u5fae\u523b"};Page((0,c.createPageConfig)(b,"pages/index/index",{root:{cn:[]}},T||{}))}},function(e){var s=function(s){return e(e.s=s)};e.O(0,[907,96,76],function(){return s(7265)});e.O()}]); \ No newline at end of file +"use strict";(wx["webpackJsonp"]=wx["webpackJsonp"]||[]).push([[421],{7265:function(e,s,a){var c=a(7842),i=a(1212),n=a(467),r=a(5544),l=a(118),t=a(758),d=a.n(t),m=a(6540),o=a(8199),h=a(9703),u=a(9201),x=a(5414),p=a(9674),j=a(3053),N=a(2371),g=a(8633),S=a(4848);function f(){var e=(0,h.wR)(),s=(e.theme,e.resolvedTheme),a=(0,u.c)();(0,x.l)(s);var c=(0,m.useState)(""),t=(0,r.A)(c,2),f=t[0],v=t[1],E=(0,m.useState)([]),y=(0,r.A)(E,2),Y=y[0],w=y[1],b=(0,m.useState)(!0),A=(0,r.A)(b,2),T=A[0],k=A[1],q=(0,m.useState)(""),F=(0,r.A)(q,2),V=F[0],_=F[1],C=(0,m.useCallback)((0,n.A)((0,i.A)().m(function e(){var s,a;return(0,i.A)().w(function(e){while(1)switch(e.p=e.n){case 0:return k(!0),_(""),e.p=1,e.n=2,(0,N.j0)({page:1,pageSize:100});case 2:s=e.v,w(s.list.map(g.D)),e.n=4;break;case 3:e.p=3,a=e.v,_(a instanceof Error?a.message:"\u5546\u54c1\u52a0\u8f7d\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5");case 4:return e.p=4,k(!1),e.f(4);case 5:return e.a(2)}},e,null,[[1,3,4,5]])})),[]);(0,m.useEffect)(function(){C()},[C]);var I=function(e){d().navigateTo({url:"/pages/product/index?id=".concat(e)})},P=function(e){I(e.id)},B=f.trim()?Y.filter(function(e){return e.name.includes(f)||e.desc.includes(f)}):Y,D=Y.slice(0,5),J=function(e){v(e.detail.value)};return(0,S.jsxs)(l.Ss,{className:"theme-".concat(s),children:[(0,S.jsx)(p.A,{}),(0,S.jsx)(j.A,{title:"\u667a\u7ed8\u5fae\u523b",targetSelector:".home-header"}),(0,S.jsxs)(l.Ss,{className:"index-page",children:[(0,S.jsx)(l.Ss,{className:"home-header",style:{paddingTop:"".concat(a.statusBarHeight+12,"px")},children:(0,S.jsx)(l.EY,{className:"home-title",children:"\u667a\u7ed8\u5fae\u523b"})}),(0,S.jsxs)(l.Ss,{className:"searchbox",children:[(0,S.jsx)(l._V,{className:"search-icon-img",src:(0,o.uq)("/icon/\u641c\u7d22.svg"),mode:"aspectFit"}),(0,S.jsx)(l.pd,{className:"search-input",type:"text",placeholder:"\u641c\u7d22\u5b9a\u5236\u54c1\u7c7b\uff0c\u5982\u7b14\u8bb0\u672c\u3001\u676f\u57ab\u3001\u4e66\u706f",placeholderClass:"search-input-placeholder",value:f,onInput:J,confirmType:"search"})]}),f.trim()&&(0,S.jsx)(l.Ss,{className:"search-result-hint",children:(0,S.jsx)(l.EY,{className:"hint-text",children:B.length>0?"\u627e\u5230 ".concat(B.length," \u4e2a\u76f8\u5173\u54c1\u7c7b"):"\u6ca1\u6709\u627e\u5230\u76f8\u5173\u54c1\u7c7b\uff0c\u8bd5\u8bd5\u770b\u5176\u4ed6\u5173\u952e\u8bcd"})}),(0,S.jsxs)(l.Ss,{className:"showcase-section",children:[(0,S.jsx)(l.EY,{className:"home-section-title",children:"\u5b9a\u5236\u6210\u54c1\u5c55\u793a"}),D.length>0?(0,S.jsx)(l.RC,{className:"showcase-swiper",circular:!0,autoplay:!0,interval:3e3,duration:500,indicatorDots:!0,children:D.map(function(e){return(0,S.jsx)(l.wu,{className:"showcase-swiper-item",children:(0,S.jsxs)(l.Ss,{className:"hero-block",children:[(0,S.jsx)(l._V,{className:"hero-media",src:e.images[0]||e.iconImg||(0,o.uq)("/icon/\u56db\u89d2\u661f.svg"),mode:"aspectFill"}),(0,S.jsxs)(l.Ss,{className:"glass-overlay",children:[(0,S.jsx)(l.EY,{className:"hero-title",children:e.name}),(0,S.jsx)(l.EY,{className:"hero-desc",children:e.desc})]})]})},e.id)})}):(0,S.jsx)(l.Ss,{className:"empty-category",children:(0,S.jsx)(l.EY,{className:"empty-text",children:T?"\u6b63\u5728\u52a0\u8f7d\u5546\u54c1\u2026":V||"\u6682\u65e0\u5546\u54c1"})})]}),(0,S.jsxs)(l.Ss,{className:"category-section",children:[(0,S.jsx)(l.EY,{className:"home-section-title",children:"\u70ed\u95e8\u54c1\u7c7b"}),(0,S.jsx)(l.Ss,{className:"home-grid",children:B.map(function(e){return(0,S.jsxs)(l.Ss,{className:"media-card",onTap:function(){return I(e.id)},children:[(0,S.jsx)(l.Ss,{className:"media-card-image",children:(0,S.jsx)(l._V,{className:"media-card-img",src:e.images[0]||e.iconImg||(0,o.uq)("/icon/\u56db\u89d2\u661f.svg"),mode:"aspectFill"})}),(0,S.jsxs)(l.Ss,{className:"media-card-body",children:[(0,S.jsx)(l.EY,{className:"media-card-title",children:e.name}),(0,S.jsx)(l.EY,{className:"media-card-desc",children:e.desc}),(0,S.jsxs)(l.EY,{className:"media-card-price",children:["\xa5",e.price," \u8d77"]})]})]},e.id)})}),0===B.length&&(0,S.jsxs)(l.Ss,{className:"empty-category",children:[(0,S.jsx)(l._V,{className:"empty-icon-img",src:(0,o.uq)("/icon/\u641c\u7d22.svg"),mode:"aspectFit"}),(0,S.jsx)(l.EY,{className:"empty-text",children:V||(T?"\u6b63\u5728\u52a0\u8f7d\u5546\u54c1\u2026":"\u672a\u627e\u5230\u5339\u914d\u7684\u54c1\u7c7b")}),(0,S.jsx)(l.EY,{className:"empty-sub",onTap:V?C:void 0,children:V?"\u70b9\u51fb\u91cd\u65b0\u52a0\u8f7d":"\u5c1d\u8bd5\u641c\u7d22\u201c\u7b14\u8bb0\u672c\u201d\u3001\u201c\u676f\u57ab\u201d\u7b49"})]})]}),(0,S.jsxs)(l.Ss,{className:"recommend-section",children:[(0,S.jsx)(l.EY,{className:"home-section-title",children:"\u4e3a\u4f60\u63a8\u8350"}),(0,S.jsx)(l.Ss,{className:"home-grid",children:D.slice(0,4).map(function(e){return(0,S.jsxs)(l.Ss,{className:"media-card",onTap:function(){return P(e)},children:[(0,S.jsx)(l.Ss,{className:"media-card-image",children:(0,S.jsx)(l._V,{className:"media-card-img",src:e.images[0]||e.iconImg||(0,o.uq)("/icon/\u56db\u89d2\u661f.svg"),mode:"aspectFill"})}),(0,S.jsxs)(l.Ss,{className:"media-card-body",children:[(0,S.jsx)(l.EY,{className:"media-card-title",children:e.name}),(0,S.jsx)(l.EY,{className:"media-card-desc",children:e.desc}),(0,S.jsxs)(l.EY,{className:"media-card-price",children:["\xa5",e.price," \u8d77"]})]})]},e.id)})})]})]})]})}var v={navigationStyle:"custom",enablePageMeta:!0,navigationBarTitleText:"\u667a\u7ed8\u5fae\u523b"};Page((0,c.createPageConfig)(f,"pages/index/index",{root:{cn:[]}},v||{}))}},function(e){var s=function(s){return e(e.s=s)};e.O(0,[907,96,76],function(){return s(7265)});e.O()}]); \ No newline at end of file diff --git a/dist/pages/product/index.js b/dist/pages/product/index.js index 620d7f0..8f6d7fb 100644 --- a/dist/pages/product/index.js +++ b/dist/pages/product/index.js @@ -1 +1 @@ -"use strict";(wx["webpackJsonp"]=wx["webpackJsonp"]||[]).push([[612],{4120:function(s,e,a){var c=a(7842),n=a(436),l=a(5544),r=a(118),i=a(758),t=a.n(i),o=a(6540),d=a(5234),m=a(1457),h=a(6845),x=a(9703),p=a(9201),j=a(5414),u=a(9674),N=a(3053),S=a(9513),g=a(4848);function f(){var s=(0,x.wR)(),e=(s.theme,s.resolvedTheme),a=(0,p.c)();(0,j.l)(e);var c=(0,o.useState)(!1),i=(0,l.A)(c,2),f=i[0],E=i[1],Y=(0,o.useState)(1),v=(0,l.A)(Y,2),y=v[0],b=v[1],k=t().getCurrentInstance().router,w=k?k.params:void 0,T=w&&w.id?w.id:"",B=(0,d.y9)(T);if(!B)return(0,g.jsxs)(r.Ss,{className:"theme-".concat(e),children:[(0,g.jsx)(u.A,{}),(0,g.jsx)(N.A,{title:"\u5546\u54c1\u8be6\u60c5",targetSelector:".page-header",showBack:!0}),(0,g.jsx)(r.Ss,{className:"product-page",children:(0,g.jsx)(r.Ss,{className:"page-header",style:{marginTop:"".concat(a.statusBarHeight+12,"px")},children:(0,g.jsxs)(r.Ss,{className:"page-header-inner",children:[(0,g.jsx)(r.Ss,{className:"back-btn",style:{position:"fixed",left:"30rpx",top:"".concat(a.menuButtonTop,"px"),zIndex:41},onTap:function(){return t().navigateBack()},children:(0,g.jsx)(r.EY,{className:"back-arrow",children:"\u2190"})}),(0,g.jsx)(r.Ss,{className:"nav-placeholder"}),(0,g.jsx)(r.EY,{className:"nav-title",children:"\u5546\u54c1\u672a\u627e\u5230"}),(0,g.jsx)(r.Ss,{className:"nav-placeholder"})]})})})]});var A=B.specs&&B.specs.length>0?B.specs.find(function(s){return s[0].indexOf("\u5de5\u827a")>=0}):void 0,q=A?A[1]:"\u6fc0\u5149\u5fae\u96d5",P=function(){b(1),E(!0)},C=function(){(0,h.x9)({productId:B.id,productName:B.name,unitPrice:B.price,count:y}).then(function(s){(0,m.Fu)([s].concat((0,n.A)((0,m.p_)()))),t().showToast({title:"\u5df2\u52a0\u5165\u8bbe\u8ba1\u6e05\u5355 x".concat(y),icon:"success"})}).catch(function(){(0,m.cY)(B,y),t().showToast({title:"\u7f51\u7edc\u4e0d\u53ef\u7528\uff0c\u5df2\u52a0\u5165\u672c\u5730\u6e05\u5355 x".concat(y),icon:"none"})}).finally(function(){E(!1),setTimeout(function(){return t().navigateBack()},1200)})},F=function(){t().navigateTo({url:"/pages/diy/index?source=product&productId=".concat(B.id,"&quantity=1")})},I=function(s){b(function(e){return Math.max(1,Math.min(99,e+s))})};return(0,g.jsxs)(r.Ss,{className:"theme-".concat(e),children:[(0,g.jsx)(u.A,{}),(0,g.jsx)(N.A,{title:"\u5546\u54c1\u8be6\u60c5",targetSelector:".page-header",showBack:!0}),(0,g.jsxs)(r.Ss,{className:"product-page",children:[(0,g.jsx)(r.Ss,{className:"page-header",style:{marginTop:"".concat(a.statusBarHeight+12,"px")},children:(0,g.jsxs)(r.Ss,{className:"page-header-inner",children:[(0,g.jsx)(r.Ss,{className:"back-btn",style:{position:"fixed",left:"30rpx",top:"".concat(a.menuButtonTop,"px"),zIndex:41},onTap:function(){return t().navigateBack()},children:(0,g.jsx)(r.EY,{className:"back-arrow",children:"\u2190"})}),(0,g.jsx)(r.Ss,{className:"nav-placeholder"}),(0,g.jsx)(r.EY,{className:"nav-title",children:"\u5546\u54c1\u8be6\u60c5"}),(0,g.jsx)(r.Ss,{className:"nav-placeholder"})]})}),(0,g.jsx)(r.Ss,{className:"hero-section",children:(0,g.jsx)(r.RC,{className:"hero-swiper",circular:!0,autoplay:!0,interval:3e3,duration:500,indicatorDots:!0,indicatorColor:"var(--border-strong)",indicatorActiveColor:"var(--accent-primary)",children:B.images&&B.images.length>0?B.images.map(function(s,e){return(0,g.jsx)(r.wu,{children:(0,g.jsx)(r.Ss,{className:"hero-block",children:(0,g.jsx)(r._V,{className:"hero-image",src:s,mode:"aspectFill"})})},e)}):(0,g.jsx)(r.wu,{children:(0,g.jsx)(r.Ss,{className:"hero-block hero-block-fallback",children:(0,g.jsx)(r._V,{className:"hero-fallback-icon",src:(0,d.QE)(B),mode:"aspectFit"})})})})}),(0,g.jsx)(r.Ss,{className:"detail-card surface-card",children:(0,g.jsxs)(r.Ss,{className:"price-line",children:[(0,g.jsxs)(r.Ss,{className:"price-left",children:[(0,g.jsx)(r.EY,{className:"detail-title",children:B.name}),(0,g.jsx)(r.EY,{className:"detail-desc",children:B.desc})]}),(0,g.jsxs)(r.Ss,{className:"price-right",children:[(0,g.jsxs)(r.EY,{className:"price",children:["\xa5",B.price]}),B.originalPrice&&B.originalPrice>B.price&&(0,g.jsxs)(r.EY,{className:"price-old",children:["\xa5",B.originalPrice]})]})]})}),(0,g.jsxs)(r.Ss,{className:"detail-card surface-card",children:[(0,g.jsxs)(r.Ss,{className:"spec-row",children:[(0,g.jsx)(r.EY,{className:"spec-key",children:"\u5355\u4ef7"}),(0,g.jsxs)(r.EY,{className:"spec-value",children:["\xa5",B.price]})]}),(0,g.jsxs)(r.Ss,{className:"spec-row",children:[(0,g.jsx)(r.EY,{className:"spec-key",children:"\u5de5\u671f"}),(0,g.jsx)(r.EY,{className:"spec-value",children:B.leadTime})]}),(0,g.jsxs)(r.Ss,{className:"spec-row",children:[(0,g.jsx)(r.EY,{className:"spec-key",children:"\u5c3a\u5bf8"}),(0,g.jsxs)(r.EY,{className:"spec-value",children:[B.mask.width," \xd7 ",B.mask.height," px"]})]}),(0,g.jsxs)(r.Ss,{className:"spec-row",children:[(0,g.jsx)(r.EY,{className:"spec-key",children:"\u5b9a\u5236\u5de5\u827a"}),(0,g.jsx)(r.EY,{className:"spec-value",children:q})]})]}),(0,g.jsxs)(r.Ss,{className:"detail-card surface-card",children:[(0,g.jsx)(r.EY,{className:"section-title",children:"\u5546\u54c1\u4ecb\u7ecd"}),(0,g.jsx)(r.EY,{className:"detail-text",children:B.description})]}),(0,g.jsxs)(S.A,{children:[(0,g.jsxs)(r.Ss,{className:"price-summary",children:[(0,g.jsx)(r.EY,{className:"summary-label",children:"\u8d77\u4ef7"}),(0,g.jsxs)(r.EY,{className:"summary-price",children:["\xa5",B.price]})]}),(0,g.jsx)(r.Ss,{className:"btn-secondary",onTap:P,children:(0,g.jsx)(r.EY,{children:"\u52a0\u5165\u8bbe\u8ba1\u6e05\u5355"})}),(0,g.jsx)(r.Ss,{className:"btn-primary",onTap:F,children:(0,g.jsx)(r.EY,{children:"\u7acb\u5373\u4e0b\u5355"})})]}),f&&(0,g.jsx)(r.Ss,{className:"modal-overlay",children:(0,g.jsxs)(r.Ss,{className:"modal-card surface-card",children:[(0,g.jsx)(r.EY,{className:"modal-title",children:"\u52a0\u5165\u8bbe\u8ba1\u6e05\u5355"}),(0,g.jsxs)(r.Ss,{className:"modal-product",children:[(0,g.jsx)(r._V,{className:"modal-icon-img",src:(0,d.QE)(B),mode:"aspectFit"}),(0,g.jsx)(r.EY,{className:"modal-name",children:B.name})]}),(0,g.jsxs)(r.Ss,{className:"quantity-row",children:[(0,g.jsx)(r.EY,{className:"qty-label",children:"\u6570\u91cf"}),(0,g.jsxs)(r.Ss,{className:"qty-control",children:[(0,g.jsx)(r.Ss,{className:"qty-btn",onTap:function(){return I(-1)},children:"\uff0d"}),(0,g.jsx)(r.EY,{className:"qty-num",children:y}),(0,g.jsx)(r.Ss,{className:"qty-btn",onTap:function(){return I(1)},children:"\uff0b"})]})]}),(0,g.jsxs)(r.Ss,{className:"modal-total",children:[(0,g.jsx)(r.EY,{className:"total-label",children:"\u5c0f\u8ba1"}),(0,g.jsxs)(r.EY,{className:"total-price",children:["\xa5",(B.price*y).toFixed(2)]})]}),(0,g.jsxs)(r.Ss,{className:"modal-actions",children:[(0,g.jsx)(r.Ss,{className:"btn-secondary",onTap:function(){return E(!1)},children:(0,g.jsx)(r.EY,{children:"\u53d6\u6d88"})}),(0,g.jsx)(r.Ss,{className:"btn-primary",onTap:C,children:(0,g.jsx)(r.EY,{children:"\u786e\u5b9a"})})]})]})})]})]})}var E={navigationStyle:"custom",enablePageMeta:!0,navigationBarTitleText:"\u5546\u54c1\u8be6\u60c5"};Page((0,c.createPageConfig)(f,"pages/product/index",{root:{cn:[]}},E||{}))}},function(s){var e=function(e){return s(s.s=e)};s.O(0,[907,96,76],function(){return e(4120)});s.O()}]); \ No newline at end of file +"use strict";(wx["webpackJsonp"]=wx["webpackJsonp"]||[]).push([[612],{4120:function(s,e,a){var c=a(7842),n=a(436),r=a(1212),l=a(467),i=a(5544),t=a(118),o=a(758),d=a.n(o),m=a(6540),h=a(1457),x=a(9972),u=a(9703),p=a(9201),j=a(5414),N=a(9674),S=a(3053),f=a(9513),g=a(5234),E=a(2371),v=a(8633),Y=a(4848);function y(){var s=(0,u.wR)(),e=s.resolvedTheme,a=(0,p.c)();(0,j.l)(e);var c=(0,m.useState)(!1),o=(0,i.A)(c,2),y=o[0],b=o[1],k=(0,m.useState)(1),w=(0,i.A)(k,2),T=w[0],A=w[1],B=(0,m.useState)(null),q=(0,i.A)(B,2),P=q[0],C=q[1],I=(0,m.useState)(!0),F=(0,i.A)(I,2),_=F[0],D=F[1],M=(0,m.useState)(""),O=(0,i.A)(M,2),V=O[0],z=O[1],H=d().getCurrentInstance().router,J=H?H.params:void 0,Q=J&&J.id?J.id:"",R=(0,m.useCallback)((0,l.A)((0,r.A)().m(function s(){var e,a,c;return(0,r.A)().w(function(s){while(1)switch(s.p=s.n){case 0:if(Q){s.n=1;break}return z("\u7f3a\u5c11\u5546\u54c1 ID"),D(!1),s.a(2);case 1:return D(!0),z(""),s.p=2,e=C,a=v.D,s.n=3,(0,E.yj)(Q);case 3:e(a(s.v)),s.n=5;break;case 4:s.p=4,c=s.v,z(c instanceof Error?c.message:"\u5546\u54c1\u52a0\u8f7d\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5");case 5:return s.p=5,D(!1),s.f(5);case 6:return s.a(2)}},s,null,[[2,4,5,6]])})),[Q]);if((0,m.useEffect)(function(){R()},[R]),_)return(0,Y.jsxs)(t.Ss,{className:"theme-".concat(e),children:[(0,Y.jsx)(N.A,{}),(0,Y.jsx)(t.Ss,{className:"product-page",children:(0,Y.jsx)(t.EY,{children:"\u6b63\u5728\u52a0\u8f7d\u5546\u54c1\u2026"})})]});if(!P)return(0,Y.jsxs)(t.Ss,{className:"theme-".concat(e),children:[(0,Y.jsx)(N.A,{}),(0,Y.jsx)(S.A,{title:"\u5546\u54c1\u8be6\u60c5",targetSelector:".page-header",showBack:!0}),(0,Y.jsx)(t.Ss,{className:"product-page",children:(0,Y.jsx)(t.Ss,{className:"page-header",style:{marginTop:"".concat(a.statusBarHeight+12,"px")},children:(0,Y.jsxs)(t.Ss,{className:"page-header-inner",children:[(0,Y.jsx)(t.Ss,{className:"back-btn",style:{position:"fixed",left:"30rpx",top:"".concat(a.menuButtonTop,"px"),zIndex:41},onTap:function(){return d().navigateBack()},children:(0,Y.jsx)(t.EY,{className:"back-arrow",children:"\u2190"})}),(0,Y.jsx)(t.Ss,{className:"nav-placeholder"}),(0,Y.jsx)(t.EY,{className:"nav-title",children:V||"\u5546\u54c1\u672a\u627e\u5230"}),(0,Y.jsx)(t.Ss,{className:"nav-placeholder"})]})})})]});var G=P.specs&&P.specs.length>0?P.specs.find(function(s){return s[0].indexOf("\u5de5\u827a")>=0}):void 0,K=G?G[1]:"\u6fc0\u5149\u5fae\u96d5",L=function(){A(1),b(!0)},U=function(){(0,x.x9)({productId:P.id,productName:P.name,unitPrice:P.price,count:T}).then(function(s){(0,h.Fu)([s].concat((0,n.A)((0,h.p_)()))),d().showToast({title:"\u5df2\u52a0\u5165\u8bbe\u8ba1\u6e05\u5355 x".concat(T),icon:"success"})}).catch(function(){(0,h.cY)(P,T),d().showToast({title:"\u7f51\u7edc\u4e0d\u53ef\u7528\uff0c\u5df2\u52a0\u5165\u672c\u5730\u6e05\u5355 x".concat(T),icon:"none"})}).finally(function(){b(!1),setTimeout(function(){return d().navigateBack()},1200)})},W=function(){d().navigateTo({url:"/pages/diy/index?source=product&productId=".concat(P.id,"&quantity=1")})},X=function(s){A(function(e){return Math.max(1,Math.min(99,e+s))})};return(0,Y.jsxs)(t.Ss,{className:"theme-".concat(e),children:[(0,Y.jsx)(N.A,{}),(0,Y.jsx)(S.A,{title:"\u5546\u54c1\u8be6\u60c5",targetSelector:".page-header",showBack:!0}),(0,Y.jsxs)(t.Ss,{className:"product-page",children:[(0,Y.jsx)(t.Ss,{className:"page-header",style:{marginTop:"".concat(a.statusBarHeight+12,"px")},children:(0,Y.jsxs)(t.Ss,{className:"page-header-inner",children:[(0,Y.jsx)(t.Ss,{className:"back-btn",style:{position:"fixed",left:"30rpx",top:"".concat(a.menuButtonTop,"px"),zIndex:41},onTap:function(){return d().navigateBack()},children:(0,Y.jsx)(t.EY,{className:"back-arrow",children:"\u2190"})}),(0,Y.jsx)(t.Ss,{className:"nav-placeholder"}),(0,Y.jsx)(t.EY,{className:"nav-title",children:"\u5546\u54c1\u8be6\u60c5"}),(0,Y.jsx)(t.Ss,{className:"nav-placeholder"})]})}),(0,Y.jsx)(t.Ss,{className:"hero-section",children:(0,Y.jsx)(t.RC,{className:"hero-swiper",circular:!0,autoplay:!0,interval:3e3,duration:500,indicatorDots:!0,indicatorColor:"var(--border-strong)",indicatorActiveColor:"var(--accent-primary)",children:P.images&&P.images.length>0?P.images.map(function(s,e){return(0,Y.jsx)(t.wu,{children:(0,Y.jsx)(t.Ss,{className:"hero-block",children:(0,Y.jsx)(t._V,{className:"hero-image",src:s,mode:"aspectFill"})})},e)}):(0,Y.jsx)(t.wu,{children:(0,Y.jsx)(t.Ss,{className:"hero-block hero-block-fallback",children:(0,Y.jsx)(t._V,{className:"hero-fallback-icon",src:(0,g.QE)(P),mode:"aspectFit"})})})})}),(0,Y.jsx)(t.Ss,{className:"detail-card surface-card",children:(0,Y.jsxs)(t.Ss,{className:"price-line",children:[(0,Y.jsxs)(t.Ss,{className:"price-left",children:[(0,Y.jsx)(t.EY,{className:"detail-title",children:P.name}),(0,Y.jsx)(t.EY,{className:"detail-desc",children:P.desc})]}),(0,Y.jsxs)(t.Ss,{className:"price-right",children:[(0,Y.jsxs)(t.EY,{className:"price",children:["\xa5",P.price]}),P.originalPrice&&P.originalPrice>P.price&&(0,Y.jsxs)(t.EY,{className:"price-old",children:["\xa5",P.originalPrice]})]})]})}),(0,Y.jsxs)(t.Ss,{className:"detail-card surface-card",children:[(0,Y.jsxs)(t.Ss,{className:"spec-row",children:[(0,Y.jsx)(t.EY,{className:"spec-key",children:"\u5355\u4ef7"}),(0,Y.jsxs)(t.EY,{className:"spec-value",children:["\xa5",P.price]})]}),(0,Y.jsxs)(t.Ss,{className:"spec-row",children:[(0,Y.jsx)(t.EY,{className:"spec-key",children:"\u5de5\u671f"}),(0,Y.jsx)(t.EY,{className:"spec-value",children:P.leadTime})]}),(0,Y.jsxs)(t.Ss,{className:"spec-row",children:[(0,Y.jsx)(t.EY,{className:"spec-key",children:"\u5c3a\u5bf8"}),(0,Y.jsxs)(t.EY,{className:"spec-value",children:[P.mask.width," \xd7 ",P.mask.height," px"]})]}),(0,Y.jsxs)(t.Ss,{className:"spec-row",children:[(0,Y.jsx)(t.EY,{className:"spec-key",children:"\u5b9a\u5236\u5de5\u827a"}),(0,Y.jsx)(t.EY,{className:"spec-value",children:K})]})]}),(0,Y.jsxs)(t.Ss,{className:"detail-card surface-card",children:[(0,Y.jsx)(t.EY,{className:"section-title",children:"\u5546\u54c1\u4ecb\u7ecd"}),(0,Y.jsx)(t.EY,{className:"detail-text",children:P.description})]}),(0,Y.jsxs)(f.A,{children:[(0,Y.jsxs)(t.Ss,{className:"price-summary",children:[(0,Y.jsx)(t.EY,{className:"summary-label",children:"\u8d77\u4ef7"}),(0,Y.jsxs)(t.EY,{className:"summary-price",children:["\xa5",P.price]})]}),(0,Y.jsx)(t.Ss,{className:"btn-secondary",onTap:L,children:(0,Y.jsx)(t.EY,{children:"\u52a0\u5165\u8bbe\u8ba1\u6e05\u5355"})}),(0,Y.jsx)(t.Ss,{className:"btn-primary",onTap:W,children:(0,Y.jsx)(t.EY,{children:"\u7acb\u5373\u4e0b\u5355"})})]}),y&&(0,Y.jsx)(t.Ss,{className:"modal-overlay",children:(0,Y.jsxs)(t.Ss,{className:"modal-card surface-card",children:[(0,Y.jsx)(t.EY,{className:"modal-title",children:"\u52a0\u5165\u8bbe\u8ba1\u6e05\u5355"}),(0,Y.jsxs)(t.Ss,{className:"modal-product",children:[(0,Y.jsx)(t._V,{className:"modal-icon-img",src:(0,g.QE)(P),mode:"aspectFit"}),(0,Y.jsx)(t.EY,{className:"modal-name",children:P.name})]}),(0,Y.jsxs)(t.Ss,{className:"quantity-row",children:[(0,Y.jsx)(t.EY,{className:"qty-label",children:"\u6570\u91cf"}),(0,Y.jsxs)(t.Ss,{className:"qty-control",children:[(0,Y.jsx)(t.Ss,{className:"qty-btn",onTap:function(){return X(-1)},children:"\uff0d"}),(0,Y.jsx)(t.EY,{className:"qty-num",children:T}),(0,Y.jsx)(t.Ss,{className:"qty-btn",onTap:function(){return X(1)},children:"\uff0b"})]})]}),(0,Y.jsxs)(t.Ss,{className:"modal-total",children:[(0,Y.jsx)(t.EY,{className:"total-label",children:"\u5c0f\u8ba1"}),(0,Y.jsxs)(t.EY,{className:"total-price",children:["\xa5",(P.price*T).toFixed(2)]})]}),(0,Y.jsxs)(t.Ss,{className:"modal-actions",children:[(0,Y.jsx)(t.Ss,{className:"btn-secondary",onTap:function(){return b(!1)},children:(0,Y.jsx)(t.EY,{children:"\u53d6\u6d88"})}),(0,Y.jsx)(t.Ss,{className:"btn-primary",onTap:U,children:(0,Y.jsx)(t.EY,{children:"\u786e\u5b9a"})})]})]})})]})]})}var b={navigationStyle:"custom",enablePageMeta:!0,navigationBarTitleText:"\u5546\u54c1\u8be6\u60c5"};Page((0,c.createPageConfig)(y,"pages/product/index",{root:{cn:[]}},b||{}))}},function(s){var e=function(e){return s(s.s=e)};s.O(0,[907,96,76],function(){return e(4120)});s.O()}]); \ No newline at end of file diff --git a/dist/pages/profile/index.js b/dist/pages/profile/index.js index aadbbb5..9119978 100644 --- a/dist/pages/profile/index.js +++ b/dist/pages/profile/index.js @@ -1 +1 @@ -"use strict";(wx["webpackJsonp"]=wx["webpackJsonp"]||[]).push([[481],{2579:function(e,s,a){var n=a(7842),i=a(1212),t=a(467),r=a(5544),c=a(118),l=a(758),o=a.n(l),u=a(6540),d=a(1457),p=a(9703),m=a(9201),g=a(5414),h=a(9674),x=a(3053),f=a(6845),j=a(3246),v=a(8199),N=a(4848),S={"\u6211\u7684\u8bbe\u8ba1":(0,v.uq)("/icon/\u8c03\u8272\u76d8.png"),"\u8bcd\u4e91\u751f\u6210":(0,v.uq)("/icon/\u8bcd\u4e91\u751f\u6210.png"),"\u6536\u8d27\u5730\u5740":(0,v.uq)("/icon/\u5730\u5740.png"),"\u8054\u7cfb\u5ba2\u670d":(0,v.uq)("/icon/\u7535\u8bdd.png"),"\u4f7f\u7528\u5e2e\u52a9":(0,v.uq)("/icon/\u4f7f\u7528\u5e2e\u52a9.png"),"\u8bbe\u7f6e":(0,v.uq)("/icon/\u8bbe\u7f6e.png")},b=[{key:"toDesign",label:"\u5f85\u8bbe\u8ba1",icon:(0,v.uq)("/icon/\u4e09\u89d2\u5c3a.png")},{key:"pending",label:"\u5f85\u4ed8\u6b3e",icon:(0,v.uq)("/icon/\u56db\u89d2\u661f.svg")},{key:"paid",label:"\u5f85\u53d1\u8d27",icon:(0,v.uq)("/icon/\u5305\u88f9.png")},{key:"shipping",label:"\u5f85\u6536\u8d27",icon:(0,v.uq)("/icon/\u676f\u5b50.png")},{key:"done",label:"\u5df2\u5b8c\u6210",icon:(0,v.uq)("/icon/\u4e66\u672c.png")}],k=[{label:"\u6211\u7684\u8bbe\u8ba1",path:"/pages/designList/index"},{label:"\u8bcd\u4e91\u751f\u6210",path:"/pages/wordcloud/index"},{label:"\u6536\u8d27\u5730\u5740",path:"/pages/address/index"},{label:"\u8054\u7cfb\u5ba2\u670d",path:"/pages/service/index"},{label:"\u4f7f\u7528\u5e2e\u52a9",path:"/pages/agreement/index"},{label:"\u8bbe\u7f6e",path:"/pages/settings/index"}],w=function(){};function T(){var e=(0,p.wR)(),s=(e.theme,e.resolvedTheme),a=(0,m.c)();(0,g.l)(s);var n=(0,u.useState)(!1),T=(0,r.A)(n,2),y=T[0],A=T[1],E=(0,u.useState)({nickName:"",avatarUrl:""}),Y=(0,r.A)(E,2),q=Y[0],U=Y[1],F=(0,u.useState)(!1),_=(0,r.A)(F,2),D=_[0],P=_[1],V=(0,u.useState)("entry"),L=(0,r.A)(V,2),C=L[0],J=L[1],O=(0,u.useState)(""),B=(0,r.A)(O,2),H=B[0],I=B[1],M=(0,u.useState)(""),R=(0,r.A)(M,2),W=R[0],$=R[1],z=(0,u.useState)(!1),G=(0,r.A)(z,2),K=G[0],Q=G[1],X=(0,u.useState)({toDesign:0,pending:0,paid:0,shipping:0,done:0}),Z=(0,r.A)(X,2),ee=Z[0],se=Z[1],ae=function(){var e=(0,d.n7)(),s=(0,d.p_)();se({toDesign:s.filter(function(e){return"undesigned"===e.status||"designing"===e.status}).length,pending:e.filter(function(e){return"pending"===e.statusCode}).length,paid:e.filter(function(e){return"paid"===e.statusCode}).length,shipping:e.filter(function(e){return"shipping"===e.statusCode}).length,done:e.filter(function(e){return"done"===e.statusCode}).length})},ne=function(){var e=(0,d.ug)();e&&e.openid?(A(!0),U({nickName:e.nickName||"",avatarUrl:e.avatarUrl||""})):(A(!1),U({nickName:"",avatarUrl:""})),ae()};(0,l.useDidShow)(function(){ne()});var ie=function(){J("entry"),I(""),$(""),P(!0)},te=function(){return P(!1)},re=function(e){Q(!1),(0,j.Sy)(),o().showToast({title:e,icon:"none"})},ce=function(e,s,a,n){var i={openid:s,nickName:a||"\u5fae\u4fe1\u7528\u6237",avatarUrl:n||"",accessToken:e,loginAt:Date.now()};(0,d.iA)(i),U({nickName:i.nickName,avatarUrl:i.avatarUrl}),A(!0),P(!1),J("entry"),Q(!1),(0,j.Sy)(),o().showToast({title:"\u767b\u5f55\u6210\u529f",icon:"success"})},le=function(){var e=(0,t.A)((0,i.A)().m(function e(){var s,a,n,t,r,c;return(0,i.A)().w(function(e){while(1)switch(e.p=e.n){case 0:if(!K){e.n=1;break}return e.a(2);case 1:return console.log("[Profile] \u767b\u5f55\u6309\u94ae\u88ab\u70b9\u51fb\uff0c\u5f00\u59cb\u767b\u5f55\u6d41\u7a0b"),Q(!0),o().showLoading({title:"\u767b\u5f55\u4e2d",mask:!0}),e.p=2,e.n=3,o().login();case 3:return s=e.v,console.log("[Profile] wx.login \u6210\u529f\uff0ccode=",s.code),e.n=4,(0,f.iD)(s.code);case 4:if(a=e.v,console.log("[Profile] \u540e\u7aef /auth/login \u8fd4\u56de:",JSON.stringify(a)),a&&a.accessToken){e.n=5;break}return re("\u767b\u5f55\u5931\u8d25\uff0c\u672a\u62ff\u5230 token"),e.a(2);case 5:return n="",e.p=6,e.n=7,(0,f.jp)();case 7:t=e.v,n=t&&t.openid||"",e.n=9;break;case 8:e.p=8,e.v,n="";case 9:if(n){e.n=10;break}return re("\u767b\u5f55\u5f02\u5e38\uff0c\u8bf7\u91cd\u8bd5"),e.a(2);case 10:if(r=a.isNewUser||!a.nickname||!a.avatar,!r){e.n=11;break}return I(a.nickname||""),$(a.avatar||""),(0,j.Sy)(),Q(!1),J("fill"),o().showToast({title:"\u8bf7\u8bbe\u7f6e\u5934\u50cf\u548c\u6635\u79f0",icon:"none"}),e.a(2);case 11:ce(a.accessToken,n,a.nickname||"",a.avatar||""),e.n=13;break;case 12:e.p=12,c=e.v,console.error("[Profile] \u767b\u5f55\u6d41\u7a0b\u51fa\u9519:",c),re(c&&c.message||"\u540e\u7aef\u8fde\u63a5\u5931\u8d25\uff0c\u8bf7\u68c0\u67e5\u7f51\u7edc");case 13:return e.a(2)}},e,null,[[6,8],[2,12]])}));return function(){return e.apply(this,arguments)}}(),oe=function(){var e=(0,t.A)((0,i.A)().m(function e(){var s,a,n,t;return(0,i.A)().w(function(e){while(1)switch(e.p=e.n){case 0:if(!K){e.n=1;break}return e.a(2);case 1:return Q(!0),o().showLoading({title:"\u4fdd\u5b58\u4e2d",mask:!0}),e.p=2,e.n=3,(0,f.r7)({nickname:H||void 0,avatar:W||void 0});case 3:return s="",e.p=4,e.n=5,(0,f.jp)();case 5:a=e.v,s=a&&a.openid||"",e.n=7;break;case 6:e.p=6,e.v,s="";case 7:if(s){e.n=8;break}return re("\u4fdd\u5b58\u5f02\u5e38\uff0c\u8bf7\u91cd\u8bd5"),e.a(2);case 8:n=(0,d.ug)(),ce(n&&n.accessToken||(0,f.gf)(),s,H,W),e.n=10;break;case 9:e.p=9,t=e.v,console.error("[Profile] \u4fdd\u5b58\u8d44\u6599\u51fa\u9519:",t),re(t&&t.message||"\u4fdd\u5b58\u5931\u8d25");case 10:return e.a(2)}},e,null,[[4,6],[2,9]])}));return function(){return e.apply(this,arguments)}}(),ue=function(e){$(e.detail.avatarUrl||"")},de=function(e){switch(o().hideToast(),e){case"toDesign":o().setStorageSync("designList:filter","toDesign"),o().switchTab({url:"/pages/designList/index"});break;case"pending":o().setStorageSync("orders:filter","pending"),o().switchTab({url:"/pages/orders/index"});break;case"paid":o().setStorageSync("orders:filter","paid"),o().switchTab({url:"/pages/orders/index"});break;case"shipping":o().setStorageSync("orders:filter","shipping"),o().switchTab({url:"/pages/orders/index"});break;case"done":o().setStorageSync("orders:filter","done"),o().switchTab({url:"/pages/orders/index"});break}},pe=function(e,s){if(o().hideToast(),!y&&(e.includes("designList")||e.includes("orders")))return o().showToast({title:"\u8bf7\u5148\u767b\u5f55",icon:"none"}),void P(!0);"\u8054\u7cfb\u5ba2\u670d"!==s?e.startsWith("/pages/")&&(e.includes("designList")||e.includes("orders")?o().switchTab({url:e,fail:function(e){console.error("switchTab fail",e),o().showToast({title:"\u8df3\u8f6c\u5931\u8d25",icon:"none"})}}):o().navigateTo({url:e,fail:function(e){console.error("navigateTo fail",e),o().showToast({title:"\u8df3\u8f6c\u5931\u8d25",icon:"none"})}})):o().navigateTo({url:"/pages/service/index",fail:function(e){console.error("navigateTo service fail",e),o().showToast({title:"\u8df3\u8f6c\u5931\u8d25",icon:"none"})}})};return(0,N.jsxs)(c.Ss,{className:"theme-".concat(s),style:{minHeight:"100vh"},children:[(0,N.jsx)(h.A,{}),(0,N.jsx)(x.A,{title:"\u6211\u7684",targetSelector:".profile-header"}),(0,N.jsxs)(c.Ss,{className:"profile-page",children:[(0,N.jsxs)(c.Ss,{className:"profile-header surface-card",style:{marginTop:"".concat(a.statusBarHeight+12,"px")},children:[(0,N.jsxs)(c.Ss,{className:"user-info",children:[y&&q.avatarUrl?(0,N.jsx)(c._V,{className:"avatar",src:q.avatarUrl,mode:"aspectFill"}):(0,N.jsx)(c.Ss,{className:"avatar-placeholder",onTap:ie,children:(0,N.jsx)(c._V,{className:"avatar-icon-img",src:(0,v.uq)("/icon/\u4e2a\u4eba.png"),mode:"aspectFit"})}),(0,N.jsxs)(c.Ss,{className:"user-meta",children:[(0,N.jsx)(c.EY,{className:"user-name",onTap:y?w:ie,children:y?q.nickName:"\u70b9\u51fb\u767b\u5f55"}),(0,N.jsx)(c.EY,{className:"user-level",children:y?"\u667a\u7ed8\u5fae\u523b\u4f1a\u5458":"\u6388\u6743\u5fae\u4fe1\uff0c\u5f00\u542f\u4e13\u5c5e\u5b9a\u5236"})]})]}),(0,N.jsxs)(c.Ss,{className:"status-grid",children:[(0,N.jsx)(c.Ss,{className:"status-row row2",children:b.slice(0,2).map(function(e){return(0,N.jsxs)(c.Ss,{className:"status-group",children:[(0,N.jsxs)(c.Ss,{className:"status-item",onTap:function(){return de(e.key)},children:[(0,N.jsx)(c._V,{className:"status-icon-img",src:e.icon,mode:"aspectFit"}),(0,N.jsx)(c.EY,{className:"status-num",children:ee[e.key]}),(0,N.jsx)(c.EY,{className:"status-label",children:e.label})]}),(0,N.jsx)(c.Ss,{className:"status-divider"})]},e.key)})}),(0,N.jsx)(c.Ss,{className:"status-divider-h"}),(0,N.jsx)(c.Ss,{className:"status-row row3",children:b.slice(2).map(function(e,s){return(0,N.jsxs)(c.Ss,{className:"status-group",children:[(0,N.jsxs)(c.Ss,{className:"status-item",onTap:function(){return de(e.key)},children:[(0,N.jsx)(c._V,{className:"status-icon-img",src:e.icon,mode:"aspectFit"}),(0,N.jsx)(c.EY,{className:"status-num",children:ee[e.key]}),(0,N.jsx)(c.EY,{className:"status-label",children:e.label})]}),s<2&&(0,N.jsx)(c.Ss,{className:"status-divider"})]},e.key)})})]})]}),(0,N.jsxs)(c.Ss,{className:"mt-20",children:[(0,N.jsx)(c.EY,{className:"section-title",children:"\u5e38\u7528\u529f\u80fd"}),(0,N.jsx)(c.Ss,{className:"menu-grid",children:k.map(function(e,s){return(0,N.jsxs)(c.Ss,{className:"menu-card surface-card",onTap:function(){return pe(e.path,e.label)},children:[(0,N.jsx)(c._V,{className:"menu-icon-img",src:S[e.label],mode:"aspectFit"}),(0,N.jsx)(c.EY,{className:"menu-label",children:e.label})]},s)})})]}),(0,N.jsx)(c.Ss,{className:"enterprise-section surface-card mt-20",children:(0,N.jsxs)(c.Ss,{className:"flex-between",children:[(0,N.jsxs)(c.Ss,{className:"flex-column",children:[(0,N.jsxs)(c.Ss,{className:"flex-center",children:[(0,N.jsx)(c._V,{className:"enterprise-icon",src:(0,v.uq)("/icon/\u4f01\u4e1a\u6279\u91cf\u5b9a\u5236.png"),mode:"aspectFit"}),(0,N.jsx)(c.EY,{className:"enterprise-title",children:"\u4f01\u4e1a\u6279\u91cf\u5b9a\u5236"})]}),(0,N.jsx)(c.EY,{className:"enterprise-desc",children:"\u5e74\u4f1a\u793c\u54c1\u3001\u5165\u804c\u7eaa\u5ff5\u3001\u56e2\u5efa\u4f34\u624b\u793c"})]}),(0,N.jsx)(c.Ss,{className:"btn-primary enterprise-btn",children:(0,N.jsx)(c.EY,{children:"\u7acb\u5373\u54a8\u8be2"})})]})}),D&&(0,N.jsx)(c.Ss,{className:"modal-overlay",children:(0,N.jsxs)(c.Ss,{className:"login-card surface-card",children:[(0,N.jsx)(c.EY,{className:"login-title",children:"\u767b\u5f55\u667a\u7ed8\u5fae\u523b"}),"entry"===C?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(c.EY,{className:"login-desc",children:"\u767b\u5f55\u540e\u540c\u6b65\u60a8\u7684\u8bbe\u8ba1\u6e05\u5355\u548c\u8ba2\u5355"}),(0,N.jsxs)(c.Ss,{className:"login-actions",children:[(0,N.jsx)(c.Ss,{className:"btn-secondary",onTap:te,children:(0,N.jsx)(c.EY,{children:"\u53d6\u6d88"})}),(0,N.jsx)(c.Ss,{className:"btn-primary",onTap:le,children:(0,N.jsx)(c.EY,{children:"\u5fae\u4fe1\u767b\u5f55"})})]})]}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(c.EY,{className:"login-desc",children:"\u8bf7\u8bbe\u7f6e\u60a8\u7684\u5934\u50cf\u548c\u6635\u79f0"}),(0,N.jsx)(c.$n,{className:"avatar-btn",openType:"chooseAvatar",onChooseAvatar:ue,children:W?(0,N.jsx)(c._V,{className:"avatar-img",src:W,mode:"aspectFill"}):(0,N.jsx)(c._V,{className:"avatar-placeholder-img",src:(0,v.uq)("/icon/\u4e2a\u4eba.png"),mode:"aspectFit"})}),(0,N.jsx)(c.pd,{type:"nickname",className:"nickname-input",placeholder:"\u8bf7\u8f93\u5165\u6635\u79f0",value:H,onInput:function(e){return I(e.detail.value)}}),(0,N.jsxs)(c.Ss,{className:"login-actions",children:[(0,N.jsx)(c.Ss,{className:"btn-secondary",onTap:te,children:(0,N.jsx)(c.EY,{children:"\u53d6\u6d88"})}),(0,N.jsx)(c.Ss,{className:"btn-primary",onTap:oe,children:(0,N.jsx)(c.EY,{children:"\u4fdd\u5b58"})})]})]})]})})]})]})}var y={navigationStyle:"custom",enablePageMeta:!0,navigationBarTitleText:"\u4e2a\u4eba\u4e2d\u5fc3"};Page((0,n.createPageConfig)(T,"pages/profile/index",{root:{cn:[]}},y||{}))}},function(e){var s=function(s){return e(e.s=s)};e.O(0,[907,96,76],function(){return s(2579)});e.O()}]); \ No newline at end of file +"use strict";(wx["webpackJsonp"]=wx["webpackJsonp"]||[]).push([[481],{2579:function(e,s,a){var n=a(7842),i=a(1212),t=a(467),r=a(5544),c=a(118),l=a(758),o=a.n(l),u=a(6540),d=a(1457),p=a(9703),m=a(9201),g=a(5414),h=a(9674),x=a(3053),f=a(9972),j=a(3246),v=a(8199),N=a(4848),S={"\u6211\u7684\u8bbe\u8ba1":(0,v.uq)("/icon/\u8c03\u8272\u76d8.png"),"\u8bcd\u4e91\u751f\u6210":(0,v.uq)("/icon/\u8bcd\u4e91\u751f\u6210.png"),"\u6536\u8d27\u5730\u5740":(0,v.uq)("/icon/\u5730\u5740.png"),"\u8054\u7cfb\u5ba2\u670d":(0,v.uq)("/icon/\u7535\u8bdd.png"),"\u4f7f\u7528\u5e2e\u52a9":(0,v.uq)("/icon/\u4f7f\u7528\u5e2e\u52a9.png"),"\u8bbe\u7f6e":(0,v.uq)("/icon/\u8bbe\u7f6e.png")},b=[{key:"toDesign",label:"\u5f85\u8bbe\u8ba1",icon:(0,v.uq)("/icon/\u4e09\u89d2\u5c3a.png")},{key:"pending",label:"\u5f85\u4ed8\u6b3e",icon:(0,v.uq)("/icon/\u56db\u89d2\u661f.svg")},{key:"paid",label:"\u5f85\u53d1\u8d27",icon:(0,v.uq)("/icon/\u5305\u88f9.png")},{key:"shipping",label:"\u5f85\u6536\u8d27",icon:(0,v.uq)("/icon/\u676f\u5b50.png")},{key:"done",label:"\u5df2\u5b8c\u6210",icon:(0,v.uq)("/icon/\u4e66\u672c.png")}],k=[{label:"\u6211\u7684\u8bbe\u8ba1",path:"/pages/designList/index"},{label:"\u8bcd\u4e91\u751f\u6210",path:"/pages/wordcloud/index"},{label:"\u6536\u8d27\u5730\u5740",path:"/pages/address/index"},{label:"\u8054\u7cfb\u5ba2\u670d",path:"/pages/service/index"},{label:"\u4f7f\u7528\u5e2e\u52a9",path:"/pages/agreement/index"},{label:"\u8bbe\u7f6e",path:"/pages/settings/index"}],w=function(){};function T(){var e=(0,p.wR)(),s=(e.theme,e.resolvedTheme),a=(0,m.c)();(0,g.l)(s);var n=(0,u.useState)(!1),T=(0,r.A)(n,2),y=T[0],A=T[1],E=(0,u.useState)({nickName:"",avatarUrl:""}),Y=(0,r.A)(E,2),q=Y[0],U=Y[1],F=(0,u.useState)(!1),_=(0,r.A)(F,2),D=_[0],P=_[1],V=(0,u.useState)("entry"),L=(0,r.A)(V,2),C=L[0],J=L[1],O=(0,u.useState)(""),B=(0,r.A)(O,2),H=B[0],I=B[1],M=(0,u.useState)(""),R=(0,r.A)(M,2),W=R[0],$=R[1],z=(0,u.useState)(!1),G=(0,r.A)(z,2),K=G[0],Q=G[1],X=(0,u.useState)({toDesign:0,pending:0,paid:0,shipping:0,done:0}),Z=(0,r.A)(X,2),ee=Z[0],se=Z[1],ae=function(){var e=(0,d.n7)(),s=(0,d.p_)();se({toDesign:s.filter(function(e){return"undesigned"===e.status||"designing"===e.status}).length,pending:e.filter(function(e){return"pending"===e.statusCode}).length,paid:e.filter(function(e){return"paid"===e.statusCode}).length,shipping:e.filter(function(e){return"shipping"===e.statusCode}).length,done:e.filter(function(e){return"done"===e.statusCode}).length})},ne=function(){var e=(0,d.ug)();e&&e.openid?(A(!0),U({nickName:e.nickName||"",avatarUrl:e.avatarUrl||""})):(A(!1),U({nickName:"",avatarUrl:""})),ae()};(0,l.useDidShow)(function(){ne()});var ie=function(){J("entry"),I(""),$(""),P(!0)},te=function(){return P(!1)},re=function(e){Q(!1),(0,j.Sy)(),o().showToast({title:e,icon:"none"})},ce=function(e,s,a,n){var i={openid:s,nickName:a||"\u5fae\u4fe1\u7528\u6237",avatarUrl:n||"",accessToken:e,loginAt:Date.now()};(0,d.iA)(i),U({nickName:i.nickName,avatarUrl:i.avatarUrl}),A(!0),P(!1),J("entry"),Q(!1),(0,j.Sy)(),o().showToast({title:"\u767b\u5f55\u6210\u529f",icon:"success"})},le=function(){var e=(0,t.A)((0,i.A)().m(function e(){var s,a,n,t,r,c;return(0,i.A)().w(function(e){while(1)switch(e.p=e.n){case 0:if(!K){e.n=1;break}return e.a(2);case 1:return console.log("[Profile] \u767b\u5f55\u6309\u94ae\u88ab\u70b9\u51fb\uff0c\u5f00\u59cb\u767b\u5f55\u6d41\u7a0b"),Q(!0),o().showLoading({title:"\u767b\u5f55\u4e2d",mask:!0}),e.p=2,e.n=3,o().login();case 3:return s=e.v,console.log("[Profile] wx.login \u6210\u529f\uff0ccode=",s.code),e.n=4,(0,f.iD)(s.code);case 4:if(a=e.v,console.log("[Profile] \u540e\u7aef /auth/login \u8fd4\u56de:",JSON.stringify(a)),a&&a.accessToken){e.n=5;break}return re("\u767b\u5f55\u5931\u8d25\uff0c\u672a\u62ff\u5230 token"),e.a(2);case 5:return n="",e.p=6,e.n=7,(0,f.jp)();case 7:t=e.v,n=t&&t.openid||"",e.n=9;break;case 8:e.p=8,e.v,n="";case 9:if(n){e.n=10;break}return re("\u767b\u5f55\u5f02\u5e38\uff0c\u8bf7\u91cd\u8bd5"),e.a(2);case 10:if(r=a.isNewUser||!a.nickname||!a.avatar,!r){e.n=11;break}return I(a.nickname||""),$(a.avatar||""),(0,j.Sy)(),Q(!1),J("fill"),o().showToast({title:"\u8bf7\u8bbe\u7f6e\u5934\u50cf\u548c\u6635\u79f0",icon:"none"}),e.a(2);case 11:ce(a.accessToken,n,a.nickname||"",a.avatar||""),e.n=13;break;case 12:e.p=12,c=e.v,console.error("[Profile] \u767b\u5f55\u6d41\u7a0b\u51fa\u9519:",c),re(c&&c.message||"\u540e\u7aef\u8fde\u63a5\u5931\u8d25\uff0c\u8bf7\u68c0\u67e5\u7f51\u7edc");case 13:return e.a(2)}},e,null,[[6,8],[2,12]])}));return function(){return e.apply(this,arguments)}}(),oe=function(){var e=(0,t.A)((0,i.A)().m(function e(){var s,a,n,t;return(0,i.A)().w(function(e){while(1)switch(e.p=e.n){case 0:if(!K){e.n=1;break}return e.a(2);case 1:return Q(!0),o().showLoading({title:"\u4fdd\u5b58\u4e2d",mask:!0}),e.p=2,e.n=3,(0,f.r7)({nickname:H||void 0,avatar:W||void 0});case 3:return s="",e.p=4,e.n=5,(0,f.jp)();case 5:a=e.v,s=a&&a.openid||"",e.n=7;break;case 6:e.p=6,e.v,s="";case 7:if(s){e.n=8;break}return re("\u4fdd\u5b58\u5f02\u5e38\uff0c\u8bf7\u91cd\u8bd5"),e.a(2);case 8:n=(0,d.ug)(),ce(n&&n.accessToken||(0,f.gf)(),s,H,W),e.n=10;break;case 9:e.p=9,t=e.v,console.error("[Profile] \u4fdd\u5b58\u8d44\u6599\u51fa\u9519:",t),re(t&&t.message||"\u4fdd\u5b58\u5931\u8d25");case 10:return e.a(2)}},e,null,[[4,6],[2,9]])}));return function(){return e.apply(this,arguments)}}(),ue=function(e){$(e.detail.avatarUrl||"")},de=function(e){switch(o().hideToast(),e){case"toDesign":o().setStorageSync("designList:filter","toDesign"),o().switchTab({url:"/pages/designList/index"});break;case"pending":o().setStorageSync("orders:filter","pending"),o().switchTab({url:"/pages/orders/index"});break;case"paid":o().setStorageSync("orders:filter","paid"),o().switchTab({url:"/pages/orders/index"});break;case"shipping":o().setStorageSync("orders:filter","shipping"),o().switchTab({url:"/pages/orders/index"});break;case"done":o().setStorageSync("orders:filter","done"),o().switchTab({url:"/pages/orders/index"});break}},pe=function(e,s){if(o().hideToast(),!y&&(e.includes("designList")||e.includes("orders")))return o().showToast({title:"\u8bf7\u5148\u767b\u5f55",icon:"none"}),void P(!0);"\u8054\u7cfb\u5ba2\u670d"!==s?e.startsWith("/pages/")&&(e.includes("designList")||e.includes("orders")?o().switchTab({url:e,fail:function(e){console.error("switchTab fail",e),o().showToast({title:"\u8df3\u8f6c\u5931\u8d25",icon:"none"})}}):o().navigateTo({url:e,fail:function(e){console.error("navigateTo fail",e),o().showToast({title:"\u8df3\u8f6c\u5931\u8d25",icon:"none"})}})):o().navigateTo({url:"/pages/service/index",fail:function(e){console.error("navigateTo service fail",e),o().showToast({title:"\u8df3\u8f6c\u5931\u8d25",icon:"none"})}})};return(0,N.jsxs)(c.Ss,{className:"theme-".concat(s),style:{minHeight:"100vh"},children:[(0,N.jsx)(h.A,{}),(0,N.jsx)(x.A,{title:"\u6211\u7684",targetSelector:".profile-header"}),(0,N.jsxs)(c.Ss,{className:"profile-page",children:[(0,N.jsxs)(c.Ss,{className:"profile-header surface-card",style:{marginTop:"".concat(a.statusBarHeight+12,"px")},children:[(0,N.jsxs)(c.Ss,{className:"user-info",children:[y&&q.avatarUrl?(0,N.jsx)(c._V,{className:"avatar",src:q.avatarUrl,mode:"aspectFill"}):(0,N.jsx)(c.Ss,{className:"avatar-placeholder",onTap:ie,children:(0,N.jsx)(c._V,{className:"avatar-icon-img",src:(0,v.uq)("/icon/\u4e2a\u4eba.png"),mode:"aspectFit"})}),(0,N.jsxs)(c.Ss,{className:"user-meta",children:[(0,N.jsx)(c.EY,{className:"user-name",onTap:y?w:ie,children:y?q.nickName:"\u70b9\u51fb\u767b\u5f55"}),(0,N.jsx)(c.EY,{className:"user-level",children:y?"\u667a\u7ed8\u5fae\u523b\u4f1a\u5458":"\u6388\u6743\u5fae\u4fe1\uff0c\u5f00\u542f\u4e13\u5c5e\u5b9a\u5236"})]})]}),(0,N.jsxs)(c.Ss,{className:"status-grid",children:[(0,N.jsx)(c.Ss,{className:"status-row row2",children:b.slice(0,2).map(function(e){return(0,N.jsxs)(c.Ss,{className:"status-group",children:[(0,N.jsxs)(c.Ss,{className:"status-item",onTap:function(){return de(e.key)},children:[(0,N.jsx)(c._V,{className:"status-icon-img",src:e.icon,mode:"aspectFit"}),(0,N.jsx)(c.EY,{className:"status-num",children:ee[e.key]}),(0,N.jsx)(c.EY,{className:"status-label",children:e.label})]}),(0,N.jsx)(c.Ss,{className:"status-divider"})]},e.key)})}),(0,N.jsx)(c.Ss,{className:"status-divider-h"}),(0,N.jsx)(c.Ss,{className:"status-row row3",children:b.slice(2).map(function(e,s){return(0,N.jsxs)(c.Ss,{className:"status-group",children:[(0,N.jsxs)(c.Ss,{className:"status-item",onTap:function(){return de(e.key)},children:[(0,N.jsx)(c._V,{className:"status-icon-img",src:e.icon,mode:"aspectFit"}),(0,N.jsx)(c.EY,{className:"status-num",children:ee[e.key]}),(0,N.jsx)(c.EY,{className:"status-label",children:e.label})]}),s<2&&(0,N.jsx)(c.Ss,{className:"status-divider"})]},e.key)})})]})]}),(0,N.jsxs)(c.Ss,{className:"mt-20",children:[(0,N.jsx)(c.EY,{className:"section-title",children:"\u5e38\u7528\u529f\u80fd"}),(0,N.jsx)(c.Ss,{className:"menu-grid",children:k.map(function(e,s){return(0,N.jsxs)(c.Ss,{className:"menu-card surface-card",onTap:function(){return pe(e.path,e.label)},children:[(0,N.jsx)(c._V,{className:"menu-icon-img",src:S[e.label],mode:"aspectFit"}),(0,N.jsx)(c.EY,{className:"menu-label",children:e.label})]},s)})})]}),(0,N.jsx)(c.Ss,{className:"enterprise-section surface-card mt-20",children:(0,N.jsxs)(c.Ss,{className:"flex-between",children:[(0,N.jsxs)(c.Ss,{className:"flex-column",children:[(0,N.jsxs)(c.Ss,{className:"flex-center",children:[(0,N.jsx)(c._V,{className:"enterprise-icon",src:(0,v.uq)("/icon/\u4f01\u4e1a\u6279\u91cf\u5b9a\u5236.png"),mode:"aspectFit"}),(0,N.jsx)(c.EY,{className:"enterprise-title",children:"\u4f01\u4e1a\u6279\u91cf\u5b9a\u5236"})]}),(0,N.jsx)(c.EY,{className:"enterprise-desc",children:"\u5e74\u4f1a\u793c\u54c1\u3001\u5165\u804c\u7eaa\u5ff5\u3001\u56e2\u5efa\u4f34\u624b\u793c"})]}),(0,N.jsx)(c.Ss,{className:"btn-primary enterprise-btn",children:(0,N.jsx)(c.EY,{children:"\u7acb\u5373\u54a8\u8be2"})})]})}),D&&(0,N.jsx)(c.Ss,{className:"modal-overlay",children:(0,N.jsxs)(c.Ss,{className:"login-card surface-card",children:[(0,N.jsx)(c.EY,{className:"login-title",children:"\u767b\u5f55\u667a\u7ed8\u5fae\u523b"}),"entry"===C?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(c.EY,{className:"login-desc",children:"\u767b\u5f55\u540e\u540c\u6b65\u60a8\u7684\u8bbe\u8ba1\u6e05\u5355\u548c\u8ba2\u5355"}),(0,N.jsxs)(c.Ss,{className:"login-actions",children:[(0,N.jsx)(c.Ss,{className:"btn-secondary",onTap:te,children:(0,N.jsx)(c.EY,{children:"\u53d6\u6d88"})}),(0,N.jsx)(c.Ss,{className:"btn-primary",onTap:le,children:(0,N.jsx)(c.EY,{children:"\u5fae\u4fe1\u767b\u5f55"})})]})]}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(c.EY,{className:"login-desc",children:"\u8bf7\u8bbe\u7f6e\u60a8\u7684\u5934\u50cf\u548c\u6635\u79f0"}),(0,N.jsx)(c.$n,{className:"avatar-btn",openType:"chooseAvatar",onChooseAvatar:ue,children:W?(0,N.jsx)(c._V,{className:"avatar-img",src:W,mode:"aspectFill"}):(0,N.jsx)(c._V,{className:"avatar-placeholder-img",src:(0,v.uq)("/icon/\u4e2a\u4eba.png"),mode:"aspectFit"})}),(0,N.jsx)(c.pd,{type:"nickname",className:"nickname-input",placeholder:"\u8bf7\u8f93\u5165\u6635\u79f0",value:H,onInput:function(e){return I(e.detail.value)}}),(0,N.jsxs)(c.Ss,{className:"login-actions",children:[(0,N.jsx)(c.Ss,{className:"btn-secondary",onTap:te,children:(0,N.jsx)(c.EY,{children:"\u53d6\u6d88"})}),(0,N.jsx)(c.Ss,{className:"btn-primary",onTap:oe,children:(0,N.jsx)(c.EY,{children:"\u4fdd\u5b58"})})]})]})]})})]})]})}var y={navigationStyle:"custom",enablePageMeta:!0,navigationBarTitleText:"\u4e2a\u4eba\u4e2d\u5fc3"};Page((0,n.createPageConfig)(T,"pages/profile/index",{root:{cn:[]}},y||{}))}},function(e){var s=function(s){return e(e.s=s)};e.O(0,[907,96,76],function(){return s(2579)});e.O()}]); \ No newline at end of file diff --git a/dist/pages/shop/detail/index.js b/dist/pages/shop/detail/index.js index 27d9506..6196527 100644 --- a/dist/pages/shop/detail/index.js +++ b/dist/pages/shop/detail/index.js @@ -1 +1 @@ -"use strict";(wx["webpackJsonp"]=wx["webpackJsonp"]||[]).push([[158],{3483:function(s,e,a){var c=a(7842),t=a(5544),n=a(118),o=a(758),r=a.n(o),i=a(6540),l=a(5234),h=a(9201),p=a(5414),d=a(9703),m=a(9674),x=a(3053),g=a(9513),u=a(4848),j=function(s,e,a){return Math.min(Math.max(s,e),a)},N=function(s,e,a){return s+(e-s)*a},b=function(s){return 1-Math.pow(1-s,3)};function f(){var s=(0,d.wR)(),e=s.resolvedTheme,a=(0,i.useState)(667),c=(0,t.A)(a,2),o=c[0],f=c[1],y=(0,i.useState)(0),S=(0,t.A)(y,2),v=S[0],Y=S[1],E=(0,h.c)();(0,p.l)(e,{mode:"light"});var k=r().getCurrentInstance().router,w=k?k.params:void 0,O=w?w.id:"",P=l.zv.find(function(s){return s.id===O});(0,i.useEffect)(function(){try{var s=r().getSystemInfoSync();f(s.windowHeight)}catch(s){}},[]);var B=(0,i.useCallback)(function(s){var e=s.detail&&s.detail.scrollTop||0,a=1.2*o,c=j(e/a,0,1);Y(c)},[o]),T=(0,i.useMemo)(function(){var s=v,e=0,a=0;if(s<=.4){var c=b(s/.4);e=N(0,32,c),a=N(0,38,c)}else if(s<=.55){var t=(s-.4)/.15;e=N(32,34,t),a=N(38,41,t)}else e=34,a=41;var n=0;n=s<=.4?0:s<=.7?N(0,-75,(s-.4)/.3):-75;var o=1;o=s<=.35?1:s<=.48?j(1-(s-.35)/.13,0,1):0;var r=0;r=s<=.55?0:s<=.7?(s-.55)/.15:1;var i=1,l=0;if(s<=.05)i=0,l=60;else if(s<=.22){var h=(s-.05)/.17;i=b(h),l=N(60,0,b(h))}var p=1;return s<=.15&&(p=j(1-s/.15,0,1)),{topCrop:e,bottomCrop:a,translateY:n,heroInfoOpacity:o,bandOpacity:r,contentOpacity:i,contentOffset:l,backBtnOpacity:p,visibleHeight:100-e-a}},[v]),A=(0,i.useMemo)(function(){return P?P.tone:[28,22,18]},[P]);return P?(0,u.jsxs)(n.Ss,{className:"shop-detail-page theme-dark",children:[(0,u.jsx)(m.A,{darkTop:!0}),(0,u.jsx)(x.A,{title:"\u5546\u54c1\u8be6\u60c5",targetSelector:".shop-back-btn",showBack:!0}),(0,u.jsxs)(n.Ss,{className:"shop-hero-fixed",children:[(0,u.jsx)(n.Ss,{className:"shop-hero-clip",style:{height:"".concat(o*T.visibleHeight/100,"px"),overflow:"hidden",transform:"translateY(".concat(o*T.translateY/100,"px)")},children:(0,u.jsx)(n._V,{className:"shop-hero-img",src:P.images&&P.images[0]||P.iconImg||"",mode:"aspectFill",style:{width:"100%",height:"".concat(o,"px"),position:"absolute",top:"".concat(-o*T.topCrop/100,"px"),left:0}})}),(0,u.jsx)(n.Ss,{className:"shop-hero-overlay",style:{background:"linear-gradient(to bottom, rgba(".concat(A[0],", ").concat(A[1],", ").concat(A[2],", 0) 0%, rgba(").concat(A[0],", ").concat(A[1],", ").concat(A[2],", 0.55) 40%, rgba(").concat(A[0],", ").concat(A[1],", ").concat(A[2],", 0.95) 100%)")}}),(0,u.jsxs)(n.Ss,{className:"shop-hero-info",style:{opacity:T.heroInfoOpacity},children:[(0,u.jsx)(n.EY,{className:"shop-hero-title",children:P.name}),(0,u.jsx)(n.EY,{className:"shop-hero-subtitle",children:P.subtitle||P.desc}),(0,u.jsxs)(n.Ss,{className:"shop-hero-price-row",children:[(0,u.jsxs)(n.EY,{className:"shop-hero-price",children:["\xa5",P.price]}),P.originalPrice&&P.originalPrice>P.price&&(0,u.jsxs)(n.EY,{className:"shop-hero-original",children:["\xa5",P.originalPrice]})]})]})]}),(0,u.jsxs)(n.BM,{className:"shop-scroll",scrollY:!0,scrollEventThrottle:16,style:{height:"".concat(o,"px")},onScroll:B,children:[(0,u.jsx)(n.Ss,{style:{height:"".concat(.65*o,"px")}}),(0,u.jsxs)(n.Ss,{className:"shop-content",style:{backgroundColor:"rgb(".concat(A[0],", ").concat(A[1],", ").concat(A[2],")")},children:[(0,u.jsxs)(n.Ss,{className:"shop-band",style:{top:"".concat(E.statusBarHeight,"px"),opacity:T.bandOpacity,backgroundColor:"rgba(".concat(A[0],", ").concat(A[1],", ").concat(A[2],", 0.88)"),backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)"},children:[(0,u.jsx)(n.EY,{className:"shop-band-title",children:P.name}),(0,u.jsx)(n.EY,{className:"shop-band-subtitle",children:P.subtitle||P.desc}),(0,u.jsxs)(n.Ss,{className:"shop-band-price-row",children:[(0,u.jsxs)(n.EY,{className:"shop-band-price",children:["\xa5",P.price]}),P.originalPrice&&P.originalPrice>P.price&&(0,u.jsxs)(n.EY,{className:"shop-band-original",children:["\xa5",P.originalPrice]})]})]}),(0,u.jsxs)(n.Ss,{className:"shop-detail-body",style:{opacity:T.contentOpacity,transform:"translateY(".concat(T.contentOffset,"px)")},children:[(0,u.jsxs)(n.Ss,{className:"shop-content-card",children:[P.story&&(0,u.jsxs)(n.Ss,{className:"shop-section",children:[(0,u.jsx)(n.EY,{className:"shop-section-title",children:"\u8bbe\u8ba1\u7406\u5ff5"}),(0,u.jsx)(n.EY,{className:"shop-section-text",children:P.story})]}),P.story&&P.scene&&(0,u.jsx)(n.Ss,{className:"shop-divider"}),P.scene&&(0,u.jsxs)(n.Ss,{className:"shop-section",children:[(0,u.jsx)(n.EY,{className:"shop-section-title",children:"\u4f7f\u7528\u573a\u666f"}),(0,u.jsx)(n.EY,{className:"shop-section-text",children:P.scene})]}),P.tags&&P.tags.length>0&&(0,u.jsx)(n.Ss,{className:"shop-section",children:(0,u.jsx)(n.Ss,{className:"shop-tag-row",children:P.tags.map(function(s){return(0,u.jsx)(n.Ss,{className:"shop-tag",children:(0,u.jsx)(n.EY,{className:"shop-tag-text",children:s})},s)})})}),(P.story||P.scene)&&P.tags&&P.tags.length>0&&(0,u.jsx)(n.Ss,{className:"shop-divider"}),(P.story||P.scene||P.tags&&P.tags.length>0)&&P.specs&&P.specs.length>0&&(0,u.jsx)(n.Ss,{className:"shop-divider"}),P.specs&&P.specs.length>0&&(0,u.jsxs)(n.Ss,{className:"shop-section",children:[(0,u.jsx)(n.EY,{className:"shop-section-title",children:"\u89c4\u683c\u53c2\u6570"}),(0,u.jsx)(n.Ss,{className:"shop-spec-table",children:P.specs.map(function(s){var e=(0,t.A)(s,2),a=e[0],c=e[1];return(0,u.jsxs)(n.Ss,{className:"shop-spec-row",children:[(0,u.jsx)(n.EY,{className:"shop-spec-key",children:a}),(0,u.jsx)(n.EY,{className:"shop-spec-val",children:c})]},a)})})]})]}),(0,u.jsx)(n.Ss,{className:"shop-bottom-spacer"})]})]})]},P.id),(0,u.jsx)(n.Ss,{className:"shop-back-btn",onTap:function(){return r().navigateBack()},style:{top:"".concat(E.menuButtonTop,"px"),opacity:T.backBtnOpacity},children:(0,u.jsx)(n.EY,{className:"shop-back-arrow",children:"\u2190"})}),(0,u.jsxs)(g.A,{children:[(0,u.jsxs)(n.Ss,{className:"price-summary",children:[(0,u.jsx)(n.EY,{className:"summary-label",children:"\u8d77\u4ef7"}),(0,u.jsxs)(n.EY,{className:"summary-price",children:["\xa5",P.price]}),P.originalPrice&&P.originalPrice>P.price&&(0,u.jsxs)(n.EY,{className:"summary-original",children:["\xa5",P.originalPrice]})]}),(0,u.jsx)(n.Ss,{className:"btn-secondary",onTap:function(){return r().navigateBack()},children:(0,u.jsx)(n.EY,{children:"\u8fd4\u56de"})}),(0,u.jsx)(n.Ss,{className:"btn-primary",onTap:function(){return r().navigateTo({url:"/pages/product/index?id=".concat(P.id)})},children:(0,u.jsx)(n.EY,{children:"\u7acb\u5373\u5b9a\u5236"})})]}),(0,u.jsx)(n.Ss,{className:"safe-bottom-placeholder"})]}):(0,u.jsxs)(n.Ss,{className:"shop-detail-page theme-dark",children:[(0,u.jsx)(m.A,{darkTop:!0}),(0,u.jsx)(x.A,{title:"\u5546\u54c1\u8be6\u60c5",targetSelector:".shop-back-btn",showBack:!0}),(0,u.jsx)(n.EY,{style:{color:"#fff",padding:"40rpx"},children:"\u5546\u54c1\u4e0d\u5b58\u5728"})]})}var y={navigationStyle:"custom",enablePageMeta:!0,navigationBarTextStyle:"white"};Page((0,c.createPageConfig)(f,"pages/shop/detail/index",{root:{cn:[]}},y||{}))}},function(s){var e=function(e){return s(s.s=e)};s.O(0,[907,96,76],function(){return e(3483)});s.O()}]); \ No newline at end of file +"use strict";(wx["webpackJsonp"]=wx["webpackJsonp"]||[]).push([[158],{3483:function(s,e,a){var c=a(7842),t=a(1212),n=a(467),r=a(5544),o=a(118),i=a(758),l=a.n(i),h=a(6540),p=a(2371),d=a(9201),m=a(5414),x=a(9703),u=a(9674),g=a(3053),j=a(9513),b=a(4848),f=function(s,e,a){return Math.min(Math.max(s,e),a)},N=function(s,e,a){return s+(e-s)*a},y=function(s){return 1-Math.pow(1-s,3)};function S(){var s=(0,x.wR)(),e=s.resolvedTheme,a=(0,h.useState)(667),c=(0,r.A)(a,2),i=c[0],S=c[1],v=(0,h.useState)(0),k=(0,r.A)(v,2),Y=k[0],E=k[1],w=(0,h.useState)(null),A=(0,r.A)(w,2),T=A[0],O=A[1],P=(0,h.useState)(!0),B=(0,r.A)(P,2),C=B[0],M=B[1],I=(0,h.useState)(""),H=(0,r.A)(I,2),F=H[0],J=H[1],D=(0,d.c)();(0,m.l)(e,{mode:"light"});var R=l().getCurrentInstance().router,V=R?R.params:void 0,W=V?V.id:"",_=(0,h.useCallback)((0,n.A)((0,t.A)().m(function s(){var e,a;return(0,t.A)().w(function(s){while(1)switch(s.p=s.n){case 0:if(W){s.n=1;break}return J("\u7f3a\u5c11\u5546\u54c1 ID"),M(!1),s.a(2);case 1:return M(!0),J(""),s.p=2,e=O,s.n=3,(0,p.yj)(W);case 3:e(s.v),s.n=5;break;case 4:s.p=4,a=s.v,J(a instanceof Error?a.message:"\u5546\u54c1\u52a0\u8f7d\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5");case 5:return s.p=5,M(!1),s.f(5);case 6:return s.a(2)}},s,null,[[2,4,5,6]])})),[W]);(0,h.useEffect)(function(){_()},[_]),(0,h.useEffect)(function(){try{var s=l().getSystemInfoSync();S(s.windowHeight)}catch(s){}},[]);var q=(0,h.useCallback)(function(s){var e=s.detail&&s.detail.scrollTop||0,a=1.2*i,c=f(e/a,0,1);E(c)},[i]),z=(0,h.useMemo)(function(){var s=Y,e=0,a=0;if(s<=.4){var c=y(s/.4);e=N(0,32,c),a=N(0,38,c)}else if(s<=.55){var t=(s-.4)/.15;e=N(32,34,t),a=N(38,41,t)}else e=34,a=41;var n=0;n=s<=.4?0:s<=.7?N(0,-75,(s-.4)/.3):-75;var r=1;r=s<=.35?1:s<=.48?f(1-(s-.35)/.13,0,1):0;var o=0;o=s<=.55?0:s<=.7?(s-.55)/.15:1;var i=1,l=0;if(s<=.05)i=0,l=60;else if(s<=.22){var h=(s-.05)/.17;i=y(h),l=N(60,0,y(h))}var p=1;return s<=.15&&(p=f(1-s/.15,0,1)),{topCrop:e,bottomCrop:a,translateY:n,heroInfoOpacity:r,bandOpacity:o,contentOpacity:i,contentOffset:l,backBtnOpacity:p,visibleHeight:100-e-a}},[Y]),G=(0,h.useMemo)(function(){return T?T.tone:[28,22,18]},[T]);return C?(0,b.jsxs)(o.Ss,{className:"shop-detail-page theme-dark",children:[(0,b.jsx)(u.A,{darkTop:!0}),(0,b.jsx)(o.EY,{style:{color:"#fff",padding:"40rpx"},children:"\u6b63\u5728\u52a0\u8f7d\u5546\u54c1\u2026"})]}):T?(0,b.jsxs)(o.Ss,{className:"shop-detail-page theme-dark",children:[(0,b.jsx)(u.A,{darkTop:!0}),(0,b.jsx)(g.A,{title:"\u5546\u54c1\u8be6\u60c5",targetSelector:".shop-back-btn",showBack:!0}),(0,b.jsxs)(o.Ss,{className:"shop-hero-fixed",children:[(0,b.jsx)(o.Ss,{className:"shop-hero-clip",style:{height:"".concat(i*z.visibleHeight/100,"px"),overflow:"hidden",transform:"translateY(".concat(i*z.translateY/100,"px)")},children:(0,b.jsx)(o._V,{className:"shop-hero-img",src:T.images&&T.images[0]||T.iconImg||"",mode:"aspectFill",style:{width:"100%",height:"".concat(i,"px"),position:"absolute",top:"".concat(-i*z.topCrop/100,"px"),left:0}})}),(0,b.jsx)(o.Ss,{className:"shop-hero-overlay",style:{background:"linear-gradient(to bottom, rgba(".concat(G[0],", ").concat(G[1],", ").concat(G[2],", 0) 0%, rgba(").concat(G[0],", ").concat(G[1],", ").concat(G[2],", 0.55) 40%, rgba(").concat(G[0],", ").concat(G[1],", ").concat(G[2],", 0.95) 100%)")}}),(0,b.jsxs)(o.Ss,{className:"shop-hero-info",style:{opacity:z.heroInfoOpacity},children:[(0,b.jsx)(o.EY,{className:"shop-hero-title",children:T.name}),(0,b.jsx)(o.EY,{className:"shop-hero-subtitle",children:T.subtitle||T.desc}),(0,b.jsxs)(o.Ss,{className:"shop-hero-price-row",children:[(0,b.jsxs)(o.EY,{className:"shop-hero-price",children:["\xa5",T.price]}),T.originalPrice&&T.originalPrice>T.price&&(0,b.jsxs)(o.EY,{className:"shop-hero-original",children:["\xa5",T.originalPrice]})]})]})]}),(0,b.jsxs)(o.BM,{className:"shop-scroll",scrollY:!0,scrollEventThrottle:16,style:{height:"".concat(i,"px")},onScroll:q,children:[(0,b.jsx)(o.Ss,{style:{height:"".concat(.65*i,"px")}}),(0,b.jsxs)(o.Ss,{className:"shop-content",style:{backgroundColor:"rgb(".concat(G[0],", ").concat(G[1],", ").concat(G[2],")")},children:[(0,b.jsxs)(o.Ss,{className:"shop-band",style:{top:"".concat(D.statusBarHeight,"px"),opacity:z.bandOpacity,backgroundColor:"rgba(".concat(G[0],", ").concat(G[1],", ").concat(G[2],", 0.88)"),backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)"},children:[(0,b.jsx)(o.EY,{className:"shop-band-title",children:T.name}),(0,b.jsx)(o.EY,{className:"shop-band-subtitle",children:T.subtitle||T.desc}),(0,b.jsxs)(o.Ss,{className:"shop-band-price-row",children:[(0,b.jsxs)(o.EY,{className:"shop-band-price",children:["\xa5",T.price]}),T.originalPrice&&T.originalPrice>T.price&&(0,b.jsxs)(o.EY,{className:"shop-band-original",children:["\xa5",T.originalPrice]})]})]}),(0,b.jsxs)(o.Ss,{className:"shop-detail-body",style:{opacity:z.contentOpacity,transform:"translateY(".concat(z.contentOffset,"px)")},children:[(0,b.jsxs)(o.Ss,{className:"shop-content-card",children:[T.story&&(0,b.jsxs)(o.Ss,{className:"shop-section",children:[(0,b.jsx)(o.EY,{className:"shop-section-title",children:"\u8bbe\u8ba1\u7406\u5ff5"}),(0,b.jsx)(o.EY,{className:"shop-section-text",children:T.story})]}),T.story&&T.scene&&(0,b.jsx)(o.Ss,{className:"shop-divider"}),T.scene&&(0,b.jsxs)(o.Ss,{className:"shop-section",children:[(0,b.jsx)(o.EY,{className:"shop-section-title",children:"\u4f7f\u7528\u573a\u666f"}),(0,b.jsx)(o.EY,{className:"shop-section-text",children:T.scene})]}),T.tags&&T.tags.length>0&&(0,b.jsx)(o.Ss,{className:"shop-section",children:(0,b.jsx)(o.Ss,{className:"shop-tag-row",children:T.tags.map(function(s){return(0,b.jsx)(o.Ss,{className:"shop-tag",children:(0,b.jsx)(o.EY,{className:"shop-tag-text",children:s})},s)})})}),(T.story||T.scene)&&T.tags&&T.tags.length>0&&(0,b.jsx)(o.Ss,{className:"shop-divider"}),(T.story||T.scene||T.tags&&T.tags.length>0)&&T.specs&&T.specs.length>0&&(0,b.jsx)(o.Ss,{className:"shop-divider"}),T.specs&&T.specs.length>0&&(0,b.jsxs)(o.Ss,{className:"shop-section",children:[(0,b.jsx)(o.EY,{className:"shop-section-title",children:"\u89c4\u683c\u53c2\u6570"}),(0,b.jsx)(o.Ss,{className:"shop-spec-table",children:T.specs.map(function(s){var e=(0,r.A)(s,2),a=e[0],c=e[1];return(0,b.jsxs)(o.Ss,{className:"shop-spec-row",children:[(0,b.jsx)(o.EY,{className:"shop-spec-key",children:a}),(0,b.jsx)(o.EY,{className:"shop-spec-val",children:c})]},a)})})]})]}),(0,b.jsx)(o.Ss,{className:"shop-bottom-spacer"})]})]})]},T.id),(0,b.jsx)(o.Ss,{className:"shop-back-btn",onTap:function(){return l().navigateBack()},style:{top:"".concat(D.menuButtonTop,"px"),opacity:z.backBtnOpacity},children:(0,b.jsx)(o.EY,{className:"shop-back-arrow",children:"\u2190"})}),(0,b.jsxs)(j.A,{children:[(0,b.jsxs)(o.Ss,{className:"price-summary",children:[(0,b.jsx)(o.EY,{className:"summary-label",children:"\u8d77\u4ef7"}),(0,b.jsxs)(o.EY,{className:"summary-price",children:["\xa5",T.price]}),T.originalPrice&&T.originalPrice>T.price&&(0,b.jsxs)(o.EY,{className:"summary-original",children:["\xa5",T.originalPrice]})]}),(0,b.jsx)(o.Ss,{className:"btn-secondary",onTap:function(){return l().navigateBack()},children:(0,b.jsx)(o.EY,{children:"\u8fd4\u56de"})}),(0,b.jsx)(o.Ss,{className:"btn-primary",onTap:function(){return l().navigateTo({url:"/pages/product/index?id=".concat(T.id)})},children:(0,b.jsx)(o.EY,{children:"\u7acb\u5373\u5b9a\u5236"})})]}),(0,b.jsx)(o.Ss,{className:"safe-bottom-placeholder"})]}):(0,b.jsxs)(o.Ss,{className:"shop-detail-page theme-dark",children:[(0,b.jsx)(u.A,{darkTop:!0}),(0,b.jsx)(g.A,{title:"\u5546\u54c1\u8be6\u60c5",targetSelector:".shop-back-btn",showBack:!0}),(0,b.jsx)(o.Ss,{style:{padding:"40rpx"},onTap:_,children:(0,b.jsxs)(o.EY,{style:{color:"#fff"},children:[F||"\u5546\u54c1\u4e0d\u5b58\u5728","\uff0c\u70b9\u51fb\u91cd\u8bd5"]})})]})}var v={navigationStyle:"custom",enablePageMeta:!0,navigationBarTextStyle:"white"};Page((0,c.createPageConfig)(S,"pages/shop/detail/index",{root:{cn:[]}},v||{}))}},function(s){var e=function(e){return s(s.s=e)};s.O(0,[907,96,76],function(){return e(3483)});s.O()}]); \ No newline at end of file diff --git a/dist/pages/shop/index.js b/dist/pages/shop/index.js index bdf6a26..3f97fbd 100644 --- a/dist/pages/shop/index.js +++ b/dist/pages/shop/index.js @@ -1 +1 @@ -"use strict";(wx["webpackJsonp"]=wx["webpackJsonp"]||[]).push([[205],{6296:function(s,e,a){var c=a(7842),n=a(118),r=a(758),i=a.n(r),o=a(9703),t=a(9201),l=a(5414),d=a(9674),h=a(3053),p=a(5234),m=a(4848);function x(){var s=(0,o.wR)(),e=s.resolvedTheme,a=(0,t.c)();(0,l.l)(e);var c=function(s){i().navigateTo({url:"/pages/shop/detail/index?id=".concat(s)})};return(0,m.jsxs)(n.Ss,{className:"shop-page theme-".concat(e),children:[(0,m.jsx)(d.A,{}),(0,m.jsx)(h.A,{title:"\u667a\u7ed8\u7cbe\u9009",targetSelector:".shop-header"}),(0,m.jsxs)(n.Ss,{className:"shop-list",children:[(0,m.jsxs)(n.Ss,{className:"shop-header",style:{paddingTop:"".concat(a.statusBarHeight+12,"px")},children:[(0,m.jsx)(n.EY,{className:"shop-header-title",children:"\u667a\u7ed8\u7cbe\u9009"}),(0,m.jsx)(n.EY,{className:"shop-header-sub",children:"\u6fc0\u5149\u5fae\u96d5\u5b9a\u5236\u597d\u7269"})]}),(0,m.jsx)(n.Ss,{className:"shop-grid",children:p.zv.map(function(s){var e=s.images[0]||s.iconImg||"";return(0,m.jsxs)(n.Ss,{className:"shop-card",onTap:function(){return c(s.id)},children:[(0,m.jsx)(n.Ss,{className:"shop-card-img-wrap",children:(0,m.jsx)(n._V,{className:"shop-card-img",src:e,mode:"aspectFill",lazyLoad:!0})}),(0,m.jsxs)(n.Ss,{className:"shop-card-body",children:[(0,m.jsx)(n.EY,{className:"shop-card-name",children:s.name}),(0,m.jsx)(n.EY,{className:"shop-card-desc",children:s.desc||""}),(0,m.jsxs)(n.EY,{className:"shop-card-price",children:["\xa5",s.price]})]})]},s.id)})})]})]})}var u={navigationStyle:"custom",enablePageMeta:!0};Page((0,c.createPageConfig)(x,"pages/shop/index",{root:{cn:[]}},u||{}))}},function(s){var e=function(e){return s(s.s=e)};s.O(0,[907,96,76],function(){return e(6296)});s.O()}]); \ No newline at end of file +"use strict";(wx["webpackJsonp"]=wx["webpackJsonp"]||[]).push([[205],{6296:function(e,s,a){var c=a(7842),n=a(1212),r=a(467),t=a(5544),i=a(118),o=a(758),l=a.n(o),h=a(6540),d=a(9703),p=a(9201),u=a(5414),m=a(9674),x=a(3053),g=a(2371),f=a(4848);function j(){var e=(0,d.wR)(),s=e.resolvedTheme,a=(0,p.c)();(0,u.l)(s);var c=(0,h.useState)([]),o=(0,t.A)(c,2),j=o[0],N=o[1],S=(0,h.useState)(!0),v=(0,t.A)(S,2),b=v[0],E=v[1],w=(0,h.useState)(""),k=(0,t.A)(w,2),A=k[0],Y=k[1],T=(0,h.useCallback)((0,r.A)((0,n.A)().m(function e(){var s,a;return(0,n.A)().w(function(e){while(1)switch(e.p=e.n){case 0:return E(!0),Y(""),e.p=1,e.n=2,(0,g.j0)({page:1,pageSize:100});case 2:s=e.v,N(s.list),e.n=4;break;case 3:e.p=3,a=e.v,Y(a instanceof Error?a.message:"\u5546\u54c1\u52a0\u8f7d\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5");case 4:return e.p=4,E(!1),e.f(4);case 5:return e.a(2)}},e,null,[[1,3,4,5]])})),[]);(0,h.useEffect)(function(){T()},[T]);var y=function(e){l().navigateTo({url:"/pages/shop/detail/index?id=".concat(e)})};return(0,f.jsxs)(i.Ss,{className:"shop-page theme-".concat(s),children:[(0,f.jsx)(m.A,{}),(0,f.jsx)(x.A,{title:"\u667a\u7ed8\u7cbe\u9009",targetSelector:".shop-header"}),(0,f.jsxs)(i.Ss,{className:"shop-list",children:[(0,f.jsxs)(i.Ss,{className:"shop-header",style:{paddingTop:"".concat(a.statusBarHeight+12,"px")},children:[(0,f.jsx)(i.EY,{className:"shop-header-title",children:"\u667a\u7ed8\u7cbe\u9009"}),(0,f.jsx)(i.EY,{className:"shop-header-sub",children:"\u6fc0\u5149\u5fae\u96d5\u5b9a\u5236\u597d\u7269"})]}),(0,f.jsx)(i.Ss,{className:"shop-grid",children:j.map(function(e){var s=e.images[0]||e.iconImg||"";return(0,f.jsxs)(i.Ss,{className:"shop-card",onTap:function(){return y(e.id)},children:[(0,f.jsx)(i.Ss,{className:"shop-card-img-wrap",children:(0,f.jsx)(i._V,{className:"shop-card-img",src:s,mode:"aspectFill",lazyLoad:!0})}),(0,f.jsxs)(i.Ss,{className:"shop-card-body",children:[(0,f.jsx)(i.EY,{className:"shop-card-name",children:e.name}),(0,f.jsx)(i.EY,{className:"shop-card-desc",children:e.subtitle||e.description||""}),(0,f.jsxs)(i.EY,{className:"shop-card-price",children:["\xa5",e.price]})]})]},e.id)})}),b&&(0,f.jsx)(i.EY,{className:"shop-feedback",children:"\u6b63\u5728\u52a0\u8f7d\u5546\u54c1\u2026"}),!b&&A&&(0,f.jsx)(i.Ss,{className:"shop-feedback shop-feedback-action",onTap:T,children:(0,f.jsxs)(i.EY,{children:["\u52a0\u8f7d\u5931\u8d25\uff1a",A,"\u3002\u70b9\u51fb\u91cd\u8bd5"]})}),!b&&!A&&0===j.length&&(0,f.jsx)(i.EY,{className:"shop-feedback",children:"\u6682\u65e0\u5728\u552e\u5546\u54c1"})]})]})}var N={navigationStyle:"custom",enablePageMeta:!0};Page((0,c.createPageConfig)(j,"pages/shop/index",{root:{cn:[]}},N||{}))}},function(e){var s=function(s){return e(e.s=s)};e.O(0,[907,96,76],function(){return s(6296)});e.O()}]); \ No newline at end of file diff --git a/dist/pages/shop/index.wxss b/dist/pages/shop/index.wxss index 226ddac..d216e00 100644 --- a/dist/pages/shop/index.wxss +++ b/dist/pages/shop/index.wxss @@ -1 +1 @@ -.shop-list{padding:0 32rpx calc(220rpx + env(safe-area-inset-bottom))}.shop-header{padding-bottom:32rpx}.shop-header-title{color:var(--text-primary);display:block;font-size:56rpx;font-weight:800;letter-spacing:0;line-height:1.15}.shop-header-sub{color:var(--text-secondary);display:block;font-size:24rpx;margin-top:8rpx}.shop-grid{display:grid;gap:24rpx;grid-template-columns:1fr 1fr}.shop-card{background:var(--bg-card);border:1rpx solid var(--border);border-radius:24rpx;-webkit-box-shadow:var(--shadow-card);box-shadow:var(--shadow-card);overflow:hidden;-webkit-transition:-webkit-transform .15s ease;transition:-webkit-transform .15s ease;transition:transform .15s ease;transition:transform .15s ease,-webkit-transform .15s ease}.shop-card:active{-webkit-transform:scale(.98);-ms-transform:scale(.98);transform:scale(.98)}.shop-card-img-wrap{aspect-ratio:1/1;background:var(--bg-muted);overflow:hidden}.shop-card-img{height:100%;-o-object-fit:cover;object-fit:cover;-webkit-transition:-webkit-transform .4s ease;transition:-webkit-transform .4s ease;transition:transform .4s ease;transition:transform .4s ease,-webkit-transform .4s ease;width:100%}.shop-card-body{padding:20rpx 24rpx 24rpx}.shop-card-name{-webkit-line-clamp:2;-webkit-box-orient:vertical;color:var(--text-primary);display:-webkit-box;font-size:28rpx;font-weight:700;line-height:1.4;overflow:hidden}.shop-card-desc{-webkit-line-clamp:2;-webkit-box-orient:vertical;color:var(--text-secondary);display:-webkit-box;font-size:24rpx;line-height:1.4;margin-top:8rpx;overflow:hidden}.shop-card-price{color:var(--accent-primary);display:block;font-size:32rpx;font-variant:tabular-nums;font-weight:700;margin-top:12rpx}@media (min-width:750rpx){.shop-page{-ms-flex-pack:center;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-justify-content:center;justify-content:center}} \ No newline at end of file +.shop-list{padding:0 32rpx calc(220rpx + env(safe-area-inset-bottom))}.shop-header{padding-bottom:32rpx}.shop-header-title{color:var(--text-primary);display:block;font-size:56rpx;font-weight:800;letter-spacing:0;line-height:1.15}.shop-header-sub{color:var(--text-secondary);display:block;font-size:24rpx;margin-top:8rpx}.shop-grid{display:grid;gap:24rpx;grid-template-columns:1fr 1fr}.shop-card{background:var(--bg-card);border:1rpx solid var(--border);border-radius:24rpx;-webkit-box-shadow:var(--shadow-card);box-shadow:var(--shadow-card);overflow:hidden;-webkit-transition:-webkit-transform .15s ease;transition:-webkit-transform .15s ease;transition:transform .15s ease;transition:transform .15s ease,-webkit-transform .15s ease}.shop-card:active{-webkit-transform:scale(.98);-ms-transform:scale(.98);transform:scale(.98)}.shop-card-img-wrap{aspect-ratio:1/1;background:var(--bg-muted);overflow:hidden}.shop-card-img{height:100%;-o-object-fit:cover;object-fit:cover;-webkit-transition:-webkit-transform .4s ease;transition:-webkit-transform .4s ease;transition:transform .4s ease;transition:transform .4s ease,-webkit-transform .4s ease;width:100%}.shop-card-body{padding:20rpx 24rpx 24rpx}.shop-card-name{-webkit-line-clamp:2;-webkit-box-orient:vertical;color:var(--text-primary);display:-webkit-box;font-size:28rpx;font-weight:700;line-height:1.4;overflow:hidden}.shop-card-desc{-webkit-line-clamp:2;-webkit-box-orient:vertical;color:var(--text-secondary);display:-webkit-box;font-size:24rpx;line-height:1.4;margin-top:8rpx;overflow:hidden}.shop-card-price{color:var(--accent-primary);display:block;font-size:32rpx;font-variant:tabular-nums;font-weight:700;margin-top:12rpx}.shop-feedback{color:var(--text-secondary);display:block;font-size:26rpx;padding:48rpx 24rpx;text-align:center}.shop-feedback-action{color:var(--accent-primary)}@media (min-width:750rpx){.shop-page{-ms-flex-pack:center;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-justify-content:center;justify-content:center}} \ No newline at end of file diff --git a/dist/pages/wordcloud/index.js b/dist/pages/wordcloud/index.js index 025de70..c9d5c0b 100644 --- a/dist/pages/wordcloud/index.js +++ b/dist/pages/wordcloud/index.js @@ -1 +1 @@ -"use strict";(wx["webpackJsonp"]=wx["webpackJsonp"]||[]).push([[18],{5849:function(s,e,a){var n=a(7842),c=a(1212),t=a(467),r=a(5544),l=a(118),i=a(758),o=a.n(i),u=a(6540),m=a(9703),d=a(9201),h=a(5414),p=a(9674),x=a(3053),j=a(8199),N=a(6845),g=a(4848);function S(){var s=(0,m.wR)(),e=(s.theme,s.resolvedTheme),a=(0,d.c)();(0,h.l)(e);var n=(0,u.useState)(1),i=(0,r.A)(n,2),S=i[0],f=i[1],b=(0,u.useState)(""),v=(0,r.A)(b,2),E=v[0],w=v[1],Y=(0,u.useState)(""),T=(0,r.A)(Y,2),A=T[0],k=T[1],y=(0,u.useState)(""),I=(0,r.A)(y,2),F=I[0],V=I[1],_=(0,u.useState)(!1),P=(0,r.A)(_,2),q=P[0],M=P[1],B=(0,u.useState)(0),J=(0,r.A)(B,2),O=J[0],z=J[1],C=(0,u.useState)(""),H=(0,r.A)(C,2),L=H[0],R=H[1],U=[{num:1,label:"\u4e0a\u4f20\u5e95\u56fe"},{num:2,label:"\u8f93\u5165\u540d\u5355"},{num:3,label:"\u751f\u6210\u9884\u89c8"}],Z=function(){o().chooseImage({count:1,sizeType:["compressed"],sourceType:["album","camera"],success:function(s){w(s.tempFilePaths[0]),f(2)}})},D=function(){var s=(0,t.A)((0,c.A)().m(function s(){var e,a,n;return(0,c.A)().w(function(s){while(1)switch(s.p=s.n){case 0:if(A.trim()){s.n=1;break}return o().showToast({title:"\u8bf7\u5148\u8f93\u5165\u540d\u5b57",icon:"none"}),s.a(2);case 1:if(E){s.n=2;break}return o().showToast({title:"\u8bf7\u5148\u4e0a\u4f20\u5e95\u56fe",icon:"none"}),s.a(2);case 2:return f(3),M(!0),z(0),R(""),s.p=3,s.n=4,(0,N.l8)(E,A.trim());case 4:return e=s.v,a=e.jobId,s.n=5,G(a);case 5:s.n=7;break;case 6:s.p=6,n=s.v,M(!1),R(n instanceof Error?n.message:"\u751f\u6210\u5931\u8d25\uff0c\u8bf7\u7a0d\u540e\u91cd\u8bd5");case 7:return s.a(2)}},s,null,[[3,6]])}));return function(){return s.apply(this,arguments)}}(),G=function(s){return new Promise(function(e,a){var n=0,r=setInterval((0,t.A)((0,c.A)().m(function t(){var l;return(0,c.A)().w(function(c){while(1)switch(c.p=c.n){case 0:return c.p=0,c.n=1,(0,N.xZ)(s);case 1:l=c.v,z(Math.min(l.progress,100)),"success"===l.status?(clearInterval(r),M(!1),V(l.imageUrl||E),e()):"failed"===l.status&&(clearInterval(r),M(!1),R(l.error||"\u8bcd\u4e91\u751f\u6210\u5931\u8d25"),a(new Error(l.error||"\u8bcd\u4e91\u751f\u6210\u5931\u8d25"))),c.n=3;break;case 2:c.p=2,c.v,n+=1,n>5&&(clearInterval(r),M(!1),a(new Error("\u4efb\u52a1\u72b6\u6001\u83b7\u53d6\u5931\u8d25\uff0c\u8bf7\u7a0d\u540e\u91cd\u8bd5")));case 3:return c.a(2)}},t,null,[[0,2]])})),1500)})},K=function(){F&&o().saveImageToPhotosAlbum({filePath:F,success:function(){return o().showToast({title:"\u5df2\u4fdd\u5b58\u5230\u76f8\u518c",icon:"success"})},fail:function(){return o().showToast({title:"\u4fdd\u5b58\u5931\u8d25",icon:"none"})}})},Q=function(){S>1?f(S-1):o().navigateBack()};return(0,g.jsxs)(l.Ss,{className:"theme-".concat(e),children:[(0,g.jsx)(p.A,{}),(0,g.jsx)(x.A,{title:"AI\u8bcd\u4e91\u751f\u6210",targetSelector:".page-header.cloud-header",showBack:!0}),(0,g.jsxs)(l.Ss,{className:"wordcloud-page",children:[(0,g.jsxs)(l.Ss,{className:"page-header cloud-header",style:{paddingTop:"".concat(a.statusBarHeight+12,"px")},children:[(0,g.jsx)(l.Ss,{className:"back-btn",onTap:Q,children:(0,g.jsx)(l.EY,{className:"back-arrow",children:"\u2190"})}),(0,g.jsx)(l.EY,{className:"page-title",children:"AI\u8bcd\u4e91\u751f\u6210"}),(0,g.jsx)(l.Ss,{className:"header-spacer"})]}),(0,g.jsx)(l.Ss,{className:"step-indicator surface-card",children:U.map(function(s,e){return(0,g.jsxs)(l.Ss,{className:"step-item",children:[(0,g.jsx)(l.Ss,{className:"step-circle ".concat(S>=s.num?"active":""),children:(0,g.jsx)(l.EY,{className:"step-num",children:s.num})}),(0,g.jsx)(l.EY,{className:"step-label ".concat(S>=s.num?"active":""),children:s.label}),es.num?"active":"")})]},s.num)})}),1===S&&(0,g.jsxs)(l.Ss,{className:"step-content",children:[(0,g.jsx)(l.Ss,{className:"upload-area surface-card",onTap:Z,children:E?(0,g.jsx)(l._V,{className:"preview-image",src:E,mode:"aspectFit"}):(0,g.jsxs)(l.Ss,{className:"upload-placeholder",children:[(0,g.jsx)(l._V,{className:"upload-icon",src:(0,j.uq)("/icon/\u8bcd\u4e91\u751f\u6210.png"),mode:"aspectFit"}),(0,g.jsx)(l.EY,{className:"upload-title",children:"\u70b9\u51fb\u4e0a\u4f20\u5e95\u56fe"}),(0,g.jsx)(l.EY,{className:"upload-desc",children:"\u652f\u6301\u7167\u7247\u3001Logo\u3001\u56fe\u6848\u7b49"}),(0,g.jsx)(l.EY,{className:"upload-tip",children:"\u7cfb\u7edf\u5c06\u7528\u540d\u5b57\u586b\u5145\u5230\u6df1\u8272\u533a\u57df"})]})}),E&&(0,g.jsxs)(l.Ss,{className:"action-btns",children:[(0,g.jsx)(l.Ss,{className:"btn-primary",onTap:function(){return f(2)},children:(0,g.jsx)(l.EY,{children:"\u4e0b\u4e00\u6b65\uff1a\u8f93\u5165\u540d\u5355"})}),(0,g.jsx)(l.Ss,{className:"btn-secondary",onTap:function(){return w("")},children:(0,g.jsx)(l.EY,{children:"\u91cd\u65b0\u9009\u62e9"})})]})]}),2===S&&(0,g.jsxs)(l.Ss,{className:"step-content",children:[(0,g.jsxs)(l.Ss,{className:"input-section surface-card",children:[(0,g.jsx)(l.EY,{className:"section-title",children:"\u8f93\u5165\u540d\u5b57\u540d\u5355"}),(0,g.jsx)(l.TM,{className:"names-input",placeholder:"\u4f8b\u5982\uff1a\n\u5f20\u4e09\n\u674e\u56db\n\u738b\u4e94",value:A,onInput:function(s){return k(s.detail.value)},maxlength:5e3}),(0,g.jsxs)(l.EY,{className:"input-stats",children:["\u5df2\u8f93\u5165 ",A.split(/\n|\uff0c|,/).filter(function(s){return s.trim()}).length," \u4e2a\u540d\u5b57"]}),(0,g.jsxs)(l.Ss,{className:"input-tips",children:[(0,g.jsx)(l.EY,{className:"tip-item",children:"\u540d\u5b57\u4f1a\u968f\u673a\u5206\u5e03\u5728\u5e95\u56fe\u7684\u6df1\u8272\u533a\u57df"}),(0,g.jsx)(l.EY,{className:"tip-item",children:"\u5efa\u8bae\u8f93\u516510-200\u4e2a\u540d\u5b57\u6548\u679c\u6700\u4f73"})]})]}),(0,g.jsxs)(l.Ss,{className:"action-btns",children:[(0,g.jsx)(l.Ss,{className:"btn-primary",onTap:D,children:(0,g.jsx)(l.EY,{children:"\u5f00\u59cb\u751f\u6210\u8bcd\u4e91"})}),(0,g.jsx)(l.Ss,{className:"btn-secondary",onTap:function(){return f(1)},children:(0,g.jsx)(l.EY,{children:"\u4e0a\u4e00\u6b65"})})]})]}),3===S&&(0,g.jsx)(l.Ss,{className:"step-content",children:L?(0,g.jsxs)(l.Ss,{className:"generating-panel",children:[(0,g.jsx)(l._V,{className:"generating-icon",src:(0,j.uq)("/icon/\u8bcd\u4e91\u751f\u6210.png"),mode:"aspectFit"}),(0,g.jsx)(l.EY,{className:"generating-title",children:"\u751f\u6210\u5931\u8d25"}),(0,g.jsx)(l.EY,{className:"generating-subtitle",children:L}),(0,g.jsx)(l.Ss,{className:"action-btns",children:(0,g.jsx)(l.Ss,{className:"btn-primary",onTap:function(){R(""),f(2)},children:(0,g.jsx)(l.EY,{children:"\u8fd4\u56de\u4fee\u6539\u540d\u5355"})})})]}):q?(0,g.jsxs)(l.Ss,{className:"generating-panel",children:[(0,g.jsx)(l._V,{className:"generating-icon",src:(0,j.uq)("/icon/\u8bcd\u4e91\u751f\u6210.png"),mode:"aspectFit"}),(0,g.jsx)(l.EY,{className:"generating-title",children:"\u6b63\u5728\u751f\u6210\u8bcd\u4e91..."}),(0,g.jsx)(l.EY,{className:"generating-subtitle",children:"AI\u6b63\u5728\u5c06\u540d\u5b57\u878d\u5165\u56fe\u6848"}),(0,g.jsx)(l.Ss,{className:"progress-bar",children:(0,g.jsx)(l.Ss,{className:"progress-fill",style:{width:"".concat(Math.min(O,100),"%")}})}),(0,g.jsxs)(l.EY,{className:"progress-text",children:[Math.min(Math.round(O),100),"%"]})]}):(0,g.jsxs)(l.Ss,{className:"result-panel",children:[(0,g.jsxs)(l.Ss,{className:"result-image-wrapper surface-card",children:[(0,g.jsx)(l._V,{className:"result-image",src:F||"",mode:"aspectFit"}),(0,g.jsx)(l.Ss,{className:"watermark-badge",children:(0,g.jsx)(l.EY,{children:"\u667a\u7ed8\u5fae\u523b\u9884\u89c8"})})]}),(0,g.jsxs)(l.Ss,{className:"result-actions",children:[(0,g.jsxs)(l.Ss,{className:"action-btn",onTap:K,children:[(0,g.jsx)(l._V,{className:"action-icon",src:(0,j.uq)("/icon/\u8bbe\u7f6e.png"),mode:"aspectFit"}),(0,g.jsx)(l.EY,{className:"action-label",children:"\u4fdd\u5b58\u56fe\u7247"})]}),(0,g.jsxs)(l.Ss,{className:"action-btn",onTap:D,children:[(0,g.jsx)(l._V,{className:"action-icon",src:(0,j.uq)("/icon/\u8bcd\u4e91\u751f\u6210.png"),mode:"aspectFit"}),(0,g.jsx)(l.EY,{className:"action-label",children:"\u91cd\u65b0\u751f\u6210"})]}),(0,g.jsxs)(l.Ss,{className:"action-btn",onTap:function(){return f(2)},children:[(0,g.jsx)(l._V,{className:"action-icon",src:(0,j.uq)("/icon/\u8c03\u8272\u76d8.png"),mode:"aspectFit"}),(0,g.jsx)(l.EY,{className:"action-label",children:"\u4fee\u6539\u540d\u5355"})]})]})]})})]})]})}var f={navigationStyle:"custom",enablePageMeta:!0,navigationBarTitleText:"\u8bcd\u4e91\u751f\u6210"};Page((0,n.createPageConfig)(S,"pages/wordcloud/index",{root:{cn:[]}},f||{}))}},function(s){var e=function(e){return s(s.s=e)};s.O(0,[907,96,76],function(){return e(5849)});s.O()}]); \ No newline at end of file +"use strict";(wx["webpackJsonp"]=wx["webpackJsonp"]||[]).push([[18],{5849:function(s,e,a){var n=a(7842),c=a(1212),t=a(467),r=a(5544),l=a(118),i=a(758),o=a.n(i),u=a(6540),m=a(9703),d=a(9201),h=a(5414),p=a(9674),x=a(3053),j=a(8199),N=a(9972),g=a(4848);function S(){var s=(0,m.wR)(),e=(s.theme,s.resolvedTheme),a=(0,d.c)();(0,h.l)(e);var n=(0,u.useState)(1),i=(0,r.A)(n,2),S=i[0],f=i[1],b=(0,u.useState)(""),v=(0,r.A)(b,2),E=v[0],w=v[1],Y=(0,u.useState)(""),T=(0,r.A)(Y,2),A=T[0],k=T[1],y=(0,u.useState)(""),I=(0,r.A)(y,2),F=I[0],V=I[1],_=(0,u.useState)(!1),P=(0,r.A)(_,2),q=P[0],M=P[1],B=(0,u.useState)(0),J=(0,r.A)(B,2),O=J[0],z=J[1],C=(0,u.useState)(""),H=(0,r.A)(C,2),L=H[0],R=H[1],U=[{num:1,label:"\u4e0a\u4f20\u5e95\u56fe"},{num:2,label:"\u8f93\u5165\u540d\u5355"},{num:3,label:"\u751f\u6210\u9884\u89c8"}],Z=function(){o().chooseImage({count:1,sizeType:["compressed"],sourceType:["album","camera"],success:function(s){w(s.tempFilePaths[0]),f(2)}})},D=function(){var s=(0,t.A)((0,c.A)().m(function s(){var e,a,n;return(0,c.A)().w(function(s){while(1)switch(s.p=s.n){case 0:if(A.trim()){s.n=1;break}return o().showToast({title:"\u8bf7\u5148\u8f93\u5165\u540d\u5b57",icon:"none"}),s.a(2);case 1:if(E){s.n=2;break}return o().showToast({title:"\u8bf7\u5148\u4e0a\u4f20\u5e95\u56fe",icon:"none"}),s.a(2);case 2:return f(3),M(!0),z(0),R(""),s.p=3,s.n=4,(0,N.l8)(E,A.trim());case 4:return e=s.v,a=e.jobId,s.n=5,G(a);case 5:s.n=7;break;case 6:s.p=6,n=s.v,M(!1),R(n instanceof Error?n.message:"\u751f\u6210\u5931\u8d25\uff0c\u8bf7\u7a0d\u540e\u91cd\u8bd5");case 7:return s.a(2)}},s,null,[[3,6]])}));return function(){return s.apply(this,arguments)}}(),G=function(s){return new Promise(function(e,a){var n=0,r=setInterval((0,t.A)((0,c.A)().m(function t(){var l;return(0,c.A)().w(function(c){while(1)switch(c.p=c.n){case 0:return c.p=0,c.n=1,(0,N.xZ)(s);case 1:l=c.v,z(Math.min(l.progress,100)),"success"===l.status?(clearInterval(r),M(!1),V(l.imageUrl||E),e()):"failed"===l.status&&(clearInterval(r),M(!1),R(l.error||"\u8bcd\u4e91\u751f\u6210\u5931\u8d25"),a(new Error(l.error||"\u8bcd\u4e91\u751f\u6210\u5931\u8d25"))),c.n=3;break;case 2:c.p=2,c.v,n+=1,n>5&&(clearInterval(r),M(!1),a(new Error("\u4efb\u52a1\u72b6\u6001\u83b7\u53d6\u5931\u8d25\uff0c\u8bf7\u7a0d\u540e\u91cd\u8bd5")));case 3:return c.a(2)}},t,null,[[0,2]])})),1500)})},K=function(){F&&o().saveImageToPhotosAlbum({filePath:F,success:function(){return o().showToast({title:"\u5df2\u4fdd\u5b58\u5230\u76f8\u518c",icon:"success"})},fail:function(){return o().showToast({title:"\u4fdd\u5b58\u5931\u8d25",icon:"none"})}})},Q=function(){S>1?f(S-1):o().navigateBack()};return(0,g.jsxs)(l.Ss,{className:"theme-".concat(e),children:[(0,g.jsx)(p.A,{}),(0,g.jsx)(x.A,{title:"AI\u8bcd\u4e91\u751f\u6210",targetSelector:".page-header.cloud-header",showBack:!0}),(0,g.jsxs)(l.Ss,{className:"wordcloud-page",children:[(0,g.jsxs)(l.Ss,{className:"page-header cloud-header",style:{paddingTop:"".concat(a.statusBarHeight+12,"px")},children:[(0,g.jsx)(l.Ss,{className:"back-btn",onTap:Q,children:(0,g.jsx)(l.EY,{className:"back-arrow",children:"\u2190"})}),(0,g.jsx)(l.EY,{className:"page-title",children:"AI\u8bcd\u4e91\u751f\u6210"}),(0,g.jsx)(l.Ss,{className:"header-spacer"})]}),(0,g.jsx)(l.Ss,{className:"step-indicator surface-card",children:U.map(function(s,e){return(0,g.jsxs)(l.Ss,{className:"step-item",children:[(0,g.jsx)(l.Ss,{className:"step-circle ".concat(S>=s.num?"active":""),children:(0,g.jsx)(l.EY,{className:"step-num",children:s.num})}),(0,g.jsx)(l.EY,{className:"step-label ".concat(S>=s.num?"active":""),children:s.label}),es.num?"active":"")})]},s.num)})}),1===S&&(0,g.jsxs)(l.Ss,{className:"step-content",children:[(0,g.jsx)(l.Ss,{className:"upload-area surface-card",onTap:Z,children:E?(0,g.jsx)(l._V,{className:"preview-image",src:E,mode:"aspectFit"}):(0,g.jsxs)(l.Ss,{className:"upload-placeholder",children:[(0,g.jsx)(l._V,{className:"upload-icon",src:(0,j.uq)("/icon/\u8bcd\u4e91\u751f\u6210.png"),mode:"aspectFit"}),(0,g.jsx)(l.EY,{className:"upload-title",children:"\u70b9\u51fb\u4e0a\u4f20\u5e95\u56fe"}),(0,g.jsx)(l.EY,{className:"upload-desc",children:"\u652f\u6301\u7167\u7247\u3001Logo\u3001\u56fe\u6848\u7b49"}),(0,g.jsx)(l.EY,{className:"upload-tip",children:"\u7cfb\u7edf\u5c06\u7528\u540d\u5b57\u586b\u5145\u5230\u6df1\u8272\u533a\u57df"})]})}),E&&(0,g.jsxs)(l.Ss,{className:"action-btns",children:[(0,g.jsx)(l.Ss,{className:"btn-primary",onTap:function(){return f(2)},children:(0,g.jsx)(l.EY,{children:"\u4e0b\u4e00\u6b65\uff1a\u8f93\u5165\u540d\u5355"})}),(0,g.jsx)(l.Ss,{className:"btn-secondary",onTap:function(){return w("")},children:(0,g.jsx)(l.EY,{children:"\u91cd\u65b0\u9009\u62e9"})})]})]}),2===S&&(0,g.jsxs)(l.Ss,{className:"step-content",children:[(0,g.jsxs)(l.Ss,{className:"input-section surface-card",children:[(0,g.jsx)(l.EY,{className:"section-title",children:"\u8f93\u5165\u540d\u5b57\u540d\u5355"}),(0,g.jsx)(l.TM,{className:"names-input",placeholder:"\u4f8b\u5982\uff1a\n\u5f20\u4e09\n\u674e\u56db\n\u738b\u4e94",value:A,onInput:function(s){return k(s.detail.value)},maxlength:5e3}),(0,g.jsxs)(l.EY,{className:"input-stats",children:["\u5df2\u8f93\u5165 ",A.split(/\n|\uff0c|,/).filter(function(s){return s.trim()}).length," \u4e2a\u540d\u5b57"]}),(0,g.jsxs)(l.Ss,{className:"input-tips",children:[(0,g.jsx)(l.EY,{className:"tip-item",children:"\u540d\u5b57\u4f1a\u968f\u673a\u5206\u5e03\u5728\u5e95\u56fe\u7684\u6df1\u8272\u533a\u57df"}),(0,g.jsx)(l.EY,{className:"tip-item",children:"\u5efa\u8bae\u8f93\u516510-200\u4e2a\u540d\u5b57\u6548\u679c\u6700\u4f73"})]})]}),(0,g.jsxs)(l.Ss,{className:"action-btns",children:[(0,g.jsx)(l.Ss,{className:"btn-primary",onTap:D,children:(0,g.jsx)(l.EY,{children:"\u5f00\u59cb\u751f\u6210\u8bcd\u4e91"})}),(0,g.jsx)(l.Ss,{className:"btn-secondary",onTap:function(){return f(1)},children:(0,g.jsx)(l.EY,{children:"\u4e0a\u4e00\u6b65"})})]})]}),3===S&&(0,g.jsx)(l.Ss,{className:"step-content",children:L?(0,g.jsxs)(l.Ss,{className:"generating-panel",children:[(0,g.jsx)(l._V,{className:"generating-icon",src:(0,j.uq)("/icon/\u8bcd\u4e91\u751f\u6210.png"),mode:"aspectFit"}),(0,g.jsx)(l.EY,{className:"generating-title",children:"\u751f\u6210\u5931\u8d25"}),(0,g.jsx)(l.EY,{className:"generating-subtitle",children:L}),(0,g.jsx)(l.Ss,{className:"action-btns",children:(0,g.jsx)(l.Ss,{className:"btn-primary",onTap:function(){R(""),f(2)},children:(0,g.jsx)(l.EY,{children:"\u8fd4\u56de\u4fee\u6539\u540d\u5355"})})})]}):q?(0,g.jsxs)(l.Ss,{className:"generating-panel",children:[(0,g.jsx)(l._V,{className:"generating-icon",src:(0,j.uq)("/icon/\u8bcd\u4e91\u751f\u6210.png"),mode:"aspectFit"}),(0,g.jsx)(l.EY,{className:"generating-title",children:"\u6b63\u5728\u751f\u6210\u8bcd\u4e91..."}),(0,g.jsx)(l.EY,{className:"generating-subtitle",children:"AI\u6b63\u5728\u5c06\u540d\u5b57\u878d\u5165\u56fe\u6848"}),(0,g.jsx)(l.Ss,{className:"progress-bar",children:(0,g.jsx)(l.Ss,{className:"progress-fill",style:{width:"".concat(Math.min(O,100),"%")}})}),(0,g.jsxs)(l.EY,{className:"progress-text",children:[Math.min(Math.round(O),100),"%"]})]}):(0,g.jsxs)(l.Ss,{className:"result-panel",children:[(0,g.jsxs)(l.Ss,{className:"result-image-wrapper surface-card",children:[(0,g.jsx)(l._V,{className:"result-image",src:F||"",mode:"aspectFit"}),(0,g.jsx)(l.Ss,{className:"watermark-badge",children:(0,g.jsx)(l.EY,{children:"\u667a\u7ed8\u5fae\u523b\u9884\u89c8"})})]}),(0,g.jsxs)(l.Ss,{className:"result-actions",children:[(0,g.jsxs)(l.Ss,{className:"action-btn",onTap:K,children:[(0,g.jsx)(l._V,{className:"action-icon",src:(0,j.uq)("/icon/\u8bbe\u7f6e.png"),mode:"aspectFit"}),(0,g.jsx)(l.EY,{className:"action-label",children:"\u4fdd\u5b58\u56fe\u7247"})]}),(0,g.jsxs)(l.Ss,{className:"action-btn",onTap:D,children:[(0,g.jsx)(l._V,{className:"action-icon",src:(0,j.uq)("/icon/\u8bcd\u4e91\u751f\u6210.png"),mode:"aspectFit"}),(0,g.jsx)(l.EY,{className:"action-label",children:"\u91cd\u65b0\u751f\u6210"})]}),(0,g.jsxs)(l.Ss,{className:"action-btn",onTap:function(){return f(2)},children:[(0,g.jsx)(l._V,{className:"action-icon",src:(0,j.uq)("/icon/\u8c03\u8272\u76d8.png"),mode:"aspectFit"}),(0,g.jsx)(l.EY,{className:"action-label",children:"\u4fee\u6539\u540d\u5355"})]})]})]})})]})]})}var f={navigationStyle:"custom",enablePageMeta:!0,navigationBarTitleText:"\u8bcd\u4e91\u751f\u6210"};Page((0,n.createPageConfig)(S,"pages/wordcloud/index",{root:{cn:[]}},f||{}))}},function(s){var e=function(e){return s(s.s=e)};s.O(0,[907,96,76],function(){return e(5849)});s.O()}]); \ No newline at end of file diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx index 3bb0411..ca84702 100644 --- a/src/pages/index/index.tsx +++ b/src/pages/index/index.tsx @@ -1,96 +1,57 @@ import { View, Text, Image, Input, Button, Swiper, SwiperItem } from '@tarojs/components' import Taro from '@tarojs/taro' -import { useState } from 'react' +import { useCallback, useEffect, useState } from 'react' import './index.scss' -import { CATEGORIES } from '../../utils/productConfig' import { assetUrl } from '../../utils/asset' import { useThemeContext } from '../../context/ThemeContext' import { useSafeArea } from '../../hooks/useSafeArea' import { useStatusBar } from '../../hooks/useStatusBar' import ThemedPageMeta from '../../components/ThemedPageMeta' import ScrollTopMask from '../../components/ScrollTopMask' - -// 成品展示配图(从 img 里取对应实物图) -const SHOWCASE_LIST = [ - { - title: '毕业纪念笔记本', - desc: '全班名字组成校徽', - priceText: '¥45 起', - categoryId: 'notebook-large', - image: assetUrl('/img/book_small/The1.jpg') - }, - { - title: '铜质杯垫', - desc: '金属质感桌面艺术', - priceText: '¥25 起', - categoryId: 'coaster', - image: assetUrl('/img/cup/The1.jpg') - }, - { - title: '竹制笔盒', - desc: '自然竹纹文房雅器', - priceText: '¥75 起', - categoryId: 'penbox', - image: assetUrl('/img/penbox/The1.jpg') - }, - { - title: '书本型灯', - desc: '温暖光影点亮心意', - priceText: '¥45 起', - categoryId: 'booklamp', - image: assetUrl('/img/booklight/The1.jpg') - }, - { - title: '情侣定制礼', - desc: '两个人的名字交织', - priceText: '¥45 起', - categoryId: 'notebook-large', - image: assetUrl('/img/book_big/The1.jpg') - }, - { - title: '企业年会礼', - desc: '员工名字组成Logo', - priceText: '¥75 起', - categoryId: 'penbox', - image: assetUrl('/img/penbox/The2.jpg') - } -] - -// 品类对应的实物照片映射(首页卡片顶部大图) -const PRODUCT_IMG_MAP: Record = { - 'notebook-small': assetUrl('/img/book_small/The1.jpg'), - 'notebook-large': assetUrl('/img/book_big/The1.jpg'), - 'coaster': assetUrl('/img/cup/The1.jpg'), - 'penbox': assetUrl('/img/penbox/The1.jpg'), - 'booklamp': assetUrl('/img/booklight/The1.jpg') -} +import type { ProductCategory } from '../../types' +import { fetchProducts } from '../../utils/api/product' +import { toProductCategory } from '../../utils/productAdapter' export default function Index() { const { theme, resolvedTheme } = useThemeContext() const safe = useSafeArea() useStatusBar(resolvedTheme) const [searchKey, setSearchKey] = useState('') + const [products, setProducts] = useState([]) + const [loading, setLoading] = useState(true) + const [error, setError] = useState('') + + const loadProducts = useCallback(async () => { + setLoading(true) + setError('') + try { + const result = await fetchProducts({ page: 1, pageSize: 100 }) + setProducts(result.list.map(toProductCategory)) + } catch (e) { + setError(e instanceof Error ? e.message : '商品加载失败,请重试') + } finally { + setLoading(false) + } + }, []) + + useEffect(() => { + loadProducts() + }, [loadProducts]) const navigateToProduct = (categoryId: string) => { Taro.navigateTo({ url: `/pages/product/index?id=${categoryId}` }) } - const navigateFromShowcase = (item: { categoryId?: string; title: string }) => { - if (item.categoryId) { - navigateToProduct(item.categoryId) - return - } - Taro.showToast({ - title: `“${item.title}”定制通道即将开放`, - icon: 'none' - }) + const navigateFromShowcase = (item: ProductCategory) => { + navigateToProduct(item.id) } const filteredCategories = searchKey.trim() - ? CATEGORIES.filter( + ? products.filter( (c) => c.name.includes(searchKey) || c.desc.includes(searchKey) ) - : CATEGORIES + : products + const showcaseProducts = products.slice(0, 5) const handleSearch = (e: any) => { setSearchKey(e.detail.value) @@ -133,26 +94,32 @@ export default function Index() { {/* 定制成品展示 */} 定制成品展示 - - {SHOWCASE_LIST.map((item, idx) => ( - + {showcaseProducts.length > 0 ? ( + + {showcaseProducts.map(item => ( + - + - {item.title} + {item.name} {item.desc} ))} - + + ) : ( + + {loading ? '正在加载商品…' : error || '暂无商品'} + + )} {/* 热门品类 */} @@ -168,7 +135,7 @@ export default function Index() { @@ -183,8 +150,10 @@ export default function Index() { {filteredCategories.length === 0 && ( - 未找到匹配的品类 - 尝试搜索“笔记本”、“杯垫”等 + {error || (loading ? '正在加载商品…' : '未找到匹配的品类')} + + {error ? '点击重新加载' : '尝试搜索“笔记本”、“杯垫”等'} + )} @@ -193,19 +162,19 @@ export default function Index() { 为你推荐 - {SHOWCASE_LIST.slice(0, 4).map((item, idx) => ( + {showcaseProducts.slice(0, 4).map(item => ( navigateFromShowcase(item)} > - + - {item.title} + {item.name} {item.desc} - {item.priceText} + ¥{item.price} 起 ))} diff --git a/src/pages/product/index.tsx b/src/pages/product/index.tsx index 46a8d0b..5ea5f0a 100644 --- a/src/pages/product/index.tsx +++ b/src/pages/product/index.tsx @@ -1,8 +1,7 @@ import { View, Text, Image, Swiper, SwiperItem } from '@tarojs/components' import Taro from '@tarojs/taro' -import { useState } from 'react' +import { useCallback, useEffect, useState } from 'react' import './index.scss' -import { getProductById } from '../../utils/productConfig' import { addDesign, getDesignList, setDesignList } from '../../utils/store' import { createDesign } from '../../utils/api' import { useThemeContext } from '../../context/ThemeContext' @@ -12,18 +11,53 @@ import ThemedPageMeta from '../../components/ThemedPageMeta' import ScrollTopMask from '../../components/ScrollTopMask' import BottomActionBar from '../../components/BottomActionBar' import { getProductIconImg } from '../../utils/productConfig' +import type { ProductCategory } from '../../types' +import { fetchProduct } from '../../utils/api/product' +import { toProductCategory } from '../../utils/productAdapter' export default function ProductPage() { - const { theme, resolvedTheme } = useThemeContext() + const { resolvedTheme } = useThemeContext() const safe = useSafeArea() useStatusBar(resolvedTheme) const [showModal, setShowModal] = useState(false) const [quantity, setQuantity] = useState(1) + const [product, setProduct] = useState(null) + const [loading, setLoading] = useState(true) + const [error, setError] = useState('') const router = Taro.getCurrentInstance().router const params = router ? router.params : undefined const productId = params && params.id ? params.id : '' - const product = getProductById(productId) + + const loadProduct = useCallback(async () => { + if (!productId) { + setError('缺少商品 ID') + setLoading(false) + return + } + setLoading(true) + setError('') + try { + setProduct(toProductCategory(await fetchProduct(productId))) + } catch (e) { + setError(e instanceof Error ? e.message : '商品加载失败,请重试') + } finally { + setLoading(false) + } + }, [productId]) + + useEffect(() => { + loadProduct() + }, [loadProduct]) + + if (loading) { + return ( + + + 正在加载商品… + + ) + } if (!product) { return ( @@ -41,7 +75,7 @@ export default function ProductPage() { - 商品未找到 + {error || '商品未找到'} diff --git a/src/pages/shop/detail/index.tsx b/src/pages/shop/detail/index.tsx index e6232d5..ce8a3a9 100644 --- a/src/pages/shop/detail/index.tsx +++ b/src/pages/shop/detail/index.tsx @@ -2,8 +2,7 @@ import { View, Text, Image, ScrollView } from '@tarojs/components' import Taro from '@tarojs/taro' import { useState, useEffect, useCallback, useMemo } from 'react' import './index.scss' -import { PRODUCTS } from '../../../utils/productConfig' -import { ProductCategory } from '../../../types' +import { fetchProduct, type ProductDto } from '../../../utils/api/product' import { useSafeArea } from '../../../hooks/useSafeArea' import { useStatusBar } from '../../../hooks/useStatusBar' import { useThemeContext } from '../../../context/ThemeContext' @@ -19,6 +18,9 @@ export default function ShopDetailPage() { const { resolvedTheme } = useThemeContext() const [winHeight, setWinHeight] = useState(667) const [progress, setProgress] = useState(0) + const [product, setProduct] = useState(null) + const [loading, setLoading] = useState(true) + const [error, setError] = useState('') const safe = useSafeArea() // 顶部为沉浸式商品图,状态栏始终使用白字。 useStatusBar(resolvedTheme, { mode: 'light' }) @@ -26,7 +28,27 @@ export default function ShopDetailPage() { const routerParams = Taro.getCurrentInstance().router const routerParamsValues = routerParams ? routerParams.params : undefined const productId = routerParamsValues ? routerParamsValues.id : '' - const product: ProductCategory | undefined = PRODUCTS.find(p => p.id === productId) + + const loadProduct = useCallback(async () => { + if (!productId) { + setError('缺少商品 ID') + setLoading(false) + return + } + setLoading(true) + setError('') + try { + setProduct(await fetchProduct(productId)) + } catch (e) { + setError(e instanceof Error ? e.message : '商品加载失败,请重试') + } finally { + setLoading(false) + } + }, [productId]) + + useEffect(() => { + loadProduct() + }, [loadProduct]) useEffect(() => { try { @@ -108,12 +130,23 @@ export default function ShopDetailPage() { const tone = useMemo(() => (product ? product.tone : [28, 22, 18]), [product]) + if (loading) { + return ( + + + 正在加载商品… + + ) + } + if (!product) { return ( - 商品不存在 + + {error || '商品不存在'},点击重试 + ) } diff --git a/src/pages/shop/index.scss b/src/pages/shop/index.scss index 27c976d..5e1782d 100644 --- a/src/pages/shop/index.scss +++ b/src/pages/shop/index.scss @@ -95,6 +95,18 @@ font-variant: tabular-nums; } +.shop-feedback { + display: block; + padding: 48rpx 24rpx; + text-align: center; + color: var(--text-secondary); + font-size: 26rpx; +} + +.shop-feedback-action { + color: var(--accent-primary); +} + /* ============================================================ Responsive: container center on wide screens ============================================================ */ diff --git a/src/pages/shop/index.tsx b/src/pages/shop/index.tsx index 3cdeeaa..8f421e0 100644 --- a/src/pages/shop/index.tsx +++ b/src/pages/shop/index.tsx @@ -1,17 +1,38 @@ import { View, Text, Image } from '@tarojs/components' import Taro from '@tarojs/taro' +import { useCallback, useEffect, useState } from 'react' import { useThemeContext } from '../../context/ThemeContext' import { useSafeArea } from '../../hooks/useSafeArea' import { useStatusBar } from '../../hooks/useStatusBar' import ThemedPageMeta from '../../components/ThemedPageMeta' import ScrollTopMask from '../../components/ScrollTopMask' import './index.scss' -import { PRODUCTS } from '../../utils/productConfig' +import { fetchProducts, type ProductDto } from '../../utils/api/product' export default function ShopPage() { const { resolvedTheme } = useThemeContext() const safe = useSafeArea() useStatusBar(resolvedTheme) + const [products, setProducts] = useState([]) + const [loading, setLoading] = useState(true) + const [error, setError] = useState('') + + const loadProducts = useCallback(async () => { + setLoading(true) + setError('') + try { + const result = await fetchProducts({ page: 1, pageSize: 100 }) + setProducts(result.list) + } catch (e) { + setError(e instanceof Error ? e.message : '商品加载失败,请重试') + } finally { + setLoading(false) + } + }, []) + + useEffect(() => { + loadProducts() + }, [loadProducts]) const openDetail = (productId: string) => { Taro.navigateTo({ url: `/pages/shop/detail/index?id=${productId}` }) @@ -28,7 +49,7 @@ export default function ShopPage() { - {PRODUCTS.map(product => { + {products.map(product => { const imageSrc = product.images[0] || product.iconImg || '' return ( {product.name} - {product.desc || ''} + {product.subtitle || product.description || ''} ¥{product.price} @@ -54,6 +75,16 @@ export default function ShopPage() { })} + {loading && 正在加载商品…} + {!loading && error && ( + + 加载失败:{error}。点击重试 + + )} + {!loading && !error && products.length === 0 && ( + 暂无在售商品 + )} + ) diff --git a/src/types/index.ts b/src/types/index.ts index 3f55427..b6bd9e0 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -44,6 +44,10 @@ export interface ProductCategory { specs?: [string, string][] // 规格参数键值对 mask: MaskConfig images: string[] // 商品实物照片路径列表(相对页面引用的路径) + /** 服务端商品目录字段;本地兜底数据可不填。 */ + status?: 'ON_SALE' + sort?: number + categoryId?: string } /** 贴纸物品 */ diff --git a/src/utils/api/product.ts b/src/utils/api/product.ts index 8d296fd..66d1760 100644 --- a/src/utils/api/product.ts +++ b/src/utils/api/product.ts @@ -1,16 +1,83 @@ import http from '../request' +import type { MaskConfig } from '../../types' -/** 商品列表 */ -export async function fetchProducts() { - return http.get('/api/products', { auth: false }) +export interface ProductDto { + id: string + name: string + categoryId?: string + price: number + originalPrice?: number + leadTime: string + subtitle?: string + description?: string + story?: string + scene?: string + tags: string[] + specs: [string, string][] + tone: [number, number, number] + mask: MaskConfig + images: string[] + iconImg?: string + status: 'ON_SALE' + sort: number } -/** 商品详情 */ -export async function fetchProduct(id: string) { - return http.get(`/api/products/${id}`, { auth: false }) +export interface CategoryDto { + id: string + name: string + parentId?: string | null + sort: number } -/** 分类列表 */ -export async function fetchCategories() { - return http.get('/api/categories', { auth: false }) +export interface ProductListParams { + page?: number + pageSize?: number + categoryId?: string + keyword?: string +} + +export interface ProductListResult { + list: ProductDto[] + total: number + page: number + pageSize: number +} + +function toNumber(value: number | string | undefined): number | undefined { + if (value === undefined) return undefined + const numberValue = Number(value) + return Number.isFinite(numberValue) ? numberValue : undefined +} + +function normalizeProduct(product: ProductDto): ProductDto { + const originalPrice = toNumber(product.originalPrice) + return { + ...product, + price: toNumber(product.price) ?? 0, + ...(originalPrice !== undefined ? { originalPrice } : {}), + tags: product.tags || [], + specs: product.specs || [], + tone: product.tone || [28, 22, 18], + images: product.images || [], + } +} + +/** 在售商品分页列表;公共接口,不携带登录 token。 */ +export async function fetchProducts(params: ProductListParams = {}): Promise { + const query = Object.entries(params) + .filter(([, value]) => value !== undefined && value !== '') + .map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`) + .join('&') + const result = await http.get(`/api/products${query ? `?${query}` : ''}`, { auth: false }) + return { ...result, list: (result.list || []).map(normalizeProduct) } +} + +/** 单个在售商品;不存在或下架时后端返回 404。 */ +export async function fetchProduct(id: string): Promise { + const product = await http.get(`/api/products/${encodeURIComponent(id)}`, { auth: false }) + return normalizeProduct(product) +} + +export async function fetchCategories(): Promise { + return http.get('/api/categories', { auth: false }) } diff --git a/src/utils/productAdapter.ts b/src/utils/productAdapter.ts new file mode 100644 index 0000000..213ea5f --- /dev/null +++ b/src/utils/productAdapter.ts @@ -0,0 +1,31 @@ +import type { ProductCategory } from '../types' +import type { ProductDto } from './api/product' + +/** + * 将商品目录接口数据适配为现有 DIY/设计清单仍在使用的商品模型。 + * 页面只从接口读取商品;本适配层避免把后端字段差异散落到各个页面。 + */ +export function toProductCategory(product: ProductDto): ProductCategory { + return { + id: product.id, + name: product.name, + desc: product.subtitle || product.description || '', + icon: product.iconImg || '', + iconImg: product.iconImg, + price: product.price, + originalPrice: product.originalPrice, + leadTime: product.leadTime, + description: product.description || product.subtitle || '', + subtitle: product.subtitle, + tone: product.tone, + story: product.story, + scene: product.scene, + tags: product.tags, + specs: product.specs, + mask: product.mask, + images: product.images, + status: product.status, + sort: product.sort, + categoryId: product.categoryId, + } +} diff --git a/src/utils/request.ts b/src/utils/request.ts index daa2a3c..61b6ede 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -1,11 +1,16 @@ import Taro from '@tarojs/taro' +declare const __API_BASE_URL__: string | undefined + /** * 后端接口请求封装 * 后端统一响应:{ code, message, data },code === 0 表示成功 * token 通过 Authorization: Bearer 传入 */ -export const BASE_URL = 'https://wxbackend.tokenleaping.com' +/** 由 Taro 构建时从 .env 注入;本机联调可设为 http://127.0.0.1:3090。 */ +export const BASE_URL = typeof __API_BASE_URL__ !== 'undefined' + ? __API_BASE_URL__ + : 'https://wxbackend.tokenleaping.com' const TOKEN_KEY = 'smart_access_token'