From 09a61bbb47b035bf90d8090cbb919a5390159702 Mon Sep 17 00:00:00 2001 From: zhangds Date: Tue, 27 Sep 2022 15:57:59 +0800 Subject: [PATCH] =?UTF-8?q?1)=20=E8=90=BD=E5=9C=B0=E9=A1=B5=E9=87=8D?= =?UTF-8?q?=E6=96=B0=E8=8E=B7=E5=8F=96=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/plan/add/add.js | 6 ++++++ src/pages/plan/add/edit.js | 6 ++++++ src/pages/plan/add/step2.js | 7 ++++++- src/pages/plan/add/step3.js | 36 +++++++++++++++++++++--------------- src/pages/plan/list/list.js | 1 + 5 files changed, 40 insertions(+), 16 deletions(-) diff --git a/src/pages/plan/add/add.js b/src/pages/plan/add/add.js index 3fac0c30..0de24882 100644 --- a/src/pages/plan/add/add.js +++ b/src/pages/plan/add/add.js @@ -273,6 +273,11 @@ export default class add extends React.Component { console.log(this.state.keys); } + // 获取落地页 + getStep3Theme() { + this.refs.step3.getThemeData(); + } + send(e) { let plan_id = sessionStorage.getItem("plan_id"); let data = { @@ -404,6 +409,7 @@ export default class add extends React.Component { onStyleChange={(e) => { this.onStyleChange(e); }} + getStep3Theme={() => this.getStep3Theme()} changeKeyType={(e) => this.setState({ keyType: e })} keyType={this.state.keyType} keyStyle={this.state.keyStyle} diff --git a/src/pages/plan/add/edit.js b/src/pages/plan/add/edit.js index 928ad043..9d2ac42d 100644 --- a/src/pages/plan/add/edit.js +++ b/src/pages/plan/add/edit.js @@ -214,6 +214,11 @@ export default class add extends React.Component { } } + // 获取落地页 + getStep3Theme() { + this.refs.step3.getThemeData(); + } + /* 转译 */ tranFormData(req) { // 需要转译的类型 @@ -678,6 +683,7 @@ export default class add extends React.Component { sessionStorage.setItem("keyType", e); this.setState({ keyType: e }); }} + getStep3Theme={() => this.getStep3Theme()} keyType={this.state.keyType} whiteStyle={this.state.whiteStyle} keyStyle={this.state.keyStyle} diff --git a/src/pages/plan/add/step2.js b/src/pages/plan/add/step2.js index a9f0c636..09de4249 100644 --- a/src/pages/plan/add/step2.js +++ b/src/pages/plan/add/step2.js @@ -293,8 +293,10 @@ export default class acclist extends React.Component { onCheckChange = ({ target }) => { this.props.changeKeyType(target.value); - console.log("keyType => ", target.value); sessionStorage.setItem("keyType", target.value); + if (this.props.getStep3Theme) { + this.props.getStep3Theme(); + } }; onStyleChange(e) { @@ -308,6 +310,9 @@ export default class acclist extends React.Component { this.setState({ model: model2 }); if (e.target.value == 6) { sessionStorage.setItem("white", 1); + if (this.props.getStep3Theme) { + this.props.getStep3Theme(); + } this.setState({ white_visible: true }); } else { sessionStorage.setItem("white", 3); diff --git a/src/pages/plan/add/step3.js b/src/pages/plan/add/step3.js index 96f3a959..e857ff84 100644 --- a/src/pages/plan/add/step3.js +++ b/src/pages/plan/add/step3.js @@ -47,23 +47,26 @@ export default class acclist extends React.Component { getThemeData() { let params = {}; - // 兑换码的处理 - if (sessionStorage.getItem("white") == 1) { - params.page = 1; + // 第一步:判断是否优惠券 + let white = sessionStorage.getItem("white"); + let keyType = sessionStorage.getItem("keyType"); + // 2 优惠券 + if (keyType == 2) { + // 并且是 白名单 + if (white == 1) { + params.page = 8; + } else { + params.page = 4; + } } else { - params.page = 3; + // 兑换码 + if (white == 1) { + params.page = 3; + } else { + // 并且是 白名单 + params.page = 1; + } } - - // 优惠券的处理 - if ( - sessionStorage.getItem("white") == 1 && - sessionStorage.getItem("keyType") == 2 - ) { - params.page = 8; - } else { - params.page = 4; - } - getThemeChoice(params).then((res) => { handelResponse( res, @@ -76,6 +79,9 @@ export default class acclist extends React.Component { }); this.setState({ options: arr }); + let model = this.state.model; + model.theme_id = ""; + this.setState({ model: model }); if (this.props.data && this.props.data.theme_id) { this.setState({ theme_id: this.props.data.theme_id }); diff --git a/src/pages/plan/list/list.js b/src/pages/plan/list/list.js index c373fba4..a6279eac 100644 --- a/src/pages/plan/list/list.js +++ b/src/pages/plan/list/list.js @@ -100,6 +100,7 @@ export default class acclist extends React.Component { }; } clickFn() { + sessionStorage.setItem("keyType", 1); let link = window.location.href.replace( window.location.hash, "#/home/plan-create"