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

View File

@ -1,5 +1,6 @@
<template> <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> </template>
<script> <script>
export default { export default {
@ -7,24 +8,30 @@ export default {
data() { data() {
return { return {
buttonName: '', buttonName: '',
url: {} isLoggedIn: this.$root.$data.checkLogin()
} }
}, },
mounted() { mounted() {
if(this.$route.name == 'home'){ if(this.$root.$data.checkLogin()){
this.buttonName = 'Explore Courses' if(this.$route.name == 'home'){
this.url = {} this.buttonName = 'Explore Courses'
} }
else if(this.$route.name == 'program'){ else if(this.$route.name == 'program'){
this.buttonName = 'Start Course' this.buttonName = 'Start Course'
this.url = { }
name: 'content', }
params: { else{
code: this.$route.params.code, this.buttonName = 'Sign Up'
course: this.$route.params.course, }
type: this.nextContentType, },
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
} }
} }
} }