master
wangxinglong 2022-01-20 20:12:22 +08:00
parent b0eeb296d3
commit 7fb6458b9f
8 changed files with 11060 additions and 91 deletions

View File

@ -616,7 +616,9 @@ class Coupon extends Base
if(CouponTypeModel::checkType($couponMain['type']) !== true){
return $this->json(4001, '优惠券类型不存在');
}
$type = CouponRepository::getInstance()->getCouponTypeAll();
$type = array_column($type->toArray(), null, "id");
$data['type_name'] = $type[$data['type']]['name'];
//验证通过
$couponMain['business_type'] = $account->business['type'];
@ -715,6 +717,9 @@ class Coupon extends Base
if(CouponTypeModel::checkType($couponMainData['type']) !== true){
return $this->json(4001, '优惠券类型不存在');
}
$type = CouponRepository::getInstance()->getCouponTypeAll();
$type = array_column($type->toArray(), null, "id");
$couponMainData['type_name'] = $type[$data['type']]['name'];
//验证通过
Db::startTrans();

View File

@ -138,7 +138,7 @@ class Dictionary extends Base
CConfig::load('extra/wechat', 'wechat');
$screenTopBanner = config('wechat')['screenTopBanner']??"/static/images/screenTopBanner.jpg";
return view('/page/screen')->assign(["couponMain"=>$couponMain,"screenTopBanner"=>$screenTopBanner]);
return view('/page/screen')->assign(["couponMain"=>json_encode($couponMain),"screenTopBanner"=>($screenTopBanner)]);
}

View File

@ -202,7 +202,9 @@ class Coupon extends Base
if(CouponTypeModel::checkType($data['type']) !== true){
return $this->json(4001, '优惠券类型不存在');
}
$type = CouponRepository::getInstance()->getCouponTypeAll();
$type = array_column($type->toArray(), null, "id");
$data['type_name'] = $type[$data['type']]['name'];
$data['business_type'] = $business['type'];
@ -301,6 +303,10 @@ class Coupon extends Base
if(CouponTypeModel::checkType($data['type']) !== true){
return $this->json(4001, '优惠券类型不存在');
}
$type = CouponRepository::getInstance()->getCouponTypeAll();
$type = array_column($type->toArray(), null, "id");
$data['type_name'] = $type[$data['type']]['name'];
//更新经纬度
$data['business_type'] = $business['type'];

View File

@ -63,14 +63,13 @@
.content-head-right > span {margin-top: 10px;font-size: 20px;color: rgba(255,255,255,.6);text-shadow: 0px 0px 10px rgba(0,0,0,.8);}
.content-head-bol{position: absolute;left: -6px;display: flex;flex-direction: column;height: 280px;overflow: hidden;}
.content-head-bol span{width: 20px;height: 20px;background-color: #f0dfed;border-radius: 100%;}
.random-color1,.random-color1 .span{background-color: #00AADC;}
.random-color2,.random-color2 .span{background-color: #00aa7f;}
.random-color3,.random-color3 .span{background-color: #5500ff;}
.random-color4,.random-color4 .span{background-color: #ffaa7f;}
.random-color5,.random-color5 .span{background-color: #005500;}
.random-color6,.random-color6 .span{background-color: #000c10;}
.random-color7,.random-color7 .span{background-color: #aa00ff;}
.random-color8,.random-color8 .span{background-color: #ff557f;}
.random-color9,.random-color9 .span{background-color: #00ffff;}
.random-color0,.random-color0 .span{background-color: #003c4d;}
.random-color1{background-color: #00AADC;}
.random-color2{background-color: #00aa7f;}
.random-color3{background-color: #5500ff;}
.random-color4{background-color: #ffaa7f;}
.random-color5{background-color: #005500;}
.random-color6{background-color: #000c10;}
.random-color7{background-color: #aa00ff;}
.random-color8{background-color: #ff557f;}
.random-color9{background-color: #00ffff;}
.random-color10{background-color: #003c4d;}

View File

@ -4,9 +4,12 @@ jQuery(function($){
$(window).resize(function(){//监听窗口大小的改变
monitorWindow();
})
prependEv();
})
function creatswiper(){
// banner轮播
var bannerSwiper = new Swiper('.banner-swiper',{
loop:false,//开启循环播放
loop:true,//开启循环播放
autoplay: {//开启自动播放
delay:3000,
disableOnInteraction: false,//触摸后不会停止自动滚动
@ -60,7 +63,7 @@ jQuery(function($){
},
}
})
})
}
function monitorWindow(){
let slideHeight = '';
// 获取视图窗口的高度
@ -69,7 +72,4 @@ function monitorWindow(){
let headHeight = $('.head-box img').height();
// 底部内容高度
let contentHeight = clientHeight-headHeight;
$('.banner-swiper').height(contentHeight);
$('.banner-swiper').css({top:headHeight+'px'});
$('.banner-swiper .swiper-slide').height(contentHeight / 4);
}
}

10881
public/static/js/jquery.js vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -43,7 +43,140 @@
<script src="__STATIC__/js/swiper.min.js" type="text/javascript" charset="utf-8"></script>
<script src="__STATIC__/js/swiper.animate1.0.3.min.js" type="text/javascript" charset="utf-8"></script>
<!-- 自定义js -->
<script src="__STATIC__/js/javascript.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
jQuery(function($){
monitorWindow();
// 窗体改变
$(window).resize(function(){
//监听窗口大小的改变
monitorWindow();
})
prependEv();
})
function creatswiper(){
// banner轮播
var bannerSwiper = new Swiper('.banner-swiper',{
loop:false,
//开启循环播放
autoplay: {
//开启自动播放
delay:3000,
disableOnInteraction: false,
//触摸后不会停止自动滚动
pauseOnMouseEnter: true,
//鼠标置于swiper时暂停自动切换鼠标离开时恢复自动切换。
},
direction : 'vertical',
//轮播切换方向默认向左horizontal、向右vertical
// height: 400,//slide高度
autoHeight: true,
//高度随内容变化
slidesPerView:4,
//显示个数
pagination: {
//分页器
el: '.swiper-pagination',
type: 'bullets',
//指示点样式 bullets圆点默认、fraction分式、progressbar进度条、custom自定义
progressbarOpposite: false,
//水平方向切换的swiper显示的是垂直进度条而垂直方向切换的swiper显示水平进度条
dynamicBullets: false,
//当slide很多时分页器小点的数量会部分隐藏。针对bullets
dynamicMainBullets: 2,
//主展示的数量
hideOnClick :true,
//点击时隐藏分页器
clickable :true,
//点击分页器的指示点控制Swiper切换
// bulletClass : 'my-bullet',//需设置.my-bullet样式
// bulletActiveClass: 'my-bullet-active',//当前活动块的指示小点的类名。需设置.my-bullet-active样式
renderBullet: function (index, className) {
switch(index){
case 0:text='壹';break;
case 1:text='贰';break;
case 2:text='叁';break;
case 3:text='肆';break;
case 4:text='伍';break;
case 5:text='六';break;
case 6:text='柒';break;
case 7:text='捌';break;
case 8:text='玖';break;
case 9:text='拾';break;
}
return '<span class="' + className + '">' + text + '</span>';
},
},
effect : 'slide',//轮播的动效 默认为"slide"(普通位移切换),还可设置为"fade"(淡入)、"cube"(方块)、"coverflow"3d流、"flip"3d翻转、"cards"(卡片式)、"creative"(创意性)。
fadeEffect: {
crossFade: true,
},
on:{
init: function(){
swiperAnimateCache(this); //隐藏动画元素
swiperAnimate(this); //初始化完成开始动画
},
slideChangeTransitionEnd: function(){
swiperAnimate(this); //每个slide切换结束时也运行当前slide动画
// this.slides.eq(this.activeIndex).find('.ani').removeClass('ani'); 动画只展现一次去除ani类名
},
slideChangeTransitionStart: function(){
},
}
})
}
function monitorWindow(){
let slideHeight = '';
// 获取视图窗口的高度
let clientHeight = $(window).height();
// 获取头部的高度
let headHeight = $('.head-box img').height();
// 底部内容高度
let contentHeight = clientHeight-headHeight;
}
function prependEv(){
var couponMain = JSON.parse('{$couponMain|raw}');
for (let i = 0; i < couponMain.length; i++) {
let yspHtml = `<div class="swiper-slide slide${i}">
<div class="content-head">
<img class="coupon" src="${couponMain[i].image_url}" >
<div class="content-head-right">
<div class="qrcode" id="qrcode${couponMain[i].id}"></div>
<span>扫码领取</span>
<div class="content-head-bol">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
</div>
</div>
<div class="content-box">
<span>${couponMain[i].name}</span>
<span>${couponMain[i].business_name}</span>
</div>
</div>`
$('.swiper-wrapper').prepend(yspHtml);
$('.slided').remove();
$(`#qrcode${couponMain[i].id}`).qrcode(`https://coupon.scdxtc.cn/coupon_info?id=${couponMain[i].id}&businessCode=${couponMain[i].business_code}`);
}
creatswiper()
}
</script>
<script type="text/javascript">
// 更新js文件版本达到清除js带来的缓存
var scripts = document.getElementsByTagName("script");
@ -66,69 +199,15 @@
<div class="head-box">
<img src="{$screenTopBanner}">
</div>
<!-- banner轮播图 -->
<div class="banner-swiper swiper">
<div class="swiper-wrapper">
{foreach $couponMain as $key => $item}
<div class="swiper-slide">
<div class="content-head">
<img class="coupon" src="{$item['image_url']}" >
<div class="content-head-right random-color{$key%10}">
<!-- <img src="favicon.ico"> -->
<div class="qrcode" id="qrcode{$key}" qrstr="https://coupon.scdxtc.cn/coupon_info?id={$item['id']}&businessCode={$item['business_code']}"></div>
<span>扫码领取</span>
<div class="content-head-bol ">
<span class="span"></span>
<span class="span"></span>
<span class="span"></span>
<span class="span"></span>
<span class="span"></span>
<span class="span"></span>
<span class="span"></span>
<span class="span"></span>
<span class="span"></span>
<span class="span"></span>
<span class="span"></span>
<span class="span"></span>
<span class="span"></span>
<span class="span"></span>
</div>
</div>
</div>
<div class="content-box">
<span>{$item['name']}</span>
<span>{$item['business_name']}</span>
</div>
</div>
<!-- <script type="text/javascript">-->
<!-- $("#qrcode{$key}").qrcode("https://coupon.scdxtc.cn/coupon_info?id={$item['id']}&businessCode={$item['business_code']}")-->
<!-- </script>-->
{/foreach}
<script type="text/javascript">
$(function () {
setTimeout(function () {
for (var aa = 0; aa < $(".qrcode").length; aa++) {
// console.log("#qrcode"+aa)
console.log("#"+$(".qrcode").eq(aa).attr("id"));
// console.log($("#qrcode"+aa).attr("qrstr"))
for(var bb = 0; bb < $("#"+$(".qrcode").eq(aa).attr("id")).length; bb++){
$("#"+$(".qrcode").eq(aa).attr("id")).eq(bb).qrcode($("#"+$(".qrcode").eq(aa).attr("id")).attr("qrstr"))
}
// return false;
}
},1000)
})
</script>
<div class="swiper-slide slided"></div>
</div>
<!-- <div class="swiper-pagination"></div> -->
</div>
<script type="text/javascript">
</script>
<!-- 主体内容 -->
<main class="main">