Przeglądaj źródła

句子拆分默认居中 可配置表格行号和列号

natasha 2 lat temu
rodzic
commit
9395c8ede8

+ 2 - 2
src/components/Adult/common/SentenceSegTemp.vue

@@ -18,7 +18,7 @@
           </el-option>
         </el-select>
       </div>
-      <div class="adult-book-input-item">
+      <div class="adult-book-input-item" v-if="type!=='config_table'">
         <el-button type="primary" size="small" @click="setConfig" style="margin"
           >功能设置</el-button
         >
@@ -350,7 +350,7 @@ export default {
           fontColor: "#000",
           fontFamily: "FZJCGFKTK",
           wordPadding: [],
-          conAlign: 'left'
+          conAlign: 'center'
         },
       };
       this.detail.detail.push(JSON.parse(JSON.stringify(obj)));

+ 174 - 1
src/components/Adult/inputModules/ConfigurableTable/components/CellEdit.vue

@@ -84,6 +84,77 @@
           :is-hide-py-position="true"
         />
       </template>
+
+      <template v-else-if="cellData.type === 'mulText'">
+        <div class="adult-book-input-item">
+            <span class="adult-book-lable">题干部分:</span>
+            <el-button type="primary" @click="setOptionDetail()"
+              >添加句子</el-button
+            >
+          </div>
+          <div
+            v-if="cellData.mulText.detail.length > 0"
+            style="padding: 10px 0px 10px 86px"
+          >
+            <ul
+              class="option-detail-detail"
+              v-for="(dItem, dIndex) in cellData.mulText.detail"
+              :key="'ddItem' + dIndex"
+            >
+              <li
+                v-for="(ddItem, ddIndex) in dItem.detail"
+                :key="'ddItem' + dIndex + ddIndex"
+              >
+                <span
+                  :class="[
+                    ddItem.config.wordPadding.indexOf('left') > -1
+                      ? 'dleft'
+                      : '',
+                    ddItem.config.wordPadding.indexOf('right') > -1
+                      ? 'dright'
+                      : '',
+                    !ddItem.sentence ? 'placeholder' : '',
+                  ]"
+                  >{{ ddItem.sentence }}</span
+                >
+              </li>
+              <i
+                class="el-icon-edit"
+                @click.prevent="
+                  setOptionDetail('edit', dItem, dIndex)
+                "
+                style="margin-left: 14px"
+              ></i>
+              <i
+                class="el-icon-delete"
+                @click.prevent="deleteOptionDetail(cellData.mulText.detail, dIndex)"
+                style="margin-left: 14px"
+              ></i>
+            </ul>
+          </div>
+          <div class="correct-box">
+            <div
+              style="width: 600px"
+            >
+              <div style="padding-top: 10px">
+                <span style="display: block; margin-bottom: 10px"
+                  >句子填空答案:<b style="font-size: 12px"
+                    >请输入本题答案,答案用换行符隔开;如果有的输入框没有答案,答案请输入??</b
+                  ></span
+                >
+                <el-input
+                  class="adult-book-input"
+                  type="textarea"
+                  :autosize="{ minRows: 2 }"
+                  v-model="cellData.mulText.correct.completeInput"
+                  placeholder="请输入句子填空答案"
+                  @blur="onBlur"
+                  maxlength="200"
+                ></el-input>
+              </div>
+            </div>
+          </div>
+      </template>
       <template v-if="cellData.isCross">
         <div>勾叉答案</div>
         <CrossTick :cellData="cellData" />
@@ -92,15 +163,30 @@
     <div slot="footer">
       <el-button type="primary" @click="confirm">确定</el-button>
     </div>
+    <el-dialog
+      title="添加句子"
+      :close-on-click-modal="false"
+      :modal-append-to-body="false"
+      append-to-body
+      :visible.sync="addStemVisible"
+      width="50%"
+    >
+      <SentenceSegTemp :detail="optionItemDetail" :segModel="'words'" :type="'config_table'" />
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="addStemVisible = false">取 消</el-button>
+        <el-button type="primary" @click="saveOptionDetail">确 定</el-button>
+      </span>
+    </el-dialog>
   </el-dialog>
 </template>
 
 <script>
 import SentenceSegwordChs from "@/components/Adult/inputModules/SentenceSegwordChs/index.vue";
 import CrossTick from "./CrossTick.vue";
+import SentenceSegTemp from "../../../common/SentenceSegTemp";
 
 export default {
-  components: { SentenceSegwordChs, CrossTick },
+  components: { SentenceSegwordChs, CrossTick, SentenceSegTemp },
   props: {
     visible: {
       type: Boolean,
@@ -138,7 +224,13 @@ export default {
           label: "前缀 + 拼音",
           value: "prePinyin",
         },
+        {
+          label: "多行文本/句子填空",
+          value: "mulText",
+        },
       ],
+      addStemVisible: false,
+      optionItemDetail: null,
     };
   },
   computed: {
@@ -154,6 +246,67 @@ export default {
     confirm() {
       this.$emit("close");
     },
+    //添加句子
+    setOptionDetail( type, dItem, dIndex) {
+      let _this = this;
+      _this.addStemVisible = true;
+      if (type == "edit") {
+        this.optionItemDetail = JSON.parse(JSON.stringify(dItem));
+      } else {
+        let obj = {
+          hengLeg: -1,
+          detail: [
+            {
+              pyPosition: "top", //top 拼音在上面;bottom 拼音在下面
+              sentence: "", //句子
+              segList: [], //分词结果
+              seg_words: "",
+              wordsList: [],
+              hengList: [],
+              config: {
+                fontSize: "16px",
+                fontColor: "#000",
+                fontFamily: "FZJCGFKTK",
+                wordPadding: [],
+              },
+            },
+          ],
+          fn_check_list: {
+            record_check: "",
+          },
+        };
+        this.optionItemDetail = JSON.parse(JSON.stringify(obj));
+      }
+      this.datailIndex = dIndex;
+      this.detailSelectType = type;
+    },
+    //删除句子
+    deleteOptionDetail(detail, dIndex) {
+        this.$confirm("确定要删除吗?", "提示", {
+            confirmButtonText: "确定",
+            cancelButtonText: "取消",
+            type: "warning",
+        })
+        .then(() => {
+            detail.splice(dIndex, 1);
+        })
+    },
+    //保存句子
+    saveOptionDetail() {
+      let _this = this;
+      _this.addStemVisible = false;
+      if (_this.detailSelectType == "edit") {
+        let optionItem = JSON.parse(JSON.stringify(_this.optionItemDetail));
+        _this.cellData.mulText.detail[_this.datailIndex] =
+          optionItem;
+      } else {
+        let optionItem = JSON.parse(JSON.stringify(_this.optionItemDetail));
+        _this.cellData.mulText.detail.push(optionItem);
+      }
+    },
+    onBlur(item, field) {
+      item[field] = item[field] ? item[field].trim() : "";
+    },
   },
 };
 </script>
@@ -169,6 +322,26 @@ export default {
     width: 70px;
   }
 }
+.option-detail-detail {
+  clear: both;
+  overflow: hidden;
+  margin-bottom: 10px;
+  > li {
+    float: left;
+    > span {
+      float: left;
+      &.dleft {
+        padding-left: 4px;
+      }
+      &.dright{
+        padding-right: 4px;
+      }
+    }
+  }
+  > i {
+    float: left;
+  }
+}
 </style>
 
 <style lang="scss">

+ 78 - 0
src/components/Adult/inputModules/ConfigurableTable/index.vue

@@ -53,7 +53,18 @@
           }}
         </caption>
         <thead>
+          <tr>
+            <td></td>
+            <td
+              v-for="(item, k) in curQue.tableData.colsConfig.width"
+              :key="`tfoot-${k}`"
+            >
+              第{{k+1}}列
+            </td>
+            <td></td>
+          </tr>
           <tr v-for="(item, i) in curQue.tableData.headers" :key="i">
+            <th></th>
             <th v-for="(header, j) in item.content" :key="j">
               <el-form :inline="true" :model="header">
                 <el-form-item label="内容">
@@ -84,7 +95,34 @@
         </thead>
         <tbody>
           <tr v-for="(row, i) in curQue.tableData.body" :key="`row-${i}`">
+            <td width="60">第{{i+1}}行</td>
             <td v-for="(col, j) in row.content" :key="`col-${j}`">
+              <p>{{col.prefix+' '+col.text+' '+col.sentence_data.sentence}}</p>
+              <template v-if="col.mulText">
+                <ul
+                class="option-detail-detail"
+                v-for="(dItem, dIndex) in col.mulText.detail"
+                :key="'ddItem' + dIndex"
+                >
+                <li
+                    v-for="(ddItem, ddIndex) in dItem.detail"
+                    :key="'ddItem' + dIndex + ddIndex"
+                >
+                    <span
+                    :class="[
+                        ddItem.config.wordPadding.indexOf('left') > -1
+                        ? 'dleft'
+                        : '',
+                        ddItem.config.wordPadding.indexOf('right') > -1
+                        ? 'dright'
+                        : '',
+                        !ddItem.sentence ? 'placeholder' : '',
+                    ]"
+                    >{{ ddItem.sentence }}</span
+                    >
+                </li>
+                </ul>
+              </template>
               <el-button size="mini" @click="edit(i, j)">编辑</el-button>
             </td>
             <td>
@@ -92,6 +130,7 @@
             </td>
           </tr>
           <tr>
+            <td></td>
             <td
               v-for="(item, k) in curQue.tableData.colsConfig.width"
               :key="`tfoot-${k}`"
@@ -101,6 +140,7 @@
               </el-input>
               <el-button size="mini" @click="deleteCol(k)">删除列</el-button>
             </td>
+            <td></td>
           </tr>
         </tbody>
       </table>
@@ -160,6 +200,12 @@ export default {
                       seg_words: "",
                       wordsList: [],
                     },
+                    mulText:{
+                        correct: {
+                            completeInput: ""
+                        },
+                        detail: [],
+                    }
                   },
                 ],
               },
@@ -253,6 +299,12 @@ export default {
             seg_words: "",
             wordsList: [],
           },
+          mulText:{
+            correct: {
+                completeInput: ""
+            },
+            detail: [],
+          }
         });
       });
       this.curQue.tableData.headers.forEach(({ content }) => {
@@ -302,6 +354,12 @@ export default {
             seg_words: "",
             wordsList: [],
           },
+          mulText:{
+            correct: {
+                completeInput: ""
+            },
+            detail: [],
+          }
         });
       }
       this.curQue.tableData.body.push({
@@ -360,5 +418,25 @@ export default {
       }
     }
   }
+  .option-detail-detail {
+    clear: both;
+    overflow: hidden;
+    margin-bottom: 10px;
+    > li {
+        float: left;
+        > span {
+        float: left;
+        &.dleft {
+            padding-left: 4px;
+        }
+        &.dright{
+            padding-right: 4px;
+        }
+        }
+    }
+    > i {
+        float: left;
+    }
+  }
 }
 </style>

+ 1 - 0
src/components/Adult/inputModules/SentenceModule.vue

@@ -1126,6 +1126,7 @@ export default {
                 fontColor: "#000",
                 fontFamily: "FZJCGFKTK",
                 wordPadding: [],
+                conAlign: 'center'
               },
             },
           ],

+ 1 - 0
src/components/Adult/inputModules/SentenceMulModule.vue

@@ -1177,6 +1177,7 @@ export default {
                 fontColor: "#000",
                 fontFamily: "FZJCGFKTK",
                 wordPadding: [],
+                conAlign: 'center'
               },
             },
           ],

+ 2 - 2
src/components/Adult/preview/components/OneSentenceTemp.vue

@@ -610,13 +610,13 @@ export default {
       let _this = this;
 
       if (
-        _this.fn_check_list.sent_check == "sentence_long_input_chs" &&
+        _this.fn_check_list&&_this.fn_check_list.sent_check == "sentence_long_input_chs" &&
         _this.fn_check_list.style_check == "sentence_input_chs"
       ) {
         classname = "answer-input-input";
       }
       if (
-        _this.fn_check_list.sent_check == "sentence_long_input_chs" &&
+       _this.fn_check_list&& _this.fn_check_list.sent_check == "sentence_long_input_chs" &&
         _this.fn_check_list.style_check == "sentence_textarea_chs"
       ) {
         classname = "answer-input-textarea";