|
@@ -3,116 +3,6 @@ import apiUrl from '../../../util/apiUrl'
|
|
|
var app = getApp();
|
|
|
Page({
|
|
|
data: {
|
|
|
- /**
|
|
|
- * [
|
|
|
- {
|
|
|
- "categoryName": "洗护类",
|
|
|
- "TaskItems": [
|
|
|
- {
|
|
|
- "id": 1,
|
|
|
- "itemName": "洗衣服",
|
|
|
- "categoryId": 1,
|
|
|
- "disabled": true,
|
|
|
- "createTime": "2020-09-28 11:38:26",
|
|
|
- "updateTime": "2020-09-28 11:38:26"
|
|
|
- },
|
|
|
- {
|
|
|
- "id": 2,
|
|
|
- "itemName": "熨烫衣服",
|
|
|
- "categoryId": 1,
|
|
|
- "disabled": true,
|
|
|
- "createTime": "2020-09-28 11:38:44",
|
|
|
- "updateTime": "2020-09-28 11:38:44"
|
|
|
- },
|
|
|
- {
|
|
|
- "id": 3,
|
|
|
- "itemName": "晾晒收衣",
|
|
|
- "categoryId": 1,
|
|
|
- "disabled": true,
|
|
|
- "createTime": "2020-09-28 11:39:06",
|
|
|
- "updateTime": "2020-09-28 11:39:06"
|
|
|
- },
|
|
|
- {
|
|
|
- "id": 4,
|
|
|
- "itemName": "做早餐",
|
|
|
- "categoryId": 2,
|
|
|
- "disabled": true,
|
|
|
- "createTime": "2020-09-28 11:39:43",
|
|
|
- "updateTime": "2020-09-28 11:39:43"
|
|
|
- },
|
|
|
- {
|
|
|
- "id": 5,
|
|
|
- "itemName": "做午餐",
|
|
|
- "categoryId": 2,
|
|
|
- "disabled": true,
|
|
|
- "createTime": "2020-09-28 11:39:58",
|
|
|
- "updateTime": "2020-09-28 11:39:58"
|
|
|
- },
|
|
|
- {
|
|
|
- "id": 6,
|
|
|
- "itemName": "做晚餐",
|
|
|
- "categoryId": 2,
|
|
|
- "disabled": true,
|
|
|
- "createTime": "2020-09-28 11:40:18",
|
|
|
- "updateTime": "2020-09-28 11:40:18"
|
|
|
- }
|
|
|
- ]
|
|
|
- },
|
|
|
- {
|
|
|
- "categoryName": "做饭类",
|
|
|
- "TaskItems": [
|
|
|
- {
|
|
|
- "id": 1,
|
|
|
- "itemName": "洗衣服",
|
|
|
- "categoryId": 1,
|
|
|
- "disabled": true,
|
|
|
- "createTime": "2020-09-28 11:38:26",
|
|
|
- "updateTime": "2020-09-28 11:38:26"
|
|
|
- },
|
|
|
- {
|
|
|
- "id": 2,
|
|
|
- "itemName": "熨烫衣服",
|
|
|
- "categoryId": 1,
|
|
|
- "disabled": true,
|
|
|
- "createTime": "2020-09-28 11:38:44",
|
|
|
- "updateTime": "2020-09-28 11:38:44"
|
|
|
- },
|
|
|
- {
|
|
|
- "id": 3,
|
|
|
- "itemName": "晾晒收衣",
|
|
|
- "categoryId": 1,
|
|
|
- "disabled": true,
|
|
|
- "createTime": "2020-09-28 11:39:06",
|
|
|
- "updateTime": "2020-09-28 11:39:06"
|
|
|
- },
|
|
|
- {
|
|
|
- "id": 4,
|
|
|
- "itemName": "做早餐",
|
|
|
- "categoryId": 2,
|
|
|
- "disabled": true,
|
|
|
- "createTime": "2020-09-28 11:39:43",
|
|
|
- "updateTime": "2020-09-28 11:39:43"
|
|
|
- },
|
|
|
- {
|
|
|
- "id": 5,
|
|
|
- "itemName": "做午餐",
|
|
|
- "categoryId": 2,
|
|
|
- "disabled": true,
|
|
|
- "createTime": "2020-09-28 11:39:58",
|
|
|
- "updateTime": "2020-09-28 11:39:58"
|
|
|
- },
|
|
|
- {
|
|
|
- "id": 6,
|
|
|
- "itemName": "做晚餐",
|
|
|
- "categoryId": 2,
|
|
|
- "disabled": true,
|
|
|
- "createTime": "2020-09-28 11:40:18",
|
|
|
- "updateTime": "2020-09-28 11:40:18"
|
|
|
- }
|
|
|
- ]
|
|
|
- }
|
|
|
- ]
|
|
|
- */
|
|
|
allList: []
|
|
|
},
|
|
|
onLoad(options) {
|
|
@@ -152,39 +42,39 @@ Page({
|
|
|
let currentIndex= e.target.dataset.index;
|
|
|
console.log('index=' + currentIndex);
|
|
|
// console.log(id.currentIndex);
|
|
|
- // let id=e.target.dataset.id;
|
|
|
- // let isNew=this.data.allList[currentIndex].every(item=>{return id!=item.id});
|
|
|
- // if(isNew){
|
|
|
- // let newArr=this.data.allList[currentIndex];
|
|
|
- // let obj={
|
|
|
- // index:id,
|
|
|
- // }
|
|
|
- // newArr.push(obj);
|
|
|
- // let newArrClass=this.data.allList[currentIndex];
|
|
|
- // newArrClass.push(id);
|
|
|
- // this.setData({
|
|
|
- // workSelectedList:newArr,
|
|
|
- // workSelectedClassList:newArrClass
|
|
|
- // })
|
|
|
- // }else{
|
|
|
- // let spliceIndex='';
|
|
|
- // this.data.workSelectedList.forEach((item,index)=> {
|
|
|
- // if(item.index==id){
|
|
|
- // console.log(item,index);
|
|
|
- // spliceIndex=index;
|
|
|
- // return;
|
|
|
+ let id=e.target.dataset.id;
|
|
|
+ let isNew=this.data.allList[currentIndex].every(item=>{return id!=item.id});
|
|
|
+ if(isNew){
|
|
|
+ let newArr=this.data.allList[currentIndex];
|
|
|
+ let obj={
|
|
|
+ index:id,
|
|
|
+ }
|
|
|
+ newArr.push(obj);
|
|
|
+ let newArrClass=this.data.allList[currentIndex];
|
|
|
+ newArrClass.push(id);
|
|
|
+ this.setData({
|
|
|
+ workSelectedList:newArr,
|
|
|
+ workSelectedClassList:newArrClass
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ let spliceIndex='';
|
|
|
+ this.data.workSelectedList.forEach((item,index)=> {
|
|
|
+ if(item.index==id){
|
|
|
+ console.log(item,index);
|
|
|
+ spliceIndex=index;
|
|
|
+ return;
|
|
|
|
|
|
- // }
|
|
|
- // })
|
|
|
- // let newArr=this.data.workSelectedList;
|
|
|
- // let newArrClass=this.data.workSelectedClassList;
|
|
|
- // newArr.splice(spliceIndex,1);
|
|
|
- // newArrClass.splice(newArrClass.indexOf(id),1);
|
|
|
- // this.setData({
|
|
|
- // workSelectedList:newArr,
|
|
|
- // workSelectedClassList:newArrClass
|
|
|
- // })
|
|
|
- // }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ let newArr=this.data.workSelectedList;
|
|
|
+ let newArrClass=this.data.workSelectedClassList;
|
|
|
+ newArr.splice(spliceIndex,1);
|
|
|
+ newArrClass.splice(newArrClass.indexOf(id),1);
|
|
|
+ this.setData({
|
|
|
+ workSelectedList:newArr,
|
|
|
+ workSelectedClassList:newArrClass
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
dailytasksdeit() {
|
|
|
/**
|