You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
1.5 KiB
78 lines
1.5 KiB
const app = getApp<IAppOption>(); |
|
|
|
Page({ |
|
data: { |
|
toastShow: false, |
|
toastType: "", |
|
// toastShow:true, |
|
// toastType:"familyUnbind", |
|
familyList: [], |
|
userInfo: {}, |
|
UserId: "", |
|
}, |
|
onLoad() { |
|
app.waitLogin().then(() => { |
|
this.getFamilyList(); |
|
app.getUserInfo(this); |
|
}); |
|
}, |
|
getFamilyList(loading = true) { |
|
wx.ajax({ |
|
method: "GET", |
|
url: "?r=igg4/account/relatives", |
|
data: {}, |
|
loading, |
|
}).then((res) => { |
|
this.setData({ |
|
familyList: res, |
|
}); |
|
}); |
|
}, |
|
handleUnbind(e) { |
|
const { id } = e.currentTarget.dataset; |
|
this.setData({ |
|
UserId: id, |
|
toastShow: true, |
|
toastType: "familyUnbind", |
|
}); |
|
}, |
|
handleUnbinOk() { |
|
const { UserId } = this.data; |
|
this.handleUnbindCancel(); |
|
wx.ajax({ |
|
method: "POST", |
|
url: "?r=igg4/account/unbind-user", |
|
data: { |
|
UserId, |
|
}, |
|
loading: true, |
|
}).then(() => { |
|
wx.showToast({ |
|
icon: "none", |
|
title: "解绑成功", |
|
success: () => { |
|
app.getUserInfo(this, true, (_userInfo) => { |
|
app.waitLogin().then(() => { |
|
this.getFamilyList(false); |
|
}); |
|
}); |
|
}, |
|
}); |
|
}); |
|
}, |
|
handleUnbindCancel() { |
|
this.setData({ |
|
toastShow: false, |
|
toastType: "", |
|
}); |
|
}, |
|
handleBack() { |
|
wx.navigateBack({ |
|
fail() { |
|
wx.reLaunch({ |
|
url: "/pages/index/index", |
|
}); |
|
}, |
|
}); |
|
}, |
|
});
|
|
|