natasha пре 2 година
родитељ
комит
f7ef9fca3f

+ 78 - 5
src/components/Header.vue

@@ -26,6 +26,54 @@
           <div @click="seekresult">搜索</div>
         </div>
       </template>
+        <el-popover
+          placement="bottom"
+          width="335"
+          trigger="click"
+          v-model="visibleOption"
+        >
+          <div class="set_corpus_dv">
+            <span>选择难度</span>
+            <el-select
+              style="width: 205px"
+              v-model="corpus.difficlty"
+              placeholder="请选择"
+            >
+                <el-option v-for="(itemD,indexD) in difficltyList" :key="indexD" :label="itemD.label" :value="itemD.value"></el-option>
+            </el-select>
+          </div>
+          <div class="set_corpus_dv">
+            <span>选择范围</span>
+            <el-select
+              style="width: 205px"
+              v-model="corpus.scope"
+              placeholder="请选择"
+            >
+                <el-option v-for="(itemD,indexD) in scopeList" :key="indexD" :label="itemD.label" :value="itemD.value"></el-option>
+            </el-select>
+          </div>
+          <div class="set_corpus_dv">
+            <span>句子长度</span>
+            <el-input
+              v-model="corpus.sentenceStart"
+              style="width: 55px; margin-right: 8px;"
+              type="number"
+              class="numbre-input"
+            ></el-input>
+            ——
+            <el-input
+              v-model="corpus.sentenceEnd"
+              style="width: 55px; margin-left: 8px"
+              type="number"
+              class="numbre-input"
+            ></el-input>
+          </div>
+          <div class="set_corpus_submit">
+            <div @click="visibleOption = false">取消</div>
+            <div @click="visibleOption = false">确认</div>
+          </div>
+          <div slot="reference" class="set_corpus" style="margin-left: 24px;cursor:pointer;">设置条件</div>
+        </el-popover>
     </div>
     <div class="userName">
       <template v-if="projectShow">
@@ -42,6 +90,7 @@
               v-model="corpus.difficlty"
               placeholder="请选择"
             >
+                <el-option v-for="(itemD,indexD) in difficltyList" :key="indexD" :label="itemD.label" :value="itemD.value"></el-option>
             </el-select>
           </div>
           <div class="set_corpus_dv">
@@ -51,25 +100,30 @@
               v-model="corpus.scope"
               placeholder="请选择"
             >
+                <el-option v-for="(itemD,indexD) in scopeList" :key="indexD" :label="itemD.label" :value="itemD.value"></el-option>
             </el-select>
           </div>
           <div class="set_corpus_dv">
             <span>句子长度</span>
             <el-input
               v-model="corpus.sentenceStart"
-              style="width: 55px; margin-right: 8px"
+              style="width: 55px; margin-right: 8px;"
+              type="number"
+              class="numbre-input"
             ></el-input>
             ——
             <el-input
               v-model="corpus.sentenceEnd"
               style="width: 55px; margin-left: 8px"
+              type="number"
+              class="numbre-input"
             ></el-input>
           </div>
           <div class="set_corpus_submit">
             <div @click="visible = false">取消</div>
-            <div>确认</div>
+            <div @click="visible = false">确认</div>
           </div>
-          <div slot="reference" class="set_corpus">设置</div>
+          <div slot="reference" class="set_corpus" v-if="!seekOption">设置</div>
         </el-popover>
       </template>
       <template>
@@ -151,11 +205,12 @@ import { updateWordPack } from "@/utils/i18n";
 
 export default {
   name: "LayoutHeader",
-  props: ["projectShow", "seekShow"],
+  props: ["projectShow", "seekShow", "seekOption"],
   data() {
     return {
-      keyword: "",
+      keyword: this.$route.query.keyword?this.$route.query.keyword:'',
       visible: false,
+      visibleOption: false,
       corpus: {
         difficlty: null,
         scope: null,
@@ -225,6 +280,18 @@ export default {
       headTimer: null,
       configInfor: null,
       isData: false,
+      difficltyList: [
+        {
+            value: '',
+            label: '全部'
+        }
+      ],
+      scopeList: [
+        {
+            value: '',
+            label: '全部'
+        }
+      ]
     };
   },
   watch: {},
@@ -644,6 +711,12 @@ export default {
     color: #000000;
     margin-right: 18px;
   }
+  .numbre-input{
+    .el-input__inner{
+        padding: 0;
+        text-align: center;
+    }
+  }
 }
 .set_corpus_submit {
   margin-top: 32px;

+ 203 - 0
src/components/corpus/StrockplayredlineTable.vue

@@ -0,0 +1,203 @@
+<!--  -->
+<template>
+  <div
+    :class="['strockplayRedInner']"
+  >
+    <!-- <div
+      @click="playHanzi"
+      :class="[
+        'strock-play-box',
+        themeColor == 'green'
+          ? 'green-border'
+          : themeColor == 'red'
+          ? 'red-border'
+          : themeColor == 'brown'
+          ? 'brown-border'
+          : 'blue-border',
+      ]"
+      v-if="playStorkes"
+    ></div> -->
+    <template v-if="Book_text != '〇'">
+      <div :id="targetDivGray" class="character-target-div character-target-div-gray"></div>
+      <div :id="targetDiv" class="character-target-div"></div>
+    </template>
+    <template v-else>
+      <span class="book-text">{{ Book_text }}</span>
+    </template>
+    <svg-icon
+        icon-class="tian"
+        className="tian-bg"
+        v-if="BoxbgType==0"
+        :style="{color:'#DEDEDE'}"
+    />
+    <svg-icon
+        icon-class="mi"
+        className="tian-bg"
+        v-if="BoxbgType==1"
+        :style="{color:'#DEDEDE'}"
+    />
+    <!-- <svg-icon
+      icon-class="tian"
+      :className="tianColor ? 'tian-bg-red' : 'tian-bg'"
+    /> -->
+  </div>
+</template>
+
+<script>
+import { getContentFile } from "@/api/api";
+const HanziWriter = require("hanzi-writer");
+export default {
+  name: "Strockplayredline",
+  components: {},
+  props: [
+    "targetDiv",
+    "Book_text",
+    "playStorkes",
+    "strokeColor",
+    "strokeColorgray",
+    "curItem",
+    "strokeNumber",
+    "targetDivGray",
+    "BoxbgType"
+  ],
+  data() {
+    return {
+      writer: null,
+    };
+  },
+  computed: {},
+  watch: {
+    targetDiv: {
+      handler: function (val, oldVal) {
+        if (val != oldVal) {
+          let _this = this;
+          _this.$nextTick(() => {
+            _this.initHanziwrite();
+          });
+        }
+      },
+      // 深度观察监听
+      deep: true,
+    },
+  },
+  //方法集合
+  methods: {
+    initHanziwrite() {
+      let _this = this;
+      if (_this.Book_text == "〇") return false;
+      _this.writer = null;
+      //var ren = require("hanzi-writer-data/国");
+      _this.writer = HanziWriter.default.create(
+        _this.targetDiv,
+        _this.Book_text,
+        {
+          padding: 5,
+          showOutline: true,
+          strokeColor: _this.strokeColor,
+          charDataLoader: function (char, onComplete) {
+            let charData = _this.handleData(Number(_this.strokeNumber));
+            onComplete(charData);
+          },
+        }
+      );
+      _this.writer = HanziWriter.default.create(
+        _this.targetDivGray,
+        _this.Book_text,
+        {
+          padding: 5,
+          showOutline: true,
+          strokeColor: _this.strokeColorgray,
+          charDataLoader: function (char, onComplete) {
+            onComplete(JSON.parse(JSON.stringify(_this.curItem)));
+          },
+        }
+      );
+    },
+    handleData(stroke_num) {
+      if (this.curItem) {
+        let charData = JSON.parse(JSON.stringify(this.curItem));
+        if (stroke_num) {
+            let stroke_arr = [];
+            for(let i = 0; i<stroke_num;i++){
+                stroke_arr.push(i+1)
+            }
+            stroke_arr = stroke_arr.map((item) => (item = Number(item) - 1));
+            let strokes = [],
+                medians = [];
+            for (let i = 0; i < stroke_arr.length; i++) {
+                let stroke_num = stroke_arr[i];
+                strokes.push(charData.strokes[stroke_num]);
+                medians.push(charData.medians[stroke_num]);
+            }
+            charData.strokes = strokes;
+            charData.medians = medians;
+        } else if (charData) {
+          charData.radStrokes = [];
+        }
+        return charData;
+      }
+    },
+    playHanzi(event) {
+      let _this = this;
+      _this.writer.animateCharacter();
+      event.stopPropagation();
+    },
+  },
+  //生命周期 - 创建完成(可以访问当前this实例)
+  created() {},
+  //生命周期 - 挂载完成(可以访问DOM元素)
+  mounted() {
+    let _this = this;
+    _this.$nextTick(() => {
+      _this.initHanziwrite();
+    });
+  },
+  beforeCreate() {}, //生命周期 - 创建之前
+  beforeMount() {}, //生命周期 - 挂载之前
+  beforeUpdate() {}, //生命周期 - 更新之前
+  updated() {}, //生命周期 - 更新之后
+  beforeDestroy() {}, //生命周期 - 销毁之前
+  destroyed() {}, //生命周期 - 销毁完成
+  activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
+};
+</script>
+<style lang='scss' scoped>
+//@import url(); 引入公共css类
+// @import "../common.scss";
+.strockplayRedInner {
+  position: relative;
+
+  width: 100%; //444px
+  height: 100%; //480px
+}
+.character-target-div {
+  width: 100%;
+  height: 100%;
+  z-index: 99999;
+  position: absolute;
+}
+.character-target-div-gray{
+    top: 0;
+    left: 0;
+}
+.tian-bg {
+  width: 100%;
+  height: 100%;
+  position: absolute;
+  left: 0;
+  top: 0;
+}
+.animate-butto {
+  width: 240px;
+  height: 160px;
+  font-size: 28px;
+}
+.book-text {
+  font-size: 96px;
+  display: block;
+  width: 100%;
+  height: 100%;
+  text-align: center;
+  line-height: 128px;
+}
+</style>

+ 4 - 4
src/views/corpus/Result.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="result" v-loading="loading">
-    <Header :projectShow="true" :seekShow="true" @changehzdata="changehzdata" />
+    <Header :projectShow="true" :seekShow="true" :seekOption="true" @changehzdata="changehzdata" />
     <div class="main">
       <div
         class="hanzi_list"
@@ -242,8 +242,8 @@
                       fontSize: conSize + 'px',
                     }"
                   >
-                    <div v-for="(txt, indexs) in item.resArr">
-                      <span v-for="(txts, indexs) in txt" v-html="txts"></span>
+                    <div v-for="(txt, indexs) in item.resArr" :key="indexs">
+                      <span v-for="(txts, indexs) in txt" v-html="txts" :key="indexs"></span>
                     </div>
                   </div>
                 </div>
@@ -392,7 +392,7 @@ export default {
             },
             {
               pinyin: "",
-              con: "?",
+              con: "",
             },
           ],
           shiyi: "good, ok",

+ 1 - 1
src/views/corpus/seekPage.vue

@@ -9,7 +9,7 @@
       <input type="text" v-model="keyword" />
       <button @click="seekEvent">搜索</button>
     </div>
-    <div class="txt">共{{ 123 }}本教材,合计{{ 321 }}词。</div>
+    <div class="txt">共{{ 120 }}本教材,合计{{ 123124 }}词。</div>
   </div>
 </template>