215 lines
4.5 KiB
Vue
215 lines
4.5 KiB
Vue
<template>
|
||
<div class="suggestions-submit-page">
|
||
<PortalHeader active-path="/suggestions" />
|
||
|
||
<main class="container submit-main">
|
||
<div class="page-header">
|
||
<h1 class="page-title">提交建言</h1>
|
||
<p class="page-desc">欢迎您对政策制定、经济发展、社会治理等方面提出宝贵意见和建议。</p>
|
||
</div>
|
||
|
||
<div class="suggestions-content">
|
||
<div class="intro-section">
|
||
<h2>参与方式</h2>
|
||
<p>建言提交后会进入审核流程,只有审核通过且设置为显示的内容才会在前台展示。</p>
|
||
</div>
|
||
|
||
<a-form
|
||
:model="formData"
|
||
:rules="rules"
|
||
layout="vertical"
|
||
class="suggestion-form"
|
||
>
|
||
<a-form-item label="建言标题" name="title">
|
||
<a-input v-model:value="formData.title" placeholder="请输入建言标题" :maxlength="100" show-count />
|
||
</a-form-item>
|
||
|
||
<a-form-item label="建言内容" name="content">
|
||
<a-textarea
|
||
v-model:value="formData.content"
|
||
placeholder="请详细描述您的建议和意见..."
|
||
:rows="8"
|
||
:maxlength="2000"
|
||
show-count
|
||
/>
|
||
</a-form-item>
|
||
|
||
<a-form-item label="联系方式(选填)" name="contact">
|
||
<a-input v-model:value="formData.contact" placeholder="请输入您的联系方式,方便我们与您联系" />
|
||
</a-form-item>
|
||
|
||
<a-form-item>
|
||
<a-space>
|
||
<a-button type="primary" size="large" @click="handleSubmit" :loading="submitting">
|
||
提交建言
|
||
</a-button>
|
||
<a-button size="large" @click="handleReset">
|
||
重置
|
||
</a-button>
|
||
</a-space>
|
||
</a-form-item>
|
||
</a-form>
|
||
</div>
|
||
</main>
|
||
|
||
<footer class="site-footer">
|
||
<PortalFooter />
|
||
</footer>
|
||
</div>
|
||
</template>
|
||
|
||
<script setup lang="ts">
|
||
import { message } from 'ant-design-vue'
|
||
import { submitSiteSuggestion } from '@/api/site'
|
||
import { usePageSeo } from '@/composables/usePageSeo'
|
||
|
||
definePageMeta({
|
||
layout: 'blank'
|
||
})
|
||
|
||
usePageSeo({
|
||
title: '提交建言',
|
||
description: '广西决策咨询网建言提交页'
|
||
})
|
||
|
||
const submitting = ref(false)
|
||
|
||
const formData = reactive({
|
||
title: '',
|
||
content: '',
|
||
contact: '',
|
||
})
|
||
|
||
const rules = {
|
||
title: [{ required: true, message: '请输入建言标题' }],
|
||
content: [{ required: true, message: '请输入建言内容' }],
|
||
}
|
||
|
||
async function handleSubmit() {
|
||
if (!formData.title.trim()) {
|
||
message.warning('请输入建言标题')
|
||
return
|
||
}
|
||
if (!formData.content.trim()) {
|
||
message.warning('请输入建言内容')
|
||
return
|
||
}
|
||
|
||
submitting.value = true
|
||
try {
|
||
await submitSiteSuggestion({
|
||
title: formData.title.trim(),
|
||
content: formData.content.trim(),
|
||
contact: formData.contact.trim(),
|
||
})
|
||
message.success('建言已提交,感谢您的参与!')
|
||
navigateTo('/suggestions')
|
||
} catch (error: unknown) {
|
||
message.error(error instanceof Error ? error.message : '提交失败')
|
||
} finally {
|
||
submitting.value = false
|
||
}
|
||
}
|
||
|
||
function handleReset() {
|
||
formData.title = ''
|
||
formData.content = ''
|
||
formData.contact = ''
|
||
}
|
||
</script>
|
||
|
||
<style scoped>
|
||
.suggestions-submit-page {
|
||
min-height: 100vh;
|
||
background: #f5f7fa;
|
||
}
|
||
|
||
.container {
|
||
width: min(960px, calc(100% - 32px));
|
||
margin: 0 auto;
|
||
}
|
||
|
||
.submit-main {
|
||
padding: 40px 0 48px;
|
||
}
|
||
|
||
.page-header {
|
||
text-align: center;
|
||
margin-bottom: 32px;
|
||
}
|
||
|
||
.page-title {
|
||
margin: 0 0 12px;
|
||
color: #1f2937;
|
||
font-size: 32px;
|
||
font-weight: 700;
|
||
}
|
||
|
||
.page-desc {
|
||
margin: 0;
|
||
color: #6b7280;
|
||
font-size: 16px;
|
||
}
|
||
|
||
.suggestions-content {
|
||
background: #fff;
|
||
padding: 40px;
|
||
box-shadow: 0 4px 16px rgba(0,0,0,0.08);
|
||
}
|
||
|
||
.intro-section {
|
||
margin-bottom: 32px;
|
||
padding-bottom: 24px;
|
||
border-bottom: 1px solid #f0f0f0;
|
||
}
|
||
|
||
.intro-section h2 {
|
||
margin: 0 0 8px;
|
||
color: #1f2937;
|
||
font-size: 18px;
|
||
font-weight: 600;
|
||
}
|
||
|
||
.intro-section p {
|
||
margin: 0;
|
||
color: #6b7280;
|
||
font-size: 14px;
|
||
line-height: 1.6;
|
||
}
|
||
|
||
.suggestion-form {
|
||
max-width: 720px;
|
||
}
|
||
|
||
.site-footer {
|
||
margin-top: 24px;
|
||
}
|
||
|
||
.footer-nav {
|
||
background: #1f4fa3;
|
||
}
|
||
|
||
.footer-nav-inner {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
gap: 36px;
|
||
min-height: 50px;
|
||
}
|
||
|
||
.footer-nav-inner a {
|
||
color: #fff;
|
||
font-size: 14px;
|
||
}
|
||
|
||
@media (max-width: 768px) {
|
||
.submit-main {
|
||
padding: 28px 0 40px;
|
||
}
|
||
|
||
.suggestions-content {
|
||
padding: 24px 18px;
|
||
}
|
||
}
|
||
</style>
|