Authored by hongyong.zhao

Merge branch 'UFO_1.0.0' of git.yoho.cn:mobile/yoho-miniapp-ufo into UFO_1.0.0

... ... @@ -9,6 +9,7 @@ import sortUp from '../../static/images/sort-up.png';
import sortDown from '../../static/images/sort-down.png';
import './index.scss';
import router from '../../router/index';
import event from '../../utils/event.js';
@connect(({ filterMenu }) => {
return {filterMenu}
... ... @@ -70,6 +71,7 @@ export default class filterMenu extends Component {
params.curType = filterMenu.curType;
}
this.props.changeType(params);
event.emit('reset-page-loading', { filterMenu: Object.assign(...filterMenu, params)});
this.setState({
curOrder: order
});
... ...
... ... @@ -8,6 +8,7 @@ function getQRCodeSource(code) {
let param = {
params: {
md5Param: code,
miniapp_type: '63'
},
url: config.domains.yohoApi +'/wechat/miniapp/getMiniAppRealParam'
}
... ...
... ... @@ -6,11 +6,13 @@ import {search as searchModel} from '../../models';
import { connect } from '@tarojs/redux';
import { bindActionCreators } from 'redux';
import { setFilter } from '../../actions/filterData';
import event from '../../utils/event.js'
import './index.scss';
import wx from '../../libs/wx';
@connect(({ filterData }) => ({
filterData
@connect(({ filterData, filterMenu }) => ({
filterData,
filterMenu
}), (dispatch) => {
return bindActionCreators({
setFilter
... ... @@ -84,8 +86,9 @@ export default class Search extends Component {
}
onConfirmSearch() {
let {setFilter} = this.props;
let {setFilter, filterMenu} = this.props;
let {selectList} = this.state;
event.emit('reset-page-loading', { filterMenu: filterMenu});
setFilter(selectList);
wx.navigateBack({
... ...
... ... @@ -87,13 +87,13 @@ export default class ProductDetail extends Component {
componentWillMount() {
let options = this.$router.params;
if (options && options.scene) {
console.log(options.scene);
// let code = '073c8bb068f4fc9d8dc573b5d4284e3f';
let code = options.scene;
getQRCodeSource(code).then(json => {
if (json) {
this.loadElement(json);
this.loadElement(json);
}
})
.catch(error => {
... ...
... ... @@ -7,6 +7,7 @@ import { bindActionCreators } from 'redux';
import { clearFilter } from '../../actions/filterData';
import './index.scss';
import goYohoBuy from '../../assets/images/goYohoBuy@3x.png';
import event from '../../utils/event.js';
@connect(({ filterMenu, filterData }) => ({
filterMenu,
... ... @@ -96,48 +97,36 @@ export default class SearchList extends Component {
this.setState(obj, () => {
this.getProductData();
});
event.on('reset-page-loading', this.resetPageAndStopLoading.bind(this));
}
componentWillReceiveProps(nextProps) {
let { destroy, page, stopLoading } = this.state;
if (!destroy) {
if (Object.keys(page).length > 0) {
Object.keys(page).forEach((key) => {
page[key] = 1
});
}
if (Object.keys(stopLoading).length > 0) {
Object.keys(stopLoading).forEach((key) => {
stopLoading[key] = false
})
}
this.setState({
page: page,
stopLoading
}, () => {
this.getProductData(nextProps.filterMenu);
});
// this.getProductData(nextProps.filterMenu);
}
}
componentDidShow() {
let { page, stopLoading } = this.state;
if (Object.keys(page).length > 0) {
Object.keys(page).forEach((key) => {
page[key] = 1
});
}
if (Object.keys(stopLoading).length > 0) {
Object.keys(stopLoading).forEach((key) => {
stopLoading[key] = false
})
}
this.setState({
page: page,
stopLoading
}, () => {
this.getProductData();
});
resetPageAndStopLoading(props) {
let { page, stopLoading } = this.state;
if (Object.keys(page).length > 0) {
Object.keys(page).forEach((key) => {
page[key] = 1
});
}
if (Object.keys(stopLoading).length > 0) {
Object.keys(stopLoading).forEach((key) => {
stopLoading[key] = false
})
}
console.log(page);
console.log(stopLoading);
this.setState({
page: page,
stopLoading
}, () => {
this.getProductData(props.filterMenu);
});
}
componentWillUnmount() {
... ... @@ -227,7 +216,9 @@ export default class SearchList extends Component {
getProductData(obj, isSearch) {
let { filterMenu, filterData } = this.props;
let { page, productList, stopLoading, query } = this.state;
console.log('obj: ', obj);
console.log('filterMenu: ', filterMenu);
console.log('filterData: ', filterData);
let order = '';
obj = obj || filterMenu;
... ...