123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310 |
- <!-- -->
- <template>
- <div class="NNPE-Big-Book-preview NPC-Book-Sty">
- <div class="NNPE-title">
- <h1>{{ fatherName }}</h1>
- <div class="NNPE-operate">
- <a class="btn-prev" @click="handleNNPEprev"></a>
- <a class="btn-next" @click="handleNNPEnext"></a>
- </div>
- </div>
- <div class="NNPE-Book-content-inner" v-if="cur">
- <div v-for="(item, index) in cur.cur_fn_data" :key="index">
- <h2 v-if="item.title_z">{{ item.title_z }}</h2>
- <h3 v-if="item.title_f">{{ item.title_f }}</h3>
- <div
- :class="['NNPE-tableList', item.Isbg ? 'NNPE-tableList-hasBg' : '']"
- >
- <div
- class="NNPE-tableList-tr"
- v-for="(items, indexs) in item.table_list"
- :key="indexs"
- >
- <div
- :class="[
- 'NNPE-tableList-item',
- items.length == 1 ? 'NNPE-tableList-item-noMargin' : '',
- ]"
- v-for="(itemss, indexss) in items"
- :key="indexss"
- >
- <template v-if="itemss.data">
- <template v-if="itemss.data.type == 'ligature'">
- <Ligature :curQue="itemss.que" />
- </template>
- <template v-if="itemss.data.type == 'image_chs'">
- <Picture :curQue="itemss.data" />
- </template>
- <template v-if="itemss.data.type == 'record_chs'">
- <Record :curQue="itemss.data" />
- </template>
- <template v-if="itemss.data.type == 'phrase_chs'">
- <WordPhrase :curQue="itemss.data" />
- </template>
- <template v-if="itemss.data.type == 'NewWord_chs'">
- <WordPhrase :curQue="itemss.data" />
- </template>
- <template v-if="itemss.data.type == 'annotation_chs'">
- <WordPhrase :curQue="itemss.data" />
- </template>
- <template v-if="itemss.data.type == 'notes_chs'">
- <Notes :curQue="itemss.data" />
- </template>
- <template v-if="itemss.data.type == 'article_chs'">
- <ArticleTemChs
- :curQue="itemss.data"
- :NNPENewWordList="NNPENewWordList"
- :NNPENewPhraseList="NNPENewPhraseList"
- :NNPEAnnotationList="NNPEAnnotationList"
- />
- </template>
- <template v-if="itemss.data.type == 'sentence_segword_chs'">
- <SentenceSegWordViewChs :curQue="itemss.data" />
- </template>
- <template v-if="itemss.data.type == 'input_record_chs'">
- <InputHasRecord :curQue="itemss.data" />
- </template>
- <template v-if="itemss.data.type == 'recordHZ_inputPY_chs'">
- <TextInputRecord :curQue="itemss.data" />
- </template>
- <template v-if="itemss.data.type == 'inputItem_chs'">
- <SentenceInput :curQue="itemss.data" />
- </template>
- <template v-if="itemss.data.type == 'NumberCombination_chs'">
- <NumberSelectHasRecord :curQue="itemss.data" />
- </template>
- </template>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- import Picture from "./preview/Picture.vue"; // 图片模板
- import Record from "./preview/Record.vue"; // 音频播放
- import Soundrecord from "./preview/Soundrecord.vue"; // 录音模板
- import ArticleTemChs from "./preview/ArticleViewChs/index.vue"; // 文章模板
- import SentenceSegWordViewChs from "./preview/SentenceSegWordViewChs.vue"; //句子分词
- import WordPhrase from "./preview/WordPhrase.vue"; // 生词 短语
- import Notes from "./preview/Notes.vue"; // 注释
- import Ligature from "./preview/Ligature.vue";
- import InputHasRecord from "./preview/InputHasRecord.vue"; // 输入加录音
- import TextInputRecord from "./preview/TextInputRecord.vue"; // 文本+输入+录音
- import SentenceInput from "./preview/SentenceInput.vue"; // 输入选项
- import NumberSelectHasRecord from "./preview/NumberSelectHasRecord.vue" // 数字组合
- export default {
- name: "preview",
- components: {
- Picture,
- Record,
- Soundrecord,
- ArticleTemChs,
- SentenceSegWordViewChs,
- WordPhrase,
- Notes,
- Ligature,
- InputHasRecord,
- TextInputRecord,
- SentenceInput,
- NumberSelectHasRecord,
- },
- props: ["context", "fatherName"],
- data() {
- return {
- contextData: null,
- queIndex: -1, // 题目的索引
- cur: null, // 当前的题目
- watchIndex: -1, // 监听的值
- queList: [],
- queTotal: 0, // 题目总数
- NNPENewWordList: [], // 存放文章的生词
- NNPENewPhraseList: [], // 存放文章的短语
- NNPEAnnotationList: [], // 存放文章注释
- height: "", //总体的高度
- };
- },
- computed: {},
- watch: {
- context: {
- handler: function (val, oldVal) {
- const _this = this;
- if (val) {
- _this.initContextData();
- }
- },
- // 深度观察监听
- deep: true,
- },
- },
- //方法集合
- methods: {
- initContextData() {
- const _this = this;
- _this.contextData = JSON.parse(JSON.stringify(_this.context));
- _this.queIndex = 0;
- _this.NNPENewWordList = [];
- _this.NNPENewPhraseList = [];
- _this.watchIndex = _this.queIndex + new Date().getTime();
- if (_this.contextData) {
- const list = _this.contextData;
- if (list && list.length > 0) {
- _this.queList = list;
- _this.cur = list[_this.queIndex];
- _this.queTotal = list.length;
- _this.cur.cur_fn_data.forEach((item) => {
- item.table_list.forEach((items) => {
- items.forEach((itemss) => {
- if (itemss.data && itemss.data.type == "NewWord_chs") {
- _this.NNPENewWordList = _this.NNPENewWordList.concat(
- itemss.data.option
- );
- } else if (itemss.data && itemss.data.type == "notes_chs") {
- _this.NNPEAnnotationList = _this.NNPEAnnotationList.concat(
- itemss.data.option
- );
- }
- });
- });
- });
- }
- }
- },
-
- // 上一页
- handleNNPEprev() {
- const _this = this;
- if (_this.queIndex == 0) {
- // this.$message({
- // message: "已经是第一题",
- // type: "success",
- // });
- } else {
- _this.queIndex = _this.queIndex - 1;
- _this.watchIndex = _this.queIndex + new Date().getTime();
- _this.cur = _this.queList[_this.queIndex];
- }
- },
- // 下一页
- handleNNPEnext() {
- const _this = this;
- if (_this.queIndex == _this.queTotal - 1) {
- // this.$message({
- // message: "已经是最后一题",
- // type: "success",
- // });
- } else {
- _this.queIndex = _this.queIndex + 1;
- _this.watchIndex = _this.queIndex + new Date().getTime();
- _this.cur = _this.queList[_this.queIndex];
- }
- },
- },
- //生命周期 - 创建完成(可以访问当前this实例)
- created() {},
- //生命周期 - 挂载完成(可以访问DOM元素)
- mounted() {
- const _this = this;
- if (_this.context) {
- _this.initContextData();
- }
- },
- beforeCreate() {}, //生命周期 - 创建之前
- beforeMount() {}, //生命周期 - 挂载之前
- beforeUpdate() {}, //生命周期 - 更新之前
- updated() {}, //生命周期 - 更新之后
- beforeDestroy() {}, //生命周期 - 销毁之前
- destroyed() {}, //生命周期 - 销毁完成
- activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
- };
- </script>
- <style lang='scss' scoped>
- //@import url(); 引入公共css类
- .NNPE-Big-Book-preview {
- width: 860px;
- margin: 0 auto;
- position: relative;
- .NNPE-title {
- background: #4f92f6;
- padding: 20px 24px;
- position: relative;
- h1 {
- color: #ffffff;
- font-weight: bold;
- font-size: 16px;
- line-height: 150%;
- margin: 0;
- }
- .NNPE-operate {
- position: absolute;
- top: 10px;
- right: 20px;
- a {
- background: #66a3ff url("../../assets/newImage/common/btn-pre.png")
- center no-repeat;
- border-radius: 4px;
- width: 44px;
- height: 44px;
- display: inline-block;
- margin: 0 4px;
- &.btn-next {
- background: #66a3ff url("../../assets/newImage/common/btn-next.png")
- center no-repeat;
- }
- &:hover {
- background-color: #3f75c4;
- }
- }
- }
- }
- .NNPE-Book-content-inner {
- padding: 0 40px;
- > div {
- padding-top: 24px;
- > h2 {
- color: #000000;
- font-size: 16px;
- line-height: 150%;
- font-weight: bold;
- margin: 0;
- }
- > h3 {
- color: #000000;
- font-size: 16px;
- line-height: 150%;
- font-weight: normal;
- margin: 8px 0 16px 0;
- }
- }
- .NNPE-tableList {
- background: #fff;
- border-radius: 8px;
- padding: 0;
- &.NNPE-tableList-hasBg {
- background: #f3f3f3;
- padding: 12px 8px;
- }
- .NNPE-tableList-tr {
- display: flex;
- justify-content: space-between;
- // flex-flow: wrap;
- .NNPE-tableList-item {
- width: 100%;
- margin: 12px 16px;
- // padding: 16px;
- // background: #FFFFFF;
- // border-radius: 4px;
- display: flex;
- flex-flow: wrap;
- justify-content: center;
- &.NNPE-tableList-item-noMargin {
- margin: 0;
- }
- }
- }
- }
- }
- }
- </style>
|