From 5affde57115a5a5f4d5c81f0a0d4da484206fb01 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Tue, 17 Nov 2020 20:37:14 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E7=BB=83=E4=B9=A0=E5=85=B1=E4=BA=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/miss/miss.js | 82 +++++++++--------------- pages/miss/missdetail.js | 9 +++ pages/questioncat/index.js | 2 +- pages/safecert/detail.wxml | 4 +- pages/safecert/index.js | 19 +++++- pages/socert/socert.js | 20 +++++- pages/socert/socertdetail.wxml | 4 +- pages/user/userdetail.js | 31 +++++---- project.config.json | 114 ++++++++++++++++----------------- utils/request.js | 2 +- 10 files changed, 158 insertions(+), 129 deletions(-) diff --git a/pages/miss/miss.js b/pages/miss/miss.js index f833262..25d96ba 100644 --- a/pages/miss/miss.js +++ b/pages/miss/miss.js @@ -1,12 +1,16 @@ // pages/miss/miss.js +const api = require("../../utils/request.js"); Page({ /** * 页面的初始数据 */ data: { - page: 1, - serverUrl: getApp().globalData.serverUrl, + query:{ + a:'listall', + page:1, + rows:10 + }, wslist:[] }, @@ -51,9 +55,9 @@ Page({ */ onPullDownRefresh: function () { var that = this; - that.getWslist(1); + this.data.query.page = 1; + that.getWslist(); wx.stopPullDownRefresh(); - this.data.page = 1; }, /** @@ -61,9 +65,16 @@ Page({ */ onReachBottom: function () { //上拉分页,将页码加1,然后调用分页函数 - this.data.page = this.data.page + 1; - this.getWslist(); - wx.stopPullDownRefresh(); + var that = this + if (that.data.total <= that.data.query.page * that.data.query.rows) { + wx.showToast({ + title: '没有更多了', + icon: 'none' + }) + } else { + that.data.query.page = that.data.query.page + 1 + that.getWslist() + } }, /** @@ -72,49 +83,18 @@ Page({ onShareAppMessage: function () { }, - getWslist: function (page) { - var that = this; - if (page != 1) { page = that.data.page } - wx.showLoading({ - title: '加载中', - }), - wx.request({ - url: this.data.serverUrl + 'api/miss?a=listall&rows=10&page=' + page, - header: { - 'content-type': 'application/json', // 默认值 - 'Cookie': getApp().globalData.sessionId, - }, - success: res => { - if (res.statusCode === 200) { - if (res.data.rows.length == 0) { - if (page == 1) { - this.setData({ - total: 0, - wslist: [] - }) - } - else { - wx.showModal({ - content: "已经到底啦!", - showCancel: false, - confirmText: "确定", - }) - } - } else { - let list - if (page == 1) { - list = res.data.rows - } else { - list = this.data.wslist.concat(res.data.rows) - } - this.setData({ - total: res.data.total, - wslist: list - }) - } - } - wx.hideLoading(); - } - }); + getWslist: function () { + var that = this + api.request('api/miss', 'GET', that.data.query).then(res => { + if (that.data.query.page == 1) { + that.data.wslist = res.rows + } else { + that.data.wslist = that.data.wslist.concat(res.rows) + } + that.setData({ + wslist: that.data.wslist, + total: res.total + }) + }) }, }) \ No newline at end of file diff --git a/pages/miss/missdetail.js b/pages/miss/missdetail.js index 674333f..dfa17a9 100644 --- a/pages/miss/missdetail.js +++ b/pages/miss/missdetail.js @@ -13,6 +13,7 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { + this.data.missid = options.missid this.getWsdetail(options.missid); }, @@ -41,7 +42,15 @@ Page({ * 生命周期函数--监听页面卸载 */ onUnload: function () { + // var pages = getCurrentPages() + // var prePage = pages[pages.length-2] + // if(prePage.data.wslist){ + // for(var i=0;i姓名 - {{realname}} + {{user__userprofile__realname}} @@ -14,7 +14,7 @@ 性别 - {{gender}} + {{user__userprofile__gender}} diff --git a/pages/safecert/index.js b/pages/safecert/index.js index 0c7a3f3..26353f1 100644 --- a/pages/safecert/index.js +++ b/pages/safecert/index.js @@ -26,7 +26,7 @@ Page({ */ onShow: function () { var that = this; - that.getsafecertlist() + that.getsafecertlist2() }, /** @@ -167,4 +167,21 @@ Page({ }); }, + getsafecertlist2: function(){ + wx.showLoading({ title: '加载中', }) + wx.request({ + url: getApp().globalData.serverUrl + 'api/safecert?a=listself', + header: { + 'content-type': 'application/json', // 默认值 + 'Cookie': getApp().globalData.sessionId, + }, + success: res => { + this.setData({ + total: res.data.total, + safecertlist: res.data.rows + }) + wx.hideLoading(); + } + }); + } }) \ No newline at end of file diff --git a/pages/socert/socert.js b/pages/socert/socert.js index ad9d737..700cd59 100644 --- a/pages/socert/socert.js +++ b/pages/socert/socert.js @@ -26,7 +26,7 @@ Page({ */ onShow: function () { var that = this; - that.getSocertlist() + that.getSocertlist2() }, /** @@ -166,4 +166,22 @@ Page({ }); }, + + getSocertlist2: function() { + wx.showLoading({ title: '加载中', }) + wx.request({ + url: getApp().globalData.serverUrl + 'api/socert?a=listself', + header: { + 'content-type': 'application/json', // 默认值 + 'Cookie': getApp().globalData.sessionId, + }, + success: res => { + this.setData({ + total: res.data.total, + socertlist: res.data.rows + }) + wx.hideLoading(); + } + }); + } }) \ No newline at end of file diff --git a/pages/socert/socertdetail.wxml b/pages/socert/socertdetail.wxml index 2eba2f0..1bf8f7b 100644 --- a/pages/socert/socertdetail.wxml +++ b/pages/socert/socertdetail.wxml @@ -6,7 +6,7 @@ 姓名 - {{realname}} + {{user__userprofile__realname}} @@ -14,7 +14,7 @@ 性别 - {{gender}} + {{user__userprofile__gender}} diff --git a/pages/user/userdetail.js b/pages/user/userdetail.js index 8905111..38ba02e 100644 --- a/pages/user/userdetail.js +++ b/pages/user/userdetail.js @@ -10,7 +10,8 @@ Page({ genderarray: ['男','女'], genderIndex:0, userprofile__realname:'', - userprofile__cardnum:'' + userprofile__cardnum:'', + userprofile__gender:'男' }, bindrealnameInput: function (e) { this.data.userprofile__realname = e.detail.value @@ -161,18 +162,22 @@ Page({ if (res.statusCode === 200) { if (res.data.code == 1) { wx.hideLoading() - wx.navigateBack() - wx.request({ - url: getApp().globalData.serverUrl + 'api/socert?a=addspiderself', - header: { - 'content-type': 'application/json', // 默认值 - 'Cookie': getApp().globalData.sessionId, - }, - method: 'GET', - data: {}, - success: res => { - } - }); + wx.showToast({ + title: '保存成功', + icon:'none' + }) + // wx.navigateBack() + // wx.request({ + // url: getApp().globalData.serverUrl + 'api/socert?a=addspiderself', + // header: { + // 'content-type': 'application/json', // 默认值 + // 'Cookie': getApp().globalData.sessionId, + // }, + // method: 'GET', + // data: {}, + // success: res => { + // } + // }); } } } diff --git a/project.config.json b/project.config.json index a811634..5e8956e 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, - "babelSetting": { - "ignore": [], - "disablePlugins": [], - "outputPath": "" - }, - "useCompilerModule": true, - "userConfirmedUseCompilerModuleSwitch": false, - "compileHotReLoad": false, - "useMultiFrameRuntime": false, - "useApiHook": false, - "useIsolateContext": 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": [] - } - } + "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": [] + } + } } \ No newline at end of file diff --git a/utils/request.js b/utils/request.js index a71ae2b..b1da53b 100644 --- a/utils/request.js +++ b/utils/request.js @@ -2,7 +2,7 @@ function request(url, method, data) { let promise = new Promise((resolve, reject) => { wx.showNavigationBarLoading(); wx.request({ - url: getApp().globalData.host + url, + url: getApp().globalData.serverUrl + url, method: method, data: data, header: { From 81b9647dce13fcb3cd04253447bdf0537ff27c6c Mon Sep 17 00:00:00 2001 From: caoqianming Date: Tue, 17 Nov 2020 21:45:55 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E7=BB=83?= =?UTF-8?q?=E4=B9=A0=E8=87=AA=E5=BB=BA=E5=88=86=E7=B1=BB=E5=85=B1=E4=BA=AB?= =?UTF-8?q?=E5=88=86=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/exercise/index.js | 7 ++++++- pages/exercise/index.wxml | 9 ++++++++- pages/questioncat/index.js | 8 ++++++-- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/pages/exercise/index.js b/pages/exercise/index.js index caf453b..ed4e72b 100644 --- a/pages/exercise/index.js +++ b/pages/exercise/index.js @@ -119,7 +119,12 @@ wx.getStorage({ }, choosequestioncat:function(){ wx.navigateTo({ - url: '/pages/questioncat/index', + url: '/pages/questioncat/index?type=2', + }) + }, + choosequestioncat2:function(){ + wx.navigateTo({ + url: '/pages/questioncat/index?type=3', }) }, start1:function(){ diff --git a/pages/exercise/index.wxml b/pages/exercise/index.wxml index 3325528..5b74ea2 100644 --- a/pages/exercise/index.wxml +++ b/pages/exercise/index.wxml @@ -4,7 +4,14 @@ 选择题库分类进行练习。 - + + + + + + + + 已选分类 {{catsname}} diff --git a/pages/questioncat/index.js b/pages/questioncat/index.js index 4089c87..4c7a2fb 100644 --- a/pages/questioncat/index.js +++ b/pages/questioncat/index.js @@ -11,13 +11,17 @@ Page({ selectList: [], //已选择的元素列表 originalList: [], //最原始的数据列表 indexList: [], //存储目录层级的数组,用于准确的返回上一层 - selectList: [], //已选中的人员列表 + selectList: [], //已选中的人员列表, + type:2 }, onLoad: function (options) { wx.setNavigationBarTitle({ title: '选择分类' }) + if(options.type){ + this.data.type = options.type + } this.init(); }, @@ -25,7 +29,7 @@ Page({ //上次选中的列表,用于判断是不是取消选中了 this.lastTimeSelect = [] wx.request({ - url: getApp().globalData.serverUrl + 'api/questioncat?a=tree3', + url: getApp().globalData.serverUrl + 'api/questioncat?a=tree' + this.data.type.toString(), header: { 'content-type': 'application/json', // 默认值 'Cookie': getApp().globalData.sessionId, From 38f7bdfe8ff2ed7af1ee10e05b60532140402153 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Tue, 8 Dec 2020 17:59:34 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=B0=9D=E8=AF=95=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=E9=80=89=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 From 0a48f6fb5045f4108cb2dc7f5cdb6f18eaca1d88 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Tue, 8 Dec 2020 22:12:48 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E9=80=89=E4=BA=BA=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=8C=E6=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/userSelect/userSelect.js | 66 +++++++++++-------- project.config.json | 114 ++++++++++++++++----------------- 2 files changed, 98 insertions(+), 82 deletions(-) diff --git a/pages/userSelect/userSelect.js b/pages/userSelect/userSelect.js index 8c807a8..212bed7 100644 --- a/pages/userSelect/userSelect.js +++ b/pages/userSelect/userSelect.js @@ -11,7 +11,6 @@ Page({ selectList: [], //已选择的元素列表 originalList: [], //最原始的数据列表 indexList: [], //存储目录层级的数组,用于准确的返回上一层 - selectList: [], //已选中的人员列表 }, onLoad: function (options) { @@ -36,7 +35,7 @@ Page({ let list = res.data.data this.setData({ currentList: list, - originalList:list + originalList: list }) } } @@ -53,11 +52,21 @@ Page({ this._getUserByGroup(item) } else { //children的长度不为0时,更新 currentList - this.setData({ - currentList: item.children - }) - - + let currentList = item.children + let selectids = [] + for (var i=0;i=0){ + currentList[i]['checked'] = true + }else{ + currentList[i]['checked'] = false + } + } + this.setData({ + currentList: currentList, + }) } //将当前的索引存入索引目录中。索引多一个表示目录多一级 let indexes = this.data.indexList @@ -67,7 +76,8 @@ Page({ indexList: indexes }) //清空上次选中的元素列表,并设置上一层的选中状态给lastTimeSelect - // this.setLastTimeSelectList(); + + this.setLastTimeSelectList(); } }, @@ -79,12 +89,10 @@ Page({ if (indexList.length > 0) { //返回时删掉最后一个索引 indexList.pop() + let currentList = [] if (indexList.length == 0) { //indexList长度为0说明回到了最顶层 - this.setData({ - currentList: this.data.originalList, - indexList: indexList - }) + currentList = this.data.originalList } else { //循环将当前索引的对应数组赋值给currentList let list = this.data.originalList @@ -92,14 +100,25 @@ Page({ let index = indexList[i] list = list[index].children } - this.setData({ - currentList: list, - indexList: indexList - }) + currentList = list } //清空上次选中的元素列表,并设置上一层的选中状态给lastTimeSelect - //this.setLastTimeSelectList(); - + let selectids = [] + for (var i=0;i=0){ + currentList[i]['checked'] = true + }else{ + currentList[i]['checked'] = false + } + } + this.setData({ + currentList: currentList, + indexList: indexList + }) + this.setLastTimeSelectList(); } }, @@ -107,7 +126,7 @@ Page({ setLastTimeSelectList() { this.lastTimeSelect = [] this.data.currentList.forEach(item => { - if (item.checked) { + if (item.checked && item.isPeople) { this.lastTimeSelect.push(item) } }) @@ -193,21 +212,19 @@ Page({ break; } - this.setData({ - originalList: originalList - }) + this.data.originalList = originalList }, //选框变化回调 checkChange(res) { let values = res.detail.value let selectItems = [] + //将值取出拼接成 id,name 格式 values.forEach(value => { let arrs = value.split(",") selectItems.push({ id: arrs[0], name: arrs[1] }) }) - //将本次选择的与上次选择的比对,本次比上次多说明新增了,本次比上次少说明删除了,找出被删除的那条数据,在footer中也删除 if (selectItems.length > this.lastTimeSelect.length) { //将 selectList 与 selectItems 拼接并去重 @@ -246,7 +263,7 @@ Page({ selectList: list }) } - //更新 currentList 选中状态并重新挂载在数据树上,以保存选择状态 + this.lastTimeSelect = selectItems this.updateCurrentList(this.data.currentList, this.data.selectList) }, @@ -290,6 +307,5 @@ Page({ currentList: currentList }) this.addList2DataTree() - this.setLastTimeSelectList() } }) \ No newline at end of file diff --git a/project.config.json b/project.config.json index a86adbf..df17f0e 100644 --- a/project.config.json +++ b/project.config.json @@ -1,59 +1,59 @@ { - "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": [] - } - } + "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