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.

335 lines
7.6 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<template>
<view class="container">
<image class="cbg" :src="base.imgHost('alumni-benefits-bg.png')"></image>
<!-- <image class="profile-icon" src="/static/index_icon1-4.png" @click="goToProfile"></image> -->
<view class="button-grid">
<view class="grid-item" @click="handleButtonClick('alumni')">
<image class="item-bg" :src="base.imgHost('xy1.png')"></image>
<!-- <view class="item-content">
<image class="icon" :src="base.imgHost('alumni-benefits-icon1.png')" mode="aspectFit"></image>
<text class="label-1">校友库</text>
</view> -->
</view>
<view class="grid-item" @click="handleButtonClick('supply-demand')">
<image class="item-bg" :src="base.imgHost('xy2.png')"></image>
<!-- <view class="item-content">
<image class="icon" :src="base.imgHost('alumni-benefits-icon3.png')" mode="aspectFit"></image>
<text class="label-2">供需发布</text>
</view> -->
</view>
<view class="grid-item" @click="handleButtonClick('booking')">
<image class="item-bg" :src="base.imgHost('xy3.png')"></image>
<!-- <view class="item-content">
<image class="icon" :src="base.imgHost('alumni-benefits-icon2.png')" mode="aspectFit"></image>
<text class="label-2">场地预约</text>
</view> -->
</view>
<view class="grid-item" @click="handleButtonClick('library')">
<image class="item-bg" :src="base.imgHost('xy4.png')"></image>
<!-- <view class="item-content">
<image class="icon" :src="base.imgHost('alumni-benefits-icon4.png')" mode="aspectFit"></image>
<text class="label-1">图书馆查询</text>
</view> -->
</view>
<view class="grid-item grid-item-wide" @click="handleButtonClick('hr')">
<image class="item-bg item-bg-wide" :src="base.imgHost('xy5.png')"></image>
<!-- <view class="item-content">
<image class="icon" :src="base.imgHost('alumni-benefits-icon4.png')" mode="aspectFit"></image>
<text class="label-1">图书馆查询</text>
</view> -->
</view>
</view>
<!-- 无手机号绑定或注册 pages/me/index 一致 -->
<view class="modal">
<u-popup v-model="showRegister" mode="bottom">
<view>
<view class="modal-tip-wrap">
<view class="modal-tip">提示</view>
<view class="modal-close" @click="showRegister = false">关闭</view>
</view>
<view class="modal-content">
<view>如您已是我方校友,请先绑定账号</view>
<view @click="goBind" class="modal-bind">
去绑定
</view>
<view>如您还不是我方校友,请先注册</view>
<view @click="toRegister" class="modal-register">
去注册
</view>
</view>
</view>
</u-popup>
</view>
<tabbar :currentPage="2"></tabbar>
</view>
</template>
<script>
import tabbar from '@/components/tabbar/tabbar.vue';
export default {
components: {
tabbar
},
data() {
return {
user: {},
enter_schoolmate: 0,
showRegister: false,
hasMobile: false
}
},
onShareAppMessage() {
return{
title:"苏州科技商学院",
imageUrl:"/static/share.jpg"
}
},
onShareTimeline() {
return{
title:"苏州科技商学院",
imageUrl:"/static/share.jpg"
}
},
onShow() {
this.showRegister = false
this.getUser()
},
onLoad() {
},
methods: {
ensureMobileOrPrompt() {
if (!this.hasMobile) {
this.base.toast("请先绑定或注册")
this.showRegister = true
return false
}
return true
},
goBind() {
uni.navigateTo({
url: '/packages/register/login'
})
},
toRegister() {
uni.navigateTo({
url: '/packages/register/index'
})
},
getUser() {
this.$u.api.user().then(res => {
console.log("res", res)
this.enter_schoolmate = res.enter_schoolmate
this.$u.vuex('vuex_user', res.user)
if (this.base.isNull(res.user.mobile)) {
this.hasMobile = false
} else {
this.showRegister = false
this.hasMobile = true
}
})
},
goToProfile() {
uni.navigateTo({
url: '/packages/chat/index'
});
},
handleButtonClick(type) {
if (!this.ensureMobileOrPrompt()) {
return
}
switch (type) {
case 'alumni':
if (this.enter_schoolmate) {
uni.navigateTo({
url: '/packages/schoolmate/index'
})
} else {
this.base.toast("您还不是校友,无权查看", 1000, function() {
setTimeout(function() {
uni.switchTab({
url: '/pages/course/index'
})
}, 1000)
})
}
break;
case 'booking':
uni.navigateTo({
url: '/packages/booksubmit/appointment'
})
break;
case 'supply-demand':
uni.navigateTo({
url: '/packages/supply/index'
})
break;
case 'library':
uni.navigateTo({
url: '/packages/library/index'
})
break;
case 'hr':
uni.navigateTo({
url: '/packages/hr/index'
})
break;
}
}
},
}
</script>
<style scoped lang="scss">
.container {
width: 100%;
height: 100vh;
padding-bottom: 200rpx;
display: flex;
justify-content: center;
align-items: center;
position: relative;
.cbg {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100vh;
z-index: -1;
}
.profile-icon {
position: absolute;
top: 80rpx;
right: 60rpx;
width: 60rpx;
height: 60rpx;
z-index: 10;
}
.button-grid {
display: grid;
grid-template-columns: repeat(2, 368rpx);
// grid-column-gap: 20rpx;
// grid-row-gap: 20rpx;
width: 100%;
justify-content: center;
padding: 0 40rpx;
box-sizing: border-box;
}
.grid-item {
position: relative;
width: 368rpx;
height: 380rpx;
}
/* 最后一张横向大图 */
.grid-item-wide {
grid-column: span 2;
width: 729rpx;
height: 239rpx;
}
.item-bg {
position: absolute;
top: 0;
left: 0;
width: 368rpx;
height: 380rpx;
}
.item-bg-wide {
width: 729rpx;
height: 239rpx;
}
.item-content {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: flex-start;
padding: 60rpx 40rpx;
box-sizing: border-box;
}
.icon {
width: 90rpx;
height: 90rpx;
margin-bottom: 60rpx;
}
.label-1 {
font-size: 34rpx;
font-weight: bold;
color: #4f4a7b;
}
.label-2 {
font-size: 34rpx;
font-weight: bold;
color: #8f6e4d;
}
.modal {
::v-deep .u-drawer-bottom {
border-radius: 40rpx;
}
.modal-tip-wrap {
display: flex;
align-items: center;
justify-content: space-between;
padding: 30rpx;
}
.modal-tip {
font-size: 32rpx;
}
.modal-close {
color: #409eff;
font-size: 28rpx;
}
.modal-content {
height: 450rpx;
padding: 0 30rpx;
font-size: 32rpx;
text-align: center;
&>view {
margin: 30rpx auto;
}
}
.modal-bind {
width: 45%;
text-align: center;
margin: 0 auto;
color: #fff;
border-radius: 30rpx;
padding: 20rpx;
background: linear-gradient(to right, #e4cdb4, #c69c6d);
}
.modal-register {
width: 45%;
text-align: center;
margin: 0 auto;
color: #fff;
border-radius: 30rpx;
padding: 20rpx;
background: linear-gradient(to right, #5e5fbc, #0d0398);
}
}
}
</style>