代码格式修复
This commit is contained in:
@@ -139,7 +139,7 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, computed, onMounted } from 'vue'
|
||||
import { useToast } from '../../composables/useToast'
|
||||
import { createAboutProfile, updateAboutProfile, getAdminAboutProfiles, AboutProfile, Experience } from '../../services/api'
|
||||
import { createAboutProfile, updateAboutProfile, getAdminAboutProfiles, Experience } from '../../services/api'
|
||||
import ImageUpload from '../../components/admin/ImageUpload.vue'
|
||||
|
||||
const toast = useToast()
|
||||
@@ -214,11 +214,10 @@ const handleSubmit = async () => {
|
||||
await updateAboutProfile(currentProfileId.value, payload)
|
||||
toast.success('资料更新成功')
|
||||
} else {
|
||||
const result = await createAboutProfile(payload)
|
||||
currentProfileId.value = result.id
|
||||
await createAboutProfile(payload)
|
||||
toast.success('资料创建成功')
|
||||
}
|
||||
// 重新加载数据
|
||||
// 重新加载数据以获取新创建的 id
|
||||
await loadProfile()
|
||||
} catch (error: any) {
|
||||
console.error('Error submitting form:', error)
|
||||
|
||||
@@ -140,10 +140,10 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, computed, onMounted, watch } from 'vue'
|
||||
import { ref, reactive, computed, onMounted } from 'vue'
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
import { useToast } from '../../composables/useToast'
|
||||
import { createAboutProfile, updateAboutProfile, getAdminAboutProfiles, AboutProfile, Experience } from '../../services/api'
|
||||
import { createAboutProfile, updateAboutProfile, getAdminAboutProfiles, Experience } from '../../services/api'
|
||||
import ImageUpload from '../../components/admin/ImageUpload.vue'
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
import { ref, reactive, onMounted, computed } from 'vue'
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
import { useToast } from '../../composables/useToast'
|
||||
import { createAttachmentCategory, updateAttachmentCategory, getAttachmentCategories, AttachmentCategory } from '../../services/api'
|
||||
import { createAttachmentCategory, updateAttachmentCategory, getAttachmentCategories } from '../../services/api'
|
||||
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
|
||||
@@ -139,7 +139,7 @@ import { updateAttachment, type Attachment } from '../../services/api'
|
||||
|
||||
const toast = useToast()
|
||||
|
||||
interface LocalAttachment extends Attachment {
|
||||
interface LocalAttachment extends Omit<Attachment, 'mimeType' | 'createdAt' | 'storageType'> {
|
||||
categoryId?: number
|
||||
mimeType?: string
|
||||
storageType?: string
|
||||
|
||||
@@ -296,7 +296,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, computed, watch } from 'vue'
|
||||
import { ref, onMounted, computed } from 'vue'
|
||||
import { getOSSConfigs, createOSSConfig, updateOSSConfig, deleteOSSConfig as deleteOSSConfigApi, OSSConfig } from '../../services/api'
|
||||
import { useToast } from '../../composables/useToast'
|
||||
|
||||
|
||||
@@ -170,7 +170,7 @@ import { MdEditor } from 'md-editor-v3'
|
||||
import 'md-editor-v3/lib/style.css'
|
||||
|
||||
import { useToast } from '../../composables/useToast'
|
||||
import { createPost, updatePost, fetchPost, fetchCategories, fetchColumns, fetchTags, Category, Tag } from '../../services/api'
|
||||
import { createPost, updatePost, fetchPost, fetchCategories, fetchColumns, fetchTags, Tag } from '../../services/api'
|
||||
import CustomSelect from '../../components/CustomSelect.vue'
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
<td class="font-medium text-white group-hover:text-art-accent transition-colors">{{ post.title }}</td>
|
||||
<td><span class="px-2 py-1 rounded bg-white/5 border border-white/5 text-xs text-art-muted">{{ post.categoryName || post.category?.name || '未分类' }}</span></td>
|
||||
<td>
|
||||
<span v-if="post.columnName || post.column?.name" class="px-2 py-1 rounded bg-art-accent/10 border border-art-accent/20 text-xs text-art-accent">
|
||||
{{ post.columnName || post.column?.name }}
|
||||
<span v-if="post.columnName" class="px-2 py-1 rounded bg-art-accent/10 border border-art-accent/20 text-xs text-art-accent">
|
||||
{{ post.columnName }}
|
||||
</span>
|
||||
<span v-else class="text-art-muted text-xs">-</span>
|
||||
</td>
|
||||
@@ -96,12 +96,10 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { getAdminPosts, deletePost as deletePostApi, Post, togglePostStatus } from '../../services/api'
|
||||
import { useToast } from '../../composables/useToast'
|
||||
import PostRelationModal from '../../components/admin/PostRelationModal.vue'
|
||||
|
||||
const router = useRouter()
|
||||
const toast = useToast()
|
||||
const posts = ref<Post[]>([])
|
||||
const isRelationModalOpen = ref(false)
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
<form v-else @submit.prevent="saveAllSettings" class="space-y-6">
|
||||
<div
|
||||
v-for="(setting, index) in settings"
|
||||
v-for="setting in settings"
|
||||
:key="setting.id"
|
||||
class="p-4 border border-white/5 rounded-lg bg-white/2 hover:bg-white/5 transition-colors"
|
||||
>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<tr v-for="tag in tags" :key="tag.id">
|
||||
<td class="table-cell">{{ tag.id }}</td>
|
||||
<td class="table-cell">{{ tag.name }}</td>
|
||||
<td class="table-cell">{{ tag.description || '-' }}</td>
|
||||
<td class="table-cell">-</td>
|
||||
<td class="table-cell">{{ tag.createdAt }}</td>
|
||||
<td class="table-cell">{{ tag.updatedAt }}</td>
|
||||
<td class="table-cell actions">
|
||||
@@ -53,12 +53,12 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { adminGetTags, deleteTag } from '../../services/api'
|
||||
import { adminGetTags, deleteTag, type Tag } from '../../services/api'
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
// 标签数据
|
||||
const tags = ref([])
|
||||
const tags = ref<Tag[]>([])
|
||||
|
||||
// 获取标签列表
|
||||
const fetchTags = async () => {
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
import { ref, reactive, onMounted, computed } from 'vue'
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
import { useToast } from '../../composables/useToast'
|
||||
import { createUser, updateUser, fetchUser, User, API_BASE, getAuthHeaders } from '../../services/api'
|
||||
import { createUser, updateUser, API_BASE, getAuthHeaders } from '../../services/api'
|
||||
import CustomSelect from '../../components/CustomSelect.vue'
|
||||
|
||||
const router = useRouter()
|
||||
@@ -205,7 +205,8 @@ onMounted(async () => {
|
||||
errorData = JSON.parse(responseText)
|
||||
throw new Error(errorData.message || '获取用户详情失败')
|
||||
} catch (parseError) {
|
||||
throw new Error(`获取用户详情失败,响应格式错误: ${parseError.message}`)
|
||||
const errorMessage = parseError instanceof Error ? parseError.message : String(parseError)
|
||||
throw new Error(`获取用户详情失败,响应格式错误: ${errorMessage}`)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@
|
||||
|
||||
<div class="space-y-2">
|
||||
<div
|
||||
v-for="(tech, techIndex) in item.items"
|
||||
v-for="(_, techIndex) in item.items"
|
||||
:key="techIndex"
|
||||
class="flex gap-2"
|
||||
>
|
||||
|
||||
@@ -217,7 +217,6 @@ const postsTrendOption = computed(() => ({
|
||||
formatter: function(params: any) {
|
||||
let result = params[0].name + '<br/>';
|
||||
params.forEach((item: any) => {
|
||||
const data = stats.value.postsTrend[item.dataIndex];
|
||||
result += item.marker + item.seriesName + ': ' + item.value + ' 篇<br/>';
|
||||
// if (data.yoy) result += '同比: ' + data.yoy + '%<br/>';
|
||||
// if (data.mom) result += '环比: ' + data.mom + '%<br/>';
|
||||
|
||||
Reference in New Issue
Block a user