Merge branch 'UFO_1.0.0' of git.yoho.cn:mobile/yoho-miniapp-ufo into UFO_1.0.0
Showing
5 changed files
with
36 additions
and
39 deletions
@@ -9,6 +9,7 @@ import sortUp from '../../static/images/sort-up.png'; | @@ -9,6 +9,7 @@ import sortUp from '../../static/images/sort-up.png'; | ||
9 | import sortDown from '../../static/images/sort-down.png'; | 9 | import sortDown from '../../static/images/sort-down.png'; |
10 | import './index.scss'; | 10 | import './index.scss'; |
11 | import router from '../../router/index'; | 11 | import router from '../../router/index'; |
12 | +import event from '../../utils/event.js'; | ||
12 | 13 | ||
13 | @connect(({ filterMenu }) => { | 14 | @connect(({ filterMenu }) => { |
14 | return {filterMenu} | 15 | return {filterMenu} |
@@ -70,6 +71,7 @@ export default class filterMenu extends Component { | @@ -70,6 +71,7 @@ export default class filterMenu extends Component { | ||
70 | params.curType = filterMenu.curType; | 71 | params.curType = filterMenu.curType; |
71 | } | 72 | } |
72 | this.props.changeType(params); | 73 | this.props.changeType(params); |
74 | + event.emit('reset-page-loading', { filterMenu: Object.assign(...filterMenu, params)}); | ||
73 | this.setState({ | 75 | this.setState({ |
74 | curOrder: order | 76 | curOrder: order |
75 | }); | 77 | }); |
@@ -8,6 +8,7 @@ function getQRCodeSource(code) { | @@ -8,6 +8,7 @@ function getQRCodeSource(code) { | ||
8 | let param = { | 8 | let param = { |
9 | params: { | 9 | params: { |
10 | md5Param: code, | 10 | md5Param: code, |
11 | + miniapp_type: '63' | ||
11 | }, | 12 | }, |
12 | url: config.domains.yohoApi +'/wechat/miniapp/getMiniAppRealParam' | 13 | url: config.domains.yohoApi +'/wechat/miniapp/getMiniAppRealParam' |
13 | } | 14 | } |
@@ -6,11 +6,13 @@ import {search as searchModel} from '../../models'; | @@ -6,11 +6,13 @@ import {search as searchModel} from '../../models'; | ||
6 | import { connect } from '@tarojs/redux'; | 6 | import { connect } from '@tarojs/redux'; |
7 | import { bindActionCreators } from 'redux'; | 7 | import { bindActionCreators } from 'redux'; |
8 | import { setFilter } from '../../actions/filterData'; | 8 | import { setFilter } from '../../actions/filterData'; |
9 | +import event from '../../utils/event.js' | ||
9 | import './index.scss'; | 10 | import './index.scss'; |
10 | import wx from '../../libs/wx'; | 11 | import wx from '../../libs/wx'; |
11 | 12 | ||
12 | -@connect(({ filterData }) => ({ | ||
13 | - filterData | 13 | +@connect(({ filterData, filterMenu }) => ({ |
14 | + filterData, | ||
15 | + filterMenu | ||
14 | }), (dispatch) => { | 16 | }), (dispatch) => { |
15 | return bindActionCreators({ | 17 | return bindActionCreators({ |
16 | setFilter | 18 | setFilter |
@@ -84,8 +86,9 @@ export default class Search extends Component { | @@ -84,8 +86,9 @@ export default class Search extends Component { | ||
84 | } | 86 | } |
85 | 87 | ||
86 | onConfirmSearch() { | 88 | onConfirmSearch() { |
87 | - let {setFilter} = this.props; | 89 | + let {setFilter, filterMenu} = this.props; |
88 | let {selectList} = this.state; | 90 | let {selectList} = this.state; |
91 | + event.emit('reset-page-loading', { filterMenu: filterMenu}); | ||
89 | setFilter(selectList); | 92 | setFilter(selectList); |
90 | 93 | ||
91 | wx.navigateBack({ | 94 | wx.navigateBack({ |
@@ -87,13 +87,13 @@ export default class ProductDetail extends Component { | @@ -87,13 +87,13 @@ export default class ProductDetail extends Component { | ||
87 | 87 | ||
88 | componentWillMount() { | 88 | componentWillMount() { |
89 | let options = this.$router.params; | 89 | let options = this.$router.params; |
90 | - | ||
91 | if (options && options.scene) { | 90 | if (options && options.scene) { |
91 | + console.log(options.scene); | ||
92 | // let code = '073c8bb068f4fc9d8dc573b5d4284e3f'; | 92 | // let code = '073c8bb068f4fc9d8dc573b5d4284e3f'; |
93 | let code = options.scene; | 93 | let code = options.scene; |
94 | getQRCodeSource(code).then(json => { | 94 | getQRCodeSource(code).then(json => { |
95 | if (json) { | 95 | if (json) { |
96 | - this.loadElement(json); | 96 | + this.loadElement(json); |
97 | } | 97 | } |
98 | }) | 98 | }) |
99 | .catch(error => { | 99 | .catch(error => { |
@@ -7,6 +7,7 @@ import { bindActionCreators } from 'redux'; | @@ -7,6 +7,7 @@ import { bindActionCreators } from 'redux'; | ||
7 | import { clearFilter } from '../../actions/filterData'; | 7 | import { clearFilter } from '../../actions/filterData'; |
8 | import './index.scss'; | 8 | import './index.scss'; |
9 | import goYohoBuy from '../../assets/images/goYohoBuy@3x.png'; | 9 | import goYohoBuy from '../../assets/images/goYohoBuy@3x.png'; |
10 | +import event from '../../utils/event.js'; | ||
10 | 11 | ||
11 | @connect(({ filterMenu, filterData }) => ({ | 12 | @connect(({ filterMenu, filterData }) => ({ |
12 | filterMenu, | 13 | filterMenu, |
@@ -96,48 +97,36 @@ export default class SearchList extends Component { | @@ -96,48 +97,36 @@ export default class SearchList extends Component { | ||
96 | this.setState(obj, () => { | 97 | this.setState(obj, () => { |
97 | this.getProductData(); | 98 | this.getProductData(); |
98 | }); | 99 | }); |
100 | + event.on('reset-page-loading', this.resetPageAndStopLoading.bind(this)); | ||
99 | } | 101 | } |
100 | 102 | ||
101 | componentWillReceiveProps(nextProps) { | 103 | componentWillReceiveProps(nextProps) { |
102 | let { destroy, page, stopLoading } = this.state; | 104 | let { destroy, page, stopLoading } = this.state; |
103 | if (!destroy) { | 105 | if (!destroy) { |
104 | - if (Object.keys(page).length > 0) { | ||
105 | - Object.keys(page).forEach((key) => { | ||
106 | - page[key] = 1 | ||
107 | - }); | ||
108 | - } | ||
109 | - if (Object.keys(stopLoading).length > 0) { | ||
110 | - Object.keys(stopLoading).forEach((key) => { | ||
111 | - stopLoading[key] = false | ||
112 | - }) | ||
113 | - } | ||
114 | - this.setState({ | ||
115 | - page: page, | ||
116 | - stopLoading | ||
117 | - }, () => { | ||
118 | - this.getProductData(nextProps.filterMenu); | ||
119 | - }); | 106 | + // this.getProductData(nextProps.filterMenu); |
120 | } | 107 | } |
121 | } | 108 | } |
122 | 109 | ||
123 | - componentDidShow() { | ||
124 | - let { page, stopLoading } = this.state; | ||
125 | - if (Object.keys(page).length > 0) { | ||
126 | - Object.keys(page).forEach((key) => { | ||
127 | - page[key] = 1 | ||
128 | - }); | ||
129 | - } | ||
130 | - if (Object.keys(stopLoading).length > 0) { | ||
131 | - Object.keys(stopLoading).forEach((key) => { | ||
132 | - stopLoading[key] = false | ||
133 | - }) | ||
134 | - } | ||
135 | - this.setState({ | ||
136 | - page: page, | ||
137 | - stopLoading | ||
138 | - }, () => { | ||
139 | - this.getProductData(); | ||
140 | - }); | 110 | + resetPageAndStopLoading(props) { |
111 | + let { page, stopLoading } = this.state; | ||
112 | + if (Object.keys(page).length > 0) { | ||
113 | + Object.keys(page).forEach((key) => { | ||
114 | + page[key] = 1 | ||
115 | + }); | ||
116 | + } | ||
117 | + if (Object.keys(stopLoading).length > 0) { | ||
118 | + Object.keys(stopLoading).forEach((key) => { | ||
119 | + stopLoading[key] = false | ||
120 | + }) | ||
121 | + } | ||
122 | + console.log(page); | ||
123 | + console.log(stopLoading); | ||
124 | + this.setState({ | ||
125 | + page: page, | ||
126 | + stopLoading | ||
127 | + }, () => { | ||
128 | + this.getProductData(props.filterMenu); | ||
129 | + }); | ||
141 | } | 130 | } |
142 | 131 | ||
143 | componentWillUnmount() { | 132 | componentWillUnmount() { |
@@ -227,7 +216,9 @@ export default class SearchList extends Component { | @@ -227,7 +216,9 @@ export default class SearchList extends Component { | ||
227 | getProductData(obj, isSearch) { | 216 | getProductData(obj, isSearch) { |
228 | let { filterMenu, filterData } = this.props; | 217 | let { filterMenu, filterData } = this.props; |
229 | let { page, productList, stopLoading, query } = this.state; | 218 | let { page, productList, stopLoading, query } = this.state; |
219 | + console.log('obj: ', obj); | ||
230 | console.log('filterMenu: ', filterMenu); | 220 | console.log('filterMenu: ', filterMenu); |
221 | + console.log('filterData: ', filterData); | ||
231 | 222 | ||
232 | let order = ''; | 223 | let order = ''; |
233 | obj = obj || filterMenu; | 224 | obj = obj || filterMenu; |
-
Please register or login to post a comment