|
@@ -130,7 +130,7 @@
|
|
|
<div v-for="(txt, indexs) in item.resArr" :key="indexs">
|
|
|
<span
|
|
|
v-for="(txts, indexs) in txt"
|
|
|
- v-html="txts"
|
|
|
+ v-html="txts[0]"
|
|
|
:key="indexs"
|
|
|
></span>
|
|
|
</div>
|
|
@@ -186,6 +186,20 @@ export default {
|
|
|
},
|
|
|
pageNo: 1,
|
|
|
pageNoNew: 1,
|
|
|
+ enFhList: [
|
|
|
+ ",",
|
|
|
+ ".",
|
|
|
+ ";",
|
|
|
+ "?",
|
|
|
+ "!",
|
|
|
+ ":",
|
|
|
+ ">",
|
|
|
+ "<",
|
|
|
+ "'",
|
|
|
+ "’",
|
|
|
+ ")",
|
|
|
+ "”",
|
|
|
+ ],
|
|
|
}
|
|
|
},
|
|
|
//计算属性 类似于data概念
|
|
@@ -362,7 +376,7 @@ export default {
|
|
|
str += items[0] + ' '
|
|
|
})
|
|
|
item.res = str
|
|
|
- item.source_courseware_name_path = item.study_phase_name + '版 / ' + item.iss_no + ' / '
|
|
|
+ item.source_courseware_name_path = item.study_phase_name + '版 / ' + item.iss_no + ' / ' + item.release_date + ' / ' + item.art_title
|
|
|
});
|
|
|
this.sentKwicData.sentence_list = res.data.results
|
|
|
}
|
|
@@ -376,7 +390,7 @@ export default {
|
|
|
word: this.data.word,
|
|
|
page_size: 30,
|
|
|
page_no: this.pageNo,
|
|
|
- only_my_bought: true,
|
|
|
+ only_my_bought: false,
|
|
|
kwic_type: 1
|
|
|
})
|
|
|
.then((res) => {
|
|
@@ -384,19 +398,11 @@ export default {
|
|
|
if(res.status===1){
|
|
|
if(res.data&&res.data.results){
|
|
|
res.data.results.forEach((item,indexs) => {
|
|
|
- let tokenIndexArr = [item.token_idx]
|
|
|
- let str = ''
|
|
|
item.number = indexs+1
|
|
|
- tokenIndexArr.forEach(index=>{
|
|
|
- item.tokens[index][0] = '<span style=\"color:#ED5F00;font-weight:600;\">'+ item.tokens[index][0] + '</span>'
|
|
|
- })
|
|
|
- item.tokens.forEach(items=>{
|
|
|
- str += items[0] + ' '
|
|
|
- })
|
|
|
- item.res = str
|
|
|
- item.source_courseware_name_path = item.study_phase_name + '版 / ' + item.iss_no + ' / '
|
|
|
+ item.source_courseware_name_path = item.study_phase_name + '版 / ' + item.iss_no + ' / ' + item.release_date + ' / ' + item.art_title
|
|
|
});
|
|
|
- this.sentKwicData.sentence_list = res.data.results
|
|
|
+ this.sentKwicData.sentence_list_sort_left = this.handleExample(res.data.results,'left')
|
|
|
+ console.log(this.sentKwicData.sentence_list_sort_left)
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -411,18 +417,17 @@ export default {
|
|
|
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));
|
|
|
+ let arr = JSON.parse(JSON.stringify(item.tokens));
|
|
|
arr.forEach((items, indexs) => {
|
|
|
- if (indexs == item.sentence_fc_list_word_index) {
|
|
|
+ if (indexs == item.token_idx) {
|
|
|
arr[
|
|
|
indexs
|
|
|
- ] = `<span style=color:#DE4444;font-weight:700;>${arr[indexs]}</span>`;
|
|
|
+ ][0] = `<span style=color:#DE4444;font-weight:700;>${arr[indexs][0]}</span>`;
|
|
|
}
|
|
|
});
|
|
|
let data = this.changefiveword(
|
|
|
arr,
|
|
|
- item.sentence_fc_list_word_index,
|
|
|
+ item.token_idx,
|
|
|
type
|
|
|
);
|
|
|
item.resArr = data;
|
|
@@ -430,15 +435,15 @@ export default {
|
|
|
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) {
|
|
|
+ if (indexs == item.token_idx) {
|
|
|
arr[
|
|
|
indexs
|
|
|
- ] = `<span style=color:#DE4444;font-weight:700;>${arr[indexs]}</span>`;
|
|
|
+ ][0] = `<span style=color:#DE4444;font-weight:700;>${arr[indexs][0]}</span>`;
|
|
|
}
|
|
|
});
|
|
|
let data = this.changefiveword(
|
|
|
arr,
|
|
|
- item.sentence_fc_list_word_index,
|
|
|
+ item.token_idx,
|
|
|
type
|
|
|
);
|
|
|
item.resArr = data;
|
|
@@ -446,15 +451,15 @@ export default {
|
|
|
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) {
|
|
|
+ if (indexs == item.token_idx) {
|
|
|
arr[
|
|
|
indexs
|
|
|
- ] = `<span style=color:#DE4444;font-weight:700;>${arr[indexs]}</span>`;
|
|
|
+ ][0] = `<span style=color:#DE4444;font-weight:700;>${arr[indexs][0]}</span>`;
|
|
|
}
|
|
|
});
|
|
|
let data = this.changefiveword(
|
|
|
arr,
|
|
|
- item.sentence_fc_list_word_index,
|
|
|
+ item.token_idx,
|
|
|
type
|
|
|
);
|
|
|
item.resArr = data;
|
|
@@ -516,6 +521,53 @@ export default {
|
|
|
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.enFhList.indexOf(arr[index - i][0]) == -1) {
|
|
|
+ arr[index - i][0] = `<span style=color:${colorList[colorIndex]};>${
|
|
|
+ arr[index - i][0]
|
|
|
+ }</span>`;
|
|
|
+ colorIndex++;
|
|
|
+ } else {
|
|
|
+ num++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (type == "right") {
|
|
|
+ if (index + i <= arr.length - 1) {
|
|
|
+ if (this.enFhList.indexOf(arr[index + i][0]) == -1) {
|
|
|
+ arr[index + i][0] = `<span style=color:${colorList[colorIndex]};>${
|
|
|
+ arr[index + i][0]
|
|
|
+ }</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() {
|