Authored by 郭成尧

'mergemaster'

  1 +/**
  2 + * 邀请好友赢福利
  3 + * <xiaoxiao.hao@yoho.cn>
  4 + * 2016/07/13
  5 + */
  6 +'use strict';
  7 +const inviteModel = require('../models/invite');
  8 +const inviteTitle = '有货 邀请好友赢福利';
  9 +const _ = require('lodash');
  10 +const md5 = require('md5');
  11 +const secretKey = '5466ee572bcbc75830d044e66ab429bc';// 秘钥
  12 +
  13 +// 简介、好友领取列表页面
  14 +exports.index = (req, res, next) => {
  15 + let actId = req.query.act_id * 1 || 0;
  16 + let uid = req.query.uid || 0;
  17 + let renderPage = 'invite/list';
  18 +
  19 + inviteModel.index({
  20 + uid: uid,
  21 + activityId: actId
  22 + }).then((result) => {
  23 +
  24 + // 非法参数跳到首页
  25 + if (result.isGo) {
  26 + res.redirect('/');
  27 + return false;
  28 + }
  29 +
  30 + if (result.isNil) {
  31 + renderPage = 'invite/intro';
  32 + }
  33 +
  34 + res.render(renderPage, {
  35 + module: 'activity',
  36 + page: 'invite',
  37 + result: result,
  38 + title: inviteTitle
  39 + });
  40 + }).catch(next);
  41 +};
  42 +
  43 +// 微信好友获取红包方法(即分享出去的地址)页面
  44 +exports.share = (req, res, next) => {
  45 + let shareUid = req.params[0];
  46 + let actId = req.params[1];
  47 + let nums = req.params[2];
  48 + let shareUrl = inviteModel.createShareUrl(shareUid, actId, nums);
  49 + let callback = 'http://m.yohobuy.com/activity/invite/getwxinfo?url=' + shareUrl;
  50 + let url = inviteModel.getWxOauthUrl(callback);
  51 + let wxUserInfo = req.cookies.wxUserInfo || {};
  52 +
  53 + if (_.isEmpty(wxUserInfo) || _.isEmpty(wxUserInfo.unionid)) {
  54 + res.redirect(url);
  55 + return false;
  56 + }
  57 +
  58 + inviteModel.shareModel({
  59 + uid: shareUid,
  60 + activityId: actId,
  61 + nums: nums,
  62 + openId: wxUserInfo.unionid,
  63 + nickName: wxUserInfo.nickname,
  64 + headImgUrl: wxUserInfo.headimgurl
  65 + }).then(result => {
  66 +
  67 + if (result.code * 1 !== 200) {
  68 + res.redirect('/');
  69 + return false;
  70 + }
  71 +
  72 + if (_.isEmpty(result.data.list)) {
  73 + res.render('invite/myshare', {
  74 + module: 'activity',
  75 + page: 'invite',
  76 + result: {
  77 + shareUid: shareUid,
  78 + nums: nums,
  79 + actId: actId,
  80 + openId: wxUserInfo.unionid
  81 + },
  82 + title: inviteTitle
  83 + });
  84 + } else {
  85 + // 是自己分享的连接
  86 + res.render('invite/list', {
  87 + module: 'activity',
  88 + page: 'invite',
  89 + result: result.data.list,
  90 + title: inviteTitle
  91 + });
  92 + }
  93 +
  94 +
  95 + }).catch(next);
  96 +};
  97 +
  98 +// 发送短信验证码API
  99 +exports.sendRegCodeToMobile = (req, res, next) => {
  100 + let mobile = req.query.mobile || '';
  101 +
  102 + inviteModel.sendRegCodeToMobile({
  103 + area: 86,
  104 + mobile: mobile
  105 + }).then((result) => {
  106 + res.json(result);
  107 + }).catch(next);
  108 +};
  109 +
  110 +// 发送已注册用户参与活动的优惠券API
  111 +exports.checkOldUserCoupon = (req, res, next) => {
  112 + let mobile = req.query.mobile || '';
  113 + let actId = req.query.actId || '';
  114 +
  115 + inviteModel.checkOldUserCoupon({
  116 + mobile: mobile,
  117 + activityId: actId
  118 + }).then((result) => {
  119 + res.json(result);
  120 + }).catch(next);
  121 +};
  122 +
  123 +// 验证手机验证码是否正确API
  124 +exports.validRegCode = (req, res, next) => {
  125 + let mobile = req.query.mobile || '';
  126 + let code = req.query.code || '';
  127 +
  128 + inviteModel.validRegCode({
  129 + area: 86,
  130 + mobile: mobile,
  131 + code: code
  132 + }).then((result) => {
  133 + res.json(result);
  134 + }).catch(next);
  135 +};
  136 +
  137 +// 手机注册账号API
  138 +exports.register = (req, res, next) => {
  139 + let mobile = req.query.mobile || '';
  140 + let activityName = req.query.activityName || 'invite';
  141 +
  142 + inviteModel.register({
  143 + mobile: mobile,
  144 + activityName: activityName
  145 + }).then((result) => {
  146 + res.json(result);
  147 + }).catch(next);
  148 +};
  149 +
  150 +// 领福利-领取优惠券API
  151 +exports.receiveCoupons = (req, res, next) => {
  152 + let uid = req.query.uid;
  153 + let actId = req.query.actId;
  154 + let nums = req.query.nums;
  155 + let shareUid = req.query.shareUid;
  156 + let openId = req.query.openId;
  157 +
  158 + inviteModel.receiveCoupons({
  159 + uid: uid,
  160 + activityId: actId,
  161 + nums: nums,
  162 + shareUid: shareUid,
  163 + openId: openId
  164 + }).then((result) => {
  165 + if (result.code === 200) {
  166 + result.data.goUrl = result.data.goUrl +
  167 + '?amount=' + result.data.couponAmount +
  168 + '&sign=' + md5(result.data.couponAmount + secretKey);
  169 + }
  170 + res.json(result);
  171 + }).catch(next);
  172 +};
  173 +
  174 +// 好友领取优惠券成功页面
  175 +exports.myCoupons = (req, res, next) => {
  176 + let shareUid = req.params[0];
  177 + let amount = req.params[1];
  178 + let actId = req.params[2];
  179 + let nums = req.params[3];
  180 + let sign = req.query.sign;
  181 + let uid = req.cookies.inviteUid || '';
  182 +
  183 + // 这个只是过滤一下非法的参数
  184 + if (md5(amount + secretKey) !== sign || _.isEmpty(uid)) {
  185 + res.redirect('/');
  186 + return false;
  187 + }
  188 +
  189 + inviteModel.myCoupons({
  190 + uid: uid,
  191 + shareUid: shareUid,
  192 + nums: nums,
  193 + amount: amount,
  194 + activityId: actId
  195 + }).then((result) => {
  196 + // 非法参数跳到首页
  197 + if (result[0].isGo || result[0].isEmpty) {
  198 + res.redirect('/');
  199 + return false;
  200 + }
  201 +
  202 + res.render('invite/mycoupons', {
  203 + module: 'activity',
  204 + page: 'invite',
  205 + result: result[0],
  206 + userInfo: result[1],
  207 + amount: amount,
  208 + title: inviteTitle
  209 + });
  210 + }).catch(next);
  211 +};
  212 +
  213 +// 好友领取完页面
  214 +exports.shareover = (req, res) => {
  215 + let amount = req.query.amount * 1 || 5;
  216 + let sign = req.query.sign;
  217 +
  218 + if (md5(amount + secretKey) !== sign) {
  219 + res.redirect('/');
  220 + return false;
  221 + }
  222 +
  223 + res.render('invite/shareover', {
  224 + module: 'activity',
  225 + page: 'invite',
  226 + result: {
  227 + amount: amount
  228 + },
  229 + title: inviteTitle
  230 + });
  231 +};
  232 +
  233 +// 接收微信返回后的信息
  234 +exports.getwxinfo = (req, res, next) => {
  235 + let url = req.query.url;
  236 + let code = req.query.code;
  237 +
  238 + inviteModel.getWxUserInfo({
  239 + code: code
  240 + }).then((result) => {
  241 + if (result === false) {
  242 + res.redirect('/');
  243 + } else {
  244 + res.cookie('wxUserInfo', result, {
  245 + domain: 'yohobuy.com'
  246 + });
  247 + res.redirect(url);
  248 + }
  249 + }).catch(next);
  250 +};
  251 +
  252 +// 活动结束页面
  253 +exports.over = (req, res) => {
  254 + res.render('invite/over', {
  255 + module: 'activity',
  256 + page: 'invite',
  257 + result: [],
  258 + title: inviteTitle
  259 + });
  260 +};
  261 +
  262 +
  263 +
  1 +'use strict';
  2 +const api = global.yoho.API;
  3 +const camelCase = global.yoho.camelCase;
  4 +const _ = require('lodash');
  5 +
  6 +/* 微信相关 */
  7 +const wxCode = {
  8 + wxAppId: 'wx75e5a7c0c88e45c2',
  9 + wxAppSecret: 'ce21ae4a3f93852279175a167e54509b'
  10 +};
  11 +
  12 +/**
  13 + * 获取微信授权地址
  14 + * @param callback
  15 + * @returns {string}
  16 + */
  17 +const getWxOauthUrl = (callback) => {
  18 + return 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' +
  19 + wxCode.wxAppId + '&redirect_uri=' + callback +
  20 + '&response_type=code&scope=snsapi_userinfo#wechat_redirect';
  21 +};
  22 +
  23 +/**
  24 + * 生成分享url
  25 + * @param shareUid
  26 + * @param actId
  27 + * @param nums
  28 + * @returns {string}
  29 + */
  30 +const createShareUrl = (shareUid, actId, nums) => {
  31 + return 'http://m.yohobuy.com/activity/invite/share_' + shareUid + '_' + actId + '_' + nums + '.html';
  32 +};
  33 +
  34 +/**
  35 + * 根据第三方id,查询绑定信息
  36 + * @param {[string || array]} openIds 第三方id数组
  37 + * @return {[array]}
  38 + */
  39 +const getBindLogByOpenId = (openIds) => {
  40 + openIds = _.isArray(openIds) ? openIds : [openIds];
  41 + return api.get('', {
  42 + method: 'wap.invite.getBindLogByOpenId',
  43 + openIds: openIds.join(',')
  44 + });
  45 +};
  46 +
  47 +/**
  48 + * 合并第三方头像和昵称
  49 + * @param {[array]} data 邀请的用户列表,最主要的是openId字段
  50 + * @return {[array]}
  51 + */
  52 +const mergeBindLogDate = (data) => {
  53 + let openIds = [];
  54 + let photo = '//static.yohobuy.com/m/v1/activity/newyear/images/108.png';
  55 +
  56 + // 取5条
  57 + data = _.slice(data, 0, 5);
  58 +
  59 + _.forEach(data, (req) => {
  60 + openIds.push(req.openId);
  61 + });
  62 +
  63 + return getBindLogByOpenId(openIds).then(result => {
  64 + if (!_.isEmpty(result.data)) {
  65 + _.forEach(data, (req, key) => {
  66 + data[key].img = photo;
  67 + _.forEach(result.data, (bind) => {
  68 + if (req.openId === bind.openId) {
  69 + data[key].img = _.isEmpty(bind.snsHeadimg) ?
  70 + photo : bind.snsHeadimg;
  71 + data[key].nick = bind.snsNick;
  72 + }
  73 + });
  74 + });
  75 + }
  76 + return data;
  77 + });
  78 +};
  79 +
  80 +/**
  81 + * 获取分享页面列表数据
  82 + * @param {[int]} uid 用户id
  83 + * @param {[int]} activityId 活动id
  84 + * @return {[array]}
  85 + */
  86 +const index = (params) => {
  87 + params = params || {};
  88 +
  89 + return api.get('', Object.assign({
  90 + method: 'wap.invite.index'
  91 + }, params
  92 + )).then((result) => {
  93 + let firstData = {
  94 + isNil: false,
  95 + isEmpty: false,
  96 + isFive: false,
  97 + isGo: false,
  98 + remainData: ['', '', '', '', ''],
  99 + data: []
  100 + };
  101 +
  102 + switch (result.code) {
  103 + case 401:
  104 + // 没有分享记录
  105 + firstData.isNil = true;
  106 + break;
  107 + case 200:
  108 + return mergeBindLogDate(result.data).then(data => {
  109 + let len = data.length;
  110 +
  111 + // 判断是否否5条分享
  112 + result.data = data;
  113 +
  114 + if (len === 0) {
  115 + firstData.isEmpty = true;
  116 + } else if (len < 5) {
  117 + firstData.remainData =
  118 + _.slice(firstData.remainData, 0, 5 - len);
  119 + } else {
  120 + firstData.isFive = true;
  121 + firstData.remainData = [];
  122 + }
  123 +
  124 + return Object.assign(firstData, camelCase(result));
  125 + });
  126 + default:
  127 + // 活动状态不正确
  128 + firstData.isGo = true;
  129 + break;
  130 + }
  131 +
  132 + return Object.assign(firstData, camelCase(result));
  133 + });
  134 +};
  135 +
  136 +/**
  137 + * 通过手机号发送验证码
  138 + * @param {[int]} area 区域,中国:86
  139 + * @param {[string]} mobile 手机号
  140 + * @return {[array]}
  141 + */
  142 +const sendRegCodeToMobile = (params) => {
  143 + return api.get('', Object.assign({
  144 + method: 'app.register.sendRegCodeToMobile'
  145 + }, params));
  146 +};
  147 +
  148 +/**
  149 + * 发送已注册用户参与活动的优惠券
  150 + * @param {[string]} mobile 手机号
  151 + * @param {[int]} activityId 活动id
  152 + * @return {[array]}
  153 + */
  154 +const checkOldUserCoupon = (params) => {
  155 + return api.get('', Object.assign({
  156 + method: 'wap.invite.checkOldUserCoupon'
  157 + }, params));
  158 +};
  159 +
  160 +/**
  161 + * 验证手机验证码是否正确
  162 + * @param {[int]} area 区域,中国:86
  163 + * @param {[string]} mobile 手机号
  164 + * @param {[int]} code 验证码
  165 + * @return {[array]}
  166 + */
  167 +const validRegCode = (params) => {
  168 + return api.get('', Object.assign({
  169 + method: 'app.register.validRegCode'
  170 + }, params));
  171 +};
  172 +
  173 +/**
  174 + * 手机账号注册
  175 + * @param {[string]} mobile 手机号
  176 + * @param {[string]} activityName 活动名称
  177 + * @return {[array]}
  178 + */
  179 +const register = (params) => {
  180 + return api.get('', Object.assign({
  181 + method: 'wap.invite.register'
  182 + }, params));
  183 +};
  184 +
  185 +/**
  186 + * 微信好友获取红包方法(即分享出去的地址)
  187 + * @param {[int]} uid 分享用户id
  188 + * @param {[int]} activityId 活动id
  189 + * @param {[int]} nums 发送优惠券的数量
  190 + * @param {[String]} openId 微信的union_id
  191 + * @param {[String]} nickName 微信昵称
  192 + * @param {[String]} headImgUrl 微信头像
  193 + * @returns {[array]}
  194 + */
  195 +const shareModel = (params) => {
  196 + let firstData = {
  197 + isEmpty: false,
  198 + isFive: false,
  199 + isGo: false,
  200 + remainData: ['', '', '', '', ''],
  201 + data: []
  202 + };
  203 + let listData = [];
  204 +
  205 + // 这里面的逻辑就是获取第三方用户的头像和昵称,然后插入数据和更新数据
  206 + return api.get('', Object.assign({
  207 + method: 'wap.invite.share'
  208 + }, params))
  209 + .then((result) => {
  210 + // list为空,说明不是分享者本人
  211 + if (result.code !== 200 || _.isEmpty(result.data.list)) {
  212 + return result;
  213 + }
  214 +
  215 + return mergeBindLogDate(result.data.list).then(data => {
  216 + let len = data.length;
  217 +
  218 + // 判断是否满5条分享
  219 + listData = data;
  220 +
  221 + if (len === 0) {
  222 + firstData.isEmpty = true;
  223 + } else if (len < 5) {
  224 + firstData.remainData =
  225 + _.slice(firstData.remainData, 0, 5 - len);
  226 + } else {
  227 + firstData.isFive = true;
  228 + firstData.remainData = [];
  229 + }
  230 +
  231 + firstData.data = listData;
  232 + result.data.list = firstData;
  233 +
  234 + // 释放内存
  235 + listData = [];
  236 + return camelCase(result);
  237 + });
  238 + });
  239 +};
  240 +
  241 +/**
  242 + * 邀请好友赢福利之后领取优惠券
  243 + * @param {[int]} uid 用户id
  244 + * @param {[int]} activityId 活动id
  245 + * @param {[int]} nums 发送优惠券的数量
  246 + * @param {[int]} shareUid 分享者的uid
  247 + * @param {[string]} openId 微信的union_id
  248 + * @returns {[array]}
  249 + */
  250 +const receiveCoupons = (params) => {
  251 + return api.get('', Object.assign({
  252 + method: 'wap.invite.receiveCoupons'
  253 + }, params));
  254 +};
  255 +
  256 +/**
  257 + * 获取分享列表和用户信息
  258 + * @param {[int]} uid 用户id
  259 + * @param {[int]} shareUid 分享着uid
  260 + * @param {[int]} nums 发送优惠券的数量
  261 + * @param {[int]} amount 金额
  262 + * @param {[int]} activityId 活动id
  263 + * @return {[array]}
  264 + */
  265 +const myCoupons = (params) => {
  266 + let mobile;
  267 + let firstData = {
  268 + isEmpty: false,
  269 + isFive: false,
  270 + isGo: false,
  271 + remainData: ['', '', '', '', ''],
  272 + data: []
  273 + };
  274 + let listData = [];
  275 +
  276 + return api.get('', Object.assign({
  277 + method: 'wap.invite.myCoupons'
  278 + }, params)).then((result) => {
  279 +
  280 + if (result.code !== 200) {
  281 + return result;
  282 + }
  283 +
  284 + return mergeBindLogDate(result.data.list).then(data => {
  285 + listData = data;
  286 +
  287 + if (listData.length < 5) {
  288 + firstData.remainData =
  289 + _.slice(firstData.remainData, 0, 5 - listData.length);
  290 + } else {
  291 + firstData.isFive = true;
  292 + firstData.remainData = [];
  293 + }
  294 +
  295 + firstData.data = listData;
  296 + result.data.list = firstData;
  297 +
  298 + mobile = result.data.myProfile.mobile;
  299 + result.data.myProfile.encMobile = mobile.replace(mobile.substring(3, 7), '****');
  300 +
  301 + // 释放内存
  302 + listData = [];
  303 + return camelCase([result.data.list, result.data.myProfile]);
  304 + });
  305 + });
  306 +};
  307 +
  308 +/**
  309 + * 授权后获取微信用户信息
  310 + * @return {[array]}
  311 + */
  312 +const getWxUserInfo = (params) => {
  313 + let url1 = 'https://api.weixin.qq.com/sns/oauth2/access_token?appid=' +
  314 + wxCode.wxAppId + '&secret=' + wxCode.wxAppSecret + '&code=' +
  315 + params.code + '&grant_type=authorization_code';
  316 + let url2 = 'https://api.weixin.qq.com/sns/userinfo?lang=zh_CN';
  317 +
  318 + return api._requestFromAPI({
  319 + url: url1,
  320 + qs: {},
  321 + json: true,
  322 + gzip: true,
  323 + timeout: 3000
  324 + })
  325 + .then((result) => {
  326 + if (_.isEmpty(result.openid)) {
  327 + return false;
  328 + }
  329 + url2 = url2 + '&access_token=' + result.access_token +
  330 + '&openid=' + result.openid;
  331 + return api._requestFromAPI({
  332 + url: url2,
  333 + qs: {},
  334 + json: true,
  335 + gzip: true,
  336 + timeout: 3000
  337 + })
  338 + .then((result2) => {
  339 + return result2;
  340 + });
  341 + });
  342 +};
  343 +
  344 +module.exports = {
  345 + index,
  346 + shareModel,
  347 + getBindLogByOpenId,
  348 + sendRegCodeToMobile,
  349 + checkOldUserCoupon,
  350 + validRegCode,
  351 + register,
  352 + receiveCoupons,
  353 + myCoupons,
  354 + createShareUrl,
  355 + getWxOauthUrl,
  356 + getWxUserInfo
  357 +};
@@ -11,6 +11,7 @@ const cRoot = './controllers'; @@ -11,6 +11,7 @@ const cRoot = './controllers';
11 11
12 const coupon = require(`${cRoot}/coupon`); 12 const coupon = require(`${cRoot}/coupon`);
13 const wechat = require(`${cRoot}/wechat`); 13 const wechat = require(`${cRoot}/wechat`);
  14 +const invite = require(`${cRoot}/invite`);
14 15
15 // routers 16 // routers
16 17
@@ -22,4 +23,18 @@ router.get('/coupon/verify', coupon.verify); @@ -22,4 +23,18 @@ router.get('/coupon/verify', coupon.verify);
22 23
23 router.get('/wechat/share', wechat.wechatShare); 24 router.get('/wechat/share', wechat.wechatShare);
24 25
  26 +router.get('/invite', invite.index);
  27 +router.get('/invite/index', invite.index);
  28 +
  29 +router.get(/\/invite\/share_([\d]+)_([\d]+)_([\d]+).html/, invite.share);
  30 +router.get('/invite/sendRegCodeToMobile', invite.sendRegCodeToMobile);
  31 +router.get('/invite/checkOldUserCoupon', invite.checkOldUserCoupon);
  32 +router.get('/invite/validRegCode', invite.validRegCode);
  33 +router.get('/invite/register', invite.register);
  34 +router.get('/invite/receiveCoupons', invite.receiveCoupons);
  35 +router.get(/\/invite\/mycoupons_([\d]+)_([\d]+)_([\d]+)_([\d]+).html/, invite.myCoupons); // 好友领取完优惠券的页面
  36 +router.get('/invite/getwxinfo', invite.getwxinfo);
  37 +router.get('/invite/shareover', invite.shareover);
  38 +router.get('/invite/over', invite.over);
  39 +
25 module.exports = router; 40 module.exports = router;
  1 +<div class="invite-page invite-page-bg">
  2 + <div class="invite-content-list">
  3 + <div>
  4 + <img src="//cdn.yoho.cn/m-yohobuy-node/assets/img/activity/invite/title_new.png" />
  5 + <br />
  6 + <p class="fz14">只需1位小伙伴领取,<br/>即得<strong class="fz17">10元现金券</strong><br/>全部领完,可继续发,上不封顶!<br/>奔跑吧,潮人们!</p>
  7 +
  8 + <a href="javascript:void(0)" class="weal-btn fz16" id="send_gift">立刻发福利</a>
  9 + <h2 class="rule-tit fz15">活动细则</h2>
  10 + <ol class="rule-con hide">
  11 + <li>本次活动所获现金券仅限Yoho!Buy有货商城购买商品使用,不得转借他人,不可兑换现金;</li>
  12 + <li>一个订单只可使用一张优惠券,优惠券需在有效期内使用,过期则无法使用;</li>
  13 + <li>使用优惠券支付的订单,退款结算按照实际支付金额退款,优惠券返还账户,且有效期不变;</li>
  14 + <li>本活动仅限普通消费者参与,如有代购或批发行为Yoho!Buy有货有权取消订单并做相关处理;</li>
  15 + <li>每位会员有10次发福利机会,超过10次不再赠送现金券;</li>
  16 + <li>Yoho!Buy有货在法律允许范围内拥有本规则解释权。</li>
  17 + </ol>
  18 + </div>
  19 + <div class="share-tag"><img src="//static.yohobuy.com/m/v1/img/invite/yd_share.png"></div>
  20 + </div>
  21 +</div><!--/invite-page-->
  1 +<div class="invite-page invite-page-bg">
  2 + <div class="invite-content-list">
  3 + {{#if result.isEmpty}}
  4 + <div class="coupon-box coupon-box02 relative mar-top-a">
  5 + <p class="fz9 bold">YUAN</p>
  6 + <strong class="fz18">现金券</strong>
  7 + <p class="fz9 bold">CPOUPON</p>
  8 + <div class="pirbox absolute">
  9 + <em class="absolute"></em>0
  10 + </div>
  11 + </div>
  12 +
  13 + <p class="draw-coupon fz19 bold t-shadow">至少1位小伙伴领取<br />才能获得现金券!</p>
  14 + <p class="goon fz11 t-shadow">~继续呼唤小伙伴吧~</p>
  15 + <p class="t-shadow">(点击右上角可以继续召集哦)</p>
  16 +
  17 + <ul class="list-port">
  18 + <li><p class="pic"></p></li>
  19 + <li><p class="pic"></p></li>
  20 + <li><p class="pic"></p></li>
  21 + <li><p class="pic"></p></li>
  22 + <li><p class="pic"></p></li>
  23 + </ul>
  24 + <p><a href="javascript:void(0)" class="weal-btn fz16">再次分享</a></p>
  25 + {{else if result.isFive}}
  26 + <!-- 现金券 start -->
  27 + <div class="coupon-box coupon-box02 relative mar-top-a">
  28 + <p class="fz9 bold">YUAN</p>
  29 + <strong class="fz18">现金券</strong>
  30 + <p class="fz9 bold">CPOUPON</p>
  31 + <div class="pirbox absolute">
  32 + <em class="absolute"></em>10
  33 + </div>
  34 + <div class="count-not fz11 absolute"><hr class="fn-left"><hr class="fn-right">已送达您的账户</div>
  35 + </div>
  36 + <!-- 现金券 end -->
  37 +
  38 + <p class="draw-coupon fz16 bold t-shadow">您的号召力爆棚!!!</p>
  39 + <p class="fz11">已有5位小伙伴领取红包</p>
  40 + <ul class="list-port">
  41 + {{# result.data}}
  42 + <li><img class="pic" src="{{img}}"><p class="name">{{nick}}</p><p class="pon">{{couponAmount}}</p></li>
  43 + {{/ result.data}}
  44 + </ul>
  45 + <br />
  46 + <p><a href="javascript:void(0)" class="weal-btn fz16">还要发福利</a></p>
  47 + <br />
  48 + <p class="fz11 t-shadow">优惠券有效期:优惠券到账以后7天内有效(自然天)</p>
  49 + {{else}}
  50 + <!-- 现金券 start -->
  51 + <div class="coupon-box coupon-box02 relative mar-top-a">
  52 + <p class="fz9 bold">YUAN</p>
  53 + <strong class="fz18">现金券</strong>
  54 + <p class="fz9 bold">CPOUPON</p>
  55 + <div class="pirbox absolute">
  56 + <em class="absolute"></em>10
  57 + </div>
  58 + <div class="count-not fz11 absolute"><hr class="fn-left"><hr class="fn-right">已送达您的账户</div>
  59 + </div>
  60 + <!-- 现金券 end -->
  61 +
  62 + <p class="draw-coupon fz19 bold t-shadow">召集5位小伙伴领取,<br>即可再发福利,赶快召唤吧!</p>
  63 + <br /><br />
  64 + <ul class="list-port">
  65 + {{# result.data}}
  66 + <li><img class="pic" src="{{img}}"><p class="name">{{nick}}</p><p class="pon">{{couponAmount}}</p></li>
  67 + {{/ result.data}}
  68 +
  69 + {{# result.remainData}}
  70 + <li><p class="pic"></p></li>
  71 + {{/ result.remainData}}
  72 + </ul>
  73 + <p><a href="javascript:void(0)" class="weal-btn fz16">继续发福利</a></p>
  74 + <br />
  75 + <p class="fz11 t-shadow">优惠券有效期:优惠券到账以后7天内有效(自然天)</p>
  76 + {{/if}}
  77 +
  78 + <div class="share-tag"><img src="//static.yohobuy.com/m/v1/img/invite/yd_share.png"></div>
  79 + </div>
  80 +</div><!--/invite-page-->
  1 +<div class="invite-page invite-page-bg">
  2 + <div class="invite-content-list">
  3 + <!-- 已有小伙伴 start -->
  4 + <div class="coupon-box coupon-box02 relative mar-top-a">
  5 + <p class="fz9 bold">YUAN</p>
  6 + <strong class="fz18">现金券</strong>
  7 + <p class="fz9 bold">CPOUPON</p>
  8 + <div class="pirbox absolute">
  9 + <em class="absolute"></em>{{amount}}
  10 + </div>
  11 + <div class="count-not fz11 absolute"><hr class="fn-left"><hr class="fn-right">已送达您的账户</div>
  12 + </div>
  13 +
  14 + <p class="congratu-coupon fz15 t-shadow">{{amount}}元现金券<br/>已自动存入YOHO!有货账户 {{userInfo.encMobile}}</p>
  15 + <p class="fz11">(首次下载客户端还能再次领取10元现金券)</p>
  16 +
  17 + <a href="javascript:void(0)" onclick="downLoadApp()" class="download-btn fz16" style="margin-top: 30px;">下载客户端查看</a>
  18 + <p><a href="//m.yohobuy.com" class="now-login fz14" style="border-bottom: 1px solid #fff; text-decoration:none;color:#FFF;line-height: normal;">立即登录网站使用</a></p>
  19 + <br />
  20 + <p class="fz11 t-shadow">优惠券有效期:优惠券到账以后7天内有效(自然天)</p>
  21 + <ul class="list-port">
  22 + {{# result.data}}
  23 + <li><img class="pic" src="{{img}}"><p class="name">{{nick}}</p><p class="pon">{{couponAmount}}</p></li>
  24 + {{/ result.data}}
  25 +
  26 + {{# result.remainData}}
  27 + <li><p class="pic"></p></li>
  28 + {{/ result.remainData}}
  29 + </ul>
  30 + <!-- 已有小伙伴 end -->
  31 + </div>
  32 +</div><!--/invite-page-->
  1 +<div class="invite-page invite-page-bg">
  2 + <div class="invite-content-page">
  3 + <img src="//cdn.yoho.cn/m-yohobuy-node/assets/img/activity/invite/title_new.png" />
  4 + <h2 class="bold fz16">YoHo!Buy有货福利来袭,即领即用!</h2>
  5 + <p>全球1000+潮流品牌每日上新!</p>
  6 + <div class='invite-group relative'>
  7 + <p class="fz13">&nbsp;&nbsp;&nbsp;&nbsp;<span class='bold'>填写您的手机号码,来YOHO潮流!</span>&nbsp;&nbsp;&nbsp;&nbsp;</p>
  8 + <p class='fz11'>已注册YOHO!Buy有货的手机号不能领取哦</p><br />
  9 + <span class='send-validate-btn'>发送验证码</span>
  10 + <input type='text' placeholder='输入手机号' class='invite-mobile' />
  11 + <input type='text' placeholder='输入验证码' class='invite-code' />
  12 + <input type='hidden' name="actId" class='invite-actId' value='{{result.actId}}' />
  13 + <input type="hidden" name="nums" value="{{result.nums}}" />
  14 + <input type="hidden" name="shareUid" value="{{result.shareUid}}" />
  15 + <input type="hidden" name="openId" value="{{result.openId}}" />
  16 + <input type='button' value='领福利' class='invite-btn receive-btn'/>
  17 + </div>
  18 +
  19 + <div class='invite-dialog oldget hide'>
  20 + <div class='invite-dialog-center'>
  21 + <p class="fz13 mtTop03">您已是Yoho!Buy有货的顾客,</p>
  22 + <p class="fz13">此福利仅限新用户领取,</p>
  23 + <p class="fz13">您只需下载Yoho!Buy有货手机客户端,</p>
  24 + <p class="fz13">在【我的】栏目中邀请好友领福利,</p>
  25 + <p class="fz13 mtTop04">即可赢取<strong class="fz18">10元现金券</strong></p>
  26 + <div class='btn-group'>
  27 + <input type='button' class='invite-btn cancelbtn' value='重新输入' />
  28 + <input type='button' class='invite-btn download-btn' value='立即查看' />
  29 + </div>
  30 + </div>
  31 + </div><!--/oldget-->
  32 +
  33 + <div class="invite-dialog isreg hide">
  34 + <br />
  35 + <br />
  36 + <p class="fz13 mtTop03">您已经领取福利券!</p>
  37 + <p class="fz13">下载Yoho!Buy有货手机客户端,</p>
  38 + <p class="fz13">在【我的】栏目中邀请好友领福利,</p>
  39 + <p class="fz13 mtTop04">还可赢取<strong class="fz18">10元现金券</strong></p>
  40 + <br />
  41 + <div class='btn-group'>
  42 + <input type='button' class='invite-btn cancelbtn' value='重新输入' />
  43 + <input type='button' class='invite-btn download-btn' value='立即查看' />
  44 + </div>
  45 + </div><!--/isreg-->
  46 +
  47 + <div class="invite-dialog ishint hide">
  48 + <div class="fz13 ishint-content">操作失败!</div>
  49 + <div class='btn-group'>
  50 + <input type='button' class='invite-btn closeBtn fw90' value='确定' />
  51 + </div>
  52 + </div><!--/ishint-->
  53 +
  54 + </div>
  55 +</div><!--/invite-page-->
  1 +<div class="invite-page invite-page-bg">
  2 + <div class="invite-content-list">
  3 + <div>
  4 + <img src="//cdn.yoho.cn/m-yohobuy-node/assets/img/activity/invite/title_new.png" />
  5 + <br />
  6 + <p class="fz14">只需1位小伙伴领取,<br/>即得<strong class="fz17">10元现金券</strong><br/>全部领完,可继续发,上不封顶!<br/>奔跑吧,潮人们!</p>
  7 +
  8 + <a href="javascript:void(0)" class="invite-btn fz16">立刻发福利</a>
  9 + <h2 class="rule-tit fz15">活动细则</h2>
  10 + </div>
  11 +
  12 + <div class='invite-dialog-bg'></div>
  13 + <div class='invite-dialog over-color'>
  14 + <div class='bold invite-dialog-center'>
  15 + <br />
  16 + <br />
  17 + <p class="fz14 mtTop03">来晚了?!</p>
  18 + <p class="fz16">活动已结束!</p>
  19 + <br />
  20 + <a href='//m.yohobuy.com' class='invite-btn fw90'>继续逛潮牌</a>
  21 + </div>
  22 + </div>
  23 + </div>
  24 +</div><!--/invite-page-->
  1 +<div class="invite-page invite-page-bg">
  2 + <div class="invite-content-list">
  3 + <div class='mar-top-a'>
  4 + <h2 class="fz37 bold">太可惜了,</h2>
  5 + <p class="fz15 t-shadow">您与88元现金券擦肩而过!别伤心,</p>
  6 + <p class="fz22 bold">赠您{{result.amount}}元现金券</p>
  7 + <p class="t-shadow">(仅限Yobo!Buy有货客户端使用)</p>
  8 + <!-- 现金券 start -->
  9 + <div class="coupon-box coupon-box02 relative mar-top-a">
  10 + <p class="fz9 bold">YUAN</p>
  11 + <strong class="fz18">现金券</strong>
  12 + <p class="fz9 bold">CPOUPON</p>
  13 + <div class="pirbox absolute">
  14 + <em class="absolute"></em>{{result.amount}}
  15 + </div>
  16 + <div class="count-not fz11 absolute"><hr class="fn-left"><hr class="fn-right">已送达您的账户</div>
  17 + </div>
  18 + <!-- 现金券 end -->
  19 +
  20 + <p class="hurry-size fz16 bold">赶紧来Yobo!Buy有货<br/>逛潮牌吧!</p>
  21 + <a href="javascript:void(0)" class="download-btn fz16">立即下载客户端</a>
  22 + <p class="fz11">优惠券有效期:优惠券到账以后7天内有效(自然天)</p>
  23 + </div>
  24 + </div>
  25 +</div><!--/invite-page-->
@@ -120,12 +120,12 @@ const _processSideBar = (list, choosed) => { @@ -120,12 +120,12 @@ const _processSideBar = (list, choosed) => {
120 const _getChannelResource = (params) => { 120 const _getChannelResource = (params) => {
121 params.gender = params.gender || 'boys'; 121 params.gender = params.gender || 'boys';
122 122
123 - params = Object.assign({  
124 - gender: genderData[params.gender], 123 + params = Object.assign(params, {
  124 + gender: genderData[params.gender] || '1,2,3',
125 content_code: contentCode[params.gender], // eslint-disable-line 125 content_code: contentCode[params.gender], // eslint-disable-line
126 page: 1, 126 page: 1,
127 limit: 30 127 limit: 30
128 - }, params); 128 + });
129 if (!params.uid) { 129 if (!params.uid) {
130 params.new_device = true; // eslint-disable-line 130 params.new_device = true; // eslint-disable-line
131 } 131 }
@@ -11,7 +11,6 @@ const isTest = process.env.NODE_ENV === 'test'; @@ -11,7 +11,6 @@ const isTest = process.env.NODE_ENV === 'test';
11 11
12 module.exports = { 12 module.exports = {
13 app: 'h5', 13 app: 'h5',
14 - appVersion: '4.6.0', // 调用api的版本  
15 port: 6001, 14 port: 6001,
16 siteUrl: '//m.yohobuy.com', 15 siteUrl: '//m.yohobuy.com',
17 domains: { 16 domains: {
@@ -40,6 +39,17 @@ module.exports = { @@ -40,6 +39,17 @@ module.exports = {
40 timeout: 1000, 39 timeout: 1000,
41 retries: 0 40 retries: 0
42 }, 41 },
  42 + interfaceShunt: {
  43 + useInterfaceShunt: false,
  44 + tencentServers: {
  45 + api: ['123.206.1.98', '123.206.2.80'],
  46 + service: ['123.206.1.98', '123.206.2.80']
  47 + },
  48 + awsServers: {
  49 + api: 'app-java-168863769.cn-north-1.elb.amazonaws.com.cn',
  50 + service: 'service-yoho-579825100.cn-north-1.elb.amazonaws.com.cn'
  51 + }
  52 + },
43 loggers: { 53 loggers: {
44 infoFile: { 54 infoFile: {
45 name: 'info', 55 name: 'info',
@@ -86,7 +96,18 @@ if (isProduction) { @@ -86,7 +96,18 @@ if (isProduction) {
86 retries: 0 96 retries: 0
87 }, 97 },
88 useOneapm: true, 98 useOneapm: true,
89 - useCache: true 99 + useCache: true,
  100 + interfaceShunt: {
  101 + useInterfaceShunt: false,
  102 + tencentServers: {
  103 + api: ['123.206.1.98', '123.206.2.80'],
  104 + service: ['123.206.1.98', '123.206.2.80']
  105 + },
  106 + awsServers: {
  107 + api: 'app-java-168863769.cn-north-1.elb.amazonaws.com.cn',
  108 + service: 'service-yoho-579825100.cn-north-1.elb.amazonaws.com.cn'
  109 + }
  110 + }
90 }); 111 });
91 } else if (isTest) { 112 } else if (isTest) {
92 Object.assign(module.exports, { 113 Object.assign(module.exports, {
1 { 1 {
2 "name": "m-yohobuy-node", 2 "name": "m-yohobuy-node",
3 - "version": "4.8.10", 3 + "version": "4.8.11",
4 "private": true, 4 "private": true,
5 "description": "A New Yohobuy Project With Express", 5 "description": "A New Yohobuy Project With Express",
6 "repository": { 6 "repository": {
@@ -56,7 +56,7 @@ @@ -56,7 +56,7 @@
56 "uuid": "^2.0.2", 56 "uuid": "^2.0.2",
57 "winston": "^2.2.0", 57 "winston": "^2.2.0",
58 "winston-daily-rotate-file": "^1.1.4", 58 "winston-daily-rotate-file": "^1.1.4",
59 - "yoho-node-lib": "0.0.32" 59 + "yoho-node-lib": "0.0.40"
60 }, 60 },
61 "devDependencies": { 61 "devDependencies": {
62 "autoprefixer": "^6.3.7", 62 "autoprefixer": "^6.3.7",

29.3 KB | W: | H:

29.7 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

48.6 KB | W: | H:

47.3 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
  1 +require('./invite/index');
  1 +
  2 +var $ = require('yoho-jquery'),
  3 + loading = require('../../plugin/loading'),
  4 + tip = require('../../plugin/tip'),
  5 + inviteObj = {};
  6 +
  7 +require('../../common');
  8 +
  9 +inviteObj = {
  10 + el: {
  11 + $sendValidateBtn: $('.send-validate-btn'),
  12 + $inviteDialog: $('.invite-dialog'),
  13 + $isreg: $('.isreg'),
  14 + $oldget: $('.oldget'),
  15 + $receiveBtn: $('.receive-btn'),
  16 + $wealBtn: $('.weal-btn'),
  17 + $shareTag: $('.share-tag'),
  18 + $ruleTit: $('.rule-tit'),
  19 + $downloadBtn: $('.download-btn'),
  20 +
  21 + // 变量
  22 + inter: 0, // 定时器变量
  23 + ischeckCode: false, // 是否成功发送验证码
  24 + actId: $('.invite-group input[name="actId"]').val(), // 活动id
  25 + shareUid: $('.invite-group input[name="shareUid"]').val(), // 分享者id
  26 + openId: $('.invite-group input[name="openId"]').val(), // 微信openId
  27 + nums: $('.invite-group input[name="nums"]').val() // 发送优惠券的次数
  28 + },
  29 + init: function() {
  30 + var $el = this.el, that = this, isreceiveBtn = false;
  31 +
  32 + // 设置大背景,因为body只能后来设置,前期设置page里面
  33 + if ($('.invite-page').length > 0) {
  34 + $('body').addClass('invite-page-bg');
  35 + $('.invite-page').removeClass('invite-page-bg');
  36 +
  37 + // 活动已结束背景
  38 + $('.invite-dialog-bg').css({
  39 + height: $(window).height()
  40 + });
  41 + }
  42 +
  43 + // 发送验证码
  44 + $el.$sendValidateBtn.click(function() {
  45 + var mobile = $('.invite-mobile').val();
  46 +
  47 + if (mobile === '' || $(this).hasClass('gray-info')) {
  48 + return true;
  49 + }
  50 +
  51 + $el.ischeckCode = false;
  52 +
  53 + $.ajax({
  54 + url: '/activity/invite/sendRegCodeToMobile',
  55 + data: {
  56 + mobile: mobile
  57 + },
  58 + success: function(result) {
  59 + switch (result.code) {
  60 + case 404:
  61 + // 老用户
  62 + that.ischeckOldUserCoupon(mobile);
  63 + break;
  64 + case 200:
  65 + that.setGrayInfo();
  66 + $el.ischeckCode = true;
  67 + break;
  68 + default:
  69 + that.ishintDialog(result.message);
  70 + break;
  71 + }
  72 + },
  73 + error: function() {
  74 + tip.show('发送验证码失败~');
  75 + }
  76 + });
  77 + });
  78 +
  79 + // 立即分享
  80 + $el.$wealBtn.click(function() {
  81 + $el.$shareTag.fadeIn();
  82 + setTimeout(function() {
  83 + $el.$shareTag.fadeOut();
  84 + }, 2000);
  85 + });
  86 +
  87 + // 活动细节
  88 + $el.$ruleTit.click(function() {
  89 + $('.rule-con').toggle();
  90 + });
  91 +
  92 + // 下载app
  93 + $el.$downloadBtn.click(function() {
  94 + that.downLoadApp();
  95 + });
  96 +
  97 + // 领取福利
  98 + $el.$receiveBtn.click(function() {
  99 + if (isreceiveBtn) {
  100 + return true;
  101 + }
  102 + isreceiveBtn = true;
  103 + loading.showLoadingMask();
  104 + that.receiveFun();
  105 + loading.hideLoadingMask();
  106 + isreceiveBtn = false;
  107 + });
  108 + },
  109 +
  110 + // 发送已注册用户参与活动的优惠券
  111 + ischeckOldUserCoupon: function(mobile) {
  112 + var that = this, $el = this.el;
  113 +
  114 + $.ajax({
  115 + url: '/activity/invite/checkOldUserCoupon',
  116 + data: {
  117 + mobile: mobile,
  118 + actId: $el.actId
  119 + },
  120 + async: false,
  121 + success: function(result) {
  122 + switch (result.code) {
  123 + case 201:
  124 + // 已经领取过
  125 + that.showDialog($el.$isreg);
  126 + break;
  127 + case 200:
  128 + // 发送慰问劵--不须要发送验证码,后台自动发送
  129 + that.showDialog($el.$oldget);
  130 + break;
  131 + default:
  132 + tip.show('发送验证码失败~');
  133 + break;
  134 + }
  135 + },
  136 + error: function() {
  137 + tip.show('发送验证码失败~');
  138 + }
  139 + });
  140 + },
  141 +
  142 + // 发送验证码提示
  143 + setGrayInfo: function() {
  144 + var $el = this.el,
  145 + that = this,
  146 + timeoutPutCount = 60;
  147 +
  148 + $el.$sendValidateBtn.html(timeoutPutCount + 'S');
  149 + $el.$sendValidateBtn.addClass('gray-info');
  150 +
  151 + // 设置定时器
  152 + clearInterval($el.inter);
  153 + $el.inter = setInterval(function() {
  154 + $el.$sendValidateBtn.html(timeoutPutCount-- + 'S');
  155 + if (timeoutPutCount <= 0) {
  156 + that.clearGrayInfo();
  157 + }
  158 + }, 1000);
  159 + },
  160 +
  161 + // 取消 验证码提示
  162 + clearGrayInfo: function() {
  163 + var $el = this.el;
  164 +
  165 + clearInterval($el.inter);
  166 + $el.$sendValidateBtn.removeClass('gray-info');
  167 + $el.$sendValidateBtn.html('发送验证码');
  168 + },
  169 +
  170 + // 验证验证码
  171 + receiveFun: function() {
  172 + var that = this,
  173 + $el = this.el,
  174 + mobile = $('.invite-mobile').val(),
  175 + code = $('.invite-code').val();
  176 +
  177 + if (mobile === '') {
  178 + that.ishintDialog('请输入手机号!');
  179 + return true;
  180 + }
  181 +
  182 + if (code === '') {
  183 + that.ishintDialog('请输入验证码!');
  184 + return true;
  185 + }
  186 +
  187 + // 如果未单击发送验证码
  188 + if ($el.ischeckCode === false) {
  189 + that.ishintDialog('该验证码或已失效,请单击发送验证码!');
  190 + that.clearGrayInfo();
  191 + return true;
  192 + }
  193 +
  194 + $.ajax({
  195 + url: '/activity/invite/validRegCode',
  196 + data: {
  197 + mobile: mobile,
  198 + code: code
  199 + },
  200 + async: false,
  201 + success: function(result) {
  202 + if (result.code === 200) {
  203 + // 跳注册方法
  204 + that.registerFun();
  205 + } else {
  206 + that.ishintDialog(result.message);
  207 + }
  208 + },
  209 + error: function() {
  210 + tip.show('账号注册失败,请稍后在试~');
  211 + }
  212 + });
  213 + },
  214 +
  215 + // 验证码通过,跳注册方法
  216 + registerFun: function() {
  217 + var that = this,
  218 + mobile = $('.invite-mobile').val();
  219 +
  220 + if (mobile === '') {
  221 + that.ishintDialog('请输入手机号!');
  222 + return true;
  223 + }
  224 +
  225 + $.ajax({
  226 + url: '/activity/invite/register',
  227 + data: {
  228 + mobile: mobile
  229 + },
  230 + async: false,
  231 + success: function(result) {
  232 + switch (result.code) {
  233 + case 205:
  234 + that.ischeckOldUserCoupon(mobile);
  235 + break;
  236 + case 200:
  237 + that.receiveCouponsFun(result.data.uid);
  238 + break;
  239 + default:
  240 + that.ishintDialog(result.message);
  241 + break;
  242 + }
  243 + },
  244 + error: function() {
  245 + tip.show('操作失败~');
  246 + }
  247 + });
  248 + },
  249 +
  250 + // 领取优惠券
  251 + receiveCouponsFun: function(uid) {
  252 + var that = this,
  253 + $el = this.el;
  254 +
  255 + window.setCookie('inviteUid', uid);
  256 + $.ajax({
  257 + url: '/activity/invite/receiveCoupons',
  258 + data: {
  259 + actId: $el.actId,
  260 + shareUid: $el.shareUid,
  261 + openId: $el.openId,
  262 + uid: uid,
  263 + nums: $el.nums
  264 + },
  265 + async: false,
  266 + success: function(result) {
  267 + switch (result.code) {
  268 + case 200:
  269 + document.location.href = result.data.goUrl;
  270 + break;
  271 + default:
  272 + that.ishintDialog(result.message);
  273 + break;
  274 + }
  275 + },
  276 + error: function() {
  277 + tip.show('操作失败~');
  278 + }
  279 + });
  280 + },
  281 +
  282 + // 弹出框
  283 + showDialog: function($dom) {
  284 + var that = this,
  285 + $bg = $('<div>').addClass('invite-dialog-bg');
  286 +
  287 + $dom.show();
  288 + $('.invite-dialog-bg').remove();
  289 +
  290 + $bg.css({
  291 + height: $(window).height()
  292 + });
  293 +
  294 + $('.invite-content-page').append($bg);
  295 +
  296 + // 弹框重置
  297 + $dom.find('.cancelbtn').unbind('click').bind('click', function() {
  298 + $('.invite-mobile').val('');
  299 + that.clearShowDialog();
  300 + });
  301 +
  302 + // 错误信息提示,确定按钮
  303 + $dom.find('.closeBtn').unbind('click').bind('click', function() {
  304 + that.clearShowDialog();
  305 + });
  306 + },
  307 +
  308 + // 错误提示弹框
  309 + ishintDialog: function(msg) {
  310 + this.showDialog($('.ishint'));
  311 + $('.ishint-content').html(msg);
  312 + },
  313 + clearShowDialog: function() {
  314 + var $el = this.el,
  315 + that = this;
  316 +
  317 + $('.invite-dialog-bg').remove();
  318 + $el.$inviteDialog.hide();
  319 + that.clearGrayInfo();
  320 + },
  321 +
  322 + // 下载app
  323 + downLoadApp: function() {
  324 + var appUrl = 'http://a.app.qq.com/o/simple.jsp?pkgname=com.yoho&g_f=995445';
  325 +
  326 + setTimeout(function() {
  327 + window.location = appUrl;
  328 + }, 200);
  329 + }
  330 +};
  331 +
  332 +inviteObj.init();
  1 +.invite-page-bg {
  2 + background-image: resolve("activity/invite/body_bg.png");
  3 + min-height: 200px;
  4 +}
  5 +
  6 +.invite-page {
  7 + * {
  8 + margin: 0;
  9 + padding: 0;
  10 + font-size: 28px;
  11 + }
  12 +
  13 + font-family: "Microsoft YaHei";
  14 + color: #fff;
  15 +
  16 + /* 手机号 领福利 */
  17 + .invite-content-page {
  18 +
  19 + text-align: center;
  20 + color: #fff;
  21 +
  22 + .bold {
  23 + font-weight: bold;
  24 + }
  25 +
  26 + .fz9 {
  27 + -webkit-transform: scale(0.75);
  28 + font-size: 18px;
  29 + -webkit-transform-origin: top left;
  30 + }
  31 +
  32 + .fz11 {
  33 + -webkit-transform: scale(0.92);
  34 + font-size: 22px;
  35 + }
  36 +
  37 + .fz13 {
  38 + font-size: 26px;
  39 + }
  40 +
  41 + .fz14 {
  42 + font-size: 28px;
  43 + }
  44 +
  45 + .fz15 {
  46 + font-size: 30px;
  47 + }
  48 +
  49 + .fz16 {
  50 + font-size: 32px;
  51 + }
  52 +
  53 + .fz17 {
  54 + font-size: 34px;
  55 + }
  56 +
  57 + .fz18 {
  58 + font-size: 36px;
  59 + }
  60 +
  61 + .t-shadow {
  62 + text-shadow: 0 4px 10px #797979;
  63 + }
  64 +
  65 + .invite-group {
  66 + text-align: left;
  67 + margin: 20px 40px 0;
  68 +
  69 + input {
  70 + width: 100%;
  71 + height: 70px;
  72 + margin-bottom: 20px;
  73 + border-radius: 4px;
  74 + border: none;
  75 + padding: 10px;
  76 + }
  77 +
  78 + p {
  79 + text-align: center;
  80 + }
  81 +
  82 + .send-validate-btn,
  83 + .gray-info {
  84 + position: absolute;
  85 + background-color: #ff7900;
  86 + height: 70px;
  87 + line-height: 70px;
  88 + cursor: pointer;
  89 + right: 0;
  90 + padding: 0 10px;
  91 + width: 160px;
  92 + }
  93 +
  94 + .gray-info {
  95 + color: #b7ad80;
  96 + background-color: #fef7d8;
  97 + cursor: none;
  98 + text-align: center;
  99 + font-size: 36px;
  100 + }
  101 + }
  102 + }
  103 +
  104 + .invite-dialog-bg {
  105 + background-color: #0d0d0d;
  106 + opacity: 0.5;
  107 + width: 100%;
  108 + height: 664px;
  109 + position: fixed;
  110 + top: 0;
  111 + left: 0;
  112 + z-index: 1;
  113 + }
  114 +
  115 + .relative {
  116 + position: relative;
  117 + right: 0;
  118 + }
  119 +
  120 + .invite-dialog {
  121 + position: fixed;
  122 + background-color: #272624;
  123 + height: 400px;
  124 + top: 32%;
  125 + left: 10%;
  126 + width: 80%;
  127 + z-index: 2;
  128 + overflow-y: auto;
  129 +
  130 + .invite-dialog-center {
  131 + text-align: center;
  132 + padding: 30px 20px;
  133 +
  134 + p {
  135 + line-height: 50px;
  136 + }
  137 + }
  138 + }
  139 +
  140 + .invite-btn {
  141 + width: 48%;
  142 + border: 1px solid #ff7900;
  143 + background-color: #ff7900;
  144 + color: #fff;
  145 + line-height: 50px;
  146 + font-weight: bold;
  147 + margin-top: 10px;
  148 + cursor: pointer;
  149 + display: inline-block;
  150 + padding: 14px 20px;
  151 + }
  152 +
  153 + .btn-group .invite-btn {
  154 + color: #ede6c9;
  155 + }
  156 +
  157 + .over-color a {
  158 + color: #fff;
  159 + }
  160 +
  161 + .fw90 {
  162 + width: 90%;
  163 + }
  164 +
  165 + .ishint-content {
  166 + margin-top: 80px;
  167 + height: 180px;
  168 + padding: 20px;
  169 + }
  170 +
  171 + /** 分享列表 **/
  172 + .invite-content-list {
  173 + text-align: center;
  174 +
  175 + .bold {
  176 + font-weight: bold;
  177 + }
  178 +
  179 + .center {
  180 + text-align: center;
  181 + }
  182 +
  183 + .relative {
  184 + position: relative;
  185 + overflow: hidden;
  186 + }
  187 +
  188 + .absolute {
  189 + position: absolute;
  190 + top: 0;
  191 + left: 0;
  192 + z-index: 0;
  193 + }
  194 +
  195 + .fz9 {
  196 + -webkit-transform: scale(0.75);
  197 + font-size: 18px;
  198 + -webkit-transform-origin: top left;
  199 + }
  200 +
  201 + .fz11 {
  202 + -webkit-transform: scale(0.92);
  203 + font-size: 22px;
  204 + }
  205 +
  206 + .fz13 {
  207 + font-size: 26px;
  208 + }
  209 +
  210 + .fz14 {
  211 + font-size: 28px;
  212 + }
  213 +
  214 + .fz15 {
  215 + font-size: 30px;
  216 + }
  217 +
  218 + .fz16 {
  219 + font-size: 32px;
  220 + }
  221 +
  222 + .fz17 {
  223 + font-size: 34px;
  224 + }
  225 +
  226 + .fz18 {
  227 + font-size: 36px;
  228 + }
  229 +
  230 + .fz19 {
  231 + font-size: 38px;
  232 + }
  233 +
  234 + .fz20 {
  235 + font-size: 40px;
  236 + }
  237 +
  238 + .fz22 {
  239 + font-size: 44px;
  240 + }
  241 +
  242 + .fz37 {
  243 + font-size: 74px;
  244 + }
  245 +
  246 + .mar-top-a {
  247 + margin-top: 14%;
  248 + }
  249 +
  250 + .mar-top-b {
  251 + margin-top: 4%;
  252 + }
  253 +
  254 + .mar-top-c {
  255 + margin-top: 80px;
  256 + }
  257 +
  258 + .mar-top-d {
  259 + margin-top: 40px;
  260 + }
  261 +
  262 + .t-shadow {
  263 + text-shadow: 0 8px 20px #797979;
  264 + }
  265 +
  266 + /* 红包已领完 */
  267 + .invite-box {
  268 + width: 100%;
  269 + min-width: 320px;
  270 + font-family: "Microsoft YaHei";
  271 + color: #fff;
  272 + padding-bottom: 5%;
  273 + }
  274 +
  275 + .fn-left {
  276 + float: left !important;
  277 + }
  278 +
  279 + .fn-right {
  280 + float: right !important;
  281 + }
  282 +
  283 + .coupon-box {
  284 + width: 384px;
  285 + height: 220px;
  286 + padding: 32px 0 0 240px;
  287 + background-color: #f4a70f;
  288 + margin: 80px auto 0;
  289 + text-align: left;
  290 + border-left: 1px dashed #000;
  291 + border-right: 1px dashed #000;
  292 + }
  293 +
  294 + .coupon-box strong {
  295 + display: inline-block;
  296 + margin-top: -4px;
  297 + }
  298 +
  299 + .coupon-box .pirbox {
  300 + width: 200px;
  301 + height: 160px;
  302 + font-size: 120px;
  303 + font-weight: bold;
  304 + font-family: arial;
  305 + padding-left: 44px;
  306 + left: 40px;
  307 + letter-spacing: -0.07em;
  308 + text-align: left;
  309 + overflow: hidden;
  310 + }
  311 +
  312 + .coupon-box .pirbox em {
  313 + font-size: 50px;
  314 + font-weight: normal;
  315 + font-family: "Microsoft YaHei";
  316 + top: 32px;
  317 + line-height: normal;
  318 + }
  319 +
  320 + .coupon-box .count-not {
  321 + text-align: center;
  322 + overflow: hidden;
  323 + margin-top: 144px;
  324 + padding: 0 24px;
  325 + width: 100%;
  326 + }
  327 +
  328 + .coupon-box .count-not hr {
  329 + height: 0;
  330 + border: 0;
  331 + width: 60px;
  332 + margin: 12px;
  333 + border-top: 1px solid #e4e4e4;
  334 + }
  335 +
  336 + .coupon-box.mar-top-a {
  337 + margin-top: 14%;
  338 + padding-top: 40px;
  339 + }
  340 +
  341 + .hurry-size {
  342 + line-height: 1.4em;
  343 + margin-top: 60px;
  344 + }
  345 +
  346 + .download-btn,
  347 + .weal-btn {
  348 + width: 410px;
  349 + height: 88px;
  350 + line-height: 88px;
  351 + background-color: #ff7800;
  352 + color: #fef7d8;
  353 + display: inline-block;
  354 + margin: 40px 0 6px;
  355 + border-radius: 4px;
  356 + }
  357 +
  358 + /* 活动细则 */
  359 + .rule-tit {
  360 + text-decoration: underline;
  361 + margin-top: 36px;
  362 + }
  363 +
  364 + ol.rule-con {
  365 + padding: 20px 30px;
  366 + text-align: left;
  367 + margin: 0;
  368 + }
  369 +
  370 + ol.rule-con li {
  371 + list-style-type: decimal;
  372 + list-style-position: inside;
  373 + padding-bottom: 6px;
  374 + }
  375 +
  376 + /* 邀请小伙伴 */
  377 + .draw-coupon {
  378 + margin-top: 30px;
  379 + text-align: center;
  380 + }
  381 +
  382 + .goon {
  383 + margin: 60px 0 12px;
  384 + }
  385 +
  386 + .congratu-coupon {
  387 + margin-top: 68px;
  388 + }
  389 +
  390 + ul.list-port {
  391 + display: inline-block;
  392 + margin-top: 60px;
  393 + }
  394 +
  395 + ul.list-port li {
  396 + width: 120px;
  397 + float: left;
  398 + overflow: hidden;
  399 + }
  400 +
  401 + ul.list-port li .pic {
  402 + width: 80px;
  403 + height: 80px;
  404 + background-color: #808080;
  405 + border-radius: 50%;
  406 + margin: 0 20px;
  407 + }
  408 +
  409 + ul.list-port li .name,
  410 + ul.list-port li .pon {
  411 + -webkit-transform: scale(0.84);
  412 + font-size: 20px;
  413 + }
  414 +
  415 + ul.list-port li .name {
  416 + height: 1.3em;
  417 + line-height: 1.4em;
  418 + white-space: nowrap;
  419 + text-overflow: ellipsis;
  420 + overflow: hidden;
  421 + }
  422 +
  423 + ul.list-port li .pon {
  424 + color: #ebd518;
  425 + }
  426 +
  427 + ul.list-firends {
  428 + margin-top: 172px;
  429 + }
  430 +
  431 + /* 新用户10元领券 */
  432 + .now-login {
  433 + margin: 12px 0 20px;
  434 + text-decoration: underline;
  435 + display: inline-block;
  436 + }
  437 +
  438 + /* 引导层 */
  439 + .share-tag {
  440 + width: 100%;
  441 + height: 100%;
  442 + position: fixed;
  443 + top: 0;
  444 + left: 0;
  445 + z-index: 100;
  446 + overflow: hidden;
  447 + background-color: #0d0d0d;
  448 + opacity: 0.5;
  449 + display: none;
  450 +
  451 + img {
  452 + float: right;
  453 + }
  454 + }
  455 +
  456 + /* v4 */
  457 + .cgreen {
  458 + color: #3e7e27;
  459 + }
  460 +
  461 + .cfe {
  462 + color: #fef7d8;
  463 + }
  464 +
  465 + .ts {
  466 + text-shadow: 0 2px 6px #5b5b59;
  467 + }
  468 + }
  469 +}
  470 +
1 @charset "utf-8"; 1 @charset "utf-8";
  2 +@import "me/index";
2 @import "layout/reset"; 3 @import "layout/reset";
3 @import "layout/common"; 4 @import "layout/common";
4 @import "layout/loading"; 5 @import "layout/loading";
@@ -9,6 +10,7 @@ @@ -9,6 +10,7 @@
9 @import "channel/index"; 10 @import "channel/index";
10 @import "product/index"; 11 @import "product/index";
11 @import "activity/index"; 12 @import "activity/index";
  13 +@import "activity/invite";
12 @import "passport/index"; 14 @import "passport/index";
13 @import "guang/index"; 15 @import "guang/index";
14 @import "cart/chose-panel"; 16 @import "cart/chose-panel";