feat: 支持班级灵动岛云端配置与跨端同步
This commit is contained in:
1 parent
4449fbd0a1
commit
f6dd59aa25
40 files changed
+1208
-719
No files matched your search
@@ -18,6 +18,7 @@ import {
|
||||
type AssignUserGroupsRequest,
|
||||
type ClassDetailDto,
|
||||
type ClassDto,
|
||||
type ClassIslandLayoutDto,
|
||||
type AutoTermWeeksRequest,
|
||||
type ClassPlanImportResultDto,
|
||||
type ClassPlanPreviewDto,
|
||||
@@ -85,6 +86,7 @@ import {
|
||||
type TimeLayoutParsePreview,
|
||||
type UpdateAiSettingsRequest,
|
||||
type UpdateClassAccountRequest,
|
||||
type UpdateClassIslandLayoutRequest,
|
||||
type UpdateClassRequest,
|
||||
type UpdateInfo,
|
||||
type UpdatePermissionGroupRequest,
|
||||
@@ -143,6 +145,10 @@ export const classApi = {
|
||||
api.patch(`${API_PATHS.classes}/${id}/class-account`, payload),
|
||||
setGradeQuery: (id: string, enabled: boolean): Promise<{ studentGradeQueryEnabled: boolean }> =>
|
||||
api.patch(`${API_PATHS.classes}/${id}/student-grade-query`, { enabled }),
|
||||
islandLayout: (id: string): Promise<ClassIslandLayoutDto> =>
|
||||
api.get(`${API_PATHS.classes}/${id}/island-layout`),
|
||||
saveIslandLayout: (id: string, payload: UpdateClassIslandLayoutRequest): Promise<ClassIslandLayoutDto> =>
|
||||
api.patch(`${API_PATHS.classes}/${id}/island-layout`, payload),
|
||||
/** 学年升级:只改年级,不归档、数据沿用 */
|
||||
promote: (classIds: string[]): Promise<{ promoted: number }> =>
|
||||
api.post(`${API_PATHS.classes}/promote`, { classIds }),
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
<script setup lang="ts">
|
||||
import type { IslandComponentKind } from '@classhelper/shared';
|
||||
|
||||
defineProps<{ kind: IslandComponentKind }>();
|
||||
|
||||
const paths: Record<IslandComponentKind, string> = {
|
||||
clock: 'M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0ZM12 7v5l3 2',
|
||||
weather:
|
||||
'M16 12a4 4 0 1 1-8 0 4 4 0 0 1 8 0ZM12 2v2m0 16v2M2 12h2m16 0h2M5 5l1.5 1.5m11 11L19 19M5 19l1.5-1.5m11-11L19 5',
|
||||
date: 'M6 5h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2ZM8 3v4m8-4v4M4 10h16M8 14h2m4 0h2m-8 3h2',
|
||||
schedule: 'M9 5h11M9 12h11M9 19h11M4 5h1m-1 7h1m-1 7h1',
|
||||
countdown: 'M6 3h12M6 21h12M8 3v4l4 5-4 5v4m8-18v4l-4 5 4 5v4',
|
||||
text: 'M6 3h12a3 3 0 0 1 3 3v12a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3V6a3 3 0 0 1 3-3Zm1 5h10M7 12h7m-7 4h10',
|
||||
separator: 'M12 4v16M5 8v8m14-8v8',
|
||||
notification: 'M9 19a3 3 0 0 0 6 0M6 10a6 6 0 0 1 12 0v4l2 3H4l2-3v-4Z',
|
||||
homework: 'M9 4H6a2 2 0 0 0-2 2v14h16V6a2 2 0 0 0-2-2h-3M9 3h6v4H9V3Zm-1 9h8m-8 4h5',
|
||||
call: 'M4 10h4l6-5v14l-6-5H4v-4Zm13-2a6 6 0 0 1 0 8m3-11a10 10 0 0 1 0 14',
|
||||
group: 'M3 5h18v14H3V5Zm4 4h4v6H7V9Zm8 0h2v6h-2V9Z',
|
||||
stack: 'm12 3 9 5-9 5-9-5 9-5ZM3 12l9 5 9-5M3 16l9 5 9-5',
|
||||
slide: 'M6 5h12v14H6V5ZM2 8v8m20-8v8m-12 7h4',
|
||||
rolling: 'M3 8h17m-4-4 4 4-4 4M21 16H4m4-4-4 4 4 4',
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<svg
|
||||
viewBox="0 0 24 24"
|
||||
width="24"
|
||||
height="24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="1.5"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<path :d="paths[kind]" />
|
||||
</svg>
|
||||
</template>
|
||||
@@ -0,0 +1,311 @@
|
||||
<script setup lang="ts">
|
||||
/** Web 管理端班级灵动岛的组件检查器。 */
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import {
|
||||
CLASSISLAND_TOKENS,
|
||||
ISLAND_COMPONENT_LABELS,
|
||||
type IslandComponentNode,
|
||||
type IslandComponentKind,
|
||||
} from '@classhelper/shared';
|
||||
const props = defineProps<{ node: IslandComponentNode }>();
|
||||
const emit = defineEmits<{ change: []; remove: []; duplicate: []; wrap: [kind: IslandComponentKind] }>();
|
||||
const node = computed(() => props.node),
|
||||
tab = ref('content');
|
||||
watch(
|
||||
() => props.node.id,
|
||||
() => {
|
||||
tab.value = 'content';
|
||||
},
|
||||
);
|
||||
const fonts = {
|
||||
secondaryFontSize: '辅助文字',
|
||||
bodyFontSize: '正文',
|
||||
emphasizedFontSize: '强调文字',
|
||||
largeFontSize: '大号文字',
|
||||
} as const;
|
||||
const containers = ['group', 'stack', 'slide', 'rolling'] as const;
|
||||
</script>
|
||||
<template>
|
||||
<div class="component-settings">
|
||||
<h3>{{ ISLAND_COMPONENT_LABELS[node.kind] }}</h3>
|
||||
<el-tabs v-model="tab" stretch>
|
||||
<el-tab-pane label="内容" name="content">
|
||||
<el-form label-position="top">
|
||||
<template v-if="node.kind === 'clock'">
|
||||
<el-form-item label="12 小时制">
|
||||
<el-switch v-model="node.settings.hour12" @change="emit('change')" />
|
||||
</el-form-item>
|
||||
<el-form-item label="显示秒">
|
||||
<el-switch v-model="node.settings.seconds" @change="emit('change')" />
|
||||
</el-form-item>
|
||||
</template>
|
||||
<template v-else-if="node.kind === 'countdown'">
|
||||
<el-form-item label="倒计时目标">
|
||||
<el-select v-model="node.settings.target" @change="emit('change')">
|
||||
<el-option label="自动:距上课 / 下课" value="auto" />
|
||||
<el-option label="下一节课" value="next" />
|
||||
<el-option label="本节下课" value="end" />
|
||||
<el-option label="放学" value="school" />
|
||||
<el-option label="指定日期" value="date" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<template v-if="node.settings.target === 'date'">
|
||||
<el-form-item label="目标名称">
|
||||
<el-input v-model="node.settings.countdownTitle" :maxlength="64" @change="emit('change')" />
|
||||
</el-form-item>
|
||||
<el-form-item label="目标日期">
|
||||
<ch-date-picker
|
||||
v-model="node.settings.targetDate"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="选择日期"
|
||||
@change="emit('change')"
|
||||
/>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</template>
|
||||
<template v-else-if="node.kind === 'weather'">
|
||||
<el-form-item label="地点名称">
|
||||
<el-input
|
||||
v-model="node.settings.locationName"
|
||||
placeholder="例如:学校"
|
||||
:maxlength="64"
|
||||
@change="emit('change')"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="纬度">
|
||||
<el-input-number
|
||||
v-model="node.settings.latitude"
|
||||
:min="-90"
|
||||
:max="90"
|
||||
:precision="4"
|
||||
@change="emit('change')"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="经度">
|
||||
<el-input-number
|
||||
v-model="node.settings.longitude"
|
||||
:min="-180"
|
||||
:max="180"
|
||||
:precision="4"
|
||||
@change="emit('change')"
|
||||
/>
|
||||
</el-form-item>
|
||||
<p class="hint">
|
||||
填写地点坐标后每 15 分钟更新天气。数据来自
|
||||
Open-Meteo,断网时显示本次运行的缓存;天气提示不作为官方预警。
|
||||
</p>
|
||||
</template>
|
||||
<template v-else-if="node.kind === 'text'">
|
||||
<el-form-item label="文字内容">
|
||||
<el-input v-model="node.settings.text" type="textarea" :rows="3" @change="emit('change')" />
|
||||
</el-form-item>
|
||||
<el-form-item label="启用模板变量">
|
||||
<el-switch v-model="node.settings.template" @change="emit('change')" />
|
||||
</el-form-item>
|
||||
<p class="hint">支持 {date} 日期、{time} 时间、{course} 当前课程。</p>
|
||||
</template>
|
||||
<template v-else-if="node.kind === 'schedule'">
|
||||
<el-form-item label="显示课程">
|
||||
<el-select v-model="node.settings.display" @change="emit('change')">
|
||||
<el-option label="当前时间点" value="current" />
|
||||
<el-option label="下一节课" value="next" />
|
||||
<el-option label="今日时间点" value="today" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="node.settings.display === 'today'" label="显示时间点数">
|
||||
<el-input-number v-model="node.settings.count" :min="1" :max="30" @change="emit('change')" />
|
||||
</el-form-item>
|
||||
<el-form-item label="当前时间点显示起止时间">
|
||||
<el-switch v-model="node.settings.showPeriod" @change="emit('change')" />
|
||||
</el-form-item>
|
||||
<el-form-item label="当前课程显示进度">
|
||||
<el-switch v-model="node.settings.showProgress" @change="emit('change')" />
|
||||
</el-form-item>
|
||||
<p class="hint">
|
||||
今日时间点只展开当前项并显示时间段;课间休息与默认隐藏的时间点折叠时完全隐藏,轮到时才展开。
|
||||
下课前一分钟的倒计时由「提醒」设置里的下课提醒负责。
|
||||
</p>
|
||||
</template>
|
||||
<template v-else-if="containers.includes(node.kind as (typeof containers)[number])">
|
||||
<el-form-item label="排列方向">
|
||||
<el-select v-model="node.settings.direction" @change="emit('change')">
|
||||
<el-option label="横向" value="horizontal" />
|
||||
<el-option label="纵向" value="vertical" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="组件间距">
|
||||
<el-input-number v-model="node.settings.gap" :min="0" :max="64" @change="emit('change')" />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="node.kind === 'slide'" label="切换间隔(秒)">
|
||||
<el-input-number
|
||||
v-model="node.settings.interval"
|
||||
:min="1"
|
||||
:max="300"
|
||||
@change="emit('change')"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="node.kind === 'rolling'" label="滚动速度">
|
||||
<el-input-number v-model="node.settings.speed" :min="1" :max="200" @change="emit('change')" />
|
||||
</el-form-item>
|
||||
</template>
|
||||
<p v-else class="hint">此组件使用实时数据。可在外观和高级设置中调整显示。</p>
|
||||
<el-divider />
|
||||
<el-form-item label="包裹到容器">
|
||||
<el-select
|
||||
data-action="wrap"
|
||||
model-value=""
|
||||
placeholder="选择容器类型"
|
||||
@change="(kind: IslandComponentKind) => emit('wrap', kind)"
|
||||
>
|
||||
<el-option
|
||||
v-for="kind in containers"
|
||||
:key="kind"
|
||||
:label="ISLAND_COMPONENT_LABELS[kind]"
|
||||
:value="kind"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<div class="actions">
|
||||
<el-button @click="emit('duplicate')">复制组件</el-button>
|
||||
<el-button type="danger" plain @click="emit('remove')">删除</el-button>
|
||||
</div>
|
||||
</el-form>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="外观" name="appearance">
|
||||
<el-form label-position="top">
|
||||
<el-form-item label="独立外观">
|
||||
<el-switch v-model="node.appearance.resourceOverridingEnabled" @change="emit('change')" />
|
||||
</el-form-item>
|
||||
<p class="hint">关闭时沿用灵动岛的整体外观。</p>
|
||||
<el-form-item v-for="(label, key) in fonts" :key="key" :label="`${label}字号`">
|
||||
<el-input-number
|
||||
v-model="node.appearance[key]"
|
||||
:disabled="!node.appearance.resourceOverridingEnabled"
|
||||
:min="CLASSISLAND_TOKENS.fontSizes.inputMin"
|
||||
:max="CLASSISLAND_TOKENS.fontSizes.inputMax"
|
||||
:step="CLASSISLAND_TOKENS.fontSizes.inputStep"
|
||||
@change="emit('change')"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="自定义文字颜色">
|
||||
<el-switch
|
||||
v-model="node.appearance.customForegroundEnabled"
|
||||
:disabled="!node.appearance.resourceOverridingEnabled"
|
||||
@change="emit('change')"
|
||||
/>
|
||||
<el-color-picker
|
||||
v-if="node.appearance.customForegroundEnabled"
|
||||
v-model="node.appearance.foreground"
|
||||
@change="emit('change')"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="自定义背景颜色">
|
||||
<el-switch
|
||||
v-model="node.appearance.customBackgroundEnabled"
|
||||
:disabled="!node.appearance.resourceOverridingEnabled"
|
||||
@change="emit('change')"
|
||||
/>
|
||||
<el-color-picker
|
||||
v-if="node.appearance.customBackgroundEnabled"
|
||||
v-model="node.appearance.background"
|
||||
@change="emit('change')"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="自定义背景透明度">
|
||||
<el-switch
|
||||
v-model="node.appearance.customBackgroundOpacityEnabled"
|
||||
:disabled="!node.appearance.resourceOverridingEnabled"
|
||||
@change="emit('change')"
|
||||
/>
|
||||
<el-input-number
|
||||
v-if="node.appearance.customBackgroundOpacityEnabled"
|
||||
v-model="node.appearance.backgroundOpacity"
|
||||
:min="0"
|
||||
:max="1"
|
||||
:step="0.05"
|
||||
@change="emit('change')"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="自定义圆角">
|
||||
<el-switch
|
||||
v-model="node.appearance.customCornerRadiusEnabled"
|
||||
:disabled="!node.appearance.resourceOverridingEnabled"
|
||||
@change="emit('change')"
|
||||
/>
|
||||
<el-input-number
|
||||
v-if="node.appearance.customCornerRadiusEnabled"
|
||||
v-model="node.appearance.cornerRadius"
|
||||
:min="0"
|
||||
:max="CLASSISLAND_TOKENS.radii.islandMax"
|
||||
:step="CLASSISLAND_TOKENS.radii.islandStep"
|
||||
@change="emit('change')"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="组件透明度">
|
||||
<el-slider
|
||||
v-model="node.appearance.opacity"
|
||||
:min="0"
|
||||
:max="1"
|
||||
:step="0.05"
|
||||
@change="emit('change')"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="高级" name="advanced">
|
||||
<el-form label-position="top">
|
||||
<el-form-item label="对齐方式">
|
||||
<el-select v-model="node.advanced.align" @change="emit('change')">
|
||||
<el-option
|
||||
v-for="(label, key) in { stretch: '拉伸', start: '起始', center: '居中', end: '末端' }"
|
||||
:key="key"
|
||||
:label="label"
|
||||
:value="key"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="固定宽度(px)">
|
||||
<el-input-number v-model="node.advanced.width" :min="0" :max="2000" @change="emit('change')" />
|
||||
</el-form-item>
|
||||
<el-form-item label="最大宽度(px)">
|
||||
<el-input-number v-model="node.advanced.maxWidth" :min="0" :max="2000" @change="emit('change')" />
|
||||
</el-form-item>
|
||||
<p class="hint">宽度为 0 时自适应;对齐在父容器设定宽度时生效。</p>
|
||||
<el-form-item label="隐藏条件">
|
||||
<el-checkbox-group v-model="node.advanced.hideRules" @change="emit('change')">
|
||||
<el-checkbox label="上课时" value="in-class" />
|
||||
<el-checkbox label="没有消息时" value="no-message" />
|
||||
<el-checkbox label="没有当前课程时" value="no-class" />
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
</template>
|
||||
<style scoped>
|
||||
h3 {
|
||||
margin: 0 0 6px;
|
||||
}
|
||||
.hint {
|
||||
color: var(--ch-text-secondary);
|
||||
line-height: 1.6;
|
||||
font-size: 12px;
|
||||
}
|
||||
.actions {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.el-select {
|
||||
width: 100%;
|
||||
}
|
||||
.el-form-item :deep(.el-form-item__content) {
|
||||
gap: 10px;
|
||||
}
|
||||
.el-checkbox-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,124 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import { ISLAND_COMPONENT_LABELS, type IslandComponentNode } from '@classhelper/shared';
|
||||
import ComponentIcon from './ComponentIcon.vue';
|
||||
const props = defineProps<{
|
||||
node: IslandComponentNode;
|
||||
selectedId: string;
|
||||
dropId?: string;
|
||||
dropPosition?: string;
|
||||
}>();
|
||||
const emit = defineEmits<{ select: [id: string]; drag: [event: PointerEvent, id: string] }>();
|
||||
const container = computed(() => ['group', 'stack', 'slide', 'rolling'].includes(props.node.kind));
|
||||
</script>
|
||||
<template>
|
||||
<div
|
||||
class="editor-component"
|
||||
:class="{
|
||||
container,
|
||||
selected: selectedId === node.id,
|
||||
'drop-before': dropId === node.id && dropPosition === 'before',
|
||||
'drop-after': dropId === node.id && dropPosition === 'after',
|
||||
'drop-inside': dropId === node.id && dropPosition === 'inside',
|
||||
}"
|
||||
:data-node="node.id"
|
||||
>
|
||||
<button
|
||||
class="component-chip node-handle"
|
||||
:data-kind="node.kind"
|
||||
:aria-label="`编辑${ISLAND_COMPONENT_LABELS[node.kind]}`"
|
||||
@pointerdown="emit('drag', $event, node.id)"
|
||||
@click.stop="emit('select', node.id)"
|
||||
>
|
||||
<ComponentIcon :kind="node.kind" />
|
||||
<span>{{ ISLAND_COMPONENT_LABELS[node.kind] }}</span>
|
||||
</button>
|
||||
<div v-if="container" class="container-children">
|
||||
<IslandEditorNode
|
||||
v-for="child in node.children"
|
||||
:key="child.id"
|
||||
:node="child"
|
||||
:selected-id="selectedId"
|
||||
:drop-id="dropId"
|
||||
:drop-position="dropPosition"
|
||||
@select="emit('select', $event)"
|
||||
@drag="(event, id) => emit('drag', event, id)"
|
||||
/>
|
||||
<span v-if="!node.children.length" class="container-empty">拖入组件</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<style scoped>
|
||||
.editor-component {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-shrink: 0;
|
||||
border-radius: var(--ch-radius-control);
|
||||
}
|
||||
.component-chip {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
min-height: 36px;
|
||||
padding: 5px 9px;
|
||||
border: 1px solid var(--ch-border);
|
||||
border-radius: var(--ch-radius-control);
|
||||
background: var(--ch-surface);
|
||||
color: inherit;
|
||||
font: inherit;
|
||||
white-space: nowrap;
|
||||
cursor: grab;
|
||||
touch-action: none;
|
||||
}
|
||||
.component-chip svg {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.component-chip:hover {
|
||||
background: var(--ch-hover-soft);
|
||||
}
|
||||
.component-chip:focus-visible {
|
||||
outline: 2px solid var(--ch-accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
.selected > .component-chip {
|
||||
background: var(--ch-accent-soft);
|
||||
border-color: var(--ch-accent);
|
||||
}
|
||||
.container {
|
||||
border: 1px dashed var(--ch-border-strong);
|
||||
padding: 3px;
|
||||
gap: 3px;
|
||||
}
|
||||
.container-children {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 3px;
|
||||
min-width: 60px;
|
||||
min-height: 34px;
|
||||
}
|
||||
.container-empty {
|
||||
color: var(--ch-text-tertiary);
|
||||
font-size: 12px;
|
||||
padding: 0 10px;
|
||||
}
|
||||
.drop-inside {
|
||||
background: var(--ch-accent-soft);
|
||||
outline: 2px solid var(--ch-accent);
|
||||
}
|
||||
.drop-before::before,
|
||||
.drop-after::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: 3px auto 3px -4px;
|
||||
width: 3px;
|
||||
border-radius: 3px;
|
||||
background: var(--ch-accent);
|
||||
}
|
||||
.drop-after::after {
|
||||
left: auto;
|
||||
right: -4px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,330 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, type CSSProperties } from 'vue';
|
||||
import {
|
||||
ISLAND_COMPONENT_LABELS,
|
||||
resolveClassStatus,
|
||||
type IslandComponentNode,
|
||||
type IslandState,
|
||||
type IslandTimePointDto,
|
||||
type ScheduleDto,
|
||||
} from '@classhelper/shared';
|
||||
|
||||
const props = defineProps<{
|
||||
node: IslandComponentNode;
|
||||
state: IslandState;
|
||||
now: number;
|
||||
schedules: ScheduleDto[];
|
||||
timePoints: IslandTimePointDto[];
|
||||
editing: boolean;
|
||||
selectedId: string;
|
||||
alertNodeId: string;
|
||||
parentHasWidth?: boolean;
|
||||
}>();
|
||||
const emit = defineEmits<{ select: [id: string]; drag: [event: PointerEvent, id: string] }>();
|
||||
const container = computed(() => ['group', 'stack', 'slide', 'rolling'].includes(props.node.kind));
|
||||
const today = computed(() =>
|
||||
props.schedules
|
||||
.filter((item) => item.dayOfWeek === (new Date(props.now).getDay() || 7))
|
||||
.sort((a, b) => a.startTime.localeCompare(b.startTime)),
|
||||
);
|
||||
const status = computed(() => resolveClassStatus(today.value, new Date(props.now)));
|
||||
const current = computed(() => today.value.find((item) => item.id === status.value.current?.scheduleId));
|
||||
const next = computed(() => today.value.find((item) => item.id === status.value.next?.scheduleId));
|
||||
|
||||
function timeAt(time: string): number {
|
||||
const date = new Date(props.now);
|
||||
const [hour, minute, second = 0] = time.split(':').map(Number);
|
||||
date.setHours(hour!, minute!, second, 0);
|
||||
return date.getTime();
|
||||
}
|
||||
|
||||
const dayPoints = computed<IslandTimePointDto[]>(() => {
|
||||
const points = props.timePoints.length
|
||||
? props.timePoints
|
||||
: today.value.map<IslandTimePointDto>((item) => ({
|
||||
id: item.id,
|
||||
timeType: 'LESSON',
|
||||
name: '',
|
||||
courseName: item.course?.name ?? null,
|
||||
startTime: item.startTime,
|
||||
endTime: item.endTime,
|
||||
isHideDefault: false,
|
||||
}));
|
||||
return [...points].sort((a, b) => a.startTime.localeCompare(b.startTime));
|
||||
});
|
||||
const currentPoint = computed(
|
||||
() =>
|
||||
dayPoints.value.find(
|
||||
(point) =>
|
||||
point.timeType !== 'DIVIDER' &&
|
||||
point.timeType !== 'ACTION' &&
|
||||
props.now >= timeAt(point.startTime) &&
|
||||
props.now < timeAt(point.endTime),
|
||||
) ?? null,
|
||||
);
|
||||
const currentLesson = computed(() => (currentPoint.value?.timeType === 'LESSON' ? currentPoint.value : null));
|
||||
const schedulePoints = computed(() => {
|
||||
if (props.node.settings.display === 'next')
|
||||
return dayPoints.value
|
||||
.filter((point) => point.timeType === 'LESSON' && timeAt(point.startTime) > props.now)
|
||||
.slice(0, 1);
|
||||
if (props.node.settings.display === 'current')
|
||||
return currentPoint.value
|
||||
? [currentPoint.value]
|
||||
: dayPoints.value
|
||||
.filter((point) => point.timeType === 'LESSON' && timeAt(point.startTime) > props.now)
|
||||
.slice(0, 1);
|
||||
return dayPoints.value
|
||||
.filter(
|
||||
(point) =>
|
||||
point.timeType === 'DIVIDER' ||
|
||||
point.id === currentPoint.value?.id ||
|
||||
(point.timeType === 'LESSON' && !point.isHideDefault),
|
||||
)
|
||||
.slice(0, Math.max(1, props.node.settings.count));
|
||||
});
|
||||
const elapsed = computed(() => {
|
||||
const point = currentLesson.value;
|
||||
if (!point) return 0;
|
||||
const start = timeAt(point.startTime);
|
||||
return Math.max(0, Math.min(1, (props.now - start) / Math.max(1, timeAt(point.endTime) - start)));
|
||||
});
|
||||
const hidden = computed(
|
||||
() =>
|
||||
!props.editing &&
|
||||
((['notification', 'homework', 'call'].includes(props.node.kind) &&
|
||||
(!props.state.active || props.state.mode === 'hidden' || props.node.id !== props.alertNodeId)) ||
|
||||
props.node.advanced.hideRules.some(
|
||||
(rule) =>
|
||||
(rule === 'in-class' && props.state.inClass) ||
|
||||
(rule === 'no-message' && !props.state.active) ||
|
||||
(rule === 'no-class' && !currentLesson.value),
|
||||
)),
|
||||
);
|
||||
const visibleChildren = computed(() =>
|
||||
props.node.kind === 'slide' && !props.editing ? props.node.children.slice(0, 1) : props.node.children,
|
||||
);
|
||||
const content = computed(() => {
|
||||
const node = props.node;
|
||||
const date = new Date(props.now);
|
||||
if (node.kind === 'date')
|
||||
return date.toLocaleDateString('zh-CN', { month: 'long', day: 'numeric', weekday: 'long' });
|
||||
if (node.kind === 'clock')
|
||||
return date.toLocaleTimeString('zh-CN', {
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
...(node.settings.seconds ? { second: '2-digit' } : {}),
|
||||
hour12: node.settings.hour12,
|
||||
});
|
||||
if (node.kind === 'text')
|
||||
return node.settings.template
|
||||
? node.settings.text
|
||||
.replaceAll('{date}', date.toLocaleDateString('zh-CN'))
|
||||
.replaceAll('{time}', date.toLocaleTimeString('zh-CN'))
|
||||
.replaceAll('{course}', current.value?.course?.name || '暂无课程')
|
||||
: node.settings.text;
|
||||
if (node.kind === 'countdown') {
|
||||
if (node.settings.target === 'date') {
|
||||
if (!node.settings.targetDate) return '请设置目标日期';
|
||||
const [year, month, day] = node.settings.targetDate.split('-').map(Number);
|
||||
const days = Math.round(
|
||||
(Date.UTC(year!, month! - 1, day!) - Date.UTC(date.getFullYear(), date.getMonth(), date.getDate())) /
|
||||
86400000,
|
||||
);
|
||||
return days >= 0
|
||||
? `距${node.settings.countdownTitle} ${days} 天`
|
||||
: `${node.settings.countdownTitle}已过 ${-days} 天`;
|
||||
}
|
||||
const end = node.settings.target === 'end' || (node.settings.target === 'auto' && !!current.value);
|
||||
const time =
|
||||
node.settings.target === 'school'
|
||||
? today.value.at(-1)?.endTime
|
||||
: end
|
||||
? current.value?.endTime
|
||||
: next.value?.startTime;
|
||||
return time ? `${end ? '距下课' : '距上课'} ${time}` : '今日课程已结束';
|
||||
}
|
||||
if (node.kind === 'weather')
|
||||
return node.settings.locationName ? `${node.settings.locationName} · 天气预览` : '天气简报';
|
||||
return '';
|
||||
});
|
||||
const style = computed<CSSProperties>(() => {
|
||||
const node = props.node;
|
||||
const appearance = node.appearance;
|
||||
const override = appearance.resourceOverridingEnabled;
|
||||
const alpha = appearance.customBackgroundOpacityEnabled ? appearance.backgroundOpacity : 1;
|
||||
return {
|
||||
opacity: appearance.opacity,
|
||||
width: node.advanced.width ? `${node.advanced.width}px` : undefined,
|
||||
maxWidth: node.advanced.maxWidth ? `${node.advanced.maxWidth}px` : undefined,
|
||||
alignSelf:
|
||||
props.parentHasWidth && override
|
||||
? ({ stretch: 'stretch', start: 'flex-start', center: 'center', end: 'flex-end' } as const)[
|
||||
node.advanced.align
|
||||
]
|
||||
: undefined,
|
||||
textAlign: node.advanced.align === 'start' ? 'start' : node.advanced.align === 'end' ? 'end' : 'center',
|
||||
background:
|
||||
override && appearance.customBackgroundEnabled
|
||||
? `color-mix(in srgb, ${appearance.background} ${alpha * 100}%, transparent)`
|
||||
: undefined,
|
||||
color: override && appearance.customForegroundEnabled ? appearance.foreground : 'var(--ci-text-1)',
|
||||
borderRadius:
|
||||
override && appearance.customCornerRadiusEnabled ? `${appearance.cornerRadius}px` : undefined,
|
||||
fontSize: override ? `${appearance.bodyFontSize}px` : undefined,
|
||||
flexDirection: container.value ? (node.settings.direction === 'vertical' ? 'column' : 'row') : undefined,
|
||||
gap: container.value ? `${node.settings.gap}px` : undefined,
|
||||
display: container.value ? 'flex' : undefined,
|
||||
};
|
||||
});
|
||||
|
||||
function select(event: MouseEvent): void {
|
||||
if (!props.editing) return;
|
||||
event.stopPropagation();
|
||||
emit('select', props.node.id);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
v-if="!hidden"
|
||||
class="preview-node"
|
||||
:class="[{ selected: editing && selectedId === node.id, container, 'node-editing': editing }, node.kind]"
|
||||
:style="style"
|
||||
:data-node="node.id"
|
||||
@click="select"
|
||||
>
|
||||
<button
|
||||
v-if="editing"
|
||||
class="node-handle"
|
||||
type="button"
|
||||
:aria-label="`拖动${ISLAND_COMPONENT_LABELS[node.kind]}`"
|
||||
@pointerdown.stop="emit('drag', $event, node.id)"
|
||||
>
|
||||
⠿ {{ ISLAND_COMPONENT_LABELS[node.kind] }}
|
||||
</button>
|
||||
<template v-if="container">
|
||||
<IslandPreviewNode
|
||||
v-for="child in visibleChildren"
|
||||
:key="child.id"
|
||||
:node="child"
|
||||
:state="state"
|
||||
:now="now"
|
||||
:schedules="schedules"
|
||||
:time-points="timePoints"
|
||||
:editing="editing"
|
||||
:selected-id="selectedId"
|
||||
:alert-node-id="alertNodeId"
|
||||
:parent-has-width="Boolean(node.advanced.width || node.advanced.maxWidth)"
|
||||
@select="emit('select', $event)"
|
||||
@drag="(event, id) => emit('drag', event, id)"
|
||||
/>
|
||||
</template>
|
||||
<span v-else-if="node.kind === 'separator'" class="preview-separator" aria-hidden="true" />
|
||||
<template v-else-if="node.kind === 'schedule'">
|
||||
<span v-for="point in schedulePoints" :key="point.id" class="preview-lesson">
|
||||
<strong>{{ point.courseName || point.name || '—' }}</strong>
|
||||
<small v-if="point.id === currentPoint?.id && node.settings.showPeriod">
|
||||
{{ point.startTime }}–{{ point.endTime }}
|
||||
</small>
|
||||
<i
|
||||
v-if="point.id === currentPoint?.id && point.timeType === 'LESSON' && node.settings.showProgress"
|
||||
class="preview-progress"
|
||||
:style="{ transform: `scaleX(${elapsed})` }"
|
||||
/>
|
||||
</span>
|
||||
<span v-if="!schedulePoints.length">暂无课程</span>
|
||||
</template>
|
||||
<span v-else-if="['notification', 'homework', 'call'].includes(node.kind)">
|
||||
{{ ISLAND_COMPONENT_LABELS[node.kind] }}
|
||||
</span>
|
||||
<span v-else>{{ content }}</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.preview-node {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
min-width: 0;
|
||||
min-height: var(--ci-island-height);
|
||||
padding: 6px;
|
||||
color: var(--ci-text-1);
|
||||
line-height: var(--ci-line-height-body);
|
||||
}
|
||||
.preview-node.clock,
|
||||
.preview-node.date,
|
||||
.preview-node.countdown {
|
||||
font-variant-numeric: tabular-nums;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.preview-node.schedule {
|
||||
flex-direction: row;
|
||||
gap: var(--ci-component-gap);
|
||||
}
|
||||
.preview-lesson {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
padding-bottom: 3px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.preview-lesson small {
|
||||
color: var(--ci-text-3);
|
||||
font-size: var(--ci-fs-secondary);
|
||||
}
|
||||
.preview-progress {
|
||||
position: absolute;
|
||||
inset: auto 0 0;
|
||||
height: var(--ci-progress-height);
|
||||
border-radius: 1.5px;
|
||||
background: var(--ci-accent);
|
||||
transform-origin: left;
|
||||
}
|
||||
.preview-separator {
|
||||
width: 1px;
|
||||
height: 20px;
|
||||
background: currentColor;
|
||||
opacity: 0.25;
|
||||
}
|
||||
.container {
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
.container.stack {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.selected {
|
||||
border-radius: var(--ci-radius-island);
|
||||
background: var(--ci-accent-fill-tertiary);
|
||||
outline: 2px solid var(--ci-stroke-drag);
|
||||
}
|
||||
.node-editing {
|
||||
cursor: pointer;
|
||||
}
|
||||
.node-handle {
|
||||
margin-right: 5px;
|
||||
padding: 3px 6px;
|
||||
border: 0;
|
||||
border-radius: var(--ci-radius-control);
|
||||
background: var(--ci-fill-secondary);
|
||||
color: var(--ci-text-3);
|
||||
font: inherit;
|
||||
font-size: var(--ci-fs-caption);
|
||||
white-space: nowrap;
|
||||
cursor: grab;
|
||||
touch-action: none;
|
||||
}
|
||||
.node-handle:hover {
|
||||
background: var(--ci-accent-soft);
|
||||
color: var(--ci-text-1);
|
||||
}
|
||||
.notification,
|
||||
.homework,
|
||||
.call {
|
||||
min-width: 64px;
|
||||
}
|
||||
</style>
|
||||
@@ -16,7 +16,15 @@ export const MANAGEMENT_GROUPS = [
|
||||
id: 'school',
|
||||
title: '班级与人员',
|
||||
icon: 'School',
|
||||
paths: ['/classes', '/students', '/teachers', '/term-weeks', '/promotion', '/archives'],
|
||||
paths: [
|
||||
'/classes',
|
||||
'/students',
|
||||
'/teachers',
|
||||
'/island-layouts',
|
||||
'/term-weeks',
|
||||
'/promotion',
|
||||
'/archives',
|
||||
],
|
||||
},
|
||||
{ id: 'devices', title: '设备运维', icon: 'Monitor', paths: ['/clients'] },
|
||||
{
|
||||
|
||||
@@ -70,6 +70,17 @@ const routes: RouteRecordRaw[] = [
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'island-layouts',
|
||||
name: 'island-layouts',
|
||||
component: () => import('@/views/IslandLayoutsView.vue'),
|
||||
meta: {
|
||||
title: '班级灵动岛',
|
||||
icon: 'MagicStick',
|
||||
permission: 'class:read',
|
||||
menuActions: ['class:settings'],
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'students',
|
||||
name: 'students',
|
||||
|
||||
@@ -0,0 +1,529 @@
|
||||
/* Web 管理端班级灵动岛编辑器。 */
|
||||
.island-editor-page {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1 0 auto;
|
||||
min-height: 0;
|
||||
min-width: 0;
|
||||
color: var(--ch-text);
|
||||
padding: 12px 24px 16px;
|
||||
background: var(--ch-bg);
|
||||
}
|
||||
:global(.main:has(> .island-editor-page)) {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
:global(.main:has(> .island-editor-page) > .offline-banner),
|
||||
.island-editor-page > * {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.editor-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: 8px;
|
||||
min-height: 30px;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
.class-toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 24px;
|
||||
padding: 14px 16px;
|
||||
border: 1px solid var(--ch-border);
|
||||
border-radius: var(--ch-radius-control);
|
||||
background: var(--ch-surface);
|
||||
}
|
||||
.class-toolbar strong {
|
||||
display: block;
|
||||
font-size: 14px;
|
||||
}
|
||||
.class-toolbar p {
|
||||
margin: 5px 0 0;
|
||||
color: var(--ch-text-secondary);
|
||||
font-size: 12px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
.class-select {
|
||||
width: min(320px, 42vw);
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
.readonly-alert {
|
||||
margin: 12px 0;
|
||||
}
|
||||
.save-status {
|
||||
color: var(--ch-text-tertiary);
|
||||
font-size: 12px;
|
||||
margin-right: 8px;
|
||||
}
|
||||
.save-status.failed {
|
||||
color: var(--el-color-danger);
|
||||
}
|
||||
.component-heading {
|
||||
align-items: flex-end;
|
||||
gap: 24px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.heading-copy {
|
||||
flex: 1 1 380px;
|
||||
}
|
||||
.component-heading .page-title {
|
||||
font-size: calc(34px * var(--ch-font-scale));
|
||||
font-weight: 600;
|
||||
line-height: 1.4;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.heading-copy p {
|
||||
font-size: calc(16px * var(--ch-font-scale));
|
||||
margin: 0;
|
||||
line-height: 1.6;
|
||||
}
|
||||
.scheme-tools {
|
||||
flex: 0 1 348px;
|
||||
min-width: 300px;
|
||||
}
|
||||
.scheme-tools label {
|
||||
display: block;
|
||||
margin-bottom: 6px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
}
|
||||
.scheme-controls {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
align-items: center;
|
||||
}
|
||||
.scheme-controls .el-select {
|
||||
min-width: 140px;
|
||||
flex: 1;
|
||||
}
|
||||
.scheme-controls :deep(.el-select__wrapper) {
|
||||
min-height: 38px;
|
||||
background: var(--ch-surface);
|
||||
border-radius: var(--ch-radius-control);
|
||||
}
|
||||
.icon-button {
|
||||
width: 34px;
|
||||
height: 36px;
|
||||
padding: 8px;
|
||||
margin: 0;
|
||||
flex-shrink: 0;
|
||||
font-size: 19px;
|
||||
}
|
||||
.surface-toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.surface-tabs,
|
||||
.surface-actions {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
align-items: center;
|
||||
}
|
||||
.surface-actions {
|
||||
gap: 0;
|
||||
}
|
||||
.surface-tabs button {
|
||||
position: relative;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: var(--ch-text-secondary);
|
||||
font: inherit;
|
||||
font-size: 12px;
|
||||
padding: 6px 0 9px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.surface-tabs button.active {
|
||||
color: var(--ch-text);
|
||||
}
|
||||
.surface-tabs button.active::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 10%;
|
||||
right: 10%;
|
||||
height: 2px;
|
||||
background: var(--ch-accent);
|
||||
border-radius: 2px;
|
||||
}
|
||||
.preview-canvas {
|
||||
min-height: 80px;
|
||||
overflow: auto;
|
||||
padding: 10px 0 20px;
|
||||
}
|
||||
.component-lines {
|
||||
min-width: 100%;
|
||||
width: max-content;
|
||||
}
|
||||
.component-line {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-height: 54px;
|
||||
border-radius: var(--ch-radius-control);
|
||||
gap: 12px;
|
||||
padding: 4px;
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
.component-line + .component-line {
|
||||
margin-top: 6px;
|
||||
}
|
||||
.component-line.active-row {
|
||||
border-color: var(--ch-border-strong);
|
||||
}
|
||||
.row-handle {
|
||||
align-self: stretch;
|
||||
width: 24px;
|
||||
flex-shrink: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: var(--ch-text-secondary);
|
||||
font: inherit;
|
||||
font-size: 20px;
|
||||
cursor: grab;
|
||||
touch-action: none;
|
||||
}
|
||||
.row-handle:hover {
|
||||
color: var(--ch-accent);
|
||||
background: var(--ch-hover-soft);
|
||||
}
|
||||
.line-components {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
padding: 0 28px 0 0;
|
||||
min-height: 38px;
|
||||
}
|
||||
.empty-line {
|
||||
border: 1px dashed var(--ch-border-strong);
|
||||
background: transparent;
|
||||
color: var(--ch-text-tertiary);
|
||||
padding: 10px 24px;
|
||||
border-radius: var(--ch-radius-control);
|
||||
font: inherit;
|
||||
font-size: 12px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.preview-canvas.live-preview {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
min-height: 220px;
|
||||
padding: 24px;
|
||||
background: var(--ch-layer-alt);
|
||||
border-radius: 6px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
.preview-stage {
|
||||
position: relative;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
min-width: 540px;
|
||||
min-height: 150px;
|
||||
padding: 30px 80px;
|
||||
border: 1px solid color-mix(in srgb, var(--ch-border) 70%, transparent);
|
||||
border-radius: 8px;
|
||||
background:
|
||||
radial-gradient(
|
||||
circle at 30% 20%,
|
||||
color-mix(in srgb, var(--ch-accent) 12%, transparent),
|
||||
transparent 38%
|
||||
),
|
||||
linear-gradient(145deg, var(--ch-layer-alt), var(--ch-surface));
|
||||
}
|
||||
.preview-stage-label {
|
||||
position: absolute;
|
||||
align-self: start;
|
||||
justify-self: start;
|
||||
margin: -16px 0 0 -60px;
|
||||
color: var(--ch-text-tertiary);
|
||||
font-size: 12px;
|
||||
}
|
||||
.island-preview {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: calc(var(--ci-component-gap) / 2);
|
||||
width: max-content;
|
||||
min-width: 80px;
|
||||
color: var(--ci-text-1);
|
||||
padding: var(--ci-island-pad-x);
|
||||
border-radius: var(--preview-radius);
|
||||
background: var(--preview-background);
|
||||
font-family: var(--ci-font-island);
|
||||
font-weight: var(--ci-font-weight);
|
||||
transition:
|
||||
background-color var(--ci-duration) linear,
|
||||
border-radius var(--ci-duration) var(--ci-ease-out);
|
||||
}
|
||||
.preview-rows {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: var(--preview-gap);
|
||||
}
|
||||
.preview-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: max-content;
|
||||
height: var(--ci-island-height);
|
||||
min-width: 120px;
|
||||
border-radius: var(--preview-radius);
|
||||
overflow: hidden;
|
||||
}
|
||||
.preview-bell {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
flex: 0 0 28px;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
color: var(--ci-text-3);
|
||||
}
|
||||
.preview-bell svg {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
}
|
||||
.island-preview.separated {
|
||||
background: transparent;
|
||||
padding: 0;
|
||||
}
|
||||
.separated .preview-row {
|
||||
padding: var(--ci-island-pad-x);
|
||||
background: var(--preview-background);
|
||||
}
|
||||
.separated .preview-bell {
|
||||
width: 48px;
|
||||
border-radius: var(--preview-radius);
|
||||
background: var(--preview-background);
|
||||
}
|
||||
.empty-preview {
|
||||
color: var(--ci-text-2);
|
||||
background: transparent;
|
||||
border: var(--ci-stroke-island-w) dashed var(--ci-stroke-control);
|
||||
border-radius: var(--ci-radius-control);
|
||||
padding: 10px 20px;
|
||||
cursor: pointer;
|
||||
font: inherit;
|
||||
font-size: 13px;
|
||||
}
|
||||
.drop-row {
|
||||
outline: 2px dashed var(--ch-accent);
|
||||
outline-offset: -2px;
|
||||
background: var(--ch-accent-soft);
|
||||
}
|
||||
.preview-toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
padding: 6px 0 12px;
|
||||
color: var(--ch-text-secondary);
|
||||
font-size: 12px;
|
||||
}
|
||||
.preview-toolbar .el-slider {
|
||||
width: 130px;
|
||||
}
|
||||
.hint {
|
||||
color: var(--ch-text-secondary);
|
||||
line-height: 1.6;
|
||||
font-size: 12px;
|
||||
}
|
||||
.font-preview {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: calc(var(--ci-line-gap) * 2);
|
||||
margin: 0 0 18px;
|
||||
padding: var(--ci-popup-pad);
|
||||
border: var(--ci-stroke-island-w) solid var(--ci-stroke-island);
|
||||
border-radius: var(--ci-radius-card);
|
||||
background: var(--ci-island-bg-custom);
|
||||
line-height: var(--ci-line-height-body);
|
||||
overflow: auto;
|
||||
}
|
||||
.component-library {
|
||||
border-top: 1px solid var(--ch-border);
|
||||
margin: 0 -24px;
|
||||
padding: 14px 24px 24px;
|
||||
flex: 1 0 auto;
|
||||
}
|
||||
.library-title {
|
||||
position: relative;
|
||||
width: max-content;
|
||||
font-size: 17px;
|
||||
font-weight: 600;
|
||||
margin: 0 0 12px;
|
||||
padding: 0 0 7px;
|
||||
}
|
||||
.library-title::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 3px;
|
||||
border-radius: 3px;
|
||||
background: var(--ch-accent);
|
||||
}
|
||||
.component-options {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: 12px 20px;
|
||||
}
|
||||
.library-item {
|
||||
min-width: 0;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
align-items: center;
|
||||
text-align: left;
|
||||
min-height: 76px;
|
||||
padding: 10px 8px;
|
||||
border: 1px solid var(--ch-border);
|
||||
border-radius: var(--ch-radius-control);
|
||||
background: var(--ch-surface);
|
||||
color: inherit;
|
||||
font: inherit;
|
||||
cursor: grab;
|
||||
touch-action: none;
|
||||
transition:
|
||||
background var(--ch-dur-fast) var(--ch-ease-out),
|
||||
border-color var(--ch-dur-fast) var(--ch-ease-out);
|
||||
}
|
||||
.library-item:hover {
|
||||
background: var(--ch-hover-soft);
|
||||
border-color: var(--ch-border);
|
||||
}
|
||||
.library-item:active {
|
||||
background: var(--ch-accent-soft);
|
||||
}
|
||||
.library-item:focus-visible,
|
||||
.row-handle:focus-visible,
|
||||
.surface-tabs button:focus-visible {
|
||||
outline: 2px solid var(--ch-accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
.library-item > svg {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
flex: 0 0 36px;
|
||||
}
|
||||
.library-item > span {
|
||||
min-width: 0;
|
||||
}
|
||||
.library-item strong {
|
||||
display: block;
|
||||
font-size: calc(18px * var(--ch-font-scale));
|
||||
font-weight: 500;
|
||||
line-height: 1.5;
|
||||
}
|
||||
.component-description {
|
||||
display: block;
|
||||
color: var(--ch-text-secondary);
|
||||
font-size: calc(14px * var(--ch-font-scale));
|
||||
line-height: 1.5;
|
||||
}
|
||||
.drag-ghost {
|
||||
position: fixed;
|
||||
z-index: 10000;
|
||||
pointer-events: none;
|
||||
padding: 10px 16px;
|
||||
background: var(--ch-layer-solid);
|
||||
border: 1px solid var(--ch-accent);
|
||||
border-radius: 6px;
|
||||
box-shadow: var(--ch-shadow-flyout);
|
||||
color: var(--ch-text);
|
||||
font-size: 14px;
|
||||
}
|
||||
.inspector-tabs {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
:global(.island-inspector) {
|
||||
color: var(--ch-text);
|
||||
background: var(--ch-surface);
|
||||
}
|
||||
:global(.island-inspector .el-drawer__header) {
|
||||
color: var(--ch-text);
|
||||
}
|
||||
:global(.island-inspector .el-input-number),
|
||||
:global(.island-inspector .el-select) {
|
||||
width: 100%;
|
||||
}
|
||||
:global(.island-inspector .el-input__wrapper),
|
||||
:global(.island-inspector .el-select__wrapper) {
|
||||
background: var(--ch-surface);
|
||||
border-radius: var(--ch-radius-control);
|
||||
}
|
||||
.row-actions {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
flex-wrap: wrap;
|
||||
margin-top: 20px;
|
||||
}
|
||||
.row-actions .el-button {
|
||||
margin: 0;
|
||||
}
|
||||
@media (max-width: 1150px) {
|
||||
.component-options {
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 8px;
|
||||
}
|
||||
.component-heading {
|
||||
gap: 16px;
|
||||
}
|
||||
.heading-copy {
|
||||
flex-basis: 300px;
|
||||
}
|
||||
.scheme-tools {
|
||||
flex-basis: 300px;
|
||||
}
|
||||
}
|
||||
@media (max-width: 800px) {
|
||||
.component-options {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
.component-heading .page-title {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.scheme-tools {
|
||||
flex: 1 1 100%;
|
||||
}
|
||||
.class-toolbar {
|
||||
align-items: stretch;
|
||||
flex-direction: column;
|
||||
}
|
||||
.class-select {
|
||||
width: 100%;
|
||||
}
|
||||
.preview-stage {
|
||||
min-width: 420px;
|
||||
padding-right: 36px;
|
||||
padding-left: 36px;
|
||||
}
|
||||
.preview-toolbar .hint {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
@media (max-width: 520px) {
|
||||
.component-options {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.island-editor-page {
|
||||
padding-right: 16px;
|
||||
padding-left: 16px;
|
||||
}
|
||||
.component-library {
|
||||
margin-right: -16px;
|
||||
margin-left: -16px;
|
||||
padding-right: 16px;
|
||||
padding-left: 16px;
|
||||
}
|
||||
.save-status {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user