소스 검색

add layout

KaysonCui 4 년 전
부모
커밋
56361e65e1

+ 1 - 1
front/config/local.json

@@ -48,4 +48,4 @@
     "H5Url": "http://h5.duoshaojiaoyu.com",
     "WechatH5AppId": "wxbee75af2ece94ed7"
   }
-}
+}

+ 1 - 1
front/project/www/app.js

@@ -23,7 +23,7 @@ export default class extends Component {
           </div>
         ) : (
           <div className={`${config.tab || ''}`} id="page">
-            <Header tabs={project.tabs} active={config.tab} />
+            <Header tabs={project.tabs} active={config.tab} {...this.props} />
             {children}
             <Login {...this.props} />
           </div>

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

@@ -3,15 +3,40 @@ import './index.less';
 import { DatePicker } from 'antd';
 
 export default class extends Component {
+  constructor(props) {
+    super(props);
+    this.state = { key: 0 };
+    this.loading = false;
+  }
+
+  dateRender(date) {
+    const { dateRender, checkRefresh } = this.props;
+    if (!this.loading && checkRefresh) {
+      if (checkRefresh(date, () => this.needRefresh())) {
+        this.loading = true;
+      }
+    }
+    if (dateRender) return dateRender(date);
+    return date.get('date');
+  }
+
+  needRefresh() {
+    this.setState({ key: this.state.key + 1 });
+    this.loading = false;
+    setTimeout(() => {
+      this.setState({ key: this.state.key + 1 });
+    }, 1);
+  }
+
   render() {
-    const { hideInput, dateRender, disabledDate } = this.props;
+    const { hideInput, disabledDate } = this.props;
     return (
       <div className={`g-date-block ${hideInput ? 'hide-input' : ''}`}>
         <DatePicker
           open
           dropdownClassName={`g-date ${hideInput ? 'hide-input' : ''}`}
           disabledDate={disabledDate}
-          dateRender={dateRender}
+          dateRender={date => this.dateRender(date)}
         />
       </div>
     );

+ 5 - 0
front/project/www/components/Date/index.less

@@ -88,6 +88,7 @@
 }
 
 .g-date.hide-input {
+
   .ant-calendar-input-wrap {
     display: none;
   }
@@ -95,6 +96,10 @@
 
 .g-date-block {
   height: 500px;
+
+  .ant-calendar-picker {
+    opacity: 0;
+  }
 }
 
 .g-date-block.hide-input {

+ 15 - 4
front/project/www/components/Header/index.js

@@ -6,7 +6,7 @@ import './index.less';
 import { User } from '../../stores/user';
 
 function Header(props) {
-  const { tabs = [], active } = props;
+  const { tabs = [], active, user } = props;
   return (
     <div id="header">
       <div className="body">
@@ -25,9 +25,20 @@ function Header(props) {
           </div>
         </div>
         <div className="right">
-          <Button onClick={() => {
-            User.needLogin();
-          }}>登录</Button>
+          {user.login ? (
+            <Link to="/my/main" className="info">
+              <Assets src={user.info.avatar} />
+              <span className="t-2 f-s-12">{user.info.nickname}</span>
+            </Link>
+          ) : (
+            <Button
+              onClick={() => {
+                User.needLogin();
+              }}
+            >
+              登录
+            </Button>
+          )}
         </div>
       </div>
     </div>

+ 13 - 0
front/project/www/components/Header/index.less

@@ -76,6 +76,19 @@
       padding: 5px 22px;
       line-height: 20px;
     }
+
+    .info {
+      line-height: 24px;
+
+      .assets {
+        margin-right: 5px;
+        width: 24px;
+        height: 24px;
+        border-radius: 50%;
+      }
+
+      span {}
+    }
   }
 }
 

+ 6 - 3
front/project/www/components/IconButton/index.js

@@ -7,9 +7,12 @@ function IconButton(props) {
   const { className, type, tip, onClick } = props;
   return (
     <Tooltip placement="top" title={tip}>
-      <div className={`icon-button ${className}`} onClick={() => {
-        if (onClick) onClick();
-      }}>
+      <div
+        className={`icon-button ${className || ''}`}
+        onClick={() => {
+          if (onClick) onClick();
+        }}
+      >
         <Assets name={`ico_24_${type}`} svg />
       </div>
     </Tooltip>

+ 4 - 2
front/project/www/components/ListTable/index.less

@@ -53,8 +53,10 @@
       padding: 0 44px;
 
       .td {
-        height: 78px;
-        padding-top: 15px;
+        >div {
+          height: 78px;
+          padding: 15px 0;
+        }
       }
     }
   }

+ 5 - 2
front/project/www/components/Table/index.js

@@ -8,7 +8,7 @@ function Table(props) {
       <div className="tr">
         {columns.map(column => {
           return (
-            <div style={{ width: column.width, textAlign: column.align }} className={`th ${column.className}`}>
+            <div style={{ width: column.width, textAlign: column.align }} className={`th ${column.className || ''}`}>
               {column.title}
             </div>
           );
@@ -20,7 +20,10 @@ function Table(props) {
           <div className="tr">
             {columns.map(column => {
               return (
-                <div style={{ width: column.width, textAlign: column.align }} className={`td ${column.className}`}>
+                <div
+                  style={{ width: column.width, textAlign: column.align }}
+                  className={`td ${column.className || ''}`}
+                >
                   {column.render ? column.render(row, row[column.key]) : row[column.key]}
                 </div>
               );

+ 11 - 2
front/project/www/components/Tabs/index.js

@@ -16,9 +16,18 @@ function getItem(props, item, onChange) {
 }
 
 function Tabs(props) {
-  const { tabs = [], size = 'basic', type = 'line', theme = 'default', border, space, onChange } = props;
+  const {
+    className = '',
+    tabs = [],
+    size = 'basic',
+    type = 'line',
+    theme = 'default',
+    border,
+    space,
+    onChange,
+  } = props;
   return (
-    <div className={`tabs ${type} ${theme} ${size} ${border ? 'border' : ''}`}>
+    <div className={`tabs ${className} ${type} ${theme} ${size} ${border ? 'border' : ''}`}>
       <div className="tabs-warpper" style={{ marginLeft: space * -1 || '', marginRight: space * -1 || '' }}>
         {tabs.map(item => {
           return item.path ? <Link to={item.path}>{getItem(props, item)}</Link> : getItem(props, item, onChange);

+ 4 - 8
front/project/www/local.json

@@ -7,20 +7,16 @@
     ],
     "proxy": [
       {
-        "target": "http://127.0.0.1:8888",
+        "target": "http://qianxing.nuliji.com",
         "from": "/api",
         "to": "/api"
       }
     ]
   },
   "test": {
-    "scripts": [
-      "http://res.wx.qq.com/connect/zh_CN/htmledition/js/wxLogin.js"
-    ]
+    "scripts": ["http://res.wx.qq.com/connect/zh_CN/htmledition/js/wxLogin.js"]
   },
   "production": {
-    "scripts": [
-      "http://res.wx.qq.com/connect/zh_CN/htmledition/js/wxLogin.js"
-    ]
+    "scripts": ["http://res.wx.qq.com/connect/zh_CN/htmledition/js/wxLogin.js"]
   }
-}
+}

+ 571 - 357
front/project/www/routes/examination/list/page.js

@@ -11,373 +11,568 @@ import Button from '../../../components/Button';
 import { Main } from '../../../stores/main';
 import { Question } from '../../../stores/question';
 
-
 export default class extends Page {
   initState() {
-    this.qxCatColumns = [{
-      title: '模考',
-      width: 250,
-      align: 'left',
-      render: (record) => {
-        let progress = 0;
-        if (record.report) {
-          progress = formatPercent(record.report.userNumber, record.report.questionNumber);
-        }
-        return (
-          <div className="table-row">
-            <div className="night f-s-16">{record.title}{record.paper && record.paper.paperNo > 0 ? String.fromCharCode(64 + record.paper.paperNo) : ''}</div>
-            <div>
-              <ProgressText progress={progress} size="small" />
-            </div>
-            {this.state.showPrev && <div className="prev">
-              <div className="night f-s-16">{record.title}{record.prevPaper && record.prevPaper.paperNo > 0 ? String.fromCharCode(64 + record.prevPaper.paperNo) : ''}</div>
-            </div>}
-          </div>
-        );
+    this.qxCatColumns = [
+      {
+        title: '模考',
+        width: 210,
+        align: 'left',
+        render: record => {
+          let progress = 0;
+          if (record.report) {
+            progress = formatPercent(record.report.userNumber, record.report.questionNumber);
+          }
+          return [
+            <div className="table-row" style={{ paddingRight: 40 }}>
+              <div className="night f-s-16">
+                {record.title}
+                {record.paper && record.paper.paperNo > 0 ? String.fromCharCode(64 + record.paper.paperNo) : ''}
+              </div>
+              <div>
+                <ProgressText progress={progress} size="small" />
+              </div>
+              {this.state.showPrev && (
+                <div className="prev">
+                  <div className="night f-s-16">
+                    {record.title}
+                    {record.prevPaper && record.prevPaper.paperNo > 0
+                      ? String.fromCharCode(64 + record.prevPaper.paperNo)
+                      : ''}
+                  </div>
+                </div>
+              )}
+            </div>,
+            <div className="table-row" style={{ paddingRight: 40 }}>
+              <div className="night f-s-16">
+                {record.title}
+                {record.paper && record.paper.paperNo > 0 ? String.fromCharCode(64 + record.paper.paperNo) : ''}
+              </div>
+              <div>
+                <ProgressText progress={progress} size="small" />
+              </div>
+              {this.state.showPrev && (
+                <div className="prev">
+                  <div className="night f-s-16">
+                    {record.title}
+                    {record.prevPaper && record.prevPaper.paperNo > 0
+                      ? String.fromCharCode(64 + record.prevPaper.paperNo)
+                      : ''}
+                  </div>
+                </div>
+              )}
+            </div>,
+          ];
+        },
       },
-    }, {
-      title: 'Total',
-      width: 150,
-      align: 'left',
-      render: (record) => {
-        return (
-          <div className="table-row">
-            <div className="night f-s-16 f-w-b">{record.report ? `${record.report.score.totalScore}分${record.report.score.totalRank}th` : '-分-th'}</div>
-            <div className="f-s-12">全站: {Math.round(record.totalScore / record.totalTimes)}分</div>
-            {this.state.showPrev && record.prevReport && <div className="prev">
-              <div className="night f-s-16 f-w-b">{record.prevReport.score.totalScore}分{record.prevReport.score.totalRank}th</div>
-              <div className="f-s-12">全站: {Math.round(record.secondTotalScore / record.secondTotalTimes)}分</div>
-            </div>}
-          </div>
-        );
+      {
+        title: 'Total',
+        width: 110,
+        align: 'left',
+        render: record => {
+          return [
+            <div className="table-row">
+              <div className="night f-s-16 f-w-b">
+                {record.report ? `${record.report.score.totalScore}分${record.report.score.totalRank}th` : '-分-th'}
+              </div>
+              <div className="f-s-12">全站: {Math.round(record.totalScore / record.totalTimes)}分</div>
+              {this.state.showPrev && record.prevReport && (
+                <div className="prev">
+                  <div className="night f-s-16 f-w-b">
+                    {record.prevReport.score.totalScore}分{record.prevReport.score.totalRank}th
+                  </div>
+                  <div className="f-s-12">全站: {Math.round(record.secondTotalScore / record.secondTotalTimes)}分</div>
+                </div>
+              )}
+            </div>,
+            <div className="table-row">
+              <div className="night f-s-16 f-w-b">
+                {record.report ? `${record.report.score.totalScore}分${record.report.score.totalRank}th` : '-分-th'}
+              </div>
+              <div className="f-s-12">全站: {Math.round(record.totalScore / record.totalTimes)}分</div>
+              {this.state.showPrev && record.prevReport && (
+                <div className="prev">
+                  <div className="night f-s-16 f-w-b">
+                    {record.prevReport.score.totalScore}分{record.prevReport.score.totalRank}th
+                  </div>
+                  <div className="f-s-12">全站: {Math.round(record.secondTotalScore / record.secondTotalTimes)}分</div>
+                </div>
+              )}
+            </div>,
+          ];
+        },
       },
-    }, {
-      title: 'Verbal',
-      width: 150,
-      align: 'left',
-      render: (record) => {
-        return (
-          <div className="table-row">
-            <div className="night f-s-16 f-w-b">{record.report ? `${record.report.score.verbalScore}分${record.report.score.verbalRank}th` : '-分-th'}</div>
-            <div className="f-s-12">全站: {Math.round(record.verbalScore / record.totalTimes)}分</div>
-            {this.state.showPrev && record.prevReport && <div className="prev">
-              <div className="night f-s-16 f-w-b">{record.prevReport.score.verbalScore}分{record.prevReport.score.verbalRank}th</div>
-              <div className="f-s-12">全站: {Math.round(record.secondVerbalScore / record.secondTotalTimes)}分</div>
-            </div>}
-          </div>
-        );
+      {
+        title: 'Verbal',
+        width: 110,
+        align: 'left',
+        render: record => {
+          return (
+            <div className="table-row">
+              <div className="night f-s-16 f-w-b">
+                {record.report ? `${record.report.score.verbalScore}分${record.report.score.verbalRank}th` : '-分-th'}
+              </div>
+              <div className="f-s-12">全站: {Math.round(record.verbalScore / record.totalTimes)}分</div>
+              {this.state.showPrev && record.prevReport && (
+                <div className="prev">
+                  <div className="night f-s-16 f-w-b">
+                    {record.prevReport.score.verbalScore}分{record.prevReport.score.verbalRank}th
+                  </div>
+                  <div className="f-s-12">全站: {Math.round(record.secondVerbalScore / record.secondTotalTimes)}分</div>
+                </div>
+              )}
+            </div>
+          );
+        },
       },
-    }, {
-      title: 'Quant',
-      width: 150,
-      align: 'left',
-      render: (record) => {
-        return (
-          <div className="table-row">
-            <div className="night f-s-16 f-w-b">{record.report ? `${record.report.score.quantScore}分${record.report.score.quantRank}th` : '-分-th'}</div>
-            <div className="f-s-12">全站: {Math.round(record.quantScore / record.totalTimes)}分</div>
-            {this.state.showPrev && record.prevReport && <div className="prev">
-              <div className="night f-s-16 f-w-b">{record.prevReport.score.quantScore}分{record.prevReport.score.quantRank}th</div>
-              <div className="f-s-12">全站: {Math.round(record.secondQuantScore / record.secondTotalTimes)}分</div>
-            </div>}
-          </div>
-        );
+      {
+        title: 'Quant',
+        width: 110,
+        align: 'left',
+        render: record => {
+          return (
+            <div className="table-row">
+              <div className="night f-s-16 f-w-b">
+                {record.report ? `${record.report.score.quantScore}分${record.report.score.quantRank}th` : '-分-th'}
+              </div>
+              <div className="f-s-12">全站: {Math.round(record.quantScore / record.totalTimes)}分</div>
+              {this.state.showPrev && record.prevReport && (
+                <div className="prev">
+                  <div className="night f-s-16 f-w-b">
+                    {record.prevReport.score.quantScore}分{record.prevReport.score.quantRank}th
+                  </div>
+                  <div className="f-s-12">全站: {Math.round(record.secondQuantScore / record.secondTotalTimes)}分</div>
+                </div>
+              )}
+            </div>
+          );
+        },
       },
-    }, {
-      title: 'IR',
-      width: 150,
-      align: 'left',
-      render: (record) => {
-        return (
-          <div className="table-row">
-            <div className="night f-s-16 f-w-b">{record.report ? `${record.report.score.irScore}分${record.report.score.irRank}th` : '-分-th'}</div>
-            <div className="f-s-12">全站: {Math.round(record.irScore / record.totalTimes)}分</div>
-            {this.state.showPrev && record.prevReport && <div className="prev">
-              <div className="night f-s-16 f-w-b">{record.prevReport.score.irScore}分{record.prevReport.score.irRank}th</div>
-              <div className="f-s-12">全站: {Math.round(record.secondIrScore / record.secondTotalTimes)}分</div>
-            </div>}
-          </div>
-        );
+      {
+        title: 'IR',
+        width: 110,
+        align: 'left',
+        render: record => {
+          return (
+            <div className="table-row">
+              <div className="night f-s-16 f-w-b">
+                {record.report ? `${record.report.score.irScore}分${record.report.score.irRank}th` : '-分-th'}
+              </div>
+              <div className="f-s-12">全站: {Math.round(record.irScore / record.totalTimes)}分</div>
+              {this.state.showPrev && record.prevReport && (
+                <div className="prev">
+                  <div className="night f-s-16 f-w-b">
+                    {record.prevReport.score.irScore}分{record.prevReport.score.irRank}th
+                  </div>
+                  <div className="f-s-12">全站: {Math.round(record.secondIrScore / record.secondTotalTimes)}分</div>
+                </div>
+              )}
+            </div>
+          );
+        },
       },
-    }, {
-      title: '做题时间',
-      width: 150,
-      align: 'left',
-      render: (record) => {
-        return (
-          <div className="table-row">
-            <div>{record.report && formatDate(record.report.updateTime, 'YYYY-MM-DD')}</div>
-            <div>{record.report && formatDate(record.report.updateTime, 'HH:mm')}</div>
-            {this.state.showPrev && record.prevReport && <div className="prev">
-              <div>{formatDate(record.prevReport.updateTime, 'YYYY-MM-DD')}</div>
-              <div>{formatDate(record.prevReport.updateTime, 'HH:mm')}</div>
-            </div>}
-          </div>
-        );
+      {
+        title: '做题时间',
+        width: 100,
+        align: 'left',
+        render: record => {
+          return (
+            <div className="table-row">
+              <div>{record.report && formatDate(record.report.updateTime, 'YYYY-MM-DD')}</div>
+              <div>{record.report && formatDate(record.report.updateTime, 'HH:mm')}</div>
+              {this.state.showPrev && record.prevReport && (
+                <div className="prev">
+                  <div>{formatDate(record.prevReport.updateTime, 'YYYY-MM-DD')}</div>
+                  <div>{formatDate(record.prevReport.updateTime, 'HH:mm')}</div>
+                </div>
+              )}
+            </div>
+          );
+        },
       },
-    }, {
-      title: '操作',
-      width: 180,
-      align: 'left',
-      render: (record) => {
-        return (
-          <div className="table-row p-t-1">
-            {!record.report && <IconButton type="start" tip="Start" onClick={() => {
-              Question.startLink('examination', record);
-            }} />}
-            {(record.report && !record.report.isFinish) && <IconButton className="m-r-2" type="continue" tip="Continue" onClick={() => {
-              Question.continueLink('examination', record);
-            }} />}
-          </div>
-        );
+      {
+        title: '操作',
+        width: 110,
+        align: 'left',
+        render: record => {
+          return (
+            <div className="table-row p-t-1">
+              {!record.report && (
+                <IconButton
+                  className="m-r-5"
+                  type="start"
+                  tip="Start"
+                  onClick={() => {
+                    Question.startLink('examination', record);
+                  }}
+                />
+              )}
+              {record.report && !record.report.isFinish && (
+                <IconButton
+                  type="continue"
+                  tip="Continue"
+                  onClick={() => {
+                    Question.continueLink('examination', record);
+                  }}
+                />
+              )}
+            </div>
+          );
+        },
       },
-    }, {
-      title: '报告',
-      width: 30,
-      align: 'right',
-      render: (record) => {
-        return (
-          <div className="table-row p-t-1">
-            {record.report && record.report.isFinish && <IconButton type="report" tip="Report" onClick={() => {
-              Question.reportLink(record);
-            }} />}
-            {this.state.showPrev && <div className="prev">
-              {record.prevReport && <IconButton type="report" tip="Report" onClick={() => {
-                Question.reportPrevLink(record);
-              }} />}
-            </div>}
-          </div>
-        );
+      {
+        title: '报告',
+        width: 50,
+        align: 'right',
+        render: record => {
+          return (
+            <div className="table-row p-t-1">
+              {record.report && record.report.isFinish && (
+                <IconButton
+                  className="m-r-5"
+                  type="report"
+                  tip="Report"
+                  onClick={() => {
+                    Question.reportLink(record);
+                  }}
+                />
+              )}
+              {this.state.showPrev && (
+                <div className="prev">
+                  {record.prevReport && (
+                    <IconButton
+                      type="report"
+                      tip="Report"
+                      onClick={() => {
+                        Question.reportPrevLink(record);
+                      }}
+                    />
+                  )}
+                </div>
+              )}
+            </div>
+          );
+        },
       },
-    }];
-    this.catColumns = [{
-      title: '模考',
-      width: 250,
-      align: 'left',
-      render: (record) => {
-        let progress = 0;
-        if (record.report) {
-          progress = formatPercent(record.report.userNumber, record.report.questionNumber);
-        }
-        return (
-          <div className="table-row">
-            <div className="night f-s-16">{record.title}{record.paper && record.paper.paperNo > 0 ? String.fromCharCode(64 + record.paper.paperNo) : ''}</div>
-            <div>
-              <ProgressText progress={progress} size="small" />
+    ];
+    this.catColumns = [
+      {
+        title: '模考',
+        width: 210,
+        align: 'left',
+        render: record => {
+          let progress = 0;
+          if (record.report) {
+            progress = formatPercent(record.report.userNumber, record.report.questionNumber);
+          }
+          return (
+            <div className="table-row">
+              <div className="night f-s-16">
+                {record.title}
+                {record.paper && record.paper.paperNo > 0 ? String.fromCharCode(64 + record.paper.paperNo) : ''}
+              </div>
+              <div>
+                <ProgressText progress={progress} size="small" />
+              </div>
             </div>
-          </div>
-        );
+          );
+        },
       },
-    }, {
-      title: 'Total',
-      width: 150,
-      align: 'left',
-      render: (record) => {
-        return (
-          <div className="table-row">
-            <div className="night f-s-16 f-w-b">{record.report ? `${record.report.score.totalScore}分${record.report.score.totalRank}th` : '-分-th'}</div>
-            <div className="f-s-12">全站: {Math.round(record.totalScore / record.totalTimes)}分</div>
-          </div>
-        );
+      {
+        title: 'Total',
+        width: 110,
+        align: 'left',
+        render: record => {
+          return (
+            <div className="table-row">
+              <div className="night f-s-16 f-w-b">
+                {record.report ? `${record.report.score.totalScore}分${record.report.score.totalRank}th` : '-分-th'}
+              </div>
+              <div className="f-s-12">全站: {Math.round(record.totalScore / record.totalTimes)}分</div>
+            </div>
+          );
+        },
       },
-    }, {
-      title: 'Verbal',
-      width: 150,
-      align: 'left',
-      render: (record) => {
-        return (
-          <div className="table-row">
-            <div className="night f-s-16 f-w-b">{record.report ? `${record.report.score.verbalScore}分${record.report.score.verbalRank}th` : '-分-th'}</div>
-            <div className="f-s-12">全站: {Math.round(record.verbalScore / record.totalTimes)}分</div>
-          </div>
-        );
+      {
+        title: 'Verbal',
+        width: 110,
+        align: 'left',
+        render: record => {
+          return (
+            <div className="table-row">
+              <div className="night f-s-16 f-w-b">
+                {record.report ? `${record.report.score.verbalScore}分${record.report.score.verbalRank}th` : '-分-th'}
+              </div>
+              <div className="f-s-12">全站: {Math.round(record.verbalScore / record.totalTimes)}分</div>
+            </div>
+          );
+        },
       },
-    }, {
-      title: 'Quant',
-      width: 150,
-      align: 'left',
-      render: (record) => {
-        return (
-          <div className="table-row">
-            <div className="night f-s-16 f-w-b">{record.report ? `${record.report.score.quantScore}分${record.report.score.quantRank}th` : '-分-th'}</div>
-            <div className="f-s-12">全站: {Math.round(record.quantScore / record.totalTimes)}分</div>
-          </div>
-        );
+      {
+        title: 'Quant',
+        width: 110,
+        align: 'left',
+        render: record => {
+          return (
+            <div className="table-row">
+              <div className="night f-s-16 f-w-b">
+                {record.report ? `${record.report.score.quantScore}分${record.report.score.quantRank}th` : '-分-th'}
+              </div>
+              <div className="f-s-12">全站: {Math.round(record.quantScore / record.totalTimes)}分</div>
+            </div>
+          );
+        },
       },
-    }, {
-      title: 'IR',
-      width: 150,
-      align: 'left',
-      render: (record) => {
-        return (
-          <div className="table-row">
-            <div className="night f-s-16 f-w-b">{record.report ? `${record.report.score.irScore}分${record.report.score.irRank}th` : '-分-th'}</div>
-            <div className="f-s-12">全站: {Math.round(record.irScore / record.totalTimes)}分</div>
-          </div>
-        );
+      {
+        title: 'IR',
+        width: 110,
+        align: 'left',
+        render: record => {
+          return (
+            <div className="table-row">
+              <div className="night f-s-16 f-w-b">
+                {record.report ? `${record.report.score.irScore}分${record.report.score.irRank}th` : '-分-th'}
+              </div>
+              <div className="f-s-12">全站: {Math.round(record.irScore / record.totalTimes)}分</div>
+            </div>
+          );
+        },
       },
-    }, {
-      title: '做题时间',
-      width: 150,
-      align: 'left',
-      render: (record) => {
-        return (
-          <div className="table-row">
-            <div>{record.report && formatDate(record.report.updateTime, 'YYYY-MM-DD')}</div>
-            <div>{record.report && formatDate(record.report.updateTime, 'HH:mm')}</div>
-          </div>
-        );
+      {
+        title: '做题时间',
+        width: 100,
+        align: 'left',
+        render: record => {
+          return (
+            <div className="table-row">
+              <div>{record.report && formatDate(record.report.updateTime, 'YYYY-MM-DD')}</div>
+              <div>{record.report && formatDate(record.report.updateTime, 'HH:mm')}</div>
+            </div>
+          );
+        },
       },
-    }, {
-      title: '操作',
-      width: 180,
-      align: 'left',
-      render: (record) => {
-        return (
-          <div className="table-row p-t-1">
-            {!record.report && <IconButton type="start" tip="Start" onClick={() => {
-              Question.startLink('examination', record);
-            }} />}
-            {(record.report && !record.report.isFinish) && <IconButton className="m-r-2" type="continue" tip="Continue" onClick={() => {
-              Question.continueLink('examination', record);
-            }} />}
-            <IconButton type="restart" tip="Restart" onClick={() => {
-              this.restart(record);
-            }} />
-          </div>
-        );
+      {
+        title: '操作',
+        width: 110,
+        align: 'left',
+        render: record => {
+          return (
+            <div className="table-row p-t-1">
+              {!record.report && (
+                <IconButton
+                  type="start"
+                  tip="Start"
+                  onClick={() => {
+                    Question.startLink('examination', record);
+                  }}
+                />
+              )}
+              {record.report && !record.report.isFinish && (
+                <IconButton
+                  className="m-r-2"
+                  type="continue"
+                  tip="Continue"
+                  onClick={() => {
+                    Question.continueLink('examination', record);
+                  }}
+                />
+              )}
+              <IconButton
+                type="restart"
+                tip="Restart"
+                onClick={() => {
+                  this.restart(record);
+                }}
+              />
+            </div>
+          );
+        },
       },
-    }, {
-      title: '报告',
-      width: 30,
-      align: 'right',
-      render: (record) => {
-        return (
-          <div className="table-row p-t-1">
-            {record.report && record.report.isFinish && <IconButton type="report" tip="Report" onClick={() => {
-              Question.reportLink(record);
-            }} />}
-            {this.state.showPrev && <div className="prev">
-              {record.prevReport && <IconButton type="report" tip="Report" onClick={() => {
-                Question.reportPrevLink(record);
-              }} />}
-            </div>}
-          </div>
-        );
+      {
+        title: '报告',
+        width: 50,
+        align: 'right',
+        render: record => {
+          return (
+            <div className="table-row p-t-1">
+              {record.report && record.report.isFinish && (
+                <IconButton
+                  type="report"
+                  tip="Report"
+                  onClick={() => {
+                    Question.reportLink(record);
+                  }}
+                />
+              )}
+              {this.state.showPrev && (
+                <div className="prev">
+                  {record.prevReport && (
+                    <IconButton
+                      type="report"
+                      tip="Report"
+                      onClick={() => {
+                        Question.reportPrevLink(record);
+                      }}
+                    />
+                  )}
+                </div>
+              )}
+            </div>
+          );
+        },
       },
-    }];
-    this.columns = [{
-      title: '模考',
-      width: 250,
-      align: 'left',
-      render: (record) => {
-        let progress = 0;
-        if (record.report) {
-          progress = formatPercent(record.report.userNumber, record.report.questionNumber);
-        }
-        return (
-          <div className="table-row">
-            <div className="night f-s-16">{record.title}</div>
-            <div>
-              <ProgressText progress={progress} times={record.paper ? record.paper.times : 0} size="small" />
+    ];
+    this.columns = [
+      {
+        title: '模考',
+        width: 210,
+        align: 'left',
+        render: record => {
+          let progress = 0;
+          if (record.report) {
+            progress = formatPercent(record.report.userNumber, record.report.questionNumber);
+          }
+          return (
+            <div className="table-row">
+              <div className="night f-s-16">{record.title}</div>
+              <div>
+                <ProgressText progress={progress} times={record.paper ? record.paper.times : 0} size="small" />
+              </div>
             </div>
-          </div>
-        );
+          );
+        },
       },
-    }, {
-      title: 'Total',
-      width: 150,
-      align: 'left',
-      render: () => {
-        return (
-          <div className="table-row">
-            <div className="f-s-12">仅CAT模考</div>
-          </div>
-        );
+      {
+        title: 'Total',
+        width: 110,
+        align: 'left',
+        render: () => {
+          return (
+            <div className="table-row">
+              <div className="f-s-12">仅CAT模考</div>
+            </div>
+          );
+        },
       },
-    }, {
-      title: 'Verbal',
-      width: 150,
-      align: 'left',
-      render: (record) => {
-        return (
-          <div className="table-row">
-            <div className="f-s-12">{record.report ? formatPercent(record.report.setting.number.verbal, this.nums.verbal.number, false) : '0%'}</div>
-          </div>
-        );
+      {
+        title: 'Verbal',
+        width: 110,
+        align: 'left',
+        render: record => {
+          return (
+            <div className="table-row">
+              <div className="f-s-12">
+                {record.report
+                  ? formatPercent(record.report.setting.number.verbal, this.nums.verbal.number, false)
+                  : '0%'}
+              </div>
+            </div>
+          );
+        },
       },
-    }, {
-      title: 'Quant',
-      width: 150,
-      align: 'left',
-      render: (record) => {
-        return (
-          <div className="table-row">
-            <div className="f-s-12">{record.report ? formatPercent(record.report.setting.number.quant, this.nums.quant.number, false) : '0%'}</div>
-          </div>
-        );
+      {
+        title: 'Quant',
+        width: 110,
+        align: 'left',
+        render: record => {
+          return (
+            <div className="table-row">
+              <div className="f-s-12">
+                {record.report
+                  ? formatPercent(record.report.setting.number.quant, this.nums.quant.number, false)
+                  : '0%'}
+              </div>
+            </div>
+          );
+        },
       },
-    }, {
-      title: 'IR',
-      width: 150,
-      align: 'left',
-      render: (record) => {
-        return (
-          <div className="table-row">
-            <div className="f-s-12">{record.report ? formatPercent(record.report.setting.number.ir, this.nums.ir.number, false) : '0%'}</div>
-          </div>
-        );
+      {
+        title: 'IR',
+        width: 110,
+        align: 'left',
+        render: record => {
+          return (
+            <div className="table-row">
+              <div className="f-s-12">
+                {record.report ? formatPercent(record.report.setting.number.ir, this.nums.ir.number, false) : '0%'}
+              </div>
+            </div>
+          );
+        },
       },
-    }, {
-      title: '做题时间',
-      width: 150,
-      align: 'left',
-      render: (record) => {
-        if (!record.report) return null;
-        return (
-          <div className="table-row">
-            <div>{formatDate(record.report.updateTime, 'YYYY-MM-DD')}</div>
-            <div>{formatDate(record.report.updateTime, 'HH:mm')}</div>
-          </div>
-        );
+      {
+        title: '做题时间',
+        width: 100,
+        align: 'left',
+        render: record => {
+          if (!record.report) return null;
+          return (
+            <div className="table-row">
+              <div>{formatDate(record.report.updateTime, 'YYYY-MM-DD')}</div>
+              <div>{formatDate(record.report.updateTime, 'HH:mm')}</div>
+            </div>
+          );
+        },
       },
-    }, {
-      title: '操作',
-      width: 180,
-      align: 'left',
-      render: (record) => {
-        return (
-          <div className="table-row p-t-1">
-            {!record.report && <IconButton type="start" tip="Start" onClick={() => {
-              Question.startLink('examination', record);
-            }} />}
-            {(record.report && !record.report.isFinish) && <IconButton className="m-r-2" type="continue" tip="Continue" onClick={() => {
-              Question.continueLink('examination', record);
-            }} />}
-            <IconButton type="restart" tip="Restart" onClick={() => {
-              this.restart(record);
-            }} />
-          </div>
-        );
+      {
+        title: '操作',
+        width: 110,
+        align: 'left',
+        render: record => {
+          return (
+            <div className="table-row p-t-1">
+              {!record.report && (
+                <IconButton
+                  type="start"
+                  tip="Start"
+                  onClick={() => {
+                    Question.startLink('examination', record);
+                  }}
+                />
+              )}
+              {record.report && !record.report.isFinish && (
+                <IconButton
+                  className="m-r-2"
+                  type="continue"
+                  tip="Continue"
+                  onClick={() => {
+                    Question.continueLink('examination', record);
+                  }}
+                />
+              )}
+              <IconButton
+                type="restart"
+                tip="Restart"
+                onClick={() => {
+                  this.restart(record);
+                }}
+              />
+            </div>
+          );
+        },
       },
-    }, {
-      title: '报告',
-      width: 30,
-      align: 'right',
-      render: (record) => {
-        if (!record.report || !record.report.isFinish) return null;
-        return (
-          <div className="table-row p-t-1">
-            <IconButton type="report" tip="Report" onClick={() => {
-              Question.reportLink(record);
-            }} />
-          </div>
-        );
+      {
+        title: '报告',
+        width: 50,
+        align: 'right',
+        render: record => {
+          if (!record.report || !record.report.isFinish) return null;
+          return (
+            <div className="table-row p-t-1">
+              <IconButton
+                type="report"
+                tip="Report"
+                onClick={() => {
+                  Question.reportLink(record);
+                }}
+              />
+            </div>
+          );
+        },
       },
-    }];
+    ];
     this.inited = false;
-    return {
-    };
+    return {};
   }
 
   init() {
@@ -406,7 +601,7 @@ export default class extends Page {
 
   refreshData() {
     if (this.cat) {
-      Question.getExaminationInfo().then((result) => {
+      Question.getExaminationInfo().then(result => {
         this.setState({ examination: result });
       });
     }
@@ -415,7 +610,7 @@ export default class extends Page {
 
   refreshExamination() {
     Question.getExaminationList(Object.assign({ structId: this.params.id }, this.state.search))
-      .then((result) => {
+      .then(result => {
         this.setState({ list: result.list, total: result.total });
       })
       .catch(err => {
@@ -453,23 +648,42 @@ export default class extends Page {
             })}
           </Breadcrumb>
           <ListTable
-            rightAction={<div hidden={!this.qxCat}>
-              <span>有效期至:{examination.expireTime && formatDate(examination.expireTime, 'YYYY-MM-DD')}</span>
-              {examination.reset && <span>第一遍模考成绩<Switch checked={this.state.showPrev} onChange={() => {
-                this.setState({ showPrev: !this.state.showPrev });
-              }} /></span>}
-              {!examination.reset && examination.canReset && <Button size="small" radius onClick={() => {
-                this.resetExamination();
-              }}>
-                Reset</Button>}
-              {!examination.reset && !examination.canReset && <Tooltip overlayClassName="gray" placement="top" title="全部模考做完才可重置">
-                <a>
-                  <Button size="small" disabled radius>
+            rightAction={
+              <div hidden={!this.qxCat}>
+                <span>有效期至:{examination.expireTime && formatDate(examination.expireTime, 'YYYY-MM-DD')}</span>
+                {examination.reset && (
+                  <span>
+                    第一遍模考成绩
+                    <Switch
+                      checked={this.state.showPrev}
+                      onChange={() => {
+                        this.setState({ showPrev: !this.state.showPrev });
+                      }}
+                    />
+                  </span>
+                )}
+                {!examination.reset && examination.canReset && (
+                  <Button
+                    size="small"
+                    radius
+                    onClick={() => {
+                      this.resetExamination();
+                    }}
+                  >
                     Reset
                   </Button>
-                </a >
-              </Tooltip>}
-            </div>}
+                )}
+                {!examination.reset && !examination.canReset && (
+                  <Tooltip overlayClassName="gray" placement="top" title="全部模考做完才可重置">
+                    <a>
+                      <Button size="small" disabled radius>
+                        Reset
+                      </Button>
+                    </a>
+                  </Tooltip>
+                )}
+              </div>
+            }
             filters={[
               {
                 type: 'radio',
@@ -488,8 +702,8 @@ export default class extends Page {
                 },
               },
             ]}
-            data={list}
-            columns={this.qxCat ? this.qxCatColumns : (this.cat ? this.catColumns : this.columns)}
+            data={[{}, {}, {}] || list}
+            columns={this.qxCatColumns}
           />
         </div>
       </div>

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

@@ -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 show className="clock-modal" title="打卡表" width={460} onClose={() => {}}>
           <div>
             <div className="d-i-b w-3">
               <div className="t-2 t-s-14">听课频率</div>
@@ -128,13 +128,22 @@ export default class extends Page {
           <Date
             hideInput
             disabledDate={() => false}
-            dateRender={current => (
-              <div className="ant-calendar-date">
-                {current.get('date')}
-                <i className="s1" style={{ background: '#6865FD' }} />
-                <i className="s2" style={{ background: '#4299FF' }} />
-              </div>
-            )}
+            dateRender={current => {
+              return (
+                <div className="ant-calendar-date">
+                  {current.get('date')}
+                  <i className="s1" style={{ background: '#6865FD' }} />
+                  <i className="s2" style={{ background: '#4299FF' }} />
+                </div>
+              );
+            }}
+            checkRefresh={(date, refresh) => {
+              console.log(date);
+              setTimeout(() => {
+                refresh();
+              }, 2000);
+              return true;
+            }}
           />
           <div className="t-2 t-s-12">*听课频率≤2天/课时,作业完成度≥90%,课程有效期可延长7-10天。</div>
         </Modal>

+ 9 - 2
front/project/www/routes/my/error/page.js

@@ -110,9 +110,14 @@ export default class extends Page {
           selectList={[
             {
               label: '123',
+              key: 'one',
+              select: [{ title: '123', key: '1' }, { title: '123', key: '2' }, { title: '123', key: '2' }],
+            },
+            {
+              label: '123',
               children: [
                 {
-                  key: 'one',
+                  key: '3',
                   default: '1',
                   select: [{ title: '123', key: '1' }, { title: '123', key: '2' }, { title: '123', key: '2' }],
                 },
@@ -120,7 +125,9 @@ export default class extends Page {
                   key: 'two',
                   be: 'one',
                   placeholder: '全部',
-                  selectMap: [{ title: '123', key: '1' }, { title: '123', key: '2' }, { title: '123', key: '2' }],
+                  selectMap: {
+                    1: [{ title: '123', key: '1' }, { title: '123', key: '2' }, { title: '123', key: '2' }],
+                  },
                 },
               ],
             },

+ 10 - 0
front/project/www/routes/my/main/index.less

@@ -23,6 +23,7 @@
           display: inline-block;
 
           .assets {
+            vertical-align: top;
             margin-top: 5px;
           }
 
@@ -42,6 +43,15 @@
         margin-right: 10px;
       }
 
+      .tabs.tag {
+        height: 24px;
+        line-height: 24px;
+
+        .tab {
+          padding: 0;
+        }
+      }
+
       .right {
         cursor: pointer;
         float: right;

+ 9 - 9
front/project/www/routes/my/main/page.js

@@ -9,6 +9,7 @@ import Button from '../../../components/Button';
 import { Icon as GIcon } from '../../../components/Icon';
 import UserTable from '../../../components/UserTable';
 import Examination from '../../../components/Examination';
+import Tabs from '../../../components/Tabs';
 import menu from '../index';
 import { BindPhone, BindEmail, EditInfo, RealAuth, EditAvatar, InviteModal } from '../../../components/OtherModal';
 import VipRenew from '../../../components/VipRenew';
@@ -146,15 +147,14 @@ export default class extends Page {
           </div>
         </div>
         <div className="action">
-          <Button size="small" radius>
-            今天
-          </Button>
-          <Button size="small" radius>
-            昨天
-          </Button>
-          <Button size="small" radius>
-            前天
-          </Button>
+          <Tabs
+            className="d-i-b"
+            type="tag"
+            width={54}
+            space={5}
+            value={'1'}
+            tabs={[{ title: '123', key: '1' }, { title: '123', key: '1' }, { title: '123', key: '1' }]}
+          />
           <Assets className="right" name="calendar" />
         </div>
         {logList.map((log, index) => {

+ 2 - 1
front/src/components/Assets/index.js

@@ -2,10 +2,11 @@ import React from 'react';
 import './index.less';
 
 function Assets(props) {
-  const { name, src, className = '', svg, onClick } = props;
+  const { name, src, className = '', svg, width, height, onClick } = props;
   if (!name && !src) return <img />;
   return (
     <img
+      style={{ width, height }}
       className={`assets ${className} ${!(!name && !src) || 'hide'}`}
       src={src || `/assets/${name}.${svg ? 'svg' : 'png'}`}
       onClick={() => onClick && onClick()}