|
@@ -15,11 +15,11 @@ function getRanToken() { |
|
@@ -15,11 +15,11 @@ function getRanToken() { |
15
|
/**
|
15
|
/**
|
16
|
* 增加单条记录
|
16
|
* 增加单条记录
|
17
|
*/
|
17
|
*/
|
18
|
-function addHistory(brandId) {
|
18
|
+function addHistory(brandName) {
|
19
|
$.ajax({
|
19
|
$.ajax({
|
20
|
type: 'GET',
|
20
|
type: 'GET',
|
21
|
url: '/category/brand/addBrandSearch',
|
21
|
url: '/category/brand/addBrandSearch',
|
22
|
- data: 'brandId=' + brandId,
|
22
|
+ data: 'brandName=' + brandName,
|
23
|
success: function(data) {
|
23
|
success: function(data) {
|
24
|
},
|
24
|
},
|
25
|
error: function() {
|
25
|
error: function() {
|
|
@@ -30,20 +30,24 @@ function addHistory(brandId) { |
|
@@ -30,20 +30,24 @@ function addHistory(brandId) { |
30
|
//绑定提交前的存local操作
|
30
|
//绑定提交前的存local操作
|
31
|
function bindWirteLocal($brandList) {
|
31
|
function bindWirteLocal($brandList) {
|
32
|
$brandList.on('click', 'p', function(e) {
|
32
|
$brandList.on('click', 'p', function(e) {
|
33
|
- var a,brandName,brandId,url;
|
|
|
34
|
- var query = brandName + url,
|
33
|
+ var brandName,brandId,url;
|
|
|
34
|
+ var a = $(this).find('a');
|
|
|
35
|
+ var query = a.attr('brandName') + a.attr('href'),
|
35
|
historys;
|
36
|
historys;
|
36
|
|
37
|
|
37
|
- e.preventDefault();
|
|
|
38
|
- a = $(this).find('a');
|
|
|
39
|
-
|
|
|
40
|
brandName = a.attr('brandName');
|
38
|
brandName = a.attr('brandName');
|
41
|
|
39
|
|
42
|
brandId = a.attr('brandId');
|
40
|
brandId = a.attr('brandId');
|
43
|
|
41
|
|
44
|
url = a.attr('href');
|
42
|
url = a.attr('href');
|
45
|
|
43
|
|
|
|
44
|
+ e.preventDefault();
|
46
|
|
45
|
|
|
|
46
|
+ if ($('.net-search').length > 0) {
|
|
|
47
|
+ addHistory(brandName);
|
|
|
48
|
+ location.href = url;
|
|
|
49
|
+ return;
|
|
|
50
|
+ }
|
47
|
|
51
|
|
48
|
if (localStorage) {
|
52
|
if (localStorage) {
|
49
|
historys = localStorage.getItem('historys-brand');
|
53
|
historys = localStorage.getItem('historys-brand');
|
|
@@ -64,9 +68,7 @@ function bindWirteLocal($brandList) { |
|
@@ -64,9 +68,7 @@ function bindWirteLocal($brandList) { |
64
|
localStorage.setItem('historys-brand', historys);
|
68
|
localStorage.setItem('historys-brand', historys);
|
65
|
}
|
69
|
}
|
66
|
|
70
|
|
67
|
- if ($('.net-search').length > 0) {
|
|
|
68
|
- addHistory(brandId);
|
|
|
69
|
- }
|
71
|
+
|
70
|
|
72
|
|
71
|
location.href = url;
|
73
|
location.href = url;
|
72
|
});
|
74
|
});
|