Files
tra-app/src/pages/courseDetail/components/knowledge.vue
T

116 lines
2.6 KiB
Vue

<template>
<view class="">
<view class="knowledge-tip-div">前序知识点学完后方可解锁下一知识点学习</view>
<view
class="point-item mb-30"
v-for="(item, index) in modelValue?.pgrphData || []"
:key="item.index"
@click="toDetail(item)"
:class="item.pgrphStdyStateName == '已学习' ? 'learn' : 'unlearn'"
>
<view class="blue-ball">
<image :src="item.pgrphStdyStateName == '已学习'?knowledgeComplete:knowledgeUnfinished" class="img"></image>
</view>
<view class="top mb-30">
<view class="fz-30 font_pf title">知识点{{ item.pgrphNm }}</view>
<view class="fl1"></view>
</view>
<view class="bottom">
<view class="fz-30 font_pf text ellipsis-text">{{ item.pgrphTitle || item.pgrphContent }}</view>
</view>
</view>
</view>
</template>
<script setup>
import { computed } from 'vue';
import common from '@/common/common';
import knowledgeComplete from '@/static/images/courseDetail/knowledgeComplete.png'
import knowledgeUnfinished from '@/static/images/courseDetail/knowledgeUnfinished.png'
const emit = defineEmits(['toStudyPrgh']);
const props = defineProps({
modelValue: Object
});
const min_no_success_id = computed(() => {
const find_item = props.modelValue?.pgrphData.find(
(res) => res.pgrphStdyStateName === '未学习' || res.pgrphStdyStateName === '学习中'
);
return find_item?.pgrphId || '';
});
const toDetail = (item) => {
if (
item.pgrphStdyStateName === '已学习' ||
item.pgrphStdyStateName === '学习中' ||
min_no_success_id.value === item.pgrphId
) {
emit('toStudyPrgh', item);
} else {
common.msg('请按顺序学习知识点');
}
};
</script>
<style lang="scss" scoped>
.knowledge-tip-div {
padding-top: 24rpx;
padding-left: 36rpx;
padding-right: 52rpx;
padding-bottom: 24rpx;
font-weight: 500;
font-size: 30rpx;
color: #0066ff;
line-height: 40rpx;
text-align: center;
background: #e4f2ff;
border-radius: 22rpx;
border: 4rpx solid #96c0ff;
margin-bottom: 26rpx;
margin-top: 6rpx;
}
.learn {
.study-status {
color: #1dd17a;
}
.title,
.text {
color: #000;
font-weight: 600;
}
}
.unlearn {
.study-status {
color: #999999;
}
color: #999999;
}
.point-item {
background-color: #fff;
padding-top: 24rpx;
padding-left: 88rpx;
padding-right: 52rpx;
padding-bottom: 36rpx;
border-radius: 22rpx;
position: relative;
overflow: hidden;
.top {
display: flex;
justify-content: space-between;
}
.bottom {
padding-left: 12rpx;
}
.blue-ball {
position: absolute;
left: 0%;
top: 0%;
.img{
width: 75rpx;
height: 73rpx;
}
}
}
</style>