Authored by 邱骏

首单收购需求

@@ -117,6 +117,58 @@ exports.couponSend = (req, res, next) => { @@ -117,6 +117,58 @@ exports.couponSend = (req, res, next) => {
117 }).catch(next); 117 }).catch(next);
118 }; 118 };
119 119
  120 +/**
  121 + * 分享领券活动模板领券接口
  122 + * @param req
  123 + * @param res
  124 + * @param next
  125 + * @returns {*}
  126 + */
  127 +exports.webShareCouponSend = (req, res, next) => {
  128 + let uid = req.user.uid,
  129 + app = req.query.app || {},
  130 + activityId = req.query.activityId,
  131 + templateId = req.query.templateId;
  132 +
  133 + let resultData = {
  134 + code: 403,
  135 + message: '参数错误',
  136 + data: ''
  137 + };
  138 +
  139 +
  140 + if (req.yoho.isApp || app.client_type === 'miniapp') {
  141 + if (app.app_version && app.client_type && app.session_key && app.uid) {
  142 + // 小程序调接口获取 session 的方式不同,H5 嵌小程序,client_type 标记为 h5
  143 + let isMiniApp = app.client_type === 'miniapp';
  144 +
  145 + uid = {
  146 + toString: () => {
  147 + return _.parseInt(app.uid);
  148 + },
  149 + sessionKey: app.session_key,
  150 + appVersion: isMiniApp ? _.get(global, 'yoho.config.appVersion') : app.app_version,
  151 + appSessionType: app.client_type
  152 + };
  153 + }
  154 + }
  155 +
  156 + console.log('UID:', uid, 'APP:', app, activityId, templateId);
  157 +
  158 + if (uid === '' || uid === 0 || !parseInt(activityId, 10) || !parseInt(templateId, 10)) {
  159 + return res.jsonp(resultData);
  160 + }
  161 +
  162 + req.ctx(model).couponSendWebShare(activityId, templateId, uid).then(result => {
  163 + res.set({
  164 + 'Cache-Control': 'no-cache',
  165 + Pragma: 'no-cache',
  166 + Expires: (new Date(1900, 0, 1, 0, 0, 0, 0)).toUTCString()
  167 + });
  168 + res.jsonp(result);
  169 + }).catch(next);
  170 +};
  171 +
120 exports.redenvelope = (req, res, next) => { 172 exports.redenvelope = (req, res, next) => {
121 let token = req.query.token || '', 173 let token = req.query.token || '',
122 uid = req.user.uid, 174 uid = req.user.uid,
@@ -447,7 +447,6 @@ class featureModel extends global.yoho.BaseModel { @@ -447,7 +447,6 @@ class featureModel extends global.yoho.BaseModel {
447 } 447 }
448 448
449 if (componentType === 'share') { // 分享模板 449 if (componentType === 'share') { // 分享模板
450 - console.log(data);  
451 f.component[0].webShare = data.webShare; 450 f.component[0].webShare = data.webShare;
452 if (f.component[0].share_template_id) { 451 if (f.component[0].share_template_id) {
453 f.component[0].webShare.url = 452 f.component[0].webShare.url =
@@ -603,6 +602,31 @@ class featureModel extends global.yoho.BaseModel { @@ -603,6 +602,31 @@ class featureModel extends global.yoho.BaseModel {
603 return result; 602 return result;
604 }); 603 });
605 } 604 }
  605 +
  606 + /**
  607 + * 领取活动模板分享的优惠券
  608 + * @param activityId
  609 + * @param templateId
  610 + * @param uid
  611 + */
  612 + couponSendWebShare(activityId, templateId, uid) {
  613 + let data = {
  614 + method: 'app.coupons.sendNewUserShareCoupon',
  615 + uid: uid,
  616 + activityId: activityId,
  617 + templateId: templateId
  618 + };
  619 +
  620 + return this.get({data}).then(result => {
  621 + if (!result) {
  622 + result.code = 404;
  623 + result.message = '出错啦~';
  624 + }
  625 +
  626 + return result;
  627 + });
  628 + }
  629 +
606 getTplPraiseInfo(ids, udid) { 630 getTplPraiseInfo(ids, udid) {
607 return this.get({ 631 return this.get({
608 data: { 632 data: {
@@ -284,6 +284,7 @@ router.get('/feature/:code.html', feature.index); @@ -284,6 +284,7 @@ router.get('/feature/:code.html', feature.index);
284 router.get('/featuresidebar/:code.html', feature.sidebar); 284 router.get('/featuresidebar/:code.html', feature.sidebar);
285 router.get('/featurebottombar/:code.html', feature.bottombar); 285 router.get('/featurebottombar/:code.html', feature.bottombar);
286 router.get('/feature/couponSend', feature.couponSend); // 获取优惠券 286 router.get('/feature/couponSend', feature.couponSend); // 获取优惠券
  287 +router.get('/feature/webShareCouponSend', feature.webShareCouponSend); // 活动模板分享领取优惠券, 不用分券类型,不用传券ID
287 router.get('/tide/category', auth, tide.category); // 潮品推介 288 router.get('/tide/category', auth, tide.category); // 潮品推介
288 router.get('/tide/shop', auth, tide.shop); // 潮牌推介 289 router.get('/tide/shop', auth, tide.shop); // 潮牌推介
289 router.get('/feature/redenvelope', feature.redenvelope); // 获取红包 290 router.get('/feature/redenvelope', feature.redenvelope); // 获取红包
  1 +<!--活动模板分享领券组件-->
1 <div class="web-share"> 2 <div class="web-share">
2 {{log .}} 3 {{log .}}
3 {{#webShare}} 4 {{#webShare}}
@@ -8,7 +9,13 @@ @@ -8,7 +9,13 @@
8 <div class="web-share-tips-wrapper"> 9 <div class="web-share-tips-wrapper">
9 <div class="web-share-tips-container"> 10 <div class="web-share-tips-container">
10 <div class="web-share-tips"> 11 <div class="web-share-tips">
11 - 12 + <p class="title">提示</p>
  13 + <p class="desc"></p>
  14 + <div class="web-share-buttons-container">
  15 + <a href="javascript:void(0)" class="button-ok">确 定</a>
  16 + <a href='https://union.yoho.cn/union/app-downloads.html' class="button-download">打开有货APP</a>
  17 + </div>
12 </div> 18 </div>
13 </div> 19 </div>
14 </div> 20 </div>
  21 +<div class="web-share-img-wrapper"></div>
@@ -79,53 +79,46 @@ class Reg { @@ -79,53 +79,46 @@ class Reg {
79 * @param next 79 * @param next
80 */ 80 */
81 regSuccessPage(req, res, next) { 81 regSuccessPage(req, res, next) {
  82 + let {activityId = 5475, templateId = 6047} = req.query;
82 83
83 - let regSuccessCouponInfo = {  
84 - totalPrice: 499,  
85 - normalCoupon: [  
86 - {  
87 - price: 19,  
88 - condition: '无限制',  
89 - name: '新人专享无门槛现金券',  
90 - desc: '领券当日开始3日内有效'  
91 - },  
92 - {  
93 - price: 150,  
94 - condition: '满499可用',  
95 - name: '新人专享商城购物券',  
96 - desc: '领券当日开始3日内有效'  
97 - },  
98 - {  
99 - price: 130,  
100 - condition: '满499可用',  
101 - name: '新人专享UFO购物券',  
102 - desc: '领券当日开始3日内有效'  
103 - }  
104 - ],  
105 - shareCoupon: [  
106 - {  
107 - price: 130,  
108 - condition: '满499可用',  
109 - name: '新人专享分享券',  
110 - desc: '领券当日开始3日内有效'  
111 - }  
112 - ],  
113 - boughtCoupon: [  
114 - {  
115 - price: 30,  
116 - condition: '满299可用',  
117 - name: '支付有礼商城购物券',  
118 - desc: '领券当日开始3日内有效'  
119 - }  
120 - ]  
121 - }; 84 + if ((global.yoho.isDev || global.yoho.isTest) && (!req.query.activityId || !req.query.templateId)) {
  85 + activityId = 528;
  86 + templateId = 4166;
  87 + }
  88 +
  89 + req.ctx(RegServiceModel).regSuccessPrize(activityId, templateId).then(result => {
  90 + // console.log(result);
  91 + let regSuccessCouponInfo = {
  92 + activityId: activityId,
  93 + templateId: templateId,
  94 + totalPrice: 0,
  95 + normalCoupon: [],
  96 + shareCoupon: [],
  97 + boughtCoupon: []
  98 + };
  99 +
  100 + _.each(result.data, (couponData) => {
  101 + // console.log('VALUE', couponData);
  102 + _.each(couponData.coupons, (coupon) => {
  103 + if (couponData.name === 'NEW_USER_REGISTER') {
  104 + regSuccessCouponInfo.totalPrice += parseInt(coupon.amount, 10) || 0;
  105 + regSuccessCouponInfo.normalCoupon.push(coupon);
  106 + } else if (couponData.name === 'NEW_USER_SHARE') {
  107 + regSuccessCouponInfo.shareCoupon.push(coupon);
  108 + } else if (couponData.name === 'ORDER_BUY') {
  109 + regSuccessCouponInfo.boughtCoupon.push(coupon);
  110 + }
122 111
123 - res.render('reg/reg-success-prize', {  
124 - module: 'passport',  
125 - page: 'reg-success-prize',  
126 - localCss: true,  
127 - width750: true,  
128 - regSuccessCouponInfo: regSuccessCouponInfo 112 + });
  113 + });
  114 +
  115 + res.render('reg/reg-success-prize', {
  116 + module: 'passport',
  117 + page: 'reg-success-prize',
  118 + localCss: true,
  119 + width750: true,
  120 + regSuccessCouponInfo: regSuccessCouponInfo
  121 + });
129 }).catch(next); 122 }).catch(next);
130 } 123 }
131 124
@@ -140,6 +140,19 @@ class RegServiceModel extends global.yoho.BaseModel { @@ -140,6 +140,19 @@ class RegServiceModel extends global.yoho.BaseModel {
140 } 140 }
141 }); 141 });
142 } 142 }
  143 +
  144 + /**
  145 + * 注册成功领券信息
  146 + */
  147 + regSuccessPrize(activityId, templateId) {
  148 + return this.get({
  149 + data: {
  150 + method: 'app.coupons.newUserlists',
  151 + activityId,
  152 + templateId
  153 + }
  154 + });
  155 + }
143 } 156 }
144 157
145 module.exports = RegServiceModel; 158 module.exports = RegServiceModel;
@@ -15,16 +15,18 @@ @@ -15,16 +15,18 @@
15 <li> 15 <li>
16 <div class="coupon-info"> 16 <div class="coupon-info">
17 <div class="coupon-left"> 17 <div class="coupon-left">
18 - <p class="coupon-price">{{price}}</p>  
19 - <p class="coupon-condition">{{condition}}</p> 18 + <p class="coupon-price">{{amount}}</p>
  19 + <p class="coupon-condition">{{useRuleText}}</p>
20 </div> 20 </div>
21 <div class="coupon-right"> 21 <div class="coupon-right">
22 - <p class="coupon-name">{{name}}</p>  
23 - <p class="coupon-desc">{{desc}}</p> 22 + <p class="coupon-name">{{couponName}}</p>
  23 + <p class="coupon-desc">{{valiPeriodText}}</p>
24 </div> 24 </div>
25 -  
26 - <a class="coupon-button">去使用</a>  
27 - 25 + {{#if isUfo}}
  26 + <a class="coupon-button" href='//m.yohobuy.com/?openby:yohobuy={"action":"go.ufo","params":{"pagename":"home"}}'>去使用</a>
  27 + {{else}}
  28 + <a class="coupon-button" href='//m.yohobuy.com/?openby:yohobuy={"action":"go.home","params":{"gender":"1","channel":"2"}}'>去使用</a>
  29 + {{/if}}
28 </div> 30 </div>
29 </li> 31 </li>
30 {{/each}} 32 {{/each}}
@@ -38,14 +40,14 @@ @@ -38,14 +40,14 @@
38 <li> 40 <li>
39 <div class="coupon-info"> 41 <div class="coupon-info">
40 <div class="coupon-left"> 42 <div class="coupon-left">
41 - <p class="coupon-price">{{price}}</p>  
42 - <p class="coupon-condition">{{condition}}</p> 43 + <p class="coupon-price">{{amount}}</p>
  44 + <p class="coupon-condition">{{useRuleText}}</p>
43 </div> 45 </div>
44 <div class="coupon-right"> 46 <div class="coupon-right">
45 - <p class="coupon-name">{{name}}</p>  
46 - <p class="coupon-desc">{{desc}}</p> 47 + <p class="coupon-name">{{couponName}}</p>
  48 + <p class="coupon-desc">{{valiPeriodText}}</p>
47 </div> 49 </div>
48 - <a class="coupon-button">去分享</a> 50 + <a class="coupon-button" href='//m.yohobuy.com/activity/feature/{{../activityId}}.html?openby:yohobuy={"action":"go.h5","params":{"url":"http://m.yohobuy.com/activity/feature/{{../activityId}}.html"}}'>去分享</a>
49 </div> 51 </div>
50 </li> 52 </li>
51 {{/each}} 53 {{/each}}
@@ -58,12 +60,12 @@ @@ -58,12 +60,12 @@
58 <li> 60 <li>
59 <div class="coupon-info"> 61 <div class="coupon-info">
60 <div class="coupon-left"> 62 <div class="coupon-left">
61 - <p class="coupon-price">{{price}}</p>  
62 - <p class="coupon-condition">{{condition}}</p> 63 + <p class="coupon-price">{{amount}}</p>
  64 + <p class="coupon-condition">{{useRuleText}}</p>
63 </div> 65 </div>
64 <div class="coupon-right"> 66 <div class="coupon-right">
65 - <p class="coupon-name">{{name}}</p>  
66 - <p class="coupon-desc">{{desc}}</p> 67 + <p class="coupon-name">{{couponName}}</p>
  68 + <p class="coupon-desc">{{valiPeriodText}}</p>
67 </div> 69 </div>
68 </div> 70 </div>
69 </li> 71 </li>
@@ -73,7 +75,7 @@ @@ -73,7 +75,7 @@
73 </div> 75 </div>
74 </div> 76 </div>
75 <div class="download-button"> 77 <div class="download-button">
76 - <a id="btn_goto_share" href="//m.yohobuy.com" target="_blank"> 78 + <a id="btn_goto_share" href='http://m.yohobuy.com/activity/feature/{{activityId}}.html?openby:yohobuy={"action":"go.h5","params":{"url":"http://m.yohobuy.com/activity/feature/{{activityId}}.html"}}' target="_blank">
77 <p>去逛逛新人专享</p> 79 <p>去逛逛新人专享</p>
78 </a> 80 </a>
79 <a id="btn_goto_download" style="display: none" href="https://union.yoho.cn/union/app-downloads.html" target="_blank"> 81 <a id="btn_goto_download" style="display: none" href="https://union.yoho.cn/union/app-downloads.html" target="_blank">
@@ -23,6 +23,7 @@ let app_info = { @@ -23,6 +23,7 @@ let app_info = {
23 }; 23 };
24 let appInterface = null; 24 let appInterface = null;
25 25
  26 +// 分享领券相关START------------------------------------------------------------
26 // 用于判断app版本 27 // 用于判断app版本
27 let versionCompare = { 28 let versionCompare = {
28 toVersion: function(str = '') { 29 toVersion: function(str = '') {
@@ -69,11 +70,35 @@ let versionCompare = { @@ -69,11 +70,35 @@ let versionCompare = {
69 } 70 }
70 }; 71 };
71 72
72 -function getParams() {  
73 - let app_uid = cookie.get('app_uid') || qs.uid || '0';  
74 - let app_session_key = cookie.get('app_session_key') || qs.session_key || ''; 73 +function closeWebShareTips() { // 关闭提示框
  74 + $('.web-share-tips-wrapper').removeClass('show');
  75 + $('.web-share-tips-wrapper .desc').text('');
  76 +}
  77 +
  78 +function showWebShareTips(text) { // 显示提示框
  79 + $('.web-share-tips-wrapper').addClass('show');
  80 + $('.web-share-tips-wrapper .desc').text(text);
  81 +}
  82 +
  83 +function showShare() {
  84 + $('.web-share-img-wrapper').addClass('show');
  85 +}
  86 +
  87 +function hideShare() {
  88 + $('.web-share-img-wrapper').removeClass('show');
  89 +}
  90 +
  91 +function getParams() { // 获取登录相关信息
  92 + let app_uid = cookie.get('app_uid') || qs.uid || app_info.uid;
  93 + let app_session_key = cookie.get('app_session_key') || qs.session_key || app_info.session_key;
75 let app_version = cookie.get('app_version') || qs.app_version || ''; 94 let app_version = cookie.get('app_version') || qs.app_version || '';
76 - let app_client_type = cookie.get('app_client_type') || qs.app_version || ''; 95 + let app_client_type = cookie.get('app_client_type') || qs.app_client_type || '';
  96 +
  97 + if (isApp) {
  98 + if (/android/i.test(navigator.userAgent)) {
  99 + app_client_type = 'android';
  100 + }
  101 + }
77 102
78 app_info = { 103 app_info = {
79 uid: app_uid, 104 uid: app_uid,
@@ -85,12 +110,78 @@ function getParams() { @@ -85,12 +110,78 @@ function getParams() {
85 console.log(app_info); 110 console.log(app_info);
86 } 111 }
87 112
88 -function checkShare() {  
89 - versionCompare.version('6.9.7', '6.9.8');  
90 - alert('ok'); 113 +function getCoupon() { // 分享成功后领券
  114 + if (parseInt(app_info.uid, 10)) {
  115 + let activityInfo = JSON.parse($('.activity-plan').val());
  116 +
  117 + let data = {
  118 + activityId: activityInfo[0].activityId,
  119 + templateId: activityInfo[0].templateId,
  120 + app: app_info
  121 + };
  122 +
  123 + console.log(data);
  124 +
  125 + $.ajax({
  126 + url: '//m.yohobuy.com/activity/feature/webShareCouponSend',
  127 + type: 'get',
  128 + dataType: 'jsonp',
  129 + data: data,
  130 + success: function(result) {
  131 + console.log(result);
  132 + if (result.code === 200) {
  133 + showWebShareTips(result.message);
  134 + } else if (result.code === 401) {
  135 + showWebShareTips('您已领取过该优惠券');
  136 + } else if (result.code === 402) {
  137 + showWebShareTips('登录信息异常');
  138 + } else {
  139 + showWebShareTips(result.message);
  140 + }
  141 + hideShare();
  142 + }
  143 + });
  144 + } else {
  145 + showWebShareTips('您还没登录哦');
  146 + }
91 } 147 }
92 148
93 -function goLogin() { 149 +function checkShare(shareData) {
  150 + console.log(shareData);
  151 + if (isApp) {
  152 + let newShare = false;
  153 + let app_vercode = cookie.get('app_vercode');
  154 + let app_version = cookie.get('app_version') || qs.app_version || '';
  155 +
  156 + if (versionCompare.version(app_version, '6.9.5') >= 0 || app_vercode) {
  157 + newShare = true;
  158 + }
  159 +
  160 + window.successShare = function() {
  161 + getCoupon();
  162 + };
  163 +
  164 + appInterface.triggerEvent(
  165 + function() {},
  166 + function() {},
  167 + {
  168 + method: 'go.showshareaction',
  169 + arguments: shareData
  170 + }
  171 + );
  172 +
  173 + if (!newShare) {
  174 + setTimeout(getCoupon, 5000);
  175 + }
  176 + } else {
  177 + showShare();
  178 + if (isWechatMiniProgram) {
  179 + setTimeout(getCoupon, 6000);
  180 + }
  181 + }
  182 +}
  183 +
  184 +function goLogin(shareData) { // 跳转登录判断
94 if (isApp) { 185 if (isApp) {
95 let uidParams = { 186 let uidParams = {
96 method: 'get.uid' 187 method: 'get.uid'
@@ -104,9 +195,10 @@ function goLogin() { @@ -104,9 +195,10 @@ function goLogin() {
104 yo_sdk.goLogin(); 195 yo_sdk.goLogin();
105 } else { 196 } else {
106 app_info.uid = uid; 197 app_info.uid = uid;
  198 +
107 appInterface.triggerEvent(function(sid) { 199 appInterface.triggerEvent(function(sid) {
108 app_info.session_key = sid; 200 app_info.session_key = sid;
109 - checkShare(); 201 + checkShare(shareData);
110 }, function() {}, sessionIdParams); 202 }, function() {}, sessionIdParams);
111 } 203 }
112 }, function() {}, uidParams); 204 }, function() {}, uidParams);
@@ -115,41 +207,60 @@ function goLogin() { @@ -115,41 +207,60 @@ function goLogin() {
115 } 207 }
116 } 208 }
117 209
118 -function initWebShareButtons(env = '') { 210 +function initWebShareButtons(env = '') { // 初始化分享按钮事件
119 $('.web-share-button').each(function() { 211 $('.web-share-button').each(function() {
120 let webShareButton = $(this); 212 let webShareButton = $(this);
121 213
122 $(this).on('click', function() { 214 $(this).on('click', function() {
123 if (!env) { 215 if (!env) {
124 - return alert('请在微信中打开'); 216 + showWebShareTips('请在微信中打开');
  217 + return;
125 } 218 }
126 getParams(); 219 getParams();
  220 + let webShareData = {
  221 + title: webShareButton.data('stitle'),
  222 + desc: webShareButton.data('sdesc'),
  223 + imgUrl: webShareButton.data('spic'),
  224 + link: webShareButton.data('surl').replace('https://activity.yoho.cn', 'http://m.yohobuy.com/activity')
  225 + };
  226 +
  227 + if (isApp) {
  228 + Object.assign(webShareData, {
  229 + hideType: ['4', '5', '6', '7', '8', '9'],
  230 + isCareCallBack: '1'
  231 + });
  232 + }
  233 +
127 if (parseInt(app_info.uid, 10)) { 234 if (parseInt(app_info.uid, 10)) {
128 - let webShareData = {  
129 - title: webShareButton.data('stitle'),  
130 - desc: webShareButton.data('sdesc'),  
131 - imgUrl: webShareButton.data('spic'),  
132 - link: webShareButton.data('surl')  
133 - };  
134 -  
135 - if (isApp) {  
136 - Object.assign(webShareData, {  
137 - hideType: ['4', '5', '6', '7', '8', '9'],  
138 - isCareCallBack: '1'  
139 - });  
140 - }  
141 - console.log(webShareData); 235 +
  236 + checkShare(webShareData);
142 } else { 237 } else {
143 - goLogin(); 238 + goLogin(webShareData);
144 } 239 }
145 }); 240 });
146 }); 241 });
  242 +
  243 + $('.web-share-img-wrapper').on('click', hideShare);
  244 +}
  245 +
  246 +function initWxShare() {
  247 + let shareData = {
  248 + title: $('#shareTitle').val(),
  249 + imgUrl: $('#shareImg').val(),
  250 + desc: $('#shareDesc').val(),
  251 + link: $('#shareLink').val(),
  252 + success: function() {
  253 + setTimeout(getCoupon, 500);
  254 + }
  255 + };
  256 +
  257 + yo_sdk.wxShare(shareData);
147 } 258 }
148 259
149 // 分享领券模板功能初始化 260 // 分享领券模板功能初始化
150 function initWebShare() { 261 function initWebShare() {
151 getParams(); 262 getParams();
152 - console.log(isApp); 263 + $('.web-share-buttons-container .button-ok').on('click', closeWebShareTips);
153 if (isApp) { 264 if (isApp) {
154 document.addEventListener('deviceready', function() { 265 document.addEventListener('deviceready', function() {
155 appInterface = window.yohoInterface; 266 appInterface = window.yohoInterface;
@@ -158,14 +269,18 @@ function initWebShare() { @@ -158,14 +269,18 @@ function initWebShare() {
158 } 269 }
159 }); 270 });
160 } else if (isWechatMiniProgram) { 271 } else if (isWechatMiniProgram) {
  272 + $('.web-share-buttons-container .button-download').hide();
161 initWebShareButtons('miniprogram'); 273 initWebShareButtons('miniprogram');
162 } else if (isWechat) { 274 } else if (isWechat) {
  275 + initWxShare();
163 initWebShareButtons('wechat'); 276 initWebShareButtons('wechat');
164 } else { 277 } else {
165 initWebShareButtons(); 278 initWebShareButtons();
166 } 279 }
167 } 280 }
168 281
  282 +// 分享领券相关END------------------------------------------------------------
  283 +
169 function swiperInit() { 284 function swiperInit() {
170 $('.swiper-container').each(function() { 285 $('.swiper-container').each(function() {
171 let opt = { 286 let opt = {
@@ -17,7 +17,7 @@ const jumpAction = ['go.productDetail', 'go.list', 'go.h5', 'go.shop', 'go.pooll @@ -17,7 +17,7 @@ const jumpAction = ['go.productDetail', 'go.list', 'go.h5', 'go.shop', 'go.pooll
17 17
18 class LinkHandle { 18 class LinkHandle {
19 constructor() { 19 constructor() {
20 - $(document).delegate('a:not(.yoho-coin, .yoho-conpon)', 'click', event => { 20 + $(document).delegate('a:not(.yoho-coin, .yoho-conpon, .web-share-button, .button-ok)', 'click', event => {
21 let $currentTarget = $(event.currentTarget); 21 let $currentTarget = $(event.currentTarget);
22 let href = $currentTarget.attr('href'); 22 let href = $currentTarget.attr('href');
23 23
1 require('scss/passport/reg-success-prize.page.scss'); 1 require('scss/passport/reg-success-prize.page.scss');
2 const $ = require('yoho-jquery'); 2 const $ = require('yoho-jquery');
3 3
4 -function hideDownloadBar() {  
5 - $('#top-downloadbar').hide();  
6 -}  
7 -  
8 -  
9 function checkEnviroment() { 4 function checkEnviroment() {
10 if (!/yohobuy/i.test(navigator.userAgent)) { 5 if (!/yohobuy/i.test(navigator.userAgent)) {
11 $('#btn_goto_download').show(); 6 $('#btn_goto_download').show();
  7 + $('.coupon-button').each(function() {
  8 +
  9 + let url = $(this).attr('href');
  10 + let newUrl = url.replace(/\?openby:yohobuy=\{\S*\s*\}/, '');
  11 +
  12 + $(this).attr('href', newUrl);
  13 + });
12 } 14 }
13 } 15 }
14 16
15 17
16 $(document).ready(function() { 18 $(document).ready(function() {
17 - hideDownloadBar();  
18 checkEnviroment(); 19 checkEnviroment();
19 }); 20 });
@@ -34,13 +34,71 @@ @@ -34,13 +34,71 @@
34 .web-share-tips { 34 .web-share-tips {
35 position: relative; 35 position: relative;
36 margin: 38px auto; 36 margin: 38px auto;
37 - width: 540px;  
38 - height: 324px; 37 + width: 460.8px;
39 background-color: #fff; 38 background-color: #fff;
40 border-radius: 10px; 39 border-radius: 10px;
41 color: #444; 40 color: #444;
42 } 41 }
  42 +
  43 + .web-share-tips .title {
  44 + font-size: 29px;
  45 + line-height: 40.96px;
  46 + color: #d0021b;
  47 + text-align: center;
  48 + padding: 34.1px 51.2px 0 51.2px;
  49 + }
  50 +
  51 + .web-share-tips .desc {
  52 + min-height: 39.25px;
  53 + font-size: 24px;
  54 + line-height: 39px;
  55 + padding: 14px 51.2px 34.1px 51.2px;
  56 + text-align: center;
  57 + }
  58 +
  59 + .web-share-tips .web-share-buttons-container {
  60 + width: 100%;
  61 + height: 75px;
  62 + display: flex;
  63 + flex-direction: row;
  64 + flex: 1;
  65 + border-top: 1px solid #e0e0e0;
  66 + }
  67 +
  68 + .web-share-tips .web-share-buttons-container a {
  69 + width: 100%;
  70 + height: 100%;
  71 + text-align: center;
  72 + line-height: 75px;
  73 + font-size: 29px;
  74 + text-decoration: none;
  75 + color: #444;
  76 + }
  77 +
  78 + .web-share-tips .web-share-buttons-container .button-download {
  79 + border-left: 1px solid #e0e0e0;
  80 + color: #d0021b;
  81 + }
  82 + }
  83 +
  84 + &.show {
  85 + display: block;
43 } 86 }
  87 +}
  88 +
  89 +.web-share-img-wrapper {
  90 + display: none;
  91 + position: fixed;
  92 + width: 100%;
  93 + height: 100%;
  94 + left: 0;
  95 + top: 0;
  96 + background-color: rgba(0, 0, 0, 0.7);
  97 + z-index: 30;
  98 + background-image: url("img/activity/feature/share.png");
  99 + background-size: contain;
  100 + background-position: 0 50%;
  101 + background-repeat: no-repeat;
44 102
45 &.show { 103 &.show {
46 display: block; 104 display: block;