|
@@ -1,4 +1,5 @@
|
|
|
const app = getApp()
|
|
|
+import QRCode from '../../utils/weapp-qrcode.js';
|
|
|
Page({
|
|
|
|
|
|
/**
|
|
@@ -7,12 +8,15 @@ Page({
|
|
|
data: {
|
|
|
frameStyle: { useTop: true, name: '学员信息', leftArrow: true, useBar: false },
|
|
|
list: [],
|
|
|
- //运动等级
|
|
|
- levelList: [],
|
|
|
total: 0,
|
|
|
page: 0,
|
|
|
skip: 0,
|
|
|
limit: 5,
|
|
|
+ //运动等级
|
|
|
+ levelList: [],
|
|
|
+ // dialog弹框
|
|
|
+ dialog: { title: '账号绑定', show: false, type: '1' },
|
|
|
+ form: {}
|
|
|
},
|
|
|
// 返回
|
|
|
back: function () {
|
|
@@ -47,11 +51,36 @@ Page({
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- // 账号绑定
|
|
|
- toBind: function (e) {
|
|
|
+ // 绑定账号
|
|
|
+ toBind: async function (e) {
|
|
|
const that = this;
|
|
|
- const { item } = e.currentTarget.dataset;
|
|
|
- console.log(item);
|
|
|
+ let { item } = e.currentTarget.dataset;
|
|
|
+ const arr = await app.$get(`/student/${item.id}`);
|
|
|
+ if (arr.errcode == '0') {
|
|
|
+ that.setData({ form: arr.data })
|
|
|
+ // 生成二维码
|
|
|
+ that.makeQRCode();
|
|
|
+ that.setData({ dialog: { title: '账号绑定', show: true, type: '1' } })
|
|
|
+ } else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }) }
|
|
|
+ },
|
|
|
+ makeQRCode(template = 0) {
|
|
|
+ const that = this;
|
|
|
+ const url = `${app.globalData.publicUrl}/courtappbind?id=${that.data.form.id}&type='3'`;
|
|
|
+ var qrcode = new QRCode(`myQrcode`, {
|
|
|
+ text: url,
|
|
|
+ width: 110,
|
|
|
+ height: 110,
|
|
|
+ padding: 3,
|
|
|
+ colorDark: "#000000",
|
|
|
+ colorLight: "#ffffff",
|
|
|
+ correctLevel: QRCode.CorrectLevel.L,
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 关闭弹框
|
|
|
+ toClose: function () {
|
|
|
+ const that = this;
|
|
|
+ that.setData({ form: {} })
|
|
|
+ that.setData({ dialog: { title: '账号绑定', show: false, type: '1' } })
|
|
|
},
|
|
|
// 分页
|
|
|
toPage: function () {
|