Authored by 张孝茹

刷新二维码

... ... @@ -150,3 +150,12 @@ exports.inviteUserInfo = (req, res, next) => {
res.json(result);
}).catch(next);
};
// 刷新二维码
exports.reloadQrcode = (req, res, next) => {
let uid = req.user.uid;
req.ctx(expandModel).reloadQrcode(uid).then(result => {
res.json(result);
}).catch(next);
};
... ...
... ... @@ -194,4 +194,21 @@ module.exports = class extends global.yoho.BaseModel {
return friendInviteData;
});
}
reloadQrcode(uid) {
return api.get('', {
method: 'app.invitecode.my',
uid: uid
}, {
code: 200
}).then((result) => {
if (result && result.code === 200 && result.data) {
return result.data;
} else {
return {};
}
});
}
};
... ...
... ... @@ -281,6 +281,7 @@ router.get('/friend-invite', expand.friendInvite); // 拓展新客 好友邀请
router.get('/invite-reg', expand.inviteReg); // 注册成功页
router.get('/set-trend-world', expand.setTrendWord); // 设置潮流口令
router.get('/invite-uesr-info', expand.inviteUserInfo); // 根据邀请码获取个人信息
router.get('/reload-qrcode', expand.reloadQrcode); // 根据邀请码获取个人信息
router.get('/free-mail/index', auth, freeMail.freeMailIndex); // 免邮券主页
router.get('/free-mail/list', auth, freeMail.freeMailList); // 免邮券列表页
... ...
... ... @@ -7,6 +7,7 @@
</div>
<div class="title">方法一:扫描二维码</div>
<div class="code-outer">
<div class="qrcode-avatar"{{#if headIcon}} style="background-image:url({{image2 headIcon mode=2 h=100 w=100 q=90}})"{{/if}}></div>
<div class="code-qr" qr-data="{{qrcodeUrl}}"></div>
</div>
<div class="reload-c">
... ...
... ... @@ -18,7 +18,7 @@ require('common/share')(shareData);
require('common/set-trend-world');
// 生成二维码
setTimeout(function() {
function generateCode() {
let text = $('.code-qr').attr('qr-data'),
width = $('.code-qr').css('width');
... ... @@ -29,7 +29,7 @@ setTimeout(function() {
ecLevel: 'L', // 纠错级别
background: '#fff'
});
}, 0);
}
// 分享弹框
$('.share').click(function() {
... ... @@ -55,6 +55,19 @@ $('.modify').click(function() {
$('.set-trend-world').show();
});
$('.reload-c').click(function() {
$.ajax({
type: 'get',
url: '//m.yohobuy.com/activity/reload-qrcode',
}).then(function(data) {
$('.code-qr').attr('qr-data', data.qrcodeUrl);
$('.code-qr').find('img').remove();
generateCode();
});
});
(function() {
if (!$('.set-trend-world').hasClass('trend-world')) {
if (!window.cookie('promotion-trend-pop') || parseInt(window.cookie('promotion-trend-pop'), 10) !== 1) {
... ... @@ -65,4 +78,6 @@ $('.modify').click(function() {
}, 1000);
}
}
generateCode();
}());
... ...
... ... @@ -51,6 +51,21 @@
height: 180px;
}
.qrcode-avatar {
width: 58px;
height: 58px;
position: absolute;
top: 50%;
left: 50%;
margin-top: 44px;
margin-left: -20px;
background-position: center center;
background-size: contain;
border-radius: 50%;
overflow: hidden;
border: solid 2px #fff;
}
.title {
color: #fff;
}
... ...