Merge branch 'feature/newQrcode' into feature/storeHome
Showing
10 changed files
with
104 additions
and
25 deletions
@@ -23,3 +23,13 @@ exports.index = (req, res, next) => { | @@ -23,3 +23,13 @@ exports.index = (req, res, next) => { | ||
23 | res.render('new-qrcode', Object.assign(responseData, result)); | 23 | res.render('new-qrcode', Object.assign(responseData, result)); |
24 | }).catch(next); | 24 | }).catch(next); |
25 | }; | 25 | }; |
26 | + | ||
27 | +exports.reload = (req, res, next) => { | ||
28 | + let params = { | ||
29 | + uid: req.user.uid | ||
30 | + }; | ||
31 | + | ||
32 | + req.ctx(newQrcodeModel).getToken(params).then(result => { | ||
33 | + res.json(result); | ||
34 | + }).catch(next); | ||
35 | +}; |
1 | 'use strict'; | 1 | 'use strict'; |
2 | 2 | ||
3 | const _ = require('lodash'); | 3 | const _ = require('lodash'); |
4 | -const camelCase = global.yoho.camelCase; | ||
5 | const api = global.yoho.API; | 4 | const api = global.yoho.API; |
6 | -const crypto = global.yoho.crypto; | ||
7 | -const PASSWORD = 'yoho9646yoho9646'; | ||
8 | 5 | ||
9 | class newQrcode extends global.yoho.BaseModel { | 6 | class newQrcode extends global.yoho.BaseModel { |
10 | constructor(ctx) { | 7 | constructor(ctx) { |
@@ -38,20 +35,9 @@ class newQrcode extends global.yoho.BaseModel { | @@ -38,20 +35,9 @@ class newQrcode extends global.yoho.BaseModel { | ||
38 | } | 35 | } |
39 | 36 | ||
40 | getToken(params) { | 37 | getToken(params) { |
41 | - let uidNum = parseInt(params.uid, 10); | ||
42 | - let token = uidNum ? crypto.encryption(PASSWORD, uidNum + '') : ''; | ||
43 | - let uid = ''; | ||
44 | - | ||
45 | - try { | ||
46 | - uid = crypto.decrypt(PASSWORD, decodeURIComponent(token)); | ||
47 | - uid = parseInt(uid, 10); | ||
48 | - } catch (e) { | ||
49 | - uid = token; | ||
50 | - } | ||
51 | - | ||
52 | return api.get('', { | 38 | return api.get('', { |
53 | method: 'app.twoDimen.getCode', | 39 | method: 'app.twoDimen.getCode', |
54 | - uid: uid, | 40 | + uid: params.uid, |
55 | }).then(result => { | 41 | }).then(result => { |
56 | return (result && result.data && result.data.code) || ''; | 42 | return (result && result.data && result.data.code) || ''; |
57 | }); | 43 | }); |
@@ -66,10 +52,10 @@ class newQrcode extends global.yoho.BaseModel { | @@ -66,10 +52,10 @@ class newQrcode extends global.yoho.BaseModel { | ||
66 | let resu = {}; | 52 | let resu = {}; |
67 | 53 | ||
68 | if (_.get(result, '[0]data')) { | 54 | if (_.get(result, '[0]data')) { |
69 | - resu = camelCase(result[0].data); | 55 | + resu = result[0].data; |
70 | } | 56 | } |
71 | if (_.get(result, '[1]data')) { | 57 | if (_.get(result, '[1]data')) { |
72 | - resu.trendWord = result[1].data.trendWord; | 58 | + resu.trendWord = result[1].data.trendWord || result[1].data.inviteCode; |
73 | } | 59 | } |
74 | if (_.get(result, '[2]')) { | 60 | if (_.get(result, '[2]')) { |
75 | resu.token = result[2]; | 61 | resu.token = result[2]; |
@@ -179,5 +179,6 @@ router.get('/return/exchange/refreshDelivery', auth, exchange.refreshDelivery); | @@ -179,5 +179,6 @@ router.get('/return/exchange/refreshDelivery', auth, exchange.refreshDelivery); | ||
179 | 179 | ||
180 | router.get('/tide-command', auth, tideCommand.tideCommand); // 设置潮流口令 | 180 | router.get('/tide-command', auth, tideCommand.tideCommand); // 设置潮流口令 |
181 | router.get('/newQrcode', auth, newQrcode.index); // 新二维码页面 | 181 | router.get('/newQrcode', auth, newQrcode.index); // 新二维码页面 |
182 | +router.get('/newQrcode/reload', auth, newQrcode.reload); // 刷新二维码页面 | ||
182 | 183 | ||
183 | module.exports = router; | 184 | module.exports = router; |
@@ -2,8 +2,8 @@ | @@ -2,8 +2,8 @@ | ||
2 | <div class="qrcode-body"> | 2 | <div class="qrcode-body"> |
3 | <div class="toper"> | 3 | <div class="toper"> |
4 | <div class="user-pic"> | 4 | <div class="user-pic"> |
5 | - <div class="avatar user-avatar"{{#if headIco}} style="background-image:url({{image2 headIco mode=2 h=100 w=100 q=90}})"{{/if}}></div> | ||
6 | - <div class="level level-{{vipInfo/curLevel}}"></div> | 5 | + <div class="avatar user-avatar"{{#if head_ico}} style="background-image:url({{image2 head_ico mode=2 h=100 w=100 q=90}})"{{/if}}></div> |
6 | + <div class="level level-{{vip_info/cur_level}}"></div> | ||
7 | </div> | 7 | </div> |
8 | <div class="user-info"> | 8 | <div class="user-info"> |
9 | <div class="name eps">{{nickname}}</div> | 9 | <div class="name eps">{{nickname}}</div> |
@@ -19,11 +19,14 @@ | @@ -19,11 +19,14 @@ | ||
19 | </div> | 19 | </div> |
20 | </div> | 20 | </div> |
21 | <div class="qrcode-pic" data-qr="{{token}}"> | 21 | <div class="qrcode-pic" data-qr="{{token}}"> |
22 | - <div class="qrcode-avatar user-avatar"{{#if headIco}} style="background-image:url({{image2 headIco mode=2 h=100 w=100 q=90}})"{{/if}}></div> | 22 | + <div class="qrcode-avatar user-avatar"{{#if head_ico}} style="background-image:url({{image2 head_ico mode=2 h=100 w=100 q=90}})"{{/if}}></div> |
23 | </div> | 23 | </div> |
24 | <div class="invite hide"> | 24 | <div class="invite hide"> |
25 | <span>邀请好友扫一扫完成注册,现金券赚不停</span> | 25 | <span>邀请好友扫一扫完成注册,现金券赚不停</span> |
26 | <span class="iconfont"></span> | 26 | <span class="iconfont"></span> |
27 | </div> | 27 | </div> |
28 | </div> | 28 | </div> |
29 | + <div class="reload-c"> | ||
30 | + <div class="reload"><span class="iconfont"></span>点击刷新二维码</div> | ||
31 | + </div> | ||
29 | </div> | 32 | </div> |
No preview for this file type
@@ -258,6 +258,9 @@ t9.5 -10.5t21.5 -4h37h67h81h80h64h36q23 0 34 12t2 38q-5 13 -9.5 30.5t-9.5 34.5q- | @@ -258,6 +258,9 @@ t9.5 -10.5t21.5 -4h37h67h81h80h64h36q23 0 34 12t2 38q-5 13 -9.5 30.5t-9.5 34.5q- | ||
258 | <glyph glyph-name="shanchu" unicode="" d="M911.36 725.333333l-242.346667 0L669.013333 848.213333c0 27.306667-20.48 47.786667-47.786667 47.786667L375.466667 896c-27.306667 0-47.786667-20.48-47.786667-47.786667L327.68 725.333333 81.92 725.333333C54.613333 725.333333 34.133333 704.853333 34.133333 677.546667s20.48-47.786667 47.786667-47.786667L375.466667 629.76l242.346667 0 293.546667 0c27.306667 0 47.786667 20.48 47.786667 47.786667S938.666667 725.333333 911.36 725.333333zM423.253333 725.333333 423.253333 797.013333l146.773333 0L570.026667 725.333333 423.253333 725.333333zM764.586667 578.56c-27.306667 0-47.786667-20.48-47.786667-47.786667l0-559.786667L276.48-29.013333 276.48 530.773333c0 27.306667-20.48 47.786667-47.786667 47.786667s-47.786667-20.48-47.786667-47.786667l0-610.986667c0-27.306667 20.48-47.786667 47.786667-47.786667l535.893333 0c27.306667 0 47.786667 20.48 47.786667 47.786667L812.373333 530.773333C815.786667 558.08 791.893333 578.56 764.586667 578.56zM447.146667 66.56 447.146667 455.68c0 27.306667-20.48 47.786667-47.786667 47.786667s-47.786667-20.48-47.786667-47.786667l0-389.12c0-27.306667 20.48-47.786667 47.786667-47.786667S447.146667 39.253333 447.146667 66.56zM645.12 66.56 645.12 455.68c0 27.306667-20.48 47.786667-47.786667 47.786667S546.133333 482.986667 546.133333 455.68l0-389.12c0-27.306667 20.48-47.786667 47.786667-47.786667S645.12 39.253333 645.12 66.56z" horiz-adv-x="1024" /> | 258 | <glyph glyph-name="shanchu" unicode="" d="M911.36 725.333333l-242.346667 0L669.013333 848.213333c0 27.306667-20.48 47.786667-47.786667 47.786667L375.466667 896c-27.306667 0-47.786667-20.48-47.786667-47.786667L327.68 725.333333 81.92 725.333333C54.613333 725.333333 34.133333 704.853333 34.133333 677.546667s20.48-47.786667 47.786667-47.786667L375.466667 629.76l242.346667 0 293.546667 0c27.306667 0 47.786667 20.48 47.786667 47.786667S938.666667 725.333333 911.36 725.333333zM423.253333 725.333333 423.253333 797.013333l146.773333 0L570.026667 725.333333 423.253333 725.333333zM764.586667 578.56c-27.306667 0-47.786667-20.48-47.786667-47.786667l0-559.786667L276.48-29.013333 276.48 530.773333c0 27.306667-20.48 47.786667-47.786667 47.786667s-47.786667-20.48-47.786667-47.786667l0-610.986667c0-27.306667 20.48-47.786667 47.786667-47.786667l535.893333 0c27.306667 0 47.786667 20.48 47.786667 47.786667L812.373333 530.773333C815.786667 558.08 791.893333 578.56 764.586667 578.56zM447.146667 66.56 447.146667 455.68c0 27.306667-20.48 47.786667-47.786667 47.786667s-47.786667-20.48-47.786667-47.786667l0-389.12c0-27.306667 20.48-47.786667 47.786667-47.786667S447.146667 39.253333 447.146667 66.56zM645.12 66.56 645.12 455.68c0 27.306667-20.48 47.786667-47.786667 47.786667S546.133333 482.986667 546.133333 455.68l0-389.12c0-27.306667 20.48-47.786667 47.786667-47.786667S645.12 39.253333 645.12 66.56z" horiz-adv-x="1024" /> |
259 | 259 | ||
260 | 260 | ||
261 | + <glyph glyph-name="facebook" unicode="" d="M435.959 524.089l0-96.095-76.888 0 0-115.239 76.888 0 0-268.953 115.26 0L551.219 312.755l115.281 0L666.5 427.994l-115.26 0 0 76.867c0 23.064 15.369 38.413 38.372 38.413l76.888 0 0 115.26-96.136 0C497.416 658.535 435.959 597.078 435.959 524.089L435.959 524.089zM512.032 861.888C248.096 861.888 34.144 648 34.144 384c0-263.936 213.952-477.888 477.888-477.888S989.856 120.128 989.856 384C989.856 648 775.968 861.888 512.032 861.888zM830.496 65.472c-41.344-41.344-89.472-73.856-143.104-96.512-55.488-23.488-114.432-35.392-175.296-35.392-60.8 0-119.808 11.904-175.36 35.392-53.632 22.656-101.824 55.104-143.168 96.512-41.344 41.344-73.856 89.6-96.512 143.232C73.504 264.128 61.6 323.2 61.6 384s11.904 119.744 35.392 175.296c22.656 53.632 55.168 101.76 96.512 143.168 41.344 41.344 89.536 73.856 143.168 96.512 55.552 23.424 114.56 35.392 175.36 35.392 60.864 0 119.808-11.968 175.296-35.392 53.632-22.656 101.76-55.168 143.104-96.512 41.344-41.408 73.856-89.536 96.64-143.168 23.424-55.488 35.392-114.432 35.392-175.296s-12.032-119.936-35.392-175.296C904.352 155.136 871.84 106.88 830.496 65.472z" horiz-adv-x="1024" /> | ||
262 | + | ||
263 | + | ||
261 | <glyph glyph-name="wenhao" unicode="" d="M512 886.272c-277.504 0-502.272-224.768-502.272-502.272s224.768-502.272 502.272-502.272 502.272 224.768 502.272 502.272S789.504 886.272 512 886.272zM520.704-14.848c-45.568 0-82.432 36.864-82.432 82.432 0 45.568 36.864 82.432 82.432 82.432 45.568 0 82.432-36.864 82.432-82.432C603.648 22.528 566.272-14.848 520.704-14.848zM737.792 477.184c-11.264-23.552-33.28-50.688-67.072-83.456-37.376-35.84-52.736-52.736-59.392-60.928-7.68-9.728-13.824-20.992-17.408-34.816-4.096-14.336-6.144-35.328-5.632-61.44l0.512-30.72-141.824 0 0 30.208c0 37.376 3.072 67.072 9.216 90.112 6.656 24.064 16.384 45.568 29.696 63.488 12.288 16.896 32.768 39.936 62.464 71.168 33.792 34.816 47.104 51.712 51.712 59.904 3.072 5.12 8.192 16.896 8.192 44.544 0 18.944-6.656 35.328-20.48 50.688-13.312 14.336-33.28 20.992-60.928 20.992-81.408 0-92.672-58.368-92.672-115.712l0-30.208-142.336 0 1.024 30.72c1.536 48.128 7.168 84.48 17.92 111.104 10.752 27.136 28.672 51.712 52.224 73.216 23.04 20.992 49.664 36.352 77.824 46.08 28.16 9.728 57.856 14.336 88.576 14.336 62.976 0 116.736-18.944 159.744-56.832l0 0c43.52-38.912 66.048-90.624 66.048-154.112C755.2 527.872 749.568 501.248 737.792 477.184z" horiz-adv-x="1024" /> | 264 | <glyph glyph-name="wenhao" unicode="" d="M512 886.272c-277.504 0-502.272-224.768-502.272-502.272s224.768-502.272 502.272-502.272 502.272 224.768 502.272 502.272S789.504 886.272 512 886.272zM520.704-14.848c-45.568 0-82.432 36.864-82.432 82.432 0 45.568 36.864 82.432 82.432 82.432 45.568 0 82.432-36.864 82.432-82.432C603.648 22.528 566.272-14.848 520.704-14.848zM737.792 477.184c-11.264-23.552-33.28-50.688-67.072-83.456-37.376-35.84-52.736-52.736-59.392-60.928-7.68-9.728-13.824-20.992-17.408-34.816-4.096-14.336-6.144-35.328-5.632-61.44l0.512-30.72-141.824 0 0 30.208c0 37.376 3.072 67.072 9.216 90.112 6.656 24.064 16.384 45.568 29.696 63.488 12.288 16.896 32.768 39.936 62.464 71.168 33.792 34.816 47.104 51.712 51.712 59.904 3.072 5.12 8.192 16.896 8.192 44.544 0 18.944-6.656 35.328-20.48 50.688-13.312 14.336-33.28 20.992-60.928 20.992-81.408 0-92.672-58.368-92.672-115.712l0-30.208-142.336 0 1.024 30.72c1.536 48.128 7.168 84.48 17.92 111.104 10.752 27.136 28.672 51.712 52.224 73.216 23.04 20.992 49.664 36.352 77.824 46.08 28.16 9.728 57.856 14.336 88.576 14.336 62.976 0 116.736-18.944 159.744-56.832l0 0c43.52-38.912 66.048-90.624 66.048-154.112C755.2 527.872 749.568 501.248 737.792 477.184z" horiz-adv-x="1024" /> |
262 | 265 | ||
263 | 266 | ||
@@ -339,6 +342,18 @@ t9.5 -10.5t21.5 -4h37h67h81h80h64h36q23 0 34 12t2 38q-5 13 -9.5 30.5t-9.5 34.5q- | @@ -339,6 +342,18 @@ t9.5 -10.5t21.5 -4h37h67h81h80h64h36q23 0 34 12t2 38q-5 13 -9.5 30.5t-9.5 34.5q- | ||
339 | <glyph glyph-name="sanjiao2-center-view-copy" unicode="" d="M511.999488 140.58653800000013L72.8374 755.413462 951.1626 755.413462Z" horiz-adv-x="1024" /> | 342 | <glyph glyph-name="sanjiao2-center-view-copy" unicode="" d="M511.999488 140.58653800000013L72.8374 755.413462 951.1626 755.413462Z" horiz-adv-x="1024" /> |
340 | 343 | ||
341 | 344 | ||
345 | + <glyph glyph-name="gm" unicode="" d="M192.86016 414.72a30.72 30.72 0 0 0-30.72 30.72l0.02048 23.87968C163.98336 665.37472 324.03456 824.32 520.54016 824.32h13.66016c197.61152 0 358.4-160.78848 358.4-358.4v-47.77984h-61.44V465.92c0 163.7376-133.2224 296.96-296.96 296.96h-13.66016c-163.7376 0-296.96-133.2224-296.96-296.96v-20.48a30.72 30.72 0 0 0-30.72-30.72zM541.85984-101.53984h-13.66016a30.72 30.72 0 1 0 0 61.44h13.66016c163.7376 0 296.96 103.13728 296.96 229.92896h61.44v-8.37632c0-1.59744-0.12288-3.15392-0.36864-4.68992-8.43776-154.624-165.7856-278.30272-358.03136-278.30272zM200.54016 155.29984h-13.66016A105.94304 105.94304 0 0 0 81.05984 261.12v102.4a105.94304 105.94304 0 0 0 105.82016 105.82016h13.66016A105.94304 105.94304 0 0 0 306.36032 363.52v-102.4a105.96352 105.96352 0 0 0-105.82016-105.82016z m-13.66016 252.60032A44.4416 44.4416 0 0 1 142.49984 363.52v-102.4a44.4416 44.4416 0 0 1 44.38016-44.38016h13.66016A44.4416 44.4416 0 0 1 244.92032 261.12v102.4a44.4416 44.4416 0 0 1-44.38016 44.38016h-13.66016zM869.13024 155.29984h-13.66016A105.92256 105.92256 0 0 0 749.6704 261.12v102.4a105.92256 105.92256 0 0 0 105.79968 105.82016h13.66016A105.94304 105.94304 0 0 0 974.9504 363.52v-102.4a105.96352 105.96352 0 0 0-105.82016-105.82016z m-13.66016 252.60032A44.4416 44.4416 0 0 1 811.1104 363.52v-102.4a44.4416 44.4416 0 0 1 44.35968-44.38016h13.66016A44.4416 44.4416 0 0 1 913.5104 261.12v102.4a44.4416 44.4416 0 0 1-44.38016 44.38016h-13.66016zM614.7072-60.37504l-83.57888-9.76896a20.54144 20.54144 0 0 0-22.71232 17.96096l-3.64544 31.232a20.54144 20.54144 0 0 0 17.96096 22.71232l83.57888 9.76896a20.54144 20.54144 0 0 0 22.71232-17.96096l3.64544-31.232a20.52096 20.52096 0 0 0-17.96096-22.71232zM528.73216-101.00736a51.28192 51.28192 0 0 0-50.83136 45.24032l-3.64544 31.232a50.83136 50.83136 0 0 0 10.71104 37.70368 50.95424 50.95424 0 0 0 34.22208 19.10784l83.53792 9.78944a51.34336 51.34336 0 0 0 56.81152-44.9536l3.66592-31.17056a51.28192 51.28192 0 0 0-44.87168-56.79104l-0.04096-0.02048-83.57888-9.76896a49.07008 49.07008 0 0 0-5.98016-0.36864z m85.99552 40.63232h0.2048-0.2048z m-78.27456 32.80896l1.26976-10.87488 63.24224 7.3728-1.26976 10.89536-63.24224-7.39328z" horiz-adv-x="1024" /> | ||
346 | + | ||
347 | + | ||
348 | + <glyph glyph-name="edit1" unicode="" d="M512 896a512 512 0 1 1 512-512A512 512 0 0 1 512 896z m148.992-146.176l97.024-97.024a43.264 43.264 0 0 0 1.28-61.184l-51.2-51.2-163.84 156.16 55.552 55.552a43.264 43.264 0 0 0 61.184-2.304z m-406.528-435.2l29.184 109.056a56.32 56.32 0 0 0 18.944 28.928l2.048 2.56 195.84 197.12 164.864-153.6-201.728-201.728-3.328-2.56-2.816-3.584a56.064 56.064 0 0 0-27.136-15.104l-107.264-28.672a56.32 56.32 0 0 0-69.12 69.12z m540.928-179.2a25.6 25.6 0 0 0-25.6-25.6h-512a25.6 25.6 0 0 0-25.6 25.6v10.24a25.6 25.6 0 0 0 25.6 25.6h512a25.6 25.6 0 0 0 25.6-25.6z" horiz-adv-x="1024" /> | ||
349 | + | ||
350 | + | ||
351 | + <glyph glyph-name="yoho-coin" unicode="" d="M512 153.6h-40.96a195.87072 195.87072 0 0 0-45.4656 5.34528l14.29504 59.76064a134.5536 134.5536 0 0 1 31.15008-3.66592h40.96c73.40032 0 133.12 59.71968 133.12 133.12V592.40448h61.44V348.16c0.02048-107.27424-87.26528-194.56-194.53952-194.56zM512 296.96c-107.27424 0-194.56 87.28576-194.56 194.56v101.56032h61.44v-101.56032c0-73.40032 59.71968-133.12 133.12-133.12s133.12 59.71968 133.12 133.12v103.1168h61.44v-103.1168c0-107.27424-87.28576-194.56-194.56-194.56zM512-51.2c-242.7904 0-440.32 197.5296-440.32 440.32S269.2096 829.44 512 829.44s440.32-197.5296 440.32-440.32-197.5296-440.32-440.32-440.32z m0 819.2c-208.91648 0-378.88-169.96352-378.88-378.88s169.96352-378.88 378.88-378.88 378.88 169.96352 378.88 378.88S720.91648 768 512 768z" horiz-adv-x="1024" /> | ||
352 | + | ||
353 | + | ||
354 | + <glyph glyph-name="sx" unicode="" d="M810.72128 293.49888a40.89856 40.89856 0 0 1-55.27552-17.28512 237.42464 237.42464 0 0 0-81.08032-89.04704 237.6704 237.6704 0 0 0-239.06304-11.07968 235.7248 235.7248 0 0 0-116.36736 139.34592 235.58144 235.58144 0 0 0 16.24064 180.81792 235.6224 235.6224 0 0 0 139.34592 116.34688 235.4176 235.4176 0 0 0 180.81792-16.26112l1.04448-0.59392-0.94208-0.16384a40.98048 40.98048 0 0 1 13.47584-80.81408l99.75808 16.65024a40.96 40.96 0 0 1 33.66912 47.14496l-16.62976 99.75808a40.96 40.96 0 0 1-80.81408-13.47584l0.49152-2.90816c-4.01408 2.33472-7.92576 4.8128-12.06272 6.98368a316.94848 316.94848 0 0 1-243.24096 21.87264 316.86656 316.86656 0 0 1-187.45344-156.54912C181.02272 378.368 241.43872 185.1392 397.312 103.5264a318.42304 318.42304 0 0 1 147.92704-36.31104c60.60032 0 121.05728 17.16224 173.62944 51.15904a319.13984 319.13984 0 0 1 109.1584 119.84896 40.96 40.96 0 0 1-17.3056 55.27552z" horiz-adv-x="1024" /> | ||
355 | + | ||
356 | + | ||
342 | 357 | ||
343 | 358 | ||
344 | </font> | 359 | </font> |
No preview for this file type
No preview for this file type
@@ -10,21 +10,52 @@ class NewQrcode extends Page { | @@ -10,21 +10,52 @@ class NewQrcode extends Page { | ||
10 | this.selector = { | 10 | this.selector = { |
11 | $qrcodePic: $('.qrcode-pic'), | 11 | $qrcodePic: $('.qrcode-pic'), |
12 | $autoScroll: $('.auto-scroll'), | 12 | $autoScroll: $('.auto-scroll'), |
13 | - $scrollWords: $('.scroll-words') | 13 | + $scrollWords: $('.scroll-words'), |
14 | + $reload: $('.reload') | ||
14 | }; | 15 | }; |
15 | 16 | ||
17 | + this.qrText = ''; | ||
18 | + this.auto = ''; | ||
16 | this.init(); | 19 | this.init(); |
17 | } | 20 | } |
18 | 21 | ||
19 | init() { | 22 | init() { |
20 | this.drawQrcode(); | 23 | this.drawQrcode(); |
21 | this.autoScroll(); | 24 | this.autoScroll(); |
25 | + this.bindEvents(); | ||
26 | + this.autoReload(); | ||
27 | + } | ||
28 | + | ||
29 | + bindEvents() { | ||
30 | + this.selector.$reload.on('click', this.reload.bind(this)); | ||
31 | + } | ||
32 | + | ||
33 | + autoReload() { | ||
34 | + this.auto = setInterval(() => { | ||
35 | + this.reload(); | ||
36 | + }, 110 * 1000); // 110秒自动刷新一次 | ||
37 | + } | ||
38 | + | ||
39 | + reload() { | ||
40 | + this.ajax({ | ||
41 | + url: '/home/newQrcode/reload', | ||
42 | + }).then(result => { | ||
43 | + if (result) { | ||
44 | + this.qrText = result; | ||
45 | + this.selector.$qrcodePic.find('canvas').remove(); | ||
46 | + this.drawQrcode(); | ||
47 | + clearInterval(this.auto); | ||
48 | + this.autoReload(); | ||
49 | + } | ||
50 | + }).catch(error => { | ||
51 | + console.error(error); | ||
52 | + }); | ||
22 | } | 53 | } |
23 | 54 | ||
24 | drawQrcode() { | 55 | drawQrcode() { |
25 | this.selector.$qrcodePic.qrcode({ | 56 | this.selector.$qrcodePic.qrcode({ |
26 | render: 'canvas', // 显示方式,canvas,image和div | 57 | render: 'canvas', // 显示方式,canvas,image和div |
27 | - text: this.selector.$qrcodePic.data('qr'), // 二维码的内容 | 58 | + text: this.qrText || this.selector.$qrcodePic.data('qr'), // 二维码的内容 |
28 | size: parseInt(420, 10), // 大小 | 59 | size: parseInt(420, 10), // 大小 |
29 | ecLevel: 'H', // 纠错级别 | 60 | ecLevel: 'H', // 纠错级别 |
30 | }); | 61 | }); |
@@ -34,7 +65,7 @@ class NewQrcode extends Page { | @@ -34,7 +65,7 @@ class NewQrcode extends Page { | ||
34 | let containerWidth = this.selector.$autoScroll.width(); | 65 | let containerWidth = this.selector.$autoScroll.width(); |
35 | let innerWidth = this.selector.$scrollWords.width(); | 66 | let innerWidth = this.selector.$scrollWords.width(); |
36 | 67 | ||
37 | - if (innerWidth <= containerWidth) { | 68 | + if (innerWidth <= (containerWidth + 1)) { |
38 | this.selector.$scrollWords.removeClass('go-scroll'); | 69 | this.selector.$scrollWords.removeClass('go-scroll'); |
39 | } | 70 | } |
40 | } | 71 | } |
@@ -2,7 +2,6 @@ body, | @@ -2,7 +2,6 @@ body, | ||
2 | html { | 2 | html { |
3 | background-image: linear-gradient(#131313, #3e3e3e); | 3 | background-image: linear-gradient(#131313, #3e3e3e); |
4 | background-repeat: no-repeat; | 4 | background-repeat: no-repeat; |
5 | - min-height: 100%; | ||
6 | background-color: #3e3e3e; | 5 | background-color: #3e3e3e; |
7 | } | 6 | } |
8 | 7 | ||
@@ -26,7 +25,7 @@ html { | @@ -26,7 +25,7 @@ html { | ||
26 | height: 784px; | 25 | height: 784px; |
27 | border-radius: 6px; | 26 | border-radius: 6px; |
28 | background-color: #fff; | 27 | background-color: #fff; |
29 | - margin: 213px auto; | 28 | + margin: 100px auto 213px; |
30 | padding: 50px; | 29 | padding: 50px; |
31 | 30 | ||
32 | .toper { | 31 | .toper { |
@@ -97,6 +96,10 @@ html { | @@ -97,6 +96,10 @@ html { | ||
97 | width: 30px; | 96 | width: 30px; |
98 | } | 97 | } |
99 | 98 | ||
99 | + .dot:last-child { | ||
100 | + text-align: right; | ||
101 | + } | ||
102 | + | ||
100 | .auto-scroll { | 103 | .auto-scroll { |
101 | max-width: 280px; | 104 | max-width: 280px; |
102 | height: 50px; | 105 | height: 50px; |
@@ -158,6 +161,36 @@ html { | @@ -158,6 +161,36 @@ html { | ||
158 | } | 161 | } |
159 | } | 162 | } |
160 | } | 163 | } |
164 | + | ||
165 | + .reload-c { | ||
166 | + width: 750px; | ||
167 | + height: 90px; | ||
168 | + line-height: 90px; | ||
169 | + background-color: #333; | ||
170 | + position: fixed; | ||
171 | + bottom: 0; | ||
172 | + left: 0; | ||
173 | + | ||
174 | + .reload { | ||
175 | + position: absolute; | ||
176 | + bottom: 0; | ||
177 | + left: 50%; | ||
178 | + font-size: 24px; | ||
179 | + color: #b0b0b0; | ||
180 | + width: 200px; | ||
181 | + line-height: 90px; | ||
182 | + margin-left: -100px; | ||
183 | + text-align: center; | ||
184 | + | ||
185 | + span { | ||
186 | + font-size: 40px; | ||
187 | + color: #eee; | ||
188 | + position: absolute; | ||
189 | + top: 0; | ||
190 | + left: -30px; | ||
191 | + } | ||
192 | + } | ||
193 | + } | ||
161 | } | 194 | } |
162 | 195 | ||
163 | @keyframes autoScroll { | 196 | @keyframes autoScroll { |
-
Please register or login to post a comment