Authored by 周少峰

Merge branch 'feature/spread' into gray

/**
* 个人中心---我的推广
* @author yyq <yanqing.yang@yoho.cn>
*/
'use strict';
const spreadModel = require('../models/spread');
exports.index = (req, res, next) => {
req.ctx(spreadModel).getIndexData(req.user.uid, req.query.page).then(result => {
res.render('spread', {
page: 'spread',
spread: result
});
}).catch(next);
};
... ...
... ... @@ -31,6 +31,7 @@ const _homeNav = (switcher) => {
{name: '我的评论', href: '/home/comment'},
// {name: '我的投诉', href: '/home/complaints'},
{name: '我的推广', href: '/home/spread'},
{name: '我的信息', href: '/home/message', count: 0},
{
name: '在线客服',
... ...
/**
* 我的消息model
* @author: yyq<yanqing.yang@yoho.cn>
* @date: 2016/8/29
*/
'use strict';
const _ = require('lodash');
const setPager = require(`${global.utils}/pager`).setPager;
module.exports = class extends global.yoho.BaseModel {
constructor(ctx) {
super(ctx);
}
getIndexData(uid, page) {
return Promise.all([
this.get({data: {
method: 'app.invitecode.my',
uid: uid
}}),
this.get({data: {
method: 'app.invitecode.history',
uid: uid,
page: page || 1
}})
]).then(result => {
let resData = _.get(result, '[0].data', {});
let resList = result[1];
if (resList.code === 200) {
let list = _.get(resList, 'data.data', []);
resData.rules = _.get(resList, 'data.activityRuleDesc', '');
if (!_.isEmpty(list)) {
resData.list = list;
}
let totalPage = _.get(resList, 'data.pageSize', 1);
if (+totalPage > 1) {
resData.pager = setPager(totalPage, {page: page});
Object.assign(resData.pager, {
count: _.get(resList, 'data.total', 0),
curPage: _.get(resList, 'data.currPage', 1),
totalPages: totalPage
});
}
}
return resData;
});
}
};
... ...
... ... @@ -21,6 +21,7 @@ const commentController = require(`${cRoot}/comment`);
const consultController = require(`${cRoot}/consult`);
// const complaintsController = require(`${cRoot}/complaints`);
const spreadController = require(`${cRoot}/spread`);
const messageController = require(`${cRoot}/message`);
const returnsController = require(`${cRoot}/returns`);
... ... @@ -68,6 +69,9 @@ router.get('/consult', tabsMiddleware.getCommonHeader, consultController.index);
// router.post('/complaints/submit', complaintsController.submit);
// router.post('/complaints/cancel', complaintsController.cancel);
// 我的推广
router.get('/spread', tabsMiddleware.getCommonHeader, spreadController.index);
// 我的消息
router.get('/message', tabsMiddleware.getCommonHeader, messageController.index);
... ...
<div class="spread-me-page me-page yoho-page clearfix">
{{> path}}
{{> navigation}}
<div class="me-main">
<div class="spread block">
<h2 class="title"></h2>
{{# spread}}
<div class="spread-wrap clearfix">
<div class="item-card">
<span class="tag">方法一:扫描邀请二维码</span>
<div class="card-main">
<div class="spread-code" data-url="{{url}}"></div>
</div>
<p>{{{activityDescribe}}}</p>
</div>
<div class="item-card">
<span class="tag">方法二:使用邀请码</span>
<div class="card-main">
<p class="spread-id">{{inviteCode}}</p>
</div>
<p>1.复制您的邀请码<br>2.粘贴给您的朋友</p>
</div>
<div class="item-card">
<span class="tag">方法二:使用邀请链接</span>
<div class="card-main">
<div class="spread-url">
<input type="text" value="{{url}}" class
="copy-url" readonly="readonly">
<div class="succ-tip">复制成功</div>
</div>
</div>
<p>1.复制您的邀请链接<br>2.选择您的社交平台<br>3.粘贴给您的朋友</p>
</div>
</div>
<div class="spread-wrap clearfix spread-rules">
<h2>活动细则</h2>
<p>{{{rules}}}</p>
</div>
<div class="my-spread-list">
<table>
<thead>
<tr>
<th>我邀请的好友</th>
<th>注册时间</th>
<th>首单购物金额</th>
<th>我的奖励</th>
<th>奖励状态</th>
<th>发放时间</th>
</tr>
</thead>
<tbody>
{{# list}}
<tr>
<td>{{nickName}}</td>
<td>{{registerTimeDis}}</td>
<td>{{orderAmountDis}}</td>
<td>{{couponName}}</td>
<td class="coupon-status">{{couponStatusDesc}}
{{#if paymentStatusDesc}}
<i class="help-icon"></i>
<div class="coin-tip-help">
<p>{{paymentStatusDesc}}</p>
</div>
{{/if}}
</td>
<td>{{couponSendTimeDis}}</td>
</tr>
{{/ list}}
{{#unless list}}
<tr><td colspan="7">暂无数据</td></tr>
{{/unless}}
</tbody>
</table>
</div>
{{> pager}}
{{/ spread}}
</div>
</div>
</div>
... ...
... ... @@ -272,7 +272,7 @@ let mobileRegister = (req, res, next) => {
}
/* 手机注册: 调用注册接口*/
let regResult = yield regService.regMobileAes(area, mobile, password, code, cookie.getShoppingKey(req));
let regResult = yield regService.regMobileAes(area, mobile, password, code, cookie.getShoppingKey(req), req.body); // eslint-disable-line
if (!regResult.code || regResult.code !== 200) {
data.message = '注册失败';
... ...
... ... @@ -6,6 +6,8 @@
* 注册 model
*/
'use strict';
const _ = require('lodash');
const aes = require('./aes-pwd');
const api = global.yoho.API;
... ... @@ -30,7 +32,7 @@ let validMobileCode = (area, mobile, code) => {
return api.post('', params);
};
let regMobileAes = (area, mobile, password, code, shoppingKey)=> {
let regMobileAes = (area, mobile, password, code, shoppingKey, extParam)=> {
let params = {
method: 'app.passport.registerAES',
area: area,
... ... @@ -43,6 +45,12 @@ let regMobileAes = (area, mobile, password, code, shoppingKey)=> {
params.shopping_key = shoppingKey;
}
if (extParam) {
if (extParam.inviteCode) {
params.inviteCode = _.replace(extParam.inviteCode, /[^(0-9a-zA-Z)]/ig, '');
}
}
return api.post('', params);
};
... ...
... ... @@ -37,6 +37,10 @@
</div>
</li>
<li class="clearfix" data-index="3">
<input id="invite-code" class="input invite-code" name="inviteCode" placeholder="邀请码" autocomplete="off" maxlength="20" type="text">
</li>
<li class="items-container clearfix">
<input id="agree-terms" class="agree-terms" type="checkbox" checked="">
<span>
... ...
... ... @@ -17,20 +17,20 @@ module.exports = {
cookieDomain: '.yohobuy.com',
domains: {
// test3
// singleApi: 'http://api-test3.yohops.com:9999/',
// api: 'http://api-test3.yohops.com:9999/',
// service: 'http://service-test3.yohops.com:9999/',
// serviceNotify: 'http://service-test3.yohops.com:9999/',
// global: 'http://global-test-soa.yohops.com:9999/',
// platformApi: 'http://192.168.102.48:8088/',
singleApi: 'http://api-test3.yohops.com:9999/',
api: 'http://api-test3.yohops.com:9999/',
service: 'http://service-test3.yohops.com:9999/',
serviceNotify: 'http://service-test3.yohops.com:9999/',
global: 'http://global-test-soa.yohops.com:9999/',
platformApi: 'http://192.168.102.48:8088/',
// prod
singleApi: 'http://single.yoho.cn/',
api: 'http://api.yoho.cn/',
service: 'http://service.yoho.cn/',
serviceNotify: 'http://service.yoho.cn/',
global: 'http://api-global.yohobuy.com/',
platformApi: 'http://172.16.6.210:8088/',
// singleApi: 'http://single.yoho.cn/',
// api: 'http://api.yoho.cn/',
// service: 'http://service.yoho.cn/',
// serviceNotify: 'http://service.yoho.cn/',
// global: 'http://api-global.yohobuy.com/',
// platformApi: 'http://172.16.6.210:8088/',
// gray
// singleApi: 'http://single.gray.yohops.com/',
... ...
... ... @@ -25,6 +25,7 @@
"body-parser": "^1.15.0",
"cheerio": "^0.22.0",
"client-sessions": "^0.7.0",
"clipboard": "^1.7.1",
"compression": "^1.6.2",
"connect-memcached": "^0.2.0",
"connect-multiparty": "^2.0.0",
... ...

5.55 KB | W: | H:

5.85 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
/**
* 我的推广
* @author: yyq<yanqing.yang@yoho.cn>
* @date: 2017/6/22
*/
var $ = require('yoho-jquery');
var Clipboard = require('clipboard');
var $copySuccTip = $('.succ-tip'),
$qrcodeImg = $('.spread-code');
var clipboard;
require('../common');
require('yoho-jquery-qrcode');
// 生成二维码
$qrcodeImg.qrcode({
render: 'div', // 显示方式,canvas,image和div
text: $qrcodeImg.data('url'), // 二维码的内容
size: parseInt($qrcodeImg.width(), 10) // 大小
});
clipboard = new Clipboard('.copy-url', {
text: function(trigger) {
return trigger.value;
}
});
clipboard.on('success', function() {
$copySuccTip.show();
setTimeout(function() {
$copySuccTip.fadeOut();
}, 2000);
});
... ...
... ... @@ -21,6 +21,7 @@ var $sendCaptcha = $('#send-captcha'),
var $pn = $('#phone-num'),
$mc = $('#msg-captcha'),
$pwd = $('#pwd'),
$ic = $('#invite-code'),
getCaptchaImageVal = function() {
return captchaImage.getResults();
},
... ... @@ -621,7 +622,8 @@ exports.init = function(page) {
mobile: $pn.val(),
verifyCode: getCaptchaImageVal(),
code: $mc.val(),
password: $pwd.val()
password: $pwd.val(),
inviteCode: $ic.val()
}
}).then(function(data) {
... ...
... ... @@ -321,6 +321,7 @@
@import "comment";
@import "consult";
@import "complaints";
@import "spread";
@import "message";
@import "message-detail";
@import "returns";
... ...
.spread-me-page {
font-size: 12px;
.spread > .title {
background-image: resolve(home/my-spread.jpg);
}
.spread-wrap {
padding: 10px;
.item-card {
width: 252px;
float: left;
height: 180px;
box-sizing: border-box;
border: 1px solid #dedede;
position: relative;
margin-left: 11px;
> p {
text-align: center;
line-height: 1.4;
}
}
.item-card:first-child {
margin-left: 0;
}
.tag {
width: 100%;
height: 25px;
line-height: 25px;
background-color: #000;
color: #fff;
text-align: center;
position: absolute;
font-weight: 300;
}
.card-main {
height: 80px;
line-height: 80px;
padding-top: 30px;
text-align: center;
> * {
display: inline-block;
}
}
.spread-code {
width: 70px;
height: 70px;
}
.spread-id {
font-size: 38px;
}
.spread-url {
width: 94%;
height: 34px;
line-height: 32px;
border: 1px solid #dedede;
background-color: #f5f5f5;
position: relative;
cursor: pointer;
> input {
width: 100%;
height: 100%;
border: 0;
padding: 0 10px;
box-sizing: border-box;
background: none;
}
.succ-tip {
position: absolute;
width: 100%;
height: 32px;
color: #89c54d;
overflow: hidden;
background-color: #f5f5f5;
top: 1px;
display: none;
}
}
}
.my-spread-list {
padding: 10px;
margin-bottom: 10px;
table {
width: 100%;
}
tr {
border: 1px solid #dedede;
}
th {
background-color: #efefef;
line-height: 30px;
text-align: center;
}
td {
line-height: 20px;
padding: 14px 0;
text-align: center;
}
.coupon-status {
position: relative;
}
.help-icon {
display: block;
width: 16px;
height: 16px;
background: url(/cart/help-mark.png);
position: absolute;
right: 3%;
top: 50%;
margin-top: -8px;
cursor: pointer;
&:hover + .coin-tip-help {
display: block;
}
}
.coin-tip-help {
width: 304px;
padding: 6px 10px;
line-height: 2;
border: 1px solid #000;
background-color: #fff;
text-align: left;
position: absolute;
top: 38px;
right: -8px;
display: none;
z-index: 1000;
}
.coin-tip-help:before {
content: "";
width: 12px;
height: 6px;
background-image: url(../img/sprite.cart.png);
background-position: -325px -76px;
display: block;
position: absolute;
top: -6px;
right: 10px;
}
}
.spread-rules {
border: 1px solid #dedede;
padding: 10px 20px;
width: 736px;
margin: 0 auto;
h2 {
font-size: 14px;
font-weight: 600;
}
p {
line-height: 18px;
}
}
}
... ...