From 38f7bdfe8ff2ed7af1ee10e05b60532140402153 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Tue, 8 Dec 2020 17:59:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=9D=E8=AF=95=E8=A7=A3=E5=86=B3=E9=80=89?= =?UTF-8?q?=E4=BA=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/footer/footer.js | 1 - components/footer/footer.wxml | 2 +- pages/userSelect/userSelect.js | 26 ++----- pages/userSelect/userSelect.wxml | 2 +- project.config.json | 114 +++++++++++++++---------------- 5 files changed, 66 insertions(+), 79 deletions(-) diff --git a/components/footer/footer.js b/components/footer/footer.js index 2052a81..6a2490f 100644 --- a/components/footer/footer.js +++ b/components/footer/footer.js @@ -14,7 +14,6 @@ Component({ */ methods: { delete(res) { - console.log(res) let index = res.currentTarget.id let list = this.data.list list.splice(index, 1) diff --git a/components/footer/footer.wxml b/components/footer/footer.wxml index 924314c..70f0fb3 100644 --- a/components/footer/footer.wxml +++ b/components/footer/footer.wxml @@ -1,7 +1,7 @@ - {{item.name}} + {{item.name}} 确定 \ No newline at end of file diff --git a/pages/userSelect/userSelect.js b/pages/userSelect/userSelect.js index 2f07103..8c807a8 100644 --- a/pages/userSelect/userSelect.js +++ b/pages/userSelect/userSelect.js @@ -34,7 +34,6 @@ Page({ success: res => { if (res.statusCode === 200) { let list = res.data.data - console.log(list) this.setData({ currentList: list, originalList:list @@ -45,12 +44,9 @@ Page({ }, clickItem(res) { - console.log(res) let index = res.currentTarget.id; let item = this.data.currentList[index] - console.log("item", item) - if (!item.isPeople) { //children的长度为0时,请求服务器 if (item.children.length === 0) { @@ -60,6 +56,7 @@ Page({ this.setData({ currentList: item.children }) + } //将当前的索引存入索引目录中。索引多一个表示目录多一级 @@ -70,7 +67,8 @@ Page({ indexList: indexes }) //清空上次选中的元素列表,并设置上一层的选中状态给lastTimeSelect - this.setLastTimeSelectList(); + // this.setLastTimeSelectList(); + } }, @@ -100,7 +98,8 @@ Page({ }) } //清空上次选中的元素列表,并设置上一层的选中状态给lastTimeSelect - this.setLastTimeSelectList(); + //this.setLastTimeSelectList(); + } }, @@ -126,7 +125,6 @@ Page({ success: res => { if (res.statusCode === 200) { let list = res.data.data - console.log(res.list) this.setData({ currentList: list }) @@ -198,12 +196,10 @@ Page({ this.setData({ originalList: originalList }) - console.log("originalList", originalList) }, //选框变化回调 checkChange(res) { - console.log(res) let values = res.detail.value let selectItems = [] //将值取出拼接成 id,name 格式 @@ -211,8 +207,6 @@ Page({ let arrs = value.split(",") selectItems.push({ id: arrs[0], name: arrs[1] }) }) - console.log("selectItems", selectItems) - console.log("lastTimeSelect", this.lastTimeSelect) //将本次选择的与上次选择的比对,本次比上次多说明新增了,本次比上次少说明删除了,找出被删除的那条数据,在footer中也删除 if (selectItems.length > this.lastTimeSelect.length) { @@ -235,7 +229,6 @@ Page({ }) if (!flag) { diffItem = item - console.log("diff=", item) } }) //找出被删除的元素在 selectList 中的位置 @@ -253,19 +246,16 @@ Page({ selectList: list }) } - console.log("selectList", this.data.selectList) //更新 currentList 选中状态并重新挂载在数据树上,以保存选择状态 this.updateCurrentList(this.data.currentList, this.data.selectList) }, //footer点击删除回调 footerDelete(res) { - console.log(res) this.setData({ selectList: res.detail.selectList }) - console.log('selectList', this.data.selectList) this.updateCurrentList(this.data.currentList, res.detail.selectList) }, @@ -280,7 +270,6 @@ Page({ wx.navigateBack({ delta: 1 }) - console.log("selectdone", selectList) }, //更新 currentList 并将更新后的列表挂载在数据树上 @@ -291,13 +280,12 @@ Page({ selectids.push(selectList[i]['id']) } for (var i = 0; i < currentList.length; i++) { - if (selectids.indexOf(currentList[i]['id'].toString())>=0){ - currentList[i]['checked']=true + if (currentList[i].isPeople && selectids.indexOf(currentList[i]['id'].toString())>=0){ + currentList[i]['checked'] = true }else{ currentList[i]['checked'] = false } } - console.log(currentList) this.setData({ currentList: currentList }) diff --git a/pages/userSelect/userSelect.wxml b/pages/userSelect/userSelect.wxml index cf095bc..f4340e3 100644 --- a/pages/userSelect/userSelect.wxml +++ b/pages/userSelect/userSelect.wxml @@ -5,7 +5,7 @@ - + diff --git a/project.config.json b/project.config.json index 5e8956e..a86adbf 100644 --- a/project.config.json +++ b/project.config.json @@ -1,59 +1,59 @@ { - "description": "项目配置文件。", - "setting": { - "urlCheck": false, - "es6": true, - "enhance": false, - "postcss": true, - "preloadBackgroundData": false, - "minified": true, - "newFeature": true, - "coverView": true, - "nodeModules": true, - "autoAudits": false, - "showShadowRootInWxmlPanel": true, - "scopeDataCheck": false, - "uglifyFileName": false, - "checkInvalidKey": true, - "checkSiteMap": true, - "uploadWithSourceMap": true, - "compileHotReLoad": false, - "useMultiFrameRuntime": false, - "useApiHook": true, - "babelSetting": { - "ignore": [], - "disablePlugins": [], - "outputPath": "" - }, - "useIsolateContext": true, - "useCompilerModule": true, - "userConfirmedUseCompilerModuleSwitch": false, - "packNpmManually": false, - "packNpmRelationList": [] - }, - "compileType": "miniprogram", - "libVersion": "2.9.4", - "appid": "wx5c39b569f01c27db", - "projectname": "aqyj", - "isGameTourist": false, - "simulatorType": "wechat", - "simulatorPluginLibVersion": {}, - "condition": { - "search": { - "current": -1, - "list": [] - }, - "conversation": { - "current": -1, - "list": [] - }, - "game": { - "currentL": -1, - "list": [] - }, - "miniprogram": { - "current": -1, - "list": [] - } - } + "description": "项目配置文件。", + "setting": { + "urlCheck": false, + "es6": true, + "postcss": true, + "minified": true, + "newFeature": true, + "coverView": true, + "nodeModules": true, + "autoAudits": false, + "showShadowRootInWxmlPanel": true, + "scopeDataCheck": false, + "checkInvalidKey": true, + "checkSiteMap": true, + "uploadWithSourceMap": true, + "babelSetting": { + "ignore": [], + "disablePlugins": [], + "outputPath": "" + }, + "useIsolateContext": true, + "useCompilerModule": false, + "userConfirmedUseCompilerModuleSwitch": false, + "enhance": false, + "preloadBackgroundData": false, + "uglifyFileName": false, + "compileHotReLoad": false, + "useMultiFrameRuntime": false, + "useApiHook": true, + "packNpmManually": false, + "packNpmRelationList": [] + }, + "compileType": "miniprogram", + "libVersion": "2.9.4", + "appid": "wx5c39b569f01c27db", + "projectname": "aqyj", + "isGameTourist": false, + "simulatorType": "wechat", + "simulatorPluginLibVersion": {}, + "condition": { + "search": { + "current": -1, + "list": [] + }, + "conversation": { + "current": -1, + "list": [] + }, + "game": { + "currentL": -1, + "list": [] + }, + "miniprogram": { + "current": -1, + "list": [] + } + } } \ No newline at end of file