// 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 }); } } })