From 814884a04b158c5f0314b454de1061492bc65cac Mon Sep 17 00:00:00 2001 From: whb <whb@yoho> Date: Fri, 15 May 2015 13:36:40 +0800 Subject: [PATCH] 首页,活动页加Q/A --- res/js/admin/activity.js | 15 ++++++--------- res/js/admin/index.js | 4 ++-- res/js/yohood.js | 3 +++ website/controller/Default.class.php | 27 ++++----------------------- website/controller/admin/Index.class.php | 13 ++++++++++--- website/facade/Index.class.php | 22 ++++++++++++---------- website/service/Index.class.php | 22 ++++++++++++---------- website/sqlmap/index/sqlmap-index.xml | 4 ++-- website/view/script/activity/index.php | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- website/view/script/admin/activity/plan.php | 12 +++--------- website/view/script/default/index.php | 17 +++++++++++++++++ website/view/widget/news/list.php | 5 ++--- 12 files changed, 131 insertions(+), 72 deletions(-) diff --git a/res/js/admin/activity.js b/res/js/admin/activity.js index b67317b..815ed9b 100644 --- a/res/js/admin/activity.js +++ b/res/js/admin/activity.js @@ -137,15 +137,13 @@ define('admin/activity',function(require, exports) var obj = $(this).parents('tr'); var id = obj.find("td:eq(0)").text(); var start_time = obj.find("td:eq(1)").text(); - var end_time = obj.find("td:eq(2)").text(); - var title = obj.find("td:eq(3)").text(); - var img = obj.find("td:eq(4) img").attr("src"); - var pic_val = obj.find("td:eq(4) img").attr("pic"); - var content = obj.find("td:eq(5)").text(); + var title = obj.find("td:eq(2)").text(); + var img = obj.find("td:eq(3) img").attr("src"); + var pic_val = obj.find("td:eq(3) img").attr("pic"); + var content = obj.find("td:eq(4)").text(); $("#id").val(id); $("#title").val(title); $("#start_time").val(start_time); - $("#end_time").val(end_time); $("#img").attr("src", img); $("#pic_val").val(pic_val).prev().css("margin-top","-50px"); $("#content").val(content); @@ -182,9 +180,8 @@ define('admin/activity',function(require, exports) var place = ''; var pic = $("#pic_val").val(); var start_time = $("#start_time").val(); - var end_time = $("#end_time").val(); var parent_id = $("#create_activity_plan").attr("parent_id"); - if(title == "" || content == "" || start_time == "" || end_time == "" || pic == "") + if(title == "" || content == "" || start_time == "" || pic == "") { box.alert('请把内容填完'); return; @@ -194,7 +191,7 @@ define('admin/activity',function(require, exports) type:"post", url:"/admin/activity/setactivityplan", data:{title:title,content:content,place:place,pic:pic, parent_id:parent_id, - start_time:start_time, end_time:end_time,id:id}, + start_time:start_time, end_time:'',id:id}, success:function(data) { if(data.status) diff --git a/res/js/admin/index.js b/res/js/admin/index.js index 1e76c70..f3c6cb3 100644 --- a/res/js/admin/index.js +++ b/res/js/admin/index.js @@ -50,7 +50,7 @@ define('admin/index',function(require, exports) form_html, submit, { title: '添加' + $(".active").eq(1).children().text(), - width: '750px', + width: '770px', autoClose: false } ); @@ -90,7 +90,7 @@ define('admin/index',function(require, exports) form_html, submit, { title: '查看' + $(".active").eq(1).children().text(), - width: '750px', + width: '770px', autoClose: false } ); diff --git a/res/js/yohood.js b/res/js/yohood.js index e0c68e4..73bd0fa 100644 --- a/res/js/yohood.js +++ b/res/js/yohood.js @@ -130,6 +130,9 @@ define('yohood', function(require, exports) { $(this).addClass('disable'); }; }); + if(parseInt($("#right_banner").attr("num")) > 0 ) { + $("#img_flow").find(".layout-item").eq(2).before($("#right_banner").html()); + } setFlowLayout(); }; //资讯 diff --git a/website/controller/Default.class.php b/website/controller/Default.class.php index 3a45855..0113967 100644 --- a/website/controller/Default.class.php +++ b/website/controller/Default.class.php @@ -15,35 +15,16 @@ class Controller_Default extends Controller_Abstract $page->setOptions(array('afterAppend' => 'setLayout')); list($offset, $limit) = $page->getLimit(); $this->_view['banners'] = Facade_Index::getIndex(1); - $rightBanners = Facade_Index::getIndex(2); - $totalRightBanner = count($rightBanners); - $list = array(); - $offset = 2; + $rightBanners = array(); if(empty($offset)) { - $news = Facade_News::getList(array(), $offset, $limit - $totalRightBanner, array('手机视频')); - for($i = 1; $i<= $totalRightBanner + count($news); $i++) - { - if($i % 3 == 0 && $i/3 <= $totalRightBanner) - { - $list[] = current($rightBanners); - next($rightBanners); - } - else - { - $list[] = current($news); - next($news); - } - } - $list = array_filter($list); - } - else - { - $list = Facade_News::getList(array(), $offset - $totalRightBanner, $limit, array('手机视频'));; + $rightBanners = Facade_Index::getIndex(2); } + $list = Facade_News::getList(array(), $offset, $limit, array('手机视频')); $this->_view['partnerList'] = Facade_Partner::getPartner(); $this->_view['partnerTypes'] = Facade_Partner::$types; $this->_view['pagination'] = $page->getPagination(); + $this->_view['rightBanners'] = $rightBanners; $this->_view['news'] = $list; } diff --git a/website/controller/admin/Index.class.php b/website/controller/admin/Index.class.php index 2e27d8f..2abc824 100644 --- a/website/controller/admin/Index.class.php +++ b/website/controller/admin/Index.class.php @@ -30,15 +30,22 @@ class Controller_Admin_Index extends Controller_Admin_Base $res = $this->_request->query('res',''); $sort = $this->_request->query('sort', 0); $type = $this->_request->query('type', 1); + $width = $height = $times = 0; + while($width <= 0 && $height <= 0 && $times++<=5) + { + $info = Lib_Images::getImageInfo($res, 'fragmentimg'); + $width = intval($info['width']); + $height = intval($info['height']); + } + $res_size = json_encode(array('width'=> $width, 'height'=> $height)); if($id) { - $ret = Facade_Index::updateIndex($url, $text, $res, $type, $sort, $id); + $ret = Facade_Index::updateIndex($url, $text, $res, $type, $sort, $res_size, $id); } else { - $ret = Facade_Index::submitIndex($url, $text, $res, $type, $sort); + $ret = Facade_Index::submitIndex($url, $text, $res, $type, $sort, $res_size); } - if($ret) { return $this->returnJson(true,200,null); diff --git a/website/facade/Index.class.php b/website/facade/Index.class.php index 9c5cf84..0f7a9db 100644 --- a/website/facade/Index.class.php +++ b/website/facade/Index.class.php @@ -42,32 +42,34 @@ class Facade_Index /** * 根据id更新首页信息状态. * 用于管理员更新一个首页信息的操作. - * @param int $url - * @param int $text - * @param int $res + * @param string $url + * @param string $text + * @param string $res * @param int $type * @param int $sort + * @param string $res_size * @param int $id * @return boolean */ - public static function updateIndex ($url, $text, $res, $type, $sort, $id) + public static function updateIndex ($url, $text, $res, $type, $sort, $res_size, $id) { - return self::service()->updateIndex($url, $text, $res, $type, $sort, $id); + return self::service()->updateIndex($url, $text, $res, $type, $sort, $res_size, $id); } /** * 用户提交首页信息 * - * @param int $url - * @param int $text - * @param int $res + * @param string $url + * @param string $text + * @param string $res * @param int $type * @param int $sort + * @param string $res_size * @return boolean */ - public static function submitIndex ($url, $text, $res, $type, $sort) + public static function submitIndex ($url, $text, $res, $type, $sort, $res_size) { - return self::service()->submitIndex($url, $text, $res, $type, $sort); + return self::service()->submitIndex($url, $text, $res, $type, $sort, $res_size); } /** diff --git a/website/service/Index.class.php b/website/service/Index.class.php index e79daeb..c3f4757 100644 --- a/website/service/Index.class.php +++ b/website/service/Index.class.php @@ -30,17 +30,18 @@ class Service_Index extends Lib_Service * 根据id更新首页信息状态. * 用于管理员更新一个首页信息的操作. * - * @param int $url - * @param int $text - * @param int $res + * @param string $url + * @param string $text + * @param string $res * @param int $type * @param int $sort + * @param string $res_size * @param int $id * @return boolean */ - public function updateIndex ($url, $text, $res, $type, $sort, $id) + public function updateIndex ($url, $text, $res, $type, $sort, $res_size, $id) { - $param = array('id' => $id, 'text' => $text, 'res' => $res,'url'=> $url,'type'=> $type, 'sort' => $sort); + $param = array('id' => $id, 'text' => $text, 'res' => $res,'url'=> $url,'type'=> $type, 'sort' => $sort, 'res_size'=> $res_size); $status = self::service(self::ROUTER)->cache(false)->update('updateBanner', $param)->status(); if($status) { @@ -52,16 +53,17 @@ class Service_Index extends Lib_Service /** * 用户提交首页信息 * - * @param int $url - * @param int $text - * @param int $res + * @param string $url + * @param string $text + * @param string $res * @param int $type * @param int $sort + * @param string $res_size * @return boolean */ - public function submitIndex ($url, $text, $res, $type, $sort) + public function submitIndex ($url, $text, $res, $type, $sort, $res_size) { - $param = array('url' => $url, 'res' => $res, 'text'=> $text, 'type'=> $type,'sort' => $sort); + $param = array('url' => $url, 'res' => $res, 'text'=> $text, 'type'=> $type,'sort' => $sort,'res_size'=> $res_size); $status = self::service(self::ROUTER)->cache(false)->insert('insertBanner', $param)->lastInsertId(); if($status) { diff --git a/website/sqlmap/index/sqlmap-index.xml b/website/sqlmap/index/sqlmap-index.xml index 4c90caf..511841e 100644 --- a/website/sqlmap/index/sqlmap-index.xml +++ b/website/sqlmap/index/sqlmap-index.xml @@ -4,10 +4,10 @@ SELECT * FROM tbl_index where type = :type order by sort desc, id desc </select> <update id="updateBanner"> - UPDATE tbl_index SET type =:type, url=:url,res= :res, text=:text, sort=:sort WHERE id = :id + UPDATE tbl_index SET type =:type, url=:url,res= :res, text=:text, sort=:sort, res_size=:res_size WHERE id = :id </update> <insert id="insertBanner"> - INSERT INTO tbl_index (type,url,res,text,sort, create_time) VALUES (:type, :url,:res, :text, :sort, UNIX_TIMESTAMP()) + INSERT INTO tbl_index (type,url,res,text,sort, res_size, create_time) VALUES (:type, :url,:res, :text, :sort, :res_size, UNIX_TIMESTAMP()) </insert> <delete id="delIndex"> DELETE FROM tbl_index WHERE id = :id diff --git a/website/view/script/activity/index.php b/website/view/script/activity/index.php index 50a23b3..d7479ad 100644 --- a/website/view/script/activity/index.php +++ b/website/view/script/activity/index.php @@ -1,7 +1,18 @@ <?php $this->_extends('layout/default_layout');?> <?php $this->_block('main');?> +<style> + .activity-ask {background: #000; padding: 8px; color: #fff; font-family: 'arial black'; font-weight: bold;} + .activity-ask h2 {font-size: 12px;} + .activity-qa {width: 820px; margin: 0 auto 20px;} + .activity-borderline {padding-bottom: 20px; border-bottom: 1px dashed #ccc; margin-bottom: 20px;} + .activity-qa h2{padding: 8px; color: #ffffff; background: #000; font-weight: 700; margin-bottom: 20px; font-family: "Arial Black";} + .activity-qa h3 {font-size: 14px; font-weight: bold; margin-bottom: 10px;} + .activity-qa h3 span{padding-right: 15px; font-size: 24px; font-family: "Arial Black";} + .activity-qa p {padding-left: 20px; color: #f96062;} + .activity-qa p span{font-weight: bold; padding-right: 10px; font-size: 14px;} +</style> <?php - $this->_widget('activity_nav', array('channel'=> 'index')); + $this->_widget('activity_nav', array('channel'=> 'index')); ?> <div class="activity-main"> <div class="activity-content content-main" style="margin: 0 auto; width: 816px;"> @@ -16,6 +27,52 @@ ?> </div> </div> + <div class="activity-ask"> + <h2>Q&A</h2> + </div> + <div class="activity-qa"> + <?php + $arrs = array( + '1.我不是有货的会员,可以购票吗?' => '活动针对所有消费者开放,您可以在完成简单的注册之后进行购票,注册地址:<a href="http://www.yohobuy.com/reg.html" target="_blank" style="color:red;">http://www.yohobuy.com/reg.html</a>。', + '2.一个账户可以购买多张同一天的单日票吗?'=>'不可以,一个账户仅可购买单日票一张。', + '3.我想参加两天的活动,如何购票?'=>'请分别购买两天的活动门票,两天的门票会绑定到同一有货账户。', + '4.门票是否可以进行退换?'=>'门票售出后不可退换,但由于活动不可抗拒原因造成消费者当天无法入场,可进行门票退换,具体操作可咨询客服。', + '5.你们预售的门票,到时会不会有进场人数的限制?'=>'根据当天现场情况,如果场内客户量较大,可能会采取临时人数管控措施,界时如果由于此问题导致您持有当日门票但直至活动结束仍无法入场,可以选择更换次日门票或是退票。', + '6.是否可以进行现场售票?'=>'现场出售当日票,并在现场进行有货账户绑定。为了更快速入场,建议在YOHOBUY提前完成购票。', + '7.我已经购买了你们的电子门票,当天怎么进场?'=>' 您需要提前把电子门票打印或保存在手机上,持对应日期的电子门票至活动现场,换取当日入场手环。', + '8.购买的二维码遗失了怎么办?'=>'二维码会保存在您的有货账户下,可在活动现场通过服务台咨询找回。', + '9.我不想用手机注册你们的账号,我还可不可以入场?'=>'如果您不想使用手机注册的话,您也可以选择邮箱注册,或者也可以使用支付宝、QQ、新浪微博等联合登录方式绑定入场手环。', + '10.现场手机注册账户,但一直收不到验证短信怎么办?'=>'如果您一直无法接受验证信息的话,建议您可以尝试通过邮箱注册,或使用支付宝、QQ、新浪微博等联合登录方式绑定入场手环。', + '11.如何进行支付?'=>'可以通过网上银行、支付宝、微信等方式支付,请参见有货支付规则:<a href="http://www.yohobuy.com/help/?category_id=43" target="_blank" style="color:red;">http://www.yohobuy.com/help/?category_id=43</a>。', + '12.下单后需要多久完成支付?'=>'订单生成后需要在二小时内付款,逾时订单会被取消。', + '13.现场是否可以通过手机支付?'=>'可通过下载YOHO!有货手机客户端,在现场进行货品查看、购买及支付。', + '14.我可以在现场用现金购物吗?'=>'现场商品均为线上销售,需通过有货APP进行购物,不接受现金支付,请提前下载有货APP。', + '15.室内手机信号不稳定无法支付,怎么办?'=>'因为在室内手机信号分布可能不太均匀,您可以换个位置尝试一下,尽量选择靠近窗边的地方试一下,或者也可以在我们提供的自助电脑上进行支付。', + '16.购买多件商品是否会有折扣,是否包邮?'=>'预购商品以标价为准,可以包邮,但不参与其他活动;非预购商品与有货在售的其他商品一样可享受网站的各项优惠政策。', + '17.预购商品什么时候可以收到货品?'=>'部分商品为预购商品,商品会在秋冬上市,具体上市时间会在商品信息中标明。', + '18.预购商品是否可以和非预售商品合并订单?'=>'不可合并订单。', + '19.我下单之后订单能不能取消?'=>'可以取消订单。', + '20.已支付的订单是否可以退换货?'=>'已支付的订单自签收商品7日内可以退货,15日内可以换货,商品不能影响二次销售。', + '21.现场是否可以购买并且拿到货品?'=>'所有产品均为线上销售,非预购商品支付成功后的3-5天把货品送到。如果您的订购完成后7天内商品仍没有送达,建议您直接与有货客服中心联系。(预购商品需要等待上市期)', + '22.在活动之后我是否还可以进行商品购买?'=>'三天活动结束后,会开始线上销售,但商品数量有限,建议尽早下单购买。', + '23.有什么品牌会参加?'=>'具体参展品牌请查询活动参展品牌页面。<a href="http://www.yohood.cn/brand/index" target="_blank" style="color:red;">http://www.yohood.cn/brand/index</a>', + '24.现场活动具体时间安排是怎么样的?'=>'请留意新闻发布或手机APP及YOHOOD官方网站的活动安排。', + '25.现场除了商品销售还有什么活动?'=>'现场除了商品销售,还会有品牌新品发布会、潮流时尚Fashion Show、VIP潮流派对、潮流文化论坛、潮流市集、BE@RBIRCK世界巡展和COLT签名会。详情请留意YO’HOOD官网:<a href="http://www.yohood.cn/activity/plan" target="_blank" style="color:red;">http://www.yohood.cn/activity/plan</a>。', + '26.会场是否有试衣间?'=>'本次活动现场不设试衣间。', + '27.我可以近距离接触品牌主理人吗?'=>'品牌主理人都会亲临现场,详情请留意YO’HOOD官网。', + '28.如何获得参加现场活动,比如潮流市集、BE@RBIRCK世界巡展等?'=>'只需购买门票就能参加所有的现场活动。详情请留意YO’HOOD官网对于活动时间的预告。', + '29.品牌展出方式是怎样的?'=>'现场品牌均有自己的独立展位。', + '30.现场是否会有限定、联名产品?'=>'此次活动,许多顶尖潮牌推出活动独家限定商品,以及YO’HOOD联名产品,详情请留意YO’HOOD官网。', + '31.我如果中途出去吃个饭,回头凭入场手环还能再进来吗?'=>'可以的,您凭当天的入场手环离场后可以再次进入。', + '32.你们这有没有饮料和食品销售?'=>'活动当天购票入场的客户均可以领取一瓶饮用水,活动现场也会有汉堡王驻场。', + '33.一米二以下儿童是否要票?'=>'每位购票成人可以携带一名一米二以下的儿童入场,但活动期间现场人流量较大,出于安全因素考虑,我们不建议客户带儿童入场。' + ); + foreach($arrs as $key => $arr): + ?> + <h3><span>Q</span><?php echo $key;?></h3> + <p class="activity-borderline"><span>A</span><?php echo $arr;?></p> + <?php endforeach;?> + </div> <?php $this->_endblock();?> <?php $this->_block('js');?> <script type="text/javascript"> diff --git a/website/view/script/admin/activity/plan.php b/website/view/script/admin/activity/plan.php index 84303de..7a0d422 100644 --- a/website/view/script/admin/activity/plan.php +++ b/website/view/script/admin/activity/plan.php @@ -10,8 +10,7 @@ </caption> <thead> <td>编号</td> - <td width="10%">开始时间</td> - <td width="10%">结束时间</td> + <td width="10%">活动时间</td> <td>标题</td> <td>图片</td> <td width="15%">内容</td> @@ -21,7 +20,6 @@ <tr> <td><?php echo $plan['id'];?></td> <td><?php echo date('Y-m-d H:i:s', $plan['start_time']);?></td> - <td><?php echo date('Y-m-d H:i:s', $plan['end_time']);?></td> <td><?php echo $plan['title'];?></td> <td><img src="<?php echo Lib_Images::getImageUrl($plan['pic'], '0200x0150','fragmentimg');?>" width="100" height="100" pic="<?php echo $plan['pic'];?>"/></td> <td><?php echo $plan['content'];?></td> @@ -56,14 +54,10 @@ </td> </tr> <tr> - <td>开始时间<span class="text-error"> * </span</td> - <td> + <td>活动时间<span class="text-error"> * </span</td> + <td colspan="3"> <input value="" type="text" class="Wdate" name="start_time" id="start_time" title="点击选择时间"> </td> - <td>结束时间<span class="text-error"> * </span</td> - <td> - <input value="" type="text" class="Wdate" name="end_time" id="end_time" title="点击选择时间"> - </td> </tr> </tbody> </table> diff --git a/website/view/script/default/index.php b/website/view/script/default/index.php index 166071f..0f4bfac 100644 --- a/website/view/script/default/index.php +++ b/website/view/script/default/index.php @@ -84,6 +84,23 @@ </div> </div> + <div id="right_banner" style="display:none;" num="<?php echo count($this->view->rightBanners);?>"> + <div class="fluid-item layout-item tiled"> + <?php + foreach($this->view->rightBanners as $banner): + $res_size = json_decode($banner['res_size'], true); + $height = ceil($res_size['height'] * (308 / $res_size['width'])); + $width = 308; + ?> + <div class="image-box" style="padding-bottom: 30px;"> + <a href="<?php echo $banner['url']?>" target="_blank"> + <img src="<?php echo Lib_Images::getImageUrl($banner['res'], 'source','fragmentimg');?>" style="<?php echo sprintf("height:%spx;width:%spx;", $height, $width);?>"/> + </a> + </div> + <?php endforeach;?> + </div> + </div> + <?php $this->_endblock();?> <?php $this->_block('js');?> <script type="text/javascript"> diff --git a/website/view/widget/news/list.php b/website/view/widget/news/list.php index a421818..429939d 100644 --- a/website/view/widget/news/list.php +++ b/website/view/widget/news/list.php @@ -1,5 +1,4 @@ -<?php -foreach($list as $news): +<?php foreach($list as $news): $title = Util_StringHelper::substr_cn($news['title'], 90); $description = Lib_Utils_StringHelper::substr_cn(Lib_Utils_StringHelper::stripTags($news['content']), 68); $height = $width = 0; @@ -41,4 +40,4 @@ else <p class="time"><?php echo date('Y.m.d', $news['create_time'])?></p> </div> </div> -<?php endforeach;?> \ No newline at end of file +<?php endforeach;?> \ No newline at end of file -- libgit2 0.24.0