From 7c2b55d968538bef28b98962c1daed315b0950d7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Fri, 13 Dec 2019 15:24:48 +0800
Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=8F=91=E5=B8=83=E6=B5=81?=
 =?UTF-8?q?=E7=A8=8Bend?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 public/react/src/modules/tpm/TPMBanner.js     | 75 +++++++++++++++++--
 .../src/modules/tpm/shixuns/css/TPMBanner.css |  8 ++
 2 files changed, 76 insertions(+), 7 deletions(-)

diff --git a/public/react/src/modules/tpm/TPMBanner.js b/public/react/src/modules/tpm/TPMBanner.js
index b43d86640..bf33f94a8 100644
--- a/public/react/src/modules/tpm/TPMBanner.js
+++ b/public/react/src/modules/tpm/TPMBanner.js
@@ -53,6 +53,8 @@ class TPMBanner extends Component {
       isSpin: false,
       Senttothevcaluetype: false,
       jupyterbool: false,
+      openknow:false,
+      openshowpublictype:false
     }
   }
 
@@ -95,7 +97,54 @@ class TPMBanner extends Component {
     }
   }
 
+  openknow=()=>{
+    let storage=window.localStorage;
+    this.setState({
+      openknow:false
+    })
+    storage.setItem("shixunopenprocess",true);
+  }
+
+  openshowpublic=()=>{
+    let storage=window.localStorage;
+    this.setState({
+      openshowpublictype:false
+    })
+    storage.setItem("openopenpublictype",true);
+  }
+
+
+  componentDidUpdate(prevProps, prevState) {
+    if (prevProps != this.props) {
+      let shixunopenprocess=window.localStorage.shixunopenprocess;
+      let openopenpublictype=window.localStorage.openopenpublictype;
+      if(this.props.shixunsDetails.shixun_status === 0 && this.props.identity < 5){
+        if(shixunopenprocess===undefined||shixunopenprocess===false){
+          this.setState({
+            openknow:true
+          })
+        }else{
+          this.setState({
+            openknow:false
+          })
+        }
+      }
+
+      if(this.props.shixunsDetails.shixun_status === 2 && this.props.shixunsDetails.public===0 && this.props.identity < 5){
+        if(openopenpublictype===undefined||openopenpublictype===false){
+          this.setState({
+            openshowpublictype:true
+          })
+        }else{
+          this.setState({
+            openshowpublictype:false
+          })
+        }
+      }
+    }
+  }
   componentDidMount() {
+
     let thiisie = this.IEVersion();
     if (thiisie != -1) {
       this.setState({
@@ -951,16 +1000,15 @@ class TPMBanner extends Component {
                 {shixunsDetails.shixun_status === 0 && this.props.identity < 5 ?
                   <Popover
                     content={
-                       <pre className={"pd20"}>
+                       <pre className={"bannerpd201"}>
                           <div>您编辑完成后,可以马上使用到自</div>
                           <div className={"wechatcenter mt10"}>己的课堂和实训课程哦</div>
-                          <div className={"wechatcenter mt15"}>   <Button  type="primary" >我知道了</Button></div>
+                          <div className={"wechatcenter mt15"}><Button  type="primary" onClick={this.openknow} >我知道了</Button></div>
                        </pre>
                     }
                     trigger="click"
                     placement="bottom"
-                    visible={false}
-                    onVisibleChange={this.handleVisibleChange}
+                    visible={this.state.openknow}
                   >
                     <a onClick={this.applyrelease} className="fr user_default_btn user_blue_btn mr20 font-18 height39"
                        id="challenge_begin">发布</a>
@@ -1028,9 +1076,22 @@ class TPMBanner extends Component {
                 </Modal>
 
                 {shixunsDetails.shixun_status === 2 && shixunsDetails.public===0 && this.props.identity < 5 ?
-                  <Button type="primary" ghost id="challenge_begin" onClick={this.openpublic} className="fr user_default_btn user_blue_btn mr20 font-18 height39">
-                  申请公开
-                  </Button>: ""
+                  <Popover
+                  content={
+                  <pre className={"bannerpd201"}>
+                  <div>申请公开成功后,您的实训将会展示实训列表</div>
+                  <div className={"wechatcenter mt10"}>平台审核通过,您将获得<span className={"FF6802"}> 1000 </span>金币~</div>
+                  <div className={"wechatcenter mt15"}><Button  type="primary" onClick={this.openshowpublic} >我知道了</Button></div>
+                  </pre>
+                }
+                  trigger="click"
+                  placement="bottom"
+                  visible={this.state.openshowpublictype}
+                  >
+                    <Button type="primary" ghost id="challenge_begin" onClick={this.openpublic} className="fr user_default_btn user_blue_btn mr20 font-18 height39">
+                      申请公开
+                    </Button>
+                  </Popover>: ""
                 }
 
                 {shixunsDetails.shixun_status === 2 && shixunsDetails.public===1 && this.props.identity < 5 ?
diff --git a/public/react/src/modules/tpm/shixuns/css/TPMBanner.css b/public/react/src/modules/tpm/shixuns/css/TPMBanner.css
index fe059fccd..50d30f673 100644
--- a/public/react/src/modules/tpm/shixuns/css/TPMBanner.css
+++ b/public/react/src/modules/tpm/shixuns/css/TPMBanner.css
@@ -111,4 +111,12 @@ a:active{text-decoration:none;}
 
 .width360{
     width:360px;
+}
+
+.bannerpd201{
+    padding: 20px 20px 10px 20px;
+}
+
+.FF6802{
+    color:#FF6802;
 }
\ No newline at end of file