feat(dealer/customer): 实现客户列表的无限滚动和搜索功能- 在客户列表页面添加 InfiniteLoading 组件,实现无限滚动加载- 添加搜索功能,支持按关键词搜索客户

- 优化数据加载逻辑,解决重复请求问题
- 在 Header 组件中增加用户登录状态和信息的检查
This commit is contained in:
2025-09-06 10:29:35 +08:00
parent 42be544acd
commit 6f799e6775
3 changed files with 220 additions and 84 deletions

View File

@@ -38,6 +38,25 @@ const Header = (props: any) => {
},
})
// 检查用户是否已登录并且有头像和昵称
if (isLoggedIn) {
const hasAvatar = user?.avatar || Taro.getStorageSync('Avatar');
const hasNickname = user?.nickname || Taro.getStorageSync('Nickname');
if (!hasAvatar || !hasNickname) {
Taro.showToast({
title: '您还没有上传头像和昵称',
icon: 'none'
})
setTimeout(() => {
Taro.navigateTo({
url: '/user/profile/profile'
})
}, 3000)
return false;
}
}
// 如果已登录,获取最新用户信息
if (isLoggedIn) {
try {
@@ -96,7 +115,7 @@ const Header = (props: any) => {
const handleGetPhoneNumber = ({detail}: { detail: { code?: string, encryptedData?: string, iv?: string } }) => {
const {code, encryptedData, iv} = detail
Taro.login({
success: (loginRes)=> {
success: (loginRes) => {
if (code) {
Taro.request({
url: 'https://server.websoft.top/api/wx-login/loginByMpWxPhone',
@@ -184,7 +203,8 @@ const Header = (props: any) => {
}}
left={
isLoggedIn ? (
<View style={{display: 'flex', alignItems: 'center', gap: '8px'}} onClick={() => navTo(`/user/profile/profile`,true)}>
<View style={{display: 'flex', alignItems: 'center', gap: '8px'}}
onClick={() => navTo(`/user/profile/profile`, true)}>
<Avatar
size="22"
src={user?.avatar}