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.

136 lines
2.7 KiB

<template>
<view class="container">
<image class="cbg" :src="base.imgHost('book-bg.png')"></image>
<view class="schoolmate btn">
<image mode="widthFix" @click="toUrl(2)" :src="base.imgHost('book-schoolmate1.png')"></image>
<!-- <view>加入我们</view> -->
</view>
<view class="book btn">
<image mode="widthFix" @click="toUrl(1)" :src="base.imgHost('book-book1.png')"></image>
<!-- <view>立即预约</view> -->
</view>
<tabbar :currentPage="2"></tabbar>
</view>
</template>
<script>
import tabbar from '@/components/tabbar/tabbar.vue';
export default {
components: {
tabbar
},
data() {
return {
user: {},
can_appointment: false,
is_schoolmate: 0,
door_appointments: false, // 当前是否有预约
}
},
onShareAppMessage() {
return{
title:"苏州科技商学院",
imageUrl:"/static/share.jpg"
}
},
onShareTimeline() {
return{
title:"苏州科技商学院",
imageUrl:"/static/share.jpg"
}
},
onShow() {
this.getUser()
},
onLoad() {
},
methods: {
getUser() {
this.$u.api.user().then(res => {
console.log("res", res)
this.is_schoolmate = res.user.is_schoolmate
if (res.user.appointment_total - res.user.pass_appointments > 0) {
this.can_appointment = true
} else {
this.can_appointment = false
}
this.door_appointments = res.door_appointments ? true : false
this.$u.vuex('vuex_user', res.user)
})
},
toUrl(type) {
if (type === 1) {
if (!this.can_appointment) {
this.base.toast("您当前没有可预约次数")
return
}
if (this.door_appointments) {
this.base.toast("您当前已有预约")
return
}
uni.navigateTo({
url: '/packages/booksubmit/appointment'
})
} else if (type === 2) {
if (this.is_schoolmate) {
uni.navigateTo({
url: '/packages/schoolmate/index'
})
} else {
this.base.toast("您还不是校友,无权查看")
uni.switchTab({
url: '/pages/course/index'
})
}
}
}
},
}
</script>
<style scoped lang="scss">
.container {
width: 100%;
height: 100vh;
padding-bottom: 200rpx;
.cbg {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100vh;
}
.btn{
width:320rpx;
// height:136rpx;
position: absolute;
image{
width:100%;
height:100%;
}
view{
text-align: center;
margin-top:10rpx;
color:#806e5c;
font-size:30rpx;
}
}
.schoolmate{
top: 300rpx;
left: 40rpx;
}
.book{
bottom: 300rpx;
right: 40rpx;
}
}
</style>