| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216 |
- <?php
- use common\components\stringUtil;
- ?>
- <script type="text/javascript" src="/js/idangerous.swiper.min.js?version=<?= $this->context->version ?>"></script>
- <div class="lay-body lay-body1" id="J_MainBody">
- <div class="home">
- <div class="banner-container" style="cursor: -webkit-grab;">
- <div class="swiper-wrapper" style="width: 5328px; height: 500px;">
- <?php
- if(!empty($imgList)){
- foreach($imgList as $key => $val){
- if(!empty($val['img'])){
- ?>
- <div class="swiper-slide" style="width: 1332px; height: 500px;">
- <a href="<?php if(!empty($val['link'])){ echo $val['link']; }else{ echo 'javascript:void(0)'; } ?>"><img name="slideImg" src="<?= Yii::$app->params['imgUrl'].$val['img'] ?>" alt=""></a>
- </div>
- <?php
- }
- }}
- ?>
- </div>
- <div class="pagination" style="margin-left: -37px;"><span class="swiper-pagination-switch swiper-visible-switch swiper-active-switch"></span><span class="swiper-pagination-switch"></span><span class="swiper-pagination-switch"></span><span class="swiper-pagination-switch"></span></div>
- </div>
- <div class="lay-body" id="J_MainBody" style="padding-top:0px;">
- <div class="list">
- <?php
- if(!empty($list)){
- foreach($list as $val){
- ?>
- <div class="home-group">
- <div class="container news">
- <div class="pic" style="padding-top:4px;padding-left:6px;padding-right:6px;">
- <a href="/mobile/goods-detail?id=<?= $val['id'] ?>&account=<?php echo $_GET['account'] ?>">
- <img src="/images/newGrey.gif" data-original="<?= Yii::$app->params['imgUrl'].$val['cover'] ?>" alt="<?= $val['goodsName'] ?>" class="lazy">
- </a>
- </div>
- <div style="font-size:14px;">
- <div style="color:#8C8F90;"><a style="color:#8C8F90;text-decoration:none;" href="/mobile/goods-detail?id=<?= $val['id'] ?>&account=<?php echo $_GET['account'] ?>"><?= $val['goodsName'] ?></a></div>
- <div style="margin-top:6px;"><span style="color:red;">¥<?= $val['price'] ?></span><span style="float:right;color:#8C8F90;">销量 <?= stringUtil::calcAdd($val['sold'], $val['actualSold']) ?></span></div>
- </div>
- </div>
- </div>
- <?php
- }
- }
- ?>
- <div style="margin:0 auto;display:none;" name="loadingMore"><img style="display:block; margin:0 auto;" src="/images/loading3.gif" /></div>
- <script>
- /*banner轮播*/
- var mySwiper = new Swiper('.banner-container',{
- pagination: '.pagination',
- loop:true,
- autoplay: 6000,//可选选项,自动滑动
- speed: 2000,
- grabCursor: true,
- lazyLoading : true,
- paginationClickable: true
- });
- $('.pagination').eq(0).css({marginLeft:-$('.pagination').width()/2+'px'});
- $('.banner-container').on('swipeLeft', function(e){ e.stopPropagation(); });
- $('.banner-container').on('swipeRight', function(e){ e.stopPropagation(); });
- //幻灯片图片外框自适应图片大小
- $(window).load(function() {
- var thisSwiperHeight = $("img[name=slideImg]").eq(0).css('height');
- $('.swiper-container').css('height',thisSwiperHeight);
- $('.banner-container').css('height',thisSwiperHeight);
- });
- /*脚部切换产品*/
- (function(){
- function Switch(ele){
- this.ele = ele;
- this.init();
- }
- Switch.prototype = {
- init: function(){
- var that = this,
- ul = this.ele.find('ul').eq(0),
- li = this.ele.find('li'),
- screenWidth = $('body').width()-20;
- li.width( screenWidth/3 );
- ul.width( screenWidth/3 * li.length);
- this.ele.on('swipeLeft', function(e){
- e.stopPropagation();
- var ul = that.ele.find('ul').eq(0), li = that.ele.find('li');
- that.left(li, ul, screenWidth);
- });
- this.ele.on('swipeRight', function(e){
- e.stopPropagation();
- var ul = that.ele.find('ul').eq(0), li = that.ele.find('li');
- that.right(li, ul, screenWidth);
- });
- },
- left : function(li, ul, screenWidth){
- li.eq(0).animate({marginLeft: -screenWidth/3+'px'},400, '', function(){
- ul.append(li.eq(0)), li.eq(0).css({marginLeft:0});
- });
- },
- right : function(li, ul, screenWidth){
- li.eq(li.length-1).css({marginLeft: -screenWidth/3+'px'}), ul.prepend(li.eq(li.length-1));
- li.eq(li.length-1).animate({marginLeft: 0 },400);
- }
- };
- $.fn.switch = function(opt){
- opt = $.extend({}, opt);
- this.each(function(){
- return new Switch($(this));
- });
- }
- })();
- $('.J_Switch').switch();
- </script>
- <script>
- <?php if($this->context->isWeixin){ ?>
- //微信分享
- var shareTitle = '<?= $this->context->webTitle ?>';
- var descContent = '<?php echo stringUtil::subStringUtf8($this->context->webDescription,26,'…'); ?>';
- var lineLink = '<?= Yii::$app->request->hostInfo ?>/mobile/index?account=<?= $_GET['account'] ?>&weixinShare=yes';
- var imgUrl = '<?php if(!empty($this->context->merchant['logo'])){ echo Yii::$app->params['imgUrl'].$this->context->merchant['logo']; }else{ echo Yii::$app->request->hostInfo.'/images/weixinSharelogo.jpg'; } ?>'
- wx.config({
- //debug:true,
- appId: '<?= $this->context->signPackage['appId'] ?>',
- timestamp: <?= $this->context->signPackage['timestamp'] ?>,
- nonceStr: '<?= $this->context->signPackage['nonceStr'] ?>',
- signature: '<?= $this->context->signPackage['signature'] ?>',
- jsApiList: [
- 'checkJsApi',
- 'onMenuShareTimeline',
- 'onMenuShareAppMessage',
- 'onMenuShareQQ',
- 'onMenuShareWeibo',
- ]
- });
- wx.ready(function () {
- var shareData = {
- title: shareTitle,
- link: lineLink,
- imgUrl: imgUrl,
- desc:descContent,
- };
- wx.onMenuShareAppMessage(shareData);
- wx.onMenuShareTimeline({
- title: shareTitle,
- link: lineLink,
- imgUrl: imgUrl,
- desc:descContent,
- success: function () {
- //分享成功后的操作
- },
- cancel: function () {
- // 用户取消分享后执行的回调函数
- }
- });
- wx.onMenuShareQQ({
- title: shareTitle,
- link: lineLink,
- imgUrl: imgUrl,
- desc:descContent,
- success: function () {
- //分享成功后的操作
- },
- cancel: function () {
- // 用户取消分享后执行的回调函数
- }
- });
- wx.onMenuShareWeibo(shareData);
- });
- <?php } ?>
- /*幻灯片/触摸屏向下滑动隐藏/向上滑动显示*/
- (function(){
- var startX, startY, endX, endY, mainbody = $('#J_MainBody').get(0);
- mainbody.addEventListener('touchstart',function(event){
- startX = event.changedTouches[0].pageX;
- startY = event.changedTouches[0].pageY;
- });
- mainbody.addEventListener('touchend', function(event){
- endX = event.changedTouches[0].pageX;
- endY = event.changedTouches[0].pageY;
- if( (startY-endY) > 50 ){
- $('#J_SubHead').css({top:0});
- }else if( (startY-endY) < -50 ){
- $('#J_SubHead').css({top:'45px'});
- }
- });
- })();
- //滚动到底部请求更多商品
- $(document).ready(function() {
- $(window).scroll(function() {
- if ($(document).scrollTop() >= $(document).height() - $(window).height()) {
- /*
- $("div[name=loadingMore]").css("display",'block');
- $.ajax({
- type:"GET",
- url:'/mobile/get-index-more?account=<?= $_GET['account'] ?>',
- dataType:'json',
- async:false,
- success:function(data){
- if(data.code == 'A0001'){
- }
- }
- });
- */
- }
- });
- });
- </script>
|