修改完成
This commit is contained in:
@@ -109,6 +109,13 @@
|
||||
<button class="uc-btn uc-btn-edit" onclick="openEditProfile()">
|
||||
编辑资料
|
||||
</button>
|
||||
<button
|
||||
class="uc-btn uc-btn-edit"
|
||||
id="referralBindButton"
|
||||
onclick="openReferralBindPrompt()"
|
||||
>
|
||||
绑定邀请码
|
||||
</button>
|
||||
<button
|
||||
class="uc-btn uc-btn-expert"
|
||||
id="expertApplyBtn"
|
||||
@@ -820,6 +827,45 @@
|
||||
});
|
||||
}
|
||||
|
||||
function bindReferralInviteCode(inviteCode) {
|
||||
var $button = $("#referralBindButton");
|
||||
$button.prop("disabled", true).text("绑定中...");
|
||||
ApiClient.post(ApiClient.API.referralBind, { inviteCode: inviteCode })
|
||||
.then(function (res) {
|
||||
if (!ApiClient.isSuccess(res)) {
|
||||
throw new Error((res && res.msg) || "邀请码绑定失败");
|
||||
}
|
||||
$button.text("已绑定");
|
||||
layui.layer.msg("邀请码绑定成功", { icon: 1 });
|
||||
})
|
||||
.catch(function (error) {
|
||||
$button.prop("disabled", false).text("绑定邀请码");
|
||||
layui.layer.msg(error.message || "邀请码绑定失败,请稍后重试", { icon: 2 });
|
||||
});
|
||||
}
|
||||
|
||||
function openReferralBindPrompt() {
|
||||
layui.layer.prompt(
|
||||
{ title: "请输入邀请人的邀请码", formType: 0, btn: ["下一步", "取消"] },
|
||||
function (value, promptIndex) {
|
||||
var inviteCode = String(value || "").trim();
|
||||
if (!inviteCode) {
|
||||
layui.layer.msg("请输入邀请码", { icon: 2 });
|
||||
return;
|
||||
}
|
||||
layui.layer.close(promptIndex);
|
||||
layui.layer.confirm(
|
||||
"每个账号只能绑定一个邀请人,绑定后不能更换。确认继续吗?",
|
||||
{ title: "确认绑定", btn: ["确认绑定", "取消"] },
|
||||
function (confirmIndex) {
|
||||
layui.layer.close(confirmIndex);
|
||||
bindReferralInviteCode(inviteCode);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
// ====== Sign-in Records ======
|
||||
function loadSignInRecords(pageNum) {
|
||||
signInPageNum = pageNum || 1;
|
||||
|
||||
Reference in New Issue
Block a user