From 94263caead9adb8070e4c2eeb00cc4c1adb96c65 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Wed, 18 Dec 2019 15:43:36 +0800
Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=96=B0=E7=89=88=E5=AE=9E?=
 =?UTF-8?q?=E8=AE=AD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../modules/courses/statistics/Statistics.js  | 29 +++++++++--
 public/react/src/modules/tpm/TPMIndex.js      | 51 ++++++++++++++++---
 .../src/modules/tpm/shixuns/ShixunCard.js     | 11 +++-
 .../src/modules/tpm/shixuns/ShixunCardList.js | 36 ++++++++++++-
 .../src/modules/tpm/shixuns/ShixunsIndex.js   |  3 ++
 5 files changed, 119 insertions(+), 11 deletions(-)

diff --git a/public/react/src/modules/courses/statistics/Statistics.js b/public/react/src/modules/courses/statistics/Statistics.js
index d8647870e..281052426 100644
--- a/public/react/src/modules/courses/statistics/Statistics.js
+++ b/public/react/src/modules/courses/statistics/Statistics.js
@@ -1,5 +1,5 @@
 import React,{ Component } from "react";
-import {Table, Pagination,Tooltip,Spin, Row, Col ,Checkbox,Tabs,Menu, Dropdown, Icon,Input} from "antd";
+import {Table, Pagination,Popover,Spin, Row, Col ,Tabs, Icon} from "antd";
 import { WordsBtn,on, off, trigger ,getImageUrl,sortDirections} from 'educoder';
 import axios from'axios';
 import Dropdownbox from './Dropdownbox';
@@ -423,15 +423,38 @@ class Statistics extends Component{
 					:""
 			}
 		</React.Fragment>;
+
+		const content = (
+			<div className={"Statisticscircle"}>
+				<p>
+					课堂总成绩 * 70 %
+				</p>
+				<p>
+					课堂活跃度 * 10%
+				</p>
+				<p>
+					课外学习成绩 * 20%
+				</p>
+				<p>
+					其中,课外学习成绩= 当前学生经验值 / 课堂学生经验值 最大值*100
+				</p>
+			</div>
+		);
 		return(
 			<React.Fragment>
 					<div className="edu-back-white">
 						<Spin size="large" spinning={this.state.topisSpin}>
 						<p className="clearfix padding30">
-							<Row gutter={24}>
-								<Col className={"Statisticsmxxy"}>
+							<Row>
+								<Col span={12}>
 									明星学员
 								</Col>
+								<Col span={12} className={"Statisticsliboxjsgz"}>
+									<span className={"mr10"}>计算规则</span>
+									<Popover  placement="bottom" title={"明星学员计算说明"} content={content} trigger="hover">
+										<Icon type="info-circle" />
+									</Popover>
+								</Col>
 							</Row>
 
 							<Row type="flex" justify="center" align="bottom">
diff --git a/public/react/src/modules/tpm/TPMIndex.js b/public/react/src/modules/tpm/TPMIndex.js
index a9fffa277..d79bae95b 100644
--- a/public/react/src/modules/tpm/TPMIndex.js
+++ b/public/react/src/modules/tpm/TPMIndex.js
@@ -2,7 +2,7 @@ import React, { Component } from 'react';
 
 import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom";
 
-import { Row, Col ,Menu} from 'antd';
+import { Row, Col ,Menu,Popover,Button} from 'antd';
 
 import Loading from '../../Loading';
 
@@ -147,12 +147,21 @@ class TPMIndex extends Component {
           PropaedeuticsList: undefined,
 				  tpmindexjupyterbool:false,
 				  is_jupyter:false,
-          selectedKeys:""
+          selectedKeys:"",
+          openknows:false
       }
     }
 
-    componentDidMount = () => {
+    openknow=()=>{
+      let storage=window.localStorage;
+      this.setState({
+        openknows:false
+      })
+      storage.setItem("newTPMsettings",true);
+    }
 
+    componentDidMount = () => {
+        let newTPMsettings=window.localStorage.newTPMsettings;
         let id = this.props.match.params.shixunId;
         // console.log('props', this.props);
         // let collaborators = `/shixuns/` + id + `/propaedeutics.json`;
@@ -200,6 +209,22 @@ class TPMIndex extends Component {
                     secret_repository: response.data.secret_repository,
 									  is_jupyter:response.data.is_jupyter=== undefined||response.data.is_jupyter===null?false:response.data.is_jupyter,
                 });
+
+
+              if(response.data.identity <4){
+
+                if(newTPMsettings===undefined||newTPMsettings===false){
+                  this.setState({
+                    openknows:true
+                  })
+                }else{
+                  this.setState({
+                    openknows:false
+                  })
+                }
+              }
+
+
             }
         }).catch((error) => {
             this.setState({
@@ -402,9 +427,23 @@ class TPMIndex extends Component {
                           <span className={"tpmbannernavstyler"}>排行榜</span>
                         </Menu.Item>:""}
 
-                        {this.state.identity >4||this.state.identity===undefined ? "":<Menu.Item key="9" className={"competitionmr50"}>
-                          <span className={"tpmbannernavstyler"}>配置</span>
-                        </Menu.Item>}
+                        {this.state.identity >4||this.state.identity===undefined ? "":
+                          <Menu.Item key="9" className={"competitionmr50"}>
+                            <Popover
+                              content={
+                                <pre className={"bannerpd201"}>
+                                <div>更多设置在这里,点击“配置”看一看~</div>
+                                <div className={"wechatcenter mt15"}><Button  type="primary" onClick={this.openknow} >我知道了</Button></div>
+                              </pre>
+                              }
+                              trigger="click"
+                              placement="top"
+                              visible={this.state.openknows}
+                            >
+                              <span className={"tpmbannernavstyler"}>配置</span>
+                            </Popover>
+                          </Menu.Item>
+                        }
 
                         {this.state.identity >2||this.state.identity===undefined?"":
                           <div className={"fr"}>
diff --git a/public/react/src/modules/tpm/shixuns/ShixunCard.js b/public/react/src/modules/tpm/shixuns/ShixunCard.js
index 045f0009b..dc07759cb 100644
--- a/public/react/src/modules/tpm/shixuns/ShixunCard.js
+++ b/public/react/src/modules/tpm/shixuns/ShixunCard.js
@@ -79,9 +79,18 @@ class ShixunCard extends Component {
 					</div>:""}
 
 
-					<div className="mt10 mb20 clearfix"
+					<div className="mb20 clearfix"
              // style={{display: middleshixundata === undefined || middleshixundata.length === 0 ? "none" : "block"}}
 				>
+            <style>
+              {
+                `
+                .square-list{
+                  margin-top:5px;
+                }
+                `
+              }
+            </style>
           <div className="shixun_list_content">
             <div className="square-list clearfix">
               {middleshixundata === undefined || middleshixundata.length === 0?" ":middleshixundata.map((item,key)=>{
diff --git a/public/react/src/modules/tpm/shixuns/ShixunCardList.js b/public/react/src/modules/tpm/shixuns/ShixunCardList.js
index d95ef75fe..8a09cd3bc 100644
--- a/public/react/src/modules/tpm/shixuns/ShixunCardList.js
+++ b/public/react/src/modules/tpm/shixuns/ShixunCardList.js
@@ -160,8 +160,42 @@ class ShixunCardList extends Component {
 			this.props.Shixunsupcircles("asc")
 		}
 	}
+
+	//头部获取是否已经登录了
+	getUser=(url,type)=>{
+		if(this.props.checkIfLogin()===false){
+			this.props.showLoginDialog()
+			return
+		}
+		if(this.props.checkIfProfileCompleted()===false){
+			this.props.showProfileCompleteDialog()
+			return
+		}
+
+		if(url !== undefined || url!==""){
+			window.location.href = url;
+		}
+
+
+	}
 	render(){
 		let {mine,InputValue,upcircle}=this.state;
+
+		// console.log("NewHeadermygetHelmetapi123123123123");
+		let shixuntype=false;
+		if(this.props&&this.props.mygetHelmetapi!=null){
+			let shixun="/shixuns";
+			let paths="/paths";
+			let courses="/courses";
+			this.props.mygetHelmetapi.navbar.map((item,key)=>{
+				var reg = RegExp(item.link);
+				if(shixun.match(reg)){
+					if(item.hidden===true){
+						shixuntype=true
+					}
+				}
+			})
+		}
 		return (
 			<div className="educontent mt20">
 				<div className="clearfix">
@@ -184,7 +218,7 @@ class ShixunCardList extends Component {
 						 id="hot"
 						 onClick={(e)=>this.latestHot(e,3)}>最热
 					</div>
-
+					{shixuntype===true?"":<a className={  "fl font-16 bestChoose active"  }  onClick={(url)=>this.getUser("/shixuns/new")}>+新建实训项目</a>}
 
 					{/*<div className="fl font-16 bestChoose shixun_repertoire ml20 mt1"*/}
 					    {/*style={{display:upcircle===true?"block":"none"}}*/}
diff --git a/public/react/src/modules/tpm/shixuns/ShixunsIndex.js b/public/react/src/modules/tpm/shixuns/ShixunsIndex.js
index 581301766..7b6e54bc8 100644
--- a/public/react/src/modules/tpm/shixuns/ShixunsIndex.js
+++ b/public/react/src/modules/tpm/shixuns/ShixunsIndex.js
@@ -394,6 +394,8 @@ class ShixunsIndex extends Component {
                         parsedid={parsedid}
                         newtag_level={newtag_level}
                         newpalce={newpalce}
+                        {...this.props}
+                        {...this.state}
                     />
 
                     <ShixunCardList
@@ -401,6 +403,7 @@ class ShixunsIndex extends Component {
                         ShixunsSwitch={this.ShixunsSwitch.bind(this)}
                         Shixunsupcircles={this.Shixunsupcircles.bind(this)}
                         allUpdatashixunlist={this.allUpdatashixunlist}
+                        {...this.props}
                         {...this.state}
                         OnSearchInput={this.OnSearchInput.bind(this)}
                     />