Go + PostgreSQL + Valkey backend (cmd/internal/migrations), uni-app mobile frontend, PC web (web/), admin console (admin/), Android WebView container (android_project/). Build artifacts, node_modules, local env and debug screenshots excluded.
1157 lines
30 KiB
JavaScript
1157 lines
30 KiB
JavaScript
import fs from 'fs';
|
||
|
||
const filePath = 'C:/Users/12914/Desktop/sky/frontend/src/pages/editor/editor.vue';
|
||
let content = fs.readFileSync(filePath, 'utf8');
|
||
|
||
// 1. 模板片段
|
||
const previewTemplate = `
|
||
<!-- ═══════════ 美篇式全真沉浸预览 & 底部模板/音乐/排版装配 ═══════════ -->
|
||
<view v-if="showMeipianPreview" class="mp-preview-overlay">
|
||
<!-- 预览顶部导航 -->
|
||
<view class="mp-preview-nav">
|
||
<view class="mp-nav-back" @tap="closeMeipianPreview">
|
||
<text class="mp-back-arrow">‹</text>
|
||
<text class="mp-back-text">返回编辑</text>
|
||
</view>
|
||
<text class="mp-nav-title">美篇效果预览</text>
|
||
<view class="mp-nav-actions">
|
||
<view class="mp-btn-draft" @tap="saveDraftInPreview">
|
||
<text class="mp-draft-text">存草稿</text>
|
||
</view>
|
||
<view class="mp-btn-publish" @tap="publishInPreview">
|
||
<text class="mp-publish-text">发布</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 预览画布滚动区 -->
|
||
<scroll-view
|
||
scroll-y
|
||
class="mp-preview-scroll"
|
||
:style="{
|
||
backgroundColor: selectedBackdrop.bg_color,
|
||
backgroundImage: selectedBackdrop.bg_pattern || 'none',
|
||
}"
|
||
>
|
||
<!-- 顶部装饰 Banner 图 -->
|
||
<view v-if="selectedBackdrop.header_decor" class="mp-header-decor">
|
||
<image class="mp-decor-img" :src="selectedBackdrop.header_decor" mode="widthFix" />
|
||
</view>
|
||
|
||
<!-- 悬浮黑胶唱片 BGM 播放器 -->
|
||
<view
|
||
v-if="selectedMusic || doc.article.music_id"
|
||
class="mp-floating-music-capsule"
|
||
:class="{ 'is-spinning': previewMusicPlaying }"
|
||
@tap="togglePreviewBgMusic"
|
||
>
|
||
<view class="mp-vinyl-disc" :class="{ spin: previewMusicPlaying }">
|
||
<text class="mp-vinyl-icon">🎵</text>
|
||
</view>
|
||
<view class="mp-music-track">
|
||
<text class="mp-music-label">{{ previewMusicPlaying ? '播放中' : '背景音乐' }}</text>
|
||
<text class="mp-music-title">{{ selectedMusic ? selectedMusic.name : '美篇背景音乐' }}</text>
|
||
</view>
|
||
<text class="mp-music-state-icon">{{ previewMusicPlaying ? '❚❚' : '▶' }}</text>
|
||
</view>
|
||
|
||
<!-- 正文大卡片容器 -->
|
||
<view
|
||
class="mp-preview-card"
|
||
:style="{
|
||
backgroundColor: selectedBackdrop.card_bg,
|
||
borderColor: selectedBackdrop.border_color,
|
||
fontFamily: articleFontFamily || 'inherit',
|
||
}"
|
||
>
|
||
<!-- 封面大图 -->
|
||
<view v-if="doc.article.cover_url" class="mp-preview-cover-wrap">
|
||
<image
|
||
class="mp-preview-cover"
|
||
:src="resolveCoverUrl(doc.article.cover_url)"
|
||
mode="aspectFill"
|
||
:style="{ objectPosition: coverFocus }"
|
||
/>
|
||
</view>
|
||
|
||
<!-- 大标题 -->
|
||
<view
|
||
class="mp-preview-title-wrap"
|
||
:class="[
|
||
titleStyleConfig.align === 'center' ? 'title-center' : 'title-left',
|
||
titleStyleConfig.is_bold ? 'title-bold' : ''
|
||
]"
|
||
>
|
||
<text class="mp-preview-title" :style="{ fontSize: titleStyleFontSize }">
|
||
{{ doc.article.title || '无标题' }}
|
||
</text>
|
||
</view>
|
||
|
||
<!-- 作者信息行 -->
|
||
<view class="mp-preview-author-row">
|
||
<view class="mp-author-avatar-box">
|
||
<text class="mp-author-avatar-text">美</text>
|
||
</view>
|
||
<view class="mp-author-info">
|
||
<text class="mp-author-name">创作者</text>
|
||
<text class="mp-article-time">{{ previewDateText }}</text>
|
||
</view>
|
||
<view class="mp-author-badge">美篇排版</view>
|
||
</view>
|
||
|
||
<!-- 正文段落渲染 -->
|
||
<view class="mp-preview-sections" :style="previewSectionStyle">
|
||
<view v-if="!doc.sections || doc.sections.length === 0" class="mp-preview-empty">
|
||
<text class="mp-empty-hint">暂无段落内容,返回编辑后添加图片或文字</text>
|
||
</view>
|
||
<SectionRenderer
|
||
v-else
|
||
v-for="sec in doc.sections"
|
||
:key="sec.id"
|
||
:section="sec"
|
||
/>
|
||
</view>
|
||
|
||
<!-- 底部落款与美篇印章 -->
|
||
<view class="mp-preview-seal-wrap">
|
||
<view class="mp-seal-line"></view>
|
||
<view class="mp-seal-badge">
|
||
<text class="mp-seal-text">❖ 美篇精选 · 匠心排版 ❖</text>
|
||
</view>
|
||
<view class="mp-seal-line"></view>
|
||
</view>
|
||
</view>
|
||
<view class="mp-preview-safe-space"></view>
|
||
</scroll-view>
|
||
|
||
<!-- 底部美篇三联装配浮动托盘 -->
|
||
<view class="mp-bottom-dock">
|
||
<!-- 抽屉内容:模板 -->
|
||
<view v-if="activePreviewDrawer === 'template'" class="mp-drawer-content">
|
||
<view class="mp-drawer-header">
|
||
<text class="mp-drawer-title">🎨 美篇主题模板(点击即时换肤)</text>
|
||
<text class="mp-drawer-close" @tap="activePreviewDrawer = ''">✕</text>
|
||
</view>
|
||
<scroll-view scroll-x class="mp-template-scroll" :show-scrollbar="false">
|
||
<view class="mp-template-cards">
|
||
<view
|
||
v-for="item in backdropList"
|
||
:key="item.id"
|
||
class="mp-template-card"
|
||
:class="{ selected: (doc.article.bg_style || 'default') === item.id }"
|
||
@tap="applyTemplateInPreview(item)"
|
||
>
|
||
<view class="mp-tpl-swatch" :style="{ backgroundColor: item.bg_color, backgroundImage: item.bg_pattern || 'none' }">
|
||
<text v-if="(doc.article.bg_style || 'default') === item.id" class="mp-tpl-check">✓</text>
|
||
</view>
|
||
<text class="mp-tpl-name">{{ item.name }}</text>
|
||
</view>
|
||
</view>
|
||
</scroll-view>
|
||
</view>
|
||
|
||
<!-- 抽屉内容:音乐 -->
|
||
<view v-if="activePreviewDrawer === 'music'" class="mp-drawer-content">
|
||
<view class="mp-drawer-header">
|
||
<text class="mp-drawer-title">🎵 背景音乐库(试听与一键配置)</text>
|
||
<text class="mp-drawer-close" @tap="activePreviewDrawer = ''">✕</text>
|
||
</view>
|
||
<scroll-view scroll-y class="mp-music-scroll">
|
||
<!-- 不使用音乐 -->
|
||
<view
|
||
class="mp-music-item"
|
||
:class="{ selected: !doc.article.music_id }"
|
||
@tap="clearMusicInPreview"
|
||
>
|
||
<view class="mp-music-left">
|
||
<text class="mp-music-type-icon">✕</text>
|
||
<text class="mp-music-title">不使用背景音乐</text>
|
||
</view>
|
||
<text v-if="!doc.article.music_id" class="mp-item-selected-tag">当前应用</text>
|
||
</view>
|
||
<!-- 音乐列表 -->
|
||
<view
|
||
v-for="m in musicList"
|
||
:key="m.id"
|
||
class="mp-music-item"
|
||
:class="{ selected: doc.article.music_id === m.id }"
|
||
@tap="selectMusicInPreview(m)"
|
||
>
|
||
<view class="mp-music-left">
|
||
<view class="mp-music-play-btn" @tap.stop="togglePreviewMusic(m)">
|
||
<text>{{ playingMusicId === m.id ? '⏸' : '▶' }}</text>
|
||
</view>
|
||
<view class="mp-music-texts">
|
||
<text class="mp-music-name">{{ m.name }}</text>
|
||
<text class="mp-music-artist">{{ m.artist }} · {{ m.category || '精选' }}</text>
|
||
</view>
|
||
</view>
|
||
<view class="mp-music-right">
|
||
<text v-if="doc.article.music_id === m.id" class="mp-item-selected-tag">当前应用</text>
|
||
<text v-else class="mp-item-pick-btn">使用</text>
|
||
</view>
|
||
</view>
|
||
</scroll-view>
|
||
</view>
|
||
|
||
<!-- 抽屉内容:排版 -->
|
||
<view v-if="activePreviewDrawer === 'layout'" class="mp-drawer-content">
|
||
<view class="mp-drawer-header">
|
||
<text class="mp-drawer-title">🔤 字体与排版设置</text>
|
||
<text class="mp-drawer-close" @tap="activePreviewDrawer = ''">✕</text>
|
||
</view>
|
||
<view class="mp-layout-controls">
|
||
<!-- 正文字号 -->
|
||
<view class="mp-control-group">
|
||
<text class="mp-group-label">正文字号</text>
|
||
<view class="mp-pill-selector">
|
||
<view class="mp-pill-opt" :class="{ active: previewFontSize === 'sm' }" @tap="previewFontSize = 'sm'">标准 (15px)</view>
|
||
<view class="mp-pill-opt" :class="{ active: previewFontSize === 'md' }" @tap="previewFontSize = 'md'">舒适 (17px)</view>
|
||
<view class="mp-pill-opt" :class="{ active: previewFontSize === 'lg' }" @tap="previewFontSize = 'lg'">大号 (19px)</view>
|
||
</view>
|
||
</view>
|
||
<!-- 行间距 -->
|
||
<view class="mp-control-group">
|
||
<text class="mp-group-label">段落行距</text>
|
||
<view class="mp-pill-selector">
|
||
<view class="mp-pill-opt" :class="{ active: previewLineHeight === 'normal' }" @tap="previewLineHeight = 'normal'">正常 (1.8倍)</view>
|
||
<view class="mp-pill-opt" :class="{ active: previewLineHeight === 'loose' }" @tap="previewLineHeight = 'loose'">宽松 (2.2倍)</view>
|
||
</view>
|
||
</view>
|
||
<!-- 对齐方式 -->
|
||
<view class="mp-control-group">
|
||
<text class="mp-group-label">对齐方式</text>
|
||
<view class="mp-pill-selector">
|
||
<view class="mp-pill-opt" :class="{ active: previewTextAlign === 'left' }" @tap="previewTextAlign = 'left'">左对齐</view>
|
||
<view class="mp-pill-opt" :class="{ active: previewTextAlign === 'justify' }" @tap="previewTextAlign = 'justify'">两端对齐</view>
|
||
<view class="mp-pill-opt" :class="{ active: previewTextAlign === 'center' }" @tap="previewTextAlign = 'center'">居中对齐</view>
|
||
</view>
|
||
</view>
|
||
<!-- 字体选择 -->
|
||
<view class="mp-control-group">
|
||
<text class="mp-group-label">正文字体</text>
|
||
<scroll-view scroll-x class="mp-font-pill-scroll" :show-scrollbar="false">
|
||
<view class="mp-font-pills">
|
||
<view
|
||
v-for="f in fontList"
|
||
:key="f.id"
|
||
class="mp-font-pill"
|
||
:class="{ active: (doc.article.font_id || 'system') === f.id }"
|
||
@tap="selectFontInPreview(f)"
|
||
>
|
||
{{ f.name }}
|
||
</view>
|
||
</view>
|
||
</scroll-view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 底部三联 Tabbar 按钮栏 -->
|
||
<view class="mp-dock-tabs">
|
||
<view
|
||
class="mp-dock-tab"
|
||
:class="{ active: activePreviewDrawer === 'template' }"
|
||
@tap="togglePreviewDrawer('template')"
|
||
>
|
||
<text class="mp-tab-icon">🎨</text>
|
||
<text class="mp-tab-label">模板</text>
|
||
<view v-if="selectedBackdrop.id !== 'default'" class="mp-tab-dot"></view>
|
||
</view>
|
||
<view
|
||
class="mp-dock-tab"
|
||
:class="{ active: activePreviewDrawer === 'music' }"
|
||
@tap="togglePreviewDrawer('music')"
|
||
>
|
||
<text class="mp-tab-icon">🎵</text>
|
||
<text class="mp-tab-label">音乐</text>
|
||
<view v-if="doc.article.music_id" class="mp-tab-dot"></view>
|
||
</view>
|
||
<view
|
||
class="mp-dock-tab"
|
||
:class="{ active: activePreviewDrawer === 'layout' }"
|
||
@tap="togglePreviewDrawer('layout')"
|
||
>
|
||
<text class="mp-tab-icon">🔤</text>
|
||
<text class="mp-tab-label">排版</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 标题样式设置弹窗 -->
|
||
<view v-if="showTitleStyleModal" class="modal-mask" @tap="closeTitleStyleModal">
|
||
<view class="modal-card title-style-modal" @tap.stop>
|
||
<view class="modal-header">
|
||
<text class="modal-title">标题样式设置</text>
|
||
<view class="modal-close" @tap="closeTitleStyleModal">
|
||
<text class="close-icon">✕</text>
|
||
</view>
|
||
</view>
|
||
<view class="modal-body">
|
||
<view class="form-item">
|
||
<text class="form-label">标题字号</text>
|
||
<view class="mp-pill-selector">
|
||
<view class="mp-pill-opt" :class="{ active: titleStyleConfig.size === 'sm' }" @tap="titleStyleConfig.size = 'sm'">标准 (22px)</view>
|
||
<view class="mp-pill-opt" :class="{ active: titleStyleConfig.size === 'md' }" @tap="titleStyleConfig.size = 'md'">大号 (26px)</view>
|
||
<view class="mp-pill-opt" :class="{ active: titleStyleConfig.size === 'lg' }" @tap="titleStyleConfig.size = 'lg'">超大 (32px)</view>
|
||
</view>
|
||
</view>
|
||
<view class="form-item">
|
||
<text class="form-label">对齐方式</text>
|
||
<view class="mp-pill-selector">
|
||
<view class="mp-pill-opt" :class="{ active: titleStyleConfig.align === 'left' }" @tap="titleStyleConfig.align = 'left'">居左</view>
|
||
<view class="mp-pill-opt" :class="{ active: titleStyleConfig.align === 'center' }" @tap="titleStyleConfig.align = 'center'">居中</view>
|
||
</view>
|
||
</view>
|
||
<view class="form-item">
|
||
<text class="form-label">字体加粗</text>
|
||
<view class="mp-pill-selector">
|
||
<view class="mp-pill-opt" :class="{ active: !titleStyleConfig.is_bold }" @tap="titleStyleConfig.is_bold = false">常规</view>
|
||
<view class="mp-pill-opt" :class="{ active: titleStyleConfig.is_bold }" @tap="titleStyleConfig.is_bold = true">加粗</view>
|
||
</view>
|
||
</view>
|
||
<button class="modal-submit-btn" type="primary" @tap="closeTitleStyleModal">完成设置</button>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
`;
|
||
|
||
// 插入模板
|
||
const tplEndPos = content.indexOf('</template>');
|
||
if (tplEndPos !== -1) {
|
||
const lastViewPos = content.lastIndexOf('</view>', tplEndPos);
|
||
if (lastViewPos !== -1) {
|
||
content = content.substring(0, lastViewPos) + previewTemplate + '\n </view>\r\n </view>\r\n</template>' + content.substring(tplEndPos + '</template>'.length);
|
||
} else {
|
||
console.error('Could not find last view before template end');
|
||
process.exit(1);
|
||
}
|
||
} else {
|
||
console.error('Could not find template end anchor');
|
||
process.exit(1);
|
||
}
|
||
|
||
// 2. 注入 Script
|
||
const scriptLogic = `
|
||
// ════════════════════════════════════════════════════════════════════════════════
|
||
// 美篇式沉浸全真预览与装配状态机
|
||
// ════════════════════════════════════════════════════════════════════════════════
|
||
const showMeipianPreview = ref(false);
|
||
const activePreviewDrawer = ref(''); // 'template' | 'music' | 'layout' | ''
|
||
const previewMusicPlaying = ref(false);
|
||
const previewFontSize = ref('md');
|
||
const previewLineHeight = ref('normal');
|
||
const previewTextAlign = ref('left');
|
||
let previewAudioCtx = null;
|
||
|
||
const previewDateText = computed(() => {
|
||
const d = new Date();
|
||
return \`\${d.getFullYear()}-\${String(d.getMonth() + 1).padStart(2, '0')}-\${String(d.getDate()).padStart(2, '0')} \${String(d.getHours()).padStart(2, '0')}:\${String(d.getMinutes()).padStart(2, '0')}\`;
|
||
});
|
||
|
||
const previewSectionStyle = computed(() => {
|
||
const fsMap = { sm: '30rpx', md: '34rpx', lg: '38rpx' };
|
||
const lhMap = { normal: '1.8', loose: '2.2' };
|
||
return {
|
||
fontSize: fsMap[previewFontSize.value] || '34rpx',
|
||
lineHeight: lhMap[previewLineHeight.value] || '1.8',
|
||
textAlign: previewTextAlign.value,
|
||
};
|
||
});
|
||
|
||
// 标题样式状态
|
||
const showTitleStyleModal = ref(false);
|
||
const titleStyleConfig = reactive({
|
||
size: 'lg',
|
||
align: 'left',
|
||
is_bold: true,
|
||
});
|
||
|
||
const titleStyleFontSize = computed(() => {
|
||
if (titleStyleConfig.size === 'sm') return '44rpx';
|
||
if (titleStyleConfig.size === 'md') return '52rpx';
|
||
return '60rpx';
|
||
});
|
||
|
||
function openTitleStyleModal() {
|
||
showTitleStyleModal.value = true;
|
||
}
|
||
function closeTitleStyleModal() {
|
||
showTitleStyleModal.value = false;
|
||
}
|
||
|
||
async function openMeipianPreview() {
|
||
showMeipianPreview.value = true;
|
||
activePreviewDrawer.value = '';
|
||
if (!backdropList.value.length || backdropList.value.length <= 1) {
|
||
try {
|
||
const res = await listBackdrops();
|
||
if (Array.isArray(res?.data) && res.data.length > 0) {
|
||
backdropList.value = res.data;
|
||
}
|
||
} catch (e) {}
|
||
}
|
||
if (!musicList.value.length) {
|
||
try {
|
||
const res = await listMusic();
|
||
if (Array.isArray(res?.data) && res.data.length > 0) {
|
||
musicList.value = res.data;
|
||
}
|
||
} catch (e) {}
|
||
}
|
||
if (!fontList.value.length) {
|
||
try {
|
||
const res = await listFonts();
|
||
if (Array.isArray(res?.data) && res.data.length > 0) {
|
||
fontList.value = res.data;
|
||
}
|
||
} catch (e) {}
|
||
}
|
||
}
|
||
|
||
function closeMeipianPreview() {
|
||
showMeipianPreview.value = false;
|
||
activePreviewDrawer.value = '';
|
||
if (previewAudioCtx) {
|
||
previewAudioCtx.stop();
|
||
previewAudioCtx.destroy();
|
||
previewAudioCtx = null;
|
||
}
|
||
previewMusicPlaying.value = false;
|
||
}
|
||
|
||
function togglePreviewDrawer(type) {
|
||
if (activePreviewDrawer.value === type) {
|
||
activePreviewDrawer.value = '';
|
||
} else {
|
||
activePreviewDrawer.value = type;
|
||
}
|
||
}
|
||
|
||
function applyTemplateInPreview(item) {
|
||
selectBackdrop(item);
|
||
}
|
||
|
||
function selectMusicInPreview(music) {
|
||
doc.article.music_id = music.id;
|
||
doc.dirty.value = true;
|
||
autosave.notifyChange();
|
||
if (previewMusicPlaying.value) {
|
||
playBgMusic(music.url);
|
||
}
|
||
uni.showToast({ title: \`已设置BGM: \${music.name}\`, icon: 'none' });
|
||
}
|
||
|
||
function clearMusicInPreview() {
|
||
doc.article.music_id = '';
|
||
doc.dirty.value = true;
|
||
autosave.notifyChange();
|
||
if (previewAudioCtx) {
|
||
previewAudioCtx.stop();
|
||
}
|
||
previewMusicPlaying.value = false;
|
||
uni.showToast({ title: '已取消背景音乐', icon: 'none' });
|
||
}
|
||
|
||
function selectFontInPreview(font) {
|
||
doc.article.font_id = font.id;
|
||
doc.dirty.value = true;
|
||
autosave.notifyChange();
|
||
uni.showToast({ title: \`已应用字体: \${font.name}\`, icon: 'none' });
|
||
}
|
||
|
||
function playBgMusic(url) {
|
||
if (!previewAudioCtx) {
|
||
previewAudioCtx = uni.createInnerAudioContext();
|
||
previewAudioCtx.loop = true;
|
||
previewAudioCtx.onEnded(() => {
|
||
previewMusicPlaying.value = false;
|
||
});
|
||
previewAudioCtx.onError(() => {
|
||
previewMusicPlaying.value = false;
|
||
});
|
||
}
|
||
previewAudioCtx.src = url;
|
||
previewAudioCtx.play();
|
||
previewMusicPlaying.value = true;
|
||
}
|
||
|
||
function togglePreviewBgMusic() {
|
||
if (previewMusicPlaying.value) {
|
||
if (previewAudioCtx) {
|
||
previewAudioCtx.pause();
|
||
}
|
||
previewMusicPlaying.value = false;
|
||
} else {
|
||
const m = selectedMusic.value || (musicList.value && musicList.value[0]);
|
||
if (m && m.url) {
|
||
playBgMusic(m.url);
|
||
} else {
|
||
uni.showToast({ title: '请先在底部选择一首背景音乐', icon: 'none' });
|
||
}
|
||
}
|
||
}
|
||
|
||
function saveDraftInPreview() {
|
||
doc.article.status = 'draft';
|
||
handleSave(false, true);
|
||
uni.showToast({ title: '草稿已保存', icon: 'success' });
|
||
}
|
||
|
||
function publishInPreview() {
|
||
closeMeipianPreview();
|
||
openPublishModal();
|
||
}
|
||
`;
|
||
|
||
const scriptEndIndex = content.lastIndexOf('</script>');
|
||
if (scriptEndIndex !== -1) {
|
||
content = content.substring(0, scriptEndIndex) + scriptLogic + '\n</script>' + content.substring(scriptEndIndex + '</script>'.length);
|
||
} else {
|
||
console.error('Could not find script end anchor');
|
||
process.exit(1);
|
||
}
|
||
|
||
// 3. 注入 Style 样式
|
||
const styleSnippet = `
|
||
/* ═══════════ 美篇式全真沉浸预览 & 底部模板/音乐/排版装配样式 ═══════════ */
|
||
.mp-preview-overlay {
|
||
position: fixed;
|
||
top: 0;
|
||
left: 0;
|
||
right: 0;
|
||
bottom: 0;
|
||
z-index: 9999;
|
||
background-color: #f8fafc;
|
||
display: flex;
|
||
flex-direction: column;
|
||
}
|
||
|
||
.mp-preview-nav {
|
||
height: 96rpx;
|
||
background: rgba(255, 255, 255, 0.95);
|
||
backdrop-filter: blur(16rpx);
|
||
border-bottom: 1rpx solid #e2e8f0;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
padding: 0 24rpx;
|
||
box-sizing: border-box;
|
||
}
|
||
|
||
.mp-nav-back {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 8rpx;
|
||
color: #334155;
|
||
font-size: 28rpx;
|
||
cursor: pointer;
|
||
}
|
||
|
||
.mp-back-arrow {
|
||
font-size: 40rpx;
|
||
line-height: 1;
|
||
}
|
||
|
||
.mp-nav-title {
|
||
font-size: 32rpx;
|
||
font-weight: 600;
|
||
color: #0f172a;
|
||
}
|
||
|
||
.mp-nav-actions {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 16rpx;
|
||
}
|
||
|
||
.mp-btn-draft {
|
||
padding: 10rpx 22rpx;
|
||
background: #f1f5f9;
|
||
border-radius: 30rpx;
|
||
color: #475569;
|
||
font-size: 26rpx;
|
||
font-weight: 500;
|
||
}
|
||
|
||
.mp-btn-publish {
|
||
padding: 10rpx 28rpx;
|
||
background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
|
||
border-radius: 30rpx;
|
||
color: #ffffff;
|
||
font-size: 26rpx;
|
||
font-weight: 600;
|
||
box-shadow: 0 4rpx 12rpx rgba(37, 99, 235, 0.25);
|
||
}
|
||
|
||
.mp-preview-scroll {
|
||
flex: 1;
|
||
width: 100%;
|
||
overflow-y: auto;
|
||
box-sizing: border-box;
|
||
padding-bottom: 240rpx;
|
||
}
|
||
|
||
.mp-header-decor {
|
||
width: 100%;
|
||
line-height: 0;
|
||
}
|
||
|
||
.mp-decor-img {
|
||
width: 100%;
|
||
display: block;
|
||
}
|
||
|
||
.mp-floating-music-capsule {
|
||
position: sticky;
|
||
top: 24rpx;
|
||
float: right;
|
||
margin-right: 24rpx;
|
||
margin-top: 20rpx;
|
||
z-index: 100;
|
||
background: rgba(255, 255, 255, 0.92);
|
||
backdrop-filter: blur(12rpx);
|
||
border: 1rpx solid rgba(226, 232, 240, 0.8);
|
||
border-radius: 40rpx;
|
||
padding: 8rpx 20rpx 8rpx 12rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 12rpx;
|
||
box-shadow: 0 6rpx 20rpx rgba(0, 0, 0, 0.08);
|
||
}
|
||
|
||
.mp-vinyl-disc {
|
||
width: 52rpx;
|
||
height: 52rpx;
|
||
border-radius: 50%;
|
||
background: #1e293b;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
box-shadow: inset 0 0 0 4rpx #334155;
|
||
}
|
||
|
||
.mp-vinyl-icon {
|
||
font-size: 24rpx;
|
||
}
|
||
|
||
.mp-vinyl-disc.spin {
|
||
animation: mp-spin 4s linear infinite;
|
||
}
|
||
|
||
@keyframes mp-spin {
|
||
from { transform: rotate(0deg); }
|
||
to { transform: rotate(360deg); }
|
||
}
|
||
|
||
.mp-music-track {
|
||
display: flex;
|
||
flex-direction: column;
|
||
}
|
||
|
||
.mp-music-label {
|
||
font-size: 18rpx;
|
||
color: #64748b;
|
||
}
|
||
|
||
.mp-music-title {
|
||
font-size: 22rpx;
|
||
font-weight: 500;
|
||
color: #0f172a;
|
||
max-width: 180rpx;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
.mp-music-state-icon {
|
||
font-size: 22rpx;
|
||
color: #2563eb;
|
||
}
|
||
|
||
.mp-preview-card {
|
||
max-width: 750rpx;
|
||
margin: 20rpx auto 0;
|
||
background: #ffffff;
|
||
border-radius: 20rpx;
|
||
border: 1rpx solid #e2e8f0;
|
||
padding: 32rpx 28rpx;
|
||
box-sizing: border-box;
|
||
box-shadow: 0 8rpx 30rpx rgba(0, 0, 0, 0.04);
|
||
}
|
||
|
||
.mp-preview-cover-wrap {
|
||
width: 100%;
|
||
border-radius: 16rpx;
|
||
overflow: hidden;
|
||
margin-bottom: 28rpx;
|
||
line-height: 0;
|
||
}
|
||
|
||
.mp-preview-cover {
|
||
width: 100%;
|
||
height: 380rpx;
|
||
display: block;
|
||
}
|
||
|
||
.mp-preview-title-wrap {
|
||
margin-bottom: 24rpx;
|
||
}
|
||
|
||
.mp-preview-title-wrap.title-center {
|
||
text-align: center;
|
||
}
|
||
|
||
.mp-preview-title-wrap.title-left {
|
||
text-align: left;
|
||
}
|
||
|
||
.mp-preview-title {
|
||
color: #0f172a;
|
||
line-height: 1.4;
|
||
word-break: break-all;
|
||
}
|
||
|
||
.mp-preview-title-wrap.title-bold .mp-preview-title {
|
||
font-weight: 700;
|
||
}
|
||
|
||
.mp-preview-author-row {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 16rpx;
|
||
padding-bottom: 28rpx;
|
||
margin-bottom: 28rpx;
|
||
border-bottom: 1rpx solid #f1f5f9;
|
||
}
|
||
|
||
.mp-author-avatar-box {
|
||
width: 68rpx;
|
||
height: 68rpx;
|
||
border-radius: 50%;
|
||
background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
|
||
.mp-author-avatar-text {
|
||
color: #ffffff;
|
||
font-size: 30rpx;
|
||
font-weight: bold;
|
||
}
|
||
|
||
.mp-author-info {
|
||
flex: 1;
|
||
display: flex;
|
||
flex-direction: column;
|
||
}
|
||
|
||
.mp-author-name {
|
||
font-size: 28rpx;
|
||
font-weight: 500;
|
||
color: #1e293b;
|
||
}
|
||
|
||
.mp-article-time {
|
||
font-size: 22rpx;
|
||
color: #94a3b8;
|
||
}
|
||
|
||
.mp-author-badge {
|
||
font-size: 22rpx;
|
||
padding: 6rpx 16rpx;
|
||
background: #eff6ff;
|
||
color: #2563eb;
|
||
border-radius: 20rpx;
|
||
}
|
||
|
||
.mp-preview-sections {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 24rpx;
|
||
}
|
||
|
||
.mp-preview-empty {
|
||
padding: 60rpx 0;
|
||
text-align: center;
|
||
}
|
||
|
||
.mp-empty-hint {
|
||
font-size: 28rpx;
|
||
color: #94a3b8;
|
||
}
|
||
|
||
.mp-preview-seal-wrap {
|
||
margin-top: 60rpx;
|
||
padding-top: 40rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
gap: 20rpx;
|
||
}
|
||
|
||
.mp-seal-line {
|
||
flex: 1;
|
||
height: 1rpx;
|
||
background: #e2e8f0;
|
||
}
|
||
|
||
.mp-seal-badge {
|
||
padding: 6rpx 20rpx;
|
||
background: #f8fafc;
|
||
border: 1rpx dashed #cbd5e1;
|
||
border-radius: 30rpx;
|
||
}
|
||
|
||
.mp-seal-text {
|
||
font-size: 22rpx;
|
||
color: #64748b;
|
||
}
|
||
|
||
.mp-preview-safe-space {
|
||
height: 200rpx;
|
||
}
|
||
|
||
/* 底部美篇三联固定操作托盘 */
|
||
.mp-bottom-dock {
|
||
position: fixed;
|
||
bottom: 0;
|
||
left: 0;
|
||
right: 0;
|
||
z-index: 10000;
|
||
background: rgba(255, 255, 255, 0.98);
|
||
backdrop-filter: blur(20rpx);
|
||
border-top: 1rpx solid #e2e8f0;
|
||
box-shadow: 0 -8rpx 30rpx rgba(0, 0, 0, 0.08);
|
||
}
|
||
|
||
.mp-dock-tabs {
|
||
height: 110rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-around;
|
||
padding: 0 40rpx;
|
||
}
|
||
|
||
.mp-dock-tab {
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
gap: 6rpx;
|
||
position: relative;
|
||
padding: 8rpx 24rpx;
|
||
cursor: pointer;
|
||
}
|
||
|
||
.mp-dock-tab.active {
|
||
background: #eff6ff;
|
||
border-radius: 16rpx;
|
||
}
|
||
|
||
.mp-tab-icon {
|
||
font-size: 38rpx;
|
||
}
|
||
|
||
.mp-tab-label {
|
||
font-size: 22rpx;
|
||
color: #475569;
|
||
font-weight: 500;
|
||
}
|
||
|
||
.mp-dock-tab.active .mp-tab-label {
|
||
color: #2563eb;
|
||
font-weight: 600;
|
||
}
|
||
|
||
.mp-tab-dot {
|
||
position: absolute;
|
||
top: 6rpx;
|
||
right: 18rpx;
|
||
width: 12rpx;
|
||
height: 12rpx;
|
||
border-radius: 50%;
|
||
background: #2563eb;
|
||
}
|
||
|
||
.mp-drawer-content {
|
||
background: #ffffff;
|
||
border-bottom: 1rpx solid #f1f5f9;
|
||
padding: 24rpx;
|
||
max-height: 480rpx;
|
||
}
|
||
|
||
.mp-drawer-header {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
margin-bottom: 20rpx;
|
||
}
|
||
|
||
.mp-drawer-title {
|
||
font-size: 28rpx;
|
||
font-weight: 600;
|
||
color: #0f172a;
|
||
}
|
||
|
||
.mp-drawer-close {
|
||
font-size: 28rpx;
|
||
color: #94a3b8;
|
||
padding: 8rpx 12rpx;
|
||
}
|
||
|
||
.mp-template-scroll {
|
||
width: 100%;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
.mp-template-cards {
|
||
display: inline-flex;
|
||
gap: 20rpx;
|
||
padding: 10rpx 4rpx;
|
||
}
|
||
|
||
.mp-template-card {
|
||
width: 160rpx;
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
gap: 12rpx;
|
||
cursor: pointer;
|
||
}
|
||
|
||
.mp-tpl-swatch {
|
||
width: 150rpx;
|
||
height: 100rpx;
|
||
border-radius: 12rpx;
|
||
border: 2rpx solid #e2e8f0;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
box-shadow: 0 4rpx 10rpx rgba(0, 0, 0, 0.05);
|
||
}
|
||
|
||
.mp-template-card.selected .mp-tpl-swatch {
|
||
border-color: #2563eb;
|
||
box-shadow: 0 0 0 4rpx rgba(37, 99, 235, 0.2);
|
||
}
|
||
|
||
.mp-tpl-check {
|
||
font-size: 32rpx;
|
||
color: #2563eb;
|
||
font-weight: bold;
|
||
}
|
||
|
||
.mp-tpl-name {
|
||
font-size: 24rpx;
|
||
color: #334155;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
.mp-template-card.selected .mp-tpl-name {
|
||
color: #2563eb;
|
||
font-weight: 600;
|
||
}
|
||
|
||
.mp-music-scroll {
|
||
max-height: 380rpx;
|
||
}
|
||
|
||
.mp-music-item {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
padding: 18rpx 20rpx;
|
||
border-radius: 14rpx;
|
||
margin-bottom: 10rpx;
|
||
background: #f8fafc;
|
||
}
|
||
|
||
.mp-music-item.selected {
|
||
background: #eff6ff;
|
||
border: 1rpx solid #bfdbfe;
|
||
}
|
||
|
||
.mp-music-left {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 16rpx;
|
||
}
|
||
|
||
.mp-music-play-btn {
|
||
width: 50rpx;
|
||
height: 50rpx;
|
||
border-radius: 50%;
|
||
background: #e2e8f0;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
font-size: 20rpx;
|
||
color: #1e293b;
|
||
}
|
||
|
||
.mp-music-texts {
|
||
display: flex;
|
||
flex-direction: column;
|
||
}
|
||
|
||
.mp-music-name {
|
||
font-size: 26rpx;
|
||
font-weight: 500;
|
||
color: #0f172a;
|
||
}
|
||
|
||
.mp-music-artist {
|
||
font-size: 22rpx;
|
||
color: #64748b;
|
||
}
|
||
|
||
.mp-item-selected-tag {
|
||
font-size: 22rpx;
|
||
color: #2563eb;
|
||
font-weight: 600;
|
||
padding: 6rpx 16rpx;
|
||
background: #dbeafe;
|
||
border-radius: 20rpx;
|
||
}
|
||
|
||
.mp-item-pick-btn {
|
||
font-size: 24rpx;
|
||
color: #475569;
|
||
padding: 6rpx 20rpx;
|
||
border: 1rpx solid #cbd5e1;
|
||
border-radius: 20rpx;
|
||
}
|
||
|
||
.mp-layout-controls {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 20rpx;
|
||
}
|
||
|
||
.mp-control-group {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
}
|
||
|
||
.mp-group-label {
|
||
font-size: 26rpx;
|
||
color: #475569;
|
||
font-weight: 500;
|
||
}
|
||
|
||
.mp-pill-selector {
|
||
display: flex;
|
||
gap: 12rpx;
|
||
}
|
||
|
||
.mp-pill-opt {
|
||
padding: 10rpx 24rpx;
|
||
background: #f1f5f9;
|
||
border-radius: 24rpx;
|
||
font-size: 24rpx;
|
||
color: #475569;
|
||
cursor: pointer;
|
||
}
|
||
|
||
.mp-pill-opt.active {
|
||
background: #2563eb;
|
||
color: #ffffff;
|
||
font-weight: 600;
|
||
}
|
||
|
||
.mp-font-pill-scroll {
|
||
max-width: 460rpx;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
.mp-font-pills {
|
||
display: inline-flex;
|
||
gap: 12rpx;
|
||
}
|
||
|
||
.mp-font-pill {
|
||
padding: 8rpx 20rpx;
|
||
background: #f1f5f9;
|
||
border-radius: 24rpx;
|
||
font-size: 22rpx;
|
||
color: #475569;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
.mp-font-pill.active {
|
||
background: #2563eb;
|
||
color: #ffffff;
|
||
}
|
||
|
||
/* 标题样式设置 */
|
||
.title-input-row {
|
||
display: flex;
|
||
align-items: flex-start;
|
||
gap: 16rpx;
|
||
}
|
||
|
||
.title-style-btn {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 6rpx;
|
||
padding: 10rpx 18rpx;
|
||
background: #f1f5f9;
|
||
border-radius: 24rpx;
|
||
color: #475569;
|
||
font-size: 24rpx;
|
||
font-weight: 500;
|
||
white-space: nowrap;
|
||
margin-top: 10rpx;
|
||
}
|
||
|
||
.title-style-icon {
|
||
font-size: 26rpx;
|
||
}
|
||
|
||
.title-align-center {
|
||
text-align: center;
|
||
}
|
||
|
||
.title-align-left {
|
||
text-align: left;
|
||
}
|
||
|
||
.title-weight-bold {
|
||
font-weight: 700;
|
||
}
|
||
|
||
.nav-btn-preview {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 6rpx;
|
||
padding: 10rpx 20rpx;
|
||
background: #eff6ff;
|
||
border-radius: 24rpx;
|
||
margin-right: 12rpx;
|
||
}
|
||
|
||
.preview-btn-icon {
|
||
font-size: 26rpx;
|
||
}
|
||
|
||
.preview-btn-text {
|
||
font-size: 24rpx;
|
||
color: #2563eb;
|
||
font-weight: 600;
|
||
}
|
||
`;
|
||
|
||
const styleEndIndex = content.lastIndexOf('</style>');
|
||
if (styleEndIndex !== -1) {
|
||
content = content.substring(0, styleEndIndex) + styleSnippet + '\n</style>' + content.substring(styleEndIndex + '</style>'.length);
|
||
} else {
|
||
console.error('Could not find style end anchor');
|
||
process.exit(1);
|
||
}
|
||
|
||
fs.writeFileSync(filePath, content, 'utf8');
|
||
console.log('Patch applied successfully!');
|