Browse Source

fix(admin): 调整搜索

Go 5 years ago
parent
commit
1da4ff81a2
49 changed files with 111 additions and 29 deletions
  1. 1 0
      front/project/admin/routes/course/data/page.js
  2. 1 0
      front/project/admin/routes/course/experience/page.js
  3. 1 0
      front/project/admin/routes/course/invoice/page.js
  4. 3 8
      front/project/admin/routes/course/list/page.js
  5. 1 0
      front/project/admin/routes/course/package/page.js
  6. 1 0
      front/project/admin/routes/course/preview/page.js
  7. 1 0
      front/project/admin/routes/course/student/page.js
  8. 1 0
      front/project/admin/routes/interaction/askQuestion/page.js
  9. 1 0
      front/project/admin/routes/interaction/comment/page.js
  10. 1 0
      front/project/admin/routes/interaction/faq/page.js
  11. 1 0
      front/project/admin/routes/interaction/feedback/page.js
  12. 1 0
      front/project/admin/routes/ready/article/page.js
  13. 1 0
      front/project/admin/routes/ready/feedback/page.js
  14. 1 0
      front/project/admin/routes/ready/read/page.js
  15. 1 0
      front/project/admin/routes/ready/room/page.js
  16. 1 0
      front/project/admin/routes/show/ad/page.js
  17. 1 0
      front/project/admin/routes/show/comment/page.js
  18. 1 0
      front/project/admin/routes/show/faq/page.js
  19. 1 0
      front/project/admin/routes/student/askCourse/page.js
  20. 1 0
      front/project/admin/routes/student/askQuestion/page.js
  21. 1 0
      front/project/admin/routes/student/study/page.js
  22. 1 0
      front/project/admin/routes/subject/examination/page.js
  23. 1 1
      front/project/admin/routes/subject/exercise/page.js
  24. 3 3
      front/project/admin/routes/subject/question/page.js
  25. 1 0
      front/project/admin/routes/subject/sentence/page.js
  26. 1 0
      front/project/admin/routes/subject/textbook/page.js
  27. 1 0
      front/project/admin/routes/textbook/feedback/page.js
  28. 1 0
      front/project/admin/routes/textbook/topic/page.js
  29. 1 0
      front/project/admin/routes/textbook/topicDetail/page.js
  30. 1 0
      front/project/admin/routes/user/abnormal/page.js
  31. 1 0
      front/project/admin/routes/user/list/page.js
  32. 1 0
      front/project/admin/routes/user/order/page.js
  33. 1 0
      front/project/admin/routes/user/recordAll/page.js
  34. 1 0
      front/project/admin/routes/user/recordBuy/page.js
  35. 1 0
      front/project/admin/routes/user/student/page.js
  36. 2 2
      front/project/www/components/Continue/index.js
  37. 1 1
      front/project/www/components/ListTable/index.less
  38. 1 1
      front/project/www/routes/course/note/page.js
  39. 1 1
      front/project/www/routes/my/answer/page.js
  40. 1 1
      front/project/www/routes/my/collect/page.js
  41. 1 1
      front/project/www/routes/my/error/page.js
  42. 1 1
      front/project/www/routes/my/main/page.js
  43. 1 1
      front/project/www/routes/my/note/page.js
  44. 1 1
      front/project/www/routes/my/report/page.js
  45. 46 4
      front/project/www/routes/paper/process/base/index.js
  46. 1 1
      front/project/www/routes/paper/process/page.js
  47. 1 1
      front/project/www/routes/question/search/page.js
  48. 1 0
      front/project/www/routes/textbook/topic/page.js
  49. 13 1
      server/gateway-api/src/main/java/com/qxgmat/service/inline/QuestionNoService.java

+ 1 - 0
front/project/admin/routes/course/data/page.js

@@ -133,6 +133,7 @@ export default class extends Page {
         itemList={this.filterForm}
         data={this.state.search}
         onChange={data => {
+          data.page = 1;
           this.search(data);
         }} />}
       <ActionLayout

+ 1 - 0
front/project/admin/routes/course/experience/page.js

@@ -181,6 +181,7 @@ export default class extends Page {
         itemList={this.filterForm}
         data={this.state.search}
         onChange={data => {
+          data.page = 1;
           this.search(data);
         }} />
       <ActionLayout

+ 1 - 0
front/project/admin/routes/course/invoice/page.js

@@ -131,6 +131,7 @@ export default class extends Page {
         itemList={this.filterForm}
         data={this.state.search}
         onChange={data => {
+          data.page = 1;
           this.search(data);
         }} />}
       <ActionLayout

+ 3 - 8
front/project/admin/routes/course/list/page.js

@@ -162,6 +162,7 @@ export default class extends Page {
         itemList={this.filterForm}
         data={this.state.search}
         onChange={data => {
+          data.page = 1;
           this.search(data);
         }} />}
       <ActionLayout
@@ -198,10 +199,7 @@ export default class extends Page {
               {this.state.detail.onlineVideo ? <div>
                 <Icon type={this.props.core.loading ? 'loading' : 'plus'} />
                 <div className="ant-upload-text">已上传</div>
-              </div> : <div>
-                <Icon type={this.props.core.loading ? 'loading' : 'plus'} />
-                <div className="ant-upload-text">Upload</div>
-              </div>}
+              </div> : <div><Icon type={this.props.core.loading ? 'loading' : 'plus'} /><div className="ant-upload-text">Upload</div></div>}
             </Upload>
           </Form.Item>
           <Form.Item labelCol={{ span: 5 }} wrapperCol={{ span: 10 }} label={'1v1课程'} help={this.state.vsErr}>
@@ -217,10 +215,7 @@ export default class extends Page {
               {this.state.detail.vsVideo ? <div>
                 <Icon type={this.props.core.loading ? 'loading' : 'plus'} />
                 <div className="ant-upload-text">已上传</div>
-              </div> : <div>
-                <Icon type={this.props.core.loading ? 'loading' : 'plus'} />
-                <div className="ant-upload-text">Upload</div>
-              </div>}
+              </div> : <div><Icon type={this.props.core.loading ? 'loading' : 'plus'} /><div className="ant-upload-text">Upload</div></div>}
             </Upload>
           </Form.Item>
         </Form>

+ 1 - 0
front/project/admin/routes/course/package/page.js

@@ -170,6 +170,7 @@ export default class extends Page {
         itemList={this.filterForm}
         data={this.state.search}
         onChange={data => {
+          data.page = 1;
           this.search(data);
         }} /> */}
       <ActionLayout

+ 1 - 0
front/project/admin/routes/course/preview/page.js

@@ -139,6 +139,7 @@ export default class extends Page {
         itemList={this.filterForm}
         data={this.state.search}
         onChange={data => {
+          data.page = 1;
           this.search(data);
         }} />}
       <ActionLayout

+ 1 - 0
front/project/admin/routes/course/student/page.js

@@ -351,6 +351,7 @@ export default class extends Page {
         itemList={this.onlineFilter}
         data={this.state.search}
         onChange={data => {
+          data.page = 1;
           this.search(data);
         }} />}
       <ActionLayout

+ 1 - 0
front/project/admin/routes/interaction/askQuestion/page.js

@@ -196,6 +196,7 @@ export default class extends Page {
           if (data.time.length > 0) {
             data.time = [data.time[0].format('YYYY-MM-DD HH:mm:ss'), data.time[1].format('YYYY-MM-DD HH:mm:ss')];
           }
+          data.page = 1;
           this.search(data);
         }} />
       <ActionLayout

+ 1 - 0
front/project/admin/routes/interaction/comment/page.js

@@ -193,6 +193,7 @@ export default class extends Page {
         data={Object.assign({}, search, { channel: search.channel ? search.channel.split('-') : '' })}
         onChange={data => {
           data.channel = data.channel.join('-');
+          data.page = 1;
           this.search(data);
         }} />
       {/* <ActionLayout

+ 1 - 0
front/project/admin/routes/interaction/faq/page.js

@@ -261,6 +261,7 @@ export default class extends Page {
         data={Object.assign({}, search, { channel: search.channel ? search.channel.split('-') : '' })}
         onChange={data => {
           data.channel = data.channel.join('-');
+          data.page = 1;
           this.search(data);
         }} />
       <ActionLayout

+ 1 - 0
front/project/admin/routes/interaction/feedback/page.js

@@ -286,6 +286,7 @@ export default class extends Page {
         itemList={this.filterForm}
         data={this.state.search}
         onChange={data => {
+          data.page = 1;
           this.search(data);
         }} />
       <ActionLayout

+ 1 - 0
front/project/admin/routes/ready/article/page.js

@@ -254,6 +254,7 @@ export default class extends Page {
         itemList={this.filterForm}
         data={this.state.search}
         onChange={data => {
+          data.page = 1;
           this.search(data);
         }} />
       <ActionLayout

+ 1 - 0
front/project/admin/routes/ready/feedback/page.js

@@ -152,6 +152,7 @@ export default class extends Page {
         itemList={this.filterForm}
         data={this.state.search}
         onChange={data => {
+          data.page = 1;
           this.search(data);
         }} />
       <ActionLayout

+ 1 - 0
front/project/admin/routes/ready/read/page.js

@@ -203,6 +203,7 @@ export default class extends Page {
         itemList={this.filterForm}
         data={this.state.search}
         onChange={data => {
+          data.page = 1;
           this.search(data);
         }} /> */}
       <ActionLayout

+ 1 - 0
front/project/admin/routes/ready/room/page.js

@@ -178,6 +178,7 @@ export default class extends Page {
         itemList={this.filterForm}
         data={this.state.search}
         onChange={data => {
+          data.page = 1;
           this.search(data);
         }} />
       <ActionLayout

+ 1 - 0
front/project/admin/routes/show/ad/page.js

@@ -193,6 +193,7 @@ export default class extends Page {
         itemList={this.filterForm}
         data={this.state.search}
         onChange={data => {
+          data.page = 1;
           this.search(data);
         }} /> */}
       <ActionLayout

+ 1 - 0
front/project/admin/routes/show/comment/page.js

@@ -278,6 +278,7 @@ export default class extends Page {
         data={Object.assign({}, search, { channel: search.channel ? search.channel.split('-') : '' })}
         onChange={data => {
           data.channel = data.channel.join('-');
+          data.page = 1;
           this.search(data);
         }} />
       <ActionLayout

+ 1 - 0
front/project/admin/routes/show/faq/page.js

@@ -260,6 +260,7 @@ export default class extends Page {
         data={Object.assign({}, search, { channel: search.channel ? search.channel.split('-') : '' })}
         onChange={data => {
           data.channel = data.channel.join('-');
+          data.page = 1;
           this.search(data);
         }} />
       <ActionLayout

+ 1 - 0
front/project/admin/routes/student/askCourse/page.js

@@ -210,6 +210,7 @@ export default class extends Page {
           if (data.time.length > 0) {
             data.time = [data.time[0].format('YYYY-MM-DD HH:mm:ss'), data.time[1].format('YYYY-MM-DD HH:mm:ss')];
           }
+          data.page = 1;
           this.search(data);
         }} />}
       {/* <ActionLayout

+ 1 - 0
front/project/admin/routes/student/askQuestion/page.js

@@ -209,6 +209,7 @@ export default class extends Page {
           if (data.time.length > 0) {
             data.time = [data.time[0].format('YYYY-MM-DD HH:mm:ss'), data.time[1].format('YYYY-MM-DD HH:mm:ss')];
           }
+          data.page = 1;
           this.search(data);
         }} />
       <ActionLayout

+ 1 - 0
front/project/admin/routes/student/study/page.js

@@ -177,6 +177,7 @@ export default class extends Page {
         itemList={this.filterForm}
         data={this.state.search}
         onChange={data => {
+          data.page = 1;
           this.search(data);
         }} />}
       <TableLayout

+ 1 - 0
front/project/admin/routes/subject/examination/page.js

@@ -184,6 +184,7 @@ export default class extends Page {
         itemList={filterForm}
         data={this.state.search}
         onChange={data => {
+          data.page = 1;
           this.search(data);
         }} />}
       <ActionLayout

+ 1 - 1
front/project/admin/routes/subject/exercise/page.js

@@ -276,7 +276,7 @@ export default class extends Page {
           if (data.time.length > 0) {
             data.time = [data.time[0].format('YYYY-MM-DD HH:mm:ss'), data.time[1].format('YYYY-MM-DD HH:mm:ss')];
           }
-          console.log(data);
+          data.page = 1;
           this.search(data);
         }} />}
       <ActionLayout

+ 3 - 3
front/project/admin/routes/subject/question/page.js

@@ -281,7 +281,7 @@ export default class extends Page {
   changeQuestion(index, k, value) {
     const { form } = this.props;
     let answer = form.getFieldValue(`answer.questions[${index}].single`) || [];
-    answer = answer.map(() => !value);
+    answer = answer.map(() => false);
     answer[k] = !!value;
     form.setFieldsValue({ [`answer.questions[${index}].single`]: answer });
   }
@@ -292,13 +292,13 @@ export default class extends Page {
     let answer = form.getFieldValue(`answer.questions[${index}].double`) || [];
     switch (direction) {
       case 'landscape':
-        answer[k] = answer[k].map(() => !value);
+        answer[k] = answer[k].map(() => false);
         if (o >= 0) {
           answer[k][o] = !!value;
         }
         break;
       case 'portrait':
-        answer = answer.map((row) => { row[o] = !value; return row; });
+        answer = answer.map((row) => { row[o] = false; return row; });
         if (o >= 0) {
           answer[k][o] = !!value;
         }

+ 1 - 0
front/project/admin/routes/subject/sentence/page.js

@@ -263,6 +263,7 @@ export default class extends Page {
         itemList={filterForm}
         data={this.state.search}
         onChange={data => {
+          data.page = 1;
           this.search(data);
         }} />
       <ActionLayout

+ 1 - 0
front/project/admin/routes/subject/textbook/page.js

@@ -123,6 +123,7 @@ export default class extends Page {
         itemList={filterForm}
         data={this.state.search}
         onChange={data => {
+          data.page = 1;
           this.search(data);
         }} />
       <ActionLayout

+ 1 - 0
front/project/admin/routes/textbook/feedback/page.js

@@ -196,6 +196,7 @@ export default class extends Page {
         itemList={this.filterForm}
         data={this.state.search}
         onChange={data => {
+          data.page = 1;
           this.search(data);
         }} />
       <ActionLayout

+ 1 - 0
front/project/admin/routes/textbook/topic/page.js

@@ -130,6 +130,7 @@ export default class extends Page {
         itemList={this.filterForm}
         data={this.state.search}
         onChange={data => {
+          data.page = 1;
           this.search(data);
         }} />
       <ActionLayout

+ 1 - 0
front/project/admin/routes/textbook/topicDetail/page.js

@@ -186,6 +186,7 @@ export default class extends Page {
         itemList={this.filterForm}
         data={this.state.search}
         onChange={data => {
+          data.page = 1;
           this.search(data);
         }} />
     </Block>

+ 1 - 0
front/project/admin/routes/user/abnormal/page.js

@@ -165,6 +165,7 @@ export default class extends Page {
           if (data.time.length > 0) {
             data.time = [data.time[0].format('YYYY-MM-DD HH:mm:ss'), data.time[1].format('YYYY-MM-DD HH:mm:ss')];
           }
+          data.page = 1;
           this.search(data);
         }} />
       {/* <ActionLayout

+ 1 - 0
front/project/admin/routes/user/list/page.js

@@ -182,6 +182,7 @@ export default class extends Page {
           if (data.time.length > 0) {
             data.time = [data.time[0].format('YYYY-MM-DD HH:mm:ss'), data.time[1].format('YYYY-MM-DD HH:mm:ss')];
           }
+          data.page = 1;
           this.search(data);
         }}
         ref={(ref) => {

+ 1 - 0
front/project/admin/routes/user/order/page.js

@@ -136,6 +136,7 @@ export default class extends Page {
         itemList={this.filterForm}
         data={this.state.search}
         onChange={data => {
+          data.page = 1;
           this.search(data);
         }} />
       <TableLayout

+ 1 - 0
front/project/admin/routes/user/recordAll/page.js

@@ -322,6 +322,7 @@ export default class extends Page {
         itemList={this.filterForm}
         data={this.state.search}
         onChange={data => {
+          data.page = 1;
           this.search(data);
         }} />
       <ActionLayout

+ 1 - 0
front/project/admin/routes/user/recordBuy/page.js

@@ -172,6 +172,7 @@ export default class extends Page {
         itemList={this.filterForm}
         data={this.state.search}
         onChange={data => {
+          data.page = 1;
           this.search(data);
         }} />
       <TableLayout

+ 1 - 0
front/project/admin/routes/user/student/page.js

@@ -105,6 +105,7 @@ export default class extends Page {
         itemList={this.filterForm}
         data={this.state.search}
         onChange={data => {
+          data.page = 1;
           this.search(data);
         }}
         ref={(ref) => {

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

@@ -1,6 +1,6 @@
 import React from 'react';
 import Assets from '@src/components/Assets';
-import { formatDate } from '@src/services/Tools';
+import { formatDate, formatPercent } from '@src/services/Tools';
 import './index.less';
 import Button from '../Button';
 
@@ -15,7 +15,7 @@ function Continue(props) {
           <div className="date">{updateTime && formatDate(updateTime, 'YYYY-MM-DD HH:mm:ss')}</div>
         </div>
         <div className="center">
-          <div className="text">{paper.title} {questionNumber > 0 ? userNumber * 100 / questionNumber : 0}%</div>
+          <div className="text">{paper.title} {formatPercent(userNumber, questionNumber, false)}</div>
           <div className="list">
             {userNumber < questionNumber && <Button radius theme="border" size="small" onClick={() => {
               onContinue();

+ 1 - 1
front/project/www/components/ListTable/index.less

@@ -56,7 +56,7 @@
 
       .td {
         >div {
-          height: 78px;
+          height: 100px;
           padding: 15px 0;
         }
       }

+ 1 - 1
front/project/www/routes/course/note/page.js

@@ -75,7 +75,7 @@ export default class extends Page {
   }
 
   onSearch(value) {
-    this.search({ keyword: value }, false);
+    this.search({ page: 1, keyword: value }, false);
     this.initData();
   }
 

+ 1 - 1
front/project/www/routes/my/answer/page.js

@@ -140,7 +140,7 @@ export default class extends Page {
   }
 
   onSearch(value) {
-    this.search({ keyword: value }, false);
+    this.search({ page: 1, keyword: value }, false);
     this.initData();
   }
 

+ 1 - 1
front/project/www/routes/my/collect/page.js

@@ -211,7 +211,7 @@ export default class extends Page {
   }
 
   onSearch(value) {
-    this.search({ keyword: value }, false);
+    this.search({ page: 1, keyword: value }, false);
     this.initData();
   }
 

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

@@ -218,7 +218,7 @@ export default class extends Page {
   }
 
   onSearch(value) {
-    this.search({ keyword: value }, false);
+    this.search({ page: 1, keyword: value }, false);
     this.initData();
   }
 

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

@@ -206,7 +206,7 @@ export default class extends Page {
     // 获取学习数据
     My.getStudyTotal().then((total) => {
       total.categorys = total.categorys.map((row, index) => {
-        row.ratio = (row.time * 100) / total.time;
+        row.ratio = formatPercent(row.time, total.time, true);
         row.time = formatSeconds(row.time);
         row.color = this.colors[index];
         return row;

+ 1 - 1
front/project/www/routes/my/note/page.js

@@ -166,7 +166,7 @@ export default class extends Page {
   }
 
   onSearch(value) {
-    this.search({ keyword: value }, false);
+    this.search({ page: 1, keyword: value }, false);
     this.initData();
   }
 

+ 1 - 1
front/project/www/routes/my/report/page.js

@@ -577,7 +577,7 @@ export default class extends Page {
   }
 
   onSearch(value) {
-    this.search({ keyword: value }, false);
+    this.search({ page: 1, keyword: value }, false);
     this.initData();
   }
 

+ 46 - 4
front/project/www/routes/paper/process/base/index.js

@@ -70,11 +70,53 @@ export default class extends Component {
 
   checkAnswer() {
     const { question } = this.props;
+    const { content } = question;
     const { answer } = this.state;
-    let result = null;
-    if (!answer) return this.showToast('Answer Required', 'You can not continue with this question unanswered. ', 430);
-    if (question.questionType === 'awa' && !answer.awa) result = 'Please answer the question first.';
-    if (result) return this.showToast(null, result);
+    let title = null;
+    let desc = null;
+    let width = null;
+    if (question.questionType === 'awa' && !answer.awa) {
+      desc = 'Please answer the question first.';
+    } else {
+      let flag = false;
+      if (!answer || !answer.questions) {
+        flag = true;
+      } else if (content.type === 'double') {
+        answer.questions.forEach((row, index) => {
+          if (flag) return;
+          if (!row.double) {
+            flag = true;
+            return;
+          }
+          const { direction } = content.questions[index];
+          switch (direction) {
+            case 'landscape':
+              flag = row.double.filter(r => (r || []).filter(rr => rr).length > 0).length < row.double.length;
+              break;
+            case 'portrait':
+              flag = [0, 1].map(r => row.double.filter(rr => rr && rr[r]).length > 0) < 2;
+              break;
+            default:
+          }
+        });
+      } else if (content.type === 'single') {
+        answer.questions.forEach((row) => {
+          if (flag) return;
+          if (!row.single) {
+            flag = true;
+            return;
+          }
+          flag = row.single.filter(r => r).length === 0;
+        });
+      }
+      if (flag) {
+        title = 'Answer Required';
+        desc = 'You can not continue with this question unanswered. ';
+        width = 430;
+      }
+    }
+
+    if (title || desc) return this.showToast(title, desc, width);
     return true;
   }
 

+ 1 - 1
front/project/www/routes/paper/process/page.js

@@ -196,7 +196,7 @@ export default class extends Page {
     const { report } = this.state;
     return Question.stage(report.id)
       .then(() => {
-        this.baseRef.expireTime(() => {
+        this.baseRef.timeOut(() => {
           this.relaxStage();
         });
       });

+ 1 - 1
front/project/www/routes/question/search/page.js

@@ -98,7 +98,7 @@ export default class extends Page {
   onSearch(value) {
     const { keyword } = this.state;
     User.addSearch(value || keyword);
-    // this.search({ keyword }, false);
+    // this.search({ page: 1, keyword }, false);
     // this.changeQuery({ keyword });
     // this.setState({ keyword });
     this.refreshQuery({ keyword: value || keyword });

+ 1 - 0
front/project/www/routes/textbook/topic/page.js

@@ -75,6 +75,7 @@ export default class extends Page {
   }
 
   filter(data) {
+    data.page = 1;
     this.search(data);
   }
 

+ 13 - 1
server/gateway-api/src/main/java/com/qxgmat/service/inline/QuestionNoService.java

@@ -514,7 +514,19 @@ public class QuestionNoService extends AbstractService {
      * @return
      */
     public QuestionNo getByNo(String title, String module){
-        return one(questionNoMapper, QuestionNo.builder().title(title).module(module).build());
+        Example example = new Example(QuestionNo.class);
+        example.and(
+                example.createCriteria()
+                        .andEqualTo("title", title)
+                        .andEqualTo("module", module)
+                        .andIsNull("deleteTime")
+        );
+        List<QuestionNo> result = select(questionNoMapper, example);
+        if (result != null && result.size() > 0){
+            return result.get(0);
+        }else{
+            return null;
+        }
     }
 
     @Transactional