answer.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. import common from '../../utils/util';
  2. import server from '../../utils/main';
  3. const app = getApp()
  4. Page({
  5. data: {
  6. version: app.globalData.version,
  7. FileUrl: app.globalData.fileUrl,
  8. IsEdit: false,
  9. ListHeight: 1320,
  10. },
  11. onLoad: function () {
  12. this.setData({
  13. Containnerheight: server.getWindowHeight(),
  14. });
  15. this.getList();
  16. },
  17. getList: function () {
  18. var that = this;
  19. var list = wx.getStorageSync("QuestionList");
  20. if (list && list.length > 0) {
  21. var arr = [];
  22. for (var i = list.length - 1; i >= 0; i--) {
  23. list[i].Selected = false;
  24. arr.push(list[i]);
  25. }
  26. var ListHeight = 1320;
  27. var ListHeight2 = 1490;
  28. var ListHeight3 = arr.length * 130+20;
  29. if (arr.length > 10) {
  30. ListHeight = 1320 + (arr.length - 10) * 130;
  31. ListHeight2 = 1490 + (arr.length - 10) * 130;
  32. }
  33. that.setData({
  34. AnswerList: arr,
  35. ListHeight: ListHeight,
  36. ListHeight2: ListHeight2,
  37. ListHeight3: ListHeight3,
  38. });
  39. }
  40. },
  41. selectItem: function (e) {
  42. if (e.currentTarget.dataset.id) {
  43. var id = e.currentTarget.dataset.id;
  44. var list = this.data.AnswerList;
  45. for (var i = list.length - 1; i >= 0; i--) {
  46. if (id == list[i].AnswerID)
  47. list[i].Selected = true;
  48. else
  49. list[i].Selected = false;
  50. }
  51. this.setData({
  52. AnswerList: list,
  53. });
  54. }
  55. },
  56. btnEdit: function () {
  57. var that = this;
  58. that.data.IsEdit = !that.data.IsEdit;
  59. that.setData({
  60. IsEdit: that.data.IsEdit,
  61. });
  62. },
  63. onShareAppMessage: function () {
  64. return {
  65. title: '',
  66. path: 'pages/index/index',
  67. success: function (res) {
  68. },
  69. fail: function (err) {
  70. console.log(err);
  71. },
  72. complete: function (res) {
  73. console.log(res);
  74. },
  75. }
  76. },
  77. })