fix(userManagement): 补传添加成员 relationType 并修复删除后同步空列表报错

- 一键添加本人传 relationType=1,其他添加新增传 relationType=2
- _clearAndSync 待下发列表为空时跳过 syncMembersToDevice,避免空列表 reject

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
17792275749
2026-09-15 15:08:47 +08:00
co-authored by Claude Code
parent 9332990a77
commit 9d56e63ce0
2 changed files with 10 additions and 5 deletions
+1
View File
@@ -420,6 +420,7 @@ Page({
const payload: Record<string, any> = {
...baseSpread,
...(editId ? {} : { relationType: 2 }),
dataType: userType === 'family' ? 1 : 0,
parentUserId: userInfo?.userId ?? '',
sn: targetSn,
@@ -391,12 +391,15 @@ Page({
this.setData({ syncShow: true, syncPercent: 0, syncStatus: '正在清空并重新下发...' })
leFuService.clearDeviceMembers()
.then(() => leFuService.syncMembersToDevice(syncDataList, (current, total) => {
this.setData({
syncPercent: Math.round((current / total) * 100),
syncStatus: `正在同步 ${current}/${total}...`,
.then(() => {
if (!syncDataList.length) return
return leFuService.syncMembersToDevice(syncDataList, (current, total) => {
this.setData({
syncPercent: Math.round((current / total) * 100),
syncStatus: `正在同步 ${current}/${total}...`,
})
})
}))
})
.then(() => this._finishSync(reportUsers, '重新下发成功'))
.catch((err: Error) => {
this.setData({ syncShow: false })
@@ -485,6 +488,7 @@ Page({
if (!sn) return
addSelfUser({
relationType: 1,
dataType: 0,
parentUserId: userInfo.userId,
sn,