feat(web): continue Ant settings migration and tighten page chrome
Migrate remaining settings screens to Ant Design Vue, densify teams/roles UI, drop page-header subtitles project-wide, and polish notes cards plus contacts row actions. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -8,16 +8,28 @@ import type {
|
||||
UpdateFaqArticleRequest,
|
||||
} from '@mento/shared';
|
||||
import {
|
||||
UiBadge,
|
||||
UiButton,
|
||||
UiCard,
|
||||
UiEmptyState,
|
||||
UiField,
|
||||
UiInput,
|
||||
UiPageHeader,
|
||||
UiTextarea,
|
||||
} from '@/components/ui';
|
||||
import UiIcon from '@/components/UiIcon.vue';
|
||||
Alert as AAlert,
|
||||
Button as AButton,
|
||||
Card as ACard,
|
||||
Checkbox as ACheckbox,
|
||||
Col as ACol,
|
||||
Empty as AEmpty,
|
||||
Flex as AFlex,
|
||||
Form as AForm,
|
||||
FormItem as AFormItem,
|
||||
Input as AInput,
|
||||
InputNumber as AInputNumber,
|
||||
Row as ARow,
|
||||
Space as ASpace,
|
||||
Spin as ASpin,
|
||||
Tag as ATag,
|
||||
Textarea as ATextarea,
|
||||
Typography,
|
||||
} from 'ant-design-vue';
|
||||
import { DeleteOutlined, EditOutlined } from '@ant-design/icons-vue';
|
||||
|
||||
const { Title: ATypographyTitle, Text: ATypographyText, Paragraph: ATypographyParagraph } =
|
||||
Typography;
|
||||
|
||||
const loading = ref(false);
|
||||
const saving = ref(false);
|
||||
@@ -127,204 +139,107 @@ onMounted(load);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="crm-page faq-page" dir="rtl">
|
||||
<UiPageHeader
|
||||
title="پایگاه دانش و سؤالات متداول"
|
||||
description="سؤالات پرتکرار و پاسخهای جامع برای تسریع در پاسخگویی پشتیبانان و کاهش تیکتهای مکرر"
|
||||
/>
|
||||
<a-flex vertical :gap="16">
|
||||
<a-typography-title :level="3" :style="{ margin: 0 }">
|
||||
پایگاه دانش و سؤالات متداول
|
||||
</a-typography-title>
|
||||
|
||||
<div v-if="error" class="crm-alert crm-alert-danger">{{ error }}</div>
|
||||
<div v-if="ok" class="crm-alert crm-alert-success">{{ ok }}</div>
|
||||
<a-alert v-if="error" type="error" show-icon :message="error" closable @close="error = ''" />
|
||||
<a-alert v-if="ok" type="success" show-icon :message="ok" closable @close="ok = ''" />
|
||||
|
||||
<UiCard :title="editingId ? 'ویرایش مقاله' : 'مقاله جدید'" class="editor-card">
|
||||
<form class="crm-form" @submit.prevent="save">
|
||||
<UiField label="پرسش / عنوان مقاله" required>
|
||||
<UiInput v-model="question" required maxlength="500" placeholder="مثلاً نحوه فعالسازی حساب کاربری..." />
|
||||
</UiField>
|
||||
<a-card :title="editingId ? 'ویرایش مقاله' : 'مقاله جدید'" :bordered="false">
|
||||
<a-form layout="vertical" @finish="save">
|
||||
<a-form-item label="پرسش / عنوان مقاله" required>
|
||||
<a-input
|
||||
v-model:value="question"
|
||||
:maxlength="500"
|
||||
placeholder="مثلاً نحوه فعالسازی حساب کاربری..."
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
|
||||
<UiField label="پاسخ کامل" required>
|
||||
<UiTextarea v-model="answer" :rows="4" required placeholder="توضیحات و راهنمای گامبهگام..." />
|
||||
</UiField>
|
||||
<a-form-item label="پاسخ کامل" required>
|
||||
<a-textarea
|
||||
v-model:value="answer"
|
||||
:rows="4"
|
||||
placeholder="توضیحات و راهنمای گامبهگام..."
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
|
||||
<div class="form-grid-extra">
|
||||
<UiField label="دستهبندی">
|
||||
<UiInput v-model="category" maxlength="100" placeholder="مثلاً مالی، فنی، نصب" />
|
||||
</UiField>
|
||||
<a-row :gutter="[16, 0]" align="bottom">
|
||||
<a-col :xs="24" :md="10">
|
||||
<a-form-item label="دستهبندی">
|
||||
<a-input
|
||||
v-model:value="category"
|
||||
:maxlength="100"
|
||||
placeholder="مثلاً مالی، فنی، نصب"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="6">
|
||||
<a-form-item label="ترتیب نمایش">
|
||||
<a-input-number v-model:value="position" :min="0" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="8">
|
||||
<a-form-item label=" ">
|
||||
<a-checkbox v-model:checked="isPublished">منتشرشده در پورتال</a-checkbox>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<UiField label="ترتیب نمایش">
|
||||
<UiInput v-model.number="position" type="number" min="0" />
|
||||
</UiField>
|
||||
<a-form-item>
|
||||
<a-space wrap>
|
||||
<a-button type="primary" html-type="submit" :loading="saving">
|
||||
{{ editingId ? 'ذخیره تغییرات' : 'افزودن مقاله' }}
|
||||
</a-button>
|
||||
<a-button v-if="editingId" @click="resetForm">انصراف</a-button>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-card>
|
||||
|
||||
<div class="publish-toggle-wrap">
|
||||
<label class="publish-label">
|
||||
<input v-model="isPublished" type="checkbox" />
|
||||
<span>منتشرشده در پورتال</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-actions-row">
|
||||
<UiButton type="submit" :loading="saving">
|
||||
{{ editingId ? 'ذخیره تغییرات' : 'افزودن مقاله' }}
|
||||
</UiButton>
|
||||
<UiButton v-if="editingId" variant="ghost" type="button" @click="resetForm">
|
||||
انصراف
|
||||
</UiButton>
|
||||
</div>
|
||||
</form>
|
||||
</UiCard>
|
||||
|
||||
<UiEmptyState
|
||||
v-if="!loading && !items.length"
|
||||
title="هنوز مقالهای ثبت نشده است"
|
||||
description="با ثبت اولین سؤال و پاسخ، پایگاه دانش سازمان را تکمیل کنید."
|
||||
icon="document"
|
||||
/>
|
||||
|
||||
<div v-else class="articles-list">
|
||||
<UiCard v-for="row in items" :key="row.id" class="article-card">
|
||||
<div class="article-content">
|
||||
<div class="article-title-row">
|
||||
<strong class="article-question">{{ row.question }}</strong>
|
||||
<div class="article-badges">
|
||||
<UiBadge :variant="row.isPublished ? 'success' : 'neutral'">
|
||||
{{ row.isPublished ? 'منتشرشده' : 'پیشنویس' }}
|
||||
</UiBadge>
|
||||
<UiBadge v-if="row.category" variant="info">
|
||||
{{ row.category }}
|
||||
</UiBadge>
|
||||
</div>
|
||||
</div>
|
||||
<p class="article-answer">{{ row.answer }}</p>
|
||||
</div>
|
||||
|
||||
<div class="article-actions">
|
||||
<UiButton variant="secondary" size="sm" @click="startEdit(row)">
|
||||
<template #icon>
|
||||
<UiIcon name="pencil" />
|
||||
</template>
|
||||
ویرایش
|
||||
</UiButton>
|
||||
<UiButton variant="danger" size="sm" @click="remove(row)">
|
||||
<template #icon>
|
||||
<UiIcon name="trash" />
|
||||
</template>
|
||||
حذف
|
||||
</UiButton>
|
||||
</div>
|
||||
</UiCard>
|
||||
</div>
|
||||
</section>
|
||||
<a-spin :spinning="loading">
|
||||
<a-empty
|
||||
v-if="!loading && !items.length"
|
||||
description="هنوز مقالهای ثبت نشده است. با ثبت اولین سؤال و پاسخ، پایگاه دانش را تکمیل کنید."
|
||||
/>
|
||||
<a-flex v-else vertical :gap="12">
|
||||
<a-card v-for="row in items" :key="row.id" :bordered="false">
|
||||
<a-row :gutter="[16, 12]" align="top">
|
||||
<a-col :xs="24" :lg="18">
|
||||
<a-flex vertical :gap="8">
|
||||
<a-space wrap>
|
||||
<a-typography-text strong>{{ row.question }}</a-typography-text>
|
||||
<a-tag :color="row.isPublished ? 'success' : 'default'" :bordered="false">
|
||||
{{ row.isPublished ? 'منتشرشده' : 'پیشنویس' }}
|
||||
</a-tag>
|
||||
<a-tag v-if="row.category" color="processing" :bordered="false">
|
||||
{{ row.category }}
|
||||
</a-tag>
|
||||
</a-space>
|
||||
<a-typography-paragraph type="secondary" :style="{ marginBottom: 0, whiteSpace: 'pre-wrap' }">
|
||||
{{ row.answer }}
|
||||
</a-typography-paragraph>
|
||||
</a-flex>
|
||||
</a-col>
|
||||
<a-col :xs="24" :lg="6">
|
||||
<a-space wrap>
|
||||
<a-button @click="startEdit(row)">
|
||||
<template #icon><EditOutlined /></template>
|
||||
ویرایش
|
||||
</a-button>
|
||||
<a-button danger @click="remove(row)">
|
||||
<template #icon><DeleteOutlined /></template>
|
||||
حذف
|
||||
</a-button>
|
||||
</a-space>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-card>
|
||||
</a-flex>
|
||||
</a-spin>
|
||||
</a-flex>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.faq-page {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--sp-6);
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.editor-card {
|
||||
padding: var(--sp-6);
|
||||
}
|
||||
|
||||
.form-grid-extra {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr auto;
|
||||
gap: var(--sp-4);
|
||||
align-items: flex-end;
|
||||
}
|
||||
|
||||
.publish-toggle-wrap {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: var(--control-h, 40px);
|
||||
}
|
||||
|
||||
.publish-label {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: var(--sp-2);
|
||||
font-size: var(--fs-sm);
|
||||
color: var(--color-text-secondary);
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.form-actions-row {
|
||||
display: flex;
|
||||
gap: var(--sp-2);
|
||||
margin-top: var(--sp-2);
|
||||
}
|
||||
|
||||
.articles-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--sp-4);
|
||||
}
|
||||
|
||||
.article-card {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
gap: var(--sp-4);
|
||||
padding: var(--sp-4) var(--sp-5);
|
||||
}
|
||||
|
||||
.article-content {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--sp-2);
|
||||
}
|
||||
|
||||
.article-title-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--sp-3);
|
||||
}
|
||||
|
||||
.article-question {
|
||||
font-size: var(--fs-md);
|
||||
font-weight: 700;
|
||||
color: var(--color-text-primary);
|
||||
}
|
||||
|
||||
.article-badges {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: var(--sp-2);
|
||||
}
|
||||
|
||||
.article-answer {
|
||||
margin: 0;
|
||||
font-size: var(--fs-sm);
|
||||
color: var(--color-text-secondary);
|
||||
line-height: var(--lh-relaxed);
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.article-actions {
|
||||
display: flex;
|
||||
gap: var(--sp-2);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.form-grid-extra {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.article-card {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.article-actions {
|
||||
justify-content: flex-end;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user