|
@@ -250,6 +250,8 @@ export const createFamily = (name) => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 确保家庭已存在:无家庭则自动创建(默认名)
|
|
// 确保家庭已存在:无家庭则自动创建(默认名)
|
|
|
|
|
+// 注意:家庭在用户注册时已由后端创建,此函数仅作静默兜底,成功时不弹提示
|
|
|
|
|
+// (此前弹『家庭创建成功』toast 会误导用户,已移除;错误仍会提示)
|
|
|
export const ensureFamily = () => {
|
|
export const ensureFamily = () => {
|
|
|
var ui = uni.getStorageSync('userInfo') || {}
|
|
var ui = uni.getStorageSync('userInfo') || {}
|
|
|
if (ui.familyId) return Promise.resolve({ alreadyExists: true, familyId: ui.familyId })
|
|
if (ui.familyId) return Promise.resolve({ alreadyExists: true, familyId: ui.familyId })
|
|
@@ -259,7 +261,6 @@ export const ensureFamily = () => {
|
|
|
ui.familyId = res.data
|
|
ui.familyId = res.data
|
|
|
uni.setStorageSync('userInfo', ui)
|
|
uni.setStorageSync('userInfo', ui)
|
|
|
try { getApp().$store.commit('setFamilyId', res.data) } catch (e) {}
|
|
try { getApp().$store.commit('setFamilyId', res.data) } catch (e) {}
|
|
|
- uni.showToast({ title: '家庭创建成功', icon: 'success' })
|
|
|
|
|
return { created: true, familyId: res.data }
|
|
return { created: true, familyId: res.data }
|
|
|
}
|
|
}
|
|
|
throw new Error((res && res.message) || '创建失败')
|
|
throw new Error((res && res.message) || '创建失败')
|