Browse Source

优化细节

master
科技小王子 1 month ago
parent
commit
3693b2d5ed
  1. 1
      package.json
  2. 322
      pnpm-lock.yaml
  3. 8
      src/api/cms/cmsAd/index.ts
  4. 4
      src/api/system/file/index.ts
  5. 12
      src/app.config.ts
  6. 4
      src/cms/about.config.ts
  7. 7
      src/cms/about.tsx
  8. 3
      src/cms/article.config.ts
  9. 51
      src/cms/article.tsx
  10. 25
      src/cms/category/components/ArticleList.tsx
  11. 54
      src/cms/category/components/ArticleTabs.tsx
  12. 31
      src/cms/category/components/Banner.tsx
  13. 4
      src/cms/category/index.config.ts
  14. 0
      src/cms/category/index.scss
  15. 78
      src/cms/category/index.tsx
  16. 4
      src/cms/detail.scss
  17. 96
      src/cms/detail.tsx
  18. 0
      src/cms/detail/index.config.ts
  19. 50
      src/cms/detail/index.scss
  20. 74
      src/cms/detail/index.tsx
  21. 3
      src/cms/help.config.ts
  22. 45
      src/cms/help.tsx
  23. 4
      src/components/GoodsList.tsx
  24. 1
      src/pages/cart/cart.tsx
  25. 2
      src/pages/index/Banner.tsx
  26. 2
      src/pages/index/BestSellers.tsx
  27. 0
      src/pages/index/GoodsList.scss
  28. 67
      src/pages/index/GoodsList.tsx
  29. 6
      src/pages/index/Header.tsx
  30. 2
      src/pages/index/Login.tsx
  31. 23
      src/pages/index/Menu.tsx
  32. 14
      src/pages/index/index.tsx
  33. 6
      src/pages/user/components/OrderIcon.tsx
  34. 2
      src/pages/user/components/UserCard.tsx
  35. 31
      src/shop/category/components/Banner.tsx
  36. 0
      src/shop/category/components/GoodsList.scss
  37. 51
      src/shop/category/components/GoodsList.tsx
  38. 4
      src/shop/category/index.config.ts
  39. 0
      src/shop/category/index.scss
  40. 78
      src/shop/category/index.tsx
  41. 2
      src/shop/goodsDetail/index.tsx
  42. 2
      src/shop/orderConfirm/index.tsx
  43. 2
      src/shop/orderDetail/index.tsx
  44. 2
      src/user/about/index.config.ts
  45. 83
      src/user/about/index.tsx
  46. 185
      src/user/address/add.tsx
  47. 94
      src/user/address/index.tsx
  48. 129
      src/user/address/wxAddress.tsx
  49. 51
      src/user/help/index.tsx
  50. 2
      src/user/profile/profile.tsx
  51. 6
      src/user/userVerify/index.tsx
  52. 2
      src/utils/config.ts
  53. 3
      src/utils/request.ts
  54. 2
      src/utils/server.ts

1
package.json

@ -39,6 +39,7 @@
"dependencies": {
"@babel/runtime": "^7.26.0",
"@nutui/icons-react-taro": "^2.0.1",
"@nutui/nutui-biz": "1.0.0-beta.2",
"@nutui/nutui-react": "^3.0.16",
"@nutui/nutui-react-taro": "^2.7.4",
"@tarojs/components": "4.0.8",

322
pnpm-lock.yaml

@ -14,6 +14,9 @@ importers:
'@nutui/icons-react-taro':
specifier: ^2.0.1
version: 2.0.1
'@nutui/nutui-biz':
specifier: 1.0.0-beta.2
version: 1.0.0-beta.2(mobx@6.13.7)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
'@nutui/nutui-react':
specifier: ^3.0.16
version: 3.0.16(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
@ -784,6 +787,9 @@ packages:
resolution: {integrity: sha512-ETyHEk2VHHvl9b9jZP5IHPavHYk57EhanlRRuae9XCpb/j5bDCbPPMOBfCWhnl/7EDJz0jEMCi/RhccCE8r1+Q==}
engines: {node: '>=6.9.0'}
'@bem-react/classname@1.7.0':
resolution: {integrity: sha512-WNZAJEVNHFpQ1eyR3SKxXUDHaXbTyMieFfC65tqEGvGxx9pMcaKf65v/IINdDBe6xIt6WgGu0EHgFQ5KH4lwZQ==}
'@cspotcode/source-map-support@0.8.1':
resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==, tarball: https://registry.npmmirror.com/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz}
engines: {node: '>=12'}
@ -1054,11 +1060,27 @@ packages:
'@nutui/lottie-miniprogram@1.0.2':
resolution: {integrity: sha512-6xV+uW8VK1hT8QfjqfNlURTiQijb/dEEl/AeOudMwOB55Fr2+TdxoOAks5d8vnYBTYDZyOUlcsGNgoAkXKz8Qg==}
'@nutui/nutui-biz@1.0.0-beta.2':
resolution: {integrity: sha512-rU+a6LRafxaoT6eGCR5mgKF0Bm9A4G2gimgw1gGj8U8Ln2W6Nyvs9sQKtZZftuvzQXmtZOO7uHoHZ4sg6rLbhw==}
engines: {node: ^14.18.0 || >=15.0.0}
peerDependencies:
react: ^16.8.0 || ^17.0.0 || ^18.0.0
'@nutui/nutui-react-taro@1.5.13':
resolution: {integrity: sha512-vENBS4WLenb3HxUruTfHlkBKOTLWKFwuaKVczs2TUfU0D8yFHvS2FISX8f3iNlHUslG+TIlyKVIH/yBlMjzzWA==}
peerDependencies:
react: ^16.8.0 || ^17.0.0 || ^18.0.0
'@nutui/nutui-react-taro@2.7.4':
resolution: {integrity: sha512-r47l2rkY5HbObyTHxt2ZCTMKolM+v9CxX7QwSQGyuVRCi5G5cwPbSEz3NucvWGyZ69NaD3XA4Oc2LumLhaHmGg==, tarball: https://registry.npmmirror.com/@nutui/nutui-react-taro/-/nutui-react-taro-2.7.4.tgz}
peerDependencies:
react: ^16.8.0 || ^17.0.0 || ^18.0.0
'@nutui/nutui-react@1.5.13':
resolution: {integrity: sha512-3UPhPTMMHQdv0aEVQ+gcv2A3MLvldyKTEeizlAS5YgRxplrvVy2oFOfItzUmxwc+zKZd6noUYp1cSr/cq9w8Tw==}
peerDependencies:
react: ^16.8.0 || ^17.0.0 || ^18.0.0
'@nutui/nutui-react@3.0.16':
resolution: {integrity: sha512-lTGGHwRCBCdN8Yn64q7uASK2LAtMOyGkWjeuzir5w3jpsJGFvbVDq1lKwlIBWc8iFeSfSWHh8nOO739V66m2XQ==}
peerDependencies:
@ -1752,6 +1774,9 @@ packages:
'@types/glob@7.2.0':
resolution: {integrity: sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==, tarball: https://registry.npmmirror.com/@types/glob/-/glob-7.2.0.tgz}
'@types/hast@2.3.10':
resolution: {integrity: sha512-McWspRw8xx8J9HurkVBfYj0xKoE25tOFlHGdx4MJ5xORQrMGZNqJhVQWaIbm6Oyla5kYOXtDiopzKRJzEOkwJw==}
'@types/hast@3.0.4':
resolution: {integrity: sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==}
@ -1815,6 +1840,9 @@ packages:
'@types/parse-json@4.0.2':
resolution: {integrity: sha512-dISoDXWWQwUquiKsyZ4Ng+HX2KsPL7LyHKHQwgGFEA3IaKac4Obd+h2a/a6waisAoepJlBcx9paWqjA8/HVjCw==, tarball: https://registry.npmmirror.com/@types/parse-json/-/parse-json-4.0.2.tgz}
'@types/parse5@6.0.3':
resolution: {integrity: sha512-SuT16Q1K51EAVPz1K29DJ/sXjhSQ0zjvsypYJ6tlwVsRV9jwW5Adq2ch8Dq8kDBCkYnELS7N7VNCSB5nC56t/g==}
'@types/postcss-url@10.0.4':
resolution: {integrity: sha512-5QIO9NgbWmAkle65haRqkdgYPCOXheNsaFdbTJJQjT302yK3H49ql4t9a4y0NfpuPtU/UBo15VcV64WCSIMJKg==, tarball: https://registry.npmmirror.com/@types/postcss-url/-/postcss-url-10.0.4.tgz}
@ -3882,18 +3910,33 @@ packages:
resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==, tarball: https://registry.npmmirror.com/hasown/-/hasown-2.0.2.tgz}
engines: {node: '>= 0.4'}
hast-util-from-parse5@7.1.2:
resolution: {integrity: sha512-Nz7FfPBuljzsN3tCQ4kCBKqdNhQE2l0Tn+X1ubgKBPRoiDIu1mL08Cfw4k7q71+Duyaw7DXDN+VTAp4Vh3oCOw==}
hast-util-is-element@3.0.0:
resolution: {integrity: sha512-Val9mnv2IWpLbNPqc/pUem+a7Ipj2aHacCwgNfTiK0vJKl0LF+4Ba4+v1oPHFpf3bLYmreq0/l3Gud9S5OH42g==}
hast-util-parse-selector@3.1.1:
resolution: {integrity: sha512-jdlwBjEexy1oGz0aJ2f4GKMaVKkA9jwjr4MjAAI22E5fM/TXVZHuS5OpONtdeIkRKqAaryQ2E9xNQxijoThSZA==}
hast-util-raw@7.2.3:
resolution: {integrity: sha512-RujVQfVsOrxzPOPSzZFiwofMArbQke6DJjnFfceiEbFh7S05CbPt0cYN+A5YeD3pso0JQk6O1aHBnx9+Pm2uqg==}
hast-util-to-jsx-runtime@2.3.6:
resolution: {integrity: sha512-zl6s8LwNyo1P9uw+XJGvZtdFF1GdAkOg8ujOw+4Pyb76874fLps4ueHXDhXWdk6YHQ6OgUtinliG7RsYvCbbBg==}
hast-util-to-parse5@7.1.0:
resolution: {integrity: sha512-YNRgAJkH2Jky5ySkIqFXTQiaqcAtJyVE+D5lkN6CdtOqrnkLfGYYrEcKuHOJZlp+MwjSwuD3fZuawI+sic/RBw==}
hast-util-to-text@4.0.2:
resolution: {integrity: sha512-KK6y/BN8lbaq654j7JgBydev7wuNMcID54lkRav1P0CaE1e47P72AWWPiGKXTJU271ooYzcvTAn/Zt0REnvc7A==}
hast-util-whitespace@3.0.0:
resolution: {integrity: sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==}
hastscript@7.2.0:
resolution: {integrity: sha512-TtYPq24IldU8iKoJQqvZOuhi5CyCQRAbvDOX0x1eW6rsHSxa/1i2CCiptNTotGHJ3VoHRGmqiv6/D3q113ikkw==}
he@1.2.0:
resolution: {integrity: sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==, tarball: https://registry.npmmirror.com/he/-/he-1.2.0.tgz}
hasBin: true
@ -3917,6 +3960,9 @@ packages:
hls.js@1.5.18:
resolution: {integrity: sha512-znxR+2jecWluu/0KOBqUcvVyAB5tLff10vjMGrpAlz1eFY+ZhF1bY3r82V+Bk7WJdk03iTjtja9KFFz5BrqjSA==, tarball: https://registry.npmmirror.com/hls.js/-/hls.js-1.5.18.tgz}
hoist-non-react-statics@3.3.2:
resolution: {integrity: sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==}
homedir-polyfill@1.0.3:
resolution: {integrity: sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA==}
engines: {node: '>=0.10.0'}
@ -3958,6 +4004,9 @@ packages:
html-url-attributes@3.0.1:
resolution: {integrity: sha512-ol6UPyBWqsrO6EJySPz2O7ZSr856WDrEzM5zMqp+FJJLGMW35cLYmmZnl0vztAZxRUoNZJFTCohfjuIJ8I4QBQ==}
html-void-elements@2.0.1:
resolution: {integrity: sha512-0quDb7s97CfemeJAnW9wC0hw78MtW7NU3hqtCD75g2vFlDLt36llsYD7uB7SUzojLMP24N5IatXf7ylGXiGG9A==}
html-webpack-plugin@5.6.3:
resolution: {integrity: sha512-QSf1yjtSAsmf7rYBV7XX86uua4W/vkhIt0xNXKbsi2foEeW7vjJQz4bhnpL3xH+l1ryl1680uNv968Z+X6jSYg==, tarball: https://registry.npmmirror.com/html-webpack-plugin/-/html-webpack-plugin-5.6.3.tgz}
engines: {node: '>=10.13.0'}
@ -4373,6 +4422,9 @@ packages:
resolution: {integrity: sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==, tarball: https://registry.npmmirror.com/is-wsl/-/is-wsl-2.2.0.tgz}
engines: {node: '>=8'}
isarray@0.0.1:
resolution: {integrity: sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==}
isarray@1.0.0:
resolution: {integrity: sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==, tarball: https://registry.npmmirror.com/isarray/-/isarray-1.0.0.tgz}
@ -5035,6 +5087,22 @@ packages:
mobile-detect@1.4.5:
resolution: {integrity: sha512-yc0LhH6tItlvfLBugVUEtgawwFU2sIe+cSdmRJJCTMZ5GEJyLxNyC/NIOAOGk67Fa8GNpOttO3Xz/1bHpXFD/g==, tarball: https://registry.npmmirror.com/mobile-detect/-/mobile-detect-1.4.5.tgz}
mobx-react-lite@3.4.3:
resolution: {integrity: sha512-NkJREyFTSUXR772Qaai51BnE1voWx56LOL80xG7qkZr6vo8vEaLF3sz1JNUVh+rxmUzxYaqOhfuxTfqUh0FXUg==}
peerDependencies:
mobx: ^6.1.0
react: ^16.8.0 || ^17 || ^18
react-dom: '*'
react-native: '*'
peerDependenciesMeta:
react-dom:
optional: true
react-native:
optional: true
mobx@6.13.7:
resolution: {integrity: sha512-aChaVU/DO5aRPmk1GX8L+whocagUUpBQqoPtJk+cm7UOXUk87J4PeWCh6nNmTTIfEhiR9DI/+FnA8dln/hTK7g==}
move-concurrently@1.0.1:
resolution: {integrity: sha512-hdrFxZOycD/g6A6SoI2bB5NA/5NEqD0569+S47WZhPvm46sD50ZHdYaFmnua5lndde9rCHGjmfK7Z8BuCt/PcQ==}
deprecated: This package is no longer supported.
@ -5400,6 +5468,9 @@ packages:
path-to-regexp@0.1.12:
resolution: {integrity: sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==, tarball: https://registry.npmmirror.com/path-to-regexp/-/path-to-regexp-0.1.12.tgz}
path-to-regexp@1.9.0:
resolution: {integrity: sha512-xIp7/apCFJuUHdDLWe8O1HIkb0kQrOMb/0u6FXQjemHn/ii5LrIzU6bdECnsiTF/GjZkMEKg1xdiZwNqDYlZ6g==}
path-to-regexp@3.3.0:
resolution: {integrity: sha512-qyCH421YQPS2WFDxDjftfc1ZR5WKQzVzqsp4n9M2kQhVOo/ByahFoUNJfl58kOcEGfQ//7weFTDhm+ss8Ecxgw==}
@ -5814,6 +5885,9 @@ packages:
property-expr@2.0.6:
resolution: {integrity: sha512-SVtmxhRE/CGkn3eZY1T6pC8Nln6Fr/lu1mKSgRud0eC73whjGfoAogbn78LkD8aFL0zz3bAFerKSnOl7NlErBA==, tarball: https://registry.npmmirror.com/property-expr/-/property-expr-2.0.6.tgz}
property-information@6.5.0:
resolution: {integrity: sha512-PgTgs/BlvHxOu8QuEN7wi5A0OmXaBcHpmCSTehcs6Uuu9IkDIEo13Hy7n898RHfrQ49vKCoGeWZSaAK01nwVig==}
property-information@7.0.0:
resolution: {integrity: sha512-7D/qOz/+Y4X/rzSB6jKxKUsQnphO046ei8qxG59mtM3RG3DHgTK81HrxrmoDVINJb8NKT5ZsRbwHvQ6B68Iyhg==}
@ -5939,6 +6013,11 @@ packages:
resolution: {integrity: sha512-F27qZr8uUqwhWZboondsPx8tnC3Ct3SxZA3V5WyEvujRyyNv0VYPhoBg1gZ8/MV5tubQp76Trw8lTv9hzRBa+A==, tarball: https://registry.npmmirror.com/react-refresh/-/react-refresh-0.11.0.tgz}
engines: {node: '>=0.10.0'}
react-router-dom@5.3.4:
resolution: {integrity: sha512-m4EqFMHv/Ih4kpcBCONHbkT68KoAeHN4p3lAGoNryfHi0dMy0kCzEZakiKRsvg5wHZ/JLrLW8o8KomWiz/qbYQ==}
peerDependencies:
react: '>=15'
react-router-dom@7.1.1:
resolution: {integrity: sha512-vSrQHWlJ5DCfyrhgo0k6zViOe9ToK8uT5XGSmnuC2R3/g261IdIMpZVqfjD6vWSXdnf5Czs4VA/V60oVR6/jnA==, tarball: https://registry.npmmirror.com/react-router-dom/-/react-router-dom-7.1.1.tgz}
engines: {node: '>=20.0.0'}
@ -5946,6 +6025,11 @@ packages:
react: '>=18'
react-dom: '>=18'
react-router@5.3.4:
resolution: {integrity: sha512-Ys9K+ppnJah3QuaRiLxk+jDWOR1MekYQrlytiXxC1RyfbdsZkS5pvKAzCCr031xHixZwpnsYNT5xysdFHQaYsA==}
peerDependencies:
react: '>=15'
react-router@7.1.1:
resolution: {integrity: sha512-39sXJkftkKWRZ2oJtHhCxmoCrBCULr/HAH4IT5DHlgu/Q0FCPV0S4Lx+abjDTx/74xoZzNYDYbOZWlJjruyuDQ==, tarball: https://registry.npmmirror.com/react-router/-/react-router-7.1.1.tgz}
engines: {node: '>=20.0.0'}
@ -6056,6 +6140,9 @@ packages:
rehype-highlight@7.0.2:
resolution: {integrity: sha512-k158pK7wdC2qL3M5NcZROZ2tR/l7zOzjxXd5VGdcfIyoijjQqpHd3JKtYSBDpDZ38UI2WJWuFAtkMDxmx5kstA==}
rehype-raw@6.1.1:
resolution: {integrity: sha512-d6AKtisSRtDRX4aSPsJGTfnzrX2ZkHQLE5kiUuGOeEoLpbEulFF4hj0mLPbsa+7vmguDKOVVEQdHKDSwoaIDsQ==}
relateurl@0.2.7:
resolution: {integrity: sha512-G08Dxvm4iDN3MLM0EsP62EDV9IuhXPR6blNz6Utcp7zyV3tr4HVNINt6MpaRWbxoOHT3Q7YN2P+jaHX8vUbgog==, tarball: https://registry.npmmirror.com/relateurl/-/relateurl-0.2.7.tgz}
engines: {node: '>= 0.10'}
@ -6953,6 +7040,9 @@ packages:
resolution: {integrity: sha512-lRfVq8fE8gz6QMBuDM6a+LO3IAzTi05H6gCVaUpir2E1Rwpo4ZUog45KpNXKC/Mn3Yb9UDuHumeFTo9iV/D9FQ==, tarball: https://registry.npmmirror.com/unicorn-magic/-/unicorn-magic-0.1.0.tgz}
engines: {node: '>=18'}
unified@10.1.2:
resolution: {integrity: sha512-pUSWAi/RAnVy1Pif2kAoeWNBa3JVrx0MId2LASj8G+7AiHWoKZNTomq6LG326T68U7/e263X6fTdcXIy7XnF7Q==}
unified@11.0.5:
resolution: {integrity: sha512-xKvGhPWw3k84Qjh8bI3ZeJjqnyadK+GEFtazSfZv/rKeTkTjOJho6mFqh2SM96iIcZokxiOpg78GazTSg8+KHA==}
@ -6969,18 +7059,33 @@ packages:
unist-util-find-after@5.0.0:
resolution: {integrity: sha512-amQa0Ep2m6hE2g72AugUItjbuM8X8cGQnFoHk0pGfrFeT9GZhzN5SW8nRsiGKK7Aif4CrACPENkA6P/Lw6fHGQ==}
unist-util-is@5.2.1:
resolution: {integrity: sha512-u9njyyfEh43npf1M+yGKDGVPbY/JWEemg5nH05ncKPfi+kBbKBJoTdsogMu33uhytuLlv9y0O7GH7fEdwLdLQw==}
unist-util-is@6.0.0:
resolution: {integrity: sha512-2qCTHimwdxLfz+YzdGfkqNlH0tLi9xjTnHddPmJwtIG9MGsdbutfTc4P+haPD7l7Cjxf/WZj+we5qfVPvvxfYw==}
unist-util-position@4.0.4:
resolution: {integrity: sha512-kUBE91efOWfIVBo8xzh/uZQ7p9ffYRtUbMRZBNFYwf0RK8koUMx6dGUfwylLOKmaT2cs4wSW96QoYUSXAyEtpg==}
unist-util-position@5.0.0:
resolution: {integrity: sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA==}
unist-util-stringify-position@3.0.3:
resolution: {integrity: sha512-k5GzIBZ/QatR8N5X2y+drfpWG8IDBzdnVj6OInRNWm1oXrzydiaAT2OQiA8DPRRZyAKb9b6I2a6PxYklZD0gKg==}
unist-util-stringify-position@4.0.0:
resolution: {integrity: sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ==}
unist-util-visit-parents@5.1.3:
resolution: {integrity: sha512-x6+y8g7wWMyQhL1iZfhIPhDAs7Xwbn9nRosDXl7qoPTSCy0yNxnKc+hWokFifWQIDGi154rdUqKvbCa4+1kLhg==}
unist-util-visit-parents@6.0.1:
resolution: {integrity: sha512-L/PqWzfTP9lzzEa6CKs0k2nARxTdZduw3zyh8d2NVBnsyvHjSX4TWse388YrrQKbvI8w20fGjGlhgT96WwKykw==}
unist-util-visit@4.1.2:
resolution: {integrity: sha512-MSd8OUGISqHdVvfY9TPhyK2VdUrPgxkUtWSuMHF6XAAFuL4LokseigBnZtPnJMu+FbynTkFNnFlyjxpVKujMRg==}
unist-util-visit@5.0.0:
resolution: {integrity: sha512-MR04uvD+07cwl/yhVuVWAtw+3GOR/knlL55Nd/wAdblk27GCVt3lqpTivy/tkJcZoNPzTwS1Y+KMojlLDhoTzg==}
@ -7087,9 +7192,18 @@ packages:
resolution: {integrity: sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==, tarball: https://registry.npmmirror.com/vary/-/vary-1.1.2.tgz}
engines: {node: '>= 0.8'}
vfile-location@4.1.0:
resolution: {integrity: sha512-YF23YMyASIIJXpktBa4vIGLJ5Gs88UB/XePgqPmTa7cDA+JeO3yclbpheQYCHjVHBn/yePzrXuygIL+xbvRYHw==}
vfile-message@3.1.4:
resolution: {integrity: sha512-fa0Z6P8HUrQN4BZaX05SIVXic+7kE3b05PWAtPuYP9QLHsLKYR7/AlLW3NtOrpXRLeawpDLMsVkmk5DG0NXgWw==}
vfile-message@4.0.2:
resolution: {integrity: sha512-jRDZ1IMLttGj41KcZvlrYAaI3CfqpLpfpf+Mfig13viT6NKvRzWZ+lXz0Y5D60w6uJIBAOGq9mSHf0gktF0duw==}
vfile@5.3.7:
resolution: {integrity: sha512-r7qlzkgErKjobAmyNIkkSpizsFPYiUPuJb5pNW1RB4JcYVZhs4lIbVqk8XPk033CV/1z8ss5pkax8SuhGpcG8g==}
vfile@6.0.3:
resolution: {integrity: sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==}
@ -7121,6 +7235,9 @@ packages:
wcwidth@1.0.1:
resolution: {integrity: sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==, tarball: https://registry.npmmirror.com/wcwidth/-/wcwidth-1.0.1.tgz}
web-namespaces@2.0.1:
resolution: {integrity: sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ==}
webidl-conversions@7.0.0:
resolution: {integrity: sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==, tarball: https://registry.npmmirror.com/webidl-conversions/-/webidl-conversions-7.0.0.tgz}
engines: {node: '>=12'}
@ -8141,6 +8258,8 @@ snapshots:
'@babel/helper-validator-identifier': 7.27.1
optional: true
'@bem-react/classname@1.7.0': {}
'@cspotcode/source-map-support@0.8.1':
dependencies:
'@jridgewell/trace-mapping': 0.3.9
@ -8361,6 +8480,39 @@ snapshots:
'@nutui/lottie-miniprogram@1.0.2': {}
'@nutui/nutui-biz@1.0.0-beta.2(mobx@6.13.7)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)':
dependencies:
'@babel/runtime': 7.26.0
'@bem-react/classname': 1.7.0
'@nutui/nutui-react': 1.5.13(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
'@nutui/nutui-react-taro': 1.5.13(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
'@react-spring/web': 9.6.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
'@use-gesture/react': 10.2.20(react@18.3.1)
classnames: 2.5.1
mobx-react-lite: 3.4.3(mobx@6.13.7)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
react: 18.3.1
react-router-dom: 5.3.4(react@18.3.1)
react-transition-group: 4.4.5(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
rehype-raw: 6.1.1
transitivePeerDependencies:
- mobx
- react-dom
- react-native
'@nutui/nutui-react-taro@1.5.13(react-dom@18.3.1(react@18.3.1))(react@18.3.1)':
dependencies:
'@babel/runtime': 7.26.0
'@bem-react/classname': 1.7.0
'@react-spring/web': 9.6.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
'@use-gesture/react': 10.2.20(react@18.3.1)
async-validator: 4.2.5
classnames: 2.5.1
lodash.kebabcase: 4.1.1
react: 18.3.1
react-transition-group: 4.4.5(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
transitivePeerDependencies:
- react-dom
'@nutui/nutui-react-taro@2.7.4(react-dom@18.3.1(react@18.3.1))(react@18.3.1)':
dependencies:
'@babel/runtime': 7.26.0
@ -8378,6 +8530,20 @@ snapshots:
transitivePeerDependencies:
- react-dom
'@nutui/nutui-react@1.5.13(react-dom@18.3.1(react@18.3.1))(react@18.3.1)':
dependencies:
'@babel/runtime': 7.26.0
'@bem-react/classname': 1.7.0
'@react-spring/web': 9.6.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
'@use-gesture/react': 10.2.20(react@18.3.1)
async-validator: 4.2.5
classnames: 2.5.1
lodash.kebabcase: 4.1.1
react: 18.3.1
react-transition-group: 4.4.5(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
transitivePeerDependencies:
- react-dom
'@nutui/nutui-react@3.0.16(react-dom@18.3.1(react@18.3.1))(react@18.3.1)':
dependencies:
'@babel/runtime': 7.26.0
@ -9198,6 +9364,10 @@ snapshots:
'@types/minimatch': 5.1.2
'@types/node': 18.19.68
'@types/hast@2.3.10':
dependencies:
'@types/unist': 2.0.11
'@types/hast@3.0.4':
dependencies:
'@types/unist': 3.0.3
@ -9258,6 +9428,8 @@ snapshots:
'@types/parse-json@4.0.2': {}
'@types/parse5@6.0.3': {}
'@types/postcss-url@10.0.4':
dependencies:
'@types/node': 18.19.68
@ -11854,10 +12026,38 @@ snapshots:
dependencies:
function-bind: 1.1.2
hast-util-from-parse5@7.1.2:
dependencies:
'@types/hast': 2.3.10
'@types/unist': 2.0.11
hastscript: 7.2.0
property-information: 6.5.0
vfile: 5.3.7
vfile-location: 4.1.0
web-namespaces: 2.0.1
hast-util-is-element@3.0.0:
dependencies:
'@types/hast': 3.0.4
hast-util-parse-selector@3.1.1:
dependencies:
'@types/hast': 2.3.10
hast-util-raw@7.2.3:
dependencies:
'@types/hast': 2.3.10
'@types/parse5': 6.0.3
hast-util-from-parse5: 7.1.2
hast-util-to-parse5: 7.1.0
html-void-elements: 2.0.1
parse5: 6.0.1
unist-util-position: 4.0.4
unist-util-visit: 4.1.2
vfile: 5.3.7
web-namespaces: 2.0.1
zwitch: 2.0.4
hast-util-to-jsx-runtime@2.3.6:
dependencies:
'@types/estree': 1.0.7
@ -11878,6 +12078,15 @@ snapshots:
transitivePeerDependencies:
- supports-color
hast-util-to-parse5@7.1.0:
dependencies:
'@types/hast': 2.3.10
comma-separated-tokens: 2.0.3
property-information: 6.5.0
space-separated-tokens: 2.0.2
web-namespaces: 2.0.1
zwitch: 2.0.4
hast-util-to-text@4.0.2:
dependencies:
'@types/hast': 3.0.4
@ -11889,6 +12098,14 @@ snapshots:
dependencies:
'@types/hast': 3.0.4
hastscript@7.2.0:
dependencies:
'@types/hast': 2.3.10
comma-separated-tokens: 2.0.3
hast-util-parse-selector: 3.1.1
property-information: 6.5.0
space-separated-tokens: 2.0.2
he@1.2.0: {}
header-case@2.0.4:
@ -11915,6 +12132,10 @@ snapshots:
hls.js@1.5.18: {}
hoist-non-react-statics@3.3.2:
dependencies:
react-is: 16.13.1
homedir-polyfill@1.0.3:
dependencies:
parse-passwd: 1.0.0
@ -11964,6 +12185,8 @@ snapshots:
html-url-attributes@3.0.1: {}
html-void-elements@2.0.1: {}
html-webpack-plugin@5.6.3(webpack@5.78.0(@swc/core@1.3.96(@swc/helpers@0.5.17))):
dependencies:
'@types/html-minifier-terser': 6.1.0
@ -12360,6 +12583,8 @@ snapshots:
dependencies:
is-docker: 2.2.1
isarray@0.0.1: {}
isarray@1.0.0: {}
isarray@2.0.5: {}
@ -13164,6 +13389,15 @@ snapshots:
mobile-detect@1.4.5: {}
mobx-react-lite@3.4.3(mobx@6.13.7)(react-dom@18.3.1(react@18.3.1))(react@18.3.1):
dependencies:
mobx: 6.13.7
react: 18.3.1
optionalDependencies:
react-dom: 18.3.1(react@18.3.1)
mobx@6.13.7: {}
move-concurrently@1.0.1:
dependencies:
aproba: 1.2.0
@ -13581,6 +13815,10 @@ snapshots:
path-to-regexp@0.1.12: {}
path-to-regexp@1.9.0:
dependencies:
isarray: 0.0.1
path-to-regexp@3.3.0: {}
path-to-regexp@6.3.0: {}
@ -13935,6 +14173,8 @@ snapshots:
property-expr@2.0.6: {}
property-information@6.5.0: {}
property-information@7.0.0: {}
proto-list@1.2.4: {}
@ -14086,12 +14326,36 @@ snapshots:
react-refresh@0.11.0: {}
react-router-dom@5.3.4(react@18.3.1):
dependencies:
'@babel/runtime': 7.26.0
history: 4.10.1
loose-envify: 1.4.0
prop-types: 15.8.1
react: 18.3.1
react-router: 5.3.4(react@18.3.1)
tiny-invariant: 1.3.3
tiny-warning: 1.0.3
react-router-dom@7.1.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1):
dependencies:
react: 18.3.1
react-dom: 18.3.1(react@18.3.1)
react-router: 7.1.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
react-router@5.3.4(react@18.3.1):
dependencies:
'@babel/runtime': 7.26.0
history: 4.10.1
hoist-non-react-statics: 3.3.2
loose-envify: 1.4.0
path-to-regexp: 1.9.0
prop-types: 15.8.1
react: 18.3.1
react-is: 16.13.1
tiny-invariant: 1.3.3
tiny-warning: 1.0.3
react-router@7.1.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1):
dependencies:
'@types/cookie': 0.6.0
@ -14239,6 +14503,12 @@ snapshots:
unist-util-visit: 5.0.0
vfile: 6.0.3
rehype-raw@6.1.1:
dependencies:
'@types/hast': 2.3.10
hast-util-raw: 7.2.3
unified: 10.1.2
relateurl@0.2.7: {}
remark-parse@11.0.0:
@ -15288,6 +15558,16 @@ snapshots:
unicorn-magic@0.1.0: {}
unified@10.1.2:
dependencies:
'@types/unist': 2.0.11
bail: 2.0.2
extend: 3.0.2
is-buffer: 2.0.5
is-plain-obj: 4.1.0
trough: 2.2.0
vfile: 5.3.7
unified@11.0.5:
dependencies:
'@types/unist': 3.0.3
@ -15315,23 +15595,46 @@ snapshots:
'@types/unist': 3.0.3
unist-util-is: 6.0.0
unist-util-is@5.2.1:
dependencies:
'@types/unist': 2.0.11
unist-util-is@6.0.0:
dependencies:
'@types/unist': 3.0.3
unist-util-position@4.0.4:
dependencies:
'@types/unist': 2.0.11
unist-util-position@5.0.0:
dependencies:
'@types/unist': 3.0.3
unist-util-stringify-position@3.0.3:
dependencies:
'@types/unist': 2.0.11
unist-util-stringify-position@4.0.0:
dependencies:
'@types/unist': 3.0.3
unist-util-visit-parents@5.1.3:
dependencies:
'@types/unist': 2.0.11
unist-util-is: 5.2.1
unist-util-visit-parents@6.0.1:
dependencies:
'@types/unist': 3.0.3
unist-util-is: 6.0.0
unist-util-visit@4.1.2:
dependencies:
'@types/unist': 2.0.11
unist-util-is: 5.2.1
unist-util-visit-parents: 5.1.3
unist-util-visit@5.0.0:
dependencies:
'@types/unist': 3.0.3
@ -15433,11 +15736,28 @@ snapshots:
vary@1.1.2: {}
vfile-location@4.1.0:
dependencies:
'@types/unist': 2.0.11
vfile: 5.3.7
vfile-message@3.1.4:
dependencies:
'@types/unist': 2.0.11
unist-util-stringify-position: 3.0.3
vfile-message@4.0.2:
dependencies:
'@types/unist': 3.0.3
unist-util-stringify-position: 4.0.0
vfile@5.3.7:
dependencies:
'@types/unist': 2.0.11
is-buffer: 2.0.5
unist-util-stringify-position: 3.0.3
vfile-message: 3.1.4
vfile@6.0.3:
dependencies:
'@types/unist': 3.0.3
@ -15476,6 +15796,8 @@ snapshots:
dependencies:
defaults: 1.0.4
web-namespaces@2.0.1: {}
webidl-conversions@7.0.0: {}
webpack-chain@6.5.1:

8
src/api/cms/cmsAd/index.ts

@ -9,9 +9,7 @@ import type { CmsAd, CmsAdParam } from './model';
export async function pageCmsAd(params: CmsAdParam) {
const res = await request.get<ApiResult<PageResult<CmsAd>>>(
'/cms/cms-ad/page',
{
params
}
params
);
if (res.code === 0) {
return res.data;
@ -25,9 +23,7 @@ export async function pageCmsAd(params: CmsAdParam) {
export async function listCmsAd(params?: CmsAdParam) {
const res = await request.get<ApiResult<CmsAd[]>>(
'/cms/cms-ad',
{
params
}
params
);
if (res.code === 0 && res.data) {
return res.data;

4
src/api/system/file/index.ts

@ -21,7 +21,7 @@ export async function uploadOssByPath(filePath: string) {
let stsExpired = Taro.getStorageSync('stsExpiredAt');
if (!sts || (stsExpired && dayjs().isBefore(dayjs(stsExpired)))) {
// @ts-ignore
const {data: {data: {credentials}}} = await request.get(`https://server.websoft.top/api/oss/getSTSToken`)
const {data: {data: {credentials}}} = await request.get(`https://server.gxwebsoft.com/api/oss/getSTSToken`)
Taro.setStorageSync('sts', credentials)
Taro.setStorageSync('stsExpiredAt', credentials.expiration)
sts = credentials
@ -66,7 +66,7 @@ export async function uploadFile() {
const tempFilePath = res.tempFilePaths[0];
// 上传图片到OSS
Taro.uploadFile({
url: 'https://server.websoft.top/api/oss/upload',
url: 'https://server.gxwebsoft.com/api/oss/upload',
filePath: tempFilePath,
name: 'file',
header: {

12
src/app.config.ts

@ -1,6 +1,7 @@
export default defineAppConfig({
pages: [
'pages/index/index',
'pages/category/index',
'pages/order/order',
'pages/cart/cart',
'pages/user/user'
@ -20,10 +21,8 @@ export default defineAppConfig({
{
"root": "cms",
"pages": [
"about",
"article",
"detail",
"help"
'category/index',
"detail/index"
]
},
{
@ -37,11 +36,13 @@ export default defineAppConfig({
"address/add",
"address/wxAddress",
"help/index",
"about/index"
]
},
{
"root": "shop",
"pages": [
'category/index',
'orderDetail/index',
'goodsDetail/index',
'orderConfirm/index',
@ -88,7 +89,8 @@ export default defineAppConfig({
},
requiredPrivateInfos: [
"getLocation",
"chooseLocation"
"chooseLocation",
"chooseAddress"
],
permission: {
"scope.userLocation": {

4
src/cms/about.config.ts

@ -1,4 +0,0 @@
export default definePageConfig({
navigationBarTitleText: '关于我们',
navigationBarBackgroundColor: '#ffe0e0'
})

7
src/cms/about.tsx

@ -1,7 +0,0 @@
function About() {
return (
<div>About</div>
)
}
export default About

3
src/cms/article.config.ts

@ -1,3 +0,0 @@
export default definePageConfig({
navigationBarTitleText: '文章列表'
})

51
src/cms/article.tsx

@ -1,51 +0,0 @@
import {useEffect, useState} from "react";
import {ArrowRight} from '@nutui/icons-react-taro'
import {pageCmsArticle} from "@/api/cms/cmsArticle";
import {CmsArticle} from "@/api/cms/cmsArticle/model";
import Taro from '@tarojs/taro'
import {useRouter} from '@tarojs/taro'
/**
*
* @constructor
*/
const Article = () => {
const {params} = useRouter();
const [categoryId, setCategoryId] = useState<number>(3494)
const [list, setList] = useState<CmsArticle[]>([])
const reload = () => {
if (params.id) {
setCategoryId(Number(params.id))
}
pageCmsArticle({categoryId}).then(res => {
if (res?.list) {
setList(res?.list)
}
})
}
useEffect(() => {
reload()
}, [])
return (
<div className={'px-3 mb-10'}>
<div className={'flex flex-col justify-between items-center bg-white rounded-lg p-4'}>
<div className={'bg-white min-h-36 w-full'}>
{
list.map((item, index) => {
return (
<div key={index} className={'flex justify-between items-center py-2'} onClick={() => Taro.navigateTo({url: `/cms/help?id=${item.articleId}`}) }>
<div className={'text-sm'}>{item.title}</div>
<ArrowRight color={'#cccccc'} size={18} />
</div>
)
})
}
</div>
</div>
</div>
)
}
export default Article

25
src/cms/category/components/ArticleList.tsx

@ -0,0 +1,25 @@
import {Image, Cell} from '@nutui/nutui-react-taro'
import Taro from '@tarojs/taro'
const ArticleList = (props: any) => {
return (
<>
<div className={'px-3'}>
{props.data.map((item, index) => {
return (
<Cell
title={item.title}
extra={
<Image src={item.image} mode={'aspectFit'} lazyLoad={false} width={100} height="100"/>
}
key={index}
onClick={() => Taro.navigateTo({url: '/cms/detail/index?id=' + item.articleId})}
/>
)
})}
</div>
</>
)
}
export default ArticleList

54
src/cms/category/components/ArticleTabs.tsx

@ -0,0 +1,54 @@
import {useEffect, useState} from "react";
import {Tabs, Loading} from '@nutui/nutui-react-taro'
import {pageCmsArticle} from "@/api/cms/cmsArticle";
import {CmsArticle} from "@/api/cms/cmsArticle/model";
import ArticleList from "./ArticleList";
const ArticleTabs = (props: any) => {
const [loading, setLoading] = useState<boolean>(true)
const [tab1value, setTab1value] = useState<string | number>('0')
const [list, setList] = useState<CmsArticle[]>([])
const reload = async (value) => {
const {data} = props
pageCmsArticle({categoryId: data[value].navigationId, page: 1, limit: 10}).then((res) => {
res && setList(res?.list || [])
})
.catch(err => {
console.log(err)
})
.finally(() => {
setTab1value(value)
setLoading(false)
})
}
useEffect(() => {
reload(0).then()
}, []);
if (loading) {
return (
<Loading className={'px-2'}></Loading>
)
}
return (
<>
<Tabs
value={tab1value}
onChange={(value) => {
reload(value).then()
}}
>
{props.data?.map((item, index) => {
return (
<Tabs.TabPane title={item.categoryName} key={index}/>
)
})}
</Tabs>
<ArticleList data={list}/>
</>
)
}
export default ArticleTabs

31
src/cms/category/components/Banner.tsx

@ -0,0 +1,31 @@
import { useEffect, useState } from 'react'
import { Swiper } from '@nutui/nutui-react-taro'
import {CmsAd} from "@/api/cms/cmsAd/model";
import {Image} from '@nutui/nutui-react-taro'
import {getCmsAd} from "@/api/cms/cmsAd";
const MyPage = () => {
const [item, setItem] = useState<CmsAd>()
const reload = () => {
getCmsAd(439).then(data => {
setItem(data)
})
}
useEffect(() => {
reload()
}, [])
return (
<>
<Swiper defaultValue={0} height={item?.height} indicator style={{ height: item?.height + 'px', display: 'none' }}>
{item?.imageList?.map((item) => (
<Swiper.Item key={item}>
<Image width="100%" height="100%" src={item.url} mode={'scaleToFill'} lazyLoad={false} style={{ height: item.height + 'px' }} />
</Swiper.Item>
))}
</Swiper>
</>
)
}
export default MyPage

4
src/cms/category/index.config.ts

@ -0,0 +1,4 @@
export default definePageConfig({
navigationBarTitleText: '文章列表',
navigationBarTextStyle: 'black'
})

0
src/cms/category/index.scss

78
src/cms/category/index.tsx

@ -0,0 +1,78 @@
import Taro from '@tarojs/taro'
import {useShareAppMessage, useShareTimeline} from "@tarojs/taro"
import {Loading} from '@nutui/nutui-react-taro'
import {useEffect, useState} from "react"
import {useRouter} from '@tarojs/taro'
import {getCmsNavigation, listCmsNavigation} from "@/api/cms/cmsNavigation";
import {CmsNavigation} from "@/api/cms/cmsNavigation/model";
import {pageCmsArticle} from "@/api/cms/cmsArticle";
import {CmsArticle} from "@/api/cms/cmsArticle/model";
import ArticleList from './components/ArticleList'
import ArticleTabs from "./components/ArticleTabs";
import './index.scss'
function Category() {
const {params} = useRouter();
const [categoryId, setCategoryId] = useState<number>(0)
const [category, setCategory] = useState<CmsNavigation[]>([])
const [loading, setLoading] = useState<boolean>(true)
const [nav, setNav] = useState<CmsNavigation>()
const [list, setList] = useState<CmsArticle[]>([])
const reload = async () => {
// 1.加载远程数据
const id = Number(params.id)
const nav = await getCmsNavigation(id)
const categoryList = await listCmsNavigation({parentId: id})
const shopGoods = await pageCmsArticle({categoryId: id})
// 2.赋值
setCategoryId(id)
setNav(nav)
setList(shopGoods?.list || [])
setCategory(categoryList)
Taro.setNavigationBarTitle({
title: `${nav?.categoryName}`
})
};
useEffect(() => {
reload().then(() => {
setLoading(false)
})
}, []);
useShareTimeline(() => {
return {
title: `${nav?.categoryName}_时里院子市集`,
path: `/shop/category/index?id=${categoryId}`
};
});
useShareAppMessage(() => {
return {
title: `${nav?.categoryName}_时里院子市集`,
path: `/shop/category/index?id=${categoryId}`,
success: function (res) {
console.log('分享成功', res);
},
fail: function (res) {
console.log('分享失败', res);
}
};
});
if (loading) {
return (
<Loading className={'px-2'}></Loading>
)
}
if(category.length > 0){
return <ArticleTabs data={category}/>
}
return <ArticleList data={list}/>
}
export default Category

4
src/cms/detail.scss

@ -1,4 +0,0 @@
.content{
padding: 32px;
line-height: 2.4rem;
}

96
src/cms/detail.tsx

@ -1,96 +0,0 @@
import {useEffect, useState} from 'react'
import {Image, Tag} from '@nutui/nutui-react-taro'
import {useRouter} from '@tarojs/taro'
import {Divider} from '@nutui/nutui-react-taro'
import dayjs from 'dayjs'
import {CmsArticle} from "@/api/cms/cmsArticle/model"
import {Eye, Clock, PickedUp, Purse, Coupon} from '@nutui/icons-react-taro'
import AddCartBar from "@/components/AddCartBar";
// 显示html富文本
import {View, RichText} from '@tarojs/components'
import './detail.scss'
import Line from "@/components/Gap";
import {wxParse} from "@/utils/common";
import {getCmsArticle} from "@/api/cms/cmsArticle";
function Detail() {
const {params} = useRouter();
// 文章详情
const [item, setItem] = useState<CmsArticle>()
// 浏览量
const [views, setViews] = useState<number>()
// 报名人数
const [bmUsers, setBmUsers] = useState<number>()
const reload = () => {
getCmsArticle(Number(params.id)).then(data => {
if(data){
data.content = wxParse(data.content)
setItem(data)
setViews(data.actualViews)
setBmUsers(data.bmUsers)
}
})
}
useEffect(() => {
reload();
}, []);
return (
<div className={'bg-white'}>
<Image src={item?.image} height={375} className={'bg-gray-50'}/>
<div className={'p-3 font-bold text-lg'}>{item?.title}</div>
<div className={'flex justify-between px-3'}>
<Tag type={'success'}>{item?.categoryName}</Tag>
<div className={'flex items-center gap-2 text-sm text-gray-400'}><Eye size={14}/>{views}</div>
</div>
{
item?.model == 'pay' ? '' :
<div className={'pt-2'}>
{
!item?.endTime ? '' :
<div className={'flex px-3 py-1 items-center gap-2'}>
<Clock size={14}/>
<div
className={'text-sm font-bold'}>{dayjs(item?.startTime).format('YYYY-MM-DD')} {dayjs(item?.endTime).format('YYYY-MM-DD')}</div>
</div>
}
{
!item?.price ? '' :
<>
<div className={'flex px-3 py-1 items-center gap-2'}>
<Purse size={14}/>
<div
className={'text-sm font-bold'}>{item?.price == 0 ? '线下收费' : '¥' + item?.price}
</div>
</div>
<Divider/>
</>
}
<div className={'flex px-3 items-center gap-2'}>
<PickedUp size={14}/>
<div
className={'text-sm font-bold'}> {bmUsers} /
</div>
</div>
</div>
}
<Divider/>
<div className={'flex px-3 items-center gap-2'}>
<Coupon size={14}/>
<div
className={'text-sm font-bold bg-white'}>
</div>
</div>
<View className={'content text-gray-700 text-sm'}>
<RichText nodes={item?.content}/>
</View>
<Line height={44}/>
<AddCartBar />
</div>
)
}
export default Detail

0
src/cms/detail.config.ts → src/cms/detail/index.config.ts

50
src/cms/detail/index.scss

@ -1,50 +0,0 @@
.article-detail-page {
padding: 15px;
background-color: #fff;
.article-header {
margin-bottom: 20px;
border-bottom: 1px solid #eee;
padding-bottom: 15px;
.article-title {
font-size: 24px;
font-weight: bold;
margin-bottom: 10px;
line-height: 1.4;
}
.article-meta {
font-size: 14px;
color: #999;
span {
margin-right: 15px;
}
}
}
.article-content {
line-height: 1.8;
font-size: 16px;
color: #333;
.article-main-image {
width: 100%;
height: auto;
margin-bottom: 15px;
border-radius: 8px;
}
img {
max-width: 100%;
height: auto;
display: block;
margin: 10px 0;
}
p {
margin-bottom: 10px;
}
}
}

74
src/cms/detail/index.tsx

@ -1,45 +1,53 @@
import {useEffect, useState} from "react";
import {Image} from '@nutui/nutui-react-taro'
import Taro from '@tarojs/taro'
import {CmsArticle} from "@/api/cms/cmsArticle/model";
import {useEffect, useState} from 'react'
import {useRouter} from '@tarojs/taro'
import {Loading} from '@nutui/nutui-react-taro'
import {View, RichText} from '@tarojs/components'
import {wxParse} from "@/utils/common";
import {getCmsArticle} from "@/api/cms/cmsArticle";
import dayjs from "dayjs";
import {CmsArticle} from "@/api/cms/cmsArticle/model"
import Line from "@/components/Gap";
import './index.scss'
const ArticleDetail = () => {
const [article, setArticle] = useState<CmsArticle | null>(null);
const router = Taro.getCurrentInstance().router;
const articleId = router?.params?.id;
function Detail() {
const {params} = useRouter();
const [loading, setLoading] = useState<boolean>(true)
// 文章详情
const [item, setItem] = useState<CmsArticle>()
const reload = async () => {
const item = await getCmsArticle(Number(params.id))
useEffect(() => {
if (articleId) {
getCmsArticle(Number(articleId)).then(res => {
setArticle(res);
}).catch(error => {
console.error("Failed to fetch article detail:", error);
});
if (item) {
item.content = wxParse(item.content)
setItem(item)
Taro.setNavigationBarTitle({
title: `${item?.categoryName}`
})
}
}, [articleId]);
}
useEffect(() => {
reload().then(() => {
setLoading(false)
});
}, []);
if (!article) {
return <div>...</div>;
if (loading) {
return (
<Loading className={'px-2'}></Loading>
)
}
return (
<div className={'article-detail-page'}>
<div className={'article-header'}>
<h1 className={'article-title'}>{article.title}</h1>
<div className={'article-meta'}>
<span>{article.author}</span>
<span>{dayjs(article.createTime).format('YYYY-MM-DD HH:mm')}</span>
</div>
</div>
<div className={'article-content'}>
{article.image && <Image src={article.image} className={'article-main-image'} />}
<div dangerouslySetInnerHTML={{ __html: article.content || '' }} />
</div>
<div className={'bg-white'}>
<div className={'p-4 font-bold text-lg'}>{item?.title}</div>
<div className={'text-gray-400 text-sm px-4 '}>{item?.createTime}</div>
<View className={'content px-3'}>
<RichText nodes={item?.content}/>
</View>
<Line height={44}/>
</div>
);
};
)
}
export default ArticleDetail;
export default Detail

3
src/cms/help.config.ts

@ -1,3 +0,0 @@
export default definePageConfig({
navigationBarTitleText: '文章详情'
})

45
src/cms/help.tsx

@ -1,45 +0,0 @@
import {useEffect, useState} from 'react'
import {useRouter} from '@tarojs/taro'
import {CmsArticle} from "@/api/cms/cmsArticle/model"
// import ReactMarkdown from 'react-markdown';
// 显示html富文本
import {View, RichText} from '@tarojs/components'
import './detail.scss'
import Line from "@/components/Gap";
import {wxParse} from "@/utils/common";
import {getCmsArticle} from "@/api/cms/cmsArticle";
function Detail() {
const {params} = useRouter();
// 文章详情
const [item, setItem] = useState<CmsArticle>()
const reload = () => {
getCmsArticle(Number(params.id)).then(data => {
if(data){
data.content = wxParse(data.content)
setItem(data)
}
})
}
useEffect(() => {
reload();
}, []);
return (
<div className={'bg-white'}>
<div className={'p-4 font-bold text-lg'}>{item?.title}</div>
<div className={'text-gray-400 text-sm px-4 '}>{item?.createTime}</div>
<View className={'content text-gray-700 text-sm'}>
{
item?.editor === 1 ?
<RichText nodes={item?.content} /> :
null
}
</View>
<Line height={44}/>
</div>
)
}
export default Detail

4
src/components/GoodsList.tsx

@ -72,12 +72,12 @@ function GoodsList(props: any) {
const reloadMore = async () => {
setPage(page + 1)
reload();
reload().then();
}
useEffect(() => {
setPage(2)
reload()
reload().then()
}, [])
return (

1
src/pages/cart/cart.tsx

@ -202,6 +202,7 @@ function Cart() {
src={item.image}
width="80"
height="80"
lazyLoad={false}
radius="8"
className="flex-shrink-0"
/>

2
src/pages/index/Banner.tsx

@ -21,7 +21,7 @@ const MyPage = () => {
<Swiper defaultValue={0} height={item?.height} indicator style={{ height: item?.height + 'px', display: 'none' }}>
{item?.imageList?.map((item) => (
<Swiper.Item key={item}>
<Image width="100%" height="100%" src={item.url} mode={'scaleToFill'} style={{ height: item.height + 'px' }} />
<Image width="100%" height="100%" src={item.url} mode={'scaleToFill'} lazyLoad={false} style={{ height: item.height + 'px' }} />
</Swiper.Item>
))}
</Swiper>

2
src/pages/index/BestSellers.tsx

@ -27,7 +27,7 @@ const BestSellers = () => {
{list?.map((item, index) => {
return (
<div key={index} className={'flex flex-col rounded-lg bg-white shadow-sm w-full mb-5'}>
<Image src={item.image} mode={'scaleToFill'}
<Image src={item.image} mode={'aspectFit'} lazyLoad={false}
radius="10px 10px 0 0" height="180"
onClick={() => Taro.navigateTo({url: '/shop/goodsDetail/index?id=' + item.goodsId})}/>
<div className={'flex flex-col p-2 rounded-lg'}>

0
src/pages/index/GoodsList.scss

67
src/pages/index/GoodsList.tsx

@ -0,0 +1,67 @@
import {useEffect, useState} from "react";
import {Image} from '@nutui/nutui-react-taro'
import {Share} from '@nutui/icons-react-taro'
import Taro from '@tarojs/taro'
import {ShopGoods} from "@/api/shop/shopGoods/model";
import {pageShopGoods} from "@/api/shop/shopGoods";
import './GoodsList.scss'
const BestSellers = () => {
const [list, setList] = useState<ShopGoods[]>([])
const reload = () => {
pageShopGoods({}).then(res => {
setList(res?.list || []);
})
}
useEffect(() => {
reload()
}, [])
return (
<>
<div className={'py-3'}>
<div className={'flex flex-wrap justify-between items-start rounded-lg px-2'}>
{list?.map((item, index) => {
return (
<div key={index} className={'flex flex-col rounded-lg bg-white shadow-sm mb-5'} style={{
width: '48%'
}}>
<Image src={item.image} mode={'scaleToFill'} lazyLoad={false}
radius="10px 10px 0 0" height="180"
onClick={() => Taro.navigateTo({url: '/shop/goodsDetail/index?id=' + item.goodsId})}/>
<div className={'flex flex-col p-2 rounded-lg'}>
<div>
<div className={'car-no text-sm'}>{item.name}</div>
<div className={'flex justify-between text-xs py-1'}>
<span className={'text-orange-500'}>{item.comments}</span>
<span className={'text-gray-400'}> {item.sales}</span>
</div>
<div className={'flex justify-between items-center py-2'}>
<div className={'flex text-red-500 text-xl items-baseline'}>
<span className={'text-xs'}></span>
<span className={'font-bold text-2xl'}>{item.price}</span>
</div>
<div className={'buy-btn'}>
<div className={'cart-icon'}>
<Share size={20} className={'mx-4 mt-2'}
onClick={() => Taro.navigateTo({url: '/shop/goodsDetail/index?id=' + item.goodsId})}/>
</div>
<div className={'text-white pl-4 pr-5'}
onClick={() => Taro.navigateTo({url: '/shop/goodsDetail/index?id=' + item.goodsId})}>
</div>
</div>
</div>
</div>
</div>
</div>
)
})}
</div>
</div>
</>
)
}
export default BestSellers

6
src/pages/index/Header.tsx

@ -9,8 +9,8 @@ import {getOrganization} from "@/api/system/organization";
import {myUserVerify} from "@/api/system/userVerify";
import {CmsWebsite} from "@/api/cms/cmsWebsite/model";
import {User} from "@/api/system/user/model";
import './Header.scss';
import MySearch from "./MySearch";
import './Header.scss';
const Header = () => {
const [userInfo, setUserInfo] = useState<User>()
@ -93,7 +93,7 @@ const Header = () => {
success: function () {
if (code) {
Taro.request({
url: 'https://server.websoft.top/api/wx-login/loginByMpWxPhone',
url: 'https://server.gxwebsoft.com/api/wx-login/loginByMpWxPhone',
method: 'POST',
data: {
code,
@ -135,7 +135,7 @@ const Header = () => {
}
useEffect(() => {
reload()
reload().then()
}, [])
return (

2
src/pages/index/Login.tsx

@ -16,7 +16,7 @@ const Login = (props:any) => {
success: function () {
if (code) {
Taro.request({
url: 'https://server.websoft.top/api/wx-login/loginByMpWxPhone',
url: 'https://server.gxwebsoft.com/api/wx-login/loginByMpWxPhone',
method: 'POST',
data: {
code,

23
src/pages/index/Menu.tsx

@ -11,14 +11,25 @@ const Page = () => {
const [navItems, setNavItems] = useState<CmsNavigation[]>([])
const reload = async () => {
// 读取栏目
const menus = await listCmsNavigation({model: 'links', hide: 0});
setNavItems(menus || [])
// 读取首页菜单
const home = await listCmsNavigation({model: 'index'});
if (home && home.length > 0) {
// 读取首页导航条
const menus = await listCmsNavigation({parentId: home[0].navigationId, hide: 0});
setNavItems(menus || [])
}
};
const onNav = (row: CmsNavigation) => {
console.log(row, 'eee')
Taro.navigateTo({url: `${row.path}`})
console.log('nav = ', row)
console.log('path = ', `/${row.model}${row.path}`)
if (row.model == 'goods') {
return Taro.navigateTo({url: `/shop/category/index?id=${row.navigationId}`})
}
if (row.model == 'article') {
return Taro.navigateTo({url: `/cms/category/index?id=${row.navigationId}`})
}
return Taro.navigateTo({url: `${row.path}`})
}
@ -36,7 +47,7 @@ const Page = () => {
navItems.map((item, index) => (
<div key={index} className={'text-center'} onClick={() => onNav(item)}>
<div className={'flex flex-col justify-center items-center p-1'}>
<Image src={item.icon} height={36} width={36}/>
<Image src={item.icon} height={36} width={36} lazyLoad={false}/>
<div className={'mt-1 text-gray-600'} style={{fontSize: '14px'}}>{item?.title}</div>
</div>
</div>

14
src/pages/index/index.tsx

@ -4,10 +4,13 @@ import Taro from '@tarojs/taro';
import {useShareAppMessage, useShareTimeline} from "@tarojs/taro"
import {useEffect} from "react";
import {getSiteInfo} from "@/api/layout";
import {Sticky} from '@nutui/nutui-react-taro'
import Menu from "./Menu";
import Banner from "./Banner";
import './index.scss'
// import GoodsList from "./GoodsList";
function Home() {
useShareTimeline(() => {
@ -94,18 +97,21 @@ function Home() {
Taro.getUserInfo({
success: (res) => {
const avatar = res.userInfo.avatarUrl;
console.log(avatar,'avatarUrl')
console.log(avatar, 'avatarUrl')
}
});
}, []);
return (
<>
<Header/>
<Sticky threshold={0}>
<Header/>
</Sticky>
<div className={'flex flex-col mt-12'}>
<Menu />
<Banner />
<Menu/>
<Banner/>
<BestSellers/>
{/*<GoodsList/>*/}
</div>
</>
)

6
src/pages/user/components/OrderIcon.tsx

@ -25,7 +25,7 @@ const OrderIcon = () => {
success: function () {
if (code) {
Taro.request({
url: 'https://server.websoft.top/api/wx-login/loginByMpWxPhone',
url: 'https://server.gxwebsoft.com/api/wx-login/loginByMpWxPhone',
method: 'POST',
data: {
code,
@ -187,13 +187,13 @@ const OrderIcon = () => {
<div className={'flex flex-col justify-center items-center'} onClick={() => {
onLogin(item, index)
}}>
<Image src={item.icon} height={28} width={28}/>
<Image src={item.icon} height={28} width={28} lazyLoad={false}/>
<div className={'mt-2'} style={{fontSize: '15px'}}>{item?.title}</div>
</div>
:
<Button className={'text-white'} open-type="getPhoneNumber" onGetPhoneNumber={handleGetPhoneNumber}>
<div className={'flex flex-col justify-center items-center'}>
<Image src={item.icon} height={28} width={28}/>
<Image src={item.icon} height={28} width={28} lazyLoad={false}/>
<div className={'mt-2 text-gray-700'} style={{fontSize: '15px'}}>{item?.title}</div>
</div>
</Button>

2
src/pages/user/components/UserCard.tsx

@ -107,7 +107,7 @@ function UserCard() {
success: function () {
if (code) {
Taro.request({
url: 'https://server.websoft.top/api/wx-login/loginByMpWxPhone',
url: 'https://server.gxwebsoft.com/api/wx-login/loginByMpWxPhone',
method: 'POST',
data: {
code,

31
src/shop/category/components/Banner.tsx

@ -0,0 +1,31 @@
import { useEffect, useState } from 'react'
import { Swiper } from '@nutui/nutui-react-taro'
import {CmsAd} from "@/api/cms/cmsAd/model";
import {Image} from '@nutui/nutui-react-taro'
import {getCmsAd} from "@/api/cms/cmsAd";
const MyPage = () => {
const [item, setItem] = useState<CmsAd>()
const reload = () => {
getCmsAd(439).then(data => {
setItem(data)
})
}
useEffect(() => {
reload()
}, [])
return (
<>
<Swiper defaultValue={0} height={item?.height} indicator style={{ height: item?.height + 'px', display: 'none' }}>
{item?.imageList?.map((item) => (
<Swiper.Item key={item}>
<Image width="100%" height="100%" src={item.url} mode={'scaleToFill'} lazyLoad={false} style={{ height: item.height + 'px' }} />
</Swiper.Item>
))}
</Swiper>
</>
)
}
export default MyPage

0
src/shop/category/components/GoodsList.scss

51
src/shop/category/components/GoodsList.tsx

@ -0,0 +1,51 @@
import {Image} from '@nutui/nutui-react-taro'
import {Share} from '@nutui/icons-react-taro'
import Taro from '@tarojs/taro'
import './GoodsList.scss'
const GoodsList = (props: any) => {
return (
<>
<div className={'py-3'}>
<div className={'flex flex-col justify-between items-center rounded-lg px-2'}>
{props.data?.map((item, index) => {
return (
<div key={index} className={'flex flex-col rounded-lg bg-white shadow-sm w-full mb-5'}>
<Image src={item.image} mode={'aspectFit'} lazyLoad={false}
radius="10px 10px 0 0" height="180"
onClick={() => Taro.navigateTo({url: '/shop/goodsDetail/index?id=' + item.goodsId})}/>
<div className={'flex flex-col p-2 rounded-lg'}>
<div>
<div className={'car-no text-sm'}>{item.name}</div>
<div className={'flex justify-between text-xs py-1'}>
<span className={'text-orange-500'}>{item.comments}</span>
<span className={'text-gray-400'}> {item.sales}</span>
</div>
<div className={'flex justify-between items-center py-2'}>
<div className={'flex text-red-500 text-xl items-baseline'}>
<span className={'text-xs'}></span>
<span className={'font-bold text-2xl'}>{item.price}</span>
</div>
<div className={'buy-btn'}>
<div className={'cart-icon'}>
<Share size={20} className={'mx-4 mt-2'}
onClick={() => Taro.navigateTo({url: '/shop/goodsDetail/index?id=' + item.goodsId})}/>
</div>
<div className={'text-white pl-4 pr-5'}
onClick={() => Taro.navigateTo({url: '/shop/goodsDetail/index?id=' + item.goodsId})}>
</div>
</div>
</div>
</div>
</div>
</div>
)
})}
</div>
</div>
</>
)
}
export default GoodsList

4
src/shop/category/index.config.ts

@ -0,0 +1,4 @@
export default definePageConfig({
navigationBarTitleText: '商品分类',
navigationBarTextStyle: 'black'
})

0
src/shop/category/index.scss

78
src/shop/category/index.tsx

@ -0,0 +1,78 @@
import Taro from '@tarojs/taro'
import GoodsList from './components/GoodsList'
import {useShareAppMessage, useShareTimeline} from "@tarojs/taro"
import {Loading} from '@nutui/nutui-react-taro'
import {useEffect, useState} from "react"
import {useRouter} from '@tarojs/taro'
import './index.scss'
import {pageShopGoods} from "@/api/shop/shopGoods"
import {ShopGoods} from "@/api/shop/shopGoods/model"
import {getCmsNavigation} from "@/api/cms/cmsNavigation";
import {CmsNavigation} from "@/api/cms/cmsNavigation/model";
function Category() {
const {params} = useRouter();
const [categoryId, setCategoryId] = useState<number>(0)
const [loading, setLoading] = useState<boolean>(true)
const [nav, setNav] = useState<CmsNavigation>()
const [list, setList] = useState<ShopGoods[]>([])
const reload = async () => {
// 1.加载远程数据
const id = Number(params.id)
const nav = await getCmsNavigation(id)
const shopGoods = await pageShopGoods({categoryId: id})
// 2.处理业务逻辑
setCategoryId(id)
setNav(nav)
setList(shopGoods?.list || [])
// 3.设置标题
Taro.setNavigationBarTitle({
title: `${nav?.categoryName}`
})
};
useEffect(() => {
reload().then(() => {
setLoading(false)
})
}, []);
useShareTimeline(() => {
return {
title: `${nav?.categoryName}_时里院子市集`,
path: `/shop/category/index?id=${categoryId}`
};
});
useShareAppMessage(() => {
return {
title: `${nav?.categoryName}_时里院子市集`,
path: `/shop/category/index?id=${categoryId}`,
success: function (res) {
console.log('分享成功', res);
},
fail: function (res) {
console.log('分享失败', res);
}
};
});
if (loading) {
return (
<Loading className={'px-2 text-center'}></Loading>
)
}
return (
<>
<div className={'flex flex-col'}>
<GoodsList data={list} nav={nav}/>
</div>
</>
)
}
export default Category

2
src/shop/goodsDetail/index.tsx

@ -129,7 +129,7 @@ const GoodsDetail = () => {
<Swiper defaultValue={0} indicator height={'350px'}>
{files.map((item) => (
<Swiper.Item key={item}>
<Image width="100%" height={'100%'} src={item.url} mode={'scaleToFill'}/>
<Image width="100%" height={'100%'} src={item.url} mode={'scaleToFill'} lazyLoad={false}/>
</Swiper.Item>
))}
</Swiper>

2
src/shop/orderConfirm/index.tsx

@ -64,7 +64,7 @@ const OrderConfirm = () => {
<CellGroup>
<Cell>
<div className={'flex items-center'}>
<Image src={goods.image} width="80" height="80"/>
<Image src={goods.image} width="80" height="80" lazyLoad={false}/>
<div className={'ml-2'}>
<div className={'text-sm font-bold'}>{goods.name}</div>
<div className={'text-red-500 text-lg'}>{goods.price}</div>

2
src/shop/orderDetail/index.tsx

@ -91,7 +91,7 @@ const OrderDetail = () => {
{orderGoodsList.map((item, index) => (
<Cell key={index}>
<div className={'flex items-center'}>
<Image src={item.goodsImage} width="80" height="80" />
<Image src={item.goodsImage} width="80" height="80" lazyLoad={false} />
<div className={'ml-2'}>
<div className={'text-sm font-bold'}>{item.goodsName}</div>
<div className={'text-gray-500 text-xs'}>{item.totalNum}</div>

2
src/user/about/index.config.ts

@ -1,4 +1,4 @@
export default definePageConfig({
navigationBarTitleText: '常见问题',
navigationBarTitleText: '关于我们',
navigationBarTextStyle: 'black'
})

83
src/user/about/index.tsx

@ -1,15 +1,30 @@
import {useEffect, useState} from "react";
import {CmsArticle} from "@/api/cms/cmsArticle/model";
import {listCmsArticle} from "@/api/cms/cmsArticle";
import {Collapse} from '@nutui/nutui-react-taro'
import {ArrowDown} from '@nutui/icons-react-taro'
import {Collapse, Avatar, Cell, Divider} from '@nutui/nutui-react-taro'
import {ArrowRight} from '@nutui/icons-react-taro'
import {CmsNavigation} from "@/api/cms/cmsNavigation/model";
import {listCmsNavigation} from "@/api/cms/cmsNavigation";
// 显示html富文本
import {View, RichText} from '@tarojs/components'
const Helper = () => {
const [list, setList] = useState<CmsArticle[]>([])
const [nav, setNav] = useState<CmsNavigation>()
const [category, setCategory] = useState<CmsNavigation[]>([])
const reload = () => {
listCmsArticle({model: 'help'}).then(res => {
const reload = async () => {
const navs = await listCmsNavigation({model: 'page', parentId: 0});
if (navs.length > 0) {
const nav = navs[0];
setNav(nav);
// 查询子栏目
const category = await listCmsNavigation({parentId: nav.navigationId})
setCategory(category)
}
listCmsArticle({model: 'page'}).then(res => {
setList(res)
}).catch(error => {
console.error("Failed to fetch goods detail:", error);
@ -17,25 +32,55 @@ const Helper = () => {
}
useEffect(() => {
reload()
reload().then()
}, []);
return (
<div className={'p-3'}>
{list.map((item, index) => (
<Collapse defaultActiveName={['1', '2']} expandIcon={<ArrowDown/>}>
<Collapse.Item
title={
<div className={'flex items-center'}>
<div className={'text-sm'}>{item.title}</div>
</div>
}
name={`${index}`}
>
<div className={'text-sm'}>{item.comments}</div>
</Collapse.Item>
</Collapse>
<div className={'px-3'}>
<Cell>
{nav && (
<View className={'flex flex-col justify-center items-center w-full'}>
<Avatar
src={nav?.icon}
size={'100'}
/>
<View className={'font-bold text-sm'}>
{nav?.comments}
</View>
<View className={'text-left py-3 text-gray-600'}>
<RichText
nodes={'时里院子市集是一家B2C模式的会员电商平台,以健康安全食品,中国国家地理标志产品,药食同源产品等为主线,愿景是守护5亿家庭餐桌健康;选品原则是健康,好吃,方便,实惠。通过严格的筛选供货商,从选品、采购发货、仓储物流产品检测、售前售后等各环节严格把控,提升用户满意度。平台采取透明公开化,以持续为用户提供物美价廉的好产品为准准则,为用户创造价值为唯一宗旨,倡导终身用户,终身服务的经营理念。'}/>
</View>
</View>
)}
</Cell>
{category.map((item, index) => (
<Cell
title={(
<div className={'font-bold'} id={`${index}`}>
{item.categoryName}
</div>
)}
description={(
<>
<Divider/>
<View className={'item flex justify-between items-center my-2'}>
<View>{item.categoryName}</View>
<ArrowRight size={16} className={'text-gray-400'}/>
</View>
<View className={'item flex justify-between items-center my-2'}>
<View>{item.categoryName}</View>
<ArrowRight size={16} className={'text-gray-400'}/>
</View>
</>
)}
>
</Cell>
))}
<Cell className={'flex flex-col'}>
<span>线0771-88888888</span>
<span>9:00-18:00</span>
</Cell>
</div>
);
};

185
src/user/address/add.tsx

@ -1,76 +1,75 @@
import {useEffect, useState} from "react";
import {Button, Cell, CellGroup, Input, TextArea, Form, Picker, Cascader} from '@nutui/nutui-react-taro'
import {useRouter} from '@tarojs/taro'
import {Button, Loading, CellGroup, Input, TextArea, Form} from '@nutui/nutui-react-taro'
import {Scan, ArrowRight} from '@nutui/icons-react-taro'
import Taro from '@tarojs/taro'
import {View} from '@tarojs/components'
import {Address} from '@nutui/nutui-react-taro'
import {ShopUserAddress} from "@/api/shop/shopUserAddress/model";
import {listShopUserAddress} from "@/api/shop/shopUserAddress";
import {updateUserInfo} from "@/api/layout";
import {getBszxClassForTree} from "@/api/bszx/bszxClass";
import {getShopUserAddress, listShopUserAddress, updateShopUserAddress} from "@/api/shop/shopUserAddress";
import RegionData from '@/api/json/regions-data.json';
const pickerOptions = [
{value: 4, text: 'BeiJing'},
{value: 1, text: 'NanJing'},
{value: 2, text: 'WuXi'},
{value: 8, text: 'DaQing'},
{value: 9, text: 'SuiHua'},
{value: 10, text: 'WeiFang'},
{value: 12, text: 'ShiJiaZhuang'},
]
const AddUserAddress = () => {
const {params} = useRouter();
const [loading, setLoading] = useState<boolean>(true)
const [text, setText] = useState<string>('')
const [optionsDemo1, setOptionsDemo1] = useState([])
const [visible, setVisible] = useState(false)
const [FormData, setFormData] = useState<ShopUserAddress>({})
const OrderConfirm = () => {
const [list, setList] = useState<ShopUserAddress[]>([])
const [classList, setClassList] = useState<any[]>()
const [FormData, setFormData] = useState<ShopUserAddress>(
{
userId: undefined,
name: undefined,
phone: undefined,
country: undefined,
province: undefined,
city: undefined,
region: undefined,
address: undefined,
fullAddress: undefined,
lat: undefined,
lng: undefined,
gender: undefined,
type: undefined,
isDefault: undefined,
}
)
const reload = async () => {
const address = await getShopUserAddress(Number(params.id))
setFormData(address)
// 设置所在地区
setText(`${address.province} ${address.city} ${address.region}`)
// 整理地区数据
setRegionData()
}
const [navBarState, setNavBarState] = useState({
visible: false
})
const changeNarBar = (visible) => {
setNavBarState({
visible
})
/**
*
*/
function setRegionData() {
// @ts-ignore
setOptionsDemo1(RegionData?.map((a) => {
return {
value: a.label,
text: a.label,
children: a.children?.map((b) => {
return {
value: b.label,
text: b.label,
children: b.children?.map((c) => {
return {
value: c.label,
text: c.label
}
})
}
})
}
}))
}
// 获取班级数据树
getBszxClassForTree().then(res => {
setClassList(res);
})
// 提交表单
const submitSucceed = async (values: any) => {
const change6 = (value: any, path: any) => {
const branch = path[0];
changeNarBar(false)
}
const defaultAddress = await listShopUserAddress({isDefault: true})
if(!defaultAddress) return
const reload = () => {
listShopUserAddress({userId: Taro.getStorageSync('UserId')}).then(res => {
setList(res)
}).catch(error => {
console.error("Failed to fetch goods detail:", error);
const setNotDefault = await updateShopUserAddress({
...defaultAddress[0],
isDefault: false
})
}
if(!setNotDefault) return
// 提交表单
const submitSucceed = (values: any) => {
console.log(values, 'values')
updateUserInfo(values).then(() => {
updateShopUserAddress({
...values,
id: Number(params.id),
province: FormData.province,
city: FormData.city,
region: FormData.region
}).then(() => {
Taro.showToast({title: `保存成功`, icon: 'success'})
setTimeout(() => {
return Taro.navigateBack()
@ -87,9 +86,15 @@ const OrderConfirm = () => {
}
useEffect(() => {
reload()
reload().then(() => {
setLoading(false)
})
}, []);
if (loading) {
return <Loading className={'px-2'}></Loading>
}
return (
<>
<Form
@ -132,63 +137,47 @@ const OrderConfirm = () => {
</CellGroup>
<View className={'bg-gray-100 h-3'}></View>
<CellGroup style={{padding: '4px 0'}}>
<Form.Item name="name" label="收货人" required>
<Form.Item name="name" label="收货人" initialValue={FormData.name} required>
<Input placeholder="请输入收货人姓名"/>
</Form.Item>
<Form.Item name="phone" label="手机号" required>
<Form.Item name="phone" label="手机号" initialValue={FormData.phone} required>
<Input placeholder="请输入手机号"/>
</Form.Item>
<Form.Item
label="所在地区"
name="region"
required
initialValue={FormData.region}
rules={[{message: '请输入您的所在地区'}]}
required
>
<div className={'flex justify-between items-center'} onClick={() => changeNarBar(true)}>
<Input placeholder="选择所在地区" disabled/>
<div className={'flex justify-between items-center'} onClick={() => setVisible(true)}>
<Input placeholder="选择所在地区" value={text} disabled/>
<ArrowRight className={'text-gray-400'}/>
</div>
</Form.Item>
<Form.Item name="address" label="收货地址" required>
<Form.Item name="address" label="收货地址" initialValue={FormData.address} required>
<Input placeholder="请输入详细收货地址"/>
</Form.Item>
</CellGroup>
</Form>
<Cascader
popupProps={{
className: 'cascader-popup',
}}
visible={navBarState.visible}
optionKey={{valueKey: 'name', textKey: 'name', childrenKey: 'children'}}
title="选择所在地区"
options={classList}
closeable
onChange={change6}
onClose={() => {
changeNarBar(false)
<Address
visible={visible}
options={optionsDemo1}
title="选择地址"
onChange={(value, _) => {
setFormData({
...FormData,
province: `${value[0]}`,
city: `${value[1]}`,
region: `${value[2]}`
})
setText(value.join(' '))
}}
onClose={() => setVisible(false)}
/>
{/*<CellGroup>*/}
{/* <Cell>*/}
{/* <div className={'flex items-center'}>*/}
{/* <Image src={goods.image} width="80" height="80"/>*/}
{/* <div className={'ml-2'}>*/}
{/* <div className={'text-sm font-bold'}>{goods.name}</div>*/}
{/* <div className={'text-red-500 text-lg'}>¥{goods.price}</div>*/}
{/* </div>*/}
{/* </div>*/}
{/* </Cell>*/}
{/*</CellGroup>*/}
{/*<div className={'fixed-bottom'}>*/}
{/* <div className={'total-price'}>*/}
{/* 合计:<span className={'text-red-500 text-xl font-bold'}>¥{goods.price}</span>*/}
{/* </div>*/}
{/* <Button type="primary" size="large" className={'submit-btn'}>提交订单</Button>*/}
{/*</div>*/}
</>
);
};
export default OrderConfirm;
export default AddUserAddress;

94
src/user/address/index.tsx

@ -4,17 +4,54 @@ import {Dongdong, ArrowRight, CheckNormal, Checked} from '@nutui/icons-react-tar
import Taro from '@tarojs/taro'
import {View} from '@tarojs/components'
import {ShopUserAddress} from "@/api/shop/shopUserAddress/model";
import {listShopUserAddress} from "@/api/shop/shopUserAddress";
import {listShopUserAddress, removeShopUserAddress, updateShopUserAddress} from "@/api/shop/shopUserAddress";
const Address = () => {
const [list, setList] = useState<ShopUserAddress[]>([{},{},{},{}])
const [list, setList] = useState<ShopUserAddress[]>([])
const [address, setAddress] = useState<ShopUserAddress>()
const reload = () => {
listShopUserAddress({userId: Taro.getStorageSync('UserId')}).then(res => {
// setList(res)
}).catch(error => {
console.error("Failed to fetch goods detail:", error);
listShopUserAddress({
userId: Taro.getStorageSync('UserId')
})
.then(data => {
setList(data || [])
// 默认地址
setAddress(data.find(item => item.isDefault))
})
.catch(() => {
Taro.showToast({
title: '获取地址失败',
icon: 'error'
});
})
}
const onDefault = async (item) => {
if(address){
await updateShopUserAddress({
...address,
isDefault: false
})
}
await updateShopUserAddress({
id: item.id,
isDefault: true
})
Taro.showToast({
title: '设置成功',
icon: 'success'
});
reload();
}
const onDel = async (id?: number) => {
await removeShopUserAddress(id)
Taro.showToast({
title: '删除成功',
icon: 'success'
});
reload();
}
useEffect(() => {
@ -35,26 +72,14 @@ const Address = () => {
/>
<Space>
<Button onClick={() => Taro.navigateTo({url: '/user/address/add'})}></Button>
<Button type="success" fill="dashed"></Button>
<Button type="success" fill="dashed"
onClick={() => Taro.navigateTo({url: '/user/address/wxAddress'})}></Button>
</Space>
</div>
</ConfigProvider>
)
}
if (list.length == 0) {
return (
<CellGroup>
<Cell className={''}>
<Space>
<Button></Button>
<Button></Button>
</Space>
</Cell>
</CellGroup>
)
}
return (
<>
<CellGroup>
@ -70,46 +95,31 @@ const Address = () => {
</div>
</Cell>
</CellGroup>
{list.map((item,index) => (
// <CellGroup key={item.id}>
// <Cell title={item.name}
// extra={
// <Button
// type="primary"
// size="small"
// >
// 修改
// </Button>
// }
// >
// <div className={'text-sm'}>{item.fullAddress}</div>
//
// </Cell>
// </CellGroup>
{list.map((item, _) => (
<Cell.Group>
<Cell className={'flex flex-col gap-1'}>
<View>
<View className={'font-medium text-sm'}> 13800010001</View>
<View className={'font-medium text-sm'}>{item.name} {item.phone}</View>
</View>
<View className={'text-xs'}>
广西13
{item.province} {item.city} {item.region} {item.address}
</View>
</Cell>
<Cell
align="center"
title={
<View className={'flex items-center gap-1'}>
{index == 0 ? <Checked className={'text-green-600'} size={16}/> : <CheckNormal size={16} />}
<View className={'flex items-center gap-1'} onClick={() => onDefault(item)}>
{item.isDefault ? <Checked className={'text-green-600'} size={16}/> : <CheckNormal size={16}/>}
<View className={'text-gray-400'}></View>
</View>
}
extra={
<>
<View className={'text-gray-400'}>
<View className={'text-gray-400'} onClick={() => onDel(item.id)}>
</View>
<Divider direction={'vertical'}/>
<View className={'text-gray-400'}>
<View className={'text-gray-400'} onClick={() => Taro.navigateTo({url: '/user/address/add?id=' + item.id})}>
</View>
</>

129
src/user/address/wxAddress.tsx

@ -1,90 +1,65 @@
import {useEffect, useState} from "react";
import {Button, Cell, CellGroup, Space, Empty, ConfigProvider} from '@nutui/nutui-react-taro'
import {Dongdong} from '@nutui/icons-react-taro'
import {useEffect} from "react";
import Taro from '@tarojs/taro'
import {ShopUserAddress} from "@/api/shop/shopUserAddress/model";
import {listShopUserAddress} from "@/api/shop/shopUserAddress";
import {addShopUserAddress} from "@/api/shop/shopUserAddress";
const Address = () => {
const [list, setList] = useState<ShopUserAddress[]>([{
id: 1,
name: '张三',
phone: '13800138000',
country: '中国',
province: '广东省',
city: '广州市',
region: '天河区',
address: '黄埔大道西10号',
fullAddress: '广东省广州市天河区黄埔大道西10号',
lat: '23.129163',
lng: '113.382391',
gender: 1,
type: 'home',
isDefault: true,
userId: 1,
tenantId: 1,
createTime: '2021-09-01 10:10:10',
},
{
id: 2,
name: '李四',
phone: '13800138000',
country: '中国',
province: '广西壮族自治区',
city: '南宁市',
region: '青秀区',
address: '青秀区民族大道100号',
fullAddress: '广西壮族自治区南宁市青秀区民族大道100号',
lat: '23.129163',
lng: '113.382391',
gender: 1,
type: 'home',
isDefault: true,
userId: 1,
tenantId: 1,
createTime: '2021-09-01 10:10:10',
},
{
id: 3,
name: '张三',
phone: '13800138000',
country: '中国',
province: '广西',
city: '南宁市',
region: '青秀区',
address: '青秀区民族大道100号',
fullAddress: '广西壮族自治区南宁市青秀区民族大道100号',
lat: '23.129163',
lng: '113.382391',
gender: 1,
type: 'home',
isDefault: true,
userId: 1,
tenantId: 1,
createTime: '2021-09-01 10:10:10',
}])
const reload = () => {
listShopUserAddress({userId: Taro.getStorageSync('UserId')}).then(res => {
// setList(res)
}).catch(error => {
console.error("Failed to fetch goods detail:", error);
})
/**
* API获取用户收货地址
*
*/
const getWeChatAddress = () => {
Taro.chooseAddress()
.then(res => {
// 格式化微信返回的地址数据为后端所需格式
const addressData = {
name: res.userName,
phone: res.telNumber,
country: res.nationalCode || '中国',
province: res.provinceName,
city: res.cityName,
region: res.countyName,
address: res.detailInfo,
postalCode: res.postalCode,
isDefault: false
}
console.log(res, 'addrs..')
// 调用保存地址的API(假设存在该接口)
addShopUserAddress(addressData)
.then((msg) => {
console.log(msg)
Taro.showToast({
title: `${msg}`,
icon: 'none'
})
setTimeout(() => {
// 保存成功后返回
Taro.navigateBack()
}, 1000)
})
.catch(error => {
console.error('保存地址失败:', error)
Taro.showToast({title: '保存地址失败', icon: 'error'})
})
})
.catch(err => {
console.error('获取微信地址失败:', err)
// 处理用户拒绝授权的情况
if (err.errMsg.includes('auth deny')) {
Taro.showModal({
title: '授权失败',
content: '请在设置中允许获取地址权限',
showCancel: false
})
}
})
}
useEffect(() => {
reload()
getWeChatAddress()
}, []);
return (
<>
{list.map((item) => (
<div className={'flex flex-col bg-white my-3 py-1 px-4'}>
<div className={'py-1'}>{item.province}{item.city}{item.region}</div>
<div className={'py-1'}>{item.address}</div>
<div className={'text-gray-500 py-1'}>{item.name} {item.phone}</div>
</div>
))}
</>
);
};

51
src/user/help/index.tsx

@ -1,23 +1,22 @@
import {useEffect, useState} from "react";
import {CmsArticle} from "@/api/cms/cmsArticle/model";
import {listCmsArticle} from "@/api/cms/cmsArticle";
import {Collapse} from '@nutui/nutui-react-taro'
import {Collapse, Image, SearchBar} from '@nutui/nutui-react-taro'
import {ArrowDown} from '@nutui/icons-react-taro'
import {CmsNavigation} from "@/api/cms/cmsNavigation/model";
import {listCmsNavigation} from "@/api/cms/cmsNavigation";
const Helper = () => {
const [list, setList] = useState<CmsArticle[]>([])
const [navigation, setNavigation] = useState<CmsNavigation>()
const [category, setCategory] = useState();
const getData = () => {
fetch("https://storage.360buyimg.com/nutui/3x/new-categoryData.js")
.then((response) => response.json())
.then((res) => {
setCategory(res.categoryInfo.category)
})
.catch((err) => console.log("Oh, error", err));
};
const reload = () => {
const reload = async () => {
const navs = await listCmsNavigation({model: 'help', parentId: 0});
if (navs.length > 0) {
const nav = navs[0];
setNavigation(nav);
}
listCmsArticle({model: 'help'}).then(res => {
setList(res)
}).catch(error => {
@ -26,13 +25,35 @@ const Helper = () => {
}
useEffect(() => {
reload()
getData();
reload().then()
}, []);
return (
<>
{/*<Category category={category} showSecondLevelQuickNav={true}></Category>*/}
<SearchBar shape="round" maxLength={5} className={'mt-2'} />
{navigation && (
<Image
src={navigation.icon}
mode={'scaleToFill'}
className={'mt-2 mb-4 w-full'}
height={120}
lazyLoad={false}
/>
)}
{list.map((item, index) => (
<Collapse defaultActiveName={['1', '2']} expandIcon={<ArrowDown/>}>
<Collapse.Item
title={
<div className={'flex items-center'}>
<div className={'text-sm'}>{item.title}</div>
</div>
}
name={`${index}`}
>
<div className={'text-sm'}>{item.comments}</div>
</Collapse.Item>
</Collapse>
))}
</>
);
};

2
src/user/profile/profile.tsx

@ -73,7 +73,7 @@ function Profile() {
avatar: `${detail.avatarUrl}`,
})
Taro.uploadFile({
url: 'https://server.websoft.top/api/oss/upload',
url: 'https://server.gxwebsoft.com/api/oss/upload',
filePath: detail.avatarUrl,
name: 'file',
header: {

6
src/user/userVerify/index.tsx

@ -233,11 +233,11 @@ function Index() {
>
<div className={'flex gap-2'}>
<div onClick={uploadSfz1}>
<Image src={FormData.sfz1}
<Image src={FormData.sfz1} lazyLoad={false}
radius="10%" width="80" height="80"/>
</div>
<div onClick={uploadSfz2}>
<Image src={FormData.sfz2} mode={'scaleToFill'}
<Image src={FormData.sfz2} mode={'scaleToFill'} lazyLoad={false}
radius="10%" width="80" height="80"/>
</div>
</div>
@ -286,7 +286,7 @@ function Index() {
]}
>
<div onClick={uploadZzImg}>
<Image src={FormData.zzImg} mode={'scaleToFill'}
<Image src={FormData.zzImg} mode={'scaleToFill'} lazyLoad={false}
radius="10%" width="80" height="80"/>
</div>
</Form.Item>

2
src/utils/config.ts

@ -1,7 +1,7 @@
// 租户ID
export const TenantId = 10550;
// 接口地址
export const BaseUrl = 'https://cms-api.websoft.top/api';
export const BaseUrl = 'https://cms.websoft.top/api';
// 当前版本
export const Version = 'v3.0.8';
// 版权信息

3
src/utils/request.ts

@ -3,8 +3,9 @@ import {BaseUrl, TenantId} from "@/utils/config";
let baseUrl = BaseUrl
// 开发环境
if(process.env.NODE_ENV === 'development'){
// baseUrl = 'http://localhost:9000/api'
baseUrl = 'http://localhost:9000/api'
}
export function request<T>(options:any) {
const token = Taro.getStorageSync('access_token');

2
src/utils/server.ts

@ -4,7 +4,7 @@ import {User} from "@/api/system/user/model";
// 模版套餐ID
export const TEMPLATE_ID = 10258;
// 服务接口
export const SERVER_API_URL = 'https://server.websoft.top/api';
export const SERVER_API_URL = 'https://server.gxwebsoft.com/api';
// export const SERVER_API_URL = 'http://127.0.0.1:8000/api';
/**
*

Loading…
Cancel
Save