|
@@ -91,7 +91,7 @@
|
|
|
<div class="list">
|
|
|
<template v-if="!kwicFlag">
|
|
|
<div
|
|
|
- v-for="(item, i) in ShowList"
|
|
|
+ v-for="(item, i) in sentKwicData.sentence_list"
|
|
|
:key="i + 'sentence'"
|
|
|
class="one"
|
|
|
>
|
|
@@ -109,32 +109,35 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<template v-else>
|
|
|
- <div
|
|
|
- v-for="(item, index) in ShowList"
|
|
|
- :key="'kwic' + index"
|
|
|
- class="kwic_one"
|
|
|
- >
|
|
|
- <div class="number">{{ item.number }}</div>
|
|
|
- <el-tooltip effect="dark" placement="bottom">
|
|
|
- <div class="content">
|
|
|
- {{ item.source_courseware_name_path }}
|
|
|
- </div>
|
|
|
- <div class="laiyuan">
|
|
|
- {{ item.source_courseware_name_path }}
|
|
|
+ <template v-if="kwicAlign==='left'">
|
|
|
+ <div
|
|
|
+ v-for="(item, index) in sentKwicData.sentence_list_sort_left"
|
|
|
+ :key="'kwic' + index"
|
|
|
+ class="kwic_one"
|
|
|
+ >
|
|
|
+ <div class="number">{{ item.number }}</div>
|
|
|
+ <el-tooltip effect="dark" placement="bottom">
|
|
|
+ <div class="content" slot="content">
|
|
|
+ {{ item.source_courseware_name_path }}
|
|
|
+ </div>
|
|
|
+ <div class="laiyuan">
|
|
|
+ {{ item.source_courseware_name_path }}
|
|
|
+ </div>
|
|
|
+ </el-tooltip>
|
|
|
+ <div
|
|
|
+ class="word_sentence"
|
|
|
+ >
|
|
|
+ <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>
|
|
|
- </el-tooltip>
|
|
|
- <div
|
|
|
- class="word_sentence"
|
|
|
- >
|
|
|
- <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>
|
|
|
+ </template>
|
|
|
+
|
|
|
</template>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -347,12 +350,172 @@ export default {
|
|
|
this.sentKwicData.max_page_no = res.data.max_page_no
|
|
|
this.sentKwicData.my_bought_total = res.my_bought_total
|
|
|
this.sentKwicData.total = res.total
|
|
|
+ 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 + ' / '
|
|
|
+ });
|
|
|
+ this.sentKwicData.sentence_list = res.data.results
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
})
|
|
|
.catch(() => {
|
|
|
this.loading = false
|
|
|
});
|
|
|
- }
|
|
|
+ getLogin('/PaperServer/Client/Article/QuerySentKwicData', {
|
|
|
+ word: this.data.word,
|
|
|
+ page_size: 30,
|
|
|
+ page_no: this.pageNo,
|
|
|
+ only_my_bought: true,
|
|
|
+ kwic_type: 1
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ this.loading = false
|
|
|
+ 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 + ' / '
|
|
|
+ });
|
|
|
+ this.sentKwicData.sentence_list = res.data.results
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.loading = 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 [];
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
//生命周期 - 创建完成(可以访问当前this实例)
|
|
|
created() {
|