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
| //index.js var dataUrl = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb.mp3?guid=ffffffff82def4af4b12b3cd9337d5e7&uin=346897220&vkey=6292F51E1E384E061FF02C31F716658E5C81F5594D561F2E88B854E81CAAB7806D5E4F103E55D33C16F3FAC506D1AB172DE8600B37E43FAD&fromtag=46' var util = require("../../utils/util.js");
//更改数组 第三个参数是对象 function editArr(arr,i,editCnt){ let newArr = arr,editingObj = newArr[i]; for (var x in editCnt){ editingObj[x]= editCnt[x]; } return newArr; }
//获取应用实例 var app = getApp() Page({ data: { userInfo: {}, curIpt:'', showAll:true, lists:[], curRange:[], curBegin:0, curFinish:1, remind:[] }, //事件处理函数 bindViewTap: function() { wx.navigateTo({ url: '../logs/logs' }) }, onLoad: function () { var that = this; //获取之前保留在缓存里的数据 wx.getStorage({ key: 'todolist', success: function(res) { if(res.data){ that.setData({ lists:res.data }) } } }) //获取用户信息 app.getUserInfo(function(userInfo){ that.setData({ userInfo:userInfo }) }) }, iptChange(e){ let timeArr = util.setTimeHalf(); this.setData({ curIpt:e.detail.value, curRange:timeArr }) }, formReset(){ this.setData({ curIpt:'', curRange:[] }) }, formSubmit(){ let cnt = this.data.curIpt,newLists = this.data.lists,i = newLists.length,begin=this.data.curRange[this.data.curBegin],finish = this.data.curRange[this.data.curFinish]; if (cnt){ newLists.push({id:i,content:cnt,done:false,beginTime:begin,finishTime:finish,editing:false}); this.setData({ lists:newLists, curIpt:'' }) } }, showAll(){ //显示全部事项 this.setData({ showAll:true }) }, saveData(){ let listsArr = this.data.lists; wx.setStorage({ key:'todolist', data:listsArr }) } // 修改功能后续完成 })
|