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 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
| Page({ data: { missionInfoData: [] },
onLoad: function (options) { var that = this;
var data = { "datas": [ { "id": 1, "imgurl": "/images/ingbar.png", "imgurl1": "/images/ingbar1.png", "barname": "在读图书", "barnum": 2, "barNum": 3, "content": [ { day: 20, name: "小程序入门", type: "计算机", statecolor: "/icons/lamp.png" }, { day: 10, name: "小程序实战", type: "计算机", statecolor: "/icons/lamp.png" }, { day: 30, name: "资本论", type: "经济学", statecolor: "/icons/lamp1.png" } ] }, { "id": 2, "imgurl": "/images/ingbar.png", "imgurl1": "/images/ingbar1.png", "barname": "在阅资源", "barnum": 2, "barNum": 2, "content": [ { day: 15, name: "概率论.pdf", type: "数学", statecolor: "/icons/lamp.png" }, { day: 20, name: "计算机网络.pdf", type: "计算机", statecolor: "/icons/lamp.png" } ] }, { "id": 3, "imgurl": "/images/ingbar.png", "imgurl1": "/images/ingbar1.png", "barname": "当前竞赛", "barnum": 1, "barNum": 1, "content": [ { day: 35, name: "高校小程序开发大赛", type: "应用比赛", statecolor: "/icons/lamp.png" } ] } ] }; that.setData({ missionInfoData: data.datas }) }, toggleBtn: function (event) { var that = this; var itemId = event.currentTarget.id; if(itemId < 0) { itemId = -itemId; }
var up = "missionInfoData[" + (itemId - 1) + "].id"; var resId = -event.currentTarget.id; that.setData ({ [up]: resId }) } })
|