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