import common from '../../utils/util'; import server from '../../utils/main'; const app = getApp() Page({ data: { version: app.globalData.version, FileUrl: app.globalData.fileUrl, IsEdit: false, ListHeight: 1320, }, onLoad: function () { this.setData({ Containnerheight: server.getWindowHeight(), }); this.getList(); }, getList: function () { var that = this; var list = wx.getStorageSync("QuestionList"); if (list && list.length > 0) { var arr = []; for (var i = list.length - 1; i >= 0; i--) { list[i].Selected = false; arr.push(list[i]); } var ListHeight = 1320; var ListHeight2 = 1490; var ListHeight3 = arr.length * 130+20; if (arr.length > 10) { ListHeight = 1320 + (arr.length - 10) * 130; ListHeight2 = 1490 + (arr.length - 10) * 130; } that.setData({ AnswerList: arr, ListHeight: ListHeight, ListHeight2: ListHeight2, ListHeight3: ListHeight3, }); } }, selectItem: function (e) { if (e.currentTarget.dataset.id) { var id = e.currentTarget.dataset.id; var list = this.data.AnswerList; for (var i = list.length - 1; i >= 0; i--) { if (id == list[i].AnswerID) list[i].Selected = true; else list[i].Selected = false; } this.setData({ AnswerList: list, }); } }, btnEdit: function () { var that = this; that.data.IsEdit = !that.data.IsEdit; that.setData({ IsEdit: that.data.IsEdit, }); }, onShareAppMessage: function () { return { title: '', path: 'pages/index/index', success: function (res) { }, fail: function (err) { console.log(err); }, complete: function (res) { console.log(res); }, } }, })