Jamcuk
2017-12-27 3996156e8e022dce953986acd91c3045272a4adb
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
// pages/help/help.js
 
const app = getApp();
const com = require("../../utils/common.js");
const dowx = require("../../utils/DOWX.js");
 
 
Page({
 
    data: {
        // 问题组
        zu_list: null,
 
        // 页面获取
        index_xuan: -1 // 当前选择的单框id
    },
 
    onShow: function()
    {
        var th=this;
        app.Get_info(function(infoD)
        {
            // 数据准备
            var mydata = { openid: infoD.info2.openid };
            var myurl = com.getWholeUrl('bainian/api/client/config/getcommonquestions',mydata);
            // 请求数据
            dowx.AjaxPost(myurl,{},function(res)
            {
                dowx.AjaxStop();
 
                if ( res.code == 0 ) { th.setData({ zu_list: res.data }); }
                else{ dowx.Showred(th,'获取问题列表返回错误:'+res.msg); }
            });
        });
        
    },
 
    Click_dan: function(ev)
    {
        var th = this;
        var index = ev.currentTarget.id; // 获取选择的id
        if (index == th.data.index_xuan)
        {
            // 初始化所选择的id
            th.setData({ index_xuan: -1 });
        }
        else
        {
            // 初始化所选择的id
            th.setData({ index_xuan: -1 });
            th.setData({ index_xuan: index });
        }
    }
 
})