Browse Source

Merge branch 'master' of www.gitinn.com:zaixianjiaoyu/sourcecode

KaysonCui 5 years ago
parent
commit
7b471e879c

+ 2 - 2
front/project/www/components/Date/index.js

@@ -29,11 +29,11 @@ export default class extends Component {
   }
 
   render() {
-    const { hideInput, disabledDate, theme = '', value, onChange } = this.props;
+    const { show, hideInput, disabledDate, theme = '', value, onChange } = this.props;
     return (
       <div className={`g-date-block ${hideInput ? 'hide-input' : ''}`}>
         <DatePicker
-          open
+          open={show}
           value={value}
           dropdownClassName={`g-date ${theme} ${hideInput ? 'hide-input' : ''}`}
           disabledDate={disabledDate}

+ 50 - 45
front/project/www/components/Examination/index.js

@@ -10,6 +10,7 @@ import TotalSort from '../TotalSort';
 import Date from '../Date';
 import Ratio from '../Ratio';
 import { My } from '../../stores/my';
+import { Main } from '../../stores/main';
 import { PrepareStatus, PrepareExaminationTime, PrepareScoreTime } from '../../../Constant';
 
 const PrepareStatusMap = getMap(PrepareStatus, 'value', 'short');
@@ -49,48 +50,44 @@ export default class extends Component {
       },
     };
     this.state = { step: 0, data: { prepareGoal: 650 } };
-    My.getPrepare().then(result => {
-      const statusTotal = result.stat.status.reduce((p, n) => {
-        return p + n.value;
-      }, 0);
-      const goalTotal = result.stat.goal.reduce((p, n) => {
-        return p + n.value;
-      }, 0);
-      const examinationTimeTotal = result.stat.examinationTime.reduce((p, n) => {
-        return p + n.value;
-      }, 0);
-      const scoreTimeTotal = result.stat.scoreTime.reduce((p, n) => {
-        return p + n.value;
-      }, 0);
-      const stat = {
-        status: result.stat.status.map((row, index) => {
-          row.value = formatPercent(row.value, statusTotal);
-          row.label = `${PrepareStatusMap[row.key]}; ${row.value}%`;
-          row.color = this.statusColors[index];
-          return row;
-        }),
-        goal: result.stat.goal.map((row, index) => {
-          row.value = formatPercent(row.value, goalTotal);
-          row.label = `${row.key}+; ${row.value}%`;
-          row.color = this.goalColors[index];
-          return row;
-        }),
-        examinationTime: result.stat.status.map((row, index) => {
-          row.value = formatPercent(row.value, examinationTimeTotal);
-          row.label = `${PrepareExaminationTimeMap[row.key]}; ${row.value}%`;
-          row.color = this.examinationTimeColors[index];
-          return row;
-        }),
-        scoreTime: result.stat.scoreTime.map((row, index) => {
-          row.value = formatPercent(row.value, scoreTimeTotal);
-          row.label = `${PrepareScoreTimeMap[row.key]}; ${row.value}%`;
-          row.color = this.scoreTimeColors[index];
-          return row;
-        }),
-      };
-      result.prepareGoal = result.prepareGoal || 650;
-      result.prepareScoreTime = result.prepareScoreTime ? moment(result.prepareScoreTime) : null;
-      this.setState({ data: result, stat, first: !result.prepareStatus, step: !result.prepareStatus ? 0 : 4 });
+    My.getPrepare()
+      .then(result => {
+        const statusTotal = result.stat.status.reduce((p, n) => { return p + n.value; }, 0);
+        const goalTotal = result.stat.goal.reduce((p, n) => { return p + n.value; }, 0);
+        const examinationTimeTotal = result.stat.examinationTime.reduce((p, n) => { return p + n.value; }, 0);
+        const scoreTimeTotal = result.stat.scoreTime.reduce((p, n) => { return p + n.value; }, 0);
+        const stat = {
+          status: result.stat.status.map((row, index) => {
+            row.value = formatPercent(row.value, statusTotal);
+            row.label = `${PrepareStatusMap[row.key]}; ${row.value}%`;
+            row.color = this.statusColors[index];
+            return row;
+          }),
+          goal: result.stat.goal.map((row, index) => {
+            row.value = formatPercent(row.value, goalTotal);
+            row.label = `${row.key}+; ${row.value}%`;
+            row.color = this.goalColors[index];
+            return row;
+          }),
+          examinationTime: result.stat.status.map((row, index) => {
+            row.value = formatPercent(row.value, examinationTimeTotal);
+            row.label = `${PrepareExaminationTimeMap[row.key]}; ${row.value}%`;
+            row.color = this.examinationTimeColors[index];
+            return row;
+          }),
+          scoreTime: result.stat.scoreTime.map((row, index) => {
+            row.value = formatPercent(row.value, scoreTimeTotal);
+            row.label = `${PrepareScoreTimeMap[row.key]}; ${row.value}%`;
+            row.color = this.scoreTimeColors[index];
+            return row;
+          }),
+        };
+        result.prepareGoal = result.prepareGoal || 650;
+        result.prepareScoreTime = result.prepareScoreTime ? moment(result.prepareScoreTime) : null;
+        this.setState({ data: result, stat, first: !result.prepareStatus, step: !result.prepareStatus ? 0 : 4 });
+      });
+    Main.getContract('register').then(() => {
+      this.setState({ link: { url: 'www', title: '了解出分时间信息>' } });
     });
   }
 
@@ -118,16 +115,22 @@ export default class extends Component {
     });
   }
 
+  onClose() {
+    const { onClose } = this.props;
+    if (onClose) onClose();
+    this.setState({ step: 0 });
+  }
+
   render() {
     const { step } = this.state;
-    const { show, onClose } = this.props;
+    const { show } = this.props;
     return (
       <Modal
         className="examination-modal"
         show={show}
         width={460}
         {...this.stepProp[step]}
-        onClose={() => onClose && onClose()}
+        onClose={() => this.onClose()}
       >
         <div className="examination-modal-wrapper">{this[`renderStep${step}`]()}</div>
       </Modal>
@@ -208,11 +211,13 @@ export default class extends Component {
   }
 
   renderStep3() {
-    const { data } = this.state;
+    const { data, link, step } = this.state;
     const { prepareScoreTime } = data;
     return (
       <div className="step-3-layout">
+        {link && <a href={link.url} className="a-l" target='_blank'>{link.title}</a>}
         <Date
+          show={step === 3}
           theme="filled"
           value={prepareScoreTime}
           onChange={date => {

+ 4 - 0
front/project/www/components/Examination/index.less

@@ -53,6 +53,10 @@
     .step-2-layout {}
 
     .step-3-layout {
+      .a-l {
+        position: absolute;
+        top: 30px;
+      }
 
       .button {
         padding-left: 30px;

+ 6 - 6
front/project/www/routes/my/course/page.js

@@ -53,7 +53,7 @@ export default class extends Page {
     };
   }
 
-  onAction() {}
+  onAction() { }
 
   refresh(tab1, tab2) {
     this.setState({ tab1, tab2 });
@@ -99,7 +99,7 @@ export default class extends Page {
           onChange={key => this.refresh(tab1, key)}
         />
         {this[`renderTab${tab1}`]()}
-        <Modal className="clock-modal" title="打卡表" width={460} onClose={() => {}}>
+        <Modal className="clock-modal" title="打卡表" width={460} onClose={() => { }}>
           <div>
             <div className="d-i-b w-3">
               <div className="t-2 t-s-14">听课频率</div>
@@ -147,10 +147,10 @@ export default class extends Page {
           />
           <div className="t-2 t-s-12">*听课频率≤2天/课时,作业完成度≥90%,课程有效期可延长7-10天。</div>
         </Modal>
-        <Modal title="恢复学习" onConfirm={() => {}} onCancel={() => {}}>
+        <Modal title="恢复学习" onConfirm={() => { }} onCancel={() => { }}>
           <div className="t-2 t-s-18">恢复学习后,本课程的停课功能将无法使用。是否恢复学习?</div>
         </Modal>
-        <Modal title="上传笔记" width={630} confirmText="提交" onConfirm={() => {}} onCancel={() => {}}>
+        <Modal title="上传笔记" width={630} confirmText="提交" onConfirm={() => { }} onCancel={() => { }}>
           <textarea
             className="b-c-1 w-10 p-10 m-b-1"
             rows={6}
@@ -401,10 +401,10 @@ class Education extends Component {
         <div className="class-hour">
           <div className="text">课时 5:解读句子属性</div>
           <div className="right">
-            <GIcon name="prev" onClick={() => {}} />
+            <GIcon name="prev" onClick={() => { }} />
             <span>上一课时</span>
             <span>下一课时</span>
-            <GIcon name="next" onClick={() => {}} />
+            <GIcon name="next" onClick={() => { }} />
           </div>
         </div>
         {tab === '1' ? this.renderTimeLine() : this.renderTable()}