Merge branch 'feature/yoluckShare' into 'release/0110'
Feature/yoluck share See merge request !1661
Showing
13 changed files
with
101 additions
and
11 deletions
@@ -2,6 +2,15 @@ const _ = require('lodash'); | @@ -2,6 +2,15 @@ const _ = require('lodash'); | ||
2 | 2 | ||
3 | const {YOLUCK_LIST_TYPE, YoLuckService} = require('../models/yoluck-service'); | 3 | const {YOLUCK_LIST_TYPE, YoLuckService} = require('../models/yoluck-service'); |
4 | 4 | ||
5 | +function _handelErrorMessage(e) { | ||
6 | + if (e && e.statusCode === 503) { | ||
7 | + e.title = '人数过多。。。'; | ||
8 | + e.message = '目前参与人数过多请点击刷新'; | ||
9 | + } | ||
10 | + | ||
11 | + return e; | ||
12 | +} | ||
13 | + | ||
5 | function index(req, res, next) { | 14 | function index(req, res, next) { |
6 | let type = +req.query.type || YOLUCK_LIST_TYPE.running; | 15 | let type = +req.query.type || YOLUCK_LIST_TYPE.running; |
7 | let uid = req.user.uid; | 16 | let uid = req.user.uid; |
@@ -17,7 +26,7 @@ function index(req, res, next) { | @@ -17,7 +26,7 @@ function index(req, res, next) { | ||
17 | `/signin.html?refer=//m.yohobuy.com/activity/yoluck/index.html?type=${YOLUCK_LIST_TYPE.joined}` | 26 | `/signin.html?refer=//m.yohobuy.com/activity/yoluck/index.html?type=${YOLUCK_LIST_TYPE.joined}` |
18 | ); | 27 | ); |
19 | } else { | 28 | } else { |
20 | - return next(result.error); | 29 | + return Promise.reject(result.error); |
21 | } | 30 | } |
22 | } | 31 | } |
23 | 32 | ||
@@ -30,8 +39,7 @@ function index(req, res, next) { | @@ -30,8 +39,7 @@ function index(req, res, next) { | ||
30 | width750: true, | 39 | width750: true, |
31 | wechatShare: true | 40 | wechatShare: true |
32 | }); | 41 | }); |
33 | - | ||
34 | - }).catch(next); | 42 | + }).catch(e => next(_handelErrorMessage(e))); |
35 | } | 43 | } |
36 | 44 | ||
37 | function nextPage(req, res, next) { | 45 | function nextPage(req, res, next) { |
@@ -82,7 +90,7 @@ function detail(req, res, next) { | @@ -82,7 +90,7 @@ function detail(req, res, next) { | ||
82 | wechatShare: true | 90 | wechatShare: true |
83 | }); | 91 | }); |
84 | 92 | ||
85 | - }).catch(next); | 93 | + }).catch(e => next(_handelErrorMessage(e))); |
86 | } | 94 | } |
87 | 95 | ||
88 | 96 |
@@ -16,12 +16,12 @@ | @@ -16,12 +16,12 @@ | ||
16 | {{! 侧悬浮}} | 16 | {{! 侧悬浮}} |
17 | {{#isEqualOr param.linkTarget '1' '3'}} | 17 | {{#isEqualOr param.linkTarget '1' '3'}} |
18 | <a href="{{param.sidebarPageId}}" class="sidebar-link" target="_blank"> | 18 | <a href="{{param.sidebarPageId}}" class="sidebar-link" target="_blank"> |
19 | - <img src="{{param.icon}}"> | 19 | + <img src="{{imageslim param.icon}}"> |
20 | </a> | 20 | </a> |
21 | {{/isEqualOr}} | 21 | {{/isEqualOr}} |
22 | {{#isEqualOr param.linkTarget '2'}} | 22 | {{#isEqualOr param.linkTarget '2'}} |
23 | <div id="sidebar" pageid="{{param.sidebarPageId}}"> | 23 | <div id="sidebar" pageid="{{param.sidebarPageId}}"> |
24 | - <img src="{{param.icon}}"> | 24 | + <img src="{{imageslim param.icon}}"> |
25 | </div> | 25 | </div> |
26 | {{/isEqualOr}} | 26 | {{/isEqualOr}} |
27 | {{/isEqualOr}} | 27 | {{/isEqualOr}} |
@@ -25,6 +25,33 @@ const forceNoCache = (res) => { | @@ -25,6 +25,33 @@ const forceNoCache = (res) => { | ||
25 | } | 25 | } |
26 | }; | 26 | }; |
27 | 27 | ||
28 | +const _err503 = (req, res, code, err) => { | ||
29 | + res.status(code); | ||
30 | + | ||
31 | + if (req.xhr) { | ||
32 | + return res.json({ | ||
33 | + code: err.code, | ||
34 | + message: err.message || '服务器繁忙请稍后重试!' | ||
35 | + }); | ||
36 | + } | ||
37 | + | ||
38 | + return res.render('error/510', { | ||
39 | + err: err, | ||
40 | + module: 'common', | ||
41 | + page: 'error', | ||
42 | + title: err.title || '服务器繁忙 | Yoho!Buy有货 | 潮流购物逛不停', | ||
43 | + pageHeader: headerModel.setNav({ | ||
44 | + navTitle: err.title || err.message || '服务器繁忙请稍后重试!' | ||
45 | + }), | ||
46 | + showRefresh: { | ||
47 | + message: err.message, | ||
48 | + btnName: '刷新重试' | ||
49 | + }, | ||
50 | + pageFooter: true, | ||
51 | + isErr: true | ||
52 | + }); | ||
53 | +}; | ||
54 | + | ||
28 | const _err510 = (req, res, code, err) => { | 55 | const _err510 = (req, res, code, err) => { |
29 | res.status(code); | 56 | res.status(code); |
30 | 57 | ||
@@ -196,6 +223,8 @@ exports.serverError = () => { | @@ -196,6 +223,8 @@ exports.serverError = () => { | ||
196 | 223 | ||
197 | } else if (err.code === 9999991 || err.code === 9999992) { | 224 | } else if (err.code === 9999991 || err.code === 9999992) { |
198 | return _err510(req, res, 510, err); | 225 | return _err510(req, res, 510, err); |
226 | + } else if (+err.statusCode === 503) { | ||
227 | + return _err503(req, res, 510, err); | ||
199 | } | 228 | } |
200 | 229 | ||
201 | if (!res.headersSent) { | 230 | if (!res.headersSent) { |
1 | <div class="err-page yoho-page"> | 1 | <div class="err-page yoho-page"> |
2 | - <div class="err-bg"></div> | 2 | + <div class="err-bg {{#if showRefresh}}err-refresh{{/if}}"> |
3 | + {{#showRefresh}} | ||
4 | + <div class="refresh-wrap"> | ||
5 | + <p class="refresh-msg">{{message}}</p> | ||
6 | + <a class="refresh-btn" href="javascript:void(0)" onclick="location.reload()" >{{btnName}}</a> | ||
7 | + </div> | ||
8 | + {{/showRefresh}} | ||
9 | + </div> | ||
3 | </div> | 10 | </div> |
@@ -88,7 +88,7 @@ | @@ -88,7 +88,7 @@ | ||
88 | "xml2js": "^0.4.19", | 88 | "xml2js": "^0.4.19", |
89 | "yoho-express-session": "^2.0.0", | 89 | "yoho-express-session": "^2.0.0", |
90 | "yoho-md5": "^2.0.0", | 90 | "yoho-md5": "^2.0.0", |
91 | - "yoho-node-lib": "=0.6.41", | 91 | + "yoho-node-lib": "=0.6.43", |
92 | "yoho-zookeeper": "^1.0.10" | 92 | "yoho-zookeeper": "^1.0.10" |
93 | }, | 93 | }, |
94 | "devDependencies": { | 94 | "devDependencies": { |
@@ -186,6 +186,7 @@ if (+fellowInfo.type === 2) { | @@ -186,6 +186,7 @@ if (+fellowInfo.type === 2) { | ||
186 | 186 | ||
187 | clipboardFellow.on('success', function(e) { | 187 | clipboardFellow.on('success', function(e) { |
188 | fellow(fellowInfo.tip); | 188 | fellow(fellowInfo.tip); |
189 | + tip.show('内容已复制', 2000); | ||
189 | e.clearSelection(); | 190 | e.clearSelection(); |
190 | }); | 191 | }); |
191 | } | 192 | } |
@@ -200,6 +201,7 @@ if (+fellowInfo.type === 2) { | @@ -200,6 +201,7 @@ if (+fellowInfo.type === 2) { | ||
200 | 201 | ||
201 | clipboardLottery.on('success', function(e) { | 202 | clipboardLottery.on('success', function(e) { |
202 | fellow(lotteryInfo.h5Tip); | 203 | fellow(lotteryInfo.h5Tip); |
204 | + tip.show('内容已复制', 2000); | ||
203 | e.clearSelection(); | 205 | e.clearSelection(); |
204 | }); | 206 | }); |
205 | 207 |
@@ -11,6 +11,7 @@ let yoSdk = require('yoho-activity-sdk'); | @@ -11,6 +11,7 @@ let yoSdk = require('yoho-activity-sdk'); | ||
11 | let yoho = require('js/yoho-app'); | 11 | let yoho = require('js/yoho-app'); |
12 | const DETAIL_URI = location.protocol + '//m.yohobuy.com/activity/yoluck'; | 12 | const DETAIL_URI = location.protocol + '//m.yohobuy.com/activity/yoluck'; |
13 | 13 | ||
14 | +let tip = require('js/plugin/tip'); | ||
14 | let Clipboard = require('clipboard'); | 15 | let Clipboard = require('clipboard'); |
15 | let publicCopyInfo = ''; | 16 | let publicCopyInfo = ''; |
16 | 17 | ||
@@ -257,11 +258,17 @@ bus$.add(onTabClick); | @@ -257,11 +258,17 @@ bus$.add(onTabClick); | ||
257 | bus$.add(onReachBottom); | 258 | bus$.add(onReachBottom); |
258 | 259 | ||
259 | function initClipboard() { | 260 | function initClipboard() { |
260 | - new Clipboard('.js-clipbroad', { | 261 | + let _clipboard = new Clipboard('.js-clipbroad', { |
261 | text: function() { | 262 | text: function() { |
262 | return publicCopyInfo; | 263 | return publicCopyInfo; |
263 | } | 264 | } |
264 | }); | 265 | }); |
266 | + | ||
267 | + _clipboard.on('success', function() { | ||
268 | + if (publicCopyInfo) { | ||
269 | + tip.show('内容已复制', 2000); | ||
270 | + } | ||
271 | + }); | ||
265 | } | 272 | } |
266 | 273 | ||
267 | initClipboard(); | 274 | initClipboard(); |
@@ -88,9 +88,10 @@ | @@ -88,9 +88,10 @@ | ||
88 | content: ""; | 88 | content: ""; |
89 | width: 100%; | 89 | width: 100%; |
90 | height: 40px; | 90 | height: 40px; |
91 | - margin-top: -31px; | 91 | + margin-top: -40px; |
92 | background: url("img/activity/yoluck/lottery-more.png"); | 92 | background: url("img/activity/yoluck/lottery-more.png"); |
93 | background-size: 100%; | 93 | background-size: 100%; |
94 | + background-repeat: no-repeat; | ||
94 | display: block; | 95 | display: block; |
95 | position: relative; | 96 | position: relative; |
96 | z-index: -1; | 97 | z-index: -1; |
@@ -10,4 +10,31 @@ | @@ -10,4 +10,31 @@ | ||
10 | background: url("img/common/404.png") no-repeat; | 10 | background: url("img/common/404.png") no-repeat; |
11 | background-size: 100% 100%; | 11 | background-size: 100% 100%; |
12 | } | 12 | } |
13 | + | ||
14 | + .err-refresh { | ||
15 | + margin-top: -250px; | ||
16 | + } | ||
17 | + | ||
18 | + .refresh-wrap { | ||
19 | + width: 460px; | ||
20 | + position: absolute; | ||
21 | + left: 50%; | ||
22 | + top: 100%; | ||
23 | + margin-left: -230px; | ||
24 | + text-align: center; | ||
25 | + | ||
26 | + .refresh-msg { | ||
27 | + line-height: 1.4; | ||
28 | + padding: 20px 0; | ||
29 | + } | ||
30 | + | ||
31 | + .refresh-btn { | ||
32 | + width: 200px; | ||
33 | + line-height: 60px; | ||
34 | + background-color: #414141; | ||
35 | + display: block; | ||
36 | + color: #fff; | ||
37 | + margin: 10px auto; | ||
38 | + } | ||
39 | + } | ||
13 | } | 40 | } |
@@ -100,7 +100,7 @@ button { | @@ -100,7 +100,7 @@ button { | ||
100 | color: #fff; | 100 | color: #fff; |
101 | font-size: 24px; | 101 | font-size: 24px; |
102 | border: none; | 102 | border: none; |
103 | - z-index: 100; | 103 | + z-index: 1000; |
104 | box-sizing: border-box; | 104 | box-sizing: border-box; |
105 | border-radius: 10PX; | 105 | border-radius: 10PX; |
106 | } | 106 | } |
This diff could not be displayed because it is too large.
-
Please register or login to post a comment