2018-12-17 08:26:27 +00:00
|
|
|
|
|
|
|
<template>
|
2019-03-31 14:16:39 +00:00
|
|
|
<div class="mt-3 col-md-4 col-sm-12">
|
|
|
|
<div class="card h-100">
|
|
|
|
<div class="card-hero-img" v-if="topic.hero_image" v-bind:style="{ 'background-image': 'url(' + image + ')' }"></div>
|
|
|
|
<div v-else class="card-image-wrapper">
|
|
|
|
<div class="image-body">{{ topic.topic_name }}</div>
|
|
|
|
</div>
|
|
|
|
<div class='card-body'>
|
2019-02-26 11:19:15 +00:00
|
|
|
<h5 class="card-title">{{ topic.topic_name }}</h5>
|
2018-12-17 08:26:27 +00:00
|
|
|
<span class="course-list text-muted" id="getting-started">
|
2019-02-26 11:19:15 +00:00
|
|
|
Content
|
2018-12-17 08:26:27 +00:00
|
|
|
<ul class="mb-0 mt-1">
|
2019-02-26 11:19:15 +00:00
|
|
|
<li v-for="content in topic.topic_content" :key="content.name">
|
2019-02-26 11:41:01 +00:00
|
|
|
<router-link v-if="isLogin" tag="a" :class="'text-muted'" :to="{name: 'content', params:{program_name: program_name, topic:topic.name, course_name: course_name, type:content.content_type, content: content.content} }">
|
2019-02-26 11:19:15 +00:00
|
|
|
<span style="padding-right: 0.4em"></span>{{ content.content }}
|
2018-12-17 08:26:27 +00:00
|
|
|
</router-link>
|
2019-02-26 11:19:15 +00:00
|
|
|
<div v-else><span style="padding-right: 0.4em"></span>{{ content.content }}</div>
|
2018-12-17 08:26:27 +00:00
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</span>
|
|
|
|
</div>
|
2019-03-31 14:16:39 +00:00
|
|
|
<div v-if="isLogin" class='text-right p-3'>
|
|
|
|
<div class='course-buttons text-center'>
|
|
|
|
<a-button
|
|
|
|
:type="buttonType"
|
|
|
|
size="sm btn-block"
|
|
|
|
:route="firstContentRoute"
|
|
|
|
>
|
|
|
|
{{ buttonName }}
|
|
|
|
</a-button>
|
|
|
|
</div>
|
2018-12-17 08:26:27 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import AButton from './Button.vue';
|
|
|
|
|
|
|
|
export default {
|
2019-02-26 11:41:01 +00:00
|
|
|
props: ['topic', 'course_name', 'program_name'],
|
2019-02-26 11:19:15 +00:00
|
|
|
name: "TopicCard",
|
2018-12-17 08:26:27 +00:00
|
|
|
data() {
|
|
|
|
return {
|
2019-02-28 10:10:49 +00:00
|
|
|
topicMeta: {}
|
2018-12-17 08:26:27 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted() {
|
2019-02-28 10:10:49 +00:00
|
|
|
if(lms.store.checkLogin()) this.getTopicMeta().then(data => this.topicMeta = data)
|
2018-12-17 08:26:27 +00:00
|
|
|
},
|
|
|
|
components: {
|
|
|
|
AButton
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
firstContentRoute() {
|
|
|
|
if(lms.store.checkLogin()){
|
2019-02-28 10:10:49 +00:00
|
|
|
return `/Program/${this.program_name}/${this.course_name}/${this.topic.name}/${this.topicMeta.content_type}/${this.topicMeta.content}`
|
2018-12-17 08:26:27 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
return {}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
buttonType() {
|
|
|
|
if(lms.store.checkProgramEnrollment(this.program_name)){
|
2019-02-28 10:10:49 +00:00
|
|
|
if (this.topicMeta.flag == "Start Topic" ){
|
2018-12-17 08:26:27 +00:00
|
|
|
return "primary"
|
|
|
|
}
|
2019-02-28 10:10:49 +00:00
|
|
|
else if (this.topicMeta.flag == "Completed" ) {
|
2018-12-17 08:26:27 +00:00
|
|
|
return "success"
|
|
|
|
}
|
2019-02-28 10:10:49 +00:00
|
|
|
else if (this.topicMeta.flag == "Continue" ) {
|
2018-12-17 08:26:27 +00:00
|
|
|
return "info"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2019-03-19 07:00:43 +00:00
|
|
|
return "info"
|
2018-12-17 08:26:27 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
isLogin() {
|
|
|
|
// return lms.store.checkProgramEnrollment(this.program_name)
|
2019-02-28 10:10:49 +00:00
|
|
|
return lms.store.checkLogin()
|
2018-12-17 08:26:27 +00:00
|
|
|
},
|
|
|
|
buttonName() {
|
2019-03-19 07:00:43 +00:00
|
|
|
if(lms.store.checkProgramEnrollment(this.program_name)){
|
2019-02-28 10:10:49 +00:00
|
|
|
return this.topicMeta.flag
|
2018-12-17 08:26:27 +00:00
|
|
|
}
|
|
|
|
else {
|
2019-03-19 07:00:43 +00:00
|
|
|
return "Explore"
|
2018-12-17 08:26:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
iconClass(content_type) {
|
|
|
|
if(content_type == 'Video') return 'fa fa-play'
|
|
|
|
if(content_type == 'Article') return 'fa fa-file-text-o'
|
|
|
|
if(content_type == 'Quiz') return 'fa fa-question-circle-o'
|
|
|
|
},
|
2019-02-28 10:10:49 +00:00
|
|
|
getTopicMeta() {
|
2019-02-26 11:41:01 +00:00
|
|
|
return lms.call('get_topic_meta', {
|
2019-02-28 10:10:49 +00:00
|
|
|
topic_name: this.topic.name,
|
2019-02-26 11:41:01 +00:00
|
|
|
course_name: this.course_name,
|
2018-12-17 08:26:27 +00:00
|
|
|
})
|
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
2019-03-31 14:16:39 +00:00
|
|
|
.course-buttons {
|
|
|
|
margin-bottom: 1em;
|
2018-12-17 08:26:27 +00:00
|
|
|
}
|
2019-03-31 14:16:39 +00:00
|
|
|
|
|
|
|
div.card-hero-img {
|
|
|
|
height: 220px;
|
|
|
|
background-size: cover;
|
|
|
|
background-repeat: no-repeat;
|
|
|
|
background-position: center;
|
|
|
|
background-color: rgb(250, 251, 252);
|
|
|
|
}
|
|
|
|
|
|
|
|
.card-image-wrapper {
|
|
|
|
display: flex;
|
|
|
|
overflow: hidden;
|
|
|
|
height: 220px;
|
|
|
|
background-color: rgb(250, 251, 252);
|
2019-02-26 11:19:15 +00:00
|
|
|
}
|
2018-12-17 08:26:27 +00:00
|
|
|
|
2019-03-31 14:16:39 +00:00
|
|
|
.image-body {
|
|
|
|
align-self: center;
|
|
|
|
color: #d1d8dd;
|
|
|
|
font-size: 24px;
|
|
|
|
font-weight: 600;
|
|
|
|
line-height: 1;
|
|
|
|
padding: 20px;
|
2018-12-17 08:26:27 +00:00
|
|
|
}
|
|
|
|
</style>
|