Authored by 郭成尧

share-js

... ... @@ -8,7 +8,7 @@ const share = require(`${mRoot}/share`);
exports.getShareContent = (req, res, next) => {
if (!req.query.shareId) {
return res.json({
return res.jsonp({
code: 400,
message: 'shareId is null'
});
... ... @@ -17,6 +17,6 @@ exports.getShareContent = (req, res, next) => {
share.getShareContent({
shareId: req.query.shareId
}).then(result => {
res.json(result);
res.jsonp(result);
}).catch(next);
};
... ...
... ... @@ -72,25 +72,27 @@ if (/MicroMessenger/i.test(navigator.userAgent)) {
}
});
}
module.exports = function(data) {
shareData = data;
if (qs && qs.shareId) {
$.ajax({
method: 'GET',
url: location.protocol + '//m.yohobuy.com/activity/share',
data: {
shareId: qs.shareId
},
success: function(res) {
if (res && res.code === 200 && res.data) {
shareData.desc = res.data.content;
shareData.imgUrl = res.data.pic;
shareData.title = res.data.title;
}
if (qs && qs.shareId) {
$.ajax({
method: 'GET',
url: location.protocol + '//m.yohobuy.com/activity/share',
data: {
shareId: qs.shareId
},
dataType: 'jsonp',
success: function(res) {
if (res && res.code === 200 && res.data) {
shareData.desc = res.data.content;
shareData.imgUrl = res.data.pic;
shareData.title = res.data.title;
}
});
}
}
});
}
module.exports = function(data) {
shareData = data;
if (window.wx) {
window.wx.onMenuShareAppMessage(shareData);
... ...