123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347 |
- <!-- -->
- <template>
- <div class="Big-Book-prev-Textdes NewWordShow" v-if="curQue">
- <h2 v-if="curQue.title">{{ curQue.title }}</h2>
- <div class="item-box">
- <div class="item" v-for="(item, index) in curQue.option" :key="index">
- <p v-if="item.pinyin">
- <span>
- {{ item.pinyin }}
- </span>
- <span>{{ item.en }}</span>
- </p>
- <div class="con-box">
- <template v-if="item.imgOrText == 'text'">
- <template v-if="item.con">
- <div
- :key="conindex"
- class="strockplay"
- v-for="(conItem, conindex) in item.con"
- @click="writeWord(conItem, item.pinyin)"
- >
- <Strockplayredline
- :Book_text="conItem"
- :playStorkes="true"
- :targetDiv="'bwcHanziIntp' + index + conItem + conindex"
- />
- <div
- class="bwc-line"
- v-if="conindex < item.con.length - 1"
- ></div>
- </div>
- </template>
- <template v-else>
- <div class="blank-item" @click="freeWrite('', index)">
- <img :src="freeImg[index]" v-if="freeImg[index]" />
- </div>
- </template>
- </template>
- <template v-else>
- <div
- class="img-box"
- v-for="(imgItem, imgIndex) in item.img_list"
- :key="imgIndex"
- @click="freeWrite(imgItem.url, imgIndex)"
- >
- <el-image :src="imgItem.url" fit="scale-down" class="img_url">
- <div slot="placeholder" class="image-slot">
- <img src="../../../assets/common/icon-imgloading.png" />
- </div>
- </el-image>
- </div>
- </template>
- </div>
- </div>
- </div>
- <div class="practiceBox practiceBoxStrock" v-if="isPraShow">
- <Practice
- :changePraShow="changePraShow"
- :cur="curData"
- :themeColor="themeColor"
- />
- </div>
- <div class="practiceBox practiceBoxStrock" v-if="ifFreeShow">
- <FreePaint
- :changePraShow="changePraShow"
- :cur="curDataImg"
- ref="freePaint"
- :themeColor="themeColor"
- />
- </div>
- </div>
- </template>
- <script>
- import Strockplayredline from "../preview/components/Strockplayredline.vue";
- import Practice from "../preview/components/Practice.vue";
- import FreePaint from "../preview/components/FreePaint.vue";
- export default {
- components: { Strockplayredline, Practice, FreePaint },
- props: ["curQue", "themeColor"],
- data() {
- return {
- isPraShow: false,
- curData: null,
- ifFreeShow: false,
- freeImg: [],
- activeIndex: null,
- };
- },
- computed: {},
- watch: {},
- //方法集合
- methods: {
- // 处理数据
- handleData() {
- let _this = this;
- _this.freeImg = [];
- _this.curQue.option.forEach((item) => {
- _this.freeImg.push("");
- });
- },
- changePraShow() {
- this.isPraShow = false;
- this.ifFreeShow = false;
- this.freeImg[this.activeIndex] = this.$refs.freePaint.imgSrc;
- },
- writeWord(words, pinyin) {
- this.isPraShow = true;
- this.activeIndex = null;
- this.curData = {
- stem: [
- {
- con: words ? words : "",
- pinyin: pinyin && pinyin ? pinyin : "",
- mp3_url: "",
- },
- ],
- };
- },
- freeWrite(imgUrl, index) {
- this.ifFreeShow = true;
- this.curDataImg = imgUrl;
- this.activeIndex = imgUrl ? null : index;
- },
- },
- //生命周期 - 创建完成(可以访问当前this实例)
- created() {},
- //生命周期 - 挂载完成(可以访问DOM元素)
- mounted() {},
- beforeCreate() {}, //生命周期 - 创建之前
- beforeMount() {}, //生命周期 - 挂载之前
- beforeUpdate() {}, //生命周期 - 更新之前
- updated() {}, //生命周期 - 更新之后
- beforeDestroy() {}, //生命周期 - 销毁之前
- destroyed() {}, //生命周期 - 销毁完成
- activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
- };
- </script>
- <style lang='scss' scoped>
- //@import url(); 引入公共css类
- .NewWordShow {
- width: 100%;
- margin-bottom: 16px;
- h2 {
- margin: 0 0 8px 0;
- font-weight: 500;
- font-size: 16px;
- line-height: 24px;
- color: #000000;
- }
- .item-box {
- display: flex;
- flex-flow: wrap;
- padding-bottom: 8px;
- padding: 0 4px;
- background: #f7f7f7;
- border: 1px solid rgba(0, 0, 0, 0.1);
- border-radius: 8px;
- .item {
- display: flex;
- align-items: flex-end;
- justify-content: center;
- flex-flow: wrap;
- margin: 9px 20px;
- box-sizing: border-box;
- // width: 66px;
- cursor: pointer;
- > p {
- white-space: nowrap;
- :nth-child(1) {
- font-family: "GB-PINYINOK-B";
- }
- :nth-child(2) {
- font-family: "robot";
- }
- color: #2c2c2c;
- font-size: 14px;
- line-height: 130%;
- width: 100%;
- text-align: center;
- margin: 0 0 8px 0;
- }
- .strockplay {
- display: flex;
- justify-content: center;
- align-items: center;
- position: relative;
- width: 64px;
- height: 64px;
- }
- .strockplayRedInner {
- width: 64px;
- height: 64px;
- }
- .bwc-line {
- width: 1px;
- height: 62px;
- background: #de4444;
- }
- }
- .con-box {
- width: 66px;
- display: flex;
- border: 1px solid #de4444;
- border-radius: 8px;
- overflow: hidden;
- .img-box {
- background: #fff url("../../../assets/NPC/chinaTianRed.png") center
- no-repeat;
- background-size: cover;
- .img_url {
- width: 64px;
- height: 64px;
- }
- }
- .blank-item {
- width: 64px;
- height: 64px;
- background: #fff url("../../../assets/NPC/chinaTianRed.png") center
- no-repeat;
- background-size: cover;
- img {
- width: 100%;
- height: 100%;
- }
- }
- }
- }
- .practiceBox {
- position: fixed;
- left: 0;
- top: 0;
- z-index: 999;
- width: 100%;
- height: 100vh;
- background: rgba(0, 0, 0, 0.19);
- padding-top: 32px;
- box-sizing: border-box;
- overflow: hidden;
- overflow-y: auto;
- &.practiceBoxStrock {
- display: flex;
- justify-content: center;
- align-items: center;
- padding-top: 0px;
- }
- }
- }
- .NPC-Big-Book-preview-brown {
- .NewWordShow {
- .item-box {
- .item {
- .bwc-line {
- background: #bf875e;
- }
- }
- .con-box {
- border: 1px solid #bf875e;
- .img-box {
- background: #fff url("../../../assets/NPC/chinaTianYellow.png") center
- no-repeat;
- background-size: cover;
- }
- .blank-item {
- background: #fff url("../../../assets/NPC/chinaTianYellow.png") center
- no-repeat;
- background-size: cover;
- }
- }
- }
- }
- }
- .NPC-Big-Book-preview-green {
- .NewWordShow {
- .item-box {
- .item {
- .bwc-line {
- background: #24b99e;
- }
- }
- .con-box {
- border: 1px solid #24b99e;
- .img-box {
- background: #fff url("../../../assets/NPC/chinaTianGreen.png") center
- no-repeat;
- background-size: cover;
- }
- .blank-item {
- background: #fff url("../../../assets/NPC/chinaTianGreen.png") center
- no-repeat;
- background-size: cover;
- }
- }
- }
- }
- }
- </style>
- <style lang="scss">
- .NPC-Big-Book-preview-red {
- .NewWordShow {
- .strock-play-box {
- width: 16px;
- height: 16px;
- right: -2px;
- top: 0;
- background: url("../../../assets/NPC/strock-play-red-click.png") center
- no-repeat;
- background-size: cover;
- }
- .character-target-div {
- // background-color: initial;
- }
- }
- }
- .NPC-Big-Book-preview-green {
- .NewWordShow {
- .strock-play-box {
- width: 16px;
- height: 16px;
- right: -2px;
- top: 0;
- background: url("../../../assets/NPC/strock-play-green-click.png") center
- no-repeat;
- background-size: cover;
- }
- .character-target-div {
- // background-color: initial;
- }
- }
- }
- .NPC-Big-Book-preview-brown {
- .NewWordShow {
- .strock-play-box {
- width: 16px;
- height: 16px;
- right: -2px;
- top: 0;
- background: url("../../../assets/NPC/strock-play-yellow-click.png") center
- no-repeat;
- background-size: cover;
- }
- .character-target-div {
- // background-color: initial;
- }
- }
- }
- </style>
|