| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- <template>
- <view class="bind-page">
- <view class="form-card">
- <text class="form-title">来源信息</text>
- <text class="form-desc">请填写来源编码(如有),用于记录您的报名来源;没有可留空</text>
- <input
- class="code-input"
- v-model="referralCode"
- placeholder="请输入来源编码"
- placeholder-class="code-placeholder"
- maxlength="16"
- :disabled="binding"
- />
- <button class="bind-btn" @click="submitBind" :loading="binding" :disabled="binding || !referralCode.trim()">
- {{ binding ? '提交中…' : '确认提交' }}
- </button>
- </view>
- <view class="tip-card">
- <text class="tip-title">填写说明</text>
- <text class="tip-desc">1. 提交后仅用于记录来源信息,不影响您的报名与学习</text>
- <text class="tip-desc">2. 来源信息仅可提交一次,提交后不可修改</text>
- <text class="tip-desc">3. 请确保编码准确,如有疑问请联系机构</text>
- </view>
- </view>
- </template>
- <script>
- import { bindReferrer } from '@/utils/api.js'
- import { guardPage } from '@/utils/guard.js'
- export default {
- data() {
- return {
- referralCode: '',
- binding: false
- }
- },
- onLoad() {
- if (!guardPage()) return
- },
- methods: {
- submitBind() {
- var self = this
- var code = this.referralCode ? this.referralCode.trim() : ''
- if (!code) {
- uni.showToast({ title: '请输入来源编码', icon: 'none' })
- return
- }
- if (this.binding) return
- this.binding = true
- bindReferrer(code).then(function() {
- uni.showToast({ title: '提交成功', icon: 'success' })
- setTimeout(function() {
- uni.navigateBack({})
- }, 800)
- }).catch(function() {
- // 业务错误已由全局请求层 toast
- }).then(function() {
- self.binding = false
- })
- }
- }
- }
- </script>
- <style scoped>
- .bind-page { min-height: 100vh; background: #F5FAFE; padding: 24rpx 32rpx; }
- .form-card { background: #FFF; border-radius: 16rpx; padding: 32rpx; margin-bottom: 24rpx; }
- .form-title { display: block; font-size: 30rpx; font-weight: 700; color: #1E3A5F; margin-bottom: 12rpx; }
- .form-desc { display: block; font-size: 24rpx; color: #3B5A78; line-height: 40rpx; margin-bottom: 24rpx; }
- .code-input { height: 88rpx; border: 2rpx solid #E3ECF4; border-radius: 12rpx; padding: 0 24rpx; font-size: 32rpx; color: #1E3A5F; font-family: monospace; letter-spacing: 4rpx; margin-bottom: 24rpx; background: #F5FAFE; }
- .code-placeholder { font-size: 28rpx; color: #6B7B8C; letter-spacing: 0; }
- .bind-btn { width: 100%; height: 88rpx; line-height: 88rpx; background: #2E6FA8; color: #FFF; font-size: 30rpx; font-weight: 600; border-radius: 44rpx; border: none; }
- .bind-btn:active { opacity: 0.85; }
- .bind-btn[disabled] { background: #B4C2D0; color: #FFF; }
- .tip-card { background: #FFF; border-radius: 16rpx; padding: 32rpx; }
- .tip-title { display: block; font-size: 30rpx; font-weight: 700; color: #1E3A5F; margin-bottom: 16rpx; border-left: 8rpx solid #2E6FA8; padding-left: 16rpx; }
- .tip-desc { display: block; font-size: 26rpx; color: #3B5A78; line-height: 48rpx; }
- </style>
|