You've already forked qlg.tsgz.moe
Init Repo
This commit is contained in:
75
static/app/js/store_home.js
Executable file
75
static/app/js/store_home.js
Executable file
@ -0,0 +1,75 @@
|
||||
mui.plusReady(function() {
|
||||
var data = JSON.parse(localStorage.getItem('shop_data'));
|
||||
if(data.shop.shopAds.length > 0) {
|
||||
var html1 = '<div class="mui-slider-group mui-slider-loop"><div class="mui-slider-item mui-slider-item-duplicate"><a href="#"><img src="' + hyhImgUrl(data.shop.shopAds[data.shop.shopAds.length - 1].adImg) + '"></a></div>';
|
||||
var html2 = '<div class="mui-slider-indicator">';
|
||||
$.each(data.shop.shopAds, function() {
|
||||
html1 += '<div class="mui-slider-item "><a href="#"><img src="' + hyhImgUrl(this.adImg) + '"></a></div>';
|
||||
html2 += '<div class="mui-indicator"></div>';
|
||||
});
|
||||
html2 += '</div>';
|
||||
html1 += '<div class="mui-slider-item mui-slider-item-duplicate"><a href="#"><img src="' + hyhImgUrl(data.shop.shopAds[0].adImg) + '"></a></div></div>'
|
||||
html1 += html2;
|
||||
$('#slider').html(html1);
|
||||
mui("#slider").slider({
|
||||
interval: 5000
|
||||
});
|
||||
} else {
|
||||
$('#slider').remove()
|
||||
}
|
||||
var html3 = '';
|
||||
$.each(data.shopcats, function() {
|
||||
html3 += '<div data-catId="' + this.catId + '" class="l_block">' + this.catName + '</div>';
|
||||
});
|
||||
$('.label').html(html3);
|
||||
$('.l_block').each(function(num) {
|
||||
if((num + 1) % 4 == 0) {
|
||||
$(this).addClass('lbrr');
|
||||
}
|
||||
})
|
||||
var html = '';
|
||||
$.each(data.rec, function() {
|
||||
html += '<div class="cnxh_block con_goods" data-id="' + this.goodsId + '"><img src="' + hyhImgUrl(this.goodsImg) + '" /><div class="cnxh_block_info"><p class="s_name">' + this.goodsName + '</p><p class="cost">¥' + Math.round(this.shopPrice * 0.8 * 100) / 100 + '<o>到手价</o><del>¥' + this.shopPrice + '</del></p><p class="cost_info">可用惠宝抵扣20%货款</p></div></div>'
|
||||
});
|
||||
$('.cnxh_con').html(html);
|
||||
$('.cnxh_con').on('tap', '.con_goods', function() {
|
||||
var good_id = $(this).attr('data-id');
|
||||
mui.openWindow({
|
||||
url: 'details.html',
|
||||
id: 'details1.html'+good_id,
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
data_id: good_id
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {
|
||||
// autoShow: true, //页面loaded事件发生后自动显示,默认为true
|
||||
// aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
|
||||
// duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
|
||||
// event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
|
||||
// extras: {} //窗口动画是否使用图片加速
|
||||
},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
localStorage.setItem('shop_data','');
|
||||
})
|
||||
|
||||
setInterval(function() {
|
||||
$('.cnxh_block img').height($('.cnxh_block img').width());
|
||||
$('.cnxh_block').height($('.cnxh_block').width() * 266 / 198);
|
||||
}, 200)
|
Reference in New Issue
Block a user