|
@@ -0,0 +1,330 @@
|
|
|
+<template>
|
|
|
+ <div class="header-separate">
|
|
|
+ <table>
|
|
|
+ <colgroup>
|
|
|
+ <col
|
|
|
+ v-for="(item, i) in curQue.tableData.colsConfig.width"
|
|
|
+ :key="`col-${i}`"
|
|
|
+ :style="{ width: `${item.val}px` }"
|
|
|
+ >
|
|
|
+ </colgroup>
|
|
|
+
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ <th
|
|
|
+ v-for="({ text, english }, i) in curQue.tableData.headers"
|
|
|
+ :key="`th-${i}`"
|
|
|
+ >
|
|
|
+ <div
|
|
|
+ class="thead-content"
|
|
|
+ :style="theadStyle"
|
|
|
+ >
|
|
|
+ <span class="chs">{{ text }}</span><span class="english">{{ english }}</span>
|
|
|
+ </div>
|
|
|
+ </th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+
|
|
|
+ <tbody
|
|
|
+ :style="{
|
|
|
+ 'text-align': `${curQue.textAlign}`
|
|
|
+ }"
|
|
|
+ >
|
|
|
+ <tr v-for="(row, i) in curQue.tableData.body" :key="`tr-${i}`">
|
|
|
+ <td
|
|
|
+ v-for="(col, j) in row.content"
|
|
|
+ :key="`td-${j}`"
|
|
|
+ :class="[
|
|
|
+ `${j === 0 ? 'mb' : j === row.content.length - 1 ? 'mbr' : 'mc'}`,
|
|
|
+ `${curQue.firstColAligin === 'center' ? 'col-center' : ''}`
|
|
|
+ ]"
|
|
|
+ >
|
|
|
+ <template v-if="col.type === 'content'">
|
|
|
+ <template v-if="col.text.length > 0">
|
|
|
+ {{ col.text }}
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <el-input
|
|
|
+ v-model="col.answer"
|
|
|
+ type="textarea"
|
|
|
+ :placeholder="`${isAnswerMode ? '' : '输入'}`"
|
|
|
+ :disabled="isAnswerMode"
|
|
|
+ :autosize="{ minRows: 1, maxRows: 6 }"
|
|
|
+ @input="enterAnswer(i, j, $event)"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <div
|
|
|
+ v-else-if="col.type === 'pinyin'"
|
|
|
+ class="sentence"
|
|
|
+ :style="pinyinStyle"
|
|
|
+ >
|
|
|
+ <div>
|
|
|
+ <span
|
|
|
+ v-for="({ pinyin, chs }, k) in col.sentence_data.wordsList"
|
|
|
+ :key="
|
|
|
+ `${
|
|
|
+ curQue.pinyinPosition === 'top' ||
|
|
|
+ curQue.pinyinPosition === 'left'
|
|
|
+ ? 'pinyin'
|
|
|
+ : 'chs'
|
|
|
+ }-${k}`
|
|
|
+ "
|
|
|
+ :class="[
|
|
|
+ `${
|
|
|
+ curQue.pinyinPosition === 'top' ||
|
|
|
+ curQue.pinyinPosition === 'left'
|
|
|
+ ? 'pinyin'
|
|
|
+ : 'chs'
|
|
|
+ }`
|
|
|
+ ]"
|
|
|
+ >
|
|
|
+ {{
|
|
|
+ curQue.pinyinPosition === "top" ||
|
|
|
+ curQue.pinyinPosition == "left"
|
|
|
+ ? pinyin
|
|
|
+ : chs
|
|
|
+ }}
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <span
|
|
|
+ v-for="({ pinyin, chs }, k) in col.sentence_data.wordsList"
|
|
|
+ :key="
|
|
|
+ `${
|
|
|
+ curQue.pinyinPosition === 'top' ||
|
|
|
+ curQue.pinyinPosition === 'left'
|
|
|
+ ? 'chs'
|
|
|
+ : 'pinyin'
|
|
|
+ }-${k}`
|
|
|
+ "
|
|
|
+ :class="[
|
|
|
+ `${
|
|
|
+ curQue.pinyinPosition === 'top' ||
|
|
|
+ curQue.pinyinPosition === 'left'
|
|
|
+ ? 'chs'
|
|
|
+ : 'pinyin'
|
|
|
+ }`
|
|
|
+ ]"
|
|
|
+ >
|
|
|
+ {{
|
|
|
+ curQue.pinyinPosition === "top" ||
|
|
|
+ curQue.pinyinPosition == "left"
|
|
|
+ ? chs
|
|
|
+ : pinyin
|
|
|
+ }}
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+export default {
|
|
|
+ props: {
|
|
|
+ curQue: {
|
|
|
+ type: Object,
|
|
|
+ required: true
|
|
|
+ },
|
|
|
+ themeColor: {
|
|
|
+ type: String,
|
|
|
+ required: true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ isAnswerMode: false
|
|
|
+ };
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ theadStyle() {
|
|
|
+ const hp = this.curQue.headerEnglishPosition;
|
|
|
+ if (hp === 'top') {
|
|
|
+ return {
|
|
|
+ 'flex-direction': 'column-reverse'
|
|
|
+ };
|
|
|
+ }
|
|
|
+ if (hp === 'right') {
|
|
|
+ return {
|
|
|
+ 'flex-direction': 'row',
|
|
|
+ 'column-gap': '8px'
|
|
|
+ };
|
|
|
+ }
|
|
|
+ if (hp === 'bottom') {
|
|
|
+ return {
|
|
|
+ 'flex-direction': 'column'
|
|
|
+ };
|
|
|
+ }
|
|
|
+ if (hp === 'left') {
|
|
|
+ return {
|
|
|
+ 'flex-direction': 'row-reverse',
|
|
|
+ 'column-gap': '8px'
|
|
|
+ };
|
|
|
+ }
|
|
|
+ },
|
|
|
+ pinyinStyle() {
|
|
|
+ let pyPos = this.curQue.pinyinPosition;
|
|
|
+ if (pyPos === "left") {
|
|
|
+ return {
|
|
|
+ "column-gap": "16px"
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+ if (pyPos === "top") {
|
|
|
+ return {
|
|
|
+ "flex-direction": "column"
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+ if (pyPos === "right") {
|
|
|
+ return {
|
|
|
+ "column-gap": "16px"
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+ if (pyPos === "bottom") {
|
|
|
+ return {
|
|
|
+ "flex-direction": "column"
|
|
|
+ };
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ const Bookanswer = this.curQue.Bookanswer;
|
|
|
+ if (Bookanswer) {
|
|
|
+ this.isAnswerMode = true;
|
|
|
+ for (const key in Bookanswer) {
|
|
|
+ let { col, row, value } = Bookanswer[key];
|
|
|
+ this.curQue.tableData.body[col].content[row].answer = value;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.$set(this.curQue, "Bookanswer", {});
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ enterAnswer(i, j, value) {
|
|
|
+ this.curQue.Bookanswer[`${i}-${j}`] = {
|
|
|
+ col: i,
|
|
|
+ row: j,
|
|
|
+ value
|
|
|
+ };
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.header-separate {
|
|
|
+ width: 100%;
|
|
|
+ margin-bottom: 16px;
|
|
|
+
|
|
|
+ table {
|
|
|
+ table-layout: fixed;
|
|
|
+ font-size: 16px;
|
|
|
+ border-collapse: separate;
|
|
|
+ border-spacing: 6px 0;
|
|
|
+
|
|
|
+ th {
|
|
|
+ color: #4d4c51;
|
|
|
+ font-weight: normal;
|
|
|
+ background-color: #efeff9;
|
|
|
+ padding: 4px 12px;
|
|
|
+ border: 2px solid #afb4d1;
|
|
|
+
|
|
|
+ .thead-content {
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+
|
|
|
+ .english {
|
|
|
+ color: #000;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ td {
|
|
|
+ color: #474747;
|
|
|
+ border-bottom: 1px solid transparent;
|
|
|
+ padding: 4px 12px;
|
|
|
+ min-height: 28px;
|
|
|
+
|
|
|
+ .sentence {
|
|
|
+ display: flex;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .pinyin {
|
|
|
+ font-family: "GB-PINYINOK-B";
|
|
|
+ }
|
|
|
+
|
|
|
+ .chs {
|
|
|
+ font-family: "FZJCGFKTK";
|
|
|
+ }
|
|
|
+
|
|
|
+ .mb {
|
|
|
+ border-left: 2px solid transparent;
|
|
|
+ border-bottom-width: 1px;
|
|
|
+ border-image: linear-gradient(
|
|
|
+ transparent 6px,
|
|
|
+ #e7b576 6px,
|
|
|
+ #e7b576 calc(100% - 6px),
|
|
|
+ transparent calc(100% - 6px),
|
|
|
+ transparent calc(100% - 2px),
|
|
|
+ #cecece calc(100% - 2px)
|
|
|
+ )
|
|
|
+ 2;
|
|
|
+ border-image-outset: 0 4px 0 0;
|
|
|
+
|
|
|
+ &.col-center {
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .mbr {
|
|
|
+ border-right: 2px solid transparent;
|
|
|
+ border-bottom-width: 1px;
|
|
|
+ border-image: linear-gradient(
|
|
|
+ transparent 6px,
|
|
|
+ #e7b576 6px,
|
|
|
+ #e7b576 calc(100% - 6px),
|
|
|
+ transparent calc(100% - 6px),
|
|
|
+ transparent calc(100% - 2px),
|
|
|
+ #cecece calc(100% - 2px)
|
|
|
+ )
|
|
|
+ 2;
|
|
|
+ border-image-outset: 0 0 0 4px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .mc {
|
|
|
+ border-left: 2px solid transparent;
|
|
|
+ border-right: 2px solid transparent;
|
|
|
+ border-image: repeating-linear-gradient(
|
|
|
+ transparent,
|
|
|
+ transparent 3px,
|
|
|
+ #cecece 3px,
|
|
|
+ #cecece 7px,
|
|
|
+ transparent 7px
|
|
|
+ )
|
|
|
+ 2;
|
|
|
+ border-image-outset: 0 4px 0 4px;
|
|
|
+ position: relative;
|
|
|
+ }
|
|
|
+
|
|
|
+ .mc::after {
|
|
|
+ content: "";
|
|
|
+ position: absolute;
|
|
|
+ top: 100%;
|
|
|
+ left: 0;
|
|
|
+ width: 100%;
|
|
|
+ height: 1px;
|
|
|
+ display: inline-block;
|
|
|
+ background-color: #cecece;
|
|
|
+ box-shadow: 5px 0 #cecece, -5px 0 #cecece;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|