Authored by 张孝茹

复制

@@ -30,7 +30,7 @@ exports.integralCharts = (req, res, next) => { @@ -30,7 +30,7 @@ exports.integralCharts = (req, res, next) => {
30 exports.familyVip = (req, res, next) => { 30 exports.familyVip = (req, res, next) => {
31 let udid = req.sessionID || 'yoho'; 31 let udid = req.sessionID || 'yoho';
32 let uid = req.user.uid; 32 let uid = req.user.uid;
33 - let yohoApp = req.yoho.isApp && !req.yoho.isMarsApp; 33 + let yohoApp = req.yoho.isYohoApp;
34 let marsApp = req.yoho.isMarsApp; 34 let marsApp = req.yoho.isMarsApp;
35 35
36 req.ctx(family).familyVip(udid, uid, yohoApp, marsApp).then(result => { 36 req.ctx(family).familyVip(udid, uid, yohoApp, marsApp).then(result => {
@@ -40,13 +40,13 @@ exports.familyVip = (req, res, next) => { @@ -40,13 +40,13 @@ exports.familyVip = (req, res, next) => {
40 40
41 exports.downLoadData = (req, res, next) => { 41 exports.downLoadData = (req, res, next) => {
42 let codeArr = req.query.codeArr; 42 let codeArr = req.query.codeArr;
43 - let yohoApp = req.yoho.isApp && !req.yoho.isMarsApp; 43 + let isApp = req.yoho.isApp;
44 44
45 if (!codeArr) { 45 if (!codeArr) {
46 return; 46 return;
47 } 47 }
48 48
49 - req.ctx(family).downLoadData(codeArr, yohoApp).then(result => { 49 + req.ctx(family).downLoadData(codeArr, isApp).then(result => {
50 res.json(result); 50 res.json(result);
51 }).catch(next); 51 }).catch(next);
52 }; 52 };
@@ -475,14 +475,14 @@ class familyModel extends global.yoho.BaseModel { @@ -475,14 +475,14 @@ class familyModel extends global.yoho.BaseModel {
475 }; 475 };
476 let _this = this; 476 let _this = this;
477 477
478 - if (_.get(result, 'data.coinlist')) {  
479 - _.forEach(result.data.coinlist, function(val) { 478 + if (_.get(result, 'data.data')) {
  479 + _.forEach(result.data.data, function(val) {
480 Object.assign(val, { 480 Object.assign(val, {
481 typeName: _this.checkType(val.iconType), 481 typeName: _this.checkType(val.iconType),
482 minus: parseInt(val.num, 10) < 0 482 minus: parseInt(val.num, 10) < 0
483 }); 483 });
484 }); 484 });
485 - resu.coinList = result.data.coinlist; 485 + resu.coinList = result.data.data;
486 } 486 }
487 487
488 return resu; 488 return resu;
@@ -12,7 +12,7 @@ const isTest = process.env.NODE_ENV === 'test'; @@ -12,7 +12,7 @@ const isTest = process.env.NODE_ENV === 'test';
12 12
13 const domains = { 13 const domains = {
14 api: 'http://api-test3.yohops.com:9999/', 14 api: 'http://api-test3.yohops.com:9999/',
15 - service: 'http://api-test3.yohops.com:9999/', 15 + service: 'http://service-test3.yohops.com:9999/',
16 liveApi: 'http://testapi.live.yohops.com:9999/', 16 liveApi: 'http://testapi.live.yohops.com:9999/',
17 singleApi: 'http://api-test3.yohops.com:9999/', 17 singleApi: 'http://api-test3.yohops.com:9999/',
18 imSocket: 'ws://socket.yohobuy.com:10240', 18 imSocket: 'ws://socket.yohobuy.com:10240',
@@ -57,8 +57,10 @@ module.exports = () => { @@ -57,8 +57,10 @@ module.exports = () => {
57 // 判断请求是否来自app 57 // 判断请求是否来自app
58 yoho.isNowApp = /yohonow/i.test(req.get('User-Agent') || ''); 58 yoho.isNowApp = /yohonow/i.test(req.get('User-Agent') || '');
59 yoho.isMarsApp = /yohomars/i.test(req.get('User-Agent') || ''); 59 yoho.isMarsApp = /yohomars/i.test(req.get('User-Agent') || '');
  60 + yoho.isYohoApp = /YohoBuy/i.test(req.get('User-Agent') || '');
60 yoho.isApp = yoho.isMarsApp || 61 yoho.isApp = yoho.isMarsApp ||
61 req.cookies.app_version || 62 req.cookies.app_version ||
  63 + yoho.isNowApp ||
62 /YohoBuy/i.test(req.get('User-Agent') || '') || 64 /YohoBuy/i.test(req.get('User-Agent') || '') ||
63 (req.query.app_version && req.query.app_version !== 'false') || 65 (req.query.app_version && req.query.app_version !== 'false') ||
64 (req.query.appVersion && req.query.appVersion !== 'false'); 66 (req.query.appVersion && req.query.appVersion !== 'false');
@@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
9 {{/imgList}} 9 {{/imgList}}
10 10
11 {{#if winXinCode}} 11 {{#if winXinCode}}
12 - <a class="code-copy" href='//m.yohobuy.com/?openby:yohobuy={"action":"go.copy","params":{"text":"{{winXinCode}}","message":"复制成功"}}'>复制</a> 12 + <span class="code-copy" data-text="{{winXinCode}}">复制</span>
13 {{/if}} 13 {{/if}}
14 </div> 14 </div>
15 {{/ downLoadData}} 15 {{/ downLoadData}}
@@ -202,6 +202,8 @@ class FamilyIndex extends Page { @@ -202,6 +202,8 @@ class FamilyIndex extends Page {
202 this.selector.$downClose.on('click', this.downClose.bind(this)); 202 this.selector.$downClose.on('click', this.downClose.bind(this));
203 this.selector.$popover = $('.popover'); 203 this.selector.$popover = $('.popover');
204 this.selector.$popover.on('mousewheel touchmove', this.banSliding.bind(this)); 204 this.selector.$popover.on('mousewheel touchmove', this.banSliding.bind(this));
  205 + this.selector.$copyBtn = $('.code-copy');
  206 + this.selector.$copyBtn.on('click', this.goCopy.bind(this));
205 }); 207 });
206 } 208 }
207 209
@@ -321,6 +323,27 @@ class FamilyIndex extends Page { @@ -321,6 +323,27 @@ class FamilyIndex extends Page {
321 'overflow-y': 'hidden' 323 'overflow-y': 'hidden'
322 }); 324 });
323 } 325 }
  326 +
  327 + // 复制公众号
  328 + goCopy(e) {
  329 + let $this = $(e.currentTarget);
  330 +
  331 + if (yoho && yoho.isApp) {
  332 + if (yoho.isYohoApp) {
  333 + let href = location.protocol + '//m.yohobuy.com/';
  334 +
  335 + yoho.goH5(href, JSON.stringify({
  336 + action: 'go.copy',
  337 + params: {
  338 + text: $this.data('text'),
  339 + message: '复制成功'
  340 + }
  341 + }));
  342 + } else {
  343 + yoho.invokeMethod('go.copy', {text: $this.data('text')});
  344 + }
  345 + }
  346 + }
324 } 347 }
325 348
326 $(() => { 349 $(() => {
@@ -39,8 +39,10 @@ yoho = { @@ -39,8 +39,10 @@ yoho = {
39 */ 39 */
40 isNowApp: /yohonow/i.test(navigator.userAgent || ''), 40 isNowApp: /yohonow/i.test(navigator.userAgent || ''),
41 isMarsApp: /YohoMars/i.test(navigator.userAgent || ''), 41 isMarsApp: /YohoMars/i.test(navigator.userAgent || ''),
  42 + isYohoApp: /YohoBuy/i.test(navigator.userAgent || ''),
42 isApp: /YohoMars/i.test(navigator.userAgent || '') || 43 isApp: /YohoMars/i.test(navigator.userAgent || '') ||
43 /YohoBuy/i.test(navigator.userAgent || '') || 44 /YohoBuy/i.test(navigator.userAgent || '') ||
  45 + /yohonow/i.test(navigator.userAgent || '') ||
44 qs && qs.app_version || cookie.get('app_version'), 46 qs && qs.app_version || cookie.get('app_version'),
45 isiOS: /\(i[^;]+;( U;)? CPU.+Mac OS X/i.test(navigator.userAgent || ''), 47 isiOS: /\(i[^;]+;( U;)? CPU.+Mac OS X/i.test(navigator.userAgent || ''),
46 isAndroid: /Android/i.test(navigator.userAgent || ''), 48 isAndroid: /Android/i.test(navigator.userAgent || ''),