初始版本

This commit is contained in:
2026-04-23 17:14:29 +08:00
parent 0d0683a6e6
commit 6dca87b988
204 changed files with 3894 additions and 52759 deletions

268
app/pages/expert/apply.vue Normal file
View File

@@ -0,0 +1,268 @@
<template>
<div class="expert-apply-page">
<div class="page-header">
<h1 class="page-title">专家申请</h1>
<p class="page-desc">成为平台认证专家展示研究成果分享专业观点</p>
</div>
<div class="apply-form-wrap">
<a-steps :current="currentStep" class="steps-wrap">
<a-step title="填写信息" />
<a-step title="上传资料" />
<a-step title="提交审核" />
</a-steps>
<a-form
:model="formData"
:rules="rules"
layout="vertical"
class="apply-form"
>
<!-- 基本信息 -->
<div v-show="currentStep === 0">
<h3 class="section-title">基本信息</h3>
<a-row :gutter="24">
<a-col :span="12">
<a-form-item label="姓名" name="name">
<a-input v-model:value="formData.name" placeholder="请输入您的姓名" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="职称/职务" name="title">
<a-input v-model:value="formData.title" placeholder="如:教授、研究员" />
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="24">
<a-col :span="12">
<a-form-item label="工作单位" name="organization">
<a-input v-model:value="formData.organization" placeholder="请输入您的工作单位" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="研究领域" name="researchArea">
<a-input v-model:value="formData.researchArea" placeholder="请输入您的研究领域" />
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="24">
<a-col :span="12">
<a-form-item label="邮箱" name="email">
<a-input v-model:value="formData.email" placeholder="请输入邮箱" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="联系电话" name="phone">
<a-input v-model:value="formData.phone" placeholder="请输入联系电话" />
</a-form-item>
</a-col>
</a-row>
<a-form-item label="个人简介" name="bio">
<a-textarea v-model:value="formData.bio" :rows="4" placeholder="请简要介绍您的学术背景和工作经历" />
</a-form-item>
</div>
<!-- 上传资料 -->
<div v-show="currentStep === 1">
<h3 class="section-title">资质证明材料</h3>
<p class="section-desc">请上传相关证明材料以便我们审核您的专家资质</p>
<a-form-item label="个人简历">
<a-upload :before-upload="beforeUpload" :custom-request="handleUpload('resume')">
<a-button><UploadOutlined /> 上传简历</a-button>
</a-upload>
<div class="upload-hint">支持 PDFWord 格式不超过 10MB</div>
</a-form-item>
<a-form-item label="职称/学历证明">
<a-upload :before-upload="beforeUpload" :custom-request="handleUpload('certificate')">
<a-button><UploadOutlined /> 上传证明</a-button>
</a-upload>
<div class="upload-hint">支持 JPGPNGPDF 格式</div>
</a-form-item>
<a-form-item label="研究成果或获奖证明">
<a-upload multiple :before-upload="beforeUpload" :custom-request="handleUpload('achievements')">
<a-button><UploadOutlined /> 上传材料</a-button>
</a-upload>
<div class="upload-hint">可上传多份材料</div>
</a-form-item>
</div>
<!-- 确认提交 -->
<div v-show="currentStep === 2" class="confirm-section">
<a-result
title="确认提交申请"
sub-title="请确认您填写的信息和上传的材料准确无误"
>
<template #icon>
<CheckCircleOutlined style="font-size: 80px; color: #52c41a" />
</template>
<template #extra>
<a-button type="primary" size="large" @click="handleSubmit" :loading="submitting">
确认提交
</a-button>
</template>
</a-result>
</div>
<!-- 步骤按钮 -->
<div class="step-actions">
<a-button v-if="currentStep > 0" @click="currentStep--">上一步</a-button>
<a-button v-if="currentStep < 2" type="primary" @click="handleNext">下一步</a-button>
</div>
</a-form>
</div>
</div>
</template>
<script setup lang="ts">
import { message } from 'ant-design-vue'
import { CheckCircleOutlined, UploadOutlined } from '@ant-design/icons-vue'
useHead({ title: '专家申请 - 决策咨询网' })
const currentStep = ref(0)
const submitting = ref(false)
const formData = reactive({
name: '',
title: '',
organization: '',
researchArea: '',
email: '',
phone: '',
bio: '',
resume: '',
certificate: '',
achievements: [] as string[],
})
const rules = {
name: [{ required: true, message: '请输入姓名' }],
email: [{ required: true, type: 'email', message: '请输入正确的邮箱' }],
}
function beforeUpload(file: File) {
const isLt10M = file.size / 1024 / 1024 < 10
if (!isLt10M) {
message.error('文件大小不能超过 10MB')
return false
}
return true
}
function handleUpload(type: string) {
return async (option: any) => {
try {
const form = new FormData()
form.append('file', option.file)
// TODO: 调用上传API
// const res = await uploadFile(form)
// if (type === 'resume') formData.resume = res.url
// if (type === 'certificate') formData.certificate = res.url
option.onSuccess()
message.success('上传成功')
} catch (e) {
option.onError()
message.error('上传失败')
}
}
}
function handleNext() {
if (currentStep.value === 0) {
if (!formData.name || !formData.email) {
message.warning('请填写必填项')
return
}
}
currentStep.value++
}
async function handleSubmit() {
submitting.value = true
try {
// TODO: 调用API提交申请
// await submitExpertApplication(formData)
message.success('提交成功,请等待审核')
navigateTo('/expert')
} catch (e: any) {
message.error(e?.message || '提交失败')
} finally {
submitting.value = false
}
}
</script>
<style scoped>
.expert-apply-page {
max-width: 800px;
margin: 0 auto;
padding: 40px 20px;
}
.page-header {
text-align: center;
margin-bottom: 40px;
}
.page-title {
font-size: 32px;
font-weight: 700;
color: #1f2937;
margin: 0 0 12px;
}
.page-desc {
font-size: 16px;
color: #6b7280;
margin: 0;
}
.apply-form-wrap {
background: #fff;
border-radius: 16px;
padding: 40px;
box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}
.steps-wrap {
margin-bottom: 40px;
}
.section-title {
font-size: 18px;
font-weight: 600;
color: #1f2937;
margin: 0 0 20px;
}
.section-desc {
font-size: 14px;
color: #6b7280;
margin: -10px 0 20px;
}
.upload-hint {
font-size: 12px;
color: #9ca3af;
margin-top: 8px;
}
.confirm-section {
padding: 40px 0;
}
.step-actions {
display: flex;
justify-content: center;
gap: 16px;
margin-top: 32px;
padding-top: 24px;
border-top: 1px solid #f0f0f0;
}
</style>

213
app/pages/expert/index.vue Normal file
View File

@@ -0,0 +1,213 @@
<template>
<div class="expert-page">
<div class="page-header">
<h1 class="page-title">专家资讯</h1>
<p class="page-desc">汇聚各领域权威专家提供专业视角与研究成果</p>
</div>
<!-- 分类标签 -->
<div class="category-tabs">
<a-radio-group v-model:value="activeType" button-style="solid" @change="handleTypeChange">
<a-radio-button value="">全部</a-radio-button>
<a-radio-button value="view">专家视点</a-radio-button>
<a-radio-button value="dynamic">专家动态</a-radio-button>
</a-radio-group>
</div>
<!-- 专家/文章列表 -->
<div class="expert-list">
<div v-for="item in items" :key="item.id" class="expert-item" @click="handleView(item)">
<div class="expert-avatar" v-if="item.avatar">
<img :src="item.avatar" :alt="item.expertName" />
</div>
<div class="expert-default-avatar" v-else>{{ item.expertName?.charAt(0) }}</div>
<div class="expert-content">
<h3 class="expert-title">{{ item.title }}</h3>
<div class="expert-meta">
<span class="meta-item">{{ item.expertName }}</span>
<span class="meta-item">{{ item.expertTitle }}</span>
<span class="meta-item">{{ item.publishTime }}</span>
</div>
<p class="expert-overview">{{ item.overview }}</p>
</div>
</div>
<div v-if="loading" class="loading-placeholder">
<a-spin size="large" />
</div>
<div v-if="!loading && items.length === 0" class="empty-placeholder">
<a-empty description="暂无内容" />
</div>
</div>
<!-- 分页 -->
<div class="pagination-wrap" v-if="total > pageSize">
<a-pagination
v-model:current="currentPage"
:total="total"
:page-size="pageSize"
@change="handlePageChange"
/>
</div>
</div>
</template>
<script setup lang="ts">
import { message } from 'ant-design-vue'
useHead({ title: '专家资讯 - 决策咨询网' })
const router = useRouter()
const activeType = ref((useRoute().query.type as string) || '')
const currentPage = ref(1)
const pageSize = ref(12)
const total = ref(0)
const loading = ref(false)
const items = ref<any[]>([])
async function loadItems() {
loading.value = true
try {
// TODO: 接入实际API
} catch (e: any) {
message.error('加载失败')
} finally {
loading.value = false
}
}
function handleTypeChange() {
currentPage.value = 1
loadItems()
}
function handlePageChange(page: number) {
currentPage.value = page
loadItems()
}
function handleView(item: any) {
router.push(`/expert/${item.id}`)
}
onMounted(() => {
loadItems()
})
</script>
<style scoped>
.expert-page {
max-width: 1200px;
margin: 0 auto;
padding: 40px 20px;
}
.page-header {
text-align: center;
margin-bottom: 40px;
}
.page-title {
font-size: 32px;
font-weight: 700;
color: #1f2937;
margin: 0 0 12px;
}
.page-desc {
font-size: 16px;
color: #6b7280;
margin: 0;
}
.category-tabs {
margin-bottom: 32px;
text-align: center;
}
.expert-list {
display: flex;
flex-direction: column;
gap: 20px;
}
.expert-item {
display: flex;
gap: 20px;
padding: 20px;
background: #fff;
border-radius: 12px;
box-shadow: 0 2px 8px rgba(0,0,0,0.06);
cursor: pointer;
transition: all 0.2s;
}
.expert-item:hover {
box-shadow: 0 4px 16px rgba(0,0,0,0.1);
transform: translateY(-2px);
}
.expert-avatar,
.expert-default-avatar {
width: 80px;
height: 80px;
border-radius: 50%;
flex-shrink: 0;
overflow: hidden;
}
.expert-avatar img {
width: 100%;
height: 100%;
object-fit: cover;
}
.expert-default-avatar {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: #fff;
font-size: 32px;
font-weight: 700;
display: flex;
align-items: center;
justify-content: center;
}
.expert-content {
flex: 1;
}
.expert-title {
font-size: 18px;
font-weight: 600;
color: #1f2937;
margin: 0 0 8px;
}
.expert-meta {
display: flex;
gap: 12px;
font-size: 12px;
color: #6b7280;
margin-bottom: 8px;
}
.expert-overview {
font-size: 14px;
color: #6b7280;
margin: 0;
line-height: 1.6;
}
.loading-placeholder,
.empty-placeholder {
padding: 60px 0;
text-align: center;
}
.pagination-wrap {
margin-top: 40px;
text-align: center;
}
</style>