xusd
7 days ago 998218675eb243d43912c203174a6b72b299c0f8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// 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();
    },
});