123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237 |
- <!-- -->
- <template>
- <div class="NPC-ArticleView">
- <div class="ArticleView-header">
- <el-switch
- style="display: block"
- v-model="showPhrases"
- active-color="#DE4444"
- inactive-color="rgba(0,0,0,0.1)"
- active-text=""
- inactive-text="本课生词"
- @change="handleSwitchChange('showPractice', 'showWord')"
- >
- </el-switch>
- <el-switch
- style="display: block"
- v-model="showPractice"
- active-color="#DE4444"
- inactive-color="rgba(0,0,0,0.1)"
- active-text=""
- inactive-text="语音练习"
- @change="handleSwitchChange('showPhrases', 'showWord')"
- >
- </el-switch>
- <el-switch
- style="display: block"
- v-model="showWord"
- active-color="#DE4444"
- inactive-color="rgba(0,0,0,0.1)"
- active-text=""
- inactive-text="取词"
- @change="handleSwitchChange('showPhrases', 'showPractice')"
- >
- </el-switch>
- <!-- <div class="setting-fontsize">
- <a @click="handleFontsize('-')"
- ><img src="../../../../assets/newImage/common/btn-reduce.png"
- /></a>
- <img src="../../../../assets/newImage/common/font-size.png" />
- <a @click="handleFontsize('+')"
- ><img src="../../../../assets/newImage/common/btn-increase.png"
- /></a>
- </div> -->
- </div>
- <div class="ArticleView-body" ref="ArticleViewbody">
- <NormalModelChs
- :curQue="curQue"
- :titleFontsize="titleFontsize"
- :wordFontsize="wordFontsize"
- :bodyLeft="bodyLeft"
- :bodyWidth="bodyWidth"
- :colorBox="colorBox"
- :NotesList="NotesList"
- v-if="!showPhrases && !showPractice && !showWord"
- />
- <PhraseModel
- :curQue="curQue"
- :titleFontsize="titleFontsize"
- :wordFontsize="wordFontsize"
- :NNPENewWordList="NNPENewWordList"
- :colorBox="colorBox"
- v-if="showPhrases"
- />
- <Practice
- :curQue="curQue"
- :titleFontsize="titleFontsize"
- :wordFontsize="wordFontsize"
- :colorBox="colorBox"
- v-if="showPractice"
- />
- <WordModel
- :curQue="curQue"
- :titleFontsize="titleFontsize"
- :wordFontsize="wordFontsize"
- :bodyLeft="bodyLeft"
- :bodyWidth="bodyWidth"
- :NNPENewWordList="NNPENewWordList"
- :colorBox="colorBox"
- v-if="showWord"
- />
- </div>
- </div>
- </template>
- <script>
- import PhraseModel from "./PhraseModelChs.vue";
- import NormalModelChs from "./NormalModelChs.vue";
- import Practice from "./Practicechs.vue"; // 语音练习模式
- import WordModel from "./WordModelChs.vue"; // 语音练习模式
- export default {
- name: "ArticleView",
- props: ["curQue", "NNPENewWordList", "NotesList", "colorBox"],
- components: { NormalModelChs, Practice, WordModel, PhraseModel },
- data() {
- return {
- showPreview: true, // 全文预览
- showPhrases: false, // 显示单词和短语
- showPractice: false, // 语音练习
- showWord: false, // 取词
- titleFontsize: 20, // 标题字号初始值
- wordFontsize: 16, // 文章内容字号初始值
- bodyLeft: 0,
- bodyWidth: 0,
- resColorArr: [],
- };
- },
- computed: {},
- watch: {},
- //方法集合
- methods: {
- // 处理字体大小
- handleFontsize(symbol) {
- if (symbol == "+") {
- if (this.wordFontsize < 24) {
- this.titleFontsize = this.titleFontsize + 2;
- this.wordFontsize = this.wordFontsize + 2;
- }
- } else if (symbol == "-") {
- if (this.wordFontsize > 12) {
- this.titleFontsize = this.titleFontsize - 2;
- this.wordFontsize = this.wordFontsize - 2;
- }
- }
- },
- // 切换开关
- handleSwitchChange(obj1, obj2) {
- this[obj1] = false;
- this[obj2] = false;
- this.showPreview = false;
- },
- },
- //生命周期 - 创建完成(可以访问当前this实例)
- created() {},
- //生命周期 - 挂载完成(可以访问DOM元素)
- mounted() {
- console.log("我是文章预览");
- console.log(this.curQue);
- this.$nextTick(() => {
- this.bodyLeft = this.$refs.ArticleViewbody.getBoundingClientRect().left;
- });
- console.log(this.NNPENewWordList);
- },
- beforeCreate() {}, //生命周期 - 创建之前
- beforeMount() {}, //生命周期 - 挂载之前
- beforeUpdate() {}, //生命周期 - 更新之前
- updated() {}, //生命周期 - 更新之后
- beforeDestroy() {}, //生命周期 - 销毁之前
- destroyed() {}, //生命周期 - 销毁完成
- activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
- };
- </script>
- <style lang='scss' scoped>
- //@import url(); 引入公共css类
- .NPC-ArticleView {
- width: 100%;
- .ArticleView-header {
- display: flex;
- justify-content: flex-end;
- align-items: center;
- margin-bottom: 16px;
- .setting-fontsize {
- display: flex;
- margin-left: 24px;
- a {
- border: 1px solid rgba(0, 0, 0, 0.1);
- box-sizing: border-box;
- border-radius: 4px;
- display: block;
- height: 24px;
- width: 24px;
- }
- img {
- width: 100%;
- }
- > img {
- margin: 0 8px;
- width: 24px;
- }
- }
- }
- .ArticleView-body {
- border: 1px solid rgba(0, 0, 0, 0.1);
- box-sizing: border-box;
- border-radius: 8px;
- overflow: hidden;
- background: #fff;
- box-sizing: border-box;
- .aduioLine-box {
- border-bottom: 1px solid rgba(0, 0, 0, 0.1);
- width: 100%;
- }
- }
- }
- </style>
- <style lang="scss">
- .NPC-ArticleView {
- .notice {
- font-weight: normal;
- font-size: 14px;
- line-height: 150%;
- margin-bottom: 16px;
- color: #000000;
- padding: 0 24px;
- margin-bottom: 8px;
- }
- .ArticleView-header {
- .el-switch {
- margin-left: 24px;
- }
- .el-switch__core {
- width: 44px !important;
- height: 24px;
- border-radius: 20px;
- }
- .el-switch__core:after {
- top: 3px;
- left: 3px;
- }
- .el-switch.is-checked .el-switch__core::after {
- left: 100%;
- margin-left: -19px;
- }
- .el-switch__label {
- color: #000000;
- }
- .el-switch__label.is-active {
- color: rgba($color: #000000, $alpha: 0.3);
- }
- .el-switch__label--left {
- margin-right: 8px;
- }
- }
- }
- </style>
|