wish.js
1.58 KB
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
82
83
84
let app = getApp();
Page({
  data: {
    tipsRuleVisible: false,
    userInfo: {},
    wishInfo: {},
    helperInfo: {}
  },
  onShareAppMessage() {},
  onLoad(options) {
    this.initData();
  },
  initData() {
    app.queryIndex().then((result) => {
      this.setData({
        userInfo: app.globalData.userInfo
      })
      this.queryWishbillDetail();
      this.queryWishbillHelpers();
    })
  },
  // 显示规则页面
  onShowRuleHandler() {
    this.setData({
      tipsRuleVisible: true
    })
  },
  // 显示海报图
  onCreatePosterHandler() {
    app.router.push({
      path: "poster"
    })
  },
  // 获取心愿单详情
  queryWishbillDetail() {
    return new Promise((resolve, reject) => {
      app.post({
        url: app.api.wishbillDetail,
        data: {
          billCode: app.globalData.indexInfo.wishBillCode
        }
      }).then((result) => {
        this.setData({
          wishInfo: result
        })
      })
    });
  },
  // 获取助力列表
  queryWishbillHelpers() {
    return new Promise((resolve, reject) => {
      app.post({
        url: app.api.wishbillHelpers,
        data: {
          billCode: app.globalData.indexInfo.wishBillCode,
          page: 1,
          size: 50
        }
      }).then((result) => {
        this.setData({
          helperInfo: result
        })
      })
    });
  },
  // 子组件事件
  evtcomp(evt) {
    let {
      name,
      data
    } = evt.detail;
    switch (name) {
      case "_evt_hide_mask":
        this.setData({
          tipsRuleVisible: false
        })
        break;
      default:
        break;
    }
  },
})