From eea6c3feefbbce29f2a42777a9ce8aaa9efc6074 Mon Sep 17 00:00:00 2001 From: lhmin0604 Date: Sat, 12 Sep 2026 19:07:07 +0800 Subject: [PATCH] =?UTF-8?q?fix(diy):=20=E8=8D=89=E7=A8=BF=E6=8C=81?= =?UTF-8?q?=E4=B9=85=E5=8C=96=20+=20=E8=BF=9B=E5=85=A5=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E5=8F=B0=E5=8D=B3=E8=AE=BE=E8=AE=A1=E4=B8=AD=20+=20=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E9=A1=B5=E7=A9=BA=E6=80=81=E5=85=9C=E5=BA=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修正工作流批次①(问题 2+3+4): - 问题2: 贴纸变化防抖 800ms 落缓存+服务端静默同步, useDidHide/卸载前强制 flush;中途退出不再丢布局 - 问题3: 进入工作台(新建/继续)即 PATCH designing(SUBMITTED), 取代原「确认完成才提交」触发点 - 问题4: 草稿实时写缓存后贴纸编辑页始终能读到 stickers; 另加 notFound 空态(未找到贴纸提示 + 返回工作台), handleEditSticker 跳转前 flushDraft 关闭防抖竞态窗口 Co-Authored-By: Claude --- 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/diy/stickerEdit/index.wxss | 2 +- dist/pages/product/index.js | 2 +- src/pages/diy/index.tsx | 65 +++++++++++++++++++++++++-- src/pages/diy/stickerEdit/index.scss | 27 +++++++++++ src/pages/diy/stickerEdit/index.tsx | 27 +++++++++++ 10 files changed, 123 insertions(+), 10 deletions(-) diff --git a/dist/common.js b/dist/common.js index d00f353..f764140 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 i}});var r=e(118),o=e(4848);function i(n){var t=n.children,e=n.className,i=n.style;return(0,o.jsx)(r.Ss,{className:"bottom-action-bar ".concat(e||""),style:i,children:t})}},7723:function(n,t,e){e.d(t,{A:function(){return d}});var r=e(5544),o=e(758),i=e.n(o),c=e(6540),u=e(118),a=e(6764),s=e(9703),l=e(8199),f=e(4848);function d(n){var t=(0,c.useState)("checking"),e=(0,r.A)(t,2),o=e[0],d=e[1],g=(0,c.useCallback)(function(){var n=!1;return(0,a.d)().then(function(t){n||d(t?"ok":"denied")}).catch(function(){n||d("denied")}),function(){n=!0}},[]);return(0,c.useEffect)(function(){var n=g(),t=function(){g()},e=function(){g()};return i().eventCenter.on("tabBarChange",t),i().eventCenter.on(s.Wo,e),i().eventCenter.on("authStateChanged",t),function(){n(),i().eventCenter.off("tabBarChange",t),i().eventCenter.off(s.Wo,e),i().eventCenter.off("authStateChanged",t)}},[g]),"checking"===o?(0,f.jsx)(u.Ss,{className:"login-guard",children:(0,f.jsxs)(u.Ss,{className:"login-guard-inner",children:[(0,f.jsx)(u._V,{className:"login-guard-icon",src:(0,l.uq)("/icon/\u8bbe\u7f6e.png"),mode:"aspectFit"}),(0,f.jsx)(u.EY,{className:"login-guard-title",children:"\u6821\u9a8c\u767b\u5f55\u72b6\u6001"})]})}):"denied"===o?(0,f.jsx)(u.Ss,{className:"login-guard",children:(0,f.jsxs)(u.Ss,{className:"login-guard-inner",children:[(0,f.jsx)(u._V,{className:"login-guard-icon",src:(0,l.uq)("/icon/\u4e2a\u4eba.png"),mode:"aspectFit"}),(0,f.jsx)(u.EY,{className:"login-guard-title",children:"\u8bf7\u5148\u767b\u5f55"}),(0,f.jsx)(u.EY,{className:"login-guard-desc",children:"\u767b\u5f55\u540e\u67e5\u770b\u60a8\u7684\u4e13\u5c5e\u5185\u5bb9"}),(0,f.jsx)(u.Ss,{className:"btn-primary login-guard-btn",onTap:function(){return i().switchTab({url:"/pages/profile/index"})},children:(0,f.jsx)(u.EY,{children:"\u53bb\u767b\u5f55"})})]})}):n.children}},3053:function(n,t,e){e.d(t,{A:function(){return d}});var r=e(5544),o=e(118),i=e(758),c=e.n(i),u=e(6540),a=e(9201);function s(n){var t=n.viewportBottom,e=n.scrollTop,r=n.statusBarHeight,o=Number.isFinite(t)?t:0,i=Number.isFinite(e)?e:0,c=Number.isFinite(r)?r:0;return Math.max(0,o+i-c-8)}function l(n){var t=n.scrollTop,e=n.startY,r=n.rangeY,o=Number.isFinite(t)?t:0,i=Math.max(0,Number.isFinite(e)?e:0),c=Math.max(1,Number.isFinite(r)?r:1);return o<=i?0:Math.min(1,(o-i)/c)}var f=e(4848);function d(n){var t=n.title,e=n.targetSelector,i=void 0===e?".page-header":e,d=n.showBack,g=void 0!==d&&d,h=(0,a.c)(),p=(0,u.useState)(0),m=(0,r.A)(p,2),v=m[0],y=m[1],S=(0,u.useMemo)(function(){return{startY:Math.max(0,h.headerPaddingTop-h.statusBarHeight),rangeY:Math.max(48,.45*h.headerPaddingTop)}},[h.headerPaddingTop,h.statusBarHeight]),k=(0,u.useRef)(S),b=(0,u.useRef)(null),A=(0,u.useRef)(0),w=(0,u.useCallback)(function(n){A.current=n,null===b.current&&(b.current=setTimeout(function(){b.current=null;var n=k.current,t=n.startY,e=n.rangeY;y(l({scrollTop:A.current,startY:t,rangeY:e}))},16))},[]);return(0,u.useEffect)(function(){var n=!1,t=null;k.current=S;var e=function(){n||c().createSelectorQuery().select(i).boundingClientRect(function(t){if(!n){if(!t||Array.isArray(t)||"number"!==typeof t.bottom||"number"!==typeof t.height)return k.current=S,void w(A.current);var e=s({viewportBottom:t.bottom,scrollTop:A.current,statusBarHeight:h.statusBarHeight}),r=Math.max(32,.7*t.height);k.current={startY:e,rangeY:r},w(A.current)}}).exec()};return c().nextTick(function(){n||(t=setTimeout(e,80))}),function(){n=!0,null!==t&&clearTimeout(t),null!==b.current&&clearTimeout(b.current),b.current=null}},[w,S,i]),c().usePageScroll(function(n){w(n.scrollTop)}),(0,f.jsxs)(o.Ss,{className:"scroll-top-mask",style:{height:"".concat(Math.max(h.menuButtonTop+h.menuButtonHeight+18,h.statusBarHeight+52)+24,"px"),opacity:v},children:[(0,f.jsx)(o.Ss,{className:"scroll-top-blur scroll-top-blur-mid"}),(0,f.jsx)(o.Ss,{className:"scroll-top-blur scroll-top-blur-soft"}),(0,f.jsx)(o.Ss,{className:"scroll-top-gradient"}),g&&(0,f.jsx)(o.Ss,{className:"scroll-top-back",style:{top:"".concat(h.menuButtonTop,"px")},onTap:function(){return c().navigateBack()},children:(0,f.jsx)(o.EY,{className:"scroll-top-back-arrow",children:"\u2190"})}),(0,f.jsx)(o.EY,{className:"scroll-top-title",style:{top:"calc(".concat(h.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 c}});var r=e(118),o=e(9703),i=e(4848);function c(n){var t=n.darkTop,e=void 0!==t&&t,c=(0,o.wR)(),u=c.resolvedTheme,a="dark"===u||e,s=a?"#191919":"#faf7f2",l=a?"#ffffff":"#000000";return(0,i.jsx)(r.tf,{backgroundColor:s,backgroundColorTop:s,backgroundColorBottom:s,backgroundTextStyle:a?"light":"dark",rootBackgroundColor:s,children:(0,i.jsx)(r.yk,{frontColor:l,backgroundColor:s})})}},9703:function(n,t,e){e.d(t,{NP:function(){return g},Wo:function(){return d},wR:function(){return h}});var r=e(5544),o=e(6540),i=e(758),c=e.n(i),u=e(118),a=e(1457),s=e(6606),l=e(4848),f=(0,o.createContext)({theme:"auto",resolvedTheme:"light",toggleTheme:function(){},setTheme:function(){}}),d="themeChange";function g(n){var t=n.children,e=(0,o.useState)((0,a.O4)()),g=(0,r.A)(e,2),h=g[0],p=g[1],m=(0,o.useState)((0,a.eW)((0,a.O4)())),v=(0,r.A)(m,2),y=v[0],S=v[1],k=(0,o.useRef)(null),b=(0,o.useCallback)(function(n){S((0,a.eW)(n))},[]),A=(0,o.useCallback)(function(n){(0,a.Rq)(n),k.current=n,"auto"===(0,a.O4)()&&S(n)},[]),w=(0,o.useCallback)(function(){try{var n=c().getAppBaseInfo();A("dark"===n.theme?"dark":"light")}catch(n){}try{c().createSelectorQuery().select(".system-theme-detector").fields({computedStyle:["opacity"]}).exec(function(n){var t=n&&n[0]&&n[0].computedStyle&&n[0].computedStyle.opacity;A("1"===t?"dark":"light")})}catch(n){}},[A]),T=(0,o.useCallback)(function(n){(0,a.F0)(n),p(n),"auto"===n?w():b(n)},[w,b]),C=(0,o.useCallback)(function(){var n="light"===y?"dark":"light";T(n)},[y,T]);return(0,o.useEffect)(function(){w()},[w]),(0,o.useEffect)(function(){var n,t=function(n){!n||"dark"!==n.theme&&"light"!==n.theme||A(n.theme)},e=c();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)}},[A]),(0,o.useEffect)(function(){if("auto"===h){var n=setInterval(function(){try{var n=c().getAppBaseInfo(),t="dark"===n.theme?"dark":"light";t!==k.current&&A(t)}catch(n){}},2e3);return function(){return clearInterval(n)}}},[h,A]),(0,o.useEffect)(function(){c().eventCenter.trigger(d,y)},[y]),(0,o.useEffect)(function(){(0,s.G)(y)},[y]),(0,i.useDidShow)(function(){"auto"===h&&w()}),(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(u.Ss,{className:"system-theme-detector"}),(0,l.jsx)(f.Provider,{value:{theme:h,resolvedTheme:y,toggleTheme:C,setTheme:T},children:t})]})}function h(){return(0,o.useContext)(f)}},9201:function(n,t,e){e.d(t,{c:function(){return a}});var r=e(5544),o=e(6540),i=e(758),c=e.n(i),u=null;function a(){var n=(0,o.useState)(null!==u&&void 0!==u?u:{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],i=t[1];return(0,o.useEffect)(function(){if(u)i(u);else try{var n,t,e,r,o,a,s,l,f=c().getSystemInfoSync(),d=c().getMenuButtonBoundingClientRect(),g=f.statusBarHeight||20,h=null!==(n=d.top)&&void 0!==n?n:g+4,p=null!==(t=d.height)&&void 0!==t?t:32,m=null!==(e=d.right)&&void 0!==e?e:f.windowWidth-7,v=null!==(r=null===(o=f.safeArea)||void 0===o?void 0:o.top)&&void 0!==r?r:g,y=null!==(a=f.safeAreaInsetBottom)&&void 0!==a?a:f.screenHeight-(null!==(s=null===(l=f.safeArea)||void 0===l?void 0:l.bottom)&&void 0!==s?s:f.screenHeight),S=Math.max(h+p+6,g+44),k=Math.max(g,h-4),b={statusBarHeight:g,menuButtonTop:h,menuButtonHeight:p,capsuleRight:m,safeInsetTop:v,safeInsetBottom:y,headerPaddingTop:S,backBtnPaddingTop:k};u=b,i(b)}catch(n){}},[]),e}},5414:function(n,t,e){e.d(t,{l:function(){return u}});var r=e(6540),o=e(758),i=e.n(o),c=e(6606);function u(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=t.mode,u=void 0===e?"auto":e,a=(0,r.useCallback)(function(){var t="dark"===u||"auto"===u&&"light"===n,e=t?"#000000":"#ffffff",r=t?"#faf7f2":"#191919";i().setNavigationBarColor({frontColor:e,backgroundColor:r}),(0,c.G)(n,r)},[u,n]);(0,r.useEffect)(a,[a]),(0,o.useDidShow)(a)}},6845:function(n,t,e){e.d(t,{l8:function(){return w},jp:function(){return f},gf:function(){return i.gf},xZ:function(){return T},iD:function(){return c},ri:function(){return a},x5:function(){return B},W$:function(){return A},r7:function(){return s}});var r=e(1212),o=e(467),i=e(3246);function c(n){return u.apply(this,arguments)}function u(){return u=(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,i.Ay.post("/api/auth/login",{code:t},{auth:!1});case 1:return e=n.v,null!==e&&void 0!==e&&e.accessToken&&(0,i.WG)(e.accessToken),n.a(2,e)}},n)})),u.apply(this,arguments)}function a(){(0,i.L)()}function s(n){return l.apply(this,arguments)}function l(){return l=(0,o.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,i.Ay.patch("/api/users/me",t))}},n)})),l.apply(this,arguments)}function f(){return d.apply(this,arguments)}function d(){return d=(0,o.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,i.Ay.get("/api/users/me"))}},n)})),d.apply(this,arguments)}var g=e(4765),h=e(9379),p=e(758),m=e.n(p);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,o,c){var u,a;return(0,r.A)().w(function(n){while(1)switch(n.p=n.n){case 0:return n.n=1,m().uploadFile({url:"".concat(i.C1).concat(t),filePath:e,name:o,formData:c,header:{Authorization:"Bearer ".concat((0,i.gf)())}});case 1:u=n.v,n.p=2,a=JSON.parse(u.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]])})),y.apply(this,arguments)}function S(n){return i.Ay.get("/api/upload/credentials?key=".concat(encodeURIComponent(n)))}function k(n,t){return b.apply(this,arguments)}function b(){return b=(0,o.A)((0,r.A)().m(function n(t,e){var o,i;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 o=m().getFileSystemManager(),i=o.readFileSync(t),n.n=2,m().request({url:e.presignedUrl,method:"PUT",data:i,header:{"Content-Type":"application/octet-stream"}});case 2:return n.a(2,e.presignedUrl.split("?")[0])}},n)})),b.apply(this,arguments)}function A(n){return v("/api/sketch",n,"image")}function w(n,t,e){return v("/api/wordcloud/generate",n,"image",(0,h.A)({names:t},e?{params:JSON.stringify(e)}:{}))}function T(n){return i.Ay.get("/api/wordcloud/jobs/".concat(n))}function C(n){return!!n&&/^(wxfile:|http:\/\/tmp\/|tmp\/)/i.test(n)}function x(n){return _.apply(this,arguments)}function _(){return _=(0,o.A)((0,r.A)().m(function n(t){var e,o;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,S(e);case 1:return o=n.v,n.n=2,k(t,o);case 2:return n.a(2,n.v);case 3:return n.p=3,n.v,n.a(2,t)}},n,null,[[0,3]])})),_.apply(this,arguments)}function B(n){return j.apply(this,arguments)}function j(){return j=(0,o.A)((0,r.A)().m(function n(t){var e,o,i,c,u,a,s,l,f,d,p,m,v,y,S,k;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,h.A)({},t),!t.background||!C(t.background.src)){n.n=3;break}return a=h.A,s=(0,h.A)({},t.background),l={},n.n=2,x(t.background.src);case 2:f=n.v,e.background=a(s,l,{src:f});case 3:if(!t.stickers||!t.stickers.length){n.n=14;break}o=[],i=(0,g.A)(t.stickers),n.p=4,i.s();case 5:if((c=i.n()).done){n.n=10;break}if(u=c.value,d=o,!C(u.src)){n.n=7;break}return m=h.A,v=(0,h.A)({},u),y={},n.n=6,x(u.src);case 6:S=n.v,p=m(v,y,{src:S}),n.n=8;break;case 7:p=u;case 8:d.push.call(d,p);case 9:n.n=5;break;case 10:n.n=12;break;case 11:n.p=11,k=n.v,i.e(k);case 12:return n.p=12,i.f(),n.f(12);case 13:e.stickers=o;case 14:return n.a(2,e)}},n,null,[[4,11,12,13]])})),j.apply(this,arguments)}},8199:function(n,t,e){e.d(t,{uq:function(){return o}});var r="";function o(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 h}});var r=e(1212),o=e(467),i=e(2284),c=e(758),u=e.n(c),a=e(6845),s=e(1457),l="smart_auth_verified",f=18e5,d=null,g=null;function h(){d=null,g=null;try{u().removeStorageSync(l)}catch(n){}}function p(n){var t=d||function(){try{var n=u().getStorageSync(l);return n&&"object"===(0,i.A)(n)?n:null}catch(n){return null}}();return t&&t.openid===n?Date.now()-t.at>f?null:(d=t,t.ok):null}function m(n,t){var e={openid:n,ok:t,at:Date.now()};d=e;try{u().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 S.apply(this,arguments)}function S(){return S=(0,o.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)(),h(),n.a(2,!1);case 2:if(e=p(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 g||(g=(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)(),h(),!1)}).catch(function(n){return console.error("[AuthGuard] getMe \u5931\u8d25\uff0c\u8d70\u672c\u5730\u4f1a\u8bdd\u515c\u5e95:",n),v()}).finally(function(){g=null})),n.a(2,g)}},n)})),S.apply(this,arguments)}},5234:function(n,t,e){e.d(t,{QE:function(){return l},R6:function(){return u},rj:function(){return s},y9:function(){return a},zv:function(){return c}});var r=e(9379),o=e(8199),i=[{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}}],c=i.map(function(n){return(0,r.A)((0,r.A)({},n),{},{images:(n.images||[]).map(function(n){return(0,o.uq)(n)}),iconImg:(0,o.uq)(n.iconImg)})}),u=c,a=function(n){return c.find(function(t){return t.id===n})},s={"notebook-small":(0,o.uq)("/icon/\u4e66\u672c.png"),"notebook-large":(0,o.uq)("/icon/\u4e66\u672c_\u5927.png"),coaster:(0,o.uq)("/icon/\u676f\u5b50.png"),penbox:(0,o.uq)("/icon/\u7b14\u76d2.png"),booklamp:(0,o.uq)("/icon/\u4e66\u706f.png")};function l(n){return null!==n&&void 0!==n&&n.iconImg?(0,o.uq)(n.iconImg):null!==n&&void 0!==n&&n.id?(0,o.uq)(s[n.id]||"/icon/\u56db\u89d2\u661f.svg"):(0,o.uq)("/icon/\u56db\u89d2\u661f.svg")}},3246:function(n,t,e){e.d(t,{C1:function(){return a},L:function(){return g},Sy:function(){return l},WG:function(){return d},gf:function(){return f},q:function(){return m}});var r=e(1212),o=e(9379),i=e(467),c=e(758),u=e.n(c),a="https://wxbackend.tokenleaping.com",s="smart_access_token";function l(){try{u().hideLoading()}catch(n){}}function f(){try{return u().getStorageSync(s)||""}catch(n){return""}}function d(n){u().setStorageSync(s,n)}function g(){try{u().removeStorageSync(s)}catch(n){}}var h=null;var p=null;function m(n){p=n}function v(n,t,e,r){return y.apply(this,arguments)}function y(){return y=(0,i.A)((0,r.A)().m(function n(t,e,o,i){return(0,r.A)().w(function(n){while(1)switch(n.n){case 0:return n.a(2,u().request({url:"".concat(a).concat(t),method:e,data:o,header:i}))}},n)})),y.apply(this,arguments)}function S(n){return k.apply(this,arguments)}function k(){return k=(0,i.A)((0,r.A)().m(function n(t){var e,i,c,u,a,s,l,d,m,y,S,k,b,A,w,T,C,x,_=arguments;return(0,r.A)().w(function(n){while(1)switch(n.p=n.n){case 0:return e=_.length>1&&void 0!==_[1]?_[1]:{},i=e.method,c=void 0===i?"GET":i,u=e.data,a=e.headers,s=void 0===a?{}:a,l=e.auth,d=void 0===l||l,m=e.skipAuthRefresh,y=void 0!==m&&m,S=function(){var n=f();return(0,o.A)((0,o.A)({"Content-Type":"application/json"},d&&n?{Authorization:"Bearer ".concat(n)}:{}),s)},n.p=1,n.n=2,v(t,c,u,S());case 2:k=n.v,n.n=4;break;case 3:throw n.p=3,n.v,b=new Error("\u7f51\u7edc\u5f02\u5e38\uff0c\u8bf7\u7a0d\u540e\u91cd\u8bd5"),b.statusCode=-1,b;case 4:if(401!==k.statusCode||y||!p){n.n=9;break}return n.n=5,p();case 5:if(A=n.v,!A){n.n=9;break}return n.p=6,n.n=7,v(t,c,u,S());case 7:k=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!==k.statusCode){n.n=10;break}throw g(),null===(T=h)||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=k.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]])})),k.apply(this,arguments)}var b={get:function(n,t){return S(n,(0,o.A)((0,o.A)({},t),{},{method:"GET"}))},post:function(n,t,e){return S(n,(0,o.A)((0,o.A)({},e),{},{method:"POST",data:t}))},put:function(n,t,e){return S(n,(0,o.A)((0,o.A)({},e),{},{method:"PUT",data:t}))},patch:function(n,t,e){return S(n,(0,o.A)((0,o.A)({},e),{},{method:"PATCH",data:t}))},del:function(n,t){return S(n,(0,o.A)((0,o.A)({},t),{},{method:"DELETE"}))}};t.Ay=b},1457:function(n,t,e){e.d(t,{E1:function(){return O},cY:function(){return S},Hf:function(){return P},kg:function(){return H},ab:function(){return Q},hG:function(){return F},IU:function(){return C},Re:function(){return U},EB:function(){return z},p_:function(){return v},n7:function(){return w},O4:function(){return V},ug:function(){return q},Q4:function(){return I},Ic:function(){return u},Q1:function(){return M},kh:function(){return b},eW:function(){return X},Fu:function(){return y},Rq:function(){return K},F0:function(){return Z},iA:function(){return R},iZ:function(){return Y},yU:function(){return L},i5:function(){return k},uF:function(){return G}});var r=e(758),o=e.n(r),i="smart_user_info",c="smart_active_openid";function u(n){return!!n&&(n.startsWith("mock_")||n.startsWith("mock-"))}function a(){var n,t=null;try{t=o().getStorageSync(i)}catch(n){t=null}var e=(null===(n=t)||void 0===n?void 0:n.openid)||o().getStorageSync(c)||"_guest_";return o().setStorageSync(c,e),e}function s(n){var t=a();return"".concat(n,"_").concat(t)}function l(n,t){return"".concat(n,"_").concat(t)}var f=e(6764),d=e(9379),g=e(436),h=e(8199),p=e(5234);function m(n){try{return o().getStorageSync(l("design_list",n))||[]}catch(n){return[]}}function v(){try{return o().getStorageSync(s("design_list"))||[]}catch(n){return[]}}function y(n){o().setStorageSync(s("design_list"),n)}function S(n,t){var e=v(),r=(0,h.uq)((null===n||void 0===n?void 0:n.iconImg)||p.rj[null===n||void 0===n?void 0:n.id]||"/icon/\u56db\u89d2\u661f.svg"),o={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,g.A)(e),[o])),o}function k(n,t){var e=v(),r=e.findIndex(function(t){return t.id===n});-1!==r&&(e[r]=(0,d.A)((0,d.A)({},e[r]),t),y(e))}function b(n){var t=v().filter(function(t){return!n.includes(t.id)});y(t)}function A(n){try{return o().getStorageSync(l("order_list",n))||[]}catch(n){return[]}}function w(){try{return o().getStorageSync(s("order_list"))||[]}catch(n){return[]}}function T(n){o().setStorageSync(s("order_list"),n)}function C(n){var t,e=v(),r=w(),o=e.find(function(t){return t.id===n});if(!o)return null;var i=null!==(t=o.productIcon)&&void 0!==t&&t.startsWith("/icon/")||/^https?:/i.test(o.productIcon||"")?o.productIcon:p.rj[o.productId]||"/icon/\u56db\u89d2\u661f.svg",c=(0,h.uq)(i),u={id:"ORD"+Date.now().toString().slice(-9),productName:o.productName,productIcon:c,statusCode:"pending",date:(new Date).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).replace(/\//g,"-"),price:"\xa5"+(o.unitPrice*o.count).toFixed(2),count:o.count,sku:"".concat(o.productName," \xd7 ").concat(o.count)},a=e.findIndex(function(t){return t.id===n});return-1!==a&&(e[a].status="ordered",e[a].orderId=u.id),y(e),T([u].concat((0,g.A)(r))),u}var x="smart_user_registry",_="zhihui2024";function B(){try{return o().getStorageSync(x)||[]}catch(n){return[]}}function j(n){var t=B();t.includes(n)||(t.push(n),o().setStorageSync(x,t))}function N(n){var t=B().filter(function(t){return t!==n});o().setStorageSync(x,t)}function I(){try{return o().getStorageSync(i)}catch(n){return null}}function E(n){var t;o().setStorageSync(i,n),null!==n&&void 0!==n&&n.openid&&(o().setStorageSync(c,n.openid),o().setStorageSync("user_info_".concat(n.openid),n),j(n.openid)),(0,f.m)(),null===(t=o().eventCenter)||void 0===t||t.trigger("authStateChanged",{openid:(null===n||void 0===n?void 0:n.openid)||""})}function D(n){try{var t=o().getStorageSync("user_info_".concat(n));if(t)return t}catch(n){}var e=I();return(null===e||void 0===e?void 0:e.openid)===n?e:null}function P(){var n;o().removeStorageSync(i),o().removeStorageSync(c),(0,f.m)(),null===(n=o().eventCenter)||void 0===n||n.trigger("authStateChanged",{openid:""})}function R(n){E(n)}function q(){return I()}function M(){var n=B();return n.map(function(n){var t=D(n),e=m(n),r=A(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 H(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 E(r),r}function Y(n){var t=D(n);return!!t&&(o().setStorageSync(i,t),o().setStorageSync(c,n),!0)}function F(n){o().removeStorageSync("user_info_".concat(n)),o().removeStorageSync("design_list_".concat(n)),o().removeStorageSync("order_list_".concat(n)),o().removeStorageSync("address_list_".concat(n)),N(n);var t=I();(null===t||void 0===t?void 0:t.openid)===n&&P()}function G(n){return n===_}function U(){try{return o().getStorageSync(s("address_list"))||[]}catch(n){return[]}}function W(n){o().setStorageSync(s("address_list"),n)}function O(n){var t=U(),e=(0,d.A)((0,d.A)({},n),{},{id:"ADR"+Date.now()});return e.isDefault&&t.forEach(function(n){n.isDefault=!1}),W([e].concat((0,g.A)(t))),e}function L(n,t){var e=U(),r=e.findIndex(function(t){return t.id===n});-1!==r&&(t.isDefault&&e.forEach(function(n){n.isDefault=!1}),e[r]=(0,d.A)((0,d.A)({},e[r]),t),W(e))}function Q(n){var t=U().filter(function(t){return t.id!==n});W(t)}function z(){return U().find(function(n){return n.isDefault})}var J="smart_theme";function V(){try{return o().getStorageSync(J)||"auto"}catch(n){return"auto"}}function Z(n){o().setStorageSync(J,n)}var $=null;function K(n){$=n}function X(n){if("auto"===n){if($)return $;try{var t=o().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 c}});var r=e(758),o=e.n(r);function i(n){return"dark"===n?"#191919":"#faf7f2"}function c(n,t){var e=null!==t&&void 0!==t?t:i(n);o().setBackgroundColor({backgroundColor:e,backgroundColorTop:e,backgroundColorBottom:e}),o().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)}},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 diff --git a/dist/pages/address/index.js b/dist/pages/address/index.js index d88919c..4bc7d70 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),r=a(758),l=a.n(r),i=a(6540),o=a(1457),d=a(9703),u=a(9201),m=a(5414),h=a(9674),p=a(3053),x=a(9513),j=a(8199),f=a(4848);function N(){var e=(0,d.wR)(),s=(e.theme,e.resolvedTheme),a=(0,u.c)();(0,m.l)(s);var n=(0,i.useState)([]),r=(0,c.A)(n,2),N=r[0],S=r[1],g=(0,i.useState)(null),v=(0,c.A)(g,2),E=v[0],Y=v[1],b=(0,i.useState)(!1),T=(0,c.A)(b,2),y=T[0],k=T[1],w=(0,i.useState)(""),A=(0,c.A)(w,2),B=A[0],C=A[1],D=(0,i.useState)(""),I=(0,c.A)(D,2),P=I[0],J=I[1],M=(0,i.useState)([]),O=(0,c.A)(M,2),R=O[0],q=O[1],F=(0,i.useState)(""),H=(0,c.A)(F,2),L=H[0],U=H[1],V=(0,i.useState)(!1),_=(0,c.A)(V,2),z=_[0],G=_[1],K=function(){return S((0,o.Re)())};(0,i.useEffect)(function(){K()},[]);var Q=function(){C(""),J(""),q([]),U(""),G(!1),Y(null)},W=function(){Q(),k(!0)},X=function(e){Y(e),C(e.name),J(e.phone),q(e.region),U(e.detail),G(e.isDefault),k(!0)},Z=function(e){l().showModal({title:"\u786e\u8ba4\u5220\u9664",content:"\u5220\u9664\u540e\u5c06\u65e0\u6cd5\u6062\u590d\u8be5\u5730\u5740",success:function(s){s.confirm&&((0,o.ab)(e),K())}})},$=function(e){var s="".concat(e.name," ").concat(e.phone,"\n").concat(e.region.join(" ")," ").concat(e.detail);l().setClipboardData({data:s})},ee=function(){if(B.trim()&&P.trim()&&0!==R.length&&L.trim()){var e={name:B,phone:P,region:R,detail:L,isDefault:z};E?(0,o.yU)(E.id,e):(0,o.E1)(e),l().showToast({title:"\u4fdd\u5b58\u6210\u529f",icon:"success"}),k(!1),Q(),K()}else l().showToast({title:"\u8bf7\u586b\u5199\u5b8c\u6574\u4fe1\u606f",icon:"none"})},se=function(e){q(e.detail.value||[])};return(0,f.jsxs)(t.Ss,{className:"theme-".concat(s),children:[(0,f.jsx)(h.A,{}),(0,f.jsx)(p.A,{title:"\u6536\u8d27\u5730\u5740",targetSelector:".page-header",showBack:!0}),(0,f.jsxs)(t.Ss,{className:"address-page",children:[(0,f.jsx)(t.Ss,{className:"page-header",style:{paddingTop:"".concat(a.statusBarHeight+12,"px")},children:(0,f.jsxs)(t.Ss,{className:"page-header-inner",children:[(0,f.jsx)(t.Ss,{className:"back-btn",onTap:function(){return l().navigateBack()},children:(0,f.jsx)(t.EY,{className:"back-arrow",children:"\u2190"})}),(0,f.jsx)(t.EY,{className:"nav-title",children:"\u6536\u8d27\u5730\u5740"}),(0,f.jsx)(t.Ss,{className:"nav-placeholder"})]})}),(0,f.jsxs)(t.Ss,{className:"address-list",children:[N.map(function(e){return(0,f.jsxs)(t.Ss,{className:"address-card surface-card",children:[(0,f.jsxs)(t.Ss,{className:"address-header",children:[(0,f.jsxs)(t.Ss,{className:"address-user",children:[(0,f.jsx)(t.EY,{className:"address-name",children:e.name}),(0,f.jsx)(t.EY,{className:"address-phone",children:e.phone}),e.isDefault&&(0,f.jsx)(t.Ss,{className:"default-tag",children:(0,f.jsx)(t.EY,{children:"\u9ed8\u8ba4"})})]}),(0,f.jsxs)(t.EY,{className:"address-full",children:[e.region.join(" ")," ",e.detail]})]}),(0,f.jsxs)(t.Ss,{className:"address-actions",children:[(0,f.jsx)(t.EY,{className:"address-act",onTap:function(){return X(e)},children:"\u7f16\u8f91"}),(0,f.jsx)(t.EY,{className:"address-act",onTap:function(){return $(e)},children:"\u590d\u5236"}),(0,f.jsx)(t.EY,{className:"address-act delete",onTap:function(){return Z(e.id)},children:"\u5220\u9664"})]})]},e.id)}),0===N.length&&(0,f.jsxs)(t.Ss,{className:"empty-state",children:[(0,f.jsx)(t._V,{className:"empty-icon-img",src:(0,j.uq)("/icon/\u5730\u5740.png"),mode:"aspectFit"}),(0,f.jsx)(t.EY,{className:"empty-text",children:"\u8fd8\u6ca1\u6709\u6536\u8d27\u5730\u5740"}),(0,f.jsx)(t.EY,{className:"empty-sub",children:"\u70b9\u51fb\u4e0b\u65b9\u6309\u94ae\u6dfb\u52a0\u65b0\u5730\u5740"})]})]}),(0,f.jsx)(t.Ss,{className:"safe-bottom-placeholder"}),(0,f.jsx)(x.A,{children:(0,f.jsx)(t.Ss,{className:"btn-primary",onTap:W,children:(0,f.jsx)(t.EY,{children:"\u65b0\u589e\u6536\u8d27\u5730\u5740"})})}),y&&(0,f.jsx)(t.Ss,{className:"modal-overlay",children:(0,f.jsxs)(t.Ss,{className:"modal-card surface-card address-form",children:[(0,f.jsx)(t.EY,{className:"modal-title",children:E?"\u7f16\u8f91\u5730\u5740":"\u65b0\u589e\u5730\u5740"}),(0,f.jsx)(t.pd,{className:"form-input",placeholder:"\u6536\u8d27\u4eba\u59d3\u540d",value:B,onInput:function(e){return C(e.detail.value)}}),(0,f.jsx)(t.pd,{className:"form-input",placeholder:"\u624b\u673a\u53f7\u7801",type:"number",value:P,onInput:function(e){return J(e.detail.value)}}),(0,f.jsx)(t.LC,{mode:"region",value:R,onChange:se,children:(0,f.jsx)(t.Ss,{className:"form-picker",children:(0,f.jsx)(t.EY,{className:R.length?"form-picker-val":"form-picker-ph",children:R.length?R.join(" / "):"\u9009\u62e9\u7701 / \u5e02 / \u533a"})})}),(0,f.jsx)(t.pd,{className:"form-input",placeholder:"\u8be6\u7ec6\u5730\u5740\uff1a\u8857\u9053\u3001\u95e8\u724c\u53f7",value:L,onInput:function(e){return U(e.detail.value)}}),(0,f.jsxs)(t.Ss,{className:"form-row",onTap:function(){return G(!z)},children:[(0,f.jsx)(t.EY,{className:"form-label",children:"\u8bbe\u4e3a\u9ed8\u8ba4\u5730\u5740"}),(0,f.jsx)(t.Ss,{className:"checkbox ".concat(z?"checked":"")})]}),(0,f.jsxs)(t.Ss,{className:"form-actions",children:[(0,f.jsx)(t.Ss,{className:"btn-secondary",onTap:function(){k(!1),Q()},children:(0,f.jsx)(t.EY,{children:"\u53d6\u6d88"})}),(0,f.jsx)(t.Ss,{className:"btn-primary",onTap:ee,children:(0,f.jsx)(t.EY,{children:"\u4fdd\u5b58"})})]})]})})]})]})}var S={navigationStyle:"custom",enablePageMeta:!0,navigationBarTitleText:"\u6536\u8d27\u5730\u5740"};Page((0,n.createPageConfig)(N,"pages/address/index",{root:{cn:[]}},S||{}))}},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(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 diff --git a/dist/pages/designList/index.js b/dist/pages/designList/index.js index 112d184..261960b 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),t=n(5544),c=n(118),i=n(758),l=n.n(i),r=n(6540),d=n(1457),o=n(5234),u=n(8199),h=n(9703),g=n(9201),m=n(5414),x=n(7723),p=n(9674),b=n(3053),j=n(4848),f=[{code:"all",label:"\u5168\u90e8"},{code:"toDesign",label:"\u5f85\u8bbe\u8ba1"},{code:"undesigned",label:"\u672a\u8bbe\u8ba1"},{code:"designing",label:"\u8bbe\u8ba1\u4e2d"},{code:"ordered",label:"\u5df2\u4e0b\u5355"}],S=f.filter(function(e){return"undesigned"!==e.code}),N={undesigned:{label:"\u672a\u8bbe\u8ba1",cls:"badge-pink"},designing:{label:"\u8bbe\u8ba1\u4e2d",cls:"badge-blue"},ordered:{label:"\u5df2\u4e0b\u5355",cls:"badge-green"}};function v(){var e=(0,h.wR)(),s=e.resolvedTheme,n=(0,g.c)();(0,m.l)(s);var a=(0,r.useState)("all"),i=(0,t.A)(a,2),v=i[0],w=i[1],y=(0,r.useState)([]),T=(0,t.A)(y,2),E=T[0],Y=T[1],k=(0,r.useState)(!1),A=(0,t.A)(k,2),z=A[0],I=A[1],P=(0,r.useState)(new Set),B=(0,t.A)(P,2),C=B[0],L=B[1],M=(0,r.useCallback)(function(){Y((0,d.p_)())},[]),F=(0,r.useCallback)(function(){var e=l().getStorageSync("designList:filter");e&&f.some(function(s){return s.code===e})&&(w(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(){F(),s&&s.apply(this)}}F()},[F]);var _="all"===v?E:"toDesign"===v?E.filter(function(e){return"undesigned"===e.status||"designing"===e.status}):E.filter(function(e){return e.status===v}),q=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"})},D=function(e){var s=new Set(C);s.has(e)?s.delete(e):s.add(e),L(s)},J=function(){C.size===_.length?L(new Set):L(new Set(_.map(function(e){return e.id})))},O=function(){0!==C.size&&l().showModal({title:"\u786e\u8ba4\u5220\u9664",content:"\u786e\u5b9a\u5220\u9664\u9009\u4e2d\u7684 ".concat(C.size," \u4e2a\u6761\u76ee\u5417\uff1f"),success:function(e){e.confirm&&((0,d.kh)(Array.from(C)),L(new Set),I(!1),M())}})},V=function(){z?(I(!1),L(new Set)):I(!0)};return(0,j.jsxs)(c.Ss,{className:"theme-".concat(s),children:[(0,j.jsx)(p.A,{}),(0,j.jsx)(b.A,{title:"\u6211\u7684\u8bbe\u8ba1\u6e05\u5355",targetSelector:".page-header.design-header"}),(0,j.jsx)(x.A,{children:(0,j.jsxs)(c.Ss,{className:"design-page",children:[(0,j.jsxs)(c.Ss,{className:"page-header design-header",style:{paddingTop:"".concat(n.statusBarHeight+12,"px")},children:[(0,j.jsx)(c.EY,{className:"header-title",children:"\u6211\u7684\u8bbe\u8ba1\u6e05\u5355"}),(0,j.jsx)(c.Ss,{className:"header-manage",onTap:V,children:(0,j.jsx)(c.EY,{children:z?"\u5b8c\u6210":"\u7ba1\u7406"})})]}),(0,j.jsx)(c.Ss,{className:"status-tabs",children:(0,j.jsx)(c.BM,{className:"tabs-scroll",scrollX:!0,children:S.map(function(e){return(0,j.jsx)(c.Ss,{className:"chip ".concat(v===e.code?"active":""),onTap:function(){return w(e.code)},children:(0,j.jsx)(c.EY,{className:"tab-label",children:e.label})},e.code)})})}),z&&(0,j.jsx)(c.Ss,{className:"batch-bar",children:(0,j.jsxs)(c.Ss,{className:"flex-between",style:{width:"100%"},children:[(0,j.jsxs)(c.Ss,{className:"batch-select-all",onTap:J,children:[(0,j.jsx)(c.Ss,{className:"batch-checkbox ".concat(C.size===_.length&&_.length>0?"checked":"")}),(0,j.jsxs)(c.EY,{className:"batch-text",children:["\u5168\u9009 (",C.size,"/",_.length,")"]})]}),(0,j.jsx)(c.Ss,{className:"batch-delete ".concat(C.size>0?"active":""),onTap:O,children:(0,j.jsx)(c.EY,{children:"\u5220\u9664"})})]})}),(0,j.jsxs)(c.BM,{className:"design-list",scrollY:!0,children:[_.map(function(e){var s=N[e.status],n=(e.productIcon||"").startsWith("/icon/")||/^https?:/i.test(e.productIcon||"")?e.productIcon:o.rj[e.productId]||"/icon/\u56db\u89d2\u661f.svg",a=(0,u.uq)(n),t=C.has(e.id);return(0,j.jsxs)(c.Ss,{className:"design-card ".concat(t?"selected":""),onTap:function(){return z?D(e.id):void 0},children:[(0,j.jsxs)(c.Ss,{className:"design-body",children:[z&&(0,j.jsx)(c.Ss,{className:"batch-checkbox ".concat(t?"checked":"")}),(0,j.jsx)(c._V,{className:"design-icon-img",src:a,mode:"aspectFit"}),(0,j.jsxs)(c.Ss,{className:"design-info",children:[(0,j.jsxs)(c.Ss,{className:"design-title-row",children:[(0,j.jsx)(c.EY,{className:"design-name",children:e.productName}),(0,j.jsx)(c.EY,{className:"badge ".concat(s.cls),children:s.label})]}),(0,j.jsxs)(c.EY,{className:"design-meta",children:["\u6570\u91cf: ",e.count," \u4ef6 | \u5355\u4ef7: \xa5",e.unitPrice]}),(0,j.jsxs)(c.EY,{className:"design-total",children:["\u5c0f\u8ba1: \xa5",(e.unitPrice*e.count).toFixed(2)]})]})]}),!z&&(0,j.jsxs)(c.Ss,{className:"design-actions",children:["ordered"!==e.status&&(0,j.jsx)(c.Ss,{className:"btn-primary design-btn",onTap:function(){return q(e)},children:(0,j.jsx)(c.EY,{children:"undesigned"===e.status?"\u5f00\u59cb\u8bbe\u8ba1":"\u7ee7\u7eed\u8bbe\u8ba1"})}),"ordered"===e.status&&(0,j.jsx)(c.Ss,{className:"btn-secondary design-btn",onTap:function(){return l().switchTab({url:"/pages/orders/index"})},children:(0,j.jsx)(c.EY,{children:"\u67e5\u770b\u8ba2\u5355"})})]})]},e.id)}),0===_.length&&(0,j.jsxs)(c.Ss,{className:"empty-state",children:[(0,j.jsx)(c._V,{className:"empty-icon-img",src:(0,u.uq)("/icon/\u8c03\u8272\u76d8.png"),mode:"aspectFit"}),(0,j.jsx)(c.EY,{className:"empty-text",children:"\u8fd8\u6ca1\u6709\u8bbe\u8ba1\u6e05\u5355"}),(0,j.jsx)(c.EY,{className:"empty-sub",children:"\u53bb\u9996\u9875\u901b\u901b\uff0c\u627e\u5230\u559c\u6b22\u7684\u5b9a\u5236\u54c1"}),(0,j.jsx)(c.Ss,{className:"btn-primary",onTap:function(){return l().switchTab({url:"/pages/index/index"})},children:(0,j.jsx)(c.EY,{children:"\u53bb\u901b\u901b"})})]})]})]})})]})}var w={navigationStyle:"custom",enablePageMeta:!0,navigationBarTitleText:"\u8bbe\u8ba1\u6e05\u5355"};Page((0,a.createPageConfig)(v,"pages/designList/index",{root:{cn:[]}},w||{}))}},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(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 diff --git a/dist/pages/diy/index.js b/dist/pages/diy/index.js index 988b8ed..ce37ea0 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,a,s){var t=s(7842),c=s(1212),n=s(467),i=s(9379),r=s(436),l=s(5544),o=s(118),d=s(758),u=s.n(d),h=s(6540),m=s(5234),p=s(1457),x=s(6845),g=s(9703),f=s(9201),v=s(5414),j=s(9674),N=s(3053),S=s(9513),y=s(4848);function w(){var e=(0,g.wR)(),a=(e.theme,e.resolvedTheme),s=(0,f.c)();(0,v.l)(a);var t=(0,h.useState)(null),d=(0,l.A)(t,2),w=d[0],b=d[1],k=(0,h.useState)(1),A=(0,l.A)(k,2),E=(A[0],A[1],(0,h.useState)("")),T=(0,l.A)(E,2),Y=T[0],D=T[1],I=(0,h.useState)(1),O=(0,l.A)(I,2),P=(O[0],O[1]),_=(0,h.useState)([]),F=(0,l.A)(_,2),M=F[0],B=F[1],R=(0,h.useState)(null),z=(0,l.A)(R,2),V=z[0],q=z[1],C=(0,h.useState)(!1),G=(0,l.A)(C,2),J=G[0],X=G[1],H=(0,h.useState)({x:0,y:0}),L=(0,l.A)(H,2),K=L[0],Q=L[1],U=(0,h.useState)(!1),W=(0,l.A)(U,2),Z=W[0],$=W[1],ee=(0,h.useState)(!1),ae=(0,l.A)(ee,2),se=ae[0],te=ae[1];(0,h.useEffect)(function(){var e=u().getCurrentInstance().router,a=e?e.params:void 0,s=a?a.source:void 0,t=a&&a.productId||a&&a.category;if("product"===s&&t){var c=(0,m.y9)(t);if(c){b(c),P(Number(a?a.quantity:void 0)||1);var n={id:"DSG"+Date.now(),productId:c.id,productName:c.name,productIcon:c.icon,unitPrice:c.price,count:Number(a?a.quantity:void 0)||1,status:"designing",createdAt:(new Date).toISOString().slice(0,10)},i=(0,p.p_)();(0,p.Fu)([].concat((0,r.A)(i),[n])),D(n.id)}}else if("designList"===s&&a&&a.designId){var l=a.designId,o=(0,p.p_)(),d=o.find(function(e){return e.id===l});if(d){D(l),P(d.count);var h=(0,m.y9)(d.productId);if(h&&b(h),d.designData?d.designData.stickers:void 0)B(d.designData.stickers);else if(d.designData?d.designData.imageSrc:void 0){var x={id:"legacy_"+Date.now(),src:d.designData.imageSrc,x:d.designData.imagePos&&d.designData.imagePos.x||0,y:d.designData.imagePos&&d.designData.imagePos.y||0,scale:d.designData.imagePos&&d.designData.imagePos.scale||1,width:200,height:200,isOverlapping:!1};B([x])}}}else if(t){var g=(0,m.y9)(t);if(g){b(g);var f={id:"DSG"+Date.now(),productId:g.id,productName:g.name,productIcon:g.icon,unitPrice:g.price,count:1,status:"designing",createdAt:(new Date).toISOString().slice(0,10)},v=(0,p.p_)();(0,p.Fu)([].concat((0,r.A)(v),[f])),D(f.id)}}},[]);var ce=function(e){for(var a=e.map(function(e){return(0,i.A)((0,i.A)({},e),{},{isOverlapping:!1})}),s=0;sn.x&&c.yn.y&&(a[s].isOverlapping=!0,a[t].isOverlapping=!0)}var u=a.some(function(e){return e.isOverlapping});return te(u),a},ne=function(){u().chooseImage({count:1,sizeType:["compressed"],sourceType:["album","camera"],success:function(e){var a=e.tempFilePaths[0];u().getImageInfo({src:a,success:function(e){var s={id:"stk_"+Date.now(),src:a,x:0,y:0,scale:1,width:e.width,height:e.height,isOverlapping:!1},t=[].concat((0,r.A)(M),[s]),c=ce(t);B(c),q(s.id)},fail:function(){var e={id:"stk_"+Date.now(),src:a,x:0,y:0,scale:1,width:200,height:200,isOverlapping:!1},s=[].concat((0,r.A)(M),[e]),t=ce(s);B(t),q(e.id)}})}})},ie=function(e){var a=M.filter(function(a){return a.id!==e}),s=ce(a);B(s),V===e&&q(null)},re=function(e,a){var s=e.touches[0],t=M.find(function(e){return e.id===a});t&&(q(a),X(!0),Q({x:s.clientX-t.x,y:s.clientY-t.y}))},le=function(e){if(J&&V){var a=e.touches[0],s=M.map(function(e){return e.id!==V?e:(0,i.A)((0,i.A)({},e),{},{x:a.clientX-K.x,y:a.clientY-K.y})}),t=ce(s);B(t)}},oe=function(){return X(!1)},de=function(){V&&Y&&u().navigateTo({url:"/pages/diy/stickerEdit/index?designId=".concat(Y,"&stickerId=").concat(V)})},ue=function(e,a){var s=M.map(function(s){return s.id!==e?s:(0,i.A)((0,i.A)({},s),{},{scale:Math.max(.3,Math.min(3,s.scale+a))})}),t=ce(s);B(t)},he=function(){u().navigateBack()},me=function(){if(!w)return{width:300,height:420};var e={width:w.mask.width,height:w.mask.height};return"rect"===w.mask.shape&&(e.borderRadius=w.mask.borderRadius||0),"circle"===w.mask.shape&&(e.borderRadius="50%"),e},pe=function(){var e=(0,n.A)((0,c.A)().m(function e(){var a;return(0,c.A)().w(function(e){while(1)switch(e.n){case 0:if(!se){e.n=1;break}return u().showToast({title:"\u8d34\u7eb8\u4e0d\u80fd\u91cd\u53e0",icon:"none"}),e.a(2);case 1:if(!Y){e.n=3;break}return e.n=2,(0,x.x5)({stickers:M,category:w,version:1});case 2:a=e.v,(0,p.i5)(Y,{designData:a});case 3:$(!1),u().navigateTo({url:"/pages/checkout/index?designId=".concat(Y)});case 4:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}(),xe=V?M.find(function(e){return e.id===V}):void 0,ge=xe?xe.scale:1;return w?(0,y.jsxs)(o.Ss,{className:"theme-".concat(a),children:[(0,y.jsx)(j.A,{}),(0,y.jsx)(N.A,{title:"\u8bbe\u8ba1\u5de5\u4f5c\u53f0",targetSelector:".page-header.surface-card",showBack:!0}),(0,y.jsxs)(o.Ss,{className:"diy-page",children:[(0,y.jsx)(o.Ss,{className:"page-header surface-card",style:{paddingTop:"".concat(s.statusBarHeight+12,"px")},children:(0,y.jsxs)(o.Ss,{className:"flex-between",style:{width:"100%"},children:[(0,y.jsx)(o.EY,{className:"back-btn",onTap:he,children:"\u2190"}),(0,y.jsx)(o.EY,{className:"page-title",children:"\u8bbe\u8ba1\u5de5\u4f5c\u53f0"}),(0,y.jsx)(o.Ss,{className:"header-spacer"})]})}),(0,y.jsx)(o.Ss,{className:"canvas-wrapper surface-card mt-20",catchMove:!0,children:(0,y.jsxs)(o.Ss,{className:"canvas-area",style:me(),children:[M.map(function(e){return(0,y.jsx)(o._V,{className:"canvas-image ".concat(e.isOverlapping?"overlap":""," ").concat(V===e.id?"active":""),src:e.src,style:{transform:"translate(".concat(e.x,"px, ").concat(e.y,"px) scale(").concat(e.scale,")"),opacity:J&&V===e.id?.8:1,zIndex:V===e.id?10:5,width:e.width||200,height:e.height||200},onTouchStart:function(a){return re(a,e.id)},onTouchMove:le,onTouchEnd:oe,onTap:function(){return q(e.id)},mode:"aspectFit"},e.id)}),(0,y.jsx)(o.Ss,{className:"mask-border",style:me()})]})}),(0,y.jsxs)(o.Ss,{className:"sticker-panel surface-card mt-20",children:[(0,y.jsx)(o.EY,{className:"section-title",children:"\u8d34\u7eb8"}),(0,y.jsxs)(o.Ss,{className:"sticker-list",children:[M.map(function(e){return(0,y.jsxs)(o.Ss,{className:"sticker-thumb ".concat(e.isOverlapping?"overlap":""," ").concat(V===e.id?"active":""),children:[(0,y.jsx)(o._V,{src:e.src,className:"sticker-thumb-img",mode:"aspectFit",onTap:function(){return q(e.id)}}),(0,y.jsx)(o.Ss,{className:"sticker-del",onTap:function(){return ie(e.id)},children:(0,y.jsx)(o.EY,{className:"del-icon",children:"\xd7"})})]},e.id)}),(0,y.jsxs)(o.Ss,{className:"sticker-add-btn",onTap:ne,children:[(0,y.jsx)(o.EY,{className:"add-icon",children:"+"}),(0,y.jsx)(o.EY,{className:"add-label",children:"\u6dfb\u52a0"})]})]}),se&&(0,y.jsx)(o.EY,{className:"overlap-hint",children:"\u6709\u8d34\u7eb8\u91cd\u53e0\uff0c\u8bf7\u8c03\u6574\u4f4d\u7f6e"})]}),V&&(0,y.jsxs)(o.Ss,{className:"toolbar surface-card mt-20",children:[(0,y.jsxs)(o.Ss,{className:"tool-row",children:[(0,y.jsx)(o.EY,{className:"tool-label",children:"\u7f29\u653e"}),(0,y.jsxs)(o.Ss,{className:"flex-center",style:{gap:"20px"},children:[(0,y.jsx)(o.Ss,{className:"tool-btn",onTap:function(){return ue(V,-.1)},children:"\uff0d"}),(0,y.jsxs)(o.EY,{className:"tool-value",children:[Math.round(100*ge),"%"]}),(0,y.jsx)(o.Ss,{className:"tool-btn",onTap:function(){return ue(V,.1)},children:"\uff0b"})]})]}),(0,y.jsxs)(o.Ss,{className:"tool-row",children:[(0,y.jsx)(o.EY,{className:"tool-label",children:"\u63d0\u793a"}),(0,y.jsx)(o.EY,{className:"tool-hint",children:"\u62d6\u52a8\u8c03\u6574\u4f4d\u7f6e\uff0c\u8d34\u7eb8\u4e0d\u53ef\u91cd\u53e0"})]})]}),(0,y.jsx)(o.Ss,{className:"edit-btn-bar mt-20",children:(0,y.jsx)(o.Ss,{className:"edit-btn ".concat(V?"active":"disabled"),onTap:de,children:(0,y.jsx)(o.EY,{children:"\u7f16\u8f91"})})}),(0,y.jsxs)(S.A,{children:[(0,y.jsx)(o.Ss,{className:"btn-primary",onTap:function(){return $(!0)},children:(0,y.jsx)(o.EY,{children:"\u9884\u89c8\u6548\u679c"})}),(0,y.jsx)(o.Ss,{className:"btn-secondary",onTap:ne,children:(0,y.jsx)(o.EY,{children:"\u6dfb\u52a0\u8d34\u7eb8"})})]}),Z&&(0,y.jsx)(o.Ss,{className:"preview-overlay",children:(0,y.jsxs)(o.Ss,{className:"preview-card surface-card",children:[(0,y.jsx)(o.EY,{className:"preview-title",children:"\u786e\u8ba4\u6548\u679c"}),(0,y.jsx)(o.Ss,{className:"preview-canvas",style:me(),children:M.map(function(e){return(0,y.jsx)(o._V,{className:"preview-image ".concat(e.isOverlapping?"overlap":""),src:e.src,style:{transform:"translate(".concat(e.x,"px, ").concat(e.y,"px) scale(").concat(e.scale,")"),width:e.width||200,height:e.height||200},mode:"aspectFit"},e.id)})}),(0,y.jsxs)(o.Ss,{className:"product-info",children:[(0,y.jsx)(o.EY,{className:"product-name",children:w.name}),(0,y.jsxs)(o.EY,{className:"product-size",children:["\u753b\u5e03\u5c3a\u5bf8: ",w.mask.width," \xd7 ",w.mask.height," px"]}),se&&(0,y.jsx)(o.EY,{className:"overlap-hint",children:"\u8d34\u7eb8\u6709\u91cd\u53e0\uff0c\u4e0d\u53ef\u63d0\u4ea4"})]}),(0,y.jsxs)(o.Ss,{className:"preview-actions",children:[(0,y.jsx)(o.Ss,{className:"btn-secondary",onTap:function(){return $(!1)},children:(0,y.jsx)(o.EY,{children:"\u8fd4\u56de\u4fee\u6539"})}),(0,y.jsx)(o.Ss,{className:"btn-primary ".concat(se?"disabled":""),onTap:pe,children:(0,y.jsx)(o.EY,{children:"\u786e\u8ba4\u5b8c\u6210"})})]})]})}),(0,y.jsx)(o.Ss,{className:"safe-bottom-placeholder"})]})]}):(0,y.jsxs)(o.Ss,{className:"theme-".concat(a),children:[(0,y.jsx)(j.A,{}),(0,y.jsx)(N.A,{title:"\u8bbe\u8ba1\u5de5\u4f5c\u53f0",targetSelector:".page-header.surface-card",showBack:!0}),(0,y.jsx)(o.Ss,{className:"diy-page",children:(0,y.jsx)(o.EY,{className:"page-title",children:"\u52a0\u8f7d\u4e2d..."})})]})}var b={navigationStyle:"custom",enablePageMeta:!0,navigationBarTitleText:"DIY\u5de5\u4f5c\u53f0"};Page((0,t.createPageConfig)(w,"pages/diy/index",{root:{cn:[]}},b||{}))}},function(e){var a=function(a){return e(e.s=a)};e.O(0,[907,96,76],function(){return a(8955)});e.O()}]); \ No newline at end of file +"use strict";(wx["webpackJsonp"]=wx["webpackJsonp"]||[]).push([[95],{8955:function(e,s,a){var t=a(7842),n=a(1212),i=a(467),c=a(9379),r=a(436),o=a(5544),d=a(118),l=a(758),u=a.n(l),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)(),s=(e.theme,e.resolvedTheme),a=(0,x.c)();(0,v.l)(s);var t=(0,h.useState)(null),l=(0,o.A)(t,2),w=l[0],k=l[1],A=(0,h.useState)(1),b=(0,o.A)(A,2),D=(b[0],b[1],(0,h.useState)("")),T=(0,o.A)(D,2),E=T[0],Y=T[1],I=(0,h.useState)(1),P=(0,o.A)(I,2),O=P[0],_=P[1],F=(0,h.useState)([]),R=(0,o.A)(F,2),M=R[0],B=R[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],se=(0,h.useState)(!1),ae=(0,o.A)(se,2),te=ae[0],ne=ae[1],ie=function(e,s){(0,g.x9)({productId:e.id,productName:e.name,unitPrice:e.price,count:s}).then(function(e){return(0,p.Fu)([e].concat((0,r.A)((0,p.p_)()))),Y(e.id),(0,g.i5)(e.id,{status:"designing"}).then(function(s){(0,p.Fu)((0,p.p_)().map(function(a){return a.id===e.id?(0,c.A)((0,c.A)({},a),{},{status:s.status}):a}))}).catch(function(){(0,p.Fu)((0,p.p_)().map(function(s){return s.id===e.id?(0,c.A)((0,c.A)({},s),{},{status:"designing"}):s}))})}).catch(function(){var a={id:"DSG"+Date.now(),productId:e.id,productName:e.name,productIcon:e.icon,unitPrice:e.price,count:s,status:"designing",createdAt:(new Date).toISOString().slice(0,10)};(0,p.Fu)([].concat((0,r.A)((0,p.p_)()),[a])),Y(a.id)})};(0,h.useEffect)(function(){var e=u().getCurrentInstance().router,s=e?e.params:void 0,a=s?s.source:void 0,t=s&&s.productId||s&&s.category;if("product"===a&&t){var n=(0,m.y9)(t);if(n){k(n);var i=Number(s?s.quantity:void 0)||1;_(i),ie(n,i)}}else if("designList"===a&&s&&s.designId){var c=s.designId,r=(0,p.p_)(),o=r.find(function(e){return e.id===c});if(o){Y(c),_(o.count);var d=(0,m.y9)(o.productId);if(d&&k(d),o.designData?o.designData.stickers:void 0)B(o.designData.stickers);else if(o.designData?o.designData.imageSrc:void 0){var l={id:"legacy_"+Date.now(),src:o.designData.imageSrc,x:o.designData.imagePos&&o.designData.imagePos.x||0,y:o.designData.imagePos&&o.designData.imagePos.y||0,scale:o.designData.imagePos&&o.designData.imagePos.scale||1,width:200,height:200,isOverlapping:!1};B([l])}"undesigned"===o.status&&((0,p.i5)(c,{status:"designing"}),(0,g.i5)(c,{status:"designing"}).catch(function(){}))}}else if(t){var h=(0,m.y9)(t);h&&(k(h),ie(h,1))}},[]);var ce=(0,h.useRef)(null),re=(0,h.useRef)({designId:"",quantity:1,category:null,stickers:[]});re.current={designId:E,quantity:O,category:w,stickers:M};var oe=function(){var e=re.current,s=e.designId,a=e.quantity,t=e.category,n=e.stickers;if(s&&t){var i=(0,p.p_)().find(function(e){return e.id===s}),r=(0,c.A)((0,c.A)({},i&&i.designData?i.designData:{}),{},{version:1,category:(0,c.A)({id:t.id,mask:t.mask},t.tone?{tone:t.tone}:{}),stickers:n});(0,p.i5)(s,{designData:r}),(0,g.i5)(s,{item:{productId:t.id,productName:t.name,unitPrice:t.price,count:a,designData:r}}).catch(function(){})}},de=function(){ce.current&&(clearTimeout(ce.current),ce.current=null),oe()};u().useDidHide(de),(0,h.useEffect)(function(){return de},[]);var le=(0,h.useRef)(!0);(0,h.useEffect)(function(){le.current?le.current=!1:(ce.current&&clearTimeout(ce.current),ce.current=setTimeout(oe,800))},[M]);var ue=function(e){for(var s=e.map(function(e){return(0,c.A)((0,c.A)({},e),{},{isOverlapping:!1})}),a=0;ai.x&&n.yi.y&&(s[a].isOverlapping=!0,s[t].isOverlapping=!0)}var u=s.some(function(e){return e.isOverlapping});return ne(u),s},he=function(){u().chooseImage({count:1,sizeType:["compressed"],sourceType:["album","camera"],success:function(e){var s=e.tempFilePaths[0];u().getImageInfo({src:s,success:function(e){var a={id:"stk_"+Date.now(),src:s,x:0,y:0,scale:1,width:e.width,height:e.height,isOverlapping:!1},t=[].concat((0,r.A)(M),[a]),n=ue(t);B(n),C(a.id)},fail:function(){var e={id:"stk_"+Date.now(),src:s,x:0,y:0,scale:1,width:200,height:200,isOverlapping:!1},a=[].concat((0,r.A)(M),[e]),t=ue(a);B(t),C(e.id)}})}})},me=function(e){var s=M.filter(function(s){return s.id!==e}),a=ue(s);B(a),V===e&&C(null)},pe=function(e,s){var a=e.touches[0],t=M.find(function(e){return e.id===s});t&&(C(s),G(!0),U({x:a.clientX-t.x,y:a.clientY-t.y}))},ge=function(e){if(X&&V){var s=e.touches[0],a=M.map(function(e){return e.id!==V?e:(0,c.A)((0,c.A)({},e),{},{x:s.clientX-Q.x,y:s.clientY-Q.y})}),t=ue(a);B(t)}},fe=function(){return G(!1)},xe=function(){V&&E&&(de(),u().navigateTo({url:"/pages/diy/stickerEdit/index?designId=".concat(E,"&stickerId=").concat(V)}))},ve=function(e,s){var a=M.map(function(a){return a.id!==e?a:(0,c.A)((0,c.A)({},a),{},{scale:Math.max(.3,Math.min(3,a.scale+s))})}),t=ue(a);B(t)},je=function(){u().navigateBack()},Ne=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},ye=function(){var e=(0,i.A)((0,n.A)().m(function e(){var s,a,t,i;return(0,n.A)().w(function(e){while(1)switch(e.p=e.n){case 0:if(!te){e.n=1;break}return u().showToast({title:"\u8d34\u7eb8\u4e0d\u80fd\u91cd\u53e0",icon:"none"}),e.a(2);case 1:if(!E||!w){e.n=6;break}return e.n=2,(0,g.x5)({stickers:M,category:w,version:1});case 2:return s=e.v,a=(0,c.A)({id:w.id,mask:w.mask},w.tone?{tone:w.tone}:{}),t=(0,p.p_)().find(function(e){return e.id===E}),i=(0,c.A)((0,c.A)({},t&&t.designData?t.designData:{}),{},{version:1,category:a,stickers:s.stickers||M}),(0,p.i5)(E,{status:"designing",designData:i}),e.p=3,e.n=4,(0,g.i5)(E,{status:"designing",item:{productId:w.id,productName:w.name,unitPrice:w.price,count:O,designData:i}});case 4:e.n=6;break;case 5:e.p=5,e.v,u().showToast({title:"\u7f51\u7edc\u4e0d\u53ef\u7528\uff0c\u5df2\u6682\u5b58\u5230\u672c\u5730",icon:"none"});case 6:ee(!1),u().navigateTo({url:"/pages/checkout/index?designId=".concat(E)});case 7:return e.a(2)}},e,null,[[3,5]])}));return function(){return e.apply(this,arguments)}}(),Se=V?M.find(function(e){return e.id===V}):void 0,we=Se?Se.scale:1;return w?(0,S.jsxs)(d.Ss,{className:"theme-".concat(s),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:je,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:Ne(),children:[M.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,width:e.width||200,height:e.height||200},onTouchStart:function(s){return pe(s,e.id)},onTouchMove:ge,onTouchEnd:fe,onTap:function(){return C(e.id)},mode:"aspectFit"},e.id)}),(0,S.jsx)(d.Ss,{className:"mask-border",style:Ne()})]})}),(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:[M.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 me(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:he,children:[(0,S.jsx)(d.EY,{className:"add-icon",children:"+"}),(0,S.jsx)(d.EY,{className:"add-label",children:"\u6dfb\u52a0"})]})]}),te&&(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 ve(V,-.1)},children:"\uff0d"}),(0,S.jsxs)(d.EY,{className:"tool-value",children:[Math.round(100*we),"%"]}),(0,S.jsx)(d.Ss,{className:"tool-btn",onTap:function(){return ve(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:xe,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:he,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:Ne(),children:M.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,")"),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"]}),te&&(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(te?"disabled":""),onTap:ye,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(s),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,t.createPageConfig)(w,"pages/diy/index",{root:{cn:[]}},k||{}))}},function(e){var s=function(s){return e(e.s=s)};e.O(0,[907,96,76],function(){return s(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 8c14e0d..c21af39 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),r=t(9379),i=t(5544),l=t(118),o=t(758),d=t.n(o),u=t(6540),h=t(1457),f=t(6845),m=t(9703),x=t(9201),g=t(5414),v=t(9674),j=t(3053),S=t(9513),w=t(4848),N=function(e,s,t){return Math.min(Math.max(e,s),t)};function p(){var e=(0,m.wR)(),s=e.resolvedTheme,t=(0,x.c)();(0,g.l)(s);var a=(0,u.useState)(""),o=(0,i.A)(a,2),p=o[0],T=o[1],k=(0,u.useState)(""),b=(0,i.A)(k,2),A=b[0],y=b[1],E=(0,u.useState)(null),Y=(0,i.A)(E,2),M=Y[0],C=Y[1],I=(0,u.useState)(0),R=(0,i.A)(I,2),D=R[0],B=R[1],P=(0,u.useState)(0),q=(0,i.A)(P,2),Q=q[0],U=q[1],F=(0,u.useState)(0),X=(0,i.A)(F,2),H=X[0],J=X[1],O=(0,u.useState)(!1),_=(0,i.A)(O,2),z=_[0],W=_[1],$=(0,u.useState)(!1),G=(0,i.A)($,2),K=G[0],L=G[1],V=((0,u.useRef)(null),(0,u.useRef)(null)),Z=(0,u.useRef)(null),ee=(0,u.useRef)({width:0,height:0}),se=(0,u.useCallback)(function(e){K||d().nextTick(function(){var s=d().createSelectorQuery();s.select("#editCanvas").fields({node:!0,size:!0}).exec(function(s){var t=s&&s[0],a=t?t.node:void 0;if(a){var n=a.getContext("2d"),c=s[0]&&s[0].width||300,r=s[0]&&s[0].height||400;c<=0&&(c=300),r<=0&&(r=400);var i=d().getSystemInfoSync().pixelRatio||1;a.width=Math.round(c*i),a.height=Math.round(r*i),n.scale(i,i),Z.current=a,V.current=n,ee.current={width:c,height:r},L(!0),te(n,c,r,e)}else setTimeout(function(){return se(e)},300)})})},[K]);(0,u.useEffect)(function(){var e=d().getCurrentInstance().router,s=e?e.params:void 0,t=s?s.designId:"",a=s?s.stickerId:"";T(t),y(a);var n=(0,h.p_)(),c=n.find(function(e){return e.id===t}),r=c&&c.designData&&c.designData.stickers?c.designData.stickers.find(function(e){return e.id===a}):void 0;r&&(C(r),B(r.edits&&r.edits.brightness||0),U(r.edits&&r.edits.hue||0),J(r.edits&&r.edits.contrast||0),se(r))},[se]);var te=function(e,s,t,a,n){if(e&&Z.current){var c=Z.current;if(s&&t){var r=a.width||200,i=a.height||200,l=c.createImage();l.onload=function(){e.clearRect(0,0,s,t),e.save();var a=.9*Math.min(s/r,t/i,4),c=r*a,o=i*a,d=(s-c)/2,u=(t-o)/2,h=n?n.brightness:D,f=n?n.hue:Q,m=n?n.contrast:H;e.filter=0!==h||0!==f||0!==m?"brightness(".concat(100+h,"%) hue-rotate(").concat(f,"deg) contrast(").concat(100+m,"%)"):"none",e.drawImage(l,d,u,c,o),e.restore()},l.onerror=function(e){console.error("Canvas load image error:",e,a.src),d().showToast({title:"\u56fe\u7247\u52a0\u8f7d\u5931\u8d25",icon:"none"})},a.src&&(l.src=a.src)}}},ae=function(){if(M&&V.current&&Z.current){var e=ee.current,s=e.width,t=e.height;te(V.current,s,t,M,{brightness:D,hue:Q,contrast:H})}};(0,u.useEffect)(function(){ae()},[D,Q,H]);var ne=function(){M&&p&&(W(!0),d().canvasToTempFilePath({canvas:Z.current,quality:.92,success:function(e){var s=e.tempFilePath,t=(0,h.p_)(),a=t.findIndex(function(e){return e.id===p});if(-1!==a){var n=t[a].designData&&t[a].designData.stickers||[],c=n.findIndex(function(e){return e.id===A});-1!==c?(n[c]=(0,r.A)((0,r.A)({},n[c]),{},{src:s,edits:{brightness:D,hue:Q,contrast:H}}),(0,h.i5)(p,{designData:(0,r.A)((0,r.A)({},t[a].designData),{},{stickers:n})}),d().showToast({title:"\u4fdd\u5b58\u6210\u529f",icon:"success"}),d().navigateBack()):W(!1)}else W(!1)},fail:function(){W(!1),d().showToast({title:"\u4fdd\u5b58\u5931\u8d25",icon:"none"})}}))},ce=function(){M&&(d().cropImage?d().cropImage({src:M.src,cropScale:"1:1",success:function(e){var s=(0,r.A)((0,r.A)({},M),{},{src:e.tempFilePath});C(s),setTimeout(function(){return ae()},200)}}):d().showToast({title:"\u5f53\u524d\u5fae\u4fe1\u7248\u672c\u4e0d\u652f\u6301\u88c1\u526a",icon:"none"}))},re=function(){var e=(0,c.A)((0,n.A)().m(function e(){var s,t;return(0,n.A)().w(function(e){while(1)switch(e.p=e.n){case 0:if(M){e.n=1;break}return e.a(2);case 1:return W(!0),e.p=2,e.n=3,(0,f.W$)(M.src);case 3:if(s=e.v,null===s||void 0===s||!s.imageUrl){e.n=4;break}t=(0,r.A)((0,r.A)({},M),{},{src:s.imageUrl,edits:(0,r.A)((0,r.A)({},M.edits),{},{sketchSrc:s.imageUrl})}),C(t),W(!1),setTimeout(function(){return ae()},200),d().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,ie();case 7:return e.a(2)}},e,null,[[2,6]])}));return function(){return e.apply(this,arguments)}}(),ie=function(){M&&V.current?(d().showToast({title:"\u4f7f\u7528\u672c\u5730\u7ebf\u7a3f",icon:"none"}),B(20),J(80),U(0),W(!1)):W(!1)},le="".concat((D+100)/200*100,"%"),oe="".concat((Q+180)/360*100,"%"),de="".concat((H+100)/200*100,"%");return(0,w.jsxs)(l.Ss,{className:"theme-".concat(s),children:[(0,w.jsx)(v.A,{}),(0,w.jsx)(j.A,{title:"\u7f16\u8f91\u8d34\u7eb8",targetSelector:".edit-header",showBack:!0}),(0,w.jsxs)(l.Ss,{className:"sticker-edit-page",children:[(0,w.jsxs)(l.Ss,{className:"edit-header",style:{paddingTop:"".concat(t.statusBarHeight+12,"px")},children:[(0,w.jsx)(l.EY,{className:"edit-back",onTap:function(){return d().navigateBack()},children:"\u2190"}),(0,w.jsx)(l.EY,{className:"edit-title",children:"\u7f16\u8f91\u8d34\u7eb8"}),(0,w.jsx)(l.EY,{className:"edit-save",onTap:ne,children:"\u4fdd\u5b58"})]}),(0,w.jsx)(l.Ss,{className:"edit-canvas-wrap",children:(0,w.jsx)(l.Hl,{id:"editCanvas",type:"2d",className:"edit-canvas",style:{width:"100%",height:"480rpx"}})}),(0,w.jsxs)(l.Ss,{className:"edit-tools surface-card mt-20",children:[(0,w.jsxs)(l.Ss,{className:"edit-row",children:[(0,w.jsx)(l.EY,{className:"edit-label",children:"\u5feb\u901f\u64cd\u4f5c"}),(0,w.jsxs)(l.Ss,{className:"edit-quick-actions",children:[(0,w.jsx)(l.Ss,{className:"quick-btn",onTap:ce,children:(0,w.jsx)(l.EY,{children:"\u88c1\u526a"})}),(0,w.jsx)(l.Ss,{className:"quick-btn",onTap:re,children:(0,w.jsx)(l.EY,{children:"\u8f6c\u7ebf\u7a3f"})})]})]}),(0,w.jsxs)(l.Ss,{className:"edit-row slider-row",onTouchMove:function(e){var s=e.changedTouches[0].clientX,t=d().createSelectorQuery().in(e.currentTarget);t.select(".slider-track").boundingClientRect(function(e){if(e){var t=N((s-e.left)/e.width,0,1),a=1*Math.round((200*t-100)/1);B(N(a,-100,100))}}).exec()},children:[(0,w.jsx)(l.EY,{className:"edit-label",children:"\u4eae\u5ea6"}),(0,w.jsxs)(l.Ss,{className:"slider-wrap",children:[(0,w.jsxs)(l.Ss,{className:"slider-track",children:[(0,w.jsx)(l.Ss,{className:"slider-fill",style:{width:le}}),(0,w.jsx)(l.Ss,{className:"slider-thumb",style:{left:le}})]}),(0,w.jsx)(l.EY,{className:"slider-value",children:D>0?"+".concat(D):D})]})]}),(0,w.jsxs)(l.Ss,{className:"edit-row slider-row",onTouchMove:function(e){var s=e.changedTouches[0].clientX,t=d().createSelectorQuery().in(e.currentTarget);t.select(".slider-track").boundingClientRect(function(e){if(e){var t=N((s-e.left)/e.width,0,1),a=1*Math.round((360*t-180)/1);U(N(a,-180,180))}}).exec()},children:[(0,w.jsx)(l.EY,{className:"edit-label",children:"\u8272\u76f8"}),(0,w.jsxs)(l.Ss,{className:"slider-wrap",children:[(0,w.jsxs)(l.Ss,{className:"slider-track",children:[(0,w.jsx)(l.Ss,{className:"slider-fill",style:{width:oe}}),(0,w.jsx)(l.Ss,{className:"slider-thumb",style:{left:oe}})]}),(0,w.jsx)(l.EY,{className:"slider-value",children:Q>0?"+".concat(Q):Q})]})]}),(0,w.jsxs)(l.Ss,{className:"edit-row slider-row",onTouchMove:function(e){var s=e.changedTouches[0].clientX,t=d().createSelectorQuery().in(e.currentTarget);t.select(".slider-track").boundingClientRect(function(e){if(e){var t=N((s-e.left)/e.width,0,1),a=1*Math.round((200*t-100)/1);J(N(a,-100,100))}}).exec()},children:[(0,w.jsx)(l.EY,{className:"edit-label",children:"\u5bf9\u6bd4\u5ea6"}),(0,w.jsxs)(l.Ss,{className:"slider-wrap",children:[(0,w.jsxs)(l.Ss,{className:"slider-track",children:[(0,w.jsx)(l.Ss,{className:"slider-fill",style:{width:de}}),(0,w.jsx)(l.Ss,{className:"slider-thumb",style:{left:de}})]}),(0,w.jsx)(l.EY,{className:"slider-value",children:H>0?"+".concat(H):H})]})]})]}),(0,w.jsx)(l.Ss,{style:{flex:1}}),(0,w.jsxs)(S.A,{className:"edit-footer",children:[(0,w.jsx)(l.Ss,{className:"btn-secondary",onTap:function(){return d().navigateBack()},children:(0,w.jsx)(l.EY,{children:"\u53d6\u6d88"})}),(0,w.jsx)(l.Ss,{className:"btn-primary",onTap:ne,children:(0,w.jsx)(l.EY,{children:"\u4fdd\u5b58"})})]}),(0,w.jsx)(l.Ss,{className:"safe-bottom-placeholder"}),z&&(0,w.jsx)(l.Ss,{className:"edit-loading",children:(0,w.jsx)(l.EY,{className:"edit-loading-text",children:"\u5904\u7406\u4e2d\u2026"})})]})]})}var T={navigationStyle:"custom",enablePageMeta:!0,navigationBarTitleText:"\u7f16\u8f91\u8d34\u7eb8"};Page((0,a.createPageConfig)(p,"pages/diy/stickerEdit/index",{root:{cn:[]}},T||{}))}},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(6845),f=t(9703),x=t(9201),g=t(5414),j=t(9674),v=t(3053),S=t(9513),p=t(4848),N=function(e,s,t){return Math.min(Math.max(e,s),t)};function w(){var e=(0,f.wR)(),s=e.resolvedTheme,t=(0,x.c)();(0,g.l)(s);var a=(0,u.useState)(""),d=(0,r.A)(a,2),w=d[0],k=d[1],T=(0,u.useState)(""),b=(0,r.A)(T,2),y=b[0],A=b[1],E=(0,u.useState)(null),Y=(0,r.A)(E,2),I=Y[0],M=Y[1],B=(0,u.useState)(!1),C=(0,r.A)(B,2),R=C[0],D=C[1],P=(0,u.useState)(0),q=(0,r.A)(P,2),Q=q[0],U=q[1],F=(0,u.useState)(0),H=(0,r.A)(F,2),X=H[0],J=H[1],O=(0,u.useState)(0),_=(0,r.A)(O,2),z=_[0],W=_[1],$=(0,u.useState)(!1),G=(0,r.A)($,2),K=G[0],L=G[1],V=(0,u.useState)(!1),Z=(0,r.A)(V,2),ee=Z[0],se=Z[1],te=((0,u.useRef)(null),(0,u.useRef)(null)),ae=(0,u.useRef)(null),ne=(0,u.useRef)({width:0,height:0}),ce=(0,u.useCallback)(function(e){ee||o().nextTick(function(){var s=o().createSelectorQuery();s.select("#editCanvas").fields({node:!0,size:!0}).exec(function(s){var t=s&&s[0],a=t?t.node:void 0;if(a){var n=a.getContext("2d"),c=s[0]&&s[0].width||300,i=s[0]&&s[0].height||400;c<=0&&(c=300),i<=0&&(i=400);var r=o().getSystemInfoSync().pixelRatio||1;a.width=Math.round(c*r),a.height=Math.round(i*r),n.scale(r,r),ae.current=a,te.current=n,ne.current={width:c,height:i},se(!0),ie(n,c,i,e)}else setTimeout(function(){return ce(e)},300)})})},[ee]);(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),A(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?(M(i),U(i.edits&&i.edits.brightness||0),J(i.edits&&i.edits.hue||0),W(i.edits&&i.edits.contrast||0),ce(i)):D(!0)},[ce]);var ie=function(e,s,t,a,n){if(e&&ae.current){var c=ae.current;if(s&&t){var i=a.width||200,r=a.height||200,l=c.createImage();l.onload=function(){e.clearRect(0,0,s,t),e.save();var a=.9*Math.min(s/i,t/r,4),c=i*a,d=r*a,o=(s-c)/2,u=(t-d)/2,h=n?n.brightness:Q,m=n?n.hue:X,f=n?n.contrast:z;e.filter=0!==h||0!==m||0!==f?"brightness(".concat(100+h,"%) hue-rotate(").concat(m,"deg) contrast(").concat(100+f,"%)"):"none",e.drawImage(l,o,u,c,d),e.restore()},l.onerror=function(e){console.error("Canvas load image error:",e,a.src),o().showToast({title:"\u56fe\u7247\u52a0\u8f7d\u5931\u8d25",icon:"none"})},a.src&&(l.src=a.src)}}},re=function(){if(I&&te.current&&ae.current){var e=ne.current,s=e.width,t=e.height;ie(te.current,s,t,I,{brightness:Q,hue:X,contrast:z})}};(0,u.useEffect)(function(){re()},[Q,X,z]);var le=function(){I&&w&&(L(!0),o().canvasToTempFilePath({canvas:ae.current,quality:.92,success:function(e){var s=e.tempFilePath,t=(0,h.p_)(),a=t.findIndex(function(e){return e.id===w});if(-1!==a){var n=t[a].designData&&t[a].designData.stickers||[],c=n.findIndex(function(e){return e.id===y});if(-1!==c){n[c]=(0,i.A)((0,i.A)({},n[c]),{},{src:s,edits:{brightness:Q,hue:X,contrast:z}});var r=t[a],l=(0,i.A)((0,i.A)({},r.designData),{},{stickers:n});(0,h.i5)(w,{designData:l}),(0,m.i5)(w,{item:{productId:r.productId,productName:r.productName,unitPrice:r.unitPrice,count:r.count,designData:l}}).catch(function(){return o().showToast({title:"\u7f51\u7edc\u4e0d\u53ef\u7528\uff0c\u5df2\u6682\u5b58\u5230\u672c\u5730",icon:"none"})}),o().showToast({title:"\u4fdd\u5b58\u6210\u529f",icon:"success"}),o().navigateBack()}else L(!1)}else L(!1)},fail:function(){L(!1),o().showToast({title:"\u4fdd\u5b58\u5931\u8d25",icon:"none"})}}))},de=function(){I&&(o().cropImage?o().cropImage({src:I.src,cropScale:"1:1",success:function(e){var s=(0,i.A)((0,i.A)({},I),{},{src:e.tempFilePath});M(s),setTimeout(function(){return re()},200)}}):o().showToast({title:"\u5f53\u524d\u5fae\u4fe1\u7248\u672c\u4e0d\u652f\u6301\u88c1\u526a",icon:"none"}))},oe=function(){var e=(0,c.A)((0,n.A)().m(function e(){var s,t;return(0,n.A)().w(function(e){while(1)switch(e.p=e.n){case 0:if(I){e.n=1;break}return e.a(2);case 1:return L(!0),e.p=2,e.n=3,(0,m.W$)(I.src);case 3:if(s=e.v,null===s||void 0===s||!s.imageUrl){e.n=4;break}t=(0,i.A)((0,i.A)({},I),{},{src:s.imageUrl,edits:(0,i.A)((0,i.A)({},I.edits),{},{sketchSrc:s.imageUrl})}),M(t),L(!1),setTimeout(function(){return re()},200),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,ue();case 7:return e.a(2)}},e,null,[[2,6]])}));return function(){return e.apply(this,arguments)}}(),ue=function(){I&&te.current?(o().showToast({title:"\u4f7f\u7528\u672c\u5730\u7ebf\u7a3f",icon:"none"}),U(20),W(80),J(0),L(!1)):L(!1)},he="".concat((Q+100)/200*100,"%"),me="".concat((X+180)/360*100,"%"),fe="".concat((z+100)/200*100,"%");return R?(0,p.jsxs)(l.Ss,{className:"theme-".concat(s),children:[(0,p.jsx)(j.A,{}),(0,p.jsx)(v.A,{title:"\u7f16\u8f91\u8d34\u7eb8",targetSelector:".edit-header",showBack:!0}),(0,p.jsxs)(l.Ss,{className:"sticker-edit-page",children:[(0,p.jsxs)(l.Ss,{className:"edit-header",style:{paddingTop:"".concat(t.statusBarHeight+12,"px")},children:[(0,p.jsx)(l.EY,{className:"edit-back",onTap:function(){return o().navigateBack()},children:"\u2190"}),(0,p.jsx)(l.EY,{className:"edit-title",children:"\u7f16\u8f91\u8d34\u7eb8"}),(0,p.jsx)(l.EY,{className:"edit-save"})]}),(0,p.jsxs)(l.Ss,{className:"edit-empty surface-card mt-20",children:[(0,p.jsx)(l.EY,{className:"edit-empty-title",children:"\u672a\u627e\u5230\u8be5\u8d34\u7eb8"}),(0,p.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,p.jsx)(l.Ss,{className:"btn-primary",onTap:function(){return o().navigateBack()},children:(0,p.jsx)(l.EY,{children:"\u8fd4\u56de\u5de5\u4f5c\u53f0"})})]})]})]}):(0,p.jsxs)(l.Ss,{className:"theme-".concat(s),children:[(0,p.jsx)(j.A,{}),(0,p.jsx)(v.A,{title:"\u7f16\u8f91\u8d34\u7eb8",targetSelector:".edit-header",showBack:!0}),(0,p.jsxs)(l.Ss,{className:"sticker-edit-page",children:[(0,p.jsxs)(l.Ss,{className:"edit-header",style:{paddingTop:"".concat(t.statusBarHeight+12,"px")},children:[(0,p.jsx)(l.EY,{className:"edit-back",onTap:function(){return o().navigateBack()},children:"\u2190"}),(0,p.jsx)(l.EY,{className:"edit-title",children:"\u7f16\u8f91\u8d34\u7eb8"}),(0,p.jsx)(l.EY,{className:"edit-save",onTap:le,children:"\u4fdd\u5b58"})]}),(0,p.jsx)(l.Ss,{className:"edit-canvas-wrap",children:(0,p.jsx)(l.Hl,{id:"editCanvas",type:"2d",className:"edit-canvas",style:{width:"100%",height:"480rpx"}})}),(0,p.jsxs)(l.Ss,{className:"edit-tools surface-card mt-20",children:[(0,p.jsxs)(l.Ss,{className:"edit-row",children:[(0,p.jsx)(l.EY,{className:"edit-label",children:"\u5feb\u901f\u64cd\u4f5c"}),(0,p.jsxs)(l.Ss,{className:"edit-quick-actions",children:[(0,p.jsx)(l.Ss,{className:"quick-btn",onTap:de,children:(0,p.jsx)(l.EY,{children:"\u88c1\u526a"})}),(0,p.jsx)(l.Ss,{className:"quick-btn",onTap:oe,children:(0,p.jsx)(l.EY,{children:"\u8f6c\u7ebf\u7a3f"})})]})]}),(0,p.jsxs)(l.Ss,{className:"edit-row slider-row",onTouchMove:function(e){var s=e.changedTouches[0].clientX,t=o().createSelectorQuery().in(e.currentTarget);t.select(".slider-track").boundingClientRect(function(e){if(e){var t=N((s-e.left)/e.width,0,1),a=1*Math.round((200*t-100)/1);U(N(a,-100,100))}}).exec()},children:[(0,p.jsx)(l.EY,{className:"edit-label",children:"\u4eae\u5ea6"}),(0,p.jsxs)(l.Ss,{className:"slider-wrap",children:[(0,p.jsxs)(l.Ss,{className:"slider-track",children:[(0,p.jsx)(l.Ss,{className:"slider-fill",style:{width:he}}),(0,p.jsx)(l.Ss,{className:"slider-thumb",style:{left:he}})]}),(0,p.jsx)(l.EY,{className:"slider-value",children:Q>0?"+".concat(Q):Q})]})]}),(0,p.jsxs)(l.Ss,{className:"edit-row slider-row",onTouchMove:function(e){var s=e.changedTouches[0].clientX,t=o().createSelectorQuery().in(e.currentTarget);t.select(".slider-track").boundingClientRect(function(e){if(e){var t=N((s-e.left)/e.width,0,1),a=1*Math.round((360*t-180)/1);J(N(a,-180,180))}}).exec()},children:[(0,p.jsx)(l.EY,{className:"edit-label",children:"\u8272\u76f8"}),(0,p.jsxs)(l.Ss,{className:"slider-wrap",children:[(0,p.jsxs)(l.Ss,{className:"slider-track",children:[(0,p.jsx)(l.Ss,{className:"slider-fill",style:{width:me}}),(0,p.jsx)(l.Ss,{className:"slider-thumb",style:{left:me}})]}),(0,p.jsx)(l.EY,{className:"slider-value",children:X>0?"+".concat(X):X})]})]}),(0,p.jsxs)(l.Ss,{className:"edit-row slider-row",onTouchMove:function(e){var s=e.changedTouches[0].clientX,t=o().createSelectorQuery().in(e.currentTarget);t.select(".slider-track").boundingClientRect(function(e){if(e){var t=N((s-e.left)/e.width,0,1),a=1*Math.round((200*t-100)/1);W(N(a,-100,100))}}).exec()},children:[(0,p.jsx)(l.EY,{className:"edit-label",children:"\u5bf9\u6bd4\u5ea6"}),(0,p.jsxs)(l.Ss,{className:"slider-wrap",children:[(0,p.jsxs)(l.Ss,{className:"slider-track",children:[(0,p.jsx)(l.Ss,{className:"slider-fill",style:{width:fe}}),(0,p.jsx)(l.Ss,{className:"slider-thumb",style:{left:fe}})]}),(0,p.jsx)(l.EY,{className:"slider-value",children:z>0?"+".concat(z):z})]})]})]}),(0,p.jsx)(l.Ss,{style:{flex:1}}),(0,p.jsxs)(S.A,{className:"edit-footer",children:[(0,p.jsx)(l.Ss,{className:"btn-secondary",onTap:function(){return o().navigateBack()},children:(0,p.jsx)(l.EY,{children:"\u53d6\u6d88"})}),(0,p.jsx)(l.Ss,{className:"btn-primary",onTap:le,children:(0,p.jsx)(l.EY,{children:"\u4fdd\u5b58"})})]}),(0,p.jsx)(l.Ss,{className:"safe-bottom-placeholder"}),K&&(0,p.jsx)(l.Ss,{className:"edit-loading",children:(0,p.jsx)(l.EY,{className:"edit-loading-text",children:"\u5904\u7406\u4e2d\u2026"})})]})]})}var k={navigationStyle:"custom",enablePageMeta:!0,navigationBarTitleText:"\u7f16\u8f91\u8d34\u7eb8"};Page((0,a.createPageConfig)(w,"pages/diy/stickerEdit/index",{root:{cn:[]}},k||{}))}},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/diy/stickerEdit/index.wxss b/dist/pages/diy/stickerEdit/index.wxss index 3672aa1..c58db31 100644 --- a/dist/pages/diy/stickerEdit/index.wxss +++ b/dist/pages/diy/stickerEdit/index.wxss @@ -1 +1 @@ -.sticker-edit-page{-webkit-box-sizing:border-box;box-sizing:border-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;min-height:100vh;padding:0 32rpx calc(48rpx + env(safe-area-inset-bottom))}.edit-header{-ms-flex-align:center;-ms-flex-pack:justify;-webkit-align-items:center;align-items:center;display:-webkit-flex;display:-ms-flexbox;display:flex;gap:16rpx;-webkit-justify-content:space-between;justify-content:space-between;padding-bottom:24rpx}.edit-back{-ms-flex-align:center;-ms-flex-pack:center;-ms-flex-negative:0;-webkit-align-items:center;align-items:center;background:var(--bg-card);border:1rpx solid var(--border-strong);border-radius:50%;-webkit-box-shadow:var(--shadow-card);box-shadow:var(--shadow-card);color:var(--text-primary);display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-shrink:0;flex-shrink:0;font-size:36rpx;height:80rpx;-webkit-justify-content:center;justify-content:center;line-height:1;width:80rpx}.edit-back:active{-webkit-transform:scale(.96);-ms-transform:scale(.96);transform:scale(.96)}.edit-title{color:var(--text-primary);-webkit-flex:1;-ms-flex:1;flex:1;font-size:34rpx;font-weight:700;letter-spacing:0;min-width:0;overflow:hidden;text-align:center;text-overflow:ellipsis;white-space:nowrap}.edit-save{-ms-flex-align:center;-ms-flex-pack:end;-webkit-align-items:center;align-items:center;color:var(--accent-primary);display:-webkit-flex;display:-ms-flexbox;display:flex;font-size:26rpx;font-weight:600;-webkit-justify-content:flex-end;justify-content:flex-end;min-width:80rpx}.edit-save:active{opacity:.85}.edit-canvas-wrap{-ms-flex-align:center;-ms-flex-pack:center;-webkit-align-items:center;align-items:center;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex:1;-ms-flex:1;flex:1;-webkit-justify-content:center;justify-content:center;min-height:480rpx;padding:8rpx 0 24rpx}.edit-canvas{background:var(--bg-input);border:1rpx solid var(--border-strong);border-radius:24rpx;-webkit-box-shadow:var(--shadow-card);box-shadow:var(--shadow-card);height:480rpx;width:100%}.edit-tools{padding:24rpx}.edit-row{-ms-flex-align:center;-ms-flex-pack:justify;-webkit-align-items:center;align-items:center;display:-webkit-flex;display:-ms-flexbox;display:flex;gap:24rpx;-webkit-justify-content:space-between;justify-content:space-between;margin-bottom:24rpx}.edit-row:last-child{margin-bottom:0}.edit-label{-ms-flex-negative:0;color:var(--text-primary);-webkit-flex-shrink:0;flex-shrink:0;font-size:26rpx;font-weight:600;width:96rpx}.edit-quick-actions{display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;gap:16rpx}.quick-btn{-ms-flex-align:center;-ms-flex-pack:center;-webkit-align-items:center;align-items:center;background:var(--bg-input);border:1rpx solid var(--border);border-radius:999rpx;color:var(--text-primary);display:-webkit-flex;display:-ms-flexbox;display:flex;font-size:24rpx;font-weight:500;height:64rpx;-webkit-justify-content:center;justify-content:center;padding:0 28rpx;-webkit-transition:all .2s ease;transition:all .2s ease}.quick-btn:active{opacity:.85;-webkit-transform:scale(.97);-ms-transform:scale(.97);transform:scale(.97)}.quick-btn.active{background:var(--accent-primary-soft);border-color:var(--accent-primary);color:var(--accent-primary)}.slider-wrap{-ms-flex-align:center;-webkit-align-items:center;align-items:center;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex:1;-ms-flex:1;flex:1;gap:12rpx;min-width:0}.slider-track{background:var(--bg-input);border:1rpx solid var(--border);border-radius:999rpx;-webkit-flex:1;-ms-flex:1;flex:1;height:8rpx;min-width:0;position:relative}.slider-fill{background:-webkit-gradient(linear,left top,right top,from(var(--accent-primary)),to(var(--accent-primary-soft)));background:-webkit-linear-gradient(left,var(--accent-primary),var(--accent-primary-soft));background:linear-gradient(90deg,var(--accent-primary),var(--accent-primary-soft));border-radius:999rpx;height:100%;left:0;position:absolute;top:0}.slider-thumb{background:var(--bg-card);border:4rpx solid var(--accent-primary);border-radius:50%;-webkit-box-shadow:var(--shadow-card);box-shadow:var(--shadow-card);height:32rpx;position:absolute;top:50%;-webkit-transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%);transform:translate(-50%,-50%);width:32rpx}.slider-thumb.dragging{-webkit-transform:translate(-50%,-50%) scale(1.12);-ms-transform:translate(-50%,-50%) scale(1.12);transform:translate(-50%,-50%) scale(1.12)}.slider-value{color:var(--text-secondary);font-size:22rpx;font-variant-numeric:tabular-nums;min-width:80rpx;text-align:right}.edit-footer .btn-primary,.edit-footer .btn-secondary{-webkit-flex:1;-ms-flex:1;flex:1;font-size:28rpx;font-weight:600;line-height:1.2;padding:28rpx 0;text-align:center}.edit-loading{-ms-flex-align:center;-ms-flex-pack:center;-webkit-align-items:center;align-items:center;background:rgba(0,0,0,.45);bottom:0;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-justify-content:center;justify-content:center;left:0;position:fixed;right:0;top:0;z-index:1000}.edit-loading-text{color:#fff;font-size:28rpx;margin-top:20rpx}.mt-20{margin-top:24rpx} \ No newline at end of file +.sticker-edit-page{-webkit-box-sizing:border-box;box-sizing:border-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;min-height:100vh;padding:0 32rpx calc(48rpx + env(safe-area-inset-bottom))}.edit-header{-ms-flex-align:center;-ms-flex-pack:justify;-webkit-align-items:center;align-items:center;display:-webkit-flex;display:-ms-flexbox;display:flex;gap:16rpx;-webkit-justify-content:space-between;justify-content:space-between;padding-bottom:24rpx}.edit-back{-ms-flex-align:center;-ms-flex-pack:center;-ms-flex-negative:0;-webkit-align-items:center;align-items:center;background:var(--bg-card);border:1rpx solid var(--border-strong);border-radius:50%;-webkit-box-shadow:var(--shadow-card);box-shadow:var(--shadow-card);color:var(--text-primary);display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-shrink:0;flex-shrink:0;font-size:36rpx;height:80rpx;-webkit-justify-content:center;justify-content:center;line-height:1;width:80rpx}.edit-back:active{-webkit-transform:scale(.96);-ms-transform:scale(.96);transform:scale(.96)}.edit-title{color:var(--text-primary);-webkit-flex:1;-ms-flex:1;flex:1;font-size:34rpx;font-weight:700;letter-spacing:0;min-width:0;overflow:hidden;text-align:center;text-overflow:ellipsis;white-space:nowrap}.edit-save{-ms-flex-align:center;-ms-flex-pack:end;-webkit-align-items:center;align-items:center;color:var(--accent-primary);display:-webkit-flex;display:-ms-flexbox;display:flex;font-size:26rpx;font-weight:600;-webkit-justify-content:flex-end;justify-content:flex-end;min-width:80rpx}.edit-save:active{opacity:.85}.edit-canvas-wrap{-ms-flex-align:center;-ms-flex-pack:center;-webkit-align-items:center;align-items:center;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex:1;-ms-flex:1;flex:1;-webkit-justify-content:center;justify-content:center;min-height:480rpx;padding:8rpx 0 24rpx}.edit-canvas{background:var(--bg-input);border:1rpx solid var(--border-strong);border-radius:24rpx;-webkit-box-shadow:var(--shadow-card);box-shadow:var(--shadow-card);height:480rpx;width:100%}.edit-tools{padding:24rpx}.edit-row{-ms-flex-align:center;-ms-flex-pack:justify;-webkit-align-items:center;align-items:center;display:-webkit-flex;display:-ms-flexbox;display:flex;gap:24rpx;-webkit-justify-content:space-between;justify-content:space-between;margin-bottom:24rpx}.edit-row:last-child{margin-bottom:0}.edit-label{-ms-flex-negative:0;color:var(--text-primary);-webkit-flex-shrink:0;flex-shrink:0;font-size:26rpx;font-weight:600;width:96rpx}.edit-quick-actions{display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;gap:16rpx}.quick-btn{-ms-flex-align:center;-ms-flex-pack:center;-webkit-align-items:center;align-items:center;background:var(--bg-input);border:1rpx solid var(--border);border-radius:999rpx;color:var(--text-primary);display:-webkit-flex;display:-ms-flexbox;display:flex;font-size:24rpx;font-weight:500;height:64rpx;-webkit-justify-content:center;justify-content:center;padding:0 28rpx;-webkit-transition:all .2s ease;transition:all .2s ease}.quick-btn:active{opacity:.85;-webkit-transform:scale(.97);-ms-transform:scale(.97);transform:scale(.97)}.quick-btn.active{background:var(--accent-primary-soft);border-color:var(--accent-primary);color:var(--accent-primary)}.slider-wrap{-ms-flex-align:center;-webkit-align-items:center;align-items:center;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex:1;-ms-flex:1;flex:1;gap:12rpx;min-width:0}.slider-track{background:var(--bg-input);border:1rpx solid var(--border);border-radius:999rpx;-webkit-flex:1;-ms-flex:1;flex:1;height:8rpx;min-width:0;position:relative}.slider-fill{background:-webkit-gradient(linear,left top,right top,from(var(--accent-primary)),to(var(--accent-primary-soft)));background:-webkit-linear-gradient(left,var(--accent-primary),var(--accent-primary-soft));background:linear-gradient(90deg,var(--accent-primary),var(--accent-primary-soft));border-radius:999rpx;height:100%;left:0;position:absolute;top:0}.slider-thumb{background:var(--bg-card);border:4rpx solid var(--accent-primary);border-radius:50%;-webkit-box-shadow:var(--shadow-card);box-shadow:var(--shadow-card);height:32rpx;position:absolute;top:50%;-webkit-transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%);transform:translate(-50%,-50%);width:32rpx}.slider-thumb.dragging{-webkit-transform:translate(-50%,-50%) scale(1.12);-ms-transform:translate(-50%,-50%) scale(1.12);transform:translate(-50%,-50%) scale(1.12)}.slider-value{color:var(--text-secondary);font-size:22rpx;font-variant-numeric:tabular-nums;min-width:80rpx;text-align:right}.edit-footer .btn-primary,.edit-footer .btn-secondary{-webkit-flex:1;-ms-flex:1;flex:1;font-size:28rpx;font-weight:600;line-height:1.2;padding:28rpx 0;text-align:center}.edit-loading{-ms-flex-align:center;-ms-flex-pack:center;-webkit-align-items:center;align-items:center;background:rgba(0,0,0,.45);bottom:0;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-justify-content:center;justify-content:center;left:0;position:fixed;right:0;top:0;z-index:1000}.edit-loading-text{color:#fff;font-size:28rpx;margin-top:20rpx}.mt-20{margin-top:24rpx}.edit-empty{-ms-flex-align:center;-webkit-align-items:center;align-items:center;border-radius:24rpx;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;gap:24rpx;margin:24rpx 24rpx 0;padding:60rpx 40rpx}.edit-empty-title{font-size:32rpx;font-weight:600}.edit-empty-desc{font-size:26rpx;opacity:.65;text-align:center}.edit-empty .btn-primary{border-radius:44rpx;padding:16rpx 60rpx} \ No newline at end of file diff --git a/dist/pages/product/index.js b/dist/pages/product/index.js index 69f3288..620d7f0 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),l=a(5544),r=a(118),n=a(758),i=a.n(n),t=a(6540),d=a(5234),o=a(1457),m=a(9703),h=a(9201),x=a(5414),p=a(9674),j=a(3053),u=a(9513),N=a(4848);function S(){var s=(0,m.wR)(),e=(s.theme,s.resolvedTheme),a=(0,h.c)();(0,x.l)(e);var c=(0,t.useState)(!1),n=(0,l.A)(c,2),S=n[0],g=n[1],f=(0,t.useState)(1),E=(0,l.A)(f,2),Y=E[0],v=E[1],y=i().getCurrentInstance().router,b=y?y.params:void 0,k=b&&b.id?b.id:"",w=(0,d.y9)(k);if(!w)return(0,N.jsxs)(r.Ss,{className:"theme-".concat(e),children:[(0,N.jsx)(p.A,{}),(0,N.jsx)(j.A,{title:"\u5546\u54c1\u8be6\u60c5",targetSelector:".page-header",showBack:!0}),(0,N.jsx)(r.Ss,{className:"product-page",children:(0,N.jsx)(r.Ss,{className:"page-header",style:{marginTop:"".concat(a.statusBarHeight+12,"px")},children:(0,N.jsxs)(r.Ss,{className:"page-header-inner",children:[(0,N.jsx)(r.Ss,{className:"back-btn",style:{position:"fixed",left:"30rpx",top:"".concat(a.menuButtonTop,"px"),zIndex:41},onTap:function(){return i().navigateBack()},children:(0,N.jsx)(r.EY,{className:"back-arrow",children:"\u2190"})}),(0,N.jsx)(r.Ss,{className:"nav-placeholder"}),(0,N.jsx)(r.EY,{className:"nav-title",children:"\u5546\u54c1\u672a\u627e\u5230"}),(0,N.jsx)(r.Ss,{className:"nav-placeholder"})]})})})]});var T=w.specs&&w.specs.length>0?w.specs.find(function(s){return s[0].indexOf("\u5de5\u827a")>=0}):void 0,B=T?T[1]:"\u6fc0\u5149\u5fae\u96d5",A=function(){v(1),g(!0)},q=function(){(0,o.cY)(w,Y),g(!1),i().showToast({title:"\u5df2\u52a0\u5165\u8bbe\u8ba1\u6e05\u5355 x".concat(Y),icon:"success"}),setTimeout(function(){return i().navigateBack()},1200)},P=function(){i().navigateTo({url:"/pages/diy/index?source=product&productId=".concat(w.id,"&quantity=1")})},C=function(s){v(function(e){return Math.max(1,Math.min(99,e+s))})};return(0,N.jsxs)(r.Ss,{className:"theme-".concat(e),children:[(0,N.jsx)(p.A,{}),(0,N.jsx)(j.A,{title:"\u5546\u54c1\u8be6\u60c5",targetSelector:".page-header",showBack:!0}),(0,N.jsxs)(r.Ss,{className:"product-page",children:[(0,N.jsx)(r.Ss,{className:"page-header",style:{marginTop:"".concat(a.statusBarHeight+12,"px")},children:(0,N.jsxs)(r.Ss,{className:"page-header-inner",children:[(0,N.jsx)(r.Ss,{className:"back-btn",style:{position:"fixed",left:"30rpx",top:"".concat(a.menuButtonTop,"px"),zIndex:41},onTap:function(){return i().navigateBack()},children:(0,N.jsx)(r.EY,{className:"back-arrow",children:"\u2190"})}),(0,N.jsx)(r.Ss,{className:"nav-placeholder"}),(0,N.jsx)(r.EY,{className:"nav-title",children:"\u5546\u54c1\u8be6\u60c5"}),(0,N.jsx)(r.Ss,{className:"nav-placeholder"})]})}),(0,N.jsx)(r.Ss,{className:"hero-section",children:(0,N.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:w.images&&w.images.length>0?w.images.map(function(s,e){return(0,N.jsx)(r.wu,{children:(0,N.jsx)(r.Ss,{className:"hero-block",children:(0,N.jsx)(r._V,{className:"hero-image",src:s,mode:"aspectFill"})})},e)}):(0,N.jsx)(r.wu,{children:(0,N.jsx)(r.Ss,{className:"hero-block hero-block-fallback",children:(0,N.jsx)(r._V,{className:"hero-fallback-icon",src:(0,d.QE)(w),mode:"aspectFit"})})})})}),(0,N.jsx)(r.Ss,{className:"detail-card surface-card",children:(0,N.jsxs)(r.Ss,{className:"price-line",children:[(0,N.jsxs)(r.Ss,{className:"price-left",children:[(0,N.jsx)(r.EY,{className:"detail-title",children:w.name}),(0,N.jsx)(r.EY,{className:"detail-desc",children:w.desc})]}),(0,N.jsxs)(r.Ss,{className:"price-right",children:[(0,N.jsxs)(r.EY,{className:"price",children:["\xa5",w.price]}),w.originalPrice&&w.originalPrice>w.price&&(0,N.jsxs)(r.EY,{className:"price-old",children:["\xa5",w.originalPrice]})]})]})}),(0,N.jsxs)(r.Ss,{className:"detail-card surface-card",children:[(0,N.jsxs)(r.Ss,{className:"spec-row",children:[(0,N.jsx)(r.EY,{className:"spec-key",children:"\u5355\u4ef7"}),(0,N.jsxs)(r.EY,{className:"spec-value",children:["\xa5",w.price]})]}),(0,N.jsxs)(r.Ss,{className:"spec-row",children:[(0,N.jsx)(r.EY,{className:"spec-key",children:"\u5de5\u671f"}),(0,N.jsx)(r.EY,{className:"spec-value",children:w.leadTime})]}),(0,N.jsxs)(r.Ss,{className:"spec-row",children:[(0,N.jsx)(r.EY,{className:"spec-key",children:"\u5c3a\u5bf8"}),(0,N.jsxs)(r.EY,{className:"spec-value",children:[w.mask.width," \xd7 ",w.mask.height," px"]})]}),(0,N.jsxs)(r.Ss,{className:"spec-row",children:[(0,N.jsx)(r.EY,{className:"spec-key",children:"\u5b9a\u5236\u5de5\u827a"}),(0,N.jsx)(r.EY,{className:"spec-value",children:B})]})]}),(0,N.jsxs)(r.Ss,{className:"detail-card surface-card",children:[(0,N.jsx)(r.EY,{className:"section-title",children:"\u5546\u54c1\u4ecb\u7ecd"}),(0,N.jsx)(r.EY,{className:"detail-text",children:w.description})]}),(0,N.jsxs)(u.A,{children:[(0,N.jsxs)(r.Ss,{className:"price-summary",children:[(0,N.jsx)(r.EY,{className:"summary-label",children:"\u8d77\u4ef7"}),(0,N.jsxs)(r.EY,{className:"summary-price",children:["\xa5",w.price]})]}),(0,N.jsx)(r.Ss,{className:"btn-secondary",onTap:A,children:(0,N.jsx)(r.EY,{children:"\u52a0\u5165\u8bbe\u8ba1\u6e05\u5355"})}),(0,N.jsx)(r.Ss,{className:"btn-primary",onTap:P,children:(0,N.jsx)(r.EY,{children:"\u7acb\u5373\u4e0b\u5355"})})]}),S&&(0,N.jsx)(r.Ss,{className:"modal-overlay",children:(0,N.jsxs)(r.Ss,{className:"modal-card surface-card",children:[(0,N.jsx)(r.EY,{className:"modal-title",children:"\u52a0\u5165\u8bbe\u8ba1\u6e05\u5355"}),(0,N.jsxs)(r.Ss,{className:"modal-product",children:[(0,N.jsx)(r._V,{className:"modal-icon-img",src:(0,d.QE)(w),mode:"aspectFit"}),(0,N.jsx)(r.EY,{className:"modal-name",children:w.name})]}),(0,N.jsxs)(r.Ss,{className:"quantity-row",children:[(0,N.jsx)(r.EY,{className:"qty-label",children:"\u6570\u91cf"}),(0,N.jsxs)(r.Ss,{className:"qty-control",children:[(0,N.jsx)(r.Ss,{className:"qty-btn",onTap:function(){return C(-1)},children:"\uff0d"}),(0,N.jsx)(r.EY,{className:"qty-num",children:Y}),(0,N.jsx)(r.Ss,{className:"qty-btn",onTap:function(){return C(1)},children:"\uff0b"})]})]}),(0,N.jsxs)(r.Ss,{className:"modal-total",children:[(0,N.jsx)(r.EY,{className:"total-label",children:"\u5c0f\u8ba1"}),(0,N.jsxs)(r.EY,{className:"total-price",children:["\xa5",(w.price*Y).toFixed(2)]})]}),(0,N.jsxs)(r.Ss,{className:"modal-actions",children:[(0,N.jsx)(r.Ss,{className:"btn-secondary",onTap:function(){return g(!1)},children:(0,N.jsx)(r.EY,{children:"\u53d6\u6d88"})}),(0,N.jsx)(r.Ss,{className:"btn-primary",onTap:q,children:(0,N.jsx)(r.EY,{children:"\u786e\u5b9a"})})]})]})})]})]})}var g={navigationStyle:"custom",enablePageMeta:!0,navigationBarTitleText:"\u5546\u54c1\u8be6\u60c5"};Page((0,c.createPageConfig)(S,"pages/product/index",{root:{cn:[]}},g||{}))}},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),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 diff --git a/src/pages/diy/index.tsx b/src/pages/diy/index.tsx index eea61c4..27328b0 100644 --- a/src/pages/diy/index.tsx +++ b/src/pages/diy/index.tsx @@ -1,6 +1,6 @@ import { View, Text, Image } from '@tarojs/components' import Taro from '@tarojs/taro' -import { useState, useEffect } from 'react' +import { useState, useEffect, useRef } from 'react' import './index.scss' import { getProductById } from '../../utils/productConfig' import { getDesignList, setDesignList, updateDesign, type DesignItem, type StickerItem } from '../../utils/store' @@ -27,7 +27,7 @@ export default function DIYPage() { const [previewMode, setPreviewMode] = useState(false) const [hasOverlap, setHasOverlap] = useState(false) - /** 进入 DIY 即创建清单条目:服务端创建(DRAFT,阶段0 决策#6),失败降级本地 */ + /** 进入 DIY 即创建清单条目,并推进到「设计中」(问题3 修正:进入工作台即 SUBMITTED),失败降级本地 */ const createDesignEntry = (product: { id: string; name: string; price: number; icon: string }, count: number) => { createDesign({ productId: product.id, @@ -38,6 +38,13 @@ export default function DIYPage() { .then(item => { setDesignList([item, ...getDesignList()]) // 回写缓存,checkout 等页面仍读缓存 setDesignId(item.id) + return updateDesignApi(item.id, { status: 'designing' }) + .then(updated => { + setDesignList(getDesignList().map(d => d.id === item.id ? { ...d, status: updated.status } : d)) + }) + .catch(() => { + setDesignList(getDesignList().map(d => d.id === item.id ? { ...d, status: 'designing' as const } : d)) + }) }) .catch(() => { const newDesign: DesignItem = { @@ -47,7 +54,7 @@ export default function DIYPage() { productIcon: product.icon, unitPrice: product.price, count, - status: 'undesigned', + status: 'designing', createdAt: new Date().toISOString().slice(0, 10) } setDesignList([...getDesignList(), newDesign]) @@ -97,6 +104,12 @@ export default function DIYPage() { } setStickers([s]) } + + // 问题3 修正:继续设计同样进入「设计中」状态(单向状态机,undesigned → designing) + if (design.status === 'undesigned') { + updateDesign(dId, { status: 'designing' }) + updateDesignApi(dId, { status: 'designing' }).catch(() => {}) + } } return } @@ -111,6 +124,51 @@ export default function DIYPage() { } }, []) + // ---------- 草稿持久化(修正工作流 问题2)---------- + // 贴纸变化防抖 800ms:本地缓存即时同步 + 服务端静默同步;不推状态(SUBMITTED 只由显式动作触发) + const draftTimerRef = useRef | null>(null) + const latestRef = useRef({ designId: '', quantity: 1, category: null as any, stickers: [] as StickerItem[] }) + latestRef.current = { designId, quantity, category, stickers } + + const saveDraft = () => { + const { designId: dId, quantity: qty, category: cat, stickers: st } = latestRef.current + if (!dId || !cat) return + // WCD 红线:基于缓存中服务端最新 designData 合并(保留 wordcloud 分组),只覆盖本页编辑字段 + const cached = getDesignList().find(d => d.id === dId) + const designData = { + ...(cached && cached.designData ? cached.designData : {}), + version: 1 as const, + category: { id: cat.id, mask: cat.mask, ...(cat.tone ? { tone: cat.tone } : {}) }, + stickers: st + } + updateDesign(dId, { designData }) // 本地缓存即时同步(问题4:贴纸编辑页从这里读取) + updateDesignApi(dId, { + item: { productId: cat.id, productName: cat.name, unitPrice: cat.price, count: qty, designData } + }).catch(() => {}) // 草稿静默降级:失败仅落缓存 + } + + const flushDraft = () => { + if (draftTimerRef.current) { + clearTimeout(draftTimerRef.current) + draftTimerRef.current = null + } + saveDraft() + } + + // 隐藏页面(切后台/跳转)时强制落盘,防止防抖窗口内的改动丢失 + Taro.useDidHide(flushDraft) + // 卸载时同样落盘 + useEffect(() => flushDraft, []) + // eslint-disable-next-line react-hooks/exhaustive-deps + + const skipDraftRef = useRef(true) + useEffect(() => { + if (skipDraftRef.current) { skipDraftRef.current = false; return } + if (draftTimerRef.current) clearTimeout(draftTimerRef.current) + draftTimerRef.current = setTimeout(saveDraft, 800) + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [stickers]) + // 矩形碰撞检测 const checkOverlap = (list: StickerItem[]) => { const newList = list.map(s => ({ ...s, isOverlapping: false })) @@ -217,6 +275,7 @@ export default function DIYPage() { const handleEditSticker = () => { if (!activeStickerId || !designId) return + flushDraft() // 问题4:跳编辑页前清掉防抖窗口,缓存里保证有最新贴纸 Taro.navigateTo({ url: `/pages/diy/stickerEdit/index?designId=${designId}&stickerId=${activeStickerId}` }) diff --git a/src/pages/diy/stickerEdit/index.scss b/src/pages/diy/stickerEdit/index.scss index 4425383..8e10d9f 100644 --- a/src/pages/diy/stickerEdit/index.scss +++ b/src/pages/diy/stickerEdit/index.scss @@ -226,3 +226,30 @@ .mt-20 { margin-top: 24rpx; } + +/* 空态(贴纸未找到) */ +.edit-empty { + margin: 24rpx 24rpx 0; + padding: 60rpx 40rpx; + border-radius: 24rpx; + display: flex; + flex-direction: column; + align-items: center; + gap: 24rpx; +} + +.edit-empty-title { + font-size: 32rpx; + font-weight: 600; +} + +.edit-empty-desc { + font-size: 26rpx; + opacity: 0.65; + text-align: center; +} + +.edit-empty .btn-primary { + padding: 16rpx 60rpx; + border-radius: 44rpx; +} diff --git a/src/pages/diy/stickerEdit/index.tsx b/src/pages/diy/stickerEdit/index.tsx index aecd3b7..03c9507 100644 --- a/src/pages/diy/stickerEdit/index.tsx +++ b/src/pages/diy/stickerEdit/index.tsx @@ -90,6 +90,7 @@ export default function StickerEditPage() { const [designId, setDesignId] = useState('') const [stickerId, setStickerId] = useState('') const [sticker, setSticker] = useState(null) + const [notFound, setNotFound] = useState(false) // 编辑参数 const [brightness, setBrightness] = useState(0) @@ -152,6 +153,9 @@ export default function StickerEditPage() { setHue((st.edits && st.edits.hue) || 0) setContrast((st.edits && st.edits.contrast) || 0) initCanvas(st) + } else { + // 问题4 留意点:找不到贴纸时给出空态,而不是停在空白 Canvas + setNotFound(true) } }, [initCanvas]) @@ -312,6 +316,29 @@ export default function StickerEditPage() { const hPct = `${((hue + 180) / 360) * 100}%` const cPct = `${((contrast + 100) / 200) * 100}%` + if (notFound) { + return ( + + + + + + Taro.navigateBack()}>← + 编辑贴纸 + + + + 未找到该贴纸 + 贴纸可能已被删除,请返回工作台重新添加 + Taro.navigateBack()}> + 返回工作台 + + + + + ) + } + return (