Skip to content
This repository has been archived by the owner on Dec 7, 2020. It is now read-only.

Commit

Permalink
绑定账号提示
Browse files Browse the repository at this point in the history
  • Loading branch information
mohuishou committed Jul 15, 2018
1 parent 493eece commit 201fcb3
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
25 changes: 25 additions & 0 deletions src/pages/bind.vue
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ export default class BindJwc extends wepy.page {
}
async Bind(params) {
try {
if (db.Get(this.types[this.type].verify) == 1) {
await this.notice();
}
const res = await this.POST(this.types[this.type].url || "/bind", params);
db.Set(this.types[this.type].verify || "verify", 1);
wepy.showModal({
Expand All @@ -181,5 +184,27 @@ export default class BindJwc extends wepy.page {
console.log(error);
}
}
notice() {
return new Promise((resolve, reject) => {
wepy.showModal({
title: "提示", //提示的标题,
content: `修改${
this.types[this.type].name
}绑定账号,会清空上一个账号的所有相关数据\r\n每天最多仅可更换三次绑定账号\r\n点击确认修改`, //提示的内容,
showCancel: true, //是否显示取消按钮,
cancelText: "取消", //取消按钮的文字,默认为取消,最多 4 个字符,
cancelColor: "#000000", //取消按钮的文字颜色,
confirmText: "确定", //确定按钮的文字,默认为取消,最多 4 个字符,
confirmColor: "#3CC51F", //确定按钮的文字颜色,
success: res => {
if (res.confirm) {
resolve();
return;
}
reject("取消修改");
}
});
});
}
}
</script>
9 changes: 4 additions & 5 deletions src/util/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,10 @@ export default class Login {
})
if (resp.status === 0) {
const data = resp.data
db.Set('token', data.token)
db.Set('verify', data.verify)
db.Set('library_verify', data.library_verify)
db.Set('jwc_verify', data.jwc_verify)
db.Set('user_type', data.user_type)
// 缓存登录之后的数据
for (const key in data) {
db.Set(key, data[key])
}
if (data.jwc_verify === 0 && data.verify === 0) {
wx.showModal({
title: '账号绑定', // 提示的标题,
Expand Down

0 comments on commit 201fcb3

Please sign in to comment.