|
@@ -342,7 +342,7 @@
|
|
|
//这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
|
|
|
//例如:import 《组件名称》from ‘《组件路径》';
|
|
|
import Header from "@/components/Header";
|
|
|
-import { getLogin } from "@/api/api";
|
|
|
+import { getLogin, BookgetContent } from "@/api/api";
|
|
|
import Strockplayredline from "@/components/corpus/Strockplayredline";
|
|
|
import StrockplayredlineCorpus from "@/components/corpus/StrockplayredlineCorpus";
|
|
|
import "@/utils/pinyin_dict_withtone";
|
|
@@ -744,6 +744,11 @@ export default {
|
|
|
],
|
|
|
conSize: 20,
|
|
|
pinyinSize: 12,
|
|
|
+ list1: [],
|
|
|
+ list2: [],
|
|
|
+ list3: [],
|
|
|
+ allList: [],
|
|
|
+ CurrentList: [],
|
|
|
};
|
|
|
},
|
|
|
//计算属性 类似于data概念
|
|
@@ -954,11 +959,213 @@ export default {
|
|
|
this.KWIC_sortIndex = 0;
|
|
|
this.cutSize(1);
|
|
|
},
|
|
|
+ getdata() {
|
|
|
+ this.loading = true;
|
|
|
+ let Mname =
|
|
|
+ "book-courseware_manager-GetCoursewareWordExampleSentenceList";
|
|
|
+ let data = {
|
|
|
+ courseware_id: "003-20211012-17-BDUZ1JVCAN",
|
|
|
+ // word: this.$route.query.keyword, // 单词
|
|
|
+ word: "我",
|
|
|
+ search_scope: 2, // 检索范围 0 【本章】,1【本教材】,2【本套教材】,3【系统所有教材】
|
|
|
+ // 本章:同一本教材下,归属同一个第一级章节下的所有课件为同一章。
|
|
|
+ is_contain_word_variants: false, // 是否包含单词变体例句
|
|
|
+ // is_contain_stat_data: true, //
|
|
|
+ };
|
|
|
+ BookgetContent(Mname, data)
|
|
|
+ .then((res) => {
|
|
|
+ this.allList = {
|
|
|
+ sentence_list: [],
|
|
|
+ sentence_list_sort_left: [],
|
|
|
+ sentence_list_sort_mid: [],
|
|
|
+ sentence_list_sort_right: [],
|
|
|
+ };
|
|
|
+ this.rightList = res.stat_list_sentence_source_book
|
|
|
+ if (res.sentence_list.length > 0) {
|
|
|
+ this.allList.sentence_list = this.handleExample(res.sentence_list);
|
|
|
+ this.allList.sentence_list_sort_left = this.handleExample(
|
|
|
+ res.sentence_list_sort_left,
|
|
|
+ "left"
|
|
|
+ );
|
|
|
+ this.allList.sentence_list_sort_mid = this.handleExample(
|
|
|
+ res.sentence_list_sort_mid,
|
|
|
+ "mid"
|
|
|
+ );
|
|
|
+ this.allList.sentence_list_sort_right = this.handleExample(
|
|
|
+ res.sentence_list_sort_right,
|
|
|
+ "right"
|
|
|
+ );
|
|
|
+ }
|
|
|
+ this.loading = false;
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ this.loading3 = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleExample(list, type) {
|
|
|
+ if (list.length > 0) {
|
|
|
+ list = list.map((item, index) => {
|
|
|
+ let str = item.source_courseware_name_path;
|
|
|
+ item.show_source_courseware_name_path = str.slice(0, 8) + "...";
|
|
|
+ if (type == "left") {
|
|
|
+ let sentence = JSON.parse(JSON.stringify(item.sentence));
|
|
|
+ let arr = JSON.parse(JSON.stringify(item.sentence_fc_list));
|
|
|
+ arr.forEach((items, indexs) => {
|
|
|
+ if (indexs == item.sentence_fc_list_word_index) {
|
|
|
+ arr[
|
|
|
+ indexs
|
|
|
+ ] = `<span style=color:#DE4444;font-weight:700;>${arr[indexs]}</span>`;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ let data = this.changefiveword(
|
|
|
+ arr,
|
|
|
+ item.sentence_fc_list_word_index,
|
|
|
+ type
|
|
|
+ );
|
|
|
+ item.resArr = data;
|
|
|
+ } else if (type == "right") {
|
|
|
+ let sentence = JSON.parse(JSON.stringify(item.sentence));
|
|
|
+ let arr = JSON.parse(JSON.stringify(item.sentence_fc_list));
|
|
|
+ arr.forEach((items, indexs) => {
|
|
|
+ if (indexs == item.sentence_fc_list_word_index) {
|
|
|
+ arr[
|
|
|
+ indexs
|
|
|
+ ] = `<span style=color:#DE4444;font-weight:700;>${arr[indexs]}</span>`;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ let data = this.changefiveword(
|
|
|
+ arr,
|
|
|
+ item.sentence_fc_list_word_index,
|
|
|
+ type
|
|
|
+ );
|
|
|
+ item.resArr = data;
|
|
|
+ } else if (type == "mid") {
|
|
|
+ let sentence = JSON.parse(JSON.stringify(item.sentence));
|
|
|
+ let arr = JSON.parse(JSON.stringify(item.sentence_fc_list));
|
|
|
+ arr.forEach((items, indexs) => {
|
|
|
+ if (indexs == item.sentence_fc_list_word_index) {
|
|
|
+ arr[
|
|
|
+ indexs
|
|
|
+ ] = `<span style=color:#DE4444;font-weight:700;>${arr[indexs]}</span>`;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ let data = this.changefiveword(
|
|
|
+ arr,
|
|
|
+ item.sentence_fc_list_word_index,
|
|
|
+ type
|
|
|
+ );
|
|
|
+ item.resArr = data;
|
|
|
+ } else {
|
|
|
+ let newsentence = JSON.parse(JSON.stringify(item.sentence));
|
|
|
+ let res = "";
|
|
|
+ for (let i = 0; i < item.position_list.length; i++) {
|
|
|
+ let part1 = "";
|
|
|
+ let part2 = "";
|
|
|
+ let part3 = "";
|
|
|
+ if (item.position_list.length > 1) {
|
|
|
+ if (i == 0) {
|
|
|
+ part1 = newsentence.substring(0, item.position_list[i].begin);
|
|
|
+ part2 = newsentence.substring(
|
|
|
+ item.position_list[i].begin,
|
|
|
+ item.position_list[i].end
|
|
|
+ );
|
|
|
+ part3 = newsentence.substring(
|
|
|
+ item.position_list[i].end,
|
|
|
+ item.position_list[i + 1].begin
|
|
|
+ );
|
|
|
+ } else if (i == item.position_list.length - 1) {
|
|
|
+ part2 = newsentence.substring(
|
|
|
+ item.position_list[i].begin,
|
|
|
+ item.position_list[i].end
|
|
|
+ );
|
|
|
+ part3 = newsentence.substring(item.position_list[i].end);
|
|
|
+ } else {
|
|
|
+ part2 = newsentence.substring(
|
|
|
+ item.position_list[i].begin,
|
|
|
+ item.position_list[i].end
|
|
|
+ );
|
|
|
+ part3 = newsentence.substring(
|
|
|
+ item.position_list[i].end,
|
|
|
+ item.position_list[i + 1].begin
|
|
|
+ );
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ part1 = newsentence.substring(0, item.position_list[i].begin);
|
|
|
+ part2 = newsentence.substring(
|
|
|
+ item.position_list[i].begin,
|
|
|
+ item.position_list[i].end
|
|
|
+ );
|
|
|
+ part3 = newsentence.substring(item.position_list[i].end);
|
|
|
+ }
|
|
|
+ res +=
|
|
|
+ part1 +
|
|
|
+ '<span style="color:#DE4444;">' +
|
|
|
+ part2 +
|
|
|
+ "</span>" +
|
|
|
+ part3;
|
|
|
+ }
|
|
|
+ item.res = res;
|
|
|
+ }
|
|
|
+ return item;
|
|
|
+ });
|
|
|
+ return list;
|
|
|
+ } else {
|
|
|
+ return [];
|
|
|
+ }
|
|
|
+ },
|
|
|
+ changefiveword(arr, index, type) {
|
|
|
+ let num = 6;
|
|
|
+ let colorIndex = 0;
|
|
|
+ let colorList = ["#4D7EFF", "#A4430F", "#9342C5", "#FF8718", "#1DAA91"];
|
|
|
+ for (let i = 1; i < num; i++) {
|
|
|
+ if (type == "left") {
|
|
|
+ if (index - i >= 0) {
|
|
|
+ if (this.chsFhList.indexOf(arr[index - i]) == -1) {
|
|
|
+ arr[index - i] = `<span style=color:${colorList[colorIndex]};>${
|
|
|
+ arr[index - i]
|
|
|
+ }</span>`;
|
|
|
+ colorIndex++;
|
|
|
+ } else {
|
|
|
+ num++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (type == "right") {
|
|
|
+ if (index + i <= arr.length - 1) {
|
|
|
+ if (this.chsFhList.indexOf(arr[index + i]) == -1) {
|
|
|
+ arr[index + i] = `<span style=color:${colorList[colorIndex]};>${
|
|
|
+ arr[index + i]
|
|
|
+ }</span>`;
|
|
|
+ colorIndex++;
|
|
|
+ } else {
|
|
|
+ num++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let newarr = [];
|
|
|
+ let arr1 = [];
|
|
|
+ let arr2 = [];
|
|
|
+ let arr3 = [];
|
|
|
+ arr.forEach((item, i) => {
|
|
|
+ if (i < index) {
|
|
|
+ arr1.push(item);
|
|
|
+ } else if (i == index) {
|
|
|
+ arr2.push(item);
|
|
|
+ } else {
|
|
|
+ arr3.push(item);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ newarr.push(arr1);
|
|
|
+ newarr.push(arr2);
|
|
|
+ newarr.push(arr3);
|
|
|
+ return newarr;
|
|
|
+ },
|
|
|
},
|
|
|
//生命周期 - 创建完成(可以访问当前this实例)
|
|
|
created() {
|
|
|
if (this.$route.query.keyword) {
|
|
|
this.changehzdata();
|
|
|
+ this.getdata();
|
|
|
}
|
|
|
},
|
|
|
//生命周期 - 挂载完成(可以访问DOM元素)
|