Showing
11 changed files
with
100 additions
and
38 deletions
@@ -11,12 +11,18 @@ exports.index = (req, res, next) => { | @@ -11,12 +11,18 @@ exports.index = (req, res, next) => { | ||
11 | if (Number(appversion.substr(0, 1) < 5) || (Number(appversion.substr(0, 1)) === 5 && Number(appversion.substr(2, 1)) < 2)) { | 11 | if (Number(appversion.substr(0, 1) < 5) || (Number(appversion.substr(0, 1)) === 5 && Number(appversion.substr(2, 1)) < 2)) { |
12 | esc = true; | 12 | esc = true; |
13 | } | 13 | } |
14 | + let uname; | ||
14 | 15 | ||
16 | + try { | ||
17 | + uname = esc ? decodeURIComponent(params.uname) : decodeURIComponent(params.uname.replace(/\%/g, escape('%'))); | ||
18 | + } catch (e) { | ||
19 | + uname = params.uname; | ||
20 | + } | ||
15 | model.getQr({ | 21 | model.getQr({ |
16 | token: params.token, | 22 | token: params.token, |
17 | }).then(result => { | 23 | }).then(result => { |
18 | params.token = result; | 24 | params.token = result; |
19 | - params.uname = esc ? decodeURIComponent(params.uname) : decodeURIComponent(params.uname.replace(/\%/g, escape('%'))); | 25 | + params.uname = uname; |
20 | params.icon = params.icon || 'https://img11.static.yhbimg.com/yhb-img01/2016/07/05/13/017ec560b82c132ab2fdb22f7cf6f42b83.png?imageView/2/w/{width}/h/{height}'; | 26 | params.icon = params.icon || 'https://img11.static.yhbimg.com/yhb-img01/2016/07/05/13/017ec560b82c132ab2fdb22f7cf6f42b83.png?imageView/2/w/{width}/h/{height}'; |
21 | res.render('myqrcode', { | 27 | res.render('myqrcode', { |
22 | title: '查看二维码', | 28 | title: '查看二维码', |
@@ -121,7 +121,8 @@ const local = { | @@ -121,7 +121,8 @@ const local = { | ||
121 | emailRetriveUrl: '/passport/back/email', // 通过邮箱找回密码的URL链接 | 121 | emailRetriveUrl: '/passport/back/email', // 通过邮箱找回密码的URL链接 |
122 | module: 'passport', | 122 | module: 'passport', |
123 | page: 'login', | 123 | page: 'login', |
124 | - title: '登录' | 124 | + title: '登录', |
125 | + reg: true | ||
125 | }); | 126 | }); |
126 | }, | 127 | }, |
127 | international: (req, res) => { | 128 | international: (req, res) => { |
@@ -11,8 +11,9 @@ | @@ -11,8 +11,9 @@ | ||
11 | <div id="js-img-check" {{#captchaShow }}data-init{{/captchaShow}}></div> | 11 | <div id="js-img-check" {{#captchaShow }}data-init{{/captchaShow}}></div> |
12 | <span id="btn-login" class="btn btn-login disable">登录</span> | 12 | <span id="btn-login" class="btn btn-login disable">登录</span> |
13 | <p class="op-container"> | 13 | <p class="op-container"> |
14 | - <a class="sms-login" href={{smsLoginUrl}}>手机号码快捷登录</a> | ||
15 | - <span id="forget-pwd" class="forget-pwd">忘记密码</span> | 14 | + <a class="op-item internat" href={{internationalUrl}}>海外手机</a> |
15 | + <a class="op-item sms-login" href={{smsLoginUrl}}>快速登录</a> | ||
16 | + <span id="forget-pwd" class="op-item forget-pwd">忘记密码</span> | ||
16 | </p> | 17 | </p> |
17 | <div class="third-party-login"> | 18 | <div class="third-party-login"> |
18 | <div class="tp-link"> | 19 | <div class="tp-link"> |
@@ -22,15 +23,12 @@ | @@ -22,15 +23,12 @@ | ||
22 | <a class="alipay" href={{aliLoginUrl}}></a> | 23 | <a class="alipay" href={{aliLoginUrl}}></a> |
23 | </div> | 24 | </div> |
24 | </div> | 25 | </div> |
25 | - <a class="international" href={{internationalUrl}}>International Customer</a> | ||
26 | - <div class="go-register"> | ||
27 | - <i class="iconfont"></i> | ||
28 | - <a href={{registerUrl}}>注册Yoho!Family</a> | ||
29 | - </div> | 26 | + |
30 | <div class="login-tip"> | 27 | <div class="login-tip"> |
31 | <div class="info-icon"></div> | 28 | <div class="info-icon"></div> |
32 | Yoho!Family账号可登录Yoho!Buy有货 | 29 | Yoho!Family账号可登录Yoho!Buy有货 |
33 | </div> | 30 | </div> |
31 | + | ||
34 | <div id="retrive-pwd-mask" class="mask"></div> | 32 | <div id="retrive-pwd-mask" class="mask"></div> |
35 | <ul id="retrive-pwd-ways" class="retrive-pwd-ways"> | 33 | <ul id="retrive-pwd-ways" class="retrive-pwd-ways"> |
36 | <li> | 34 | <li> |
@@ -12,7 +12,7 @@ | @@ -12,7 +12,7 @@ | ||
12 | a.async = 1; | 12 | a.async = 1; |
13 | a.src = j; | 13 | a.src = j; |
14 | m.parentNode.insertBefore(a, m); | 14 | m.parentNode.insertBefore(a, m); |
15 | - }(window, document, 'script', (document.location.protocol === 'https:' ? 'https:' : 'http:') + '//cdn.yoho.cn/yas-jssdk/2.2.5/yas.js', '_yas')); | 15 | + }(window, document, 'script', (document.location.protocol === 'https:' ? 'https:' : 'http:') + '//cdn.yoho.cn/yas-jssdk/2.3.0/yas.js', '_yas')); |
16 | 16 | ||
17 | var _hmt = _hmt || []; | 17 | var _hmt = _hmt || []; |
18 | 18 | ||
@@ -56,7 +56,7 @@ | @@ -56,7 +56,7 @@ | ||
56 | uid = uid === 0 ? '' : uid; | 56 | uid = uid === 0 ? '' : uid; |
57 | window._ozuid = uid; // 暴露ozuid | 57 | window._ozuid = uid; // 暴露ozuid |
58 | if (window._yas) { | 58 | if (window._yas) { |
59 | - window._yas(1 * new Date(), '2.2.5', 'yohobuy_m', uid, '', ''); | 59 | + window._yas(1 * new Date(), '2.3.0', 'yohobuy_m', uid, '', ''); |
60 | } | 60 | } |
61 | 61 | ||
62 | setTimeout(function() { | 62 | setTimeout(function() { |
@@ -280,7 +280,7 @@ function ajaxResource() { | @@ -280,7 +280,7 @@ function ajaxResource() { | ||
280 | 280 | ||
281 | $.ajax({ | 281 | $.ajax({ |
282 | method: 'get', | 282 | method: 'get', |
283 | - url: location.protocol + '//m.yohobuy.com/product/opt/favoriteBrand', | 283 | + url: '/product/opt/favoriteBrand', |
284 | data: { | 284 | data: { |
285 | id: self.parent().attr('shopId'), | 285 | id: self.parent().attr('shopId'), |
286 | opt: opt, | 286 | opt: opt, |
@@ -323,7 +323,7 @@ function ajaxResource() { | @@ -323,7 +323,7 @@ function ajaxResource() { | ||
323 | // vip专属等级查询 | 323 | // vip专属等级查询 |
324 | $.ajax({ | 324 | $.ajax({ |
325 | method: 'POST', | 325 | method: 'POST', |
326 | - url: location.protocol + '//m.yohobuy.com/channel/userVip', | 326 | + url: '/channel/userVip', |
327 | data: { | 327 | data: { |
328 | channel: 1, | 328 | channel: 1, |
329 | }, | 329 | }, |
@@ -3,17 +3,57 @@ | @@ -3,17 +3,57 @@ | ||
3 | */ | 3 | */ |
4 | const qs = require('yoho-qs'); | 4 | const qs = require('yoho-qs'); |
5 | 5 | ||
6 | +const u = navigator.userAgent; | ||
7 | +const isFromYOHO = /m\.yohobuy\.com/i.test(document.referrer); | ||
8 | +const isApp = /yohobuy/i.test(u) || !!window.yohoInterface || /app_version=/i.test(location.search) || /openrefer=/i.test(location.search); | ||
9 | + | ||
10 | +const isiOS = /(iPhone|iPad|iPod|iOS)/i.test(u); // ios终端 | ||
11 | +const isAndroid = /Android/i.test(u); // android终端 | ||
12 | +const iOSVersion = parseInt((u.match(/OS (\d+)_(\d+)_?(\d+)?/i) || [])[1], 10); // iOS 版本 | ||
13 | + | ||
14 | +const nodownload = document.getElementById('no-download'); // 页面不需要下载 | ||
15 | +const urlBlacklist = ['m.yohobuy.com/brands', 'm.yohobuy.com/passport']; | ||
16 | +const blackCheck = urlBlacklist.some(function (url) { | ||
17 | + return new RegExp(url, 'i').test(location.href); | ||
18 | +}); | ||
19 | + | ||
20 | +const canOpenApp = () => { | ||
21 | + if (isApp || isFromYOHO || nodownload || qs.nodownload || qs.no_openapp || blackCheck) { | ||
22 | + return false; | ||
23 | + } | ||
24 | + return isAndroid || iOSVersion < 9 || qs.openapp; | ||
25 | +}; | ||
26 | + | ||
6 | const getAppPath = () => { | 27 | const getAppPath = () => { |
7 | - return document.getElementById('main-wrap').dataset.apppath || 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.home","params":{"gender":"1","channel":"2"}}'; | 28 | + let appPath = document.getElementById('main-wrap').dataset.apppath || 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.home","params":{"gender":"1","channel":"2"}}'; |
29 | + let ct = qs.mkt_code || qs.union_type; | ||
30 | + | ||
31 | + if (ct) { | ||
32 | + appPath = appPath.replace('goapp?', 'goapp?ct=' + ct + '&'); | ||
33 | + } | ||
34 | + | ||
35 | + return appPath; | ||
8 | }; | 36 | }; |
9 | 37 | ||
10 | -if (qs.openapp) { | ||
11 | - const u = navigator.userAgent.toLowerCase(); | ||
12 | - const isiOS = u.indexOf('os') > -1 || u.indexOf('iphone') > -1 || u.indexOf('mac') > -1 || u.indexOf('ipad') > -1; | ||
13 | 38 | ||
39 | +if (canOpenApp()) { | ||
14 | let appPath = getAppPath(); | 40 | let appPath = getAppPath(); |
15 | let ifr; | 41 | let ifr; |
16 | 42 | ||
43 | + if (window._yas && window._yas.sendCustomInfo) { | ||
44 | + window._yas.sendCustomInfo({ | ||
45 | + op: 'YB_H5_AWAKE_APP', | ||
46 | + param: JSON.stringify({ | ||
47 | + PAGE_NAME: encodeURIComponent(document.title), | ||
48 | + PAGE_URL: encodeURIComponent(location.href) | ||
49 | + }) | ||
50 | + }, true); | ||
51 | + } | ||
52 | + | ||
53 | + if (window._hmt && window._hmt.push) { | ||
54 | + window._hmt.push(['_trackEvent', 'H5唤起APP', isiOS ? 'Apple' : 'Android', document.title, location.href]); | ||
55 | + } | ||
56 | + | ||
17 | if (isiOS) { | 57 | if (isiOS) { |
18 | window.location.href = appPath; | 58 | window.location.href = appPath; |
19 | } else { | 59 | } else { |
@@ -22,14 +62,4 @@ if (qs.openapp) { | @@ -22,14 +62,4 @@ if (qs.openapp) { | ||
22 | ifr.style.display = 'none'; | 62 | ifr.style.display = 'none'; |
23 | document.body.appendChild(ifr); | 63 | document.body.appendChild(ifr); |
24 | } | 64 | } |
25 | - | ||
26 | - // let time = Date.now(); | ||
27 | - | ||
28 | - // window.setTimeout(function() { | ||
29 | - // document.body.removeChild(ifr); | ||
30 | - // if (Date.now() - time < 2200) { | ||
31 | - // window.location.href = 'http://a.app.qq.com/o/simple.jsp?pkgname=com.yoho'; | ||
32 | - // } | ||
33 | - // }, 2000); | ||
34 | } | 65 | } |
35 | - |
@@ -67,6 +67,22 @@ body.passport-body { | @@ -67,6 +67,22 @@ body.passport-body { | ||
67 | background-size: 100% 100%; | 67 | background-size: 100% 100%; |
68 | margin: 0 auto; | 68 | margin: 0 auto; |
69 | } | 69 | } |
70 | + | ||
71 | + .opts { | ||
72 | + display: block; | ||
73 | + background: transparent; | ||
74 | + border: solid 1PX #fff; | ||
75 | + width: auto; | ||
76 | + height: 30PX; | ||
77 | + line-height: 30PX; | ||
78 | + border-radius: 30PX; | ||
79 | + color: #fff; | ||
80 | + padding-left: 15PX; | ||
81 | + padding-right: 15PX; | ||
82 | + position: absolute; | ||
83 | + right: 0; | ||
84 | + top: 5PX; | ||
85 | + } | ||
70 | } | 86 | } |
71 | 87 | ||
72 | .input-container, | 88 | .input-container, |
@@ -17,19 +17,21 @@ | @@ -17,19 +17,21 @@ | ||
17 | position: relative; | 17 | position: relative; |
18 | width: 100%; | 18 | width: 100%; |
19 | margin: 20PX 0; | 19 | margin: 20PX 0; |
20 | - text-align: left; | 20 | + text-align: center; |
21 | font-size: 16PX; | 21 | font-size: 16PX; |
22 | + display: flex; | ||
22 | 23 | ||
23 | - .sms-login { | ||
24 | - text-decoration: underline; | ||
25 | - color: #858585; | 24 | + .op-item { |
25 | + flex: 1; | ||
26 | + color: #fff; | ||
27 | + } | ||
28 | + | ||
29 | + .internat { | ||
30 | + text-align: left; | ||
26 | } | 31 | } |
27 | 32 | ||
28 | .forget-pwd { | 33 | .forget-pwd { |
29 | - position: absolute; | ||
30 | - right: 0; | ||
31 | - text-decoration: underline; | ||
32 | - color: #858585; | 34 | + text-align: right; |
33 | } | 35 | } |
34 | } | 36 | } |
35 | 37 | ||
@@ -96,7 +98,7 @@ | @@ -96,7 +98,7 @@ | ||
96 | } | 98 | } |
97 | 99 | ||
98 | .login-tip { | 100 | .login-tip { |
99 | - font-size: 16PX; | 101 | + font-size: 14PX; |
100 | position: relative; | 102 | position: relative; |
101 | color: #d8d8d8; | 103 | color: #d8d8d8; |
102 | margin: 15PX 0; | 104 | margin: 15PX 0; |
@@ -11,7 +11,13 @@ const url = require('url'); | @@ -11,7 +11,13 @@ const url = require('url'); | ||
11 | * @return referer | 11 | * @return referer |
12 | */ | 12 | */ |
13 | exports.refererLimit = (referer, blacklist) => { // eslint-disable-line | 13 | exports.refererLimit = (referer, blacklist) => { // eslint-disable-line |
14 | - let result = decodeURIComponent(referer || '/home'); | 14 | + let result; |
15 | + | ||
16 | + try { | ||
17 | + result = decodeURIComponent(referer || '/home'); | ||
18 | + } catch (e) { | ||
19 | + result = referer || '/home'; | ||
20 | + } | ||
15 | 21 | ||
16 | let urlObj = url.parse(result, false, true); | 22 | let urlObj = url.parse(result, false, true); |
17 | 23 |
-
Please register or login to post a comment