Showing
3 changed files
with
74 additions
and
43 deletions
@@ -30,15 +30,22 @@ class CouponFloorProcess | @@ -30,15 +30,22 @@ class CouponFloorProcess | ||
30 | 30 | ||
31 | $build = array(); | 31 | $build = array(); |
32 | foreach ($data as $k => &$v) { | 32 | foreach ($data as $k => &$v) { |
33 | + $fun = ''; | ||
33 | if (empty($v) || !is_array($v) || !array_key_exists('template_name', $v)) { | 34 | if (empty($v) || !is_array($v) || !array_key_exists('template_name', $v)) { |
34 | - continue; | 35 | + if (array_key_exists('templateName', $v)) { |
36 | + $fun = $v['templateName']; | ||
37 | + } else { | ||
38 | + continue; | ||
39 | + } | ||
40 | + } | ||
41 | + if ($fun !== 'single_image') { | ||
42 | + $fun = $v['template_name']; | ||
35 | } | 43 | } |
36 | - $fun = $v['template_name']; | ||
37 | if (empty($v['data']) || !is_callable("self::$fun")) { | 44 | if (empty($v['data']) || !is_callable("self::$fun")) { |
38 | continue; | 45 | continue; |
39 | } | 46 | } |
40 | // tar note 处理楼层标题 | 47 | // tar note 处理楼层标题 |
41 | - if ($fun === 'getCoupon' && $data[$k - 1]['template_name'] === 'text') { | 48 | + if ($fun === 'getCoupon' && array_key_exists('template_name', $data[$k - 1]) && $data[$k - 1]['template_name'] === 'text') { |
42 | $v['data']['floorTitle'] = $data[$k - 1]['data']; | 49 | $v['data']['floorTitle'] = $data[$k - 1]['data']; |
43 | } | 50 | } |
44 | $build = self::$fun($v['data']); | 51 | $build = self::$fun($v['data']); |
@@ -63,8 +70,10 @@ class CouponFloorProcess | @@ -63,8 +70,10 @@ class CouponFloorProcess | ||
63 | return array(); | 70 | return array(); |
64 | } | 71 | } |
65 | foreach ($data['list'] as &$item) { | 72 | foreach ($data['list'] as &$item) { |
66 | - $imageSrc = Images::getImageUrl($item['src'], 0, 0); | ||
67 | - $item['src'] = $imageSrc; | 73 | + $item['img'] = Images::getImageUrl($item['src'], 0, 0); |
74 | + if (!is_string($item['url'])) { | ||
75 | + $item['url'] = ''; | ||
76 | + } | ||
68 | } | 77 | } |
69 | $data['isCarouselBanner'] = true; | 78 | $data['isCarouselBanner'] = true; |
70 | return $data; | 79 | return $data; |
@@ -132,14 +141,15 @@ class CouponFloorProcess | @@ -132,14 +141,15 @@ class CouponFloorProcess | ||
132 | 141 | ||
133 | /** | 142 | /** |
134 | * | 143 | * |
135 | - * 单张图片的处理方法,不用 | 144 | + * 单张图片的处理方法 |
136 | * | 145 | * |
137 | * @param $data | 146 | * @param $data |
138 | * @return mixed | 147 | * @return mixed |
139 | */ | 148 | */ |
140 | private static function single_image($data) | 149 | private static function single_image($data) |
141 | { | 150 | { |
142 | - $data['isSingleImage'] = true; | ||
143 | - return $data; | 151 | + $data[0]['src'] = Images::getImageUrl($data[0]['src'], 0, 0); |
152 | + $data[0]['isSingleImage'] = true; | ||
153 | + return $data[0]; | ||
144 | } | 154 | } |
145 | } | 155 | } |
1 | {{>layout/header}} | 1 | {{>layout/header}} |
2 | {{# content}} | 2 | {{# content}} |
3 | - {{#if isCarouselBanner}} | ||
4 | - {{>home/baner_top}} | 3 | +{{#if isCarouselBanner}} |
4 | +<div class="banner-top"> | ||
5 | + <div class="banner-swiper swiper-container"> | ||
6 | + <ul class="swiper-wrapper"> | ||
7 | + {{#each list}} | ||
8 | + {{#if @first}} | ||
9 | + <li class="swiper-slide"> | ||
10 | + <a href="{{url}}"> | ||
11 | + <img src="{{img}}"> | ||
12 | + </a> | ||
13 | + </li> | ||
14 | + {{^}} | ||
15 | + <li class="swiper-slide"> | ||
16 | + <a href="{{url}}"> | ||
17 | + <img class="swiper-lazy" src="{{img}}"> | ||
18 | + </a> | ||
19 | + <div class="swiper-lazy-preloader"></div> | ||
20 | + </li> | ||
21 | + {{/if}} | ||
22 | + {{/each}} | ||
23 | + </ul> | ||
24 | + </div> | ||
25 | + <div class="swiper-pagination"> | ||
26 | + <div class="pagination-inner"> | ||
27 | + </div> | ||
28 | + </div> | ||
29 | +</div> | ||
30 | +{{/if}} | ||
31 | +{{#if isCoupon}} | ||
32 | +<div class="coupon-floor"> | ||
33 | + {{#if showFloorTitle}} | ||
34 | + <div class="floor-title"> | ||
35 | + {{floorTitle}} | ||
36 | + </div> | ||
5 | {{/if}} | 37 | {{/if}} |
6 | - {{#if isCoupon}} | ||
7 | - <div class="coupon-floor"> | ||
8 | - {{#if showFloorTitle}} | ||
9 | - <div class="floor-title"> | ||
10 | - {{floorTitle}} | ||
11 | - </div> | ||
12 | - {{/if}} | ||
13 | - <div class="floor-main" style="background-image: url({{image.src}});"> | ||
14 | - <a href="{{image.url}}" class="main-left"></a> | ||
15 | - {{#if isGet}} | ||
16 | - <div class="main-right-receive"> | ||
17 | - <span class="on-receive"></span> | ||
18 | - </div> | ||
19 | - <a href="{{image.url}}" class="main-right-use" style="display: none"> | ||
20 | - <span class="received"></span> | ||
21 | - </a> | ||
22 | - {{/if}} | ||
23 | - {{#if isGeted}} | ||
24 | - <a href="{{image.url}}" class="main-right-use"> | ||
25 | - <span class="received"></span> | ||
26 | - </a> | ||
27 | - {{/if}} | ||
28 | - {{#if isZero}} | ||
29 | - <a href="{{image.url}}" class="main-right-go"> | ||
30 | - <span class="zero"></span> | ||
31 | - </a> | ||
32 | - {{/if}} | ||
33 | - </div> | ||
34 | - </div> | 38 | + <div class="floor-main" style="background-image: url({{image.src}});"> |
39 | + <a href="{{image.url}}" class="main-left"></a> | ||
40 | + {{#if isGet}} | ||
41 | + <div class="main-right-receive"> | ||
42 | + <span class="on-receive"></span> | ||
43 | + </div> | ||
44 | + <a href="{{image.url}}" class="main-right-use" style="display: none"> | ||
45 | + <span class="received"></span> | ||
46 | + </a> | ||
35 | {{/if}} | 47 | {{/if}} |
48 | + {{#if isGeted}} | ||
49 | + <a href="{{image.url}}" class="main-right-use"> | ||
50 | + <span class="received"></span> | ||
51 | + </a> | ||
52 | + {{/if}} | ||
53 | + {{#if isZero}} | ||
54 | + <a href="{{image.url}}" class="main-right-go"> | ||
55 | + <span class="zero"></span> | ||
56 | + </a> | ||
57 | + {{/if}} | ||
58 | + </div> | ||
59 | +</div> | ||
60 | +{{/if}} | ||
36 | {{/ content}} | 61 | {{/ content}} |
37 | <div class="floor-mask"></div> | 62 | <div class="floor-mask"></div> |
38 | <div class="floor-message"> | 63 | <div class="floor-message"> |
@@ -31,10 +31,6 @@ class CouponController extends AbstractAction | @@ -31,10 +31,6 @@ class CouponController extends AbstractAction | ||
31 | if (isset($resource['code']) && $resource['code'] == 200) { | 31 | if (isset($resource['code']) && $resource['code'] == 200) { |
32 | $result = CouponFloorProcess::getContent($resource['data']); | 32 | $result = CouponFloorProcess::getContent($resource['data']); |
33 | } | 33 | } |
34 | -// header("Content-type:text/html;charset=utf-8"); | ||
35 | -// echo '<pre>'; | ||
36 | -// print_r($result); | ||
37 | -// echo '</pre>';exit; | ||
38 | $this->_view->display('index', array( | 34 | $this->_view->display('index', array( |
39 | 'content' => $result, | 35 | 'content' => $result, |
40 | 'floorPage' => true | 36 | 'floorPage' => true |
-
Please register or login to post a comment