<template>
	<view class="attestationAlumna white_style">
		<Nav className="nav_F6" :backVisible="true" :scroll="scroll">
			<block slot="content" class="omit">{{ $t('campus.attestationAlumna.title') }}</block>
		</Nav>
		<view :style="{paddingTop: `${CustomBar}px;`}">
			<scroll-view
				class="body_scroll clearfix"
				:scroll-y="true"
				:style="scrollHeight"
				:refresher-enabled="true"
				:refresher-triggered="triggered"
				@refresherrefresh="onRefresh"
				@refresherrestore="onRestore">
				<view class="attestationAlumna_form">
					<view class="user_info">
						<view class="head_portrait">
							<image class="pic" mode="aspectFill" :src="form.user.avatarUrl"></image>
						</view>
						<view class="tips">请帮忙确认我的校友身份，谢谢</view>
						<view class="user_info__contenter">
							<view class="item">
								<view class="title">姓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名：</view>
								<view class="content">{{ form.userName | across }}</view>
							</view>
							<view class="item">
								<view class="title">学&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;校：</view>
								<view class="content">{{ form.schoolFullname | across }}</view>
							</view>
							<view class="item">
								<view class="title">学&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;历：</view>
								<view class="content">{{ dict['education'][form.eduBackground] | across }}</view>
							</view>
							<view class="item">
								<view class="title">入学年份：</view>
								<view class="content">{{ form.enrollmentYear | across }}年</view>
							</view>
						</view>
						<view class="copyright">
							<image class="pic" mode="aspectFill" src="https://daifeiclub.com/image/pics/copyright.png"></image>
						</view>
					</view>
					<view class="explain">已获确认（{{ form.confirmNum || 0}}/1）</view>
					<button class="btn active" open-type="share" v-if="form.authStatus === '0'">邀请校友确认</button>
					<view class="btn" v-else>已通过认证</view>
				</view>
			</scroll-view>
		</view>
		<!-- loading -->
		<loading :visible="loading" />
	</view>
</template>

<script>
	import mixins from '@/utils/mixins'

	export default {
		mixins: [mixins],
		data() {
			return {
				dict: {
					education: this.API.dict['education']
				}
			}
		},
		onLoad(e) {
			if (e) {
				this.options = Object.assign({}, this.options, e)
				this.getDeatil()
			}
		},
		methods: {
			// 获取详情
			async getDeatil () {
				this.loading = true
				const result = await this.$axios.get(this.API.getAuthPage, {
					params: {
						schoolmateAuthId: this.options.id
					}
				})
				this.loading = false
				this.triggered = false
				if (result) {
					this.form = result
				}
			},
			// 自定义下拉刷新被触发
			onRefresh () {
				this.triggered = true
				this.getDeatil()
			},
			// 自定义下拉刷新被复位
			onRestore () {
				this.triggered = false
			}
		},
		// 分享
		onShareAppMessage (e) {
			return {
				title: `帮忙确认下我的校友身份呗`, // 分享标题
				path: `/pages/share/authSchool?id=${this.options.id}`, // 页面 path
				imageUrl: 'https://daifeiclub.com/image/pics/team_share.png'
			}
		}
	}
</script>

<style lang="scss" scoped>
	.attestationAlumna {
		min-height: calc(100vh);

		.body_scroll {
			.attestationAlumna_form {
				padding: 124rpx 13px 96rpx 13px;
				.user_info {
					box-shadow: -4rpx 4rpx 8rpx 2rpx rgba(0, 0, 0, 0.08);
					padding: 0 10px 10rpx 10px;
					border: 2rpx solid $FDFDFD;
					background-color: $white;
					border-radius: 18rpx;
					.head_portrait {
						margin: -65rpx auto 44rpx auto;
						height: 130rpx;
						width: 130rpx;
						.pic {
							border-radius: 50%;
						}
					}
					.tips {
						text-align: center;
						line-height: 42rpx;
						font-size: 30rpx;
						font-weight: 400;
						color: $B18181;
					}
					.user_info__contenter {
						padding: 44rpx 12%;
						.item {
							display: flex;
							align-items: center;
							line-height: 30rpx;
							font-size: 34rpx;
							font-weight: 500;
							padding: 30rpx 0;
							color: $bg-0;
							.title {
								min-width: 170rpx;
								width: 170rpx;
							}
							.content {
								position: relative;
								text-align: center;
								line-height: 44rpx;
								flex: 1;
								&::before {
									content: '';
									position: absolute;
									right: 0;
									bottom: -14rpx;
									left: 0;
									height: 2rpx;
									background-color: $ECECEC;
								}
							}
						}
					}
				}
				.explain {
					text-align: center;
					line-height: 30rpx;
					font-size: 30rpx;
					font-weight: 400;
					margin-top: 26%;
					color: $B18181;
				}
				.btn {
					background-color: $white;
					margin: 60rpx auto 0 auto;
					width: 368rpx;
					height: 80rpx;
					display: flex;
					align-items: center;
					justify-content: center;
					border-radius: 12rpx;
					font-size: 32rpx;
					font-weight: 500;
					color: $B18181;
					&.active {
						color: $L7C160;
					}
					&::after {
						border-color: transparent;
					}
				}
			}
		}
	}
</style>
