Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
lls_program
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2025-09-03 10:58:10 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a75c944255a4dbac292970a506625aaa68eeb467
a75c9442
1 parent
3d93910f
fix(MyFamily): 修复家庭创建者退出家庭的逻辑问题
移除解散家庭功能并添加创建者退出限制 家庭创建者现在会收到提示不能退出家庭
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
32 deletions
src/pages/MyFamily/index.vue
src/pages/MyFamily/index.vue
View file @
a75c944
...
...
@@ -93,10 +93,11 @@
切换到此家庭
</view>
<view
@tap="family.is_my ? dissolveFamily(family.id) : exitFamily(family.id)"
v-if="!family.is_my"
@tap="exitFamily(family.id)"
class="px-4 py-2 bg-red-500 text-white text-sm rounded-lg"
>
{{ family.is_my ? '解散家庭' : '退出家庭' }}
退出家庭
</view>
</view>
</view>
...
...
@@ -327,6 +328,15 @@ const exitFamily = (familyId) => {
const family = familyList.value.find(f => f.id === familyId);
if (!family) return;
// 家庭所有者不能退出
if (family.is_my) {
Taro.showToast({
title: '您是家庭创建者,不能退出家庭',
icon: 'none',
});
return;
}
Taro.showModal({
title: '退出家庭',
content: `确定要退出「${family.name}」吗?退出后将无法查看该家庭的相关信息。`,
...
...
@@ -362,37 +372,7 @@ const exitFamily = (familyId) => {
});
};
/**
* 解散家庭
* @param {number} familyId - 家庭ID
*/
const dissolveFamily = (familyId) => {
const family = familyList.value.find(f => f.id === familyId);
if (!family) return;
Taro.showModal({
title: '解散家庭',
content: `确定要解散「${family.name}」吗?\n\n解散后:\n• 所有家庭成员将被移除\n• 家庭数据将被永久删除\n• 此操作无法撤销\n\n请谨慎操作!`,
confirmText: '确认解散',
cancelText: '取消',
success: (res) => {
if (res.confirm) {
// 解散家庭逻辑
familyList.value = familyList.value.filter(f => f.id !== familyId);
Taro.showToast({
title: '家庭已解散',
icon: 'success'
});
// 延迟返回我的页面
setTimeout(() => {
Taro.navigateBack();
}, 1500);
}
}
});
};
/**
* 加入新家庭
...
...
Please
register
or
login
to post a comment