diff --git a/src/pages/bind.vue b/src/pages/bind.vue index 29dfc60..2678a71 100644 --- a/src/pages/bind.vue +++ b/src/pages/bind.vue @@ -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({ @@ -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("取消修改"); + } + }); + }); + } } diff --git a/src/util/login.js b/src/util/login.js index 527e723..b2002b4 100644 --- a/src/util/login.js +++ b/src/util/login.js @@ -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: '账号绑定', // 提示的标题,