Kaynağa Gözat

feat(front): getReady

Go 4 yıl önce
ebeveyn
işleme
14363ac851

+ 12 - 5
front/project/admin/routes/ready/article/page.js

@@ -4,6 +4,7 @@ import { Button, Modal, Checkbox, Row, Col, Switch } from 'antd';
 import './index.less';
 import Page from '@src/containers/Page';
 import Block from '@src/components/Block';
+import EditTableCell from '@src/components/EditTableCell';
 // import DragList from '@src/components/DragList';
 import FilterLayout from '@src/layouts/FilterLayout';
 import TreeLayout from '@src/layouts/TreeLayout';
@@ -127,17 +128,18 @@ export default class extends Page {
   refreshCategory() {
     Ready.allCategory().then(result => {
       this.categoryTitleMap = getMap(result, 'id', 'title');
+      this.categoryTree = formatTreeData(result, 'id', 'title', 'parentId');
+      this.categoryMap = getMap(result, 'id');
       this.categoryList = result.map(row => {
+        const parent = this.categoryMap[row.parentId];
         row.value = row.id;
         row.title = <Row style={{ width: 400 }}>
-          <Col span={11}>{row.title}</Col>
-          <Col span={5}>{row.parentId > 0 && <Switch checked={row.isData} checkedChildren='资料节点' unCheckedChildren='基本节点' onChange={() => this.changeCategoryData(row.id, !row.isData)} />}{row.parentId === 0 && <Switch checked={row.isRoom} checkedChildren='考场节点' unCheckedChildren='非考场' onChange={() => this.changeCategoryRoom(row.id, !row.isRoom)} />}</Col>
-          <Col span={5}>{row.parentId > 0 && row.isData > 0 && <Switch checked={row.isOfficial} checkedChildren='官方资料' unCheckedChildren='非官方资料' onChange={() => this.changeCategoryOfficial(row.id, !row.isOfficial)} />}</Col>
+          <Col span={11}><EditTableCell value={row.title} onChange={(value) => this.changeCategoryTitle(row.id, value)} /></Col>
+          <Col span={5}>{row.parentId === 0 && <Switch checked={row.isData} checkedChildren='资料节点' unCheckedChildren='非资料' onChange={() => this.changeCategoryData(row.id, !row.isData)} />}{row.parentId === 0 && <Switch checked={row.isRoom} checkedChildren='考场节点' unCheckedChildren='非考场' onChange={() => this.changeCategoryRoom(row.id, !row.isRoom)} />}</Col>
+          <Col span={5}>{row.parentId > 0 && parent.isData > 0 && <Switch checked={row.isOfficial} checkedChildren='官方资料' unCheckedChildren='非官方资料' onChange={() => this.changeCategoryOfficial(row.id, !row.isOfficial)} />}</Col>
         </Row>;
         return row;
       });
-      this.categoryTree = formatTreeData(result, 'id', 'title', 'parentId');
-      this.categoryMap = getMap(result, 'id');
       this.filterForm[0].select = this.categoryList.filter(row => row.parentId === 0);
       this.changeSearch(this.filterForm, this, this.state.search.parentCategoryId);
       this.initData();
@@ -172,6 +174,11 @@ export default class extends Page {
     });
   }
 
+  changeCategoryTitle(id, title) {
+    Ready.editCategory({ id, title })
+      .then(() => { });
+  }
+
   changeCategoryRoom(id, checked) {
     const category = this.categoryMap[id];
     if (category.isRoom) {

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

@@ -173,7 +173,7 @@ export default class extends Page {
         this.setState({ detail: null });
       }}>
         <p>考场:{this.state.detail.room.title}</p>
-        <p>补充内容{this.state.detail.content}</p>
+        <p>补充内容{this.state.detail.content}</p>
         {!this.state.detail.status && <p><Button type="primary" onClick={() => {
           this.handleDetail();
         }}>采纳</Button><Button type="primary" onClick={() => {

+ 16 - 5
front/project/www/components/OtherModal/index.js

@@ -428,7 +428,7 @@ export class EditAvatar extends Component {
       };
     } else {
       const img = new Image();
-      img.onload = function() {
+      img.onload = function () {
         const canvas = document.createElement('canvas');
         canvas.height = img.height;
         canvas.width = img.width;
@@ -1153,9 +1153,20 @@ export class SuppleModal extends Component {
     this.state = { data: {} };
   }
 
+  componentWillReceiveProps(nextProps) {
+    if (nextProps.defaultData) {
+      this.setState({ data: Object.assign({}, nextProps.defaultData, this.state.data) });
+    }
+  }
+
   onConfirm() {
     const { onConfirm } = this.props;
-    if (onConfirm) onConfirm();
+    const { data } = this.state;
+    if (!data.content) return;
+    My.addRoomFeedback(data.roomId, data.content).then(() => {
+      if (onConfirm) onConfirm();
+      this.setState({ data: {} });
+    });
   }
 
   onCancel() {
@@ -1165,11 +1176,11 @@ export class SuppleModal extends Component {
   }
 
   render() {
-    const { show } = this.props;
+    const { show, info = {} } = this.props;
     const { data } = this.state;
     return (
       <Modal show={show} title="考场信息" onConfirm={() => this.onConfirm()} onCancel={() => this.onCancel()}>
-        <div className="t-2 t-s-16">考场位置: 中国 上海 XXXXXXXXXXX</div>
+        <div className="t-2 t-s-16">考场位置: {info.isOverseas ? '海外' : '中国'}{info.area ? ` ${info.area}` : ''} {info.title}</div>
         <div className="t-2 t-s-16">补充内容:</div>
         <textarea
           value={data.content}
@@ -1193,7 +1204,7 @@ export class SuppleFinishModal extends Component {
       <Modal show={show} title="提交成功" confirmText="好的,知道了" btnAlign="center" onConfirm={() => onConfirm()}>
         <div className="t-2 t-s-18">
           <Icon type="check" className="t-5 m-r-5" />
-          您的每一次反馈都是千行进步的动力
+          内容将在审核通过后发布,感谢您的参与
         </div>
       </Modal>
     );

+ 270 - 137
front/project/www/routes/page/ready/page.js

@@ -6,127 +6,236 @@ import Page from '@src/containers/Page';
 import Select from '../../../components/Select';
 import Button from '../../../components/Button';
 import { SuppleModal, SuppleFinishModal } from '../../../components/OtherModal';
+import { Main } from '../../../stores/main';
+import { User } from '../../../stores/user';
+import { getMap, formatTreeData } from '../../../../../src/services/Tools';
 
 export default class extends Page {
   initState() {
+    this.areaMap = {};
+    this.categoryMap = {};
+    this.loadArticleMap = {};
+    this.dataList = null;
     return {
-      load: false,
-      list: [
-        {
-          key: '1',
-          title: '了解GMAT',
-          children: true,
-        },
-        { key: '2', title: '推荐阅读' },
-        { key: '3', title: '考场查询' },
-        { key: '4', title: '熟悉备考资料', children: true },
-      ],
-      current: '1',
-      scrollCurrent: '1-1',
-      result: [{}, {}, {}],
-      data: [
-        { key: '1', id: 'data1', title: '官方', children: [{}, {}, {}] },
-        { key: '2', id: 'data2', title: '非官方', children: [{}, {}, {}] },
-      ],
-      page: [
-        {
-          key: '1-1',
-          title: '考试功能',
-          id: '#test1',
-          content:
-            '11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111',
-        },
-        {
-          key: '1-2',
-          title: '出题原理',
-          id: '#test2',
-          content:
-            '11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111',
-        },
-        {
-          key: '1-3',
-          title: '出题原理',
-          id: '#test3',
-          content:
-            '11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111',
-        },
-        {
-          key: '1-4',
-          title: '出题原理',
-          id: '#test4',
-          content:
-            '11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111',
-        },
-        {
-          key: '1-5',
-          title: '出题原理',
-          id: '#test5',
-          content:
-            '11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111',
-        },
-        {
-          key: '1-6',
-          title: '出题原理',
-          id: '#test6',
-          content:
-            '11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111',
-        },
-        {
-          key: '1-7',
-          title: '出题原理',
-          id: '#test7',
-          content:
-            '11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111',
-        },
-        {
-          key: '1-8',
-          title: '出题原理',
-          id: '#test8',
-          content:
-            '11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111',
-        },
-        {
-          key: '1-9',
-          title: '出题原理',
-          id: '#test9',
-          content:
-            '11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111',
-        },
-        {
-          key: '1-10',
-          title: '出题原理',
-          id: '#test10',
-          content:
-            '11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111',
-        },
-        {
-          key: '1-11',
-          title: '出题原理',
-          id: '#test11',
-          content:
-            '11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111',
-        },
-      ],
+      // load: false,
+      // list: [
+      //   {
+      //     key: '1',
+      //     title: '了解GMAT',
+      //     children: true,
+      //   },
+      //   { key: '2', title: '推荐阅读' },
+      //   { key: '3', title: '考场查询' },
+      //   { key: '4', title: '熟悉备考资料', children: true },
+      // ],
+      // current: '1',
+      // scrollCurrent: '1-1',
+      // result: [{}, {}, {}],
+      // data: [
+      //   { key: '1', id: 'data1', title: '官方', children: [{}, {}, {}] },
+      //   { key: '2', id: 'data2', title: '非官方', children: [{}, {}, {}] },
+      // ],
+      // page: [
+      //   {
+      //     key: '1-1',
+      //     title: '考试功能',
+      //     id: '#test1',
+      //     content:
+      //       '11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111',
+      //   },
+      //   {
+      //     key: '1-2',
+      //     title: '出题原理',
+      //     id: '#test2',
+      //     content:
+      //       '11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111',
+      //   },
+      //   {
+      //     key: '1-3',
+      //     title: '出题原理',
+      //     id: '#test3',
+      //     content:
+      //       '11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111',
+      //   },
+      //   {
+      //     key: '1-4',
+      //     title: '出题原理',
+      //     id: '#test4',
+      //     content:
+      //       '11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111',
+      //   },
+      //   {
+      //     key: '1-5',
+      //     title: '出题原理',
+      //     id: '#test5',
+      //     content:
+      //       '11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111',
+      //   },
+      //   {
+      //     key: '1-6',
+      //     title: '出题原理',
+      //     id: '#test6',
+      //     content:
+      //       '11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111',
+      //   },
+      //   {
+      //     key: '1-7',
+      //     title: '出题原理',
+      //     id: '#test7',
+      //     content:
+      //       '11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111',
+      //   },
+      //   {
+      //     key: '1-8',
+      //     title: '出题原理',
+      //     id: '#test8',
+      //     content:
+      //       '11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111',
+      //   },
+      //   {
+      //     key: '1-9',
+      //     title: '出题原理',
+      //     id: '#test9',
+      //     content:
+      //       '11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111',
+      //   },
+      //   {
+      //     key: '1-10',
+      //     title: '出题原理',
+      //     id: '#test10',
+      //     content:
+      //       '11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111',
+      //   },
+      //   {
+      //     key: '1-11',
+      //     title: '出题原理',
+      //     id: '#test11',
+      //     content:
+      //       '11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111',
+      //   },
+      // ],
     };
   }
 
+  init() {
+    Main.readyInfo()
+      .then(result => {
+        // read, category, area
+        this.areaMap = getMap(result.area, 'id', 'title');
+        result.category = result.category.map(row => {
+          row.key = row.id;
+          return row;
+        });
+        result.category.push({
+          id: 'read',
+          key: 'read',
+          title: '推荐阅读',
+          isRead: true,
+        });
+        result.category.push({
+          id: 'faq',
+          key: 'faq',
+          title: 'FAQs',
+          isFaq: true,
+        });
+        this.categoryMap = getMap(result.category, 'id');
+        const list = formatTreeData(result.category, 'id', 'title', 'parentId');
+        this.setState({ list });
+        this.changePage(list[0].id);
+      });
+  }
+
   initData() {
-    this.initInfo();
+
+  }
+
+  refreshRoom() {
+    const { isOverseas, keyword } = this.state;
+    Main.listRoom({ page: 1, size: 10, keyword, isOverseas })
+      .then(result => {
+        result.list = result.list.map(row => {
+          if (row.isOverseas) return row;
+          row.area = this.areaMap[row.areaId];
+          return row;
+        });
+        this.setState({ rooms: result.list });
+      });
+  }
+
+  refreshData(item) {
+    if (!this.dataList) {
+      Main.allData()
+        .then(result => {
+          const official = result.filter(row => row.isOfficial);
+          const unofficial = result.filter(row => !row.isOfficial);
+          item.children.forEach(row => {
+            if (row.isOfficial) {
+              row.children = official;
+            } else {
+              row.children = unofficial;
+            }
+          });
+          this.dataList = result;
+          this.setState({ datas: item.children });
+          this.initScroll(item.children);
+        });
+    } else {
+      this.setState({ datas: item.children });
+      this.initScroll(item.children);
+    }
+  }
+
+  refreshList(item) {
+    const { key } = item;
+    if (!this.loadArticleMap[key]) {
+      Main.listArticle(key)
+        .then(result => {
+          this.loadArticleMap[key] = result;
+          this.setState({ articles: result });
+          this.initScroll(item.children);
+        });
+    } else {
+      const list = this.loadArticleMap[key];
+      this.setState({ articles: list });
+      this.initScroll(item.children);
+    }
   }
 
-  initInfo() {
+  refreshRead() {
+    if (!this.readList) {
+      Main.listRead()
+        .then(result => {
+          this.readList = result.list;
+          this.setState({ reads: this.readList });
+        });
+    } else {
+      this.setState({ reads: this.readList });
+    }
+  }
+
+  refreshFaq() {
+    if (!this.faqList) {
+      Main.listFaq({ page: 1, size: 1000, channel: 'getready' })
+        .then(result => {
+          this.faqList = result.list;
+          this.setState({ faqs: this.faqList });
+        });
+    } else {
+      this.setState({ faqs: this.faqList });
+    }
+  }
+
+  initScroll(list) {
     this.load = false;
     try {
-      const { page, current, data } = this.state;
-      const _list = current === '4' ? data : page;
-      _list.forEach(item => {
+      list.forEach(item => {
         item.top = document.getElementById(item.id).offsetTop - 100;
         return item;
       });
       this.load = true;
     } catch (e) {
       setTimeout(() => {
-        this.initInfo();
+        this.initScroll(list);
       }, 500);
     }
   }
@@ -144,8 +253,8 @@ export default class extends Page {
 
   onScroll(e) {
     const t = e.target.scrollTop;
-    const { page, data, current, scrollCurrent } = this.state;
-    const _list = current === '4' ? data : page;
+    const { current, scrollCurrent } = this.state;
+    const _list = this.categoryMap[current].children;
     let _current = null;
     for (let i = 0; i < _list.length; i += 1) {
       if (!_current) _current = _list[i].key;
@@ -162,14 +271,23 @@ export default class extends Page {
   }
 
   changePage(key) {
+    const item = this.categoryMap[key];
+    if (item.isRoom) {
+      this.refreshRoom();
+    } else if (item.isData) {
+      this.refreshData(item);
+    } else if (item.isRead) {
+      this.refreshRead();
+    } else if (item.isFaq) {
+      this.refreshFaq();
+    } else {
+      this.refreshList(item);
+    }
     this.setState({ current: key });
-    setTimeout(() => {
-      this.initInfo();
-    }, 1);
   }
 
   renderView() {
-    const { list, current, scrollCurrent, page, data } = this.state;
+    const { list, current, scrollCurrent } = this.state;
     let detail = {};
     return (
       <div>
@@ -178,23 +296,25 @@ export default class extends Page {
             <Anchor offsetTop={90} getContainer={() => document.getElementById('root')}>
               {list.map(item => {
                 if (item.key === current) detail = item;
-                const _list = item.key === '4' ? data : page;
                 return (
                   <div
                     className={`page-item ${item.key === current ? 'active' : ''}`}
                     onClick={() => this.changePage(item.key)}
                   >
-                    {item.children && <Assets name="dropdown_hover" className="up" />}
-                    {item.children && <Assets name="dropdown_normal" className="down" />}
+                    {item.children && item.children.length > 0 && <Assets name="dropdown_hover" className="up" />}
+                    {item.children && item.children.length > 0 && <Assets name="dropdown_normal" className="down" />}
                     <div className="page-item-title">{item.title}</div>
                     {current === item.key &&
                       item.children &&
-                      _list.map(child => {
+                      item.children.map(child => {
                         return (
                           <div
                             style={{ margin: 3 }}
                             className={`t-s-12 t-2 c-p ${child.key === scrollCurrent ? 't-4' : ''}`}
-                            onClick={() => this.scrollTo(child.top)}
+                            onClick={(e) => {
+                              e.stopPropagation();
+                              this.scrollTo(child.top);
+                            }}
                             title={child.title}
                           >
                             {child.title}
@@ -208,53 +328,58 @@ export default class extends Page {
           </div>
           <div className="center">
             <div className="t-1 t-s-24 m-b-2">{detail.title}</div>
-            {current !== '3' && current !== '4' && this.renderList()}
-            {current === '3' && this.renderQuery()}
-            {current === '4' && this.renderData()}
+            {!detail.isData && !detail.isRoom && !detail.isRead && !detail.isFaq && this.renderList()}
+            {!!detail.isRoom && this.renderRoom()}
+            {!!detail.isData && this.renderData()}
+            {!!detail.isRead && this.renderRead()}
+            {!!detail.isFaq && this.renderFaq()}
           </div>
         </div>
-      </div>
+      </div >
     );
   }
 
-  renderQuery() {
-    const { result } = this.state;
+  renderRoom() {
+    const { rooms = [], isOverseas, keyword, showFinish, showSupple, supple, room } = this.state;
     return (
       <div className="query-layout">
         <div className="search-wrapper">
-          <Select theme="white" list={[{ title: '中国', key: '1' }, { title: '海外', key: '2' }]} />
-          <input />
-          <Button width={150}>
+          <Select theme="white" value={isOverseas} list={[{ title: '中国', key: false }, { title: '海外', key: true }]} onChange={({ key }) => this.setState({ isOverseas: key })} />
+          <input value={keyword} onChange={(e) => this.setState({ keyword: e.target.value })} />
+          <Button width={150} onClick={() => this.refreshRoom()}>
             <Icon className="m-r-5" type="search" />
-            搜索题目
+            搜索考场
           </Button>
         </div>
-        {result.map(() => {
+        {rooms.map((item, index) => {
           return (
             <div className="m-b-2">
-              <div className="t-1 t-s-18">1.上海财经大学</div>
-              <div className="t-1">上海市徐汇区天钥桥路333号腾飞大厦8层805室</div>
+              <div className="t-1 t-s-18">{index + 1}.{item.title}</div>
+              <div className="t-1">{item.address}</div>
               <div className="t-1">
-                温馨提示: 本考场提供听力耳机 <span className="t-4">我要补充</span>
+                温馨提示: {item.description} <span className="t-4" onClick={() => User.needLogin().then(() => this.setState({ showSupple: true, supple: { roomId: item.id }, room: item }))}>我要补充</span>
               </div>
             </div>
           );
         })}
-        <SuppleModal />
-        <SuppleFinishModal />
+        <SuppleModal show={showSupple} defaultData={supple} info={room} onConfirm={() => this.setState({ showSupple: false, showFinish: true })} onCancel={() => this.setState({ showSupple: false })} />
+        <SuppleFinishModal show={showFinish} onConfirm={() => this.setState({ showFinish: false })} onCancel={() => this.setState({ showFinish: false })} />
       </div>
     );
   }
 
   renderData() {
-    const { data } = this.state;
-    return data.map(item => {
+    const { datas = [], dataId } = this.state;
+    return datas.map(item => {
       return (
         <div className="p-t-1 m-b-2" id={item.id}>
           <div className="t-1 t-s-18 m-b-1">{item.title}</div>
           <div className="data-list">
             {item.children.map(child => {
-              return <Assets width={240} height={310} src={child} className="data-item" />;
+              if (child.id === dataId) {
+                return <div style={{ width: 240, height: 310, overflowY: 'auto', display: 'inline-block' }} className="ws-p data-item" onClick={() => this.setState({ dataId: null })}>{child.content}</div>;
+              }
+              return <Assets width={240} height={310} src={child.cover} className="data-item" onClick={() => this.setState({ dataId: child.id })} />;
             })}
           </div>
         </div>
@@ -263,14 +388,22 @@ export default class extends Page {
   }
 
   renderList() {
-    const { page } = this.state;
-    return page.map(item => {
+    const { articles = [] } = this.state;
+    return articles.map(item => {
       return (
-        <div className="p-t-1 m-b-2" id={item.id}>
+        <div className="p-t-1 m-b-2" id={item.categoryId}>
           <div className="t-1 t-s-18 m-b-1">{item.title}</div>
-          <div className="t-2">{item.content}</div>
+          <div className="t-2" dangerouslySetInnerHTML={{ __html: item.content }} />
         </div>
       );
     });
   }
+
+  renderRead() {
+    return <div />;
+  }
+
+  renderFaq() {
+    return <div />;
+  }
 }

+ 9 - 0
front/project/www/stores/my.js

@@ -391,6 +391,15 @@ export default class MyStore extends BaseStore {
   }
 
   /**
+   * 添加考场反馈
+   * @param {*} roomId
+   * @param {*} content
+   */
+  addRoomFeedback(roomId, content) {
+    return this.apiPost('/my/feedback/ready/room', { roomId, content });
+  }
+
+  /**
    * 添加Faq
    * @param {*} channel
    * @param {*} position

+ 1 - 1
front/src/components/Editor/index.js

@@ -50,7 +50,7 @@ class Editor extends React.Component {
     this.state = {};
     this.loading = 0;
     this.modules = Object.assign({}, modules, props.modules);
-    if (props.onUpload && !props.modules.toolbar) {
+    if (props.onUpload && (!props.modules || !props.modules.toolbar)) {
       this.modules.toolbar.container.unshift(['image']);
     }
     // console.log(this.modules);

+ 3 - 2
server/gateway-api/src/main/java/com/qxgmat/controller/api/BaseController.java

@@ -349,17 +349,18 @@ public class BaseController {
             @RequestParam(required = false, defaultValue = "100") int size,
             @RequestParam(required = false) String keyword,
             @RequestParam(required = false) Integer areaId,
+            @RequestParam(required = false) Boolean isOverseas,
             @RequestParam(required = false, defaultValue = "id") String order,
             @RequestParam(required = false, defaultValue = "desc") String direction,
             HttpSession session) {
-        Page<ReadyRoom> p = readyRoomService.list(page, size, keyword, areaId, order, DirectionStatus.ValueOf(direction));
+        Page<ReadyRoom> p = readyRoomService.list(page, size, keyword, areaId, isOverseas, order, DirectionStatus.ValueOf(direction));
         return ResponseHelp.success(p, page, size, p.getTotal());
     }
 
     @RequestMapping(value = "/data/all", method = RequestMethod.GET)
     @ApiOperation(value = "资料", httpMethod = "GET")
     public Response<List<ReadyData>> allData(
-            @RequestParam(required = true) Boolean isOfficial,
+            @RequestParam(required = false) Boolean isOfficial,
             HttpSession session) {
         List<ReadyData> p = readyDataService.all(isOfficial);
         return ResponseHelp.success(p);

+ 10 - 0
server/gateway-api/src/main/java/com/qxgmat/dto/admin/request/ReadyArticleCategoryDto.java

@@ -14,6 +14,8 @@ public class ReadyArticleCategoryDto {
 
     private Integer isData;
 
+    private Integer isRoom;
+
     private Integer isOfficial;
 
     private Integer index;
@@ -65,4 +67,12 @@ public class ReadyArticleCategoryDto {
     public void setIndex(Integer index) {
         this.index = index;
     }
+
+    public Integer getIsRoom() {
+        return isRoom;
+    }
+
+    public void setIsRoom(Integer isRoom) {
+        this.isRoom = isRoom;
+    }
 }

+ 6 - 1
server/gateway-api/src/main/java/com/qxgmat/service/inline/ReadyRoomService.java

@@ -26,7 +26,7 @@ public class ReadyRoomService extends AbstractService {
     private ReadyRoomMapper readyRoomMapper;
 
 
-    public Page<ReadyRoom> list(int page, int size, String keyword, Integer areaId, String order, DirectionStatus direction){
+    public Page<ReadyRoom> list(int page, int size, String keyword, Integer areaId, Boolean isOverseas, String order, DirectionStatus direction){
         Example example = new Example(ReadyRoom.class);
         if (keyword != null)
             example.and(
@@ -40,6 +40,11 @@ public class ReadyRoomService extends AbstractService {
                     example.createCriteria()
                             .andEqualTo("areaId", areaId)
             );
+        if (isOverseas != null)
+            example.and(
+                    example.createCriteria()
+                            .andEqualTo("isOverseas", isOverseas ? 1:0)
+            );
         if(order == null || order.isEmpty()) order = "id";
         switch(direction){
             case ASC: