Authored by QC-L

修复展示不正确的问题 review by 黄敬囿

... ... @@ -77,6 +77,10 @@ export default class filterMenu extends Component {
goToFilter() {
let { screen } = this.props;
console.log('screen: ', screen);
if (screen && screen.query) {
screen.query = decodeURI(screen.query);
}
router.go('filter', {
...screen
});
... ...
... ... @@ -10,7 +10,9 @@ import getPrivateKey from '../../libs/request/getPrivateKey.js'
export default class Resources extends Component {
constructor(props) {
super(props);
this.state = {
floors: []
};
}
static defaultProps = {
... ... @@ -19,8 +21,21 @@ export default class Resources extends Component {
isShow: false
}
async componentDidMount() {
const pk = await getPrivateKey();
Taro.setStorage({ key: 'verifyKey', data: pk });
commonModel.resource(this.props.code).then(res => {
if (res && res.code === 200) {
this.setState({
floors: res.data
});
}
});
}
render() {
const { isShow, floors } = this.props;
let { isShow, floors } = this.props;
return (
<View className="resources">
... ...
... ... @@ -2,6 +2,7 @@ import api from '../utils/api';
export default {
resource(code) {
console.log(code);
return api.get({
url: '/resources',
data: {
... ...
... ... @@ -33,6 +33,9 @@ export default class Search extends Component {
componentDidMount () {
console.log(this.$router);
let { params } = this.$router;
if (params && params.query) {
params.query = decodeURI(params.query);
}
searchModel.getFilterData(params).then(ret => {
if (ret && ret.code === 200) {
this.setState({
... ...
... ... @@ -66,7 +66,8 @@ export default class Index extends Component {
async getResource() {
const pk = await getPrivateKey();
Taro.setStorage({ key: 'verifyKey', data: pk });
return commonModel.resource(contentCode.index).then(res => {
console.log(contentCode.index);
return commonModel.resource(contentCode.index).then(res => {
if (res && res.code === 200) {
this.setState({
floors: res.data
... ... @@ -224,7 +225,7 @@ export default class Index extends Component {
onScrollToLower={this.onScrollToLower}>
<Resources isRefresh={isRefresh} floors={floors}></Resources>
<Resources isRefresh={ isRefresh } floors = { floors } code={ contentCode.index}></Resources>
<FilterMenu filterMenu={filterMenu} tabs={tabs} tabClass="border" fromPage="index"></FilterMenu>
{
list &&
... ...
... ... @@ -182,7 +182,7 @@ export default class ProductDetail extends Component {
text: '系列',
value: productInfo.series_name
}, {
text: '发时间',
text: '发时间',
value: productInfo.sale_time
}, {
text: '货号',
... ...
... ... @@ -307,6 +307,10 @@ export default class SearchList extends Component {
let type = this.state.pageTitle ? this.state.tabs[0].type : filterMenu.curType;
let isSearchQuery = this.$router.params.query;
let value = this.state.query;
let params = {
...this.$router.params,
query: value
}
return (
<ScrollView
... ... @@ -337,7 +341,7 @@ export default class SearchList extends Component {
<PageTitle pageTitle={pageTitle} selfClass="pd"></PageTitle>
}
<View className={ this.state.fixed ? 'fixed' : '' }>
<FilterMenu filterMenu={ filterMenu } tabs = { this.state.tabs } fromPage = "search" hasFilter = { this.state.hasFilter } screen={this.$router.params} > </FilterMenu>
<FilterMenu filterMenu={ filterMenu } tabs = { this.state.tabs } fromPage = "search" hasFilter = { this.state.hasFilter } screen={params} > </FilterMenu>
< /View>
<ProductList list={productList[type]}></ProductList>
... ...