Files
cz-web/src/views/profile/feedback.vue
2026-09-30 08:04:16 +08:00

87 lines
1.9 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<script setup lang="ts">
import { ref } from 'vue'
import { ElMessage } from 'element-plus'
import type { FileInfo } from '@/types/api'
import type { Feedback } from '@/types/business/profile'
import { useProfileStore } from '@/stores/modules/profile'
import { useOssStore } from '@/stores/modules/oss'
import FeedbackForm from './cpns/FeedbackForm.vue'
const profileStore = useProfileStore()
const ossStore = useOssStore()
const resetSignal = ref(0)
function onSubmit(feedback: Feedback): void {
if (!feedback.title.trim()) {
ElMessage.warning('请填写反馈标题')
return
}
if (!feedback.description.trim()) {
ElMessage.warning('请填写详细描述')
return
}
void profileStore.submitFeedback(feedback).then(() => {
ElMessage.success('提交成功')
resetSignal.value += 1
})
}
function onReset(): void {
resetSignal.value += 1
}
function onPreview(file: FileInfo): void {
// 同源预览:本地未上传文件无 ossId,弹窗会提示无法在线预览
ossStore.openPreview(file)
}
</script>
<template>
<div class="feedback-page">
<header class="feedback-page__head">
<h2 class="feedback-page__title">
意见反馈
</h2>
<p class="feedback-page__sub text-secondary">
您的每一条建议都是我们前进的动力
</p>
</header>
<FeedbackForm
:reset-signal="resetSignal"
@submit="onSubmit"
@reset="onReset"
@preview="onPreview"
/>
</div>
</template>
<style lang="less" scoped>
.feedback-page {
.flex(column, flex-start);
gap: @spacing-base;
width: 100%;
&__head {
.flex(column, flex-start);
gap: @spacing-xs;
width: 100%;
padding: @spacing-base @spacing-xl;
border-radius: @radius-lg;
background: @white;
box-shadow: @shadow-base;
}
&__title {
font-size: @font-size-lg;
font-weight: 600;
color: @heading-color;
}
&__sub {
font-size: @font-size-base;
}
}
</style>