Authored by 李靖

Merge branch 'feature/newQrcode' into feature/storeHome

... ... @@ -23,3 +23,13 @@ exports.index = (req, res, next) => {
res.render('new-qrcode', Object.assign(responseData, result));
}).catch(next);
};
exports.reload = (req, res, next) => {
let params = {
uid: req.user.uid
};
req.ctx(newQrcodeModel).getToken(params).then(result => {
res.json(result);
}).catch(next);
};
... ...
'use strict';
const _ = require('lodash');
const camelCase = global.yoho.camelCase;
const api = global.yoho.API;
const crypto = global.yoho.crypto;
const PASSWORD = 'yoho9646yoho9646';
class newQrcode extends global.yoho.BaseModel {
constructor(ctx) {
... ... @@ -38,20 +35,9 @@ class newQrcode extends global.yoho.BaseModel {
}
getToken(params) {
let uidNum = parseInt(params.uid, 10);
let token = uidNum ? crypto.encryption(PASSWORD, uidNum + '') : '';
let uid = '';
try {
uid = crypto.decrypt(PASSWORD, decodeURIComponent(token));
uid = parseInt(uid, 10);
} catch (e) {
uid = token;
}
return api.get('', {
method: 'app.twoDimen.getCode',
uid: uid,
uid: params.uid,
}).then(result => {
return (result && result.data && result.data.code) || '';
});
... ... @@ -66,10 +52,10 @@ class newQrcode extends global.yoho.BaseModel {
let resu = {};
if (_.get(result, '[0]data')) {
resu = camelCase(result[0].data);
resu = result[0].data;
}
if (_.get(result, '[1]data')) {
resu.trendWord = result[1].data.trendWord;
resu.trendWord = result[1].data.trendWord || result[1].data.inviteCode;
}
if (_.get(result, '[2]')) {
resu.token = result[2];
... ...
... ... @@ -179,5 +179,6 @@ router.get('/return/exchange/refreshDelivery', auth, exchange.refreshDelivery);
router.get('/tide-command', auth, tideCommand.tideCommand); // 设置潮流口令
router.get('/newQrcode', auth, newQrcode.index); // 新二维码页面
router.get('/newQrcode/reload', auth, newQrcode.reload); // 刷新二维码页面
module.exports = router;
... ...
... ... @@ -2,8 +2,8 @@
<div class="qrcode-body">
<div class="toper">
<div class="user-pic">
<div class="avatar user-avatar"{{#if headIco}} style="background-image:url({{image2 headIco mode=2 h=100 w=100 q=90}})"{{/if}}></div>
<div class="level level-{{vipInfo/curLevel}}"></div>
<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>
<div class="level level-{{vip_info/cur_level}}"></div>
</div>
<div class="user-info">
<div class="name eps">{{nickname}}</div>
... ... @@ -19,11 +19,14 @@
</div>
</div>
<div class="qrcode-pic" data-qr="{{token}}">
<div class="qrcode-avatar user-avatar"{{#if headIco}} style="background-image:url({{image2 headIco mode=2 h=100 w=100 q=90}})"{{/if}}></div>
<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>
</div>
<div class="invite hide">
<span>邀请好友扫一扫完成注册,现金券赚不停</span>
<span class="iconfont">&#xe639;</span>
</div>
</div>
<div class="reload-c">
<div class="reload"><span class="iconfont">&#xe733;</span>点击刷新二维码</div>
</div>
</div>
\ No newline at end of file
... ...
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-
<glyph glyph-name="shanchu" unicode="&#58956;" 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" />
<glyph glyph-name="facebook" unicode="&#58958;" 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" />
<glyph glyph-name="wenhao" unicode="&#59033;" 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" />
... ... @@ -339,6 +342,18 @@ t9.5 -10.5t21.5 -4h37h67h81h80h64h36q23 0 34 12t2 38q-5 13 -9.5 30.5t-9.5 34.5q-
<glyph glyph-name="sanjiao2-center-view-copy" unicode="&#59183;" d="M511.999488 140.58653800000013L72.8374 755.413462 951.1626 755.413462Z" horiz-adv-x="1024" />
<glyph glyph-name="gm" unicode="&#59184;" 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" />
<glyph glyph-name="edit1" unicode="&#59185;" 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" />
<glyph glyph-name="yoho-coin" unicode="&#59186;" 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" />
<glyph glyph-name="sx" unicode="&#59187;" 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" />
</font>
... ...
No preview for this file type
No preview for this file type
... ... @@ -10,21 +10,52 @@ class NewQrcode extends Page {
this.selector = {
$qrcodePic: $('.qrcode-pic'),
$autoScroll: $('.auto-scroll'),
$scrollWords: $('.scroll-words')
$scrollWords: $('.scroll-words'),
$reload: $('.reload')
};
this.qrText = '';
this.auto = '';
this.init();
}
init() {
this.drawQrcode();
this.autoScroll();
this.bindEvents();
this.autoReload();
}
bindEvents() {
this.selector.$reload.on('click', this.reload.bind(this));
}
autoReload() {
this.auto = setInterval(() => {
this.reload();
}, 110 * 1000); // 110秒自动刷新一次
}
reload() {
this.ajax({
url: '/home/newQrcode/reload',
}).then(result => {
if (result) {
this.qrText = result;
this.selector.$qrcodePic.find('canvas').remove();
this.drawQrcode();
clearInterval(this.auto);
this.autoReload();
}
}).catch(error => {
console.error(error);
});
}
drawQrcode() {
this.selector.$qrcodePic.qrcode({
render: 'canvas', // 显示方式,canvas,image和div
text: this.selector.$qrcodePic.data('qr'), // 二维码的内容
text: this.qrText || this.selector.$qrcodePic.data('qr'), // 二维码的内容
size: parseInt(420, 10), // 大小
ecLevel: 'H', // 纠错级别
});
... ... @@ -34,7 +65,7 @@ class NewQrcode extends Page {
let containerWidth = this.selector.$autoScroll.width();
let innerWidth = this.selector.$scrollWords.width();
if (innerWidth <= containerWidth) {
if (innerWidth <= (containerWidth + 1)) {
this.selector.$scrollWords.removeClass('go-scroll');
}
}
... ...
... ... @@ -2,7 +2,6 @@ body,
html {
background-image: linear-gradient(#131313, #3e3e3e);
background-repeat: no-repeat;
min-height: 100%;
background-color: #3e3e3e;
}
... ... @@ -26,7 +25,7 @@ html {
height: 784px;
border-radius: 6px;
background-color: #fff;
margin: 213px auto;
margin: 100px auto 213px;
padding: 50px;
.toper {
... ... @@ -97,6 +96,10 @@ html {
width: 30px;
}
.dot:last-child {
text-align: right;
}
.auto-scroll {
max-width: 280px;
height: 50px;
... ... @@ -158,6 +161,36 @@ html {
}
}
}
.reload-c {
width: 750px;
height: 90px;
line-height: 90px;
background-color: #333;
position: fixed;
bottom: 0;
left: 0;
.reload {
position: absolute;
bottom: 0;
left: 50%;
font-size: 24px;
color: #b0b0b0;
width: 200px;
line-height: 90px;
margin-left: -100px;
text-align: center;
span {
font-size: 40px;
color: #eee;
position: absolute;
top: 0;
left: -30px;
}
}
}
}
@keyframes autoScroll {
... ...