|
@@ -8,8 +8,6 @@ var $ = require('yoho.jquery'); |
|
@@ -8,8 +8,6 @@ var $ = require('yoho.jquery'); |
8
|
|
8
|
|
9
|
var $returnTop = $('.return-top');
|
9
|
var $returnTop = $('.return-top');
|
10
|
|
10
|
|
11
|
-var apiDomain;
|
|
|
12
|
-
|
|
|
13
|
/**
|
11
|
/**
|
14
|
* 订阅
|
12
|
* 订阅
|
15
|
* @return {[type]} [description]
|
13
|
* @return {[type]} [description]
|
|
@@ -19,42 +17,37 @@ function actionSubscription() { |
|
@@ -19,42 +17,37 @@ function actionSubscription() { |
19
|
$subscriberBtn = $('#subscriber-btn'),
|
17
|
$subscriberBtn = $('#subscriber-btn'),
|
20
|
emailReg = /^[.\-_a-zA-Z0-9]+@[\-_a-zA-Z0-9]+\.[a-zA-Z0-9]/;
|
18
|
emailReg = /^[.\-_a-zA-Z0-9]+@[\-_a-zA-Z0-9]+\.[a-zA-Z0-9]/;
|
21
|
|
19
|
|
22
|
- var subscribeParam = {
|
|
|
23
|
- method: 'open.subscriber.subscriber',
|
|
|
24
|
- v: 1,
|
|
|
25
|
- return_type: 'jsonp',
|
|
|
26
|
- open_key: '12345'
|
|
|
27
|
- };
|
|
|
28
|
-
|
|
|
29
|
var iconCode = {
|
20
|
var iconCode = {
|
30
|
mail: '',
|
21
|
mail: '',
|
31
|
tick: ''
|
22
|
tick: ''
|
32
|
};
|
23
|
};
|
33
|
|
24
|
|
34
|
- var email = $.trim($subscriberBox.val());
|
|
|
35
|
-
|
|
|
36
|
- var params = {};
|
|
|
37
|
-
|
|
|
38
|
$subscriberBox.focus(function() {
|
25
|
$subscriberBox.focus(function() {
|
39
|
$(this).val('').css('color', '');
|
26
|
$(this).val('').css('color', '');
|
40
|
$subscriberBtn.removeClass('done').html(iconCode.mail);
|
27
|
$subscriberBtn.removeClass('done').html(iconCode.mail);
|
41
|
});
|
28
|
});
|
42
|
|
29
|
|
43
|
$subscriberBtn.click(function() {
|
30
|
$subscriberBtn.click(function() {
|
|
|
31
|
+ var email = $.trim($subscriberBox.val());
|
|
|
32
|
+
|
44
|
if (email !== '' && emailReg.test(email)) {
|
33
|
if (email !== '' && emailReg.test(email)) {
|
45
|
- $.extend(params, subscribeParam, {
|
34
|
+ try {
|
|
|
35
|
+ $.ajax({
|
|
|
36
|
+ url: 'http://www.yohobuy.com/common/emailsubscriber',
|
|
|
37
|
+ dataType: 'jsonp',
|
|
|
38
|
+ data: {
|
46
|
email: email,
|
39
|
email: email,
|
47
|
tmp: Math.random(),
|
40
|
tmp: Math.random(),
|
48
|
- uid: $.uid('_UID')
|
|
|
49
|
- });
|
|
|
50
|
- try {
|
|
|
51
|
- $.getJSON('http://test.open.yohobuy.com' + '/?callback=?', params, function(data) {
|
41
|
+ uid: window.getUid()
|
|
|
42
|
+ },
|
|
|
43
|
+ success: function(data) {
|
52
|
if (data.data.result === 1) {
|
44
|
if (data.data.result === 1) {
|
53
|
$subscriberBox.val('已订阅到:' + email);
|
45
|
$subscriberBox.val('已订阅到:' + email);
|
54
|
$subscriberBtn.addClass('done').html(iconCode.tick);
|
46
|
$subscriberBtn.addClass('done').html(iconCode.tick);
|
55
|
} else {
|
47
|
} else {
|
56
|
$subscriberBox.css('color', 'red');
|
48
|
$subscriberBox.css('color', 'red');
|
57
|
}
|
49
|
}
|
|
|
50
|
+ }
|
58
|
});
|
51
|
});
|
59
|
} catch (e) {
|
52
|
} catch (e) {
|
60
|
console.log(e.message);
|
53
|
console.log(e.message);
|
|
@@ -90,7 +83,6 @@ function actionhomeFootChange() { |
|
@@ -90,7 +83,6 @@ function actionhomeFootChange() { |
90
|
var $this = $(this),
|
83
|
var $this = $(this),
|
91
|
$li = $this.closest('li'),
|
84
|
$li = $this.closest('li'),
|
92
|
index = $li.index(),
|
85
|
index = $li.index(),
|
93
|
- params = {},
|
|
|
94
|
_solution = [];
|
86
|
_solution = [];
|
95
|
|
87
|
|
96
|
var _answer = $li.find('.feedback-answer').val(),
|
88
|
var _answer = $li.find('.feedback-answer').val(),
|
|
@@ -101,18 +93,19 @@ function actionhomeFootChange() { |
|
@@ -101,18 +93,19 @@ function actionhomeFootChange() { |
101
|
_solution.push($(this).val());
|
93
|
_solution.push($(this).val());
|
102
|
});
|
94
|
});
|
103
|
|
95
|
|
104
|
- params = {
|
|
|
105
|
- method: 'open.feedback.submit',
|
|
|
106
|
- feedback: _feedback || 0,
|
|
|
107
|
- question: _question || 0,
|
96
|
+ $.ajax({
|
|
|
97
|
+ url: 'http://www.yohobuy.com/common/suggestfeedback',
|
|
|
98
|
+ dataType: 'jsonp',
|
|
|
99
|
+ data: {
|
|
|
100
|
+ feedback_id: _feedback || 0,
|
|
|
101
|
+ question_id: _question || 0,
|
108
|
answer: _answer || '',
|
102
|
answer: _answer || '',
|
109
|
solution: _solution.join(',')
|
103
|
solution: _solution.join(',')
|
110
|
- };
|
|
|
111
|
-
|
|
|
112
|
- $.getData(apiDomain, params, function(data) {
|
104
|
+ },
|
|
|
105
|
+ success: function(data) {
|
113
|
var next = index + 1;
|
106
|
var next = index + 1;
|
114
|
|
107
|
|
115
|
- if (data.result === 1) {
|
108
|
+ if (~~data.data.result === 1) {
|
116
|
if (index === count - 1) {
|
109
|
if (index === count - 1) {
|
117
|
alert('感谢您的参与!');
|
110
|
alert('感谢您的参与!');
|
118
|
return;
|
111
|
return;
|
|
@@ -120,9 +113,10 @@ function actionhomeFootChange() { |
|
@@ -120,9 +113,10 @@ function actionhomeFootChange() { |
120
|
|
113
|
|
121
|
$li.addClass('hide');
|
114
|
$li.addClass('hide');
|
122
|
|
115
|
|
123
|
- $vote.eq(index + 1).removeClass('hide');
|
116
|
+ $vote.children(':eq(' + (index + 1) + ')').removeClass('hide');
|
124
|
$feedBackPage.children('.cur').removeClass('cur');
|
117
|
$feedBackPage.children('.cur').removeClass('cur');
|
125
|
- $feedBackPage.eq(next).addClass('cur');
|
118
|
+ $feedBackPage.children(':eq(' + next + ')').addClass('cur');
|
|
|
119
|
+ }
|
126
|
}
|
120
|
}
|
127
|
});
|
121
|
});
|
128
|
});
|
122
|
});
|