Go пре 5 година
родитељ
комит
73fc9f5649

+ 33 - 22
front/project/admin/routes/setting/index/page.js

@@ -13,7 +13,7 @@ export default class extends Page {
     System.getIndex().then(result => {
       const { form } = this.props;
       form.setFieldsValue(flattenObject(result, 'index'));
-      this.setState({ load: true, index: result });
+      this.setState({ load: true, indexInfo: result });
     });
     System.getBase().then(result => {
       const { form } = this.props;
@@ -23,19 +23,19 @@ export default class extends Page {
   }
 
   addLength(field, info) {
-    let { index } = this.state;
-    index = index || {};
-    index[field] = index[field] || [];
-    index[field].push(info);
-    this.setState({ index });
+    let { indexInfo } = this.state;
+    indexInfo = indexInfo || {};
+    indexInfo[field] = indexInfo[field] || [];
+    indexInfo[field].push(info);
+    this.setState({ indexInfo });
   }
 
   deleteLength(field, start, length) {
-    let { index } = this.state;
-    index = index || {};
-    index[field] = index[field] || [];
-    index[field].splice(start, length);
-    this.setState({ index });
+    let { indexInfo } = this.state;
+    indexInfo = indexInfo || {};
+    indexInfo[field] = indexInfo[field] || [];
+    indexInfo[field].splice(start, length);
+    this.setState({ indexInfo });
   }
 
   submit() {
@@ -47,13 +47,14 @@ export default class extends Page {
     const { form } = this.props;
     form.validateFields(['index'], (err) => {
       if (!err) {
+        // const { indexInfo } = this.state;
         const { index } = form.getFieldsValue();
-        index.class = Object.keys(index.class || {}).map((key) => index.class[key]);
+        index.course = Object.keys(index.course || {}).map((key) => index.course[key]);
         index.activity = Object.keys(index.activity || {}).map((key) => index.activity[key]);
         index.evaluation = Object.keys(index.evaluation || {}).map((key) => index.evaluation[key]);
         System.setIndex(index)
           .then(() => {
-            this.setState({ index });
+            this.setState({ indexInfo: index });
             asyncSMessage('保存成功');
           }).catch((e) => {
             form.setFields(formatFormError(index, e.result));
@@ -170,10 +171,10 @@ export default class extends Page {
     </Block>;
   }
 
-  renderClass() {
+  renderCourse() {
     const { getFieldDecorator, getFieldValue, setFieldsValue } = this.props.form;
-    const { data } = this.state;
-    const course = data.course || [];
+    const { indexInfo = {} } = this.state;
+    const course = indexInfo.course || [];
     return <Block>
       <h1>千行课堂</h1>
       <Form>
@@ -243,8 +244,8 @@ export default class extends Page {
 
   renderActivity() {
     const { getFieldDecorator, getFieldValue, setFieldsValue } = this.props.form;
-    const { data } = this.state;
-    const activity = data.activity || [];
+    const { indexInfo = {} } = this.state;
+    const activity = indexInfo.activity || [];
     return <Block>
       <h1>活动信息</h1>
       <Form>
@@ -304,8 +305,8 @@ export default class extends Page {
 
   renderEvaluation() {
     const { getFieldDecorator, getFieldValue, setFieldsValue } = this.props.form;
-    const { data } = this.state;
-    const evaluation = data.evaluation || [];
+    const { indexInfo = {} } = this.state;
+    const evaluation = indexInfo.evaluation || [];
     return <Block>
       <h1>学员评价</h1>
       <Form>
@@ -328,6 +329,16 @@ export default class extends Page {
                   <Input placeholder='请输入学员昵称' />,
                 )}
               </Form.Item>
+              <Form.Item labelCol={{ span: 7 }} wrapperCol={{ span: 15 }} label='发布时间'>
+                {getFieldDecorator(`index.evaluation.${index}.createTime`, {
+                  rules: [
+                    { required: true, message: '输入发布时间' },
+                  ],
+                  initialValue: row.createTime,
+                })(
+                  <Input placeholder='请输入发布时间' />,
+                )}
+              </Form.Item>
               <Form.Item labelCol={{ span: 7 }} wrapperCol={{ span: 15 }} label='学员头像'>
                 {getFieldDecorator(`index.evaluation.${index}.avatar`, {
                   rules: [
@@ -376,7 +387,7 @@ export default class extends Page {
   renderContact() {
     const { getFieldDecorator, setFieldsValue, getFieldValue } = this.props.form;
     const wechatImage = getFieldValue('base.contact.wechatImage');
-    const weiboImage = getFieldValue('base.contacct.weiboImage');
+    const weiboImage = getFieldValue('base.contact.weiboImage');
     return <Block>
       <Form>
         <h1>联系方式</h1>
@@ -453,7 +464,7 @@ export default class extends Page {
     return <div >
       {this.renderPrepare()}
       {this.renderUser()}
-      {this.renderClass()}
+      {this.renderCourse()}
       {this.renderActivity()}
       {this.renderEvaluation()}
       {this.renderContact()}

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

@@ -64,7 +64,7 @@ export default class extends Page {
     }];
     this.columns = [{
       title: '单项',
-      dataIndex: 'topic.questionSubject',
+      dataIndex: 'topic.textbookSubject',
       render: (text) => {
         return TextbookSubjectMap[text] || '';
       },

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

@@ -16,7 +16,7 @@ import { Textbook } from '../../../stores/textbook';
 export default class extends Page {
   init() {
     this.filterForm = [{
-      key: 'testbookSubject',
+      key: 'textbookSubject',
       type: 'select',
       name: '单项',
       select: TextbookSubject,
@@ -55,8 +55,8 @@ export default class extends Page {
   }
 
   refreshLibrary() {
-    const { libraryId, testbookSubject } = this.state.search;
-    Textbook.getNextTopic({ libraryId, testbookSubject }).then(result => {
+    const { libraryId, textbookSubject } = this.state.search;
+    Textbook.getNextTopic({ libraryId, textbookSubject }).then(result => {
       this.setState({ no: result });
       this.addTopic();
     });

+ 2 - 1
server/gateway-api/src/main/java/com/qxgmat/controller/admin/TextbookController.java

@@ -230,8 +230,9 @@ public class TextbookController {
     @ApiOperation(value = "编辑机经题目", httpMethod = "PUT")
     public Response<Boolean> editTopic(@RequestBody @Validated TextbookTopic dto, HttpServletRequest request) {
         TextbookTopic entity = Transform.convert(dto, TextbookTopic.class);
+        TextbookTopic in = textbookTopicService.get(entity.getId());
         entity = textbookTopicService.edit(entity);
-        textbookService.updateLibraryNo(entity.getLibraryId(), entity.getTextbookSubject());
+        textbookService.updateLibraryNo(in.getLibraryId(), in.getTextbookSubject());
         managerLogService.log(request);
         return ResponseHelp.success(true);
     }

+ 6 - 1
server/gateway-api/src/main/java/com/qxgmat/controller/api/MyController.java

@@ -1533,7 +1533,12 @@ public class MyController {
         entity.setStatus(0);
         if (entity.getNo() != null && entity.getNo() > 0){
             TextbookTopic textbookTopic = textbookTopicService.getByNo(entity.getLibraryId(), entity.getTextbookSubject(), entity.getNo());
-            entity.setTopicId(textbookTopic.getId());
+            if (textbookTopic == null){
+                throw new ParameterException("题目不存在");
+            }
+            if (textbookTopic != null){
+                entity.setTopicId(textbookTopic.getId());
+            }
         }
         userTextbookFeedbackService.add(entity);
 

+ 9 - 9
server/gateway-api/src/main/java/com/qxgmat/dto/admin/extend/TextbookTopicExtendDto.java

@@ -9,7 +9,7 @@ public class TextbookTopicExtendDto {
 
     private Integer libraryId;
 
-    private String questionType;
+    private String textbookSubject;
 
     private Integer no;
 
@@ -33,14 +33,6 @@ public class TextbookTopicExtendDto {
         this.libraryId = libraryId;
     }
 
-    public String getQuestionType() {
-        return questionType;
-    }
-
-    public void setQuestionType(String questionType) {
-        this.questionType = questionType;
-    }
-
     public Integer getNo() {
         return no;
     }
@@ -64,4 +56,12 @@ public class TextbookTopicExtendDto {
     public void setQuality(String quality) {
         this.quality = quality;
     }
+
+    public String getTextbookSubject() {
+        return textbookSubject;
+    }
+
+    public void setTextbookSubject(String textbookSubject) {
+        this.textbookSubject = textbookSubject;
+    }
 }

+ 1 - 1
server/gateway-api/src/main/java/com/qxgmat/service/extend/MessageExtendService.java

@@ -343,7 +343,7 @@ public class MessageExtendService {
 
         map.put("number", String.valueOf(pList.size()));
         if(userOrder.getProductTypes().size() == 1){
-            String productType = userOrder.getProductTypes().getString(1);
+            String productType = userOrder.getProductTypes().getString(0);
             UserOrderRecord one = pList.get(0);
             switch(ProductType.ValueOf(productType)){
                 case SERVICE: