From be74cb34c86642a1a834dd10b9f50d682d3e5f76 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com>
Date: Wed, 10 Sep 2025 10:09:12 +0800
Subject: [PATCH] =?UTF-8?q?refactor(user):=20=E9=87=8D=E6=9E=84=E7=94=A8?=
=?UTF-8?q?=E6=88=B7=E9=A1=B5=E9=9D=A2=E5=B8=83=E5=B1=80=E5=92=8C=E5=8A=9F?=
=?UTF-8?q?=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 移除未使用的导入和注释
- 更新页面标题和样式
- 添加新的 UserGrid 组件
- 修改 IsDealer 组件的文案
- 优化搜索框样式
- 更新分享信息标题
---
src/dealer/qrcode/index.tsx | 136 ++++++++++++-------------
src/pages/cart/cart.tsx | 2 +-
src/pages/index/Header.tsx | 5 +-
src/pages/index/MySearch.tsx | 4 +-
src/pages/index/index.tsx | 2 +-
src/pages/user/components/IsDealer.tsx | 2 +-
src/pages/user/components/UserGrid.tsx | 111 ++++++++++++++++++++
src/pages/user/user.tsx | 30 +-----
8 files changed, 189 insertions(+), 103 deletions(-)
create mode 100644 src/pages/user/components/UserGrid.tsx
diff --git a/src/dealer/qrcode/index.tsx b/src/dealer/qrcode/index.tsx
index 882931b..90edb58 100644
--- a/src/dealer/qrcode/index.tsx
+++ b/src/dealer/qrcode/index.tsx
@@ -1,7 +1,7 @@
import React, {useState, useEffect} from 'react'
import {View, Text, Image} from '@tarojs/components'
import {Button, Loading} from '@nutui/nutui-react-taro'
-import {Share, Download, Copy, QrCode} from '@nutui/icons-react-taro'
+import {Download, QrCode} from '@nutui/icons-react-taro'
import Taro from '@tarojs/taro'
import {useDealerUser} from '@/hooks/useDealerUser'
import {generateInviteCode} from '@/api/invite'
@@ -115,52 +115,52 @@ const DealerQrcode: React.FC = () => {
}
// 复制邀请信息
- const copyInviteInfo = () => {
- if (!dealerUser?.userId) {
- Taro.showToast({
- title: '用户信息未加载',
- icon: 'error'
- })
- return
- }
-
- const inviteText = `🎉 邀请您加入我的团队!
-
-扫描小程序码或搜索"时里院子市集"小程序,即可享受优质商品和服务!
-
-💰 成为我的团队成员,一起赚取丰厚佣金
-🎁 新用户专享优惠等你来拿
-
-邀请码:${dealerUser.userId}
-快来加入我们吧!`
-
- Taro.setClipboardData({
- data: inviteText,
- success: () => {
- Taro.showToast({
- title: '邀请信息已复制',
- icon: 'success'
- })
- }
- })
- }
+// const copyInviteInfo = () => {
+// if (!dealerUser?.userId) {
+// Taro.showToast({
+// title: '用户信息未加载',
+// icon: 'error'
+// })
+// return
+// }
+//
+// const inviteText = `🎉 邀请您加入我的团队!
+//
+// 扫描小程序码或搜索"时里院子市集"小程序,即可享受优质商品和服务!
+//
+// 💰 成为我的团队成员,一起赚取丰厚佣金
+// 🎁 新用户专享优惠等你来拿
+//
+// 邀请码:${dealerUser.userId}
+// 快来加入我们吧!`
+//
+// Taro.setClipboardData({
+// data: inviteText,
+// success: () => {
+// Taro.showToast({
+// title: '邀请信息已复制',
+// icon: 'success'
+// })
+// }
+// })
+// }
// 分享小程序码
- const shareMiniProgramCode = () => {
- if (!dealerUser?.userId) {
- Taro.showToast({
- title: '用户信息未加载',
- icon: 'error'
- })
- return
- }
-
- // 小程序分享
- Taro.showShareMenu({
- withShareTicket: true,
- showShareItems: ['shareAppMessage']
- })
- }
+ // const shareMiniProgramCode = () => {
+ // if (!dealerUser?.userId) {
+ // Taro.showToast({
+ // title: '用户信息未加载',
+ // icon: 'error'
+ // })
+ // return
+ // }
+ //
+ // // 小程序分享
+ // Taro.showShareMenu({
+ // withShareTicket: true,
+ // showShareItems: ['shareAppMessage']
+ // })
+ // }
if (!dealerUser) {
return (
@@ -263,29 +263,29 @@ const DealerQrcode: React.FC = () => {
保存小程序码到相册
-
-
-
-
-
-
+ {/**/}
+ {/* */}
+ {/**/}
+ {/**/}
+ {/* */}
+ {/**/}
{/* 推广说明 */}
diff --git a/src/pages/cart/cart.tsx b/src/pages/cart/cart.tsx
index 8711e5b..e415a03 100644
--- a/src/pages/cart/cart.tsx
+++ b/src/pages/cart/cart.tsx
@@ -41,7 +41,7 @@ function Cart() {
useShareAppMessage(() => {
return {
- title: '购物车 - 网宿小店',
+ title: '购物车 - 时里院子市集',
success: function () {
console.log('分享成功');
},
diff --git a/src/pages/index/Header.tsx b/src/pages/index/Header.tsx
index cd5fc25..0427d86 100644
--- a/src/pages/index/Header.tsx
+++ b/src/pages/index/Header.tsx
@@ -173,9 +173,10 @@ const Header = (props: any) => {
return (
<>
-
+
{/*{!props.stickyStatus && }*/}
('')
const onKeywords = (keywords: string) => {
@@ -39,7 +39,7 @@ function MySearch() {
background: '#ffffff',
padding: '0 5px',
borderRadius: '20px',
- marginTop: '100px',
+ marginTop: `${props.statusBarHeight + 50}px`,
}}
>
diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx
index 3aee534..286a5c3 100644
--- a/src/pages/index/index.tsx
+++ b/src/pages/index/index.tsx
@@ -21,7 +21,7 @@ function Home() {
const userId = Taro.getStorageSync('UserId');
return {
- title: '网宿小店 - 网宿软件',
+ title: '时里院子市集',
path: userId ? `/pages/index/index?inviter=${userId}&source=share&t=${Date.now()}` : `/pages/index/index`,
success: function () {
console.log('首页分享成功');
diff --git a/src/pages/user/components/IsDealer.tsx b/src/pages/user/components/IsDealer.tsx
index 15936cc..f8315aa 100644
--- a/src/pages/user/components/IsDealer.tsx
+++ b/src/pages/user/components/IsDealer.tsx
@@ -56,7 +56,7 @@ const UserCell = () => {
管理中心
+ className={'pl-3 text-orange-100 font-medium'}>分销中心
{/*门店核销*/}
}
diff --git a/src/pages/user/components/UserGrid.tsx b/src/pages/user/components/UserGrid.tsx
new file mode 100644
index 0000000..7fc7765
--- /dev/null
+++ b/src/pages/user/components/UserGrid.tsx
@@ -0,0 +1,111 @@
+import {Grid, ConfigProvider} from '@nutui/nutui-react-taro'
+import navTo from "@/utils/common";
+import Taro from '@tarojs/taro'
+import {View} from '@tarojs/components'
+import {ShieldCheck, Location, Tips, Ask, Dongdong, People, AfterSaleService, Logout} from '@nutui/icons-react-taro'
+import {useUser} from "@/hooks/useUser";
+
+const UserCell = () => {
+ const {logoutUser} = useUser();
+
+ const onLogout = () => {
+ Taro.showModal({
+ title: '提示',
+ content: '确定要退出登录吗?',
+ success: function (res) {
+ if (res.confirm) {
+ // 使用 useUser hook 的 logoutUser 方法
+ logoutUser();
+ Taro.reLaunch({
+ url: '/pages/index/index'
+ })
+ }
+ }
+ })
+ }
+
+ return (
+ <>
+
+ 我的服务
+
+
+ navTo('/user/address/index', true)}>
+
+
+
+
+
+
+
+ navTo('/user/userVerify/index', true)}>
+
+
+
+
+
+
+
+ navTo('/dealer/team/index', true)}>
+
+
+
+
+
+
+
+ navTo('/dealer/qrcode/index', true)}>
+
+
+
+
+
+
+
+ navTo('/admin/index', true)}>
+
+
+
+
+
+
+
+ navTo('/user/help/index')}>
+
+
+
+
+
+
+
+ navTo('/user/about/index')}>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ >
+ )
+}
+export default UserCell
diff --git a/src/pages/user/user.tsx b/src/pages/user/user.tsx
index c4f4930..2ad1f98 100644
--- a/src/pages/user/user.tsx
+++ b/src/pages/user/user.tsx
@@ -2,17 +2,13 @@ import {useEffect, useRef} from 'react'
import {PullToRefresh} from '@nutui/nutui-react-taro'
import UserCard from "./components/UserCard";
import UserOrder from "./components/UserOrder";
-import UserCell from "./components/UserCell";
import UserFooter from "./components/UserFooter";
-import {useUser} from "@/hooks/useUser";
import {useUserData} from "@/hooks/useUserData";
import './user.scss'
import IsDealer from "./components/IsDealer";
+import UserGrid from "@/pages/user/components/UserGrid";
function User() {
- const {
- isAdmin
- } = useUser();
const { refresh } = useUserData()
const userCardRef = useRef()
@@ -29,28 +25,6 @@ function User() {
useEffect(() => {
}, []);
- /**
- * 门店核销管理
- */
- if (isAdmin()) {
- return (
-
-
-
-
-
-
-
-
-
- )
- }
-
return (
-
+