Commit 99bac123 by 程智春

Merge branch 'nativehome_tst' of http://code.mayi888.com/chengmo/mayi-mp-shop into nativehome_tst

parents 1fcfbad1 27241d6a
......@@ -19,7 +19,7 @@
<cube-nav :datas="item"></cube-nav>
</div>
<div v-else-if="item.componentCode == 'time-limited-discount' && item.componentInfo.visible == 1">
<time-limited-discount :datas="item"></time-limited-discount>
<time-limited-discount :class="'time-limited-discount'+index" :datas="item" :k="index"></time-limited-discount>
</div>
<div v-if="item.componentCode == 'links' && item.componentInfo.visible == 1">
<links :datas="item"></links>
......@@ -106,6 +106,7 @@ import imgText from '@/components/content/imgText'
import coupon from '@/components/activity/coupon'
import integralTurntable from '@/components/activity/integralTurntable'
import { setTabBarActive, checkTabbarPage,themeColor } from "../../utils/mayi.js";
import { throttle } from "../../utils/index.js"
const app = getApp();
export default {
......@@ -182,17 +183,7 @@ export default {
this.changeLocation = options.changeLocation || ''
if(this.changeLocation == 1){
// let extConfig = wx.getExtConfigSync ? wx.getExtConfigSync() : {};
// console.log(extConfig, "-----------extConfig");
// if (
// process.env.NODE_ENV == "development" ||
// JSON.stringify(extConfig) == "{}"
// ) {
// extConfig = { mixid: "antgood", shopid: 67 };
// }
console.log('this.$store.state.extConfig',this.$store.state.extConfig)
app.getShopInfo(this.$store.state.extConfig);
app.getThemePage(this.$store.state.extConfig);
}
......@@ -233,10 +224,11 @@ export default {
onShow() {
setTabBarActive.bind(this)(checkTabbarPage('/'));
this.$mp.page.onPageScroll= (el)=>{
this.scrolls(el);
throttle(this.scrolls(el),100)
};
},
methods: {
init(pageList) {
setTabBarActive.bind(this)(checkTabbarPage('/'));
......@@ -252,10 +244,22 @@ export default {
wx.stopPullDownRefresh()
},
scrolls(el){
this.setFooterShow(el);
// this.setFooterShow(el);
if(this.$mp.page && this.$mp.page.selectComponent(".goodsListItem")){
this.$mp.page.selectComponent(".goodsListItem").getScroll(el);
}
if (this.pageData) {
for (let i = 0; i < this.pageData.length; i++) {
const element = this.pageData[i]
if(element.componentCode=="time-limited-discount"){
let com=this.$mp.page.selectComponent(".time-limited-discount"+i) ;
com && com.getScroll(el);
}
}
}
},
setFooterShow(el){
let afterScrollTop = el.scrollTop;
......
......@@ -51,7 +51,7 @@ export default {
if (!this.ss && ss) {
this.ss = `&sessionid=${ss}`;
}else if(!ss){
!this.params.includes('logOut=true') && (this.params+="&logOut=true")
// !this.params.includes('logOut=true') && (this.params+="&logOut=true")
}else{
this.params+=`&timestamp=${new Date().getTime()}`
}
......
......@@ -50,7 +50,7 @@ export default {
if (!this.ss && ss) {
this.ss = `&sessionid=${ss}`;
}else if(!ss){
this.params+="&logOut=true"
// this.params+="&logOut=true"
}else{
this.params+=`&timestamp=${new Date().getTime()}`
}
......
......@@ -56,7 +56,7 @@ export default {
if (!this.ss && ss) {
this.ss = `&sessionid=${ss}`;
}else if(!ss){
this.params+="&logOut=true"
// this.params+="&logOut=true"
}else{
this.params+=`&timestamp=${new Date().getTime()}`
}
......
......@@ -56,7 +56,7 @@ export default {
if (!this.ss && ss) {
this.ss = `&sessionid=${ss}`;
}else if(!ss){
this.params+="&logOut=true"
// this.params+="&logOut=true"
}else{
this.params+=`&timestamp=${new Date().getTime()}`
}
......
......@@ -2,6 +2,29 @@ function formatNumber(n) {
const str = n.toString()
return str[1] ? str : `0${str}`
}
// 防抖
export function debounce(fn, wait) {
var timeout = null;
return function() {
if (timeout !== null)
clearTimeout(timeout);
timeout = setTimeout(fn, wait);
}
}
// 节流
export function throttle(func, delay) {
var prev = Date.now();
return function() {
var context = this;
var args = arguments;
var now = Date.now();
if (now - prev >= delay) {
func.apply(context, args);
prev = Date.now();
}
}
}
//格式时间
export function formatTime(date) {
......
......@@ -29,7 +29,7 @@ export function $themeToLink(data, option) {
let type = data.type;
// 点击底部栏--
// if (option) {
if (type!=2) {
// 登录拦截
let parseLink = getUrlofLink(data);
let aa=noLoginListPath.includes(parseLink) || parseLink.substr(0,7)=="/goods/"
......@@ -52,7 +52,7 @@ export function $themeToLink(data, option) {
}
// console.log(option, data,'---',parseLink == '/' ? '/pages/home/main' : `/pages/tabBar${isTabbarIndex}/main`)
// return
// }
}
// 历史数据
......
......@@ -39,6 +39,7 @@ xcsoft.countdown = function(a, b, c) {
d.minute = 0;
d.second = 0;
d.t = setInterval(function() {
console.log('倒计时')
e = new Date().getTime();
f = parseInt(e / 1000 + x);
var l = d.time - f;
......@@ -109,10 +110,15 @@ const componentOptions = {
properties: {
datas: {
type: Object
},
k:{
type:String
}
},
// 组件数据
data: {
loaded:false,
isContain:false,
isPageHidden: false, // 页面是否处于隐藏状态
timeData: {},
isLoading: true,
......@@ -243,6 +249,24 @@ const componentOptions = {
}
});
},
getScroll(){
this.getEleInfo(()=>{
this.getData()
});
},
// 获取当前组件位置信息
getEleInfo(cb){
if(this.loaded || this.isContain) return
this.isContain=true;
let {windowHeight} = wx.getSystemInfoSync()
let query=wx.createSelectorQuery().in(this);
query.select('.time-limited-discount').boundingClientRect(rect=>{
if (rect.top<windowHeight && rect.top+rect.height>0) {
cb && cb()
}
this.isContain=false;
}).exec();
},
onChange(e) {
this.setData({ timeData: e.detail });
},
......@@ -275,6 +299,8 @@ const componentOptions = {
});
},
getData() {
if(this.loaded) return
this.loaded=true
let { dimension } = this.data.datas.componentData;
if (dimension == 0) {
this.init();
......@@ -287,7 +313,11 @@ const componentOptions = {
lifetimes: {
created() {},
ready() {
this.getData();
this.loaded=false;
this.isContain=false;
this.getEleInfo(()=>{
this.getData()
});
},
moved() {},
detached() {}
......@@ -297,7 +327,11 @@ const componentOptions = {
pageLifetimes: {
// 页面被展示
show() {
this.getData();
this.loaded=false;
this.isContain=false;
this.getEleInfo(()=>{
this.getData()
});
const { isPageHidden } = this.data;
// show事件发生前,页面不是处于隐藏状态时
if (!isPageHidden) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment