Browse Source

字词卡片配色

natasha 1 year ago
parent
commit
35891f91d5

+ 5 - 3
src/views/wordcard/UploadDrag.vue

@@ -98,10 +98,12 @@ export default {
 </script>
 <style lang="scss" scoped>
 .upload-wrapper {
-  height: 536px;
+  height: 294px;
   background-color: #f2f3f5;
+  border-radius: 8px;
+  overflow: hidden;
   .plus-icon {
-    margin: 200px auto 20px auto;
+    margin: 95px auto 20px auto;
     color: #4e5969;
   }
   .cn-tips {
@@ -126,7 +128,7 @@ export default {
 .upload-wrapper-drag {
   .el-upload {
     width: 100%;
-    height: 536px;
+    height: 294px;
   }
   .el-upload-dragger {
     border: none;

+ 26 - 7
src/views/wordcard/cread.vue

@@ -106,6 +106,11 @@ export default {
       editCardflag: true, // 是否编辑卡片
       newEditTable: [
         {
+          borderColor: '#000000',
+          fontColor: '#000000',
+          fontAlign: 'left',
+          label: '',
+          headerCon: '',
           left: {
             fileList: [],
             con: '',
@@ -115,7 +120,7 @@ export default {
             collocation: '',
             exampleSent: '',
             hz_info: [],
-            pinyin: [],
+            pinyin: '',
             audio_file: '',
           },
         },
@@ -131,6 +136,11 @@ export default {
   methods: {
     addCard() {
       this.newEditTable.push({
+        borderColor: '#000000',
+        fontColor: '#000000',
+        fontAlign: 'left',
+        label: '',
+        headerCon: '',
         left: {
           fileList: [],
           con: '',
@@ -140,7 +150,7 @@ export default {
           collocation: '',
           exampleSent: '',
           hz_info: [],
-          pinyin: [],
+          pinyin: '',
           audio_file: '',
         },
       });
@@ -158,7 +168,7 @@ export default {
     },
     // 保存
     save() {
-      if (!this.saveName.trim()) {
+      if (!this.saveName || !this.saveName.trim()) {
         this.$message.warning('请填写卡片名称');
         return;
       }
@@ -310,6 +320,11 @@ export default {
       this.loading = false;
       this.newEditTable = [
         {
+          borderColor: '#000000',
+          fontColor: '#000000',
+          fontAlign: 'left',
+          label: '',
+          headerCon: '',
           left: {
             fileList: [],
             con: '',
@@ -319,7 +334,7 @@ export default {
             collocation: '',
             exampleSent: '',
             hz_info: [],
-            pinyin: [],
+            pinyin: '',
             audio_file: '',
           },
         },
@@ -426,7 +441,7 @@ export default {
   left: 0;
   top: 64px;
   width: 100%;
-  min-height: 100%;
+  min-height: calc(100% - 64px);
   background: #f2f2f2;
   > img {
     width: 40px;
@@ -445,10 +460,14 @@ export default {
   .preview_main {
     padding: 24px 0;
     width: 740px;
-    margin: 0 auto;
     display: flex;
     align-items: center;
-    height: 100%;
+    height: 450px;
+    position: absolute;
+    top: 50%;
+    margin-top: -225px;
+    left: 50%;
+    margin-left: -370px;
     > div {
       margin: 0 24px;
     }

+ 112 - 24
src/views/wordcard/printNew.vue

@@ -2,10 +2,19 @@
   <div class="none_writeTable writeTable printTable" v-if="dataConfig">
     <div class="none_word_main_table" v-for="(data, indexT) in dataConfig" :key="indexT">
       <div class="writeTop" :class="[data.left.fileList ? 'writeTop-nopadding' : '']">
-        <div class="left" :class="[data.left.fileList.length === 0 ? 'left-big' : '']">
+        <div
+          class="left left-preview"
+          :class="[data.left.fileList.length === 0 ? 'left-big' : '']"
+          v-if="(isPreview && showLeft) || !isPreview"
+          :style="{ borderColor: data.borderColor }"
+        >
+          <div class="header-info-preview">
+            <h5 :style="{ textAlign: data.fontAlign }">{{ data.headerCon }}</h5>
+            <label :style="{ background: data.borderColor }">{{ data.label }}</label>
+          </div>
           <div class="item-image" v-if="data.left.fileList.length > 0">
             <el-image
-              style="width: 536px; height: 536px"
+              style="width: 568px; height: 294px"
               :src="data.left.fileList[0].fileUrl"
               :preview-src-list="[data.left.fileList[0].fileUrl]"
               fit="contain"
@@ -14,41 +23,52 @@
           <h2 :class="['con-preview', data.left.fileList.length === 0 ? 'con-preview-big' : '']">
             {{ data.left.con }}
           </h2>
+          <a class="overturn-btn" v-if="isPreview" @click="changeShowLeft"><i class="el-icon-refresh"></i></a>
         </div>
-        <div class="right right-preview">
+        <div
+          class="right right-preview left-preview"
+          :class="[isPreview ? 'right-preview-rota' : '']"
+          v-if="(isPreview && !showLeft) || !isPreview"
+          :style="{ borderColor: data.borderColor }"
+        >
           <div class="hz-box">
             <div class="hz-item" v-for="(itemh, indexh) in data.right.hz_info" :key="indexh">
-              <p>{{ data.right.pinyin[indexh] ? data.right.pinyin[indexh] : '' }}</p>
+              <p :style="{ color: data.borderColor }">
+                {{ data.right.pinyin.split(' ')[indexh] ? data.right.pinyin.split(' ')[indexh] : '' }}
+              </p>
               <Strockplay
                 className="adult-strockplay"
                 :Book_text="itemh.con"
                 :playStorkes="true"
-                :strokePlayColor="'#D65353'"
+                :strokePlayColor="data.borderColor"
                 :strokeColor="'#000000'"
                 :palyWidth="'18px'"
                 :BoxbgType="'0'"
                 :curItem="itemh.hzDetail.hz_json"
-                :targetDiv="'writeTops-item-' + '-' + indexh + '-' + itemh.con"
+                :targetDiv="'writeTops-item-' + pageNumber + '-' + indexh + '-' + itemh.con"
                 :class="[indexh !== 0 ? 'writeTop-item-noLeft' : '']"
                 class="writeTop-item"
+                :style="{ borderColor: data.borderColor }"
               />
             </div>
+            <AudioPlay :file-id="data.right.audio_file" v-if="data.right.audio_file" />
           </div>
-          <AudioPlay :file-id="data.right.audio_file" v-if="data.right.audio_file" />
+
           <div class="definition-box">
             <div v-if="data.right.definition">
-              <label>释义:</label>
+              <label class="card-label">释义:</label>
               <p>{{ data.right.definition }}</p>
             </div>
             <div v-if="data.right.collocation">
-              <label>搭配:</label>
+              <label class="card-label">搭配:</label>
               <p>{{ data.right.collocation }}</p>
             </div>
             <div v-if="data.right.exampleSent">
-              <label>例句:</label>
+              <label class="card-label">例句:</label>
               <p>{{ data.right.exampleSent }}</p>
             </div>
           </div>
+          <a class="overturn-btn" v-if="isPreview" @click="changeShowLeft"><i class="el-icon-refresh"></i></a>
         </div>
       </div>
       <!-- <div class="writeBottom">
@@ -231,7 +251,34 @@ export default {
     padding-top: 0;
   }
 }
-
+.header-info-preview {
+  position: absolute;
+  width: 100%;
+  left: 0;
+  top: 0;
+  z-index: 1;
+  padding: 0 16px;
+  box-sizing: border-box;
+  h5 {
+    color: #000;
+    font-size: 24px;
+    font-weight: 400;
+    line-height: 32px;
+    padding: 0 12px;
+  }
+  label {
+    position: absolute;
+    right: 20px;
+    top: -4px;
+    border-radius: 0px 8px;
+    background: #fff;
+    padding: 0px 16px 0px 8px;
+    color: #fff;
+    font-size: 24px;
+    font-weight: 500;
+    line-height: 150%;
+  }
+}
 .writeTable {
   background: #ffffff;
   box-sizing: border-box;
@@ -253,12 +300,37 @@ export default {
     .left,
     .right {
       width: 600px;
-      height: 783px;
-      padding: 32px;
+      height: 450px;
+      padding: 8px 12px 18px 12px;
       border-radius: 24px;
       background: #fff;
       box-sizing: border-box;
       position: relative;
+      overflow: hidden;
+      .header-info {
+        display: flex;
+        width: 100%;
+        justify-content: space-between;
+        margin-bottom: 12px;
+        :deep .el-input__inner {
+          color: rgba(0, 0, 0, 1);
+          font-size: 24px;
+          font-weight: 400;
+          line-height: 100%;
+          height: 24px;
+          border: none;
+          padding: 0;
+        }
+        .label {
+          :deep .el-input__inner {
+            text-align: right;
+          }
+        }
+      }
+    }
+    .left-preview {
+      padding-top: 32px;
+      padding-bottom: 32px;
     }
     .left-big {
       display: flex;
@@ -387,28 +459,44 @@ export default {
       }
     }
     .item-con {
-      margin-top: 74px;
-      :deep .el-input__inner {
-        color: rgba(0, 0, 0, 1);
-        text-align: center;
-        font-size: 80px;
+      width: 100%;
+      display: flex;
+      align-items: center;
+      margin-top: 8px;
+      label {
+        color: #4e5969;
+        font-size: 14px;
         font-weight: 400;
-        line-height: 100%;
-        height: 80px;
-        font-family: 'FZJCGFKTK';
+        line-height: 22px;
+        width: 44px;
+      }
+      :deep .el-input__inner {
+        border-radius: 2px;
+        background: #f2f3f5;
+        width: 235px;
         border: none;
+        font-size: 14px;
+        font-weight: 400;
+        line-height: 22px;
+        height: 32px;
+        font-family: FZJCGFKTK;
+      }
+      .pinyin {
+        :deep .el-input__inner {
+          font-family: League;
+        }
       }
     }
     .con-preview {
-      margin-top: 74px;
+      margin-top: 16px;
       color: #000;
       text-align: center;
       font-family: 'FZJCGFKTK';
-      font-size: 80px;
+      font-size: 64px;
       font-weight: 400;
       line-height: 100%;
       &-big {
-        font-size: 144px;
+        font-size: 96px;
         margin-top: 0;
       }
     }

+ 186 - 49
src/views/wordcard/writeTableNew.vue

@@ -3,6 +3,10 @@
     <div class="writeTop" v-bind:class="{ flipped: isFlipped }">
       <template v-if="editCardflag">
         <div class="left">
+          <div class="header-info">
+            <el-input v-model="data.headerCon" placeholder="输入页眉"></el-input>
+            <el-input class="label" v-model="data.label" placeholder="输入标签"></el-input>
+          </div>
           <UploadDrag
             :fileList="data.left.fileList"
             @changeFillId="changeFillId"
@@ -11,34 +15,57 @@
           ></UploadDrag>
           <div class="item-image" v-else>
             <el-image
-              style="width: 536px; height: 536px"
+              style="width: 568px; height: 294px"
               :src="data.left.fileList[0].fileUrl"
               :preview-src-list="[data.left.fileList[0].fileUrl]"
               fit="contain"
             />
             <span class="item-image-del" @click="handleDeleteImg"><i class="el-icon-delete"></i></span>
           </div>
-          <el-input class="item-con" v-model="data.left.con" placeholder="输入" @blur="handleBlurCon"></el-input>
+          <div class="item-con">
+            <label>字词</label>
+            <el-input v-model="data.left.con" placeholder="输入" @blur="handleBlurCon"></el-input>
+          </div>
+          <div class="item-con">
+            <label>拼音</label>
+            <el-input class="pinyin" v-model="data.right.pinyin" placeholder="输入"></el-input>
+          </div>
           <a class="del-btn" @click="handleDelItem"><i class="el-icon-delete"></i></a>
         </div>
         <div class="right">
+          <div class="config-box">
+            <span class="title">主题颜色</span>
+            <el-color-picker v-model="data.borderColor" style="margin-right: 16px"></el-color-picker>
+            <span class="title">页眉颜色</span>
+            <el-color-picker v-model="data.fontColor" style="margin-right: 16px"></el-color-picker>
+            <span class="title">页眉对齐</span>
+            <el-radio-group v-model="data.fontAlign">
+              <el-radio label="left">左对齐</el-radio>
+              <el-radio label="center">居中对齐</el-radio>
+            </el-radio-group>
+          </div>
           <label>释义</label>
-          <el-input type="textarea" :rows="6" v-model="data.right.definition" placeholder="请输入"></el-input>
+          <el-input type="textarea" :rows="3" v-model="data.right.definition" placeholder="请输入"></el-input>
           <label>搭配</label>
-          <el-input type="textarea" :rows="6" v-model="data.right.collocation" placeholder="请输入"></el-input>
+          <el-input type="textarea" :rows="3" v-model="data.right.collocation" placeholder="请输入"></el-input>
           <label>例句</label>
-          <el-input type="textarea" :rows="6" v-model="data.right.exampleSent" placeholder="请输入"></el-input>
+          <el-input type="textarea" :rows="3" v-model="data.right.exampleSent" placeholder="请输入"></el-input>
         </div>
       </template>
       <template v-else>
         <div
-          class="left"
+          class="left left-preview"
           :class="[data.left.fileList.length === 0 ? 'left-big' : '']"
           v-if="(isPreview && showLeft) || !isPreview"
+          :style="{ borderColor: data.borderColor }"
         >
+          <div class="header-info-preview">
+            <h5 :style="{ textAlign: data.fontAlign }">{{ data.headerCon }}</h5>
+            <label :style="{ background: data.borderColor }">{{ data.label }}</label>
+          </div>
           <div class="item-image" v-if="data.left.fileList.length > 0">
             <el-image
-              style="width: 536px; height: 536px"
+              style="width: 568px; height: 294px"
               :src="data.left.fileList[0].fileUrl"
               :preview-src-list="[data.left.fileList[0].fileUrl]"
               fit="contain"
@@ -50,18 +77,25 @@
           <a class="overturn-btn" v-if="isPreview" @click="changeShowLeft"><i class="el-icon-refresh"></i></a>
         </div>
         <div
-          class="right right-preview"
+          class="right right-preview left-preview"
           :class="[isPreview ? 'right-preview-rota' : '']"
           v-if="(isPreview && !showLeft) || !isPreview"
+          :style="{ borderColor: data.borderColor }"
         >
+          <div class="header-info-preview">
+            <h5 :style="{ textAlign: data.fontAlign }">{{ data.headerCon }}</h5>
+            <label :style="{ background: data.borderColor }">{{ data.label }}</label>
+          </div>
           <div class="hz-box">
             <div class="hz-item" v-for="(itemh, indexh) in data.right.hz_info" :key="indexh">
-              <p>{{ data.right.pinyin[indexh] ? data.right.pinyin[indexh] : '' }}</p>
+              <p :style="{ color: data.borderColor }">
+                {{ data.right.pinyin.split(' ')[indexh] ? data.right.pinyin.split(' ')[indexh] : '' }}
+              </p>
               <Strockplay
                 className="adult-strockplay"
                 :Book_text="itemh.con"
                 :playStorkes="true"
-                :strokePlayColor="'#D65353'"
+                :strokePlayColor="data.borderColor"
                 :strokeColor="'#000000'"
                 :palyWidth="'18px'"
                 :BoxbgType="'0'"
@@ -69,21 +103,23 @@
                 :targetDiv="'writeTops-item-' + pageNumber + '-' + indexh + '-' + itemh.con"
                 :class="[indexh !== 0 ? 'writeTop-item-noLeft' : '']"
                 class="writeTop-item"
+                :style="{ borderColor: data.borderColor }"
               />
             </div>
+            <AudioPlay :file-id="data.right.audio_file" v-if="data.right.audio_file" />
           </div>
-          <AudioPlay :file-id="data.right.audio_file" v-if="data.right.audio_file" />
+
           <div class="definition-box">
             <div v-if="data.right.definition">
-              <label>释义:</label>
+              <label class="card-label">释义:</label>
               <p>{{ data.right.definition }}</p>
             </div>
             <div v-if="data.right.collocation">
-              <label>搭配:</label>
+              <label class="card-label">搭配:</label>
               <p>{{ data.right.collocation }}</p>
             </div>
             <div v-if="data.right.exampleSent">
-              <label>例句:</label>
+              <label class="card-label">例句:</label>
               <p>{{ data.right.exampleSent }}</p>
             </div>
           </div>
@@ -218,17 +254,18 @@ export default {
             hz_list.push(obj);
           });
           this.data.right.hz_info = hz_list;
-          this.data.right.pinyin = cnchar.spell(con, 'array', 'low', 'tone');
+          this.data.right.pinyin = cnchar.spell(con, 'array', 'low', 'tone').join(' ');
           let MethodName = 'tool-TextToVoiceFile';
-          let datas = {
-            text: con,
-          };
-          getLogin(MethodName, datas).then((res) => {
-            if (res.status === 1) {
-              this.data.right.audio_file = res.file_id;
-            }
-          });
-          console.log(this.data);
+          if (con) {
+            let datas = {
+              text: con,
+            };
+            getLogin(MethodName, datas).then((res) => {
+              if (res.status === 1) {
+                this.data.right.audio_file = res.file_id;
+              }
+            });
+          }
         })
         .catch(() => {
           this.loading = false;
@@ -275,14 +312,14 @@ export default {
 <style lang="scss" scoped>
 .writeTable {
   width: 1208px;
-  margin: 0 auto 8px auto;
+  margin: 0 auto 19px auto;
   // height: 842px;
   box-sizing: border-box;
   &-preview {
     width: 600px;
   }
   .writeTop {
-    height: 800px;
+    height: 450px;
     display: flex;
     column-gap: 8px;
     perspective: 1000px;
@@ -291,11 +328,63 @@ export default {
     .right {
       width: 600px;
       height: 100%;
-      padding: 32px;
+      padding: 8px 12px 18px 12px;
       border-radius: 24px;
       background: #fff;
       box-sizing: border-box;
       position: relative;
+      border: 4px solid #fff;
+      overflow: hidden;
+      .header-info {
+        display: flex;
+        width: 100%;
+        justify-content: space-between;
+        margin-bottom: 12px;
+        :deep .el-input__inner {
+          color: rgba(0, 0, 0, 1);
+          font-size: 24px;
+          font-weight: 400;
+          line-height: 100%;
+          height: 24px;
+          border: none;
+          padding: 0;
+        }
+        .label {
+          :deep .el-input__inner {
+            text-align: right;
+          }
+        }
+      }
+    }
+    .left-preview {
+      padding-top: 32px;
+      padding-bottom: 32px;
+    }
+    .header-info-preview {
+      position: absolute;
+      width: 100%;
+      left: 0;
+      top: 0;
+      z-index: 1;
+      h5 {
+        color: #000;
+        font-size: 24px;
+        font-weight: 400;
+        line-height: 32px;
+        padding: 0 12px;
+      }
+      label {
+        position: absolute;
+        right: -4px;
+        top: -4px;
+        border-radius: 0px 8px;
+        background: #fff;
+        padding: 0px 16px 0px 8px;
+        color: #fff;
+        font-size: 24px;
+        font-weight: 500;
+        line-height: 150%;
+      }
     }
     .left-big {
       display: flex;
@@ -304,13 +393,14 @@ export default {
     }
     .del-btn {
       cursor: pointer;
-      border-radius: 8px;
+      border-radius: 40px;
       background: #f56767;
-      padding: 8px;
+      padding: 5px 8px;
       position: absolute;
-      right: 24px;
-      bottom: 24px;
+      right: 8px;
+      bottom: 8px;
       color: #fff;
+      font-size: 24px;
     }
     .overturn-btn {
       position: absolute;
@@ -330,10 +420,10 @@ export default {
       display: flex;
       align-items: center;
       flex-flow: wrap;
-      padding: 120px 86px;
+      padding: 16px 24px 26px 24px;
       row-gap: 8px;
 
-      label {
+      .card-label {
         width: 100%;
         color: #4e5969;
         font-size: 14px;
@@ -342,14 +432,42 @@ export default {
         height: 22px;
       }
       :deep .el-textarea {
-        height: 140px;
+        height: 64px;
+      }
+      .config-box {
+        display: flex;
+        align-items: center;
+        span {
+          color: #000;
+          font-size: 14px;
+          line-height: 20px;
+          margin-right: 8px;
+        }
+        .el-color-picker {
+          height: 32px;
+        }
+        :deep .el-color-picker__trigger {
+          height: 32px;
+        }
+        .el-radio {
+          margin-right: 8px;
+        }
+        .el-radio-group {
+          display: flex;
+        }
+        :deep .el-radio__input.is-checked .el-radio__inner {
+          border-color: #000;
+          background: #000;
+        }
+        :deep .el-radio__input.is-checked + .el-radio__label {
+          color: #000;
+        }
       }
     }
     .right-preview {
       padding: 72px;
       display: block;
       .hz-box {
-        justify-content: center;
         width: 100%;
         .hz-item {
           text-align: center;
@@ -361,14 +479,14 @@ export default {
             color: #de4444;
             font-feature-settings: 'cv01' on;
             font-family: League;
-            font-size: 20px;
+            font-size: 24px;
             line-height: 120%;
             margin-bottom: 8px;
           }
         }
       }
       :deep .audio-wrapper {
-        margin: 24px auto;
+        margin: 58px 0 0 35px;
         border-radius: 40px;
         background: #f3f3f3;
         padding: 16px;
@@ -383,9 +501,10 @@ export default {
       }
       .definition-box {
         white-space: pre;
+        margin-top: 16px;
         > div {
           display: flex;
-          margin-bottom: 16px;
+          margin-bottom: 8px;
           label,
           p {
             width: 40px;
@@ -408,6 +527,7 @@ export default {
       background: #f2f3f5;
       border-radius: 8px;
       overflow: hidden;
+      font-size: 0;
       .item-image-del {
         position: absolute;
         top: 8px;
@@ -421,31 +541,48 @@ export default {
         padding: 8px;
         border-radius: 50%;
         box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25);
+        font-size: 16px;
       }
     }
     .item-con {
-      margin-top: 74px;
-      :deep .el-input__inner {
-        color: rgba(0, 0, 0, 1);
-        text-align: center;
-        font-size: 80px;
+      width: 100%;
+      display: flex;
+      align-items: center;
+      margin-top: 8px;
+      label {
+        color: #4e5969;
+        font-size: 14px;
         font-weight: 400;
-        line-height: 100%;
-        height: 80px;
-        font-family: 'FZJCGFKTK';
+        line-height: 22px;
+        width: 44px;
+      }
+      :deep .el-input__inner {
+        border-radius: 2px;
+        background: #f2f3f5;
+        width: 235px;
         border: none;
+        font-size: 14px;
+        font-weight: 400;
+        line-height: 22px;
+        height: 32px;
+        font-family: FZJCGFKTK;
+      }
+      .pinyin {
+        :deep .el-input__inner {
+          font-family: League;
+        }
       }
     }
     .con-preview {
-      margin-top: 74px;
+      margin-top: 16px;
       color: #000;
       text-align: center;
       font-family: 'FZJCGFKTK';
-      font-size: 80px;
+      font-size: 64px;
       font-weight: 400;
       line-height: 100%;
       &-big {
-        font-size: 144px;
+        font-size: 96px;
         margin-top: 0;
       }
     }