index.page.js
1.29 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
/* eslint-disable */
var $ = require('yoho-jquery');
const brand_tmp = require('hbs/material/brand.hbs');
$('#filter').on('change', function() {
if ($('#filter').find('option:selected').attr('value') == 3) {
$('.date').show();
}
});
/* 品牌点击*/
$('#brand label').on('click', function() {
if ($('#brand_container').css('display') == 'none') {
$('#brand_container').css('display', 'block');
} else {
$('#brand_container').hide();
}
});
$(document).on('click', '#brand_container .nav span', function() {
var yh_channel = $(this).attr('yh_channel');
$('#brand_container .nav span').removeClass('focus');
$(this).addClass('focus');
getBrandList($(this).attr('_index'), yh_channel);
});
/* 获取品牌数据*/
function getBrandList(_index, yh_channel) {
$.get('/material/newBrandList?yh_channel=' + yh_channel, function(data) {
var list = [];
list = Object.keys(data.data.all_list).map(function(item) {
return { name: item, content: data.data.all_list[item] };
});
list['focus' + _index] = true;
$('#brand_container').html(brand_tmp({ list: list }));
});
}
getBrandList(1, 1);
/* 获取品类数据*/
$.get('/material/getCategory', function(data) {
console.log(data);
});
/* eslint-enable */