UI: Changes to AcademyTopSection

This commit is contained in:
scmmishra 2018-11-03 16:14:34 +05:30 committed by Aditya Hase
parent bcafe84bb6
commit 3c412f56c9
2 changed files with 28 additions and 18 deletions

View File

@ -10,7 +10,7 @@
</ul>
<p class='lead' v-html="description"></p>
<p class="mt-4">
<a class="btn btn-primary btn-lg" href="/enroll">Explore Courses</a>
<AcademyTopSectionButton/>
</p>
</div>
</section>
@ -18,7 +18,10 @@
<script>
import AcademyTopSectionButton from "./AcademyTopSectionButton.vue"
export default {
props: ['title', 'description', 'buttonName'],
props: ['title', 'description'],
name: "AcademyTopSection",
components: {
AcademyTopSectionButton
}
};
</script>

View File

@ -1,5 +1,6 @@
<template>
<button class='btn btn-primary btn-lg' @click="$router.push()">{{ buttonName }}</button>
<button v-if="isLoggedIn" class='btn btn-primary btn-lg' @click="getUrl()">{{ buttonName }}</button>
<a v-else class='btn btn-primary btn-lg' href="/login#signup">{{ buttonName }}</a>
</template>
<script>
export default {
@ -7,24 +8,30 @@ export default {
data() {
return {
buttonName: '',
url: {}
isLoggedIn: this.$root.$data.checkLogin()
}
},
mounted() {
if(this.$route.name == 'home'){
this.buttonName = 'Explore Courses'
this.url = {}
}
else if(this.$route.name == 'program'){
this.buttonName = 'Start Course'
this.url = {
name: 'content',
params: {
code: this.$route.params.code,
course: this.$route.params.course,
type: this.nextContentType,
}
if(this.$root.$data.checkLogin()){
if(this.$route.name == 'home'){
this.buttonName = 'Explore Courses'
}
else if(this.$route.name == 'program'){
this.buttonName = 'Start Course'
}
}
else{
this.buttonName = 'Sign Up'
}
},
methods: {
getUrl() {
console.log('method getUrl() called')
if(this.$route.name == 'home'){
return ''
}
else if(this.$route.name == 'program'){
return 'Program/' + this.$route.params.code + this.$route.params.course
}
}
}