Ver código fonte

句子模式

natasha 1 ano atrás
pai
commit
94596c1704
1 arquivos alterados com 39 adições e 29 exclusões
  1. 39 29
      src/views/wordcard/cread.vue

+ 39 - 29
src/views/wordcard/cread.vue

@@ -100,7 +100,9 @@
                   class="numbre-input"
                 ></el-input>
                 <span style="margin-left: 8px">行</span> -->
-                <el-checkbox class="auto-complete" v-model="from.autoCompletion">自动补足页面空白</el-checkbox>
+                <el-checkbox v-if="typeIndex == 0" class="auto-complete" v-model="from.autoCompletion"
+                  >自动补足页面空白</el-checkbox
+                >
               </div>
             </div>
             <div class="dv">
@@ -580,38 +582,40 @@ export default {
           if (contentItem) data.option.push(contentItem);
         }
       }
-      await data.option.forEach(async (item, i) => {
-        let hz_list = [];
-        item.con.split('').forEach((items) => {
-          let res = JSON.parse(JSON.stringify(hzDetailList[items]));
-          let obj = {
-            con: items,
-            hzDetail: {
-              hz_json: res,
-            },
-          };
-          hz_list.push(obj);
-        });
-        item.hz_list = hz_list;
-        item.pinyin = pinyin(item.con);
-        let MethodName = 'tool-PinyinToVoiceFile';
-        let datas = {
-          pinyin: item.pinyin.split(' ').join(','),
-        };
-        await getLogin(MethodName, datas).then((res) => {
-          if (res.status === 1) {
-            audio_file_obj[item.con] = res.file_id;
-          }
-        });
-      });
 
       //   字模式 笔顺打开
       if (data.typeIndex == 0) {
         let allArr = [];
+        await data.option.forEach(async (item, i) => {
+          let hz_list = [];
+          item.con.split('').forEach((items) => {
+            let res = JSON.parse(JSON.stringify(hzDetailList[items]));
+            let obj = {
+              con: items,
+              hzDetail: {
+                hz_json: res,
+              },
+            };
+            hz_list.push(obj);
+          });
+          item.hz_list = hz_list;
+          item.pinyin = pinyin(item.con);
+          let MethodName = 'tool-PinyinToVoiceFile';
+          let datas = {
+            pinyin: item.pinyin.split(' ').join(','),
+          };
+          await getLogin(MethodName, datas).then((res) => {
+            if (res.status === 1) {
+              audio_file_obj[item.con] = res.file_id;
+            }
+          });
+        });
+
         data.option.forEach((item) => {
           let arr = [];
           let hzLength = 1;
           let arrOption = [];
+          let newarr = [];
 
           if (data.StorkesUnfold) {
             // 拆分字和笔画为每一项
@@ -908,17 +912,23 @@ export default {
             allArr.push(JSON.parse(JSON.stringify(sentenceItemNull)));
           }
         }
-
-        data.result = this.arrSplice(allArr, data.pageNumber);
+        console.log(allArr);
+        for (let i = 0; i < allArr.length; i += data.pageNumber) {
+          final_result.push({
+            list: allArr.slice(i, i + data.pageNumber),
+          });
+        }
+        // data.result = this.arrSplice(allArr, data.pageNumber);
+        data.result = final_result;
         data.result.forEach((item, index) => {
-          item.forEach((items, indexs) => {
+          item.list.forEach((items, indexs) => {
             items.forEach((itemss, indexss) => {
               if (itemss.con) {
                 let res = JSON.parse(JSON.stringify(hzDetailList[itemss.con]));
                 itemss.hzDetail = {
                   hz_json: null,
                 };
-                this.$set(data.result[index][indexs][indexss], 'hzDetail', res);
+                this.$set(data.result[index].list[indexs][indexss], 'hzDetail', res);
               }
             });
           });