Authored by 张孝茹

复制

... ... @@ -30,7 +30,7 @@ exports.integralCharts = (req, res, next) => {
exports.familyVip = (req, res, next) => {
let udid = req.sessionID || 'yoho';
let uid = req.user.uid;
let yohoApp = req.yoho.isApp && !req.yoho.isMarsApp;
let yohoApp = req.yoho.isYohoApp;
let marsApp = req.yoho.isMarsApp;
req.ctx(family).familyVip(udid, uid, yohoApp, marsApp).then(result => {
... ... @@ -40,13 +40,13 @@ exports.familyVip = (req, res, next) => {
exports.downLoadData = (req, res, next) => {
let codeArr = req.query.codeArr;
let yohoApp = req.yoho.isApp && !req.yoho.isMarsApp;
let isApp = req.yoho.isApp;
if (!codeArr) {
return;
}
req.ctx(family).downLoadData(codeArr, yohoApp).then(result => {
req.ctx(family).downLoadData(codeArr, isApp).then(result => {
res.json(result);
}).catch(next);
};
... ...
... ... @@ -475,14 +475,14 @@ class familyModel extends global.yoho.BaseModel {
};
let _this = this;
if (_.get(result, 'data.coinlist')) {
_.forEach(result.data.coinlist, function(val) {
if (_.get(result, 'data.data')) {
_.forEach(result.data.data, function(val) {
Object.assign(val, {
typeName: _this.checkType(val.iconType),
minus: parseInt(val.num, 10) < 0
});
});
resu.coinList = result.data.coinlist;
resu.coinList = result.data.data;
}
return resu;
... ...
... ... @@ -12,7 +12,7 @@ const isTest = process.env.NODE_ENV === 'test';
const domains = {
api: 'http://api-test3.yohops.com:9999/',
service: 'http://api-test3.yohops.com:9999/',
service: 'http://service-test3.yohops.com:9999/',
liveApi: 'http://testapi.live.yohops.com:9999/',
singleApi: 'http://api-test3.yohops.com:9999/',
imSocket: 'ws://socket.yohobuy.com:10240',
... ...
... ... @@ -57,8 +57,10 @@ module.exports = () => {
// 判断请求是否来自app
yoho.isNowApp = /yohonow/i.test(req.get('User-Agent') || '');
yoho.isMarsApp = /yohomars/i.test(req.get('User-Agent') || '');
yoho.isYohoApp = /YohoBuy/i.test(req.get('User-Agent') || '');
yoho.isApp = yoho.isMarsApp ||
req.cookies.app_version ||
yoho.isNowApp ||
/YohoBuy/i.test(req.get('User-Agent') || '') ||
(req.query.app_version && req.query.app_version !== 'false') ||
(req.query.appVersion && req.query.appVersion !== 'false');
... ...
... ... @@ -9,7 +9,7 @@
{{/imgList}}
{{#if winXinCode}}
<a class="code-copy" href='//m.yohobuy.com/?openby:yohobuy={"action":"go.copy","params":{"text":"{{winXinCode}}","message":"复制成功"}}'>复制</a>
<span class="code-copy" data-text="{{winXinCode}}">复制</span>
{{/if}}
</div>
{{/ downLoadData}}
... ...
... ... @@ -202,6 +202,8 @@ class FamilyIndex extends Page {
this.selector.$downClose.on('click', this.downClose.bind(this));
this.selector.$popover = $('.popover');
this.selector.$popover.on('mousewheel touchmove', this.banSliding.bind(this));
this.selector.$copyBtn = $('.code-copy');
this.selector.$copyBtn.on('click', this.goCopy.bind(this));
});
}
... ... @@ -321,6 +323,27 @@ class FamilyIndex extends Page {
'overflow-y': 'hidden'
});
}
// 复制公众号
goCopy(e) {
let $this = $(e.currentTarget);
if (yoho && yoho.isApp) {
if (yoho.isYohoApp) {
let href = location.protocol + '//m.yohobuy.com/';
yoho.goH5(href, JSON.stringify({
action: 'go.copy',
params: {
text: $this.data('text'),
message: '复制成功'
}
}));
} else {
yoho.invokeMethod('go.copy', {text: $this.data('text')});
}
}
}
}
$(() => {
... ...
... ... @@ -39,8 +39,10 @@ yoho = {
*/
isNowApp: /yohonow/i.test(navigator.userAgent || ''),
isMarsApp: /YohoMars/i.test(navigator.userAgent || ''),
isYohoApp: /YohoBuy/i.test(navigator.userAgent || ''),
isApp: /YohoMars/i.test(navigator.userAgent || '') ||
/YohoBuy/i.test(navigator.userAgent || '') ||
/yohonow/i.test(navigator.userAgent || '') ||
qs && qs.app_version || cookie.get('app_version'),
isiOS: /\(i[^;]+;( U;)? CPU.+Mac OS X/i.test(navigator.userAgent || ''),
isAndroid: /Android/i.test(navigator.userAgent || ''),
... ...