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.

53 lines
2.1 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="modal">
<u-popup :value="value" mode="bottom" :mask-close-able="!busy" @input="onInput">
<view>
<view class="modal-tip-wrap">
<view class="modal-tip">提示</view>
<view class="modal-close" @click="dismiss">关闭</view>
</view>
<view class="modal-content">
<view>如您已是我方校友,请先登录账号</view>
<view class="modal-bind" :class="{ 'is-busy': busy }" @click="go('login')">去登录</view>
<view>如您还不是我方校友,请先注册</view>
<view class="modal-register" :class="{ 'is-busy': busy }" @click="go('register')">去注册</view>
</view>
</view>
</u-popup>
</view>
</template>
<script>
import { beginSupplyIdentity } from '@/common/supplyIdentity.js'
export default {
props: { value: { type: Boolean, default: false }, returnPath: { type: String, default: '' } },
data() { return { busy: false } },
methods: {
onInput(visible) { if (!visible) this.dismiss() },
dismiss() { if (!this.busy) { this.$emit('input', false); this.$emit('dismiss') } },
async go(kind) {
if (this.busy) return
this.busy = true
try { await beginSupplyIdentity(this, kind, this.returnPath); this.$emit('input', false) }
catch (error) { this.$u.toast('暂时无法进入登录注册,请重试') }
finally { this.busy = false }
}
}
}
</script>
<style lang="scss" scoped>
.modal {
::v-deep .u-drawer-bottom { border-radius: 40rpx; }
&-tip-wrap { display: flex; align-items: center; justify-content: space-between; padding: 30rpx; }
&-tip { font-size: 32rpx; }
&-close { color: #409eff; font-size: 28rpx; }
&-content {
height: 450rpx; padding: 0 30rpx; font-size: 32rpx; text-align: center;
& > view { margin: 30rpx auto; }
}
&-bind, &-register { width: 45%; text-align: center; margin: 0 auto; color: #fff; border-radius: 30rpx; padding: 20rpx; }
&-bind { background: linear-gradient(to right, #e4cdb4, #c69c6d); }
&-register { background: linear-gradient(to right, #5e5fbc, #0d0398); }
.is-busy { opacity: .6; }
}
</style>