From b33ce05d52e97fdce1e7c40b7b176807dfdfd528 Mon Sep 17 00:00:00 2001 From: Timi Date: Fri, 5 Dec 2025 12:40:19 +0800 Subject: [PATCH] support dark mode --- .gitignore | 4 +- miniprogram/app.json | 30 +++--- miniprogram/app.wxss | 1 + miniprogram/assets/icon/dark/info.png | Bin 0 -> 1199 bytes miniprogram/assets/icon/dark/info_active.png | Bin 0 -> 1264 bytes miniprogram/assets/icon/dark/journal.png | Bin 0 -> 504 bytes .../assets/icon/dark/journal_active.png | Bin 0 -> 569 bytes miniprogram/assets/icon/dark/moment.png | Bin 0 -> 1409 bytes .../assets/icon/dark/moment_active.png | Bin 0 -> 1673 bytes miniprogram/assets/icon/dark/portfolio.png | Bin 0 -> 1386 bytes .../assets/icon/dark/portfolio_active.png | Bin 0 -> 1648 bytes miniprogram/assets/icon/dark/travel.png | Bin 0 -> 1508 bytes .../assets/icon/dark/travel_active.png | Bin 0 -> 1853 bytes miniprogram/assets/icon/{ => light}/info.png | Bin .../assets/icon/{ => light}/info_active.png | Bin .../assets/icon/{ => light}/journal.png | Bin .../icon/{ => light}/journal_active.png | Bin .../assets/icon/{ => light}/moment.png | Bin .../assets/icon/{ => light}/moment_active.png | Bin .../assets/icon/{ => light}/portfolio.png | Bin .../icon/{ => light}/portfolio_active.png | Bin .../assets/icon/{ => light}/travel.png | Bin .../assets/icon/{ => light}/travel_active.png | Bin .../background/snowflake/index.less | 5 +- .../components/background/snowflake/index.ts | 2 - miniprogram/config/index.ts | 2 +- miniprogram/pages/index/index.less | 16 +-- miniprogram/pages/main/about/index.less | 30 +++--- .../pages/main/journal-creater/index.less | 6 +- miniprogram/pages/main/journal/index.less | 65 +++-------- miniprogram/pages/main/journal/index.ts | 1 - miniprogram/pages/main/journal/index.wxml | 1 + miniprogram/pages/main/moment/index.less | 14 +-- miniprogram/pages/main/portfolio/index.less | 2 +- miniprogram/pages/main/travel/index.less | 2 +- .../pages/main/travel/luggage/index.less | 10 +- miniprogram/theme.json | 46 ++++++++ miniprogram/theme.wxss | 89 +++++++++++++++ miniprogram/utils/Theme.ts | 102 ++++++++++++++++++ 39 files changed, 317 insertions(+), 111 deletions(-) create mode 100644 miniprogram/assets/icon/dark/info.png create mode 100644 miniprogram/assets/icon/dark/info_active.png create mode 100644 miniprogram/assets/icon/dark/journal.png create mode 100644 miniprogram/assets/icon/dark/journal_active.png create mode 100644 miniprogram/assets/icon/dark/moment.png create mode 100644 miniprogram/assets/icon/dark/moment_active.png create mode 100644 miniprogram/assets/icon/dark/portfolio.png create mode 100644 miniprogram/assets/icon/dark/portfolio_active.png create mode 100644 miniprogram/assets/icon/dark/travel.png create mode 100644 miniprogram/assets/icon/dark/travel_active.png rename miniprogram/assets/icon/{ => light}/info.png (100%) rename miniprogram/assets/icon/{ => light}/info_active.png (100%) rename miniprogram/assets/icon/{ => light}/journal.png (100%) rename miniprogram/assets/icon/{ => light}/journal_active.png (100%) rename miniprogram/assets/icon/{ => light}/moment.png (100%) rename miniprogram/assets/icon/{ => light}/moment_active.png (100%) rename miniprogram/assets/icon/{ => light}/portfolio.png (100%) rename miniprogram/assets/icon/{ => light}/portfolio_active.png (100%) rename miniprogram/assets/icon/{ => light}/travel.png (100%) rename miniprogram/assets/icon/{ => light}/travel_active.png (100%) create mode 100644 miniprogram/theme.json create mode 100644 miniprogram/theme.wxss create mode 100644 miniprogram/utils/Theme.ts diff --git a/.gitignore b/.gitignore index b92f0ab..00a8080 100644 --- a/.gitignore +++ b/.gitignore @@ -58,4 +58,6 @@ cloudfunctions/**/*.log .Spotlight-V100 .Trashes ehthumbs.db -[Tt]humbs.db \ No newline at end of file +[Tt]humbs.db + +CLAUDE.md \ No newline at end of file diff --git a/miniprogram/app.json b/miniprogram/app.json index 15f2879..a4a0015 100644 --- a/miniprogram/app.json +++ b/miniprogram/app.json @@ -10,6 +10,8 @@ "pages/main/moment/index", "pages/main/journal-list/index" ], + "darkmode": true, + "themeLocation": "theme.json", "window": { "navigationStyle": "custom", "navigationBarTextStyle": "black", @@ -17,40 +19,40 @@ }, "lazyCodeLoading": "requiredComponents", "tabBar": { - "color": "#8a8a8a", - "selectedColor": "#07C160", - "backgroundColor": "#ffffff", - "borderStyle": "white", + "color": "@tabBarColor", + "selectedColor": "@tabBarSelectedColor", + "backgroundColor": "@tabBarBackgroundColor", + "borderStyle": "@tabBarBorderStyle", "list": [ { "text": "归档", "pagePath": "pages/main/journal/index", - "iconPath": "assets/icon/journal.png", - "selectedIconPath": "assets/icon/journal_active.png" + "iconPath": "@tabBarIconJournal", + "selectedIconPath": "@tabBarIconJournalActive" }, { "text": "专拍", "pagePath": "pages/main/portfolio/index", - "iconPath": "assets/icon/portfolio.png", - "selectedIconPath": "assets/icon/portfolio_active.png" + "iconPath": "@tabBarIconPortfolio", + "selectedIconPath": "@tabBarIconPortfolioActive" }, { "text": "瞬间", "pagePath": "pages/main/moment/index", - "iconPath": "assets/icon/moment.png", - "selectedIconPath": "assets/icon/moment_active.png" + "iconPath": "@tabBarIconMoment", + "selectedIconPath": "@tabBarIconMomentActive" }, { "text": "旅行", "pagePath": "pages/main/travel/index", - "iconPath": "assets/icon/travel.png", - "selectedIconPath": "assets/icon/travel_active.png" + "iconPath": "@tabBarIconTravel", + "selectedIconPath": "@tabBarIconTravelActive" }, { "text": "关于", "pagePath": "pages/main/about/index", - "iconPath": "assets/icon/info.png", - "selectedIconPath": "assets/icon/info_active.png" + "iconPath": "@tabBarIconInfo", + "selectedIconPath": "@tabBarIconInfoActive" } ] }, diff --git a/miniprogram/app.wxss b/miniprogram/app.wxss index 099cf50..a4856d8 100644 --- a/miniprogram/app.wxss +++ b/miniprogram/app.wxss @@ -1,2 +1,3 @@ /**app.wxss**/ +@import "./theme.wxss"; @import "./tdesign.wxss"; \ No newline at end of file diff --git a/miniprogram/assets/icon/dark/info.png b/miniprogram/assets/icon/dark/info.png new file mode 100644 index 0000000000000000000000000000000000000000..7582c179efdf4f89a85551105a8ab72b512d5a7b GIT binary patch literal 1199 zcmV;g1W@~lP)Jy zUAlBBqh6$)#+WTVkdJa)4@M%)KPcEg+Kdw~A)?e{Og_A0e2leUyesgF(r(+6Z3k zMO_WDBt+#gs&|6tCT*TCaA#I@?@|!80I)d#IH^_MQ$d!1=$bOazP*8kK;8t;(I9g} zOfs``TJ1e2L?xI|2Y|CAxpnAb>W~W}od946By9n)aSGN4fRU1JOF-s;=mKmG0HGAf zA`taS0m8^1%5^NnC8IbUK1WU%z>oOLQiTXWgPA%?qd4Cp3%FrA^z=L4TavVuN{cbA z7Xi4hKAX^t_vpsTDVH`X*Y4JxTdt&-mgruMzpJlK9kT03=zC#Ma}WvBuJpjhFNStd zi)kGdX5ItML3FRezlDZU)S`dzjfpob+r2mb3nUC^)7&k9uF@ zrefK>ju7b5A&A=9Zr8f0RIRh^?b0EL_CXJ9drvxo7|#zFQL!zN6U@}C*2pHu&0A1{ngc&}1`4`6{8w(=we#6F!b1$05oARk1w z@>Jf&p+#1nrGS{0NV5@NM=b61L2QfJs84Dx;A)A>#L`Y5#1AV^xt&xdvhp8NK+J;$ zNdLi3tT?ho)2EWc`CFsH^Yj@G9T4-i&%FxkCqCApMXeCd@q769s)V{=24K$;3b-UZM1*yBq;^nvWmcE5m%O=RSiNp4HdQwk!?@mC{J zMqX}4Ej?FBh~t%(jCO0xW=g)+x7t%_h@4(X+wBEA5F@+C6!pUj^JP7kI@fY zybpglr65na3i5CrqaW5vnsNJ8SFJOq@Tzr3Uq8{_M_9IgB8D=v&hf_ zT**@sp$9oaO;tOj;=eFB5=2{MrC0d7EMwZu53{=QrAwDCUAmN2{{gn(d>GAN8r=W@ N002ovPDHLkV1je7Hyr=~ literal 0 HcmV?d00001 diff --git a/miniprogram/assets/icon/dark/info_active.png b/miniprogram/assets/icon/dark/info_active.png new file mode 100644 index 0000000000000000000000000000000000000000..04e20d65c7477b7373904d508e1a8ce967ecf009 GIT binary patch literal 1264 zcmVI&>(ZPTWCj?UFu_lb)GlolKj${9F53W%TVvr_(L6dqE@s zp8%*f&5>!-D;9uyZ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x?>k4{m8%_vs|f z;qAz9aA8)G61dpV!RBJ3u!vC*A*Aq2Wchk&&(llx?u+)^C0jLlO^0`{@W!(@S_;ih z{8C$Ia?bhA^d8?$N__vSGktnCBkKhlcj8y_?>Dd2qgS{5pR!5mUiKVz0scwr+U^1M zD=c!nX2EY4RG(pNcCzb++FN6;V>dC}aHXo}N#N~v?#ThK4JS?gxcS>L3u&O3%F_xD z&Ay2e2Inx`jBJEJZP(^&7SDOxuXtAV>-4z2`5Uy!tL0wQaf|;Z{W`CN3&n0ONIDuE vRrN6DQtF$yRa-B7>kj_o=Fh-jAUc1_Y%M`A%NzN?7-jHu^>bP0l+XkKeUH_v literal 0 HcmV?d00001 diff --git a/miniprogram/assets/icon/dark/journal_active.png b/miniprogram/assets/icon/dark/journal_active.png new file mode 100644 index 0000000000000000000000000000000000000000..c0211c79c054de7ebce4d40b032e6c3ed26738b2 GIT binary patch literal 569 zcmeAS@N?(olHy`uVBq!ia0vp^fgsGm1|(PYdzmpXFfn+#IEGZrd3$H0*Wmz(qaTaA zTfJnhL{`mMxMR2Fi)nY&3)bW-luU10{NPnuEyMi<&NYIZH=NX8DlBo%lwrwq%qXh< zWP0)Q?Be3X^XpDO4RUaCaXED~wNk_PGF!vvru|EEZZWu>+j(;t`(`(mhH{33W%olh zgBje<<@$x3{&=bN`}2^?Hm{p2mHx3yyMH&Yo;Uj|!ur{L>I;v?t&S;>QGLPRb?>-JlGVJHirKAV)oY{5 zW*NRZ`hIbtn!!)iT@NgP{Ea}RSzjlIch~wTslDLWIhGY}a*n0TV?hTBkx;_Ws3%aW z`z=cRSm(h~@x{y?vzN!pI4lugtoW*Y@1pM)Erd0c8ZT;|bIunRpZeVG`u`rk!hcU< zkI7?m_lhT`LgI7m)OW~jy0?98R-7`Yozkt{96+0=?s0omkXB@?q8+QOcmZsvk`T~j z?8J|Gk9-(QI`0RvaWl-f8Bp5th{an^LB{Ts5t)Aum literal 0 HcmV?d00001 diff --git a/miniprogram/assets/icon/dark/moment.png b/miniprogram/assets/icon/dark/moment.png new file mode 100644 index 0000000000000000000000000000000000000000..913b15517e1638a443eeeae966dcaa3ee4a28055 GIT binary patch literal 1409 zcmV-{1%CR8P)zvV!ea##{xV2--Ex4A)qMcl*J^GUG0M(uh zQjth7=j3+W7|?v@`{Y6~f44%Z>OODr5s*EI$oT6_D-=ftneUL;_I5T|kCu zT}H&d=m2PVs^R$#f4Sc0L z>DNLAb|OAjmQ!H-DEv+$&jn6vVOlK^Qf>{VFMLHVt`#^jXXCWsH zLWS!D=Ib)cYC|40#P1L0vvqvwYWN^?jtPai26ixC|7t@%Jj8#)^#44;zlM?wJ`&0D z$6A#m%nAI0A!08WhD=Fhjd*>eU4LhuIW@5s;oxP;090@jnFYB>EHO2)4)F*aQDI7? zLMF4$MWP%)A2H!2G?;!(vuI-u5=%_`5;@@+6O6f8tAz3Zjp zNK}@;$smt0B~m$KMMMq~$@1r#my{+=?r3q4nnWeSU1E77ScEC1u+$_{;`~p6+<*J{ zPI4%vu+${72vcHtK5)v+pOr)|CU#ah*XDRRz~_|0a%f`E+HGVg z%ip9HmV?C3@)Ndh$JmY%nFsheNMz(SX*++$lV~C%--M}LIZQcY^bfhd&K;)OSR&1& ztXhzn3^|85ADDh6KM{9%K$>wDEd=}|vgLO!SnmL1KBN7KW2Q|oCM^3|*qbyynGH-O?T-M#Xw&=f+jvHKbYnba#g$;B z*#RMC%-|!@895>tMq}h5OM=nNa%X;gtXNLaS_GdtuP#_e0K-)LNdLt{`jq=8X)QvC zIj2SgV}b-@&V=Q45yowAVwbE`H<0Cb{`(2tDVw{qChJMKX<5!PjPmWBvcHR>U>WIN zec~EeJnsb+5@~6i$XhdeLXZfvE7H<9(N2(j0sN$}>)rSwEs-cs6sbeSc|0ftPN^-C z*op8@(?(g}#ustTob7}PKV%&l^U338De~HtE`;ePo?!;I&yE(;?(5$W&vm8C+5`mS zjyq8A1W90nJ>yfyPJR0{fljbP|13_PY-nYiy(ErA+UTE<$WqTiF-i0Zc@`pTN8OYw z?okq<-Iwt6t`>U`M|$2>X}xe>Fb0Xx{u5EPew_PqNc$CHu?{Y*4RL%R_zyNRrnA%C zdb1@5;Wo}4r`seLJ8!MqOX66t5@F|)$0u9wW1ZBpvG@MO27#-C*G-;NFwFcwgAG$| zIqsBIxS0#>$s{otC%seF2eRC&^$reyEU@s8T}Fq5w;Nx$aN)v*3sLbu+3@;HsX}mj P00000NkvXXu0mjfT3e1U literal 0 HcmV?d00001 diff --git a/miniprogram/assets/icon/dark/moment_active.png b/miniprogram/assets/icon/dark/moment_active.png new file mode 100644 index 0000000000000000000000000000000000000000..220c3eedb0cf0212915e634f9ab1ed67ca6b0423 GIT binary patch literal 1673 zcmV;426p+0P)nT9 zSP;M!S6p$$6;}iV`5rQJh_prhyR3ijtY>iip)$7ImwSO`L$}}~(FoN zzOF~-yMxh_$g(5j??RrB%)O^hokUJ0(ISqhV7> z+&US^8B{ukTY88LLZVCHb_SJADUo_AiSm~b2tKIr)~UDbBQZO}=aUm&4{wTZ3j;to z&s-kP!)ldIvHk^4TXo-$mBghJez~|cW`=yHR{5J+4vcQsSD?+uC;CYIYxxU&{qk)R z{=6#9z%w)SKq3n?>)ff*eI!cD|2iPkp9s6&qASvWJqg$^nQ3MDdSr}s1t25*DD_ee-&UMNv}1#Tel@tLzK30- zv#|UobV+LI+k;yK8Uoe?tf|7{{ZZ5Vqb90wPZjQopqR1om6tPY^Fq1lg@Cd1@kQuT zXIq3fXfK0Cqb6|cJT?Tpl#hBfFb#nWOFqoq#MpEO!tUA%B3if+&aIt;!b>2bcz@LQ zmsGrz+LVuaMHLp*T+a&zo+3$PCx)nVkX^aFP{JjUfc5)>Znf-Ce3I!BnL%6Aq^Yp$ z?@cqAB=QZk9VTEMO6|NvI{C#!5)$(_wQLL`gd%Xi)h3c5Q>k?l5}BJD{8Lo87Zox!86D9{tSu(u7$yog(z__7HbhOeP9craNvx`dNez)#7r;kzSys^qtMrA4P9o8% zFYK5o2Sq8h0iB4n^N)oTeWL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CToI-NVv8!|*Ge(}B{Vp7@)^Z`C+dtq&a9~KMIS_N ztaGC|sWf{}lF{Fu#@v`YOVztm9}4+&{k?~b5~T6q@g^DgAd1EXg3%TH*7mOvI4}5y zv)gDW63S~xNgHEMEV^hI=aUW@#GY8bv$Rtu$>7Sw0=oV?7myF4cIs3=j6;i@x|R%L zGLeE7-$z>7=z};^3*&rJA%iOu_eo0|eGtE#I+c!uskZ-IkyHPY3}Q|!K)v6ME%K(t z)Z9LJMJ`cIa!a#bLf2MUx-mNb$3!1J^Ff7UY#9e}b;wpG4n>ZLU#@?`{%mTo%-{j# z{}?n*{bN_lnRvsFf+~EJNyx@FF+;|}vDxD4zQAb@L_VawtE4hPa`nc4z{to8?n@tF zDTycrB3QtEg+QfXt;V_Z9&lDQ4lc}cMeyi;wijZ{9Mw4DHp9jZP?BoKqgY>E4n$(k z`bt6DzS>B5t*LvTOwamU^u-mk$g{)pEcK4Me+vnZv#z~huIJY;%m%U$twHvQk!Ky-G?+hA*H7%YFNWh~J*EYqkmN^~~=v z9h^)fmj9JSKB;TAHP$Ogd(rZ|a+3sL--ElgarWeAt*+u3@|lJ2SHESS1JQyUS%>Wb zAmo&m?avr$lMB&;=0C+aOQHW8c_^Soc9%(7iF*Vo% z#g~0qG1Y`5(Fgiz6a9CR53XlC4wW!v$gc=n z?YwHXjj-?eiJ1G`n|Z)=Ikpk{&;UMex7)&}Z{d4MX-qrviS6MAl(_*(Bk$pp1kZAj zSzDhyRA4B_48ta37{;p47_wWXb^5rUT)2+%bYolI;2*LY%VGYEryCO<&w;q#BUAF} s#@|H^*ulCW?iV3&q3Y75OE07U0nAEc*_z&>ApigX07*qoM6N<$g1U~JEdT%j literal 0 HcmV?d00001 diff --git a/miniprogram/assets/icon/dark/portfolio_active.png b/miniprogram/assets/icon/dark/portfolio_active.png new file mode 100644 index 0000000000000000000000000000000000000000..6dd6e9fc5a93fe9ae960462ee36dfdd853cfd7bd GIT binary patch literal 1648 zcmV-$29NoPP)EE>prt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};Y?H$;%$ z4PFJLQvkY@V{=2)K++3$yroTv}Rlbll@?rWA_4-9D9uxH#P^PSd>KRD>7uqd#(PO(nisXApk5(_>oTT;9R< zM+^n*TIh?%9_gC&Z3S@j?PwK@fjGL@(R0000< KMNUMnLSTY3PT@oV literal 0 HcmV?d00001 diff --git a/miniprogram/assets/icon/dark/travel_active.png b/miniprogram/assets/icon/dark/travel_active.png new file mode 100644 index 0000000000000000000000000000000000000000..72ba0d62c082c74da40d3889f2cdfde9391daefa GIT binary patch literal 1853 zcmV-D2g3M?P)dyo80g-V1sEE?vUBlDaVS-uP4&M+-YM{z!+7dk5lUf_3 zPl!}wXgDW$atitE37+s8)7uxsPysMn0C1{NIcN&f2SnK@p6;7BFcZk0!e(obt|2xu zX3nX$?Jglwg%NZC;8aO+A0{?^a0QV(0e~iuqz#CX)Nr@}Fq))Z6_73<$^fGUfZz+H z7l`2#1qiNQl!vwut3+`o$Rj5Vz%%>P@+d?AL@4Q_DvGmW*+37)(9?mvZI4C_#eNY0 z1DgYFN20hR2C!#q*&|ehJlf8X^p#~l)*XrR**LCaS)1wtq>IyD7pJ`%hl~9qNM@l? zWe^FHaDJvCT7EE8MHxIkKA7sP#32? ze*K=}kAJAu0qY$$1&tdvD<7|&(k6(ng!~X5p5dA#k2O6eem(zaKx zT;?PIJdC<24rfL~@cUmh%k!O$;RkmoeT4j_0|L!;vCOe#V$JO-%F0Oy(^Yqk>*B01 zY8^NfQB2wPU3Jh ztU`t5$1BjI0s7O$+n9@#pE&fU>K9PJ-=2g<%UP!IVshXp|}8|_vd z)e~RQ_ELzt>CA*Yabd|6U{f3(f7twCFW4PC z3wB@hl?88Z2_Ikf`FIp{5mQx>S%>0uZ77Qfd8R606WJ!EB`PWdn!w!O(_cS-d!^c2 zSR1+tHrR@(cIqI;-pmk`z@+i*>d8R@^y>qxcUbm2zqktJW4ZtlF9(i-4JOgD0&^LO zDkVVQ41?`&^K0A9Es>}6{oRoiZFd%Iun|-3)Ik)VO%T_Xm_?bmb$|C$;kHf=HdMO1 zsV5@jmCtN!91GC=A9k!Y1sI-x5@*{YG|#~Xl|q|Bwh)yUcwY)Ozsaw2!jx_y*dR*| zI1E*VOb}yXJ8WuAHBnY@FxNjO*Fpcm23ety*S2SJEaFrlXn9H}3+_~ZPstpD4S?l? zIupd$P+xee0v{DnRpM_(XcUp0xF1dgssYqRx59*Zj9B_L1AZ_-+eP_1^=Nwji$Yh<^O< z_XE%EL{k5(|9hYcM51WOcgIqQoUHMPwg@oNm2CXW9mu$nV8DEfS7@l z8}&I#d?w0gW$cS9h^odX{PB&*$^czM1XoXk#{x1`01R!8bq!Gkl0O2F1BJ~4+v9ye z)PbDv7T1xMiE#CoNqSZ4@dXil@xMkwx%zW6v}#>GA!cVH^j{7 zfx>8>?k6q6)7cRgLe_4};H0@HT10)PdSgTPG00000NkvXXu0mjf(sgOO literal 0 HcmV?d00001 diff --git a/miniprogram/assets/icon/info.png b/miniprogram/assets/icon/light/info.png similarity index 100% rename from miniprogram/assets/icon/info.png rename to miniprogram/assets/icon/light/info.png diff --git a/miniprogram/assets/icon/info_active.png b/miniprogram/assets/icon/light/info_active.png similarity index 100% rename from miniprogram/assets/icon/info_active.png rename to miniprogram/assets/icon/light/info_active.png diff --git a/miniprogram/assets/icon/journal.png b/miniprogram/assets/icon/light/journal.png similarity index 100% rename from miniprogram/assets/icon/journal.png rename to miniprogram/assets/icon/light/journal.png diff --git a/miniprogram/assets/icon/journal_active.png b/miniprogram/assets/icon/light/journal_active.png similarity index 100% rename from miniprogram/assets/icon/journal_active.png rename to miniprogram/assets/icon/light/journal_active.png diff --git a/miniprogram/assets/icon/moment.png b/miniprogram/assets/icon/light/moment.png similarity index 100% rename from miniprogram/assets/icon/moment.png rename to miniprogram/assets/icon/light/moment.png diff --git a/miniprogram/assets/icon/moment_active.png b/miniprogram/assets/icon/light/moment_active.png similarity index 100% rename from miniprogram/assets/icon/moment_active.png rename to miniprogram/assets/icon/light/moment_active.png diff --git a/miniprogram/assets/icon/portfolio.png b/miniprogram/assets/icon/light/portfolio.png similarity index 100% rename from miniprogram/assets/icon/portfolio.png rename to miniprogram/assets/icon/light/portfolio.png diff --git a/miniprogram/assets/icon/portfolio_active.png b/miniprogram/assets/icon/light/portfolio_active.png similarity index 100% rename from miniprogram/assets/icon/portfolio_active.png rename to miniprogram/assets/icon/light/portfolio_active.png diff --git a/miniprogram/assets/icon/travel.png b/miniprogram/assets/icon/light/travel.png similarity index 100% rename from miniprogram/assets/icon/travel.png rename to miniprogram/assets/icon/light/travel.png diff --git a/miniprogram/assets/icon/travel_active.png b/miniprogram/assets/icon/light/travel_active.png similarity index 100% rename from miniprogram/assets/icon/travel_active.png rename to miniprogram/assets/icon/light/travel_active.png diff --git a/miniprogram/components/background/snowflake/index.less b/miniprogram/components/background/snowflake/index.less index 4e3e09d..dcb05c8 100644 --- a/miniprogram/components/background/snowflake/index.less +++ b/miniprogram/components/background/snowflake/index.less @@ -28,12 +28,13 @@ page { display: block; position: absolute; animation: fall linear infinite; - + &::before, &::after { content: ''; position: absolute; - background: rgba(255, 122, 155, .8); + background: var(--theme-brand-gao); + opacity: .8; } &::before { diff --git a/miniprogram/components/background/snowflake/index.ts b/miniprogram/components/background/snowflake/index.ts index 9f1d0bf..0c47e33 100644 --- a/miniprogram/components/background/snowflake/index.ts +++ b/miniprogram/components/background/snowflake/index.ts @@ -36,8 +36,6 @@ Component({ docHeight: systemInfo.windowHeight, timer: setInterval(() => { this.createSnowflake(); - console.log(this.data.snowflakes); - if (40 < this.data.snowflakes.length) { if (this.data.timer) { clearInterval(this.data.timer); diff --git a/miniprogram/config/index.ts b/miniprogram/config/index.ts index 1c64fb6..b1ff8d6 100644 --- a/miniprogram/config/index.ts +++ b/miniprogram/config/index.ts @@ -1,6 +1,6 @@ const envArgs = { develop: { - url: "http://localhost:8091" + url: "https://api.imyeyu.com" }, trial: { url: "https://api.imyeyu.com" diff --git a/miniprogram/pages/index/index.less b/miniprogram/pages/index/index.less index 7f7fdc2..23e0809 100644 --- a/miniprogram/pages/index/index.less +++ b/miniprogram/pages/index/index.less @@ -29,28 +29,28 @@ page { height: 128px; display: block; border-radius: 4px; - box-shadow: 2px 2px 8px rgba(0, 0, 0, .2); + box-shadow: 2px 2px 8px var(--theme-shadow-medium); margin-bottom: 1rem; } - + .name { margin: 0 .5rem; display: inline-block; - + &.gao { - color: #FF7A9B; + color: var(--theme-brand-gao); } - + &.yeyu { - color: #7A9BFF; + color: var(--theme-brand-yeyu); } } } .password { width: 20rem; - border-top: 1px solid rgba(0, 0, 0, .1); - border-bottom: 1px solid rgba(0, 0, 0, .1); + border-top: 1px solid var(--theme-border-light); + border-bottom: 1px solid var(--theme-border-light); } .enter { diff --git a/miniprogram/pages/main/about/index.less b/miniprogram/pages/main/about/index.less index 543101b..e28985e 100644 --- a/miniprogram/pages/main/about/index.less +++ b/miniprogram/pages/main/about/index.less @@ -29,35 +29,35 @@ page { height: 128px; display: block; border-radius: 4px; - box-shadow: 2px 2px 8px rgba(0, 0, 0, .2); + box-shadow: 2px 2px 8px var(--theme-shadow-medium); margin-bottom: 1rem; } - + .name { margin: 0 .5rem; display: inline-block; - + &.gao { - color: #FF7A9B; + color: var(--theme-brand-gao); } - + &.yeyu { - color: #7A9BFF; + color: var(--theme-brand-yeyu); } } } .text { - color: #777; + color: var(--theme-text-secondary); font-size: 12px; text-align: center; .love { color: transparent; font-size: 1rem; - animation: loveGradient 1500ms linear infinite; + animation: loveGradient 1000ms linear infinite; text-align: center; - background: linear-gradient(90deg, #FFB5C7, #FF7A9B, #FF3A6B, #FF7A9B, #FFB5C7); + background: linear-gradient(90deg, var(--theme-brand-gao-light), var(--theme-brand-gao), var(--theme-brand-gao-dark), var(--theme-brand-gao), var(--theme-brand-gao-light)); font-weight: bold; font-family: "Arial", sans-serif; margin-bottom: 1rem; @@ -66,7 +66,7 @@ page { -webkit-background-clip: text; -webkit-text-fill-color: transparent; } - + @keyframes loveGradient { 0% { background-position: 0% 50%; @@ -83,19 +83,19 @@ page { flex-direction: column; .exit { - color: #E64340; + color: var(--theme-error); width: 10rem; margin-bottom: 1rem; } - + .item { font-size: 14px; text-align: center; - + .label { - color: #777; + color: var(--theme-text-secondary); } - + &.copyright { display: flex; font-size: 12px; diff --git a/miniprogram/pages/main/journal-creater/index.less b/miniprogram/pages/main/journal-creater/index.less index a4c399e..fbf53a8 100644 --- a/miniprogram/pages/main/journal-creater/index.less +++ b/miniprogram/pages/main/journal-creater/index.less @@ -10,7 +10,7 @@ flex-direction: column; .label { - color: #777; + color: var(--theme-text-secondary); } .section { @@ -47,8 +47,8 @@ height: 200rpx; position: relative; overflow: hidden; - background: #FFF; - box-shadow: 1px 1px 6px rgba(0, 0, 0, .1); + background: var(--theme-bg-card); + box-shadow: 1px 1px 6px var(--theme-shadow-light); border-radius: 2rpx; .thumbnail { diff --git a/miniprogram/pages/main/journal/index.less b/miniprogram/pages/main/journal/index.less index b670f84..7c6fb21 100644 --- a/miniprogram/pages/main/journal/index.less +++ b/miniprogram/pages/main/journal/index.less @@ -1,55 +1,20 @@ .custom-navbar { - .more { - width: 24px; - height: 18px; - position: relative; - - &::before { - content: ""; - top: calc(50% - 1px); - width: 100%; - height: 2px; - position: absolute; - background: rgba(0, 0, 0, .8); - } - - &::after { - content: ""; - top: 0; - width: 100%; - height: calc(100% - 4px); - position: absolute; - border-top: 2px solid rgba(0, 0, 0, .8); - border-bottom: 2px solid rgba(0, 0, 0, .8); - } - } - .more-menu { top: 0; left: 0; width: 100%; height: 100%; position: fixed; - background: rgba(0, 0, 0, .1); + background: var(--theme-bg-overlay); .content { - margin: 200rpx 0 0 12rpx; + margin: 190rpx 0 0 12rpx; z-index: 1; position: fixed; - background: rgba(255, 255, 255, .95); + background: var(--theme-bg-menu); + box-shadow: 0 0 12px var(--theme-shadow-medium); border-radius: 2px; - box-shadow: 0 0 12px rgba(0, 0, 0, .2); - - &::before { - content: ""; - margin: -10rpx 0 0 24rpx; - border-top: 24rpx solid rgba(255, 255, 255, .95); - border-left: 24rpx solid transparent; - z-index: 1; - position: fixed; - transform: rotate(-45deg); - } } } } @@ -86,8 +51,8 @@ padding: 8px 16px; margin: .5rem 1rem 1rem 1rem; position: relative; - background: #FFF8E1; - box-shadow: 0 2px 10px rgba(0, 0, 0, .2); + background: var(--theme-bg-journal); + box-shadow: 0 2px 10px var(--theme-shadow-medium); border-radius: 2px; // 纸张纹理效果 @@ -100,17 +65,17 @@ bottom: 0; background: linear-gradient(90deg, - rgba(255, 255, 255, 0) 0%, - rgba(255, 255, 255, 0.3) 50%, - rgba(255, 255, 255, 0) 100%), - linear-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 1px), - linear-gradient(90deg, rgba(0, 0, 0, 0.03) 1px, transparent 1px); + var(--theme-texture-light) 0%, + var(--theme-texture-bright) 50%, + var(--theme-texture-light) 100%), + linear-gradient(var(--theme-texture-line) 1px, transparent 1px), + linear-gradient(90deg, var(--theme-texture-line) 1px, transparent 1px); pointer-events: none; background-size: 100% 100%, 10px 10px, 10px 10px; } .location { - color: #777; + color: var(--theme-text-secondary); text-align: right; } } @@ -122,7 +87,7 @@ .item { overflow: hidden; - background: #FFF; + background: var(--theme-bg-card); break-inside: avoid; margin-bottom: .25rem; @@ -144,7 +109,7 @@ position: absolute; transform: translate(-50%, -50%); border-top: 16px solid transparent; - border-left: 24px solid rgba(255, 255, 255, .9); + border-left: 24px solid var(--theme-video-play); border-bottom: 16px solid transparent; pointer-events: none; } @@ -154,7 +119,7 @@ } .start { - color: #777; + color: var(--theme-text-secondary); padding: 1rem 0; font-size: 12px; text-align: center; diff --git a/miniprogram/pages/main/journal/index.ts b/miniprogram/pages/main/journal/index.ts index 36e6313..3142f1a 100644 --- a/miniprogram/pages/main/journal/index.ts +++ b/miniprogram/pages/main/journal/index.ts @@ -3,7 +3,6 @@ import Time from "../../../utils/Time"; import config from "../../../config/index" import Events from "../../../utils/Events"; -import Toolkit from "../../../utils/Toolkit"; export type Journal = { date: string; diff --git a/miniprogram/pages/main/journal/index.wxml b/miniprogram/pages/main/journal/index.wxml index 1daa159..b885197 100644 --- a/miniprogram/pages/main/journal/index.wxml +++ b/miniprogram/pages/main/journal/index.wxml @@ -1,6 +1,7 @@ + diff --git a/miniprogram/pages/main/moment/index.less b/miniprogram/pages/main/moment/index.less index ff876b9..c6681c5 100644 --- a/miniprogram/pages/main/moment/index.less +++ b/miniprogram/pages/main/moment/index.less @@ -36,7 +36,7 @@ } .text { - color: #777; + color: var(--theme-text-secondary); display: flex; font-size: .8rem; justify-content: space-between; @@ -55,14 +55,14 @@ width: 100%; display: block; overflow: hidden; - background: #FFF; + background: var(--theme-bg-card); break-inside: avoid; margin-bottom: .25rem; &.video { height: auto; position: relative; - + &::after { content: ""; top: 50%; @@ -72,7 +72,7 @@ position: absolute; transform: translate(-50%, -50%); border-top: 16px solid transparent; - border-left: 24px solid rgba(255, 255, 255, .9); + border-left: 24px solid var(--theme-video-play); border-bottom: 16px solid transparent; pointer-events: none; } @@ -95,7 +95,7 @@ height: 16px; z-index: 1; position: absolute; - background: #FFF; + background: var(--theme-bg-card); border-radius: 50%; } } @@ -131,7 +131,7 @@ } &.confirm { - color: #07C160; + color: var(--theme-success); } } } @@ -144,7 +144,7 @@ margin-top: 1.5rem; .label { - color: #777; + color: var(--theme-text-secondary); } &.type { diff --git a/miniprogram/pages/main/portfolio/index.less b/miniprogram/pages/main/portfolio/index.less index 165c649..39d5cd6 100644 --- a/miniprogram/pages/main/portfolio/index.less +++ b/miniprogram/pages/main/portfolio/index.less @@ -11,7 +11,7 @@ .item { overflow: hidden; - background: #FFF; + background: var(--theme-bg-card); break-inside: avoid; margin-bottom: .25rem; diff --git a/miniprogram/pages/main/travel/index.less b/miniprogram/pages/main/travel/index.less index d22de1c..a3a74d9 100644 --- a/miniprogram/pages/main/travel/index.less +++ b/miniprogram/pages/main/travel/index.less @@ -15,7 +15,7 @@ width: 100%; display: block; overflow: hidden; - background: #FFF; + background: var(--theme-bg-card); break-inside: avoid; margin-bottom: .25rem; } diff --git a/miniprogram/pages/main/travel/luggage/index.less b/miniprogram/pages/main/travel/luggage/index.less index 05dfea5..1ad6ed1 100644 --- a/miniprogram/pages/main/travel/luggage/index.less +++ b/miniprogram/pages/main/travel/luggage/index.less @@ -1,7 +1,7 @@ .luggage { .tips { - color: #777; + color: var(--theme-text-secondary); margin: .5rem 0; font-size: 12px; text-align: center; @@ -19,7 +19,7 @@ flex: 1; margin: 0; - border: 3rpx solid #CCC; + border: 3rpx solid var(--theme-text-disabled); position: relative; overflow: hidden; box-sizing: border-box; @@ -68,13 +68,13 @@ .add-container { left: 0; right: 0; - color: #333; + color: var(--theme-text-primary); bottom: 0; display: flex; padding: 20rpx; position: fixed; - border-top: 1px solid rgba(0, 0, 0, .1); - background: rgba(240, 240, 240, .8); + border-top: 1px solid var(--theme-border-light); + background: var(--theme-bg-secondary); box-sizing: border-box; align-items: center; padding-bottom: calc(20rpx + env(safe-area-inset-bottom)); diff --git a/miniprogram/theme.json b/miniprogram/theme.json new file mode 100644 index 0000000..3dfaf9b --- /dev/null +++ b/miniprogram/theme.json @@ -0,0 +1,46 @@ +{ + "light": { + "navigationBarBackgroundColor": "#FFFFFF", + "navigationBarTextStyle": "black", + "backgroundColor": "#FFFFFF", + "backgroundTextStyle": "dark", + "backgroundColorTop": "#FFFFFF", + "backgroundColorBottom": "#FFFFFF", + "tabBarColor": "#8a8a8a", + "tabBarSelectedColor": "#07C160", + "tabBarBackgroundColor": "#ffffff", + "tabBarBorderStyle": "white", + "tabBarIconJournal": "assets/icon/light/journal.png", + "tabBarIconJournalActive": "assets/icon/light/journal_active.png", + "tabBarIconPortfolio": "assets/icon/light/portfolio.png", + "tabBarIconPortfolioActive": "assets/icon/light/portfolio_active.png", + "tabBarIconMoment": "assets/icon/light/moment.png", + "tabBarIconMomentActive": "assets/icon/light/moment_active.png", + "tabBarIconTravel": "assets/icon/light/travel.png", + "tabBarIconTravelActive": "assets/icon/light/travel_active.png", + "tabBarIconInfo": "assets/icon/light/info.png", + "tabBarIconInfoActive": "assets/icon/light/info_active.png" + }, + "dark": { + "navigationBarBackgroundColor": "#1A1A1A", + "navigationBarTextStyle": "white", + "backgroundColor": "#1A1A1A", + "backgroundTextStyle": "light", + "backgroundColorTop": "#1A1A1A", + "backgroundColorBottom": "#1A1A1A", + "tabBarColor": "#aaaaaa", + "tabBarSelectedColor": "#07C160", + "tabBarBackgroundColor": "#1A1A1A", + "tabBarBorderStyle": "black", + "tabBarIconJournal": "assets/icon/dark/journal.png", + "tabBarIconJournalActive": "assets/icon/dark/journal_active.png", + "tabBarIconPortfolio": "assets/icon/dark/portfolio.png", + "tabBarIconPortfolioActive": "assets/icon/dark/portfolio_active.png", + "tabBarIconMoment": "assets/icon/dark/moment.png", + "tabBarIconMomentActive": "assets/icon/dark/moment_active.png", + "tabBarIconTravel": "assets/icon/dark/travel.png", + "tabBarIconTravelActive": "assets/icon/dark/travel_active.png", + "tabBarIconInfo": "assets/icon/dark/info.png", + "tabBarIconInfoActive": "assets/icon/dark/info_active.png" + } +} diff --git a/miniprogram/theme.wxss b/miniprogram/theme.wxss new file mode 100644 index 0000000..e654787 --- /dev/null +++ b/miniprogram/theme.wxss @@ -0,0 +1,89 @@ +/** + * 全局主题变量定义 + * 支持浅色和深色两种模式 + */ + +/* 浅色模式变量 */ +page { + /* === 背景色 === */ + --theme-bg-primary: #FFFFFF; + --theme-bg-secondary: #F5F5F5; + --theme-bg-card: #FFFFFF; + --theme-bg-journal: #FFF8E1; + --theme-bg-overlay: rgba(0, 0, 0, .1); + --theme-bg-menu: rgba(255, 255, 255, .95); + + /* === 文字颜色 === */ + --theme-text-primary: #000000; + --theme-text-secondary: #777777; + --theme-text-tertiary: #999999; + --theme-text-disabled: #CCCCCC; + + /* === 边框颜色 === */ + --theme-border-light: rgba(0, 0, 0, .1); + --theme-border-medium: rgba(0, 0, 0, .2); + --theme-border-dark: rgba(0, 0, 0, .8); + + /* === 阴影颜色 === */ + --theme-shadow-light: rgba(0, 0, 0, .1); + --theme-shadow-medium: rgba(0, 0, 0, .2); + --theme-shadow-dark: rgba(0, 0, 0, .3); + + /* === 品牌色(不随主题改变) === */ + --theme-brand-gao: #FF7A9B; + --theme-brand-yeyu: #7A9BFF; + --theme-brand-gao-light: #FFB5C7; + --theme-brand-gao-dark: #FF3A6B; + + /* === 功能色 === */ + --theme-error: #E64340; + --theme-success: #07C160; + --theme-warning: #FFC107; + + /* === 纸张纹理效果 === */ + --theme-texture-light: rgba(255, 255, 255, 0); + --theme-texture-bright: rgba(255, 255, 255, .3); + --theme-texture-line: rgba(0, 0, 0, .03); + + /* === 视频播放按钮 === */ + --theme-video-play: rgba(255, 255, 255, .9); +} + +/* 深色模式变量 */ +page[data-weui-theme="dark"] { + /* === 背景色 === */ + --theme-bg-primary: #1A1A1A; + --theme-bg-secondary: #2A2A2A; + --theme-bg-card: #2C2C2C; + --theme-bg-journal: #3A3A2E; + --theme-bg-overlay: rgba(0, 0, 0, .3); + --theme-bg-menu: rgba(40, 40, 40, .95); + + /* === 文字颜色 === */ + --theme-text-primary: #FFFFFF; + --theme-text-secondary: #AAAAAA; + --theme-text-tertiary: #888888; + --theme-text-disabled: #666666; + + /* === 边框颜色 === */ + --theme-border-light: rgba(255, 255, 255, .1); + --theme-border-medium: rgba(255, 255, 255, .2); + --theme-border-dark: rgba(255, 255, 255, .6); + + /* === 阴影颜色 === */ + --theme-shadow-light: rgba(0, 0, 0, .3); + --theme-shadow-medium: rgba(0, 0, 0, .5); + --theme-shadow-dark: rgba(0, 0, 0, .7); + + /* === 品牌色保持不变 === */ + + /* === 功能色保持不变 === */ + + /* === 纸张纹理效果(深色模式调整) === */ + --theme-texture-light: rgba(0, 0, 0, 0); + --theme-texture-bright: rgba(255, 255, 255, .05); + --theme-texture-line: rgba(255, 255, 255, .02); + + /* === 视频播放按钮 === */ + --theme-video-play: rgba(200, 200, 200, .8); +} diff --git a/miniprogram/utils/Theme.ts b/miniprogram/utils/Theme.ts new file mode 100644 index 0000000..7f39edf --- /dev/null +++ b/miniprogram/utils/Theme.ts @@ -0,0 +1,102 @@ +/** + * 主题管理工具类 + * 负责主题切换、主题状态监听和主题信息获取 + */ + +/** 主题模式枚举 */ +export enum ThemeMode { + /** 浅色模式 */ + LIGHT = 'light', + /** 深色模式 */ + DARK = 'dark' +} + +/** 主题变化回调函数类型 */ +type ThemeChangeCallback = (theme: ThemeMode) => void + +class Theme { + /** 主题变化监听器列表 */ + private listeners: ThemeChangeCallback[] = [] + + /** 当前主题模式 */ + private currentTheme: ThemeMode = ThemeMode.LIGHT + + constructor() { + this.init() + } + + /** + * 初始化主题管理器 + * 获取系统当前主题并监听主题变化 + */ + private init(): void { + // 获取系统信息,判断当前主题 + const systemInfo = wx.getSystemInfoSync() + this.currentTheme = systemInfo.theme === 'dark' ? ThemeMode.DARK : ThemeMode.LIGHT + + // 监听主题变化事件 + wx.onThemeChange((result) => { + const newTheme = result.theme === 'dark' ? ThemeMode.DARK : ThemeMode.LIGHT + this.currentTheme = newTheme + this.notifyListeners(newTheme) + }) + } + + /** + * 获取当前主题模式 + * @returns 当前主题模式 + */ + getTheme(): ThemeMode { + return this.currentTheme + } + + /** + * 判断是否为深色模式 + * @returns 是否为深色模式 + */ + isDark(): boolean { + return this.currentTheme === ThemeMode.DARK + } + + /** + * 判断是否为浅色模式 + * @returns 是否为浅色模式 + */ + isLight(): boolean { + return this.currentTheme === ThemeMode.LIGHT + } + + /** + * 监听主题变化 + * @param callback 主题变化时的回调函数 + * @returns 取消监听的函数 + */ + onChange(callback: ThemeChangeCallback): () => void { + this.listeners.push(callback) + + // 返回取消监听的函数 + return () => { + const index = this.listeners.indexOf(callback) + if (index > -1) { + this.listeners.splice(index, 1) + } + } + } + + /** + * 通知所有监听器主题已变化 + * @param theme 新的主题模式 + */ + private notifyListeners(theme: ThemeMode): void { + this.listeners.forEach(callback => { + try { + callback(theme) + } catch (error) { + console.error('主题变化监听器执行出错:', error) + } + }) + } +} + +// 导出单例 +export default new Theme()