From a69e6055d95fecb16acd81d3bd3981abcc4ba2b9 Mon Sep 17 00:00:00 2001 From: yvan.ni Date: Thu, 13 May 2021 10:25:43 +0800 Subject: [PATCH] 1. 领券未登录要登录一下 2. 报警错误的修复 --- components/diy_goodsGroup/diy_goodsGroup.js | 22 ++++++++++++---------- packageA/pages/quan_list/quan_list.js | 9 ++++++++- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/components/diy_goodsGroup/diy_goodsGroup.js b/components/diy_goodsGroup/diy_goodsGroup.js index 7ac451a..785e8fe 100644 --- a/components/diy_goodsGroup/diy_goodsGroup.js +++ b/components/diy_goodsGroup/diy_goodsGroup.js @@ -101,13 +101,16 @@ Component({ } this.data.requestData = new Array(); - this.data.g_id = nav_item.data; - var arr = []; + if(nav_item && nav_item.data) + { + this.data.g_id = nav_item.data; + var arr = []; + for (var i = 0; i < this.data.g_id.length; i += this.data.goodscount) { + arr.push(this.data.g_id.slice(i, i + this.data.goodscount)); + } + this.data.firist_type_data = arr; + } - for (var i = 0; i < this.data.g_id.length; i += this.data.goodscount) { - arr.push(this.data.g_id.slice(i, i + this.data.goodscount)); - } - this.data.firist_type_data = arr; this.init(this.data.classstyle_id, this.data.wgroup); }, detached: function() { @@ -127,12 +130,11 @@ Component({ // 这里是一个自定义方法 init:async function (classstyle_id, wgroup) { - this.setData({classstyle_id:classstyle_id}) - + this.setData({classstyle_id:classstyle_id}) var th = this; var g_id = this.data.g_id; - var len=this.data.firist_type_data.length; - if (classstyle_id == 1) { + var len=this.data.firist_type_data?this.data.firist_type_data.length:0; + if (classstyle_id == 1 && this.data.firist_type_data) { //---手动选择的时候--- g_id = this.data.firist_type_data[th.data.firist_type_curr]; th.data.firist_type_curr++; diff --git a/packageA/pages/quan_list/quan_list.js b/packageA/pages/quan_list/quan_list.js index 47a2fba..57210d8 100644 --- a/packageA/pages/quan_list/quan_list.js +++ b/packageA/pages/quan_list/quan_list.js @@ -25,9 +25,16 @@ Page({ onLoad: function(t) { var th=this; getApp().getConfig2(function (conf) { - conf.couponset=conf.couponset.replace(/\