update pay center. codereview by XWG
Showing
5 changed files
with
105 additions
and
28 deletions
@@ -1247,18 +1247,19 @@ | @@ -1247,18 +1247,19 @@ | ||
1247 | } | 1247 | } |
1248 | } | 1248 | } |
1249 | 1249 | ||
1250 | -###支付中心 | 1250 | +### 支付中心 |
1251 | 1251 | ||
1252 | { | 1252 | { |
1253 | 'payAppInfo' : { | 1253 | 'payAppInfo' : { |
1254 | 'appIcon' : 'http://static.yohobuy.com/images/icon.png', | 1254 | 'appIcon' : 'http://static.yohobuy.com/images/icon.png', |
1255 | + 'payLink' : '/weixin/pay/' | ||
1255 | 'app' : '微信支付', | 1256 | 'app' : '微信支付', |
1256 | 'hint' : '需下载微信客户端', | 1257 | 'hint' : '需下载微信客户端', |
1257 | 'subHint' : '推荐使用' | 1258 | 'subHint' : '推荐使用' |
1258 | } | 1259 | } |
1259 | } | 1260 | } |
1260 | 1261 | ||
1261 | -###物流详情 | 1262 | +### 物流详情 |
1262 | 1263 | ||
1263 | { | 1264 | { |
1264 | 'logisticImg' : 'http://static.yohobuy.com/images/icon.png', | 1265 | 'logisticImg' : 'http://static.yohobuy.com/images/icon.png', |
static/img/layout/pay-icon.png
0 → 100644
18.4 KB
@@ -3,12 +3,11 @@ | @@ -3,12 +3,11 @@ | ||
3 | * @author: 赵彪<bill.zhao@yoho.cn> | 3 | * @author: 赵彪<bill.zhao@yoho.cn> |
4 | * @date: 2015/12/03 | 4 | * @date: 2015/12/03 |
5 | */ | 5 | */ |
6 | - | 6 | +var loading = require('../plugin/loading'); |
7 | 7 | ||
8 | function isWXOpen() { | 8 | function isWXOpen() { |
9 | var ua = navigator.userAgent.toLowerCase(); | 9 | var ua = navigator.userAgent.toLowerCase(); |
10 | 10 | ||
11 | - | ||
12 | if (ua.match(/MicroMessenger/i) === 'micromessenger') { | 11 | if (ua.match(/MicroMessenger/i) === 'micromessenger') { |
13 | return true; | 12 | return true; |
14 | } else { | 13 | } else { |
@@ -19,7 +18,6 @@ function isWXOpen() { | @@ -19,7 +18,6 @@ function isWXOpen() { | ||
19 | function hideWeChatPay() { | 18 | function hideWeChatPay() { |
20 | var payApps = document.getElementsByClassName('app'); | 19 | var payApps = document.getElementsByClassName('app'); |
21 | 20 | ||
22 | - | ||
23 | [].forEach.call(payApps, function(app, index) { | 21 | [].forEach.call(payApps, function(app, index) { |
24 | if (app.innerHTML.indexOf('微信') !== -1) { | 22 | if (app.innerHTML.indexOf('微信') !== -1) { |
25 | app.parentNode.style.display = 'none'; | 23 | app.parentNode.style.display = 'none'; |
@@ -34,4 +32,58 @@ function handleForWX() { | @@ -34,4 +32,58 @@ function handleForWX() { | ||
34 | } | 32 | } |
35 | } | 33 | } |
36 | 34 | ||
37 | -window.onload = handleForWX; | 35 | +function setIcon(div, appName) { |
36 | + | ||
37 | + if (appName.indexOf('百度') !== -1) { | ||
38 | + div.style.backgroundPositionY = '-2.7rem'; | ||
39 | + return false; | ||
40 | + } | ||
41 | + | ||
42 | + if (appName.indexOf('微信') !== -1) { | ||
43 | + div.style.backgroundPositionY = '-1.2rem'; | ||
44 | + return false; | ||
45 | + } | ||
46 | + | ||
47 | + if (appName.indexOf('银联') !== -1) { | ||
48 | + div.style.backgroundPositionY = '-4rem'; | ||
49 | + return false; | ||
50 | + } | ||
51 | + | ||
52 | + if (appName.indexOf('QQ') !== -1) { | ||
53 | + div.style.backgroundPositionY = '-5.4rem'; | ||
54 | + return false; | ||
55 | + } | ||
56 | +} | ||
57 | + | ||
58 | +function loadIcon() { | ||
59 | + var boxs = document.getElementsByClassName('box'); | ||
60 | + var div = null; | ||
61 | + var appName = null; | ||
62 | + | ||
63 | + [].forEach.call(boxs, function(box, index) { | ||
64 | + div = box.getElementsByClassName('icon')[0].getElementsByTagName('div')[0]; | ||
65 | + if (div) { | ||
66 | + appName = box.getElementsByClassName('app')[0].innerHTML; | ||
67 | + setIcon(div, appName); | ||
68 | + } | ||
69 | + }); | ||
70 | +} | ||
71 | + | ||
72 | + | ||
73 | + | ||
74 | +function showPage() { | ||
75 | + var pageList = document.getElementsByClassName('payapp-list')[0]; | ||
76 | + | ||
77 | + pageList.style.visibility = 'visible'; | ||
78 | +} | ||
79 | + | ||
80 | +function main() { | ||
81 | + handleForWX(); | ||
82 | + loading.hideLoadingMask(); | ||
83 | + showPage(); | ||
84 | + loadIcon(); | ||
85 | +} | ||
86 | + | ||
87 | +loading.showLoadingMask(); | ||
88 | + | ||
89 | +window.onload = main; |
1 | .pay-page { | 1 | .pay-page { |
2 | padding: (40rem / $pxConvertRem) (20rem / $pxConvertRem) 0; | 2 | padding: (40rem / $pxConvertRem) (20rem / $pxConvertRem) 0; |
3 | 3 | ||
4 | + .payapp-list { | ||
5 | + visibility: hidden; | ||
6 | + } | ||
7 | + | ||
4 | .box { | 8 | .box { |
5 | border: 1px solid #eee; | 9 | border: 1px solid #eee; |
6 | border-radius: 10rem / $pxConvertRem; | 10 | border-radius: 10rem / $pxConvertRem; |
@@ -16,31 +20,45 @@ | @@ -16,31 +20,45 @@ | ||
16 | } | 20 | } |
17 | 21 | ||
18 | .icon { | 22 | .icon { |
19 | - flex-grow: 0.3; | 23 | + //flex-grow: 0.3 |
24 | + width: 15%; | ||
20 | 25 | ||
21 | img { | 26 | img { |
22 | width: 60rem / $pxConvertRem; | 27 | width: 60rem / $pxConvertRem; |
23 | margin: 0; | 28 | margin: 0; |
24 | } | 29 | } |
30 | + | ||
31 | + > div { | ||
32 | + width: 60rem / $pxConvertRem; | ||
33 | + height: 60rem / $pxConvertRem; | ||
34 | + background-image: url(http://localhost:8000/img/layout/pay-icon.png); | ||
35 | + background-size: 90%; | ||
36 | + background-position-y: 8rem / $pxConvertRem; | ||
37 | + background-position-x: center; | ||
38 | + background-repeat: no-repeat; | ||
39 | + } | ||
25 | } | 40 | } |
26 | 41 | ||
27 | .app { | 42 | .app { |
28 | - flex-grow: 3; | 43 | + //flex-grow: 4 |
44 | + width: 40%; | ||
29 | font-size: 32rem / $pxConvertRem; | 45 | font-size: 32rem / $pxConvertRem; |
30 | color: #414141; | 46 | color: #414141; |
31 | 47 | ||
32 | //padding-left: 20rem/$pxConvertRem | 48 | //padding-left: 20rem/$pxConvertRem |
33 | - | 49 | + |
34 | } | 50 | } |
35 | 51 | ||
36 | .hint { | 52 | .hint { |
37 | - flex-grow: 4; | 53 | + //flex-grow: 4 |
54 | + width: 40%; | ||
38 | font-size: 24rem / $pxConvertRem; | 55 | font-size: 24rem / $pxConvertRem; |
39 | color: #4b4b4b; | 56 | color: #4b4b4b; |
40 | } | 57 | } |
41 | 58 | ||
42 | .iconfont { | 59 | .iconfont { |
43 | - flex-grow: 1; | 60 | + //flex-grow: 1 |
61 | + width: 5%; | ||
44 | justify-content: flex-end; | 62 | justify-content: flex-end; |
45 | color: #e0e0e0; | 63 | color: #e0e0e0; |
46 | font-size: 28rem / $pxConvertRem; | 64 | font-size: 28rem / $pxConvertRem; |
1 | {{> layout/header}} | 1 | {{> layout/header}} |
2 | <div class="pay-page yoho-page"> | 2 | <div class="pay-page yoho-page"> |
3 | - {{# payAppInfo}} | ||
4 | - <div class="box"> | ||
5 | - <div class="icon"> | ||
6 | - <img src="{{appIcon}}" alt="app图标"> | ||
7 | - </div> | ||
8 | - <div class="app">{{app}}</div> | ||
9 | - <div class="hint"> | ||
10 | - {{hint}} | ||
11 | - {{#if subHint}} | ||
12 | - <br> | ||
13 | - {{subHint}} | ||
14 | - {{/if}} | ||
15 | - | ||
16 | - </div> | ||
17 | - <div class="iconfont"></div> | 3 | + <div class="payapp-list"> |
4 | + {{# payAppInfo}} | ||
5 | + <a href="{{payLink}}"> | ||
6 | + <div class="box"> | ||
7 | + <div class="icon"> | ||
8 | + {{#if appIcon}} | ||
9 | + <img src="{{appIcon}}" alt="app图标"> | ||
10 | + {{else}} | ||
11 | + <div></div> | ||
12 | + {{/if}} | ||
13 | + </div> | ||
14 | + <div class="app">{{app}}</div> | ||
15 | + <div class="hint"> | ||
16 | + {{hint}} | ||
17 | + {{#if subHint}} | ||
18 | + <br> | ||
19 | + {{subHint}} | ||
20 | + {{/if}} | ||
21 | + </div> | ||
22 | + <div class="iconfont"></div> | ||
23 | + </div> | ||
24 | + </a> | ||
25 | + {{/ payAppInfo}} | ||
18 | </div> | 26 | </div> |
19 | - {{/ payAppInfo}} | ||
20 | - | ||
21 | </div> | 27 | </div> |
22 | {{> layout/footer}} | 28 | {{> layout/footer}} |
23 | 29 |
-
Please register or login to post a comment