From f84d9327f364a04a6499f1a5f44e1bdfcf5958dd Mon Sep 17 00:00:00 2001 From: yvan.ni Date: Sat, 23 May 2020 17:26:09 +0800 Subject: [PATCH] 分类列表添加风格页面 商品列表 --- .idea/mshopweapp.iml | 8 ++++++++ pages/goods/categoryList/categoryList.js | 62 ++++++++++++++++++++++++++++++++++++++++---------------------- pages/goods/categoryList/categoryList.wxml | 47 +++++++++++++++++++++++------------------------ project.config.json | 17 ++++++++++++++++- 4 files changed, 87 insertions(+), 47 deletions(-) create mode 100644 .idea/mshopweapp.iml diff --git a/.idea/mshopweapp.iml b/.idea/mshopweapp.iml new file mode 100644 index 0000000..c956989 --- /dev/null +++ b/.idea/mshopweapp.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/pages/goods/categoryList/categoryList.js b/pages/goods/categoryList/categoryList.js index 8446b1a..9792a66 100644 --- a/pages/goods/categoryList/categoryList.js +++ b/pages/goods/categoryList/categoryList.js @@ -63,6 +63,8 @@ Page({ msgStatus:false, //页面显示暂无数据状态 countDownNum: 3, timer: '', //定时器 + lastMsg:false, + toView:"", }, onLoad: function(tt) { var that = this; @@ -543,10 +545,8 @@ Page({ //==2的时候 请求数据为商品,不为分类 if (this.data.is_used_share == 2) { this.style(this.data.stylePage, cid) - this.setData({ select_classify_on: indexs, index: indexs, classify_name: name, cat_id: cid }); + this.setData({ select_classify_on: indexs, index: indexs, classify_name: name, cat_id: cid,lastMsg: false, }); }else{ - - if (arr != "undefined" && arr != undefined) { if (arr.length == 0) { this.setData({ @@ -569,7 +569,7 @@ Page({ } } } - this.setData({ select_classify_on: indexs, index: indexs, classify_name: name, cat_id: cid, stylePage:1}); + this.setData({ select_classify_on: indexs, index: indexs, classify_name: name, cat_id: cid, stylePage: 1,lastMsg: false,}); } }, @@ -665,6 +665,7 @@ Page({ that.setData({ stylePage: that.data.stylePage + 1, countDownNum: 3, + lastMsg: false, }); that.style(that.data.stylePage, that.data.cat_id); }, @@ -680,6 +681,7 @@ Page({ that.setData({ stylePage: that.data.stylePage + 1, countDownNum: 3, + lastMsg: false, }); that.style(that.data.stylePage, that.data.cat_id); }, @@ -698,7 +700,16 @@ Page({ msgStatus: false, }); //如果有数据 怕断分页为第一页的时候直接渲染数据 - if (page = 1) { + if (page > 1) { + //如果分页不是在第一页 那么就把返回的数据追加到原有数据后面 + var arr = s.data.requestData + console.log("arr:=" + JSON.stringify(arr)) + arr.push(e.data.data.pageData); + s.setData({ + requestData: arr + }); + + }else{ s.setData({ requestData: e.data.data.pageData }); @@ -707,14 +718,8 @@ Page({ scrollTop: 0 }) } - }else{ - //如果分页不是在第一页 那么就把返回的数据追加到原有数据后面 - var arr = s.data.requestData - arr.push(e.data.data.pageData); - s.setData({ - requestData: arr - }); } + } else { //没有数据页面显示暂无数据 @@ -731,6 +736,10 @@ Page({ }); s.style(s.data.stylePage, dataArray[index + 1]['items']['id']) }else{ + //没有数据而且是第一页的时候 + s.setData({ + stylePage: 1, + }); let countDownNum = 3; //获取倒计时初始值 s.setData({ msgStatus: true, @@ -750,16 +759,25 @@ Page({ //没有数据根据当前分类id去找到下一个分类id再次传递给服务端请求数据 var dataArray = s.data.one_level_classify var index = s.data.index - console.log(dataArray[index + 1]['items']) - s.setData({ - stylePage: 1, - index: index + 1, - select_classify_on: index + 1, - cat_id: dataArray[index + 1]['items']['id'], - classify_name: dataArray[index + 1]['items']['name'] - }); - s.style(s.data.stylePage, dataArray[index + 1]['items']['id']); - + console.log(dataArray[index + 1]) + if (dataArray[index + 1] == undefined || dataArray[index + 1] == "undefined"){ + console.log("dataArray[index + 1] = undefined") + s.setData({ + stylePage: 1, + msgStatus: false, + lastMsg: true + }); + }else{ + s.setData({ + stylePage: 1, + index: index + 1, + select_classify_on: index + 1, + cat_id: dataArray[index + 1]['items']['id'], + classify_name: dataArray[index + 1]['items']['name'] + }); + s.style(s.data.stylePage, dataArray[index + 1]['items']['id']); + } + } countDownNum--; s.setData({ diff --git a/pages/goods/categoryList/categoryList.wxml b/pages/goods/categoryList/categoryList.wxml index 46b67f8..1193a28 100644 --- a/pages/goods/categoryList/categoryList.wxml +++ b/pages/goods/categoryList/categoryList.wxml @@ -285,9 +285,9 @@ - + - + - - - + + + + - - - - - - - + + + @@ -381,7 +376,7 @@ - + @@ -469,6 +464,10 @@ 该类别暂无推荐商品 {{countDownNum}} 秒后自动跳到下一个类别 + + + 该类别暂无推荐商品 + diff --git a/project.config.json b/project.config.json index 8843409..79d1daa 100644 --- a/project.config.json +++ b/project.config.json @@ -31,13 +31,28 @@ "current": -1, "list": [] }, + "plugin": { + "current": -1, + "list": [] + }, "game": { "currentL": -1, "list": [] }, - "miniprogram": { + "gamePlugin": { "current": -1, "list": [] + }, + "miniprogram": { + "current": -1, + "list": [ + { + "id": -1, + "name": "pages/goods/categoryList/categoryList", + "pathName": "pages/goods/categoryList/categoryList", + "scene": null + } + ] } } } \ No newline at end of file -- libgit2 0.21.4