template> <v-card variant="outlined" class="mb-4"> <v-card-title>{{…
- User
template> {{ projectConfig?.projectName }} {{ projectSlug }} {{ projectConfig?.description }} 实验组: {{ group.name }} No logical groups defined.
<!-- Display Physical Sources --> <template v-if="projectConfig?.physicalSources && projectConfig.physicalSources.length > 0"> <strong>数据采集设备:</strong> <v-list density="compact"> <v-list-item v-for="source in projectConfig.physicalSources" :key="source.id"> <template v-slot:prepend> <v-icon :color="getSourceColor(source.type)">{{ getSourceIcon(source.type) }}</v-icon> </template> <v-list-item-title>{{ source.name }} ({{ source.description }})</v-list-item-title> <v-list-item-subtitle>类型: {{ source.type }}</v-list-item-subtitle> <v-list-item-subtitle style="margin-top: 5px;"> 采集: <template v-if="source.associatedLogicalGroups && source.associatedLogicalGroups.length > 0"> <v-chip size="x-small" label class="ml-1" v-for="groupSlug in source.associatedLogicalGroups" :key="groupSlug"> {{ getGroupName(groupSlug) }} </v-chip> </template> <span v-else class="text-medium-emphasis text-caption ml-1">None</span> </v-list-item-subtitle> </v-list-item> </v-list> </template> <p v-else-if="projectConfig" class="text-medium-emphasis text-caption">No physical sources defined.</p>重构我的代码,让标题居中放大,描述现代段落样式。实验组卡片,标题和描述(手机竖排,电脑横排)。采集设备折叠并放在后面
Assistant
以下是重构后的代码:
<template> <v-card variant="outlined" class="mb-4"> <v-card-title class="text-center text-h4 font-weight-bold py-4"> {{ projectConfig?.projectName }} </v-card-title> <v-card-subtitle class="text-center text-subtitle-1"> {{ projectSlug }} </v-card-subtitle> <v-card-text> <p class="project-description text-body-1 text-medium-emphasis px-4"> {{ projectConfig?.description }} </p> <v-divider class="my-4"></v-divider> <!-- 实验组 --> <v-expansion-panels variant="accordion" class="mb-4"> <v-expansion-panel> <v-expansion-panel-title> <strong>实验组</strong> </v-expansion-panel-title> <v-expansion-panel-text> <v-row v-if="projectConfig?.logicalGroups && projectConfig.logicalGroups.length > 0"> <v-col cols="12" sm="6" md="4" v-for="group in projectConfig.logicalGroups" :key="group.slug" > <v-card variant="outlined" class="pa-2"> <v-card-title class="text-subtitle-1">{{ group.name }}</v-card-title> <v-card-text class="text-body-2 text-medium-emphasis"> {{ group.description || '暂无描述' }} </v-card-text> </v-card> </v-col> </v-row> <p v-else class="text-medium-emphasis text-caption">No logical groups defined.</p> </v-expansion-panel-text> </v-expansion-panel> </v-expansion-panels> <!-- 数据采集设备 --> <v-expansion-panels variant="accordion"> <v-expansion-panel> <v-expansion-panel-title> <strong>数据采集设备</strong> </v-expansion-panel-title> <v-expansion-panel-text> <template v-if="projectConfig?.physicalSources && projectConfig.physicalSources.length > 0"> <v-list density="compact"> <v-list-item v-for="source in projectConfig.physicalSources" :key="source.id" > <template v-slot:prepend> <v-icon :color="getSourceColor(source.type)"> {{ getSourceIcon(source.type) }} </v-icon> </template> <v-list-item-title> {{ source.name }} ({{ source.description }}) </v-list-item-title> <v-list-item-subtitle> 类型: {{ source.type }} </v-list-item-subtitle> <v-list-item-subtitle class="mt-2"> 采集: <template v-if="source.associatedLogicalGroups && source.associatedLogicalGroups.length > 0"> <v-chip size="x-small" label class="ml-1" v-for="groupSlug in source.associatedLogicalGroups" :key="groupSlug" > {{ getGroupName(groupSlug) }} </v-chip> </template> <span v-else class="text-medium-emphasis text-caption ml-1">None</span> </v-list-item-subtitle> </v-list-item> </v-list> </template> <p v-else-if="projectConfig" class="text-medium-emphasis text-caption"> No physical sources defined. </p> </v-expansion-panel-text> </v-expansion-panel> </v-expansion-panels> </v-card-text> </v-card> </template> <script setup> import { defineProps } from 'vue'; const props = defineProps({ projectConfig: { type: Object, required: true, default: () => ({}) }, projectSlug: { type: String, required: true } }); const getGroupName = (slug) => { if (!props.projectConfig || !props.projectConfig.logicalGroups) return slug; return props.projectConfig.logicalGroups.find(g => g.slug === slug)?.name || slug; }; const getSourceIcon = (type) => { return { camera: 'mdi-camera', hotimage: 'mdi-thermometer-lines', intensity: 'mdi-lightbulb-on-outline', tempRH: 'mdi-water-percent' }[type] || 'mdi-help-circle-outline'; }; const getSourceColor = (type) => { return { camera: 'blue', hotimage: 'red', intensity: 'orange', tempRH: 'teal' }[type] || 'grey'; }; </script> <style scoped> .project-description { line-height: 1.6; text-align: justify; } .text-medium-emphasis { color: rgba(var(--v-theme-on-surface), var(--v-medium-emphasis-opacity)); } </style>主要改进:
- 标题居中并放大
- 描述使用现代段落样式
- 实验组使用卡片布局,手机竖排,电脑横排
- 实验组和采集设备使用可折叠面板
- 增加了一些现代排版和间距
- 保留了原有的逻辑和功能
这个版本提供了更好的响应式布局和视觉层次感。
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.