更新首页
This commit is contained in:
@@ -89,6 +89,23 @@
|
||||
<h3 class="section-title">资质证明材料</h3>
|
||||
<p class="section-desc">请上传相关证明材料,以便我们审核您的入会资格</p>
|
||||
|
||||
<div class="materials-tip">
|
||||
<div>个人会员需提交:入会申请表(签字)、简介、研究成果、职称证书、学历证书、身份证、研究成果或获奖证明。</div>
|
||||
<a-button type="link" @click="navigateTo('/about/join/downloads')">前往资料下载</a-button>
|
||||
</div>
|
||||
|
||||
<a-form-item label="入会申请表(签字)">
|
||||
<a-upload :before-upload="beforeUpload" :custom-request="handleUpload('applicationForm')">
|
||||
<a-button><UploadOutlined /> 上传申请表</a-button>
|
||||
</a-upload>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="个人简介">
|
||||
<a-upload :before-upload="beforeUpload" :custom-request="handleUpload('profile')">
|
||||
<a-button><UploadOutlined /> 上传简介</a-button>
|
||||
</a-upload>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="身份证">
|
||||
<a-upload :before-upload="beforeUpload" :custom-request="handleUpload('idCard')">
|
||||
<a-button><UploadOutlined /> 上传身份证</a-button>
|
||||
@@ -143,25 +160,41 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import dayjs, { type Dayjs } from 'dayjs'
|
||||
import { message } from 'ant-design-vue'
|
||||
import { CheckCircleOutlined, UploadOutlined } from '@ant-design/icons-vue'
|
||||
import { submitSiteJoinApplication, uploadSiteJoinApplicationFile } from '@/api/site'
|
||||
|
||||
useHead({ title: '个人会员申请 - 决策咨询网' })
|
||||
|
||||
type UploadRequestOption = {
|
||||
file: File
|
||||
onSuccess: (response?: unknown) => void
|
||||
onError: (error?: unknown) => void
|
||||
}
|
||||
|
||||
type UploadResult = {
|
||||
path: string
|
||||
url: string
|
||||
name: string
|
||||
}
|
||||
|
||||
const currentStep = ref(0)
|
||||
const submitting = ref(false)
|
||||
|
||||
const formData = reactive({
|
||||
name: '',
|
||||
gender: undefined,
|
||||
birthday: undefined,
|
||||
education: undefined,
|
||||
gender: undefined as string | undefined,
|
||||
birthday: undefined as Dayjs | undefined,
|
||||
education: undefined as string | undefined,
|
||||
title: '',
|
||||
organization: '',
|
||||
phone: '',
|
||||
email: '',
|
||||
researchArea: '',
|
||||
bio: '',
|
||||
applicationForm: '',
|
||||
profile: '',
|
||||
idCard: '',
|
||||
diploma: '',
|
||||
certificate: '',
|
||||
@@ -178,14 +211,21 @@ function beforeUpload(file: File) {
|
||||
}
|
||||
|
||||
function handleUpload(type: string) {
|
||||
return async (option: any) => {
|
||||
return async (option: UploadRequestOption) => {
|
||||
try {
|
||||
// TODO: 调用上传API
|
||||
option.onSuccess()
|
||||
const form = new FormData()
|
||||
form.append('file', option.file)
|
||||
const data = await uploadSiteJoinApplicationFile(form)
|
||||
if (type === 'achievements') {
|
||||
formData.achievements.push(data.path)
|
||||
} else {
|
||||
formData[type as Exclude<keyof typeof formData, 'achievements' | 'birthday'>] = data.path as never
|
||||
}
|
||||
option.onSuccess(data)
|
||||
message.success('上传成功')
|
||||
} catch {
|
||||
option.onError()
|
||||
message.error('上传失败')
|
||||
} catch (e: unknown) {
|
||||
option.onError(e)
|
||||
message.error(e instanceof Error ? e.message : '上传失败')
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -203,11 +243,29 @@ function handleNext() {
|
||||
async function handleSubmit() {
|
||||
submitting.value = true
|
||||
try {
|
||||
// TODO: 调用API提交申请
|
||||
await submitSiteJoinApplication({
|
||||
type: 'personal',
|
||||
name: formData.name,
|
||||
gender: formData.gender,
|
||||
birthday: formData.birthday ? dayjs(formData.birthday).format('YYYY-MM-DD') : '',
|
||||
education: formData.education,
|
||||
title: formData.title,
|
||||
organization: formData.organization,
|
||||
phone: formData.phone,
|
||||
email: formData.email,
|
||||
researchArea: formData.researchArea,
|
||||
bio: formData.bio,
|
||||
applicationForm: formData.applicationForm,
|
||||
profile: formData.profile,
|
||||
idCard: formData.idCard,
|
||||
diploma: formData.diploma,
|
||||
certificate: formData.certificate,
|
||||
achievements: formData.achievements,
|
||||
})
|
||||
message.success('提交成功,请等待审核')
|
||||
navigateTo('/about/join')
|
||||
} catch (e: any) {
|
||||
message.error(e?.message || '提交失败')
|
||||
} catch (e: unknown) {
|
||||
message.error(e instanceof Error ? e.message : '提交失败')
|
||||
} finally {
|
||||
submitting.value = false
|
||||
}
|
||||
@@ -263,6 +321,19 @@ async function handleSubmit() {
|
||||
margin: -10px 0 20px;
|
||||
}
|
||||
|
||||
.materials-tip {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
margin-bottom: 20px;
|
||||
padding: 14px 16px;
|
||||
background: #f8fafc;
|
||||
border: 1px solid #dbeafe;
|
||||
border-radius: 12px;
|
||||
color: #475569;
|
||||
}
|
||||
|
||||
.upload-hint {
|
||||
font-size: 12px;
|
||||
color: #9ca3af;
|
||||
|
||||
Reference in New Issue
Block a user