You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
zhishifufei_uniapp/pages/learningCenter/reciteDetail.vue

285 lines
7.7 KiB

9 months ago
<template>
<BaseContainer class="recite-detail flex">
<NavBar title="详情" />
<view class="detail-box">
8 months ago
<mp-html
v-if="!!content"
class="swiper-conter"
container-style="padding: 30rpx;background: #ffffff;"
:content="content"
></mp-html>
<!-- <view class="detail-info">
9 months ago
<view class="info-name flex">
{{ detailInfo.name }}
<view :class="[
'iconfont',
detailInfo.collect ? 'iconshoucang2' : 'iconshoucang11',
]" @click="detailInfo.collect = !detailInfo.collect"></view>
</view>
<view class="audio-box">
<view class="audio" :class="{ audioActive: activeAudio === 1 }" @click="activeAudio = 1;">
<text>{{ detailInfo.enAudio }}</text>
<image v-if="activeAudio !== 1" src="@/static/images/learning/audio.png" mode="aspectFill" @click="openAudio"></image>
<image v-else src="@/static/images/learning/audio_active.png" mode="aspectFill" @click="openAudio"></image>
</view>
<view class="audio" :class="{ audioActive: activeAudio === 2 }" @click="activeAudio = 2;">
<text>{{ detailInfo.uaAudio }}</text>
<image v-if="activeAudio !== 2" src="@/static/images/learning/audio.png" mode="aspectFill" @click="openAudio"></image>
<image v-else src="@/static/images/learning/audio_active.png" mode="aspectFill" @click="openAudio"></image>
</view>
</view>
<view class="info-remark flex flex-center-x">
<view>{{ detailInfo.remark }}</view>
<view>单词报错</view>
</view>
<view class="info-adverb">
副词 <text>{{ detailInfo.adverb }}</text>
</view>
</view>
<view class="example">
<view class="title">例句</view>
<view v-for="(item, index) in detailInfo.example" :key="index" class="example-item">
<view class="item-content">
<view v-html="item.content"></view>
<image src="@/static/images/learning/audio.png" mode="aspectFill"></image>
</view>
<view class="item-translate">{{ item.translate }}</view>
</view>
</view>
<view class="analysis">
<view class="title">词根词缀句</view>
<view class="analysis-content">{{ detailInfo.analysis }}</view>
8 months ago
</view> -->
9 months ago
</view>
<view class="detail-footer flex flex-center-x">
8 months ago
<!-- <view class="btn cut">砍掉</view> -->
<view class="btn next" @click="toNext">下一题</view>
9 months ago
</view>
</BaseContainer>
</template>
<script>
8 months ago
import { clearanceSubjectChapter } from '@/api/learning';
import mpHtml from "mp-html/dist/uni-app/components/mp-html/mp-html.vue";
9 months ago
export default {
8 months ago
components: {
mpHtml,
},
9 months ago
data() {
return {
detailInfo: {
collect: false,
name: 'outdoor',
enAudio: '/’aʊtdɔ:(r)/',
uaAudio: '/’aʊtdɔ:r/ ',
remark: 'adj.户外的;室外的',
adverb: 'outdoors',
example: [
{ content: 'If you enjoy <text style="color: #0F74BB;">outdoor</text> activities, this is the trip for you.', translate: '如果你喜欢户外运动,这一旅行很适合你。' },
{ content: 'If you enjoy <text style="color: #0F74BB;">outdoor</text> activities, this is the trip for you.', translate: '如果你喜欢户外运动,这一旅行很适合你。' },
{ content: 'If you enjoy <text style="color: #0F74BB;">outdoor</text> activities, this is the trip for you.', translate: '如果你喜欢户外运动,这一旅行很适合你。' },
{ content: 'If you enjoy <text style="color: #0F74BB;">outdoor</text> activities, this is the trip for you.', translate: '如果你喜欢户外运动,这一旅行很适合你。' },
],
analysis: 'out- 在外面 + door n.门'
},
activeAudio: 1,
8 months ago
id: 0,
content: '',
subjectId: 0,
name: '',
allList: [],
9 months ago
};
},
8 months ago
onLoad({id, subjectId, name}) {
this.id = id;
this.subjectId = subjectId;
this.name = name;
this.clearanceSubjectChapter();
},
9 months ago
methods: {
8 months ago
async clearanceSubjectChapter() {
try {
const { data } = await clearanceSubjectChapter({
recite_subject_id: this.subjectId,
});
console.log(data);
this.allList = data.filter(v => v.name === this.name)[0].children;
this.content = this.allList.filter(v => Number(v.id) === Number(this.id))[0].content;
console.log(this.allList);
} catch (err) {
console.log(err);
}
},
9 months ago
openAudio() {
},
8 months ago
toNext() {
const index = this.allList.findIndex(v => Number(v.id) === Number(this.id));
console.log(index, this.id);
if (index < this.allList.length - 1) {
this.content = this.allList[index + 1].content;
this.id = this.allList[index + 1].id;
} else {
this.$util.showMsg('已经是最后一题了');
}
},
9 months ago
},
};
</script>
<style lang="scss" scoped>
.recite-detail {
background: #f6f6f6;
flex-direction: column;
.detail-box {
width: 690rpx;
margin: 20rpx auto;
flex: 1;
overflow-y: auto;
.detail-info {
padding: 36rpx 20rpx 36rpx 32rpx;
background: #FFFFFF;
box-shadow: 0rpx 4rpx 10rpx 0rpx rgba(68,68,68,0.04);
border-radius: 8rpx;
.info-name {
color: #333333;
font-size: 62rpx;
line-height: 62rpx;
align-items: baseline;
font-weight: bold;
.iconfont {
font-size: 40rpx;
margin-left: auto;
font-weight: normal;
&.iconshoucang2 {
color: #ff6b00 !important;
}
}
}
.audio-box {
display: flex;
flex-wrap: wrap;
margin-top: 40rpx;
.audio {
height: 48rpx;
background: #F7F7F7;
border-radius: 24rpx;
display: flex;
align-items: center;
padding: 0 26rpx;
&:first-child {
margin-right: 16rpx;
}
&.audioActive {
background: rgba(15, 116, 187, 0.1);
}
text {
margin-left: 10rpx;
}
image {
width: 28rpx;
height: 28rpx;
margin-left: 27rpx;
}
}
}
.info-remark {
color: #333;
font-size: 26rpx;
margin: 16rpx 0 24rpx;
view:last-child {
width: 93rpx;
height: 39rpx;
background: #EEEEEE;
border-radius: 10rpx;
color: #666666;
font-size: 20rpx;
text-align: center;
line-height: 39rpx;
margin-left: auto;
}
}
.info-adverb {
color: #999999;
font-size: 26rpx;
text {
color: #333;
margin-left: 22rpx;
}
}
}
.example {
background: #FFFFFF;
box-shadow: 0rpx 4rpx 10rpx 0rpx rgba(68,68,68,0.04);
border-radius: 8rpx;
padding: 30rpx;
margin-top: 20rpx;
.title {
color: #999999;
font-size: 26rpx;
}
.example-item {
margin-top: 30rpx;
.item-content {
display: flex;
margin-bottom: 24rpx;
>view {
width: 520rpx;
}
image {
width: 28rpx;
height: 28rpx;
margin-left: auto;
margin-top: 10rpx;
}
}
.item-translate {
color: #999999;
font-size:24rpx;
}
}
}
.analysis {
background: #FFFFFF;
box-shadow: 0rpx 4rpx 10rpx 0rpx rgba(68,68,68,0.04);
border-radius: 8rpx;
padding: 30rpx 32rpx;
margin-top: 20rpx;
.title {
color: #999999;
font-size: 26rpx;
margin-bottom: 24rpx;
}
.analysis-content {
color: #333333;
font-size: 30rpx;
}
}
}
.detail-footer {
width: 100%;
height: 130rpx;
justify-content: center;
8 months ago
// padding-left: 30rpx;
9 months ago
background: #fff;
box-shadow: 0rpx -19rpx 54rpx 0rpx rgba(34,34,34,0.05);
flex-shrink: 0;
.btn {
color: #666;
font-size: 30rpx;
&.next {
8 months ago
// width: 550rpx;
width: 690rpx;
9 months ago
height: 88rpx;
background: linear-gradient(0deg, #0F74BB 0%, #3293FF 100%);
border-radius: 44rpx;
color: #fff;
line-height: 88rpx;
text-align: center;
8 months ago
// margin-left: 44rpx;
9 months ago
}
}
}
}
</style>