作者 潘浩文
1 个管道 的构建 通过 耗费 1 秒

1

... ... @@ -126,26 +126,44 @@ class ActiveController extends WeChatBaseController
//活动详情
public function activeDetail()
{
$re=$this->checkUser();
$id=$this->request->param('id');
$data=Db::name('active')
->where('id',$id)
->find();
$data['more']=json_decode($data['more'],true);
$data['content']=cmf_replace_content_file_url(htmlspecialchars_decode($data['content']));
$like=Db::name('like')->where(['cid'=>$id,'users_id'=>session('wechat_user')['users_id'],'status'=>2])->find();
$like=Db::name('like')->where(['cid'=>$id,'users_id'=>$re['id'],'status'=>2])->find();
if ($like){
$like=1;
}else{
$like=0;
}
$comment=Db::name('comment')
->alias('c')
->join('users u','c.users_id=u.id')
->join('brand b','c.cid=b.id')
->where(['b.id'=>$id,'c.status'=>2])
->field('c.*,u.*')
->select();
$this->assign('comment',$comment);
$this->assign('like',$like);
$this->assign('list',$data);
return $this->fetch();
return $this->fetch('active_detail');
}
//兑奖首页
public function prize(){
$user=Db::name('users')->where('id',session('wechat_user')['users_id'])->find();
... ...
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="__TMPL__/public/assets/css/base.css">
<link rel="stylesheet" href="__TMPL__/public/assets/css/swiper.css">
<script type="text/javascript" src="__TMPL__/public/assets/js/base.js"></script>
<title>活动详情</title>
<style>
body,html{
background:#F5F6FA;
}
.head{
height:3.6rem;
}
.swiper-container{
height:3.6rem;
}
.swiper-slide{
height:3.6rem;
}
.swiper-slide img{
width:100%;
height:100%;
}
.body{
height:1.39rem;
padding: 0.29rem 0.33rem;
background: #fff;
display:flex;
justify-content: space-between;
align-items: center;
}
.bodytext_name{
width:4.5rem;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color:#000000;
font-size: 0.32rem;
}
.body_textdate{
color: #666666;
font-size:0.26rem;
margin-top: 0.2rem;
}
.discuss{
display:flex;
position:relative;
}
.praise{
width:0.6rem;
height:0.6rem;
background: #CA277B;
border-radius: 50%;
font-size: 0;
text-align: center;
vertical-align: middle;
margin-right: 0.16rem;
}
.praise img{
width:0.28rem;
height:0.28rem;
margin-top: 0.15rem;
}
.comment{
width:1.4rem;
height:0.6rem;
background:#CA277B;
color:#fff;
font-size: 0.26rem;
text-align: center;
line-height: 0.6rem;
border-radius:0.3rem;
}
.activedetail{
margin-top: 0.16rem;
background: #fff;
}
.shop_tab{
display:flex;
justify-content: space-between;
padding: 0.31rem 1.36rem;
align-items: center;
width:7.5rem;
height:0.88rem;
background: #fff;
border-bottom: 1px solid #f5f5f5;
}
.tab{
color:#97A0A8;
font-size: 0.26rem;
position: relative;
}
.active{
color:#CA277B;
}
.active em{
width:0.8rem;
height:0.06rem;
position: absolute;
left:0;
right:0;
top: 0.45rem;
margin: 0 auto;
background:#CA277B;
border-radius: 0.03rem;
}
.goodtail_name{
display:flex;
justify-content: space-between;
align-items: center;
margin-top: 0.36rem;
}
.good_line{
width:2.5rem;
height:1px;
background: #f5f5f5;
}
.good_name{
color:#999999;
font-size: 0.26rem;
}
.goodtail{
background: #fff;
padding: 0 0.24rem 0.5rem 0.24rem;
}
.commenttail{
background: #fff;
padding: 0 0.24rem 0.5rem 0.24rem;
}
.goodtail_img{
width:7.02rem;
margin-top: 0.16rem;
}
.goodtail_img img{
width:100%;
height:100%;
}
.comment_list{
display:flex;
border-bottom: 1px solid #f5f5f5;
padding: 0.3rem 0;
}
.comment_img{
width:0.8rem;
height:0.8rem;
border-radius: 50%;
font-size: 0;
}
.comment_img img{
width:100%;
height:100%;
}
.comment_name{
color:#000000;
font-size: 0.3rem;
}
.comment_date{
color:#999999;
font-size: 0.24rem;
}
.comment_text{
color:#000000;
font-size: 0.28rem;
width:5.86rem;
margin-top: 0.53rem;
}
.comment_content{
margin-left: 0.19rem;
}
.commentnum{
width:0.3rem;
text-align: center;
height:0.3rem;
line-height: 0.3rem;
background:#CA277B;
border-radius: 50%;
color:#fff;
position:absolute;
left:0.4rem;
font-size: 0.2rem;
}
</style>
</head>
<body>
<div class="container">
<div class="head">
<div class="swiper-container">
<div class="swiper-wrapper">
<foreach name="list.more.photos" item="vo">
<div class="swiper-slide">
<img src="{:cmf_get_image_preview_url($vo.url)}" alt="" >
</div>
</foreach>
</div>
<div class="swiper-pagination"></div>
</div>
</div>
<div class="body">
<div class="body_text">
<p class="bodytext_name">{$list.name}</p>
<p class="body_textdate">{:date('Y-m-d',$vo['active_time'])}-{:date('Y-m-d',$vo['end_time'])}</p>
</div>
<div class="discuss">
<p class="praise">
<img src="__TMPL__/public/assets/images/img/zan.png" alt="">
<p class="commentnum">{$list.dolike}</p>
</p>
<a href="{:url('portal/active/comment',array('id'=>$list.id))}" style="text-decoration:none;">
<p class="comment">
评论留言
</p>
</a>
</div>
</div>
<div class="activedetail">
<div class="shop_tab">
<p class="tab active" id="1">
<em></em>
活动详情
</p>
<P class="tab" id="2">
<em></em>
评论留言
</P>
</div>
<div class="goodtail" >
{$list.content}
<!--<div class="goodtail_name">-->
<!--<p class="good_line"></p>-->
<!--<p class="good_name">活动详情</p>-->
<!--<p class="good_line"></p>-->
<!--</div>-->
<!--<div class="goodtail_img">-->
<!--<img src="img/activetail.png" alt="">-->
<!--</div>-->
</div>
<div class="commenttail" style="display:none">
<foreach name="comment" item="vo">
<div class="comment_list">
<div class="comment_img">
<img src="{:cmf_get_image_preview_url($vo.avatar)}" alt="">
</div>
<div class="comment_content">
<p class="comment_name">{$vo.nickname}</p>
<p class="comment_date">{:date('Y-m-d',$vo['create_time'])}</p>
<div class="comment_text">
{$vo.content}
</div>
</div>
</div>
</foreach>
</div>
</div>
</div>
</body>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/swiper.min.js"></script>
<script>
var mySwiper = new Swiper('.swiper-container', {
pagination: {
el: '.swiper-pagination',
},
autoplay: true,//可选选项,自动滑动
})
$(".tab").click(function(){
if($(this).attr("id")==1){
$(this).addClass("active");
$(this).siblings(".tab").removeClass("active")
$(".goodtail").css("display","block");
$(".commenttail").css("display","none")
}else if($(this).attr("id")==2){
$(this).addClass("active");
$(this).siblings(".tab").removeClass("active")
$(".goodtail").css("display","none");
$(".commenttail").css("display","block")
}
})
//评论留言
$(".comment").click(function(){
window.location.href='writeevalute.html'
})
//点赞
$(".discuss").click(function(){
window.event.stopPropagation();
var num=$(".commentnum").html();
num++;
$(".commentnum").html(num)
})
</script>
</html>
... ...
... ... @@ -300,10 +300,6 @@
}
})
//评论留言
$(".comment").click(function(){
window.location.href='writeevalute.html'
})
//点赞
$(".praise").click(function(){
// alert("{$list.id}")
... ...