From 3693b2d5ede8ff6d55e2bd21323253f458fd831b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Thu, 24 Jul 2025 19:37:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=BB=86=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + pnpm-lock.yaml | 322 ++++++++++++++++++ src/api/cms/cmsAd/index.ts | 8 +- src/api/system/file/index.ts | 4 +- src/app.config.ts | 12 +- src/cms/about.config.ts | 4 - src/cms/about.tsx | 7 - src/cms/article.config.ts | 3 - src/cms/article.tsx | 51 --- src/cms/category/components/ArticleList.tsx | 25 ++ src/cms/category/components/ArticleTabs.tsx | 54 +++ src/cms/category/components/Banner.tsx | 31 ++ src/cms/category/index.config.ts | 4 + src/cms/category/index.scss | 0 src/cms/category/index.tsx | 78 +++++ src/cms/detail.scss | 4 - src/cms/detail.tsx | 96 ------ .../index.config.ts} | 0 src/cms/detail/index.scss | 50 --- src/cms/detail/index.tsx | 74 ++-- src/cms/help.config.ts | 3 - src/cms/help.tsx | 45 --- src/components/GoodsList.tsx | 4 +- src/pages/cart/cart.tsx | 1 + src/pages/index/Banner.tsx | 2 +- src/pages/index/BestSellers.tsx | 2 +- src/pages/index/GoodsList.scss | 0 src/pages/index/GoodsList.tsx | 67 ++++ src/pages/index/Header.tsx | 6 +- src/pages/index/Login.tsx | 2 +- src/pages/index/Menu.tsx | 23 +- src/pages/index/index.tsx | 14 +- src/pages/user/components/OrderIcon.tsx | 6 +- src/pages/user/components/UserCard.tsx | 2 +- src/shop/category/components/Banner.tsx | 31 ++ src/shop/category/components/GoodsList.scss | 0 src/shop/category/components/GoodsList.tsx | 51 +++ src/shop/category/index.config.ts | 4 + src/shop/category/index.scss | 0 src/shop/category/index.tsx | 78 +++++ src/shop/goodsDetail/index.tsx | 2 +- src/shop/orderConfirm/index.tsx | 2 +- src/shop/orderDetail/index.tsx | 2 +- src/user/about/index.config.ts | 2 +- src/user/about/index.tsx | 83 +++-- src/user/address/add.tsx | 185 +++++----- src/user/address/index.tsx | 94 ++--- src/user/address/wxAddress.tsx | 129 +++---- src/user/help/index.tsx | 51 ++- src/user/profile/profile.tsx | 2 +- src/user/userVerify/index.tsx | 6 +- src/utils/config.ts | 2 +- src/utils/request.ts | 3 +- src/utils/server.ts | 2 +- 54 files changed, 1141 insertions(+), 593 deletions(-) delete mode 100644 src/cms/about.config.ts delete mode 100644 src/cms/about.tsx delete mode 100644 src/cms/article.config.ts delete mode 100644 src/cms/article.tsx create mode 100644 src/cms/category/components/ArticleList.tsx create mode 100644 src/cms/category/components/ArticleTabs.tsx create mode 100644 src/cms/category/components/Banner.tsx create mode 100644 src/cms/category/index.config.ts create mode 100644 src/cms/category/index.scss create mode 100644 src/cms/category/index.tsx delete mode 100644 src/cms/detail.scss delete mode 100644 src/cms/detail.tsx rename src/cms/{detail.config.ts => detail/index.config.ts} (100%) delete mode 100644 src/cms/help.config.ts delete mode 100644 src/cms/help.tsx create mode 100644 src/pages/index/GoodsList.scss create mode 100644 src/pages/index/GoodsList.tsx create mode 100644 src/shop/category/components/Banner.tsx create mode 100644 src/shop/category/components/GoodsList.scss create mode 100644 src/shop/category/components/GoodsList.tsx create mode 100644 src/shop/category/index.config.ts create mode 100644 src/shop/category/index.scss create mode 100644 src/shop/category/index.tsx diff --git a/package.json b/package.json index f05bd1b..4a39d70 100644 --- a/package.json +++ b/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", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 55df406..dc15213 100644 --- a/pnpm-lock.yaml +++ b/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: diff --git a/src/api/cms/cmsAd/index.ts b/src/api/cms/cmsAd/index.ts index 1cb8a54..336eef2 100644 --- a/src/api/cms/cmsAd/index.ts +++ b/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>>( '/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>( '/cms/cms-ad', - { - params - } + params ); if (res.code === 0 && res.data) { return res.data; diff --git a/src/api/system/file/index.ts b/src/api/system/file/index.ts index 969fa0a..fa78a8a 100644 --- a/src/api/system/file/index.ts +++ b/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: { diff --git a/src/app.config.ts b/src/app.config.ts index 9e966f1..57fadb7 100644 --- a/src/app.config.ts +++ b/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": { diff --git a/src/cms/about.config.ts b/src/cms/about.config.ts deleted file mode 100644 index 4cd5e58..0000000 --- a/src/cms/about.config.ts +++ /dev/null @@ -1,4 +0,0 @@ -export default definePageConfig({ - navigationBarTitleText: '关于我们', - navigationBarBackgroundColor: '#ffe0e0' -}) diff --git a/src/cms/about.tsx b/src/cms/about.tsx deleted file mode 100644 index 22e4043..0000000 --- a/src/cms/about.tsx +++ /dev/null @@ -1,7 +0,0 @@ -function About() { - return ( -
About
- ) -} - -export default About diff --git a/src/cms/article.config.ts b/src/cms/article.config.ts deleted file mode 100644 index 7e92b86..0000000 --- a/src/cms/article.config.ts +++ /dev/null @@ -1,3 +0,0 @@ -export default definePageConfig({ - navigationBarTitleText: '文章列表' -}) diff --git a/src/cms/article.tsx b/src/cms/article.tsx deleted file mode 100644 index 98c8ba7..0000000 --- a/src/cms/article.tsx +++ /dev/null @@ -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(3494) - const [list, setList] = useState([]) - - const reload = () => { - if (params.id) { - setCategoryId(Number(params.id)) - } - pageCmsArticle({categoryId}).then(res => { - if (res?.list) { - setList(res?.list) - } - }) - } - - useEffect(() => { - reload() - }, []) - - return ( -
-
-
- { - list.map((item, index) => { - return ( -
Taro.navigateTo({url: `/cms/help?id=${item.articleId}`}) }> -
{item.title}
- -
- ) - }) - } -
-
-
- ) -} -export default Article diff --git a/src/cms/category/components/ArticleList.tsx b/src/cms/category/components/ArticleList.tsx new file mode 100644 index 0000000..3f46857 --- /dev/null +++ b/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 ( + <> +
+ {props.data.map((item, index) => { + return ( + + } + key={index} + onClick={() => Taro.navigateTo({url: '/cms/detail/index?id=' + item.articleId})} + /> + ) + })} +
+ + ) +} +export default ArticleList diff --git a/src/cms/category/components/ArticleTabs.tsx b/src/cms/category/components/ArticleTabs.tsx new file mode 100644 index 0000000..428d93f --- /dev/null +++ b/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(true) + const [tab1value, setTab1value] = useState('0') + const [list, setList] = useState([]) + + 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 ( + 加载中 + ) + } + + return ( + <> + { + reload(value).then() + }} + > + {props.data?.map((item, index) => { + return ( + + ) + })} + + + + ) +} +export default ArticleTabs diff --git a/src/cms/category/components/Banner.tsx b/src/cms/category/components/Banner.tsx new file mode 100644 index 0000000..7f3942d --- /dev/null +++ b/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() + const reload = () => { + getCmsAd(439).then(data => { + setItem(data) + }) + } + + useEffect(() => { + reload() + }, []) + + return ( + <> + + {item?.imageList?.map((item) => ( + + + + ))} + + + ) +} +export default MyPage diff --git a/src/cms/category/index.config.ts b/src/cms/category/index.config.ts new file mode 100644 index 0000000..689ba07 --- /dev/null +++ b/src/cms/category/index.config.ts @@ -0,0 +1,4 @@ +export default definePageConfig({ + navigationBarTitleText: '文章列表', + navigationBarTextStyle: 'black' +}) diff --git a/src/cms/category/index.scss b/src/cms/category/index.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/cms/category/index.tsx b/src/cms/category/index.tsx new file mode 100644 index 0000000..3205c26 --- /dev/null +++ b/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(0) + const [category, setCategory] = useState([]) + const [loading, setLoading] = useState(true) + const [nav, setNav] = useState() + const [list, setList] = useState([]) + + 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 ( + 加载中 + ) + } + + if(category.length > 0){ + return + } + + return +} + +export default Category diff --git a/src/cms/detail.scss b/src/cms/detail.scss deleted file mode 100644 index aa0274d..0000000 --- a/src/cms/detail.scss +++ /dev/null @@ -1,4 +0,0 @@ -.content{ - padding: 32px; - line-height: 2.4rem; -} diff --git a/src/cms/detail.tsx b/src/cms/detail.tsx deleted file mode 100644 index d88d725..0000000 --- a/src/cms/detail.tsx +++ /dev/null @@ -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() - // 浏览量 - const [views, setViews] = useState() - // 报名人数 - const [bmUsers, setBmUsers] = useState() - - 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 ( -
- -
{item?.title}
-
- {item?.categoryName} -
{views}
-
- { - item?.model == 'pay' ? '' : -
- { - !item?.endTime ? '' : -
- -
{dayjs(item?.startTime).format('YYYY-MM-DD')} 至 {dayjs(item?.endTime).format('YYYY-MM-DD')}
-
- } - { - !item?.price ? '' : - <> -
- -
{item?.price == 0 ? '线下收费' : '¥' + item?.price} -
-
- - - } -
- -
已报名 {bmUsers} 人 / 仅限校友报名 -
-
-
- } - - -
- -
活动详情 -
-
- - - - - -
- ) -} - -export default Detail diff --git a/src/cms/detail.config.ts b/src/cms/detail/index.config.ts similarity index 100% rename from src/cms/detail.config.ts rename to src/cms/detail/index.config.ts diff --git a/src/cms/detail/index.scss b/src/cms/detail/index.scss index cf68b09..e69de29 100644 --- a/src/cms/detail/index.scss +++ b/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; - } - } -} \ No newline at end of file diff --git a/src/cms/detail/index.tsx b/src/cms/detail/index.tsx index c8a70ae..b0ef53a 100644 --- a/src/cms/detail/index.tsx +++ b/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(null); - const router = Taro.getCurrentInstance().router; - const articleId = router?.params?.id; +function Detail() { + const {params} = useRouter(); + const [loading, setLoading] = useState(true) + // 文章详情 + const [item, setItem] = useState() + 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
加载中...
; + if (loading) { + return ( + 加载中 + ) } return ( -
-
-

{article.title}

-
- 作者:{article.author} - 发布时间:{dayjs(article.createTime).format('YYYY-MM-DD HH:mm')} -
-
-
- {article.image && } -
-
+
+
{item?.title}
+
{item?.createTime}
+ + + +
- ); -}; + ) +} -export default ArticleDetail; +export default Detail diff --git a/src/cms/help.config.ts b/src/cms/help.config.ts deleted file mode 100644 index d74c9f2..0000000 --- a/src/cms/help.config.ts +++ /dev/null @@ -1,3 +0,0 @@ -export default definePageConfig({ - navigationBarTitleText: '文章详情' -}) diff --git a/src/cms/help.tsx b/src/cms/help.tsx deleted file mode 100644 index b7e4976..0000000 --- a/src/cms/help.tsx +++ /dev/null @@ -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() - const reload = () => { - getCmsArticle(Number(params.id)).then(data => { - if(data){ - data.content = wxParse(data.content) - setItem(data) - } - }) - } - - useEffect(() => { - reload(); - }, []); - - return ( -
-
{item?.title}
-
{item?.createTime}
- - { - item?.editor === 1 ? - : - null - } - - -
- ) -} - -export default Detail diff --git a/src/components/GoodsList.tsx b/src/components/GoodsList.tsx index 4b1d3bd..3777b6a 100644 --- a/src/components/GoodsList.tsx +++ b/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 ( diff --git a/src/pages/cart/cart.tsx b/src/pages/cart/cart.tsx index 52c96a2..8af8411 100644 --- a/src/pages/cart/cart.tsx +++ b/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" /> diff --git a/src/pages/index/Banner.tsx b/src/pages/index/Banner.tsx index 44471a3..7f3942d 100644 --- a/src/pages/index/Banner.tsx +++ b/src/pages/index/Banner.tsx @@ -21,7 +21,7 @@ const MyPage = () => { {item?.imageList?.map((item) => ( - + ))} diff --git a/src/pages/index/BestSellers.tsx b/src/pages/index/BestSellers.tsx index 6934a0e..d644ce2 100644 --- a/src/pages/index/BestSellers.tsx +++ b/src/pages/index/BestSellers.tsx @@ -27,7 +27,7 @@ const BestSellers = () => { {list?.map((item, index) => { return (
- Taro.navigateTo({url: '/shop/goodsDetail/index?id=' + item.goodsId})}/>
diff --git a/src/pages/index/GoodsList.scss b/src/pages/index/GoodsList.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/pages/index/GoodsList.tsx b/src/pages/index/GoodsList.tsx new file mode 100644 index 0000000..f1eaf02 --- /dev/null +++ b/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([]) + + const reload = () => { + pageShopGoods({}).then(res => { + setList(res?.list || []); + }) + } + + useEffect(() => { + reload() + }, []) + + return ( + <> +
+
+ {list?.map((item, index) => { + return ( +
+ Taro.navigateTo({url: '/shop/goodsDetail/index?id=' + item.goodsId})}/> +
+
+
{item.name}
+
+ {item.comments} + 已售 {item.sales} +
+
+
+ + {item.price} +
+
+
+ Taro.navigateTo({url: '/shop/goodsDetail/index?id=' + item.goodsId})}/> +
+
Taro.navigateTo({url: '/shop/goodsDetail/index?id=' + item.goodsId})}>购买 +
+
+
+
+
+
+ ) + })} +
+
+ + ) +} +export default BestSellers diff --git a/src/pages/index/Header.tsx b/src/pages/index/Header.tsx index 152f1ce..3e1cf04 100644 --- a/src/pages/index/Header.tsx +++ b/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() @@ -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 ( diff --git a/src/pages/index/Login.tsx b/src/pages/index/Login.tsx index 1cc2dd0..a2528e6 100644 --- a/src/pages/index/Login.tsx +++ b/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, diff --git a/src/pages/index/Menu.tsx b/src/pages/index/Menu.tsx index e001379..5fd072d 100644 --- a/src/pages/index/Menu.tsx +++ b/src/pages/index/Menu.tsx @@ -11,14 +11,25 @@ const Page = () => { const [navItems, setNavItems] = useState([]) 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) => (
onNav(item)}>
- +
{item?.title}
diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx index 52d9c73..0e05fd3 100644 --- a/src/pages/index/index.tsx +++ b/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 ( <> -
+ +
+
- - + + + {/**/}
) diff --git a/src/pages/user/components/OrderIcon.tsx b/src/pages/user/components/OrderIcon.tsx index fc7ffca..1e5fb10 100644 --- a/src/pages/user/components/OrderIcon.tsx +++ b/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 = () => {
{ onLogin(item, index) }}> - +
{item?.title}
: diff --git a/src/pages/user/components/UserCard.tsx b/src/pages/user/components/UserCard.tsx index 09cf726..e12879d 100644 --- a/src/pages/user/components/UserCard.tsx +++ b/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, diff --git a/src/shop/category/components/Banner.tsx b/src/shop/category/components/Banner.tsx new file mode 100644 index 0000000..7f3942d --- /dev/null +++ b/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() + const reload = () => { + getCmsAd(439).then(data => { + setItem(data) + }) + } + + useEffect(() => { + reload() + }, []) + + return ( + <> + + {item?.imageList?.map((item) => ( + + + + ))} + + + ) +} +export default MyPage diff --git a/src/shop/category/components/GoodsList.scss b/src/shop/category/components/GoodsList.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/shop/category/components/GoodsList.tsx b/src/shop/category/components/GoodsList.tsx new file mode 100644 index 0000000..19f34aa --- /dev/null +++ b/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 ( + <> +
+
+ {props.data?.map((item, index) => { + return ( +
+ Taro.navigateTo({url: '/shop/goodsDetail/index?id=' + item.goodsId})}/> +
+
+
{item.name}
+
+ {item.comments} + 已售 {item.sales} +
+
+
+ + {item.price} +
+
+
+ Taro.navigateTo({url: '/shop/goodsDetail/index?id=' + item.goodsId})}/> +
+
Taro.navigateTo({url: '/shop/goodsDetail/index?id=' + item.goodsId})}>购买 +
+
+
+
+
+
+ ) + })} +
+
+ + ) +} +export default GoodsList diff --git a/src/shop/category/index.config.ts b/src/shop/category/index.config.ts new file mode 100644 index 0000000..9b73741 --- /dev/null +++ b/src/shop/category/index.config.ts @@ -0,0 +1,4 @@ +export default definePageConfig({ + navigationBarTitleText: '商品分类', + navigationBarTextStyle: 'black' +}) diff --git a/src/shop/category/index.scss b/src/shop/category/index.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/shop/category/index.tsx b/src/shop/category/index.tsx new file mode 100644 index 0000000..4e959f4 --- /dev/null +++ b/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(0) + const [loading, setLoading] = useState(true) + const [nav, setNav] = useState() + const [list, setList] = useState([]) + + 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 ( + 加载中 + ) + } + + return ( + <> +
+ +
+ + ) +} + +export default Category diff --git a/src/shop/goodsDetail/index.tsx b/src/shop/goodsDetail/index.tsx index 02e0106..3bf369f 100644 --- a/src/shop/goodsDetail/index.tsx +++ b/src/shop/goodsDetail/index.tsx @@ -129,7 +129,7 @@ const GoodsDetail = () => { {files.map((item) => ( - + ))} diff --git a/src/shop/orderConfirm/index.tsx b/src/shop/orderConfirm/index.tsx index 067e959..700ff7d 100644 --- a/src/shop/orderConfirm/index.tsx +++ b/src/shop/orderConfirm/index.tsx @@ -64,7 +64,7 @@ const OrderConfirm = () => {
- +
{goods.name}
¥{goods.price}
diff --git a/src/shop/orderDetail/index.tsx b/src/shop/orderDetail/index.tsx index d1dba5e..4a2b299 100644 --- a/src/shop/orderDetail/index.tsx +++ b/src/shop/orderDetail/index.tsx @@ -91,7 +91,7 @@ const OrderDetail = () => { {orderGoodsList.map((item, index) => (
- +
{item.goodsName}
数量:{item.totalNum}
diff --git a/src/user/about/index.config.ts b/src/user/about/index.config.ts index 9c56e35..f96248b 100644 --- a/src/user/about/index.config.ts +++ b/src/user/about/index.config.ts @@ -1,4 +1,4 @@ export default definePageConfig({ - navigationBarTitleText: '常见问题', + navigationBarTitleText: '关于我们', navigationBarTextStyle: 'black' }) diff --git a/src/user/about/index.tsx b/src/user/about/index.tsx index b4ba796..5bbae96 100644 --- a/src/user/about/index.tsx +++ b/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([]) + const [nav, setNav] = useState() + const [category, setCategory] = useState([]) - 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 ( -
- {list.map((item, index) => ( - }> - -
{item.title}
-
- } - name={`${index}`} - > -
{item.comments}
- - +
+ + {nav && ( + + + + {nav?.comments} + + + + + + )} + + {category.map((item, index) => ( + + {item.categoryName} +
+ )} + description={( + <> + + + {item.categoryName} + + + + {item.categoryName} + + + + )} + > + ))} + + 服务热线:0771-88888888 + 工作日:9:00-18:00 +
); }; diff --git a/src/user/address/add.tsx b/src/user/address/add.tsx index 5d8b984..b116519 100644 --- a/src/user/address/add.tsx +++ b/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(true) + const [text, setText] = useState('') + const [optionsDemo1, setOptionsDemo1] = useState([]) + const [visible, setVisible] = useState(false) + const [FormData, setFormData] = useState({}) -const OrderConfirm = () => { - const [list, setList] = useState([]) - const [classList, setClassList] = useState() - const [FormData, setFormData] = useState( - { - 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 加载中 + } + return ( <>
{ - + - + -
changeNarBar(true)}> - +
setVisible(true)}> +
- + - { - changeNarBar(false) + +
{ + setFormData({ + ...FormData, + province: `${value[0]}`, + city: `${value[1]}`, + region: `${value[2]}` + }) + setText(value.join(' ')) }} + onClose={() => setVisible(false)} /> - - {/**/} - {/* */} - {/*
*/} - {/* */} - {/*
*/} - {/*
{goods.name}
*/} - {/*
¥{goods.price}
*/} - {/*
*/} - {/*
*/} - {/*
*/} - {/*
*/} - - {/*
*/} - {/*
*/} - {/* 合计:¥{goods.price}*/} - {/*
*/} - {/* */} - {/*
*/} ); }; -export default OrderConfirm; +export default AddUserAddress; diff --git a/src/user/address/index.tsx b/src/user/address/index.tsx index 02d416f..bcb932a 100644 --- a/src/user/address/index.tsx +++ b/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([{},{},{},{}]) + const [list, setList] = useState([]) + const [address, setAddress] = useState() 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 = () => { /> - +
) } - if (list.length == 0) { - return ( - - - - - - - - - ) - } - return ( <> @@ -70,46 +95,31 @@ const Address = () => {
- {list.map((item,index) => ( - // - // - // 修改 - // - // } - // > - //
{item.fullAddress}
- // - //
- //
+ {list.map((item, _) => ( - 赵四 13800010001 + {item.name} {item.phone} - 广西壮族自治区南宁市青秀区金湖路13号 + {item.province} {item.city} {item.region} {item.address} - {index == 0 ? : } + onDefault(item)}> + {item.isDefault ? : } 默认地址 } extra={ <> - + onDel(item.id)}> 删除 - + Taro.navigateTo({url: '/user/address/add?id=' + item.id})}> 修改 diff --git a/src/user/address/wxAddress.tsx b/src/user/address/wxAddress.tsx index f61f1d0..50beeef 100644 --- a/src/user/address/wxAddress.tsx +++ b/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([{ - 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) => ( -
-
{item.province}{item.city}{item.region}
-
{item.address}
-
{item.name} {item.phone}
-
- ))} ); }; diff --git a/src/user/help/index.tsx b/src/user/help/index.tsx index 65a7c72..9789766 100644 --- a/src/user/help/index.tsx +++ b/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([]) + const [navigation, setNavigation] = useState() - 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 ( <> - {/**/} + + {navigation && ( + + )} + {list.map((item, index) => ( + }> + +
{item.title}
+
+ } + name={`${index}`} + > +
{item.comments}
+ + + ))} ); }; diff --git a/src/user/profile/profile.tsx b/src/user/profile/profile.tsx index 0ea52d5..cb141b5 100644 --- a/src/user/profile/profile.tsx +++ b/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: { diff --git a/src/user/userVerify/index.tsx b/src/user/userVerify/index.tsx index 5cbdc3d..63b7b25 100644 --- a/src/user/userVerify/index.tsx +++ b/src/user/userVerify/index.tsx @@ -233,11 +233,11 @@ function Index() { >
-
-
@@ -286,7 +286,7 @@ function Index() { ]} >
-
diff --git a/src/utils/config.ts b/src/utils/config.ts index 906814f..23d23cf 100644 --- a/src/utils/config.ts +++ b/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'; // 版权信息 diff --git a/src/utils/request.ts b/src/utils/request.ts index 7bbba37..1f1e824 100644 --- a/src/utils/request.ts +++ b/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(options:any) { const token = Taro.getStorageSync('access_token'); diff --git a/src/utils/server.ts b/src/utils/server.ts index 037fbcd..9ebf757 100644 --- a/src/utils/server.ts +++ b/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'; /** * 保存用户信息到本地存储