share-buy.page.js
1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
'use strict';
require('activity/share-buy.page.css');
let $ = require('yoho-jquery'),
dialog = require('plugin/dialog'),
yoho = require('yoho-app');
let $news = $('.news'),
newsLiL = $news.find('li').length,
newsHeight = 0;
let shareData = {
title: '【有货】参与分享购,大家一起拿返利~',
link: location.href,
desc: '学生用户专享,返利升级购物可直接抵现金,超级福利等你来嗨~',
imgUrl: 'http://img11.static.yhbimg.com/yhb-img01/2017/05/10/16/011568a808f9b10e098b6542d3a8cb3d6b.png'
};
require('common');
require('common/share')(shareData);
if (yoho.isApp) {
if (window.queryString.act_id) {
shareData.link = 'http://m.yohobuy.com/activity/share-buy?act_id=' + window.queryString.act_id;
} else {
shareData.link = 'http://m.yohobuy.com/activity/share-buy';
}
yoho.ready(function() {
yoho.invokeMethod('set.shareInfo', shareData);
});
}
// 返利资讯的滚动
function Marquee() {
let diff;
$news.scrollTop($news.scrollTop() + 1);
diff = newsHeight - $news.scrollTop();
if (diff <= 0) {
$news.scrollTop(Math.abs(diff));
}
}
if (newsLiL > 1) {
$news.append('<li>' + $news.find('li:first').html() + '</li>');
for (let i = 0; i < newsLiL; i++) {
$news.find('li').eq(i).height($news.find('li:first').height());
newsHeight = newsHeight + $news.find('li').eq(i).height();
}
setInterval(Marquee, 100);
}
$('.join').click(function() {
if ($('.coupon-list').data('student') === false) {
dialog.showDialog({
dialogText: '完成学生认证即可参与活动哦~',
fast: true,
hasFooter: {
rightBtnText: '去认证'
}
}, function() {
yoho.goH5('http://m.yohobuy.com/activity/student/register', '{"action":"go.h5","params":{"islogin":"N","type":"13","url":"http://m.yohobuy.com/activity/student/register"}}');
}, null, true);
}
});