// pages/signIn/index.js const $$ = require('../../utils/util'); const app = getApp(); // 签到 function signInApi(submitData) { return $$.request({ url: 'paMeetInfo/updateSign', type: 'post', service: 'mediate', submitData: { id: submitData } }); } // 获取个人信息 function getUserInfoApi() { return $$.request({ url: 'paUser/getUserInfo', type: 'get', service: 'cust' }); } Page({ /** * 页面的初始数据 */ meetUserId: 0, // 会议id data: { imgUrl: $$.url.img, userInfo: {}, signInResult: '', }, // 刷脸 handleRealName() { this.signIn(); }, // 返回调解 or 重新签到 handleClickNext() { if (this.data.signInResult === 'success') { wx.navigateBack({ delta: 1, }); } else { this.handleRealName(); } }, // 签到 async signIn() { $$.showLoading(); const res = await signInApi(this.meetUserId); $$.hideLoading(); if (res.type) { app.globalData.caseMsg.handleVisible = true; this.setData({ signInResult: 'success' }); } else { app.globalData.caseMsg.handleVisible = true; this.setData({ signInResult: 'fail' }); } }, // 获取用户个人信息 async getUserInfo() { $$.showLoading(); const res = await getUserInfoApi(); $$.hideLoading(); if (res.type) { this.setData({ userInfo: res.data }); } }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { this.meetUserId = options.meetUserId; this.getUserInfo(); }, });