增加前端格式检查配置

This commit is contained in:
yml2213
2026-06-08 06:40:33 +08:00
parent 79ea3a476c
commit 500f511185
150 changed files with 7254 additions and 4013 deletions
@@ -1,7 +1,17 @@
<script setup lang="ts">
import { onMounted, ref } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { Bell, Delete, Document, Edit, Plus, QuestionFilled, Refresh, Top, Warning } from '@element-plus/icons-vue'
import {
Bell,
Delete,
Document,
Edit,
Plus,
QuestionFilled,
Refresh,
Top,
Warning,
} from '@element-plus/icons-vue'
import {
fetchAdminAnnouncements,
createAnnouncement,
@@ -199,12 +209,34 @@ function getStatusType(status: string): '' | 'success' | 'info' | 'warning' {
</div>
<div class="filter-bar">
<el-select v-model="statusFilter" placeholder="筛选状态" clearable @change="handleFilterChange" style="width: 150px">
<el-option v-for="item in statusOptions" :key="item.value" :label="item.label" :value="item.value" />
<el-select
v-model="statusFilter"
placeholder="筛选状态"
clearable
@change="handleFilterChange"
style="width: 150px"
>
<el-option
v-for="item in statusOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<el-select v-model="categoryFilter" placeholder="筛选分类" clearable @change="handleFilterChange" style="width: 150px">
<el-select
v-model="categoryFilter"
placeholder="筛选分类"
clearable
@change="handleFilterChange"
style="width: 150px"
>
<el-option value="" label="全部分类" />
<el-option v-for="cat in categories" :key="cat.value" :label="cat.label" :value="cat.value" />
<el-option
v-for="cat in categories"
:key="cat.value"
:label="cat.label"
:value="cat.value"
/>
</el-select>
</div>
@@ -220,14 +252,23 @@ function getStatusType(status: string): '' | 'success' | 'info' | 'warning' {
<el-icon><Top /></el-icon>
置顶
</el-tag>
<el-tag v-if="row.is_important" type="danger" size="small" effect="plain">重要</el-tag>
<el-tag v-if="row.is_important" type="danger" size="small" effect="plain"
>重要</el-tag
>
</div>
</div>
</template>
</el-table-column>
<el-table-column label="分类" width="120">
<template #default="{ row }">
<el-tag :style="{ borderColor: getCategoryColor(row.category), color: getCategoryColor(row.category) }" effect="plain" size="small">
<el-tag
:style="{
borderColor: getCategoryColor(row.category),
color: getCategoryColor(row.category),
}"
effect="plain"
size="small"
>
{{ getCategoryLabel(row.category) }}
</el-tag>
</template>
@@ -248,17 +289,43 @@ function getStatusType(status: string): '' | 'success' | 'info' | 'warning' {
</el-table-column>
<el-table-column label="操作" width="280" fixed="right">
<template #default="{ row }">
<el-button type="primary" size="small" @click="handleEdit(row)" text style="color: #1d6fd6; font-weight: 700;">
<el-button
type="primary"
size="small"
@click="handleEdit(row)"
text
style="color: #1d6fd6; font-weight: 700"
>
<el-icon><Edit /></el-icon>
编辑
</el-button>
<el-button v-if="row.status === 'draft'" type="success" size="small" @click="handlePublish(row)" text style="color: #4caf50; font-weight: 700;">
<el-button
v-if="row.status === 'draft'"
type="success"
size="small"
@click="handlePublish(row)"
text
style="color: #4caf50; font-weight: 700"
>
发布
</el-button>
<el-button v-if="row.status === 'published'" type="warning" size="small" @click="handleArchive(row)" text style="color: #d97706; font-weight: 700;">
<el-button
v-if="row.status === 'published'"
type="warning"
size="small"
@click="handleArchive(row)"
text
style="color: #d97706; font-weight: 700"
>
归档
</el-button>
<el-button type="danger" size="small" @click="handleDelete(row)" text style="color: #dc2626; font-weight: 700;">
<el-button
type="danger"
size="small"
@click="handleDelete(row)"
text
style="color: #dc2626; font-weight: 700"
>
<el-icon><Delete /></el-icon>
删除
</el-button>