add sidebar filter
This commit is contained in:
@@ -3,6 +3,7 @@ import { View,Button } from '@tarojs/components'
|
||||
import { AtTag, AtButton} from 'taro-ui'
|
||||
|
||||
|
||||
import URL from '../../serviceAPI.config'
|
||||
|
||||
import './sideBarFilterComponent.scss'
|
||||
|
||||
@@ -20,8 +21,75 @@ class sideBarFilterComponent extends Component {
|
||||
onClick(value){
|
||||
console.log(value)
|
||||
}
|
||||
getSearchParam(){
|
||||
Taro.request({
|
||||
url: URL.GetSearchParam,
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
goods: JSON.stringify({
|
||||
shop_name: false,
|
||||
shop_id: 808,
|
||||
shop_class_id: "",
|
||||
goods_type: 12
|
||||
}),
|
||||
goodsSpec: JSON.stringify([]),
|
||||
goodsParam: JSON.stringify([]),
|
||||
goodsParamExt: JSON.stringify([]),
|
||||
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
console.log('param',res)
|
||||
})
|
||||
}
|
||||
getSearchResult(){
|
||||
Taro.request({
|
||||
url: URL.SearchResult,
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
goods: JSON.stringify({
|
||||
curr_page: 1,
|
||||
page_count: 50,
|
||||
shop_name: false,
|
||||
shop_id: 808,
|
||||
config_id: 4,
|
||||
shop_class_id: '',
|
||||
goods_type:12
|
||||
}),
|
||||
goodsSpec: JSON.stringify([]),
|
||||
goodsParam: JSON.stringify([]),
|
||||
goodsParamExt: JSON.stringify([]),
|
||||
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
console.log('result',res)
|
||||
})
|
||||
}
|
||||
|
||||
componentWillMount() {
|
||||
|
||||
}
|
||||
componentDidMount() {
|
||||
this.getSearchParam()
|
||||
this.getSearchResult()
|
||||
}
|
||||
|
||||
componentDidShow() { }
|
||||
|
||||
componentDidHide() { }
|
||||
render() {
|
||||
|
||||
|
||||
const goodsClass = this.props.FilterText?this.props.FilterText.goods_class:null
|
||||
const goodsType = this.props.FilterText?this.props.FilterText.goods_type:null
|
||||
const widthness = this.props.FilterText?this.props.FilterText.goodsParamExt['5'].param_value[0]:null
|
||||
@@ -30,19 +98,19 @@ class sideBarFilterComponent extends Component {
|
||||
// 分类
|
||||
const goodsClassElementsArray=goodsClass.map((item,index)=>{
|
||||
return <AtTag style='margin-left:5px' key={index}
|
||||
name={item.class_name}
|
||||
type='primary'
|
||||
active={this.state.isActive}
|
||||
onClick={this.onClick.bind(this)}
|
||||
>{item.class_name}</AtTag>
|
||||
name={item.class_name}
|
||||
type='primary'
|
||||
active={this.state.isActive}
|
||||
onClick={this.onClick.bind(this)}
|
||||
>{item.class_name}</AtTag>
|
||||
})
|
||||
// 商品类型
|
||||
const goodsTypeElementsArray=goodsType.map((item,index)=>{
|
||||
return <AtTag style='margin-left:5px' key={index}
|
||||
name={item.goods_type_ch_name}
|
||||
type='primary'
|
||||
active={this.state.isActive}
|
||||
onClick={this.onClick.bind(this)}
|
||||
name={item.goods_type_ch_name}
|
||||
type='primary'
|
||||
active={this.state.isActive}
|
||||
onClick={this.onClick.bind(this)}
|
||||
>{item.goods_type_ch_name}</AtTag>
|
||||
})
|
||||
//---------
|
||||
@@ -50,19 +118,15 @@ class sideBarFilterComponent extends Component {
|
||||
return <View key={index}><View className='title' >{item.param_name}</View>
|
||||
<View className='button-box'>
|
||||
<AtTag style='margin-left:5px'
|
||||
name={item.param_value[0]}
|
||||
type='primary'
|
||||
active={this.state.isActive}
|
||||
onClick={this.onClick.bind(this)}
|
||||
>{item.param_value[0]}</AtTag>
|
||||
|
||||
name={item.param_value[0]}
|
||||
type='primary'
|
||||
active={this.state.isActive}
|
||||
onClick={this.onClick.bind(this)}
|
||||
>{item.param_value[0]}</AtTag>
|
||||
</View>
|
||||
</View>
|
||||
})
|
||||
// 宽度
|
||||
|
||||
|
||||
|
||||
return (
|
||||
<View className='filter-box'>
|
||||
<View className='title'>分类</View>
|
||||
@@ -73,10 +137,10 @@ class sideBarFilterComponent extends Component {
|
||||
<View className='title'>宽度</View>
|
||||
<View className='button-box'>
|
||||
<AtTag style='margin-left:5px'
|
||||
name={widthness.value_desc}
|
||||
type='primary'
|
||||
active={this.state.isActive}
|
||||
onClick={this.onClick.bind(this)}
|
||||
name={widthness.value_desc}
|
||||
type='primary'
|
||||
active={this.state.isActive}
|
||||
onClick={this.onClick.bind(this)}
|
||||
>{widthness.value_desc}</AtTag>
|
||||
|
||||
</View>
|
||||
|
Reference in New Issue
Block a user