From 6805b7ef163f4930fcac8b7340e44c068c971384 Mon Sep 17 00:00:00 2001 From: yvan.ni <765199919@qq.com> Date: Fri, 10 Jul 2020 17:37:02 +0800 Subject: [PATCH] 1. 首页点击商品,返回的时候要到原来固定位置的bug修复 2. 默认情况下,顶部搜索框的优化 3. 推荐列表,商品分组的组件在游客登陆后,要能够正确的显示商品的价格 --- components/diy_goodsGroup/diy_goodsGroup.js | 35 +++-------------------------------- components/diy_searchbox/diy_searchbox.wxml | 2 +- components/goods_list/goods_list.js | 7 +++++++ pages/index/index/index.js | 63 ++++++++++++++++++++++++++++++--------------------------------- pages/index/index/index.wxml | 2 +- pages/index/index/index.wxss | 1 + 6 files changed, 43 insertions(+), 67 deletions(-) diff --git a/components/diy_goodsGroup/diy_goodsGroup.js b/components/diy_goodsGroup/diy_goodsGroup.js index e40b4cc..b5f9507 100644 --- a/components/diy_goodsGroup/diy_goodsGroup.js +++ b/components/diy_goodsGroup/diy_goodsGroup.js @@ -83,39 +83,10 @@ Component({ }, pageLifetimes: { + //游客登陆后,只要更新卡的情况 show: function () { - this.data.firist_type_curr=0, - this.data.currentPage=1, - this.setData({ goods_array: null}) - - // 页面被展示 - // 在组件实例进入页面节点树时执行 - this.data.classstyle_id = this.data.object.classstyle; - this.data.goodscount = this.data.object.goodscount; - this.data.wgroup = this.data.object.wgroup; - - this.setData({ - classstyle_id: this.data.object.classstyle - }) - if (this.data.object.goodsclass == 1) { - this.data.is_recommend = 1 - } - if (this.data.object.goodsclass == 2) { - this.data.is_hot = 1 - } - if (this.data.object.goodsclass == 3) { - this.data.is_new = 1 - } - this.data.requestData = new Array(); - //---将数组--- - this.data.g_id = this.data.object.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; - this.init(this.data.classstyle_id, this.data.wgroup); + //--初始化卡类-- + this.card_init(); }, }, diff --git a/components/diy_searchbox/diy_searchbox.wxml b/components/diy_searchbox/diy_searchbox.wxml index d448a5a..2ce8ff1 100644 --- a/components/diy_searchbox/diy_searchbox.wxml +++ b/components/diy_searchbox/diy_searchbox.wxml @@ -10,7 +10,7 @@ - + diff --git a/components/goods_list/goods_list.js b/components/goods_list/goods_list.js index 60e5404..b436a56 100644 --- a/components/goods_list/goods_list.js +++ b/components/goods_list/goods_list.js @@ -23,6 +23,13 @@ Component({ }, ready: function () { }, + pageLifetimes:{ + //要处理一下,游客登陆后的界面的变化,主要还该是改变会员 + show: function () { + this.init(); + } + }, + methods: { init: function () { var th = this; diff --git a/pages/index/index/index.js b/pages/index/index/index.js index faf1e5c..89efc1a 100644 --- a/pages/index/index/index.js +++ b/pages/index/index/index.js @@ -76,7 +76,7 @@ Page({ }, - onLoad: function() { + onLoad: async function() { var th = this; //看一下商家是否开通了权益 //--初始化是否有打勾-- @@ -92,26 +92,11 @@ Page({ }); } }) - - - }, - //关闭新用户领取广告 - close_disgraceful: function() { - var th = this; - th.setData({ - is_disgraceful: 0 - }) - }, - async onShow() { - - var th = this - //调用底部导航 getApp().globalData.url=th.data.url t.editTabBar(th,o.stoid,th.data.url); - await this.init_load(); //显示的时候要开启计时器 this.data.is_timer = 1; @@ -119,16 +104,16 @@ Page({ if (this.data.isTemplate) { //---先获取会员--- t.getUserFir(function() { - th.is_festival(); - var new_nav = th.data.new_nav; - if (new_nav == "") { - th.is_new(); - } - setTimeout(function () { - if (getApp().globalData.user_id) getApp().requestCardNum(th); - },500) - - }); + th.is_festival(); + var new_nav = th.data.new_nav; + if (new_nav == "") { + th.is_new(); + } + setTimeout(function () { + if (getApp().globalData.user_id) getApp().requestCardNum(th); + },500) + + }); } else { await this.init_fir(); wx.setNavigationBarColor({ @@ -168,12 +153,25 @@ Page({ }).then(res => { if (res.data.data) { var gd_category = res.data.data.pageData; - th.setData({ gd_category: gd_category }); } }) + + + + }, + //关闭新用户领取广告 + close_disgraceful: function() { + var th = this; + th.setData({ + is_disgraceful: 0 + }) + }, + + async onShow() { + var th = this }, //当隐藏的时候就关闭计时器 onHide: function() { @@ -185,6 +183,7 @@ Page({ clearInterval(i); } + }, //同步初始加载 @@ -469,13 +468,12 @@ Page({ this.data.timer && (clearInterval(this.data.timer), this.data.timer = null); }, onPageScroll: function(e) { - this.setData({ - scrollTop: e.scrollTop - }); + this.data.scrollTop=e.scrollTop; + + var t = getCurrentPages(); "pages/index/index/index" == t[t.length - 1].route; - /*-- - && (e.scrollTop > 10 ? wx.setNavigationBarColor({ + /*--(e.scrollTop > 10 ? wx.setNavigationBarColor({ frontColor: "#ffffff", backgroundColor: "#f95959" }) : wx.setNavigationBarColor({ @@ -829,5 +827,4 @@ Page({ }) } - }); \ No newline at end of file diff --git a/pages/index/index/index.wxml b/pages/index/index/index.wxml index 73cd56c..0d6c695 100644 --- a/pages/index/index/index.wxml +++ b/pages/index/index/index.wxml @@ -249,7 +249,7 @@ - + diff --git a/pages/index/index/index.wxss b/pages/index/index/index.wxss index 087b2b7..e3f1467 100644 --- a/pages/index/index/index.wxss +++ b/pages/index/index/index.wxss @@ -9,6 +9,7 @@ width: 100%; height: 88rpx; z-index: 10; + background-color: #ff7295; } .classify-img { -- libgit2 0.21.4