|
@@ -2,19 +2,20 @@
|
|
|
<template>
|
|
|
<div class="wordIntp" v-if="word">
|
|
|
<div class="closeBox">
|
|
|
+ <span>数据来自百度汉语</span>
|
|
|
<i class="el-icon-close" @click="changeIntpShow(false)"></i>
|
|
|
</div>
|
|
|
<div class="bwc-top" v-if="word.detail">
|
|
|
+ <span v-if="word.detail.pinyin">{{word.detail.pinyin}}</span>
|
|
|
<Audio
|
|
|
:fontSize="20"
|
|
|
- :mp3="word.detail.mp3_url ? word.detail.mp3_url : ''"
|
|
|
- :pinyin="word.detail.pinyin"
|
|
|
+ :mp3="mp3Url ? mp3Url : ''"
|
|
|
/>
|
|
|
</div>
|
|
|
<div
|
|
|
class="bwc-Strockplay"
|
|
|
- :style="{ width: word.list.length * 126 + 8 + 'px' }"
|
|
|
- v-if="word.list.length<5"
|
|
|
+ :style="{ width: word.detail.new_word.length * 126 + 8 + 'px' }"
|
|
|
+ v-if="word.detail.new_word.length<5"
|
|
|
>
|
|
|
<div
|
|
|
:key="conindex"
|
|
@@ -25,12 +26,12 @@
|
|
|
:Book_text="conItem"
|
|
|
:playStorkes="true"
|
|
|
:targetDiv="'bwcIntp' + conItem + conindex"
|
|
|
- :wordNum="word.list.length"
|
|
|
+ :wordNum="word.detail.new_word.length"
|
|
|
/>
|
|
|
- <div class="bwc-line" v-if="conindex < word.list.length - 1"></div>
|
|
|
+ <div class="bwc-line" v-if="conindex < word.detail.new_word.length - 1"></div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <p v-else class="bwc-tolength"><span v-for="(item,index) in word.list" :key="index">{{item}}</span></p>
|
|
|
+ <p v-else class="bwc-tolength"><span v-for="(item,index) in word.detail.new_word" :key="index">{{item}}</span></p>
|
|
|
<el-menu
|
|
|
:default-active="activeIndex"
|
|
|
class="el-menu-demo"
|
|
@@ -38,28 +39,58 @@
|
|
|
@select="handleSelect"
|
|
|
>
|
|
|
<el-menu-item index="1">释义</el-menu-item>
|
|
|
- <el-menu-item index="2" disabled>近/反义词</el-menu-item>
|
|
|
- <el-menu-item index="3" disabled>造句</el-menu-item>
|
|
|
+ <el-menu-item index="2">近/反义词</el-menu-item>
|
|
|
+ <el-menu-item index="3">组词</el-menu-item>
|
|
|
</el-menu>
|
|
|
<template v-if="activeIndex == '1'">
|
|
|
- <ul class="bwc-intp" v-if="word.detail">
|
|
|
- <li v-for="(item, index) in word.detail.definition_list" :key="index">
|
|
|
- {{ item }}
|
|
|
- </li>
|
|
|
- </ul>
|
|
|
+ <div class="bwc-intp">
|
|
|
+ <!-- 基本释义 -->
|
|
|
+ <h1>基本释义</h1>
|
|
|
+ <span v-if="word.detail.pinyin" class="pinyin">{{word.detail.pinyin}}</span>
|
|
|
+ <p v-for="(itemss,indexss) in paraphrase" :key="indexss" class="paraphrase">
|
|
|
+ {{itemss['@value']}}
|
|
|
+ </p>
|
|
|
+ <hr />
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template v-if="activeIndex == '2'">
|
|
|
+ <div class="bwc-intp">
|
|
|
+ <h1 v-if="synonymList.length>0">近义词</h1>
|
|
|
+ <ul class="synonym">
|
|
|
+ <li v-for="(itemss,indexss) in synonymList" :key="indexss" class="paraphrase">
|
|
|
+ {{itemss['@value']}}
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ <h1 v-if="antonymList.length>0">反义词</h1>
|
|
|
+ <ul class="synonym">
|
|
|
+ <li v-for="(itemss,indexss) in antonymList" :key="indexss" class="paraphrase">
|
|
|
+ {{itemss['@value']}}
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template v-if="activeIndex == '3'">
|
|
|
+ <div class="bwc-intp">
|
|
|
+ <ul class="synonym">
|
|
|
+ <li v-for="(itemss,indexss) in termsList" :key="indexss" class="paraphrase">
|
|
|
+ {{itemss['@value']}}
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-// import Audio from "./Audio.vue";
|
|
|
-// import Strockplayredline from "./Strockplayredline.vue";
|
|
|
+import Audio from "./AudioRed.vue";
|
|
|
+import Strockplayredline from "./Strockplayredline.vue";
|
|
|
+import { getHZChineseInfo } from "@/api/ajax";
|
|
|
|
|
|
export default {
|
|
|
name: "WordIntp",
|
|
|
components: {
|
|
|
- // Strockplayredline,
|
|
|
- // Audio,
|
|
|
+ Strockplayredline,
|
|
|
+ Audio,
|
|
|
},
|
|
|
props: ["word", "changeIntpShow"],
|
|
|
data() {
|
|
@@ -67,6 +98,88 @@ export default {
|
|
|
isPraShow: false,
|
|
|
curData: null,
|
|
|
activeIndex: "1",
|
|
|
+ mp3Url:'', // 音频
|
|
|
+ paraphrase:[], // 释义
|
|
|
+ synonymList:[], // 近义词
|
|
|
+ antonymList:[], // 反义词
|
|
|
+ termsList:[], // 组词
|
|
|
+ dataDetail: [
|
|
|
+ {
|
|
|
+ "request":{
|
|
|
+ "query":"熊掌",
|
|
|
+ "queryType":"entity"
|
|
|
+ },
|
|
|
+ "response":{
|
|
|
+ "voice":"熊掌,意思是:熊的脚掌。",
|
|
|
+ "sourceUrl":"https://hanyu.baidu.com/zici/s?wd=%E7%86%8A%E6%8E%8C&query=%E7%86%8A%E6%8E%8C&srcid=28243&from=kg2",
|
|
|
+ "answer":[
|
|
|
+ "熊掌"
|
|
|
+ ],
|
|
|
+ "sourceName":"百度汉语",
|
|
|
+ "title":"熊掌",
|
|
|
+ "entity":[
|
|
|
+ {
|
|
|
+ "@type":[
|
|
|
+ "term"
|
|
|
+ ],
|
|
|
+ "name":"熊掌",
|
|
|
+ "attrs":[
|
|
|
+ {
|
|
|
+ "objects":[
|
|
|
+ {
|
|
|
+ "@value":"https://hanyu.baidu.com/zici/s?wd=%E7%86%8A%E6%8E%8C&query=%E7%86%8A%E6%8E%8C&srcid=28243&from=kg2"
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ "label":"详情页",
|
|
|
+ "type":"simple",
|
|
|
+ "key":"url"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "objects":[
|
|
|
+ {
|
|
|
+ "@value":"熊的脚掌。"
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ "label":"释义",
|
|
|
+ "type":"simple",
|
|
|
+ "key":"definition"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "objects":[
|
|
|
+ {
|
|
|
+ "@value":"https://dss0.baidu.com/6KAZsjip0QIZ8tyhnq/text2audio?tex=%E7%86%8A%28xiong2%29%E6%8E%8C%28zhang3%29&cuid=dict&lan=ZH&ctp=1&pdt=30&vol=9&per=4100"
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ "label":"读音",
|
|
|
+ "type":"simple",
|
|
|
+ "key":"pronunciation"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "objects":[
|
|
|
+ {
|
|
|
+ "@value":"[xióng zhǎng]"
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ "label":"拼音",
|
|
|
+ "type":"simple",
|
|
|
+ "key":"spell"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "objects":[
|
|
|
+ {
|
|
|
+ "@value":"ceip"
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ "label":"五笔",
|
|
|
+ "type":"simple",
|
|
|
+ "key":"wubi"
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
};
|
|
|
},
|
|
|
computed: {},
|
|
@@ -87,7 +200,51 @@ export default {
|
|
|
changePraShow() {
|
|
|
this.isPraShow = false;
|
|
|
},
|
|
|
- handleSelect() {},
|
|
|
+ handleSelect(val) {
|
|
|
+ this.activeIndex = val
|
|
|
+ },
|
|
|
+ getChineseInfo(){
|
|
|
+ let _this = this
|
|
|
+ let data = {
|
|
|
+ query: this.word.detail.new_word,
|
|
|
+ // query: "开心",
|
|
|
+ };
|
|
|
+ debugger
|
|
|
+ getHZChineseInfo(data).then((res) => {
|
|
|
+ _this.dataDetail = res.data.result
|
|
|
+ _this.handleChineseDetail()
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 处理数据
|
|
|
+ handleChineseDetail(){
|
|
|
+ let _this = this
|
|
|
+ _this.dataDetail.forEach(item=>{
|
|
|
+ if(item.request.queryType=='entity'){
|
|
|
+ // 读音
|
|
|
+ item.response.entity.forEach(items=>{
|
|
|
+ items.attrs.forEach(itemss=>{
|
|
|
+ if(itemss.key=="pronunciation"){
|
|
|
+ // 音频
|
|
|
+ _this.mp3Url = itemss.objects[0]['@value']?itemss.objects[0]['@value']:''
|
|
|
+ }else if(itemss.key=="definition"){
|
|
|
+ // 释义
|
|
|
+ _this.paraphrase = itemss.objects
|
|
|
+ }else if(itemss.key=="synonym"){
|
|
|
+ // 近义词
|
|
|
+ _this.synonymList = itemss.objects
|
|
|
+ }else if(itemss.key=="antonym"){
|
|
|
+ // 反义词
|
|
|
+ _this.antonymList = itemss.objects
|
|
|
+ }else if(itemss.key=="terms"){
|
|
|
+ // 反义词
|
|
|
+ _this.termsList = itemss.objects
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
//生命周期 - 创建完成(可以访问当前this实例)
|
|
|
created() {},
|
|
@@ -95,6 +252,8 @@ export default {
|
|
|
mounted() {
|
|
|
let _this = this;
|
|
|
console.log(this.word);
|
|
|
+ // this.getChineseInfo()
|
|
|
+ _this.handleChineseDetail()
|
|
|
},
|
|
|
beforeCreate() {}, //生命周期 - 创建之前
|
|
|
beforeMount() {}, //生命周期 - 挂载之前
|
|
@@ -109,17 +268,59 @@ export default {
|
|
|
//@import url(); 引入公共css类
|
|
|
.wordIntp {
|
|
|
width: 600px;
|
|
|
- height: 100vh;
|
|
|
+// height: 100vh;
|
|
|
overflow: hidden;
|
|
|
overflow-y: auto;
|
|
|
margin: 0 auto;
|
|
|
+ position: relative;
|
|
|
.bwc-intp {
|
|
|
- > li {
|
|
|
- font-weight: normal;
|
|
|
- font-size: 16px;
|
|
|
- line-height: 150%;
|
|
|
- color: #2c2c2c;
|
|
|
- }
|
|
|
+ padding: 16px 0;
|
|
|
+ h1{
|
|
|
+ color: #000000;
|
|
|
+ font-size: 20px;
|
|
|
+ line-height: 150%;
|
|
|
+ font-weight: normal;
|
|
|
+ margin: 8px 0 8px 0;
|
|
|
+ }
|
|
|
+ .pinyin{
|
|
|
+ color: #DE4444;
|
|
|
+ font-size: 24px;
|
|
|
+ line-height: 36px;
|
|
|
+ margin-bottom: 8px;
|
|
|
+ font-family: 'GB-PINYINOK-B';
|
|
|
+ display: block;
|
|
|
+ }
|
|
|
+ .paraphrase{
|
|
|
+ margin-bottom: 8px;
|
|
|
+ margin-top: 0;
|
|
|
+ color: #000000;
|
|
|
+ font-size: 16px;
|
|
|
+ line-height: 150%;
|
|
|
+ }
|
|
|
+ hr{
|
|
|
+ margin: 16px 0 0 0;
|
|
|
+ background: rgba($color: #000000, $alpha: 0.15);
|
|
|
+ height: 1px;
|
|
|
+ border: none;
|
|
|
+ }
|
|
|
+ ul.synonym{
|
|
|
+ display: flex;
|
|
|
+ flex-flow: wrap;
|
|
|
+ margin-left: -4px;
|
|
|
+ padding: 4px 0;
|
|
|
+ li{
|
|
|
+ padding: 4px 8px;
|
|
|
+ background: #FFFFFF;
|
|
|
+ border: 1px solid rgba(0, 0, 0, 0.15);
|
|
|
+ border-radius: 4px;
|
|
|
+ margin: 4px;
|
|
|
+ font-size: 16px;
|
|
|
+ line-height: 150%;
|
|
|
+ color: #000000;
|
|
|
+ text-align: center;
|
|
|
+ min-width: 127px;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
.practiceBox {
|
|
|
position: fixed;
|
|
@@ -137,17 +338,29 @@ export default {
|
|
|
.closeBox {
|
|
|
width: 100%;
|
|
|
display: flex;
|
|
|
- justify-content: flex-end;
|
|
|
+ justify-content: space-between;
|
|
|
+ position: absolute;
|
|
|
+ left: 0;
|
|
|
+ top: 0;
|
|
|
+ padding: 12px;
|
|
|
> i {
|
|
|
+ font-size: 16px;
|
|
|
+ color:#000000;
|
|
|
cursor: pointer;
|
|
|
}
|
|
|
+ span{
|
|
|
+ color: #000000;
|
|
|
+ opacity: 0.2;
|
|
|
+ font-size: 14px;
|
|
|
+ line-height: 130%;
|
|
|
+ }
|
|
|
}
|
|
|
min-width: 312px;
|
|
|
min-height: 360px;
|
|
|
background: #ffffff;
|
|
|
box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.15);
|
|
|
border-radius: 8px;
|
|
|
- padding: 24px;
|
|
|
+ padding: 52px 32px 32px;
|
|
|
box-sizing: border-box;
|
|
|
.bwc-top {
|
|
|
margin-bottom: 16px;
|
|
@@ -155,6 +368,16 @@ export default {
|
|
|
display: flex;
|
|
|
justify-content: center;
|
|
|
align-items: center;
|
|
|
+ .content-voices{
|
|
|
+ width: 24px;
|
|
|
+ }
|
|
|
+ >span{
|
|
|
+ font-family: 'GB-PINYINOK-B';
|
|
|
+ color: #2C2C2C;
|
|
|
+ font-size: 20px;
|
|
|
+ line-height: 24px;
|
|
|
+ margin-right: 4px;
|
|
|
+ }
|
|
|
}
|
|
|
.bwc-Strockplay {
|
|
|
display: flex;
|
|
@@ -163,19 +386,28 @@ export default {
|
|
|
min-width: 130px;
|
|
|
height: 130px;
|
|
|
margin: 0 auto;
|
|
|
- margin-bottom: 16px;
|
|
|
- border: 2px solid #ff5757;
|
|
|
+ margin-bottom: 6px;
|
|
|
+ border: 2px solid #DE4444;
|
|
|
border-radius: 8px;
|
|
|
box-sizing: border-box;
|
|
|
+ overflow: hidden;
|
|
|
.strockplay {
|
|
|
display: flex;
|
|
|
justify-content: center;
|
|
|
align-items: center;
|
|
|
+ position: relative;
|
|
|
+ .collect-icon{
|
|
|
+ width: 16px;
|
|
|
+ position: absolute;
|
|
|
+ right: 4px;
|
|
|
+ bottom: 4px;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
}
|
|
|
.bwc-line {
|
|
|
width: 2px;
|
|
|
height: 126px;
|
|
|
- background: #ff5757;
|
|
|
+ background: #DE4444;
|
|
|
}
|
|
|
}
|
|
|
.bwc-tolength{
|
|
@@ -230,3 +462,21 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
</style>
|
|
|
+<style lang="scss">
|
|
|
+.wordIntp{
|
|
|
+ .el-menu--horizontal > .el-menu-item {
|
|
|
+ width: 33.33%;
|
|
|
+ text-align: center;
|
|
|
+ color: #000000;
|
|
|
+ font-size: 18px;
|
|
|
+ }
|
|
|
+ .el-menu.el-menu--horizontal{
|
|
|
+ border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
|
|
+ }
|
|
|
+ .el-menu--horizontal>.el-menu-item.is-active{
|
|
|
+ color: #DE4444;
|
|
|
+ font-weight: bold;
|
|
|
+ border-bottom: 2px solid #DE4444;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|