riku
2026-01-20 91f7d372fa318e859efd20d71eafbd34274902c4
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
73
74
75
76
77
78
79
80
81
import selfpatrolservice from "../../../service/selfpatrolservice";
import moment from "../../../utils/moment.min";
const app = getApp()
 
Page({
 
  /**
   * 页面的初始数据
   */
  data: {
    date: '2026年01月20日',
    promiseText: app.globalData.userSetting.spPromiseContent,
    showDialog: false,
    promiseContent: '尊敬的用户:\n签署本承诺书后,您本年度内已上传的有效自巡查记录将无需每月重复上传,系统将视其为长期有效。您仍可随时上传新的巡查记录。\n请确保填写信息准确,承诺内容真实。虚假承诺可能导致服务终止并承担相应责任。',
    agree: false,
    confirmBtn: {
      content: '确认',
      variant: 'base'
    },
  },
 
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    var now = moment();
    this.setData({
      date: now.format('YYYY年MM月DD日'),
    });
  },
 
  checkboxChange(e) {
    var a = !this.data.agree;
    this.setData({
      agree: a,
    });
  },
 
  waitAgree() {
    if (this.data.agree) {
      return true;
    } else {
      wx.showToast({
        title: '请勾选同意条款',
        icon: 'none',
      });
      return false;
    }
  },
 
  showCheckDialog() {
    if (this.waitAgree()) {
      this.setData({
        showDialog: true
      })
    }
  },
  closeCheckDialog() {
    this.setData({
      showDialog: false
    })
  },
 
  /**
   * 签署自巡查承诺书
   */
  doPromise() {
    selfpatrolservice.signPromise(app.globalData.accessToken.userId, {
      success: res => {
        // app.globalData.userSetting = res.data
        this.getOpenerEventChannel().emit('doPromiseDone', {
          promised: res.data.selfPatrolPromised,
          promiseTime: res.data.lastPromisedTime,
        });
        wx.navigateBack({
          delta: 1,
        });
      }
    })
  },
})