mirror of
https://gitee.com/ulthon/ulthon_information.git
synced 2026-07-01 16:22:49 +08:00
feat(output_view): 导出页面重构 - 长图卡片化展示、缩略图增大、预览优化、纯图片页原图保存
- output_view.html: 长图改为固定高度卡片(70px),Blob URL查看,缩略图minmax(280px,1fr), 竖图预览优先填充视口高度,下载功能完整保留 - phone-image.js: renderPureImageToCanvas()使用naturalWidth/naturalHeight保持原图分辨率, 新增长图生成和保存功能 - Post.php: 新增outputView()方法提供导出页面渲染数据 - PhoneImage.php: 图片数据改为DB存储,新增saveLongImage()方法 - phone_image.html: 添加导出页面入口按钮 - 新增数据库迁移: post_output_file表添加image_data字段
This commit is contained in:
498
view/admin/post/output_view.html
Normal file
498
view/admin/post/output_view.html
Normal file
@@ -0,0 +1,498 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{$post.title} - 排版导出</title>
|
||||
<link rel="stylesheet" href="/static/lib/layui/css/layui.css">
|
||||
<style>
|
||||
body { background: #f2f2f2; margin: 0; padding: 20px; }
|
||||
|
||||
.export-header {
|
||||
background: #fff;
|
||||
padding: 15px 20px;
|
||||
border-radius: 4px;
|
||||
margin-bottom: 20px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
box-shadow: 0 1px 4px rgba(0,0,0,0.08);
|
||||
}
|
||||
.export-header h2 { margin: 0; font-size: 18px; color: #333; }
|
||||
.export-header .header-info { color: #999; font-size: 13px; margin-top: 4px; }
|
||||
.export-actions { display: flex; gap: 10px; align-items: center; }
|
||||
|
||||
.image-section {
|
||||
background: #fff;
|
||||
border-radius: 4px;
|
||||
padding: 20px;
|
||||
margin-bottom: 20px;
|
||||
box-shadow: 0 1px 4px rgba(0,0,0,0.08);
|
||||
}
|
||||
.image-section h3 {
|
||||
margin: 0 0 15px 0;
|
||||
font-size: 16px;
|
||||
color: #333;
|
||||
border-bottom: 1px solid #eee;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
/* 长图卡片 */
|
||||
.long-image-card {
|
||||
height: 70px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background: #fff;
|
||||
border: 1px solid #e8e8e8;
|
||||
border-radius: 4px;
|
||||
padding: 0 16px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.long-image-card .card-info {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
.long-image-card .card-icon {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
background: #f0f0f0;
|
||||
border-radius: 4px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 16px;
|
||||
color: #999;
|
||||
}
|
||||
.long-image-card .card-label {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
.long-image-card .card-dims {
|
||||
font-size: 12px;
|
||||
color: #999;
|
||||
}
|
||||
.long-image-card .card-actions {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
/* 缩略图网格 */
|
||||
.thumb-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
|
||||
gap: 16px;
|
||||
}
|
||||
.thumb-item {
|
||||
background: #fafafa;
|
||||
border: 1px solid #e8e8e8;
|
||||
border-radius: 4px;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
transition: box-shadow 0.2s, transform 0.15s;
|
||||
position: relative;
|
||||
}
|
||||
.thumb-item:hover {
|
||||
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
.thumb-item img {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
display: block;
|
||||
}
|
||||
.thumb-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 6px 10px;
|
||||
background: #fff;
|
||||
border-top: 1px solid #e8e8e8;
|
||||
}
|
||||
.thumb-bar .thumb-label {
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
}
|
||||
.thumb-bar .thumb-dl {
|
||||
background: none;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
padding: 2px 6px;
|
||||
color: #1e9fff;
|
||||
font-size: 12px;
|
||||
border-radius: 2px;
|
||||
}
|
||||
.thumb-bar .thumb-dl:hover {
|
||||
background: #e8f4ff;
|
||||
}
|
||||
|
||||
/* 全屏预览 */
|
||||
.preview-overlay {
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 0; left: 0; right: 0; bottom: 0;
|
||||
background: rgba(0,0,0,0.85);
|
||||
z-index: 19999;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
}
|
||||
.preview-overlay.active { display: flex; }
|
||||
|
||||
.preview-topbar {
|
||||
position: absolute;
|
||||
top: 0; left: 0; right: 0;
|
||||
height: 48px;
|
||||
background: rgba(0,0,0,0.6);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 0 20px;
|
||||
color: #fff;
|
||||
font-size: 14px;
|
||||
z-index: 20001;
|
||||
}
|
||||
.preview-topbar button {
|
||||
background: none;
|
||||
border: 1px solid rgba(255,255,255,0.4);
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
padding: 4px 12px;
|
||||
border-radius: 3px;
|
||||
font-size: 13px;
|
||||
}
|
||||
.preview-topbar button:hover { background: rgba(255,255,255,0.15); }
|
||||
.preview-topbar-actions { display: flex; gap: 8px; align-items: center; }
|
||||
|
||||
.preview-body {
|
||||
max-width: 90vw;
|
||||
max-height: calc(85vh - 48px);
|
||||
height: calc(85vh - 48px);
|
||||
margin-top: 48px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.preview-body img {
|
||||
max-height: calc(85vh - 48px);
|
||||
max-width: 90vw;
|
||||
height: auto;
|
||||
width: auto;
|
||||
object-fit: contain;
|
||||
border-radius: 2px;
|
||||
box-shadow: 0 4px 24px rgba(0,0,0,0.4);
|
||||
user-select: none;
|
||||
}
|
||||
.preview-body img.portrait-fill {
|
||||
height: calc(85vh - 48px);
|
||||
width: auto;
|
||||
max-width: 90vw;
|
||||
}
|
||||
|
||||
/* 底部缩略图导航 */
|
||||
.preview-nav {
|
||||
position: absolute;
|
||||
bottom: 0; left: 0; right: 0;
|
||||
background: rgba(0,0,0,0.6);
|
||||
padding: 10px 20px;
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
overflow-x: auto;
|
||||
justify-content: center;
|
||||
z-index: 20001;
|
||||
}
|
||||
.preview-nav-item {
|
||||
width: 48px;
|
||||
height: 64px;
|
||||
flex-shrink: 0;
|
||||
border: 2px solid transparent;
|
||||
border-radius: 3px;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
opacity: 0.5;
|
||||
transition: opacity 0.15s, border-color 0.15s;
|
||||
}
|
||||
.preview-nav-item.active {
|
||||
border-color: #1e9fff;
|
||||
opacity: 1;
|
||||
}
|
||||
.preview-nav-item:hover { opacity: 0.85; }
|
||||
.preview-nav-item img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
/* 左右切换箭头 */
|
||||
.preview-arrow {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
background: rgba(255,255,255,0.1);
|
||||
border: 1px solid rgba(255,255,255,0.2);
|
||||
border-radius: 50%;
|
||||
color: #fff;
|
||||
font-size: 22px;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 20001;
|
||||
user-select: none;
|
||||
transition: background 0.15s;
|
||||
}
|
||||
.preview-arrow:hover { background: rgba(255,255,255,0.25); }
|
||||
.preview-arrow.prev { left: 20px; }
|
||||
.preview-arrow.next { right: 20px; }
|
||||
|
||||
.export-footer {
|
||||
text-align: center;
|
||||
padding: 20px;
|
||||
color: #999;
|
||||
font-size: 13px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="export-header">
|
||||
<div>
|
||||
<h2>{$post.title} - 排版导出</h2>
|
||||
<div class="header-info">
|
||||
共 {$output.page_count} 页
|
||||
| 生成时间:{$output.create_time|date='Y-m-d H:i:s'}
|
||||
</div>
|
||||
</div>
|
||||
<div class="export-actions">
|
||||
<a href="{:url('post/phoneImage', ['id' => $post.id])}" class="layui-btn layui-btn-sm layui-btn-primary">
|
||||
<i class="layui-icon layui-icon-return"></i> 返回排版
|
||||
</a>
|
||||
<a href="{$downloadZipUrl|raw}" class="layui-btn layui-btn-sm layui-btn-normal">
|
||||
<i class="layui-icon layui-icon-download-circle"></i> 下载全部 ZIP
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{if condition="$longImage"}
|
||||
<div class="image-section">
|
||||
<h3>长图</h3>
|
||||
<div class="long-image-card">
|
||||
<div class="card-info">
|
||||
<span class="card-icon"><i class="layui-icon layui-icon-picture"></i></span>
|
||||
<span class="card-label">长图</span>
|
||||
<span class="card-dims">{$longImage.width} x {$longImage.height} px</span>
|
||||
</div>
|
||||
<div class="card-actions">
|
||||
<button class="layui-btn layui-btn-sm layui-btn-primary btn-view-long-image" data-src="{$longImage.image_src|raw}">查看原图</button>
|
||||
<button class="layui-btn layui-btn-sm layui-btn-normal btn-download-image" data-src="{$longImage.image_src|raw}" data-filename="long_image.jpg">下载</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{if condition="count($pages) > 0"}
|
||||
<div class="image-section">
|
||||
<h3>分页图片({$output.page_count} 页)</h3>
|
||||
<div class="thumb-grid">
|
||||
{volist name="pages" id="page"}
|
||||
<div class="thumb-item" data-index="{$i}">
|
||||
<img src="{$page.image_src|raw}" alt="第{$page.page}页">
|
||||
<div class="thumb-bar">
|
||||
<span class="thumb-label">第 {$page.page} 页</span>
|
||||
<button class="thumb-dl btn-download-image"
|
||||
data-src="{$page.image_src|raw}" data-filename="page_{$page.page}.jpg">
|
||||
下载
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{/volist}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="export-footer">
|
||||
排版导出 - 共 {$output.page_count} 页
|
||||
</div>
|
||||
|
||||
<!-- 全屏预览浮层 -->
|
||||
<div class="preview-overlay" id="previewOverlay">
|
||||
<div class="preview-topbar">
|
||||
<span id="previewTitle">第 1 页</span>
|
||||
<div class="preview-topbar-actions">
|
||||
<button id="previewDownload"><i class="layui-icon layui-icon-download-circle"></i> 下载此页</button>
|
||||
<button id="previewClose">关闭</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="preview-arrow prev" id="previewPrev">‹</div>
|
||||
<div class="preview-arrow next" id="previewNext">›</div>
|
||||
<div class="preview-body">
|
||||
<img id="previewImg" src="" alt="">
|
||||
</div>
|
||||
<div class="preview-nav" id="previewNav"></div>
|
||||
</div>
|
||||
|
||||
<script src="/static/lib/jquery/jquery-3.4.1.min.js"></script>
|
||||
<script src="/static/lib/layui/layui.js"></script>
|
||||
<script>
|
||||
layui.use(['layer'], function () {
|
||||
var layer = layui.layer;
|
||||
|
||||
// 收集所有图片数据(仅分页,不含长图)
|
||||
var allImages = [];
|
||||
{volist name="pages" id="p"}
|
||||
allImages.push({ src: '{$p.image_src|raw}', label: '第 {$p.page} 页', filename: 'page_{$p.page}.jpg' });
|
||||
{/volist}
|
||||
|
||||
var currentIndex = 0;
|
||||
|
||||
// ===== 查看长图(通过 Blob URL 在新标签打开) =====
|
||||
function viewLongImage(src) {
|
||||
try {
|
||||
var parts = src.split(',');
|
||||
var byteString = atob(parts[1]);
|
||||
var mimeString = parts[0].split(':')[1].split(';')[0];
|
||||
var ab = new ArrayBuffer(byteString.length);
|
||||
var ia = new Uint8Array(ab);
|
||||
for (var i = 0; i < byteString.length; i++) {
|
||||
ia[i] = byteString.charCodeAt(i);
|
||||
}
|
||||
var blob = new Blob([ab], {type: mimeString});
|
||||
var url = URL.createObjectURL(blob);
|
||||
window.open(url, '_blank');
|
||||
} catch(e) {
|
||||
layer.msg('打开长图失败');
|
||||
}
|
||||
}
|
||||
|
||||
// 长图查看按钮
|
||||
$(document).on('click', '.btn-view-long-image', function () {
|
||||
viewLongImage($(this).data('src'));
|
||||
});
|
||||
|
||||
// ===== 下载单张图片 =====
|
||||
function downloadImage(src, filename) {
|
||||
if (!src) { layer.msg('图片地址无效'); return; }
|
||||
if (src.indexOf('data:') === 0) {
|
||||
var link = document.createElement('a');
|
||||
link.download = filename || 'image.jpg';
|
||||
link.href = src;
|
||||
link.click();
|
||||
return;
|
||||
}
|
||||
var img = new Image();
|
||||
img.crossOrigin = 'anonymous';
|
||||
img.onload = function () {
|
||||
var canvas = document.createElement('canvas');
|
||||
canvas.width = img.naturalWidth;
|
||||
canvas.height = img.naturalHeight;
|
||||
canvas.getContext('2d').drawImage(img, 0, 0);
|
||||
var link = document.createElement('a');
|
||||
link.download = filename || 'image.jpg';
|
||||
link.href = canvas.toDataURL('image/jpeg', 0.92);
|
||||
link.click();
|
||||
};
|
||||
img.onerror = function () { window.open(src); };
|
||||
img.src = src;
|
||||
}
|
||||
|
||||
// 缩略图上的下载按钮
|
||||
$(document).on('click', '.btn-download-image', function (e) {
|
||||
e.stopPropagation();
|
||||
downloadImage($(this).data('src'), $(this).data('filename'));
|
||||
});
|
||||
|
||||
// ===== 全屏预览 =====
|
||||
function showPreview(index) {
|
||||
if (index < 0 || index >= allImages.length) return;
|
||||
currentIndex = index;
|
||||
var item = allImages[index];
|
||||
|
||||
var $img = $('#previewImg');
|
||||
$img.attr('src', item.src);
|
||||
// 重置样式
|
||||
$img.removeClass('portrait-fill').css({ 'height': '', 'width': '' });
|
||||
|
||||
// 根据图片方向动态调整预览尺寸
|
||||
var tempImg = new Image();
|
||||
tempImg.onload = function () {
|
||||
var isPortrait = tempImg.naturalHeight > tempImg.naturalWidth;
|
||||
if (isPortrait) {
|
||||
$img.addClass('portrait-fill');
|
||||
}
|
||||
};
|
||||
tempImg.src = item.src;
|
||||
|
||||
$('#previewTitle').text(item.label + ' (' + (index + 1) + '/' + allImages.length + ')');
|
||||
$('#previewDownload').data('src', item.src).data('filename', item.filename);
|
||||
|
||||
// 底部导航高亮
|
||||
$('#previewNav .preview-nav-item').removeClass('active');
|
||||
$('#previewNav .preview-nav-item').eq(index).addClass('active');
|
||||
|
||||
$('#previewOverlay').addClass('active');
|
||||
document.body.style.overflow = 'hidden';
|
||||
}
|
||||
|
||||
function closePreview() {
|
||||
$('#previewOverlay').removeClass('active');
|
||||
document.body.style.overflow = '';
|
||||
}
|
||||
|
||||
// 点击缩略图打开预览
|
||||
$(document).on('click', '.thumb-item', function (e) {
|
||||
if ($(e.target).closest('.btn-download-image').length) return;
|
||||
var idx = parseInt($(this).data('index'), 10);
|
||||
showPreview(idx);
|
||||
});
|
||||
|
||||
// 构建底部导航缩略图
|
||||
var navHtml = '';
|
||||
for (var i = 0; i < allImages.length; i++) {
|
||||
navHtml += '<div class="preview-nav-item" data-nav-index="' + i + '"><img src="' + allImages[i].src + '"></div>';
|
||||
}
|
||||
$('#previewNav').html(navHtml);
|
||||
|
||||
// 底部导航点击
|
||||
$(document).on('click', '.preview-nav-item', function () {
|
||||
showPreview(parseInt($(this).data('nav-index'), 10));
|
||||
});
|
||||
|
||||
// 关闭
|
||||
$('#previewClose').on('click', closePreview);
|
||||
$('#previewOverlay').on('click', function (e) {
|
||||
if (e.target === this) closePreview();
|
||||
});
|
||||
|
||||
// 上一页 / 下一页
|
||||
$('#previewPrev').on('click', function (e) {
|
||||
e.stopPropagation();
|
||||
if (currentIndex > 0) showPreview(currentIndex - 1);
|
||||
});
|
||||
$('#previewNext').on('click', function (e) {
|
||||
e.stopPropagation();
|
||||
if (currentIndex < allImages.length - 1) showPreview(currentIndex + 1);
|
||||
});
|
||||
|
||||
// 键盘快捷键
|
||||
$(document).on('keydown.preview', function (e) {
|
||||
if (!$('#previewOverlay').hasClass('active')) return;
|
||||
if (e.key === 'Escape') closePreview();
|
||||
if (e.key === 'ArrowLeft' || e.key === 'Left') { e.preventDefault(); $('#previewPrev').click(); }
|
||||
if (e.key === 'ArrowRight' || e.key === 'Right') { e.preventDefault(); $('#previewNext').click(); }
|
||||
});
|
||||
|
||||
// 预览中的下载
|
||||
$('#previewDownload').on('click', function () {
|
||||
downloadImage($(this).data('src'), $(this).data('filename'));
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -138,18 +138,19 @@
|
||||
<div class="page-header-right">
|
||||
<button type="button" class="layui-btn layui-btn-sm layui-btn-primary" id="btn-settings"><i
|
||||
class="layui-icon layui-icon-set"></i> 设置</button>
|
||||
<button type="button" class="layui-btn layui-btn-sm layui-btn-warm" id="btn-render"><i
|
||||
class="layui-icon layui-icon-refresh"></i> 生成</button>
|
||||
<button type="button" class="layui-btn layui-btn-sm layui-btn-normal" id="btn-save"><i
|
||||
class="layui-icon layui-icon-ok"></i> 保存</button>
|
||||
<button type="button" class="layui-btn layui-btn-sm" id="btn-generate"><i
|
||||
class="layui-icon layui-icon-picture"></i> 生成并保存</button>
|
||||
<button type="button" class="layui-btn layui-btn-sm layui-btn-primary" id="btn-export-page"><i
|
||||
class="layui-icon layui-icon-upload-circle"></i> 导出页面</button>
|
||||
<div class="more-dropdown-wrapper" style="position:relative;display:inline-block;">
|
||||
<button type="button" class="layui-btn layui-btn-sm layui-btn-primary" id="btn-more"><i
|
||||
class="layui-icon layui-icon-more"></i></button>
|
||||
<ul class="more-dropdown-menu" id="more-dropdown-menu" style="display:none;position:absolute;right:0;top:100%;margin-top:4px;background:#fff;border:1px solid #e8e8e8;border-radius:4px;box-shadow:0 2px 8px rgba(0,0,0,0.12);z-index:9999;min-width:130px;padding:4px 0;list-style:none;">
|
||||
<li data-action="history" style="padding:8px 16px;cursor:pointer;font-size:13px;white-space:nowrap;">历史记录</li>
|
||||
<li data-action="rerender" style="padding:8px 16px;cursor:pointer;font-size:13px;white-space:nowrap;">重新生成</li>
|
||||
<li data-action="download" style="padding:8px 16px;cursor:pointer;font-size:13px;white-space:nowrap;">打包下载</li>
|
||||
<li data-action="exportLong" style="padding:8px 16px;cursor:pointer;font-size:13px;white-space:nowrap;">导出长图</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@@ -184,8 +185,9 @@
|
||||
var form = layui.form;
|
||||
var layer = layui.layer;
|
||||
|
||||
var lastOutputId = null;
|
||||
var lastOutputId = <?php echo $lastOutputId ? (int) $lastOutputId : 'null'; ?>;
|
||||
var downloadBaseUrl = '{:url("post/downloadPostOutputZip", ["id" => 0])}';
|
||||
var outputViewUrl = '{:url("post/outputView", ["id" => 0])}';
|
||||
var saveConfigUrl = '{:url("post/savePostOutputConfig")}';
|
||||
var historyListUrl = '{:url("post/getOutputListJson", ["id" => $post->id])}';
|
||||
var loadConfigUrl = '{:url("post/loadPostOutputConfig")}';
|
||||
@@ -395,6 +397,21 @@
|
||||
}, 300);
|
||||
}
|
||||
|
||||
// ========== 生成按钮 ==========
|
||||
$('#btn-render').click(function () {
|
||||
doRender();
|
||||
});
|
||||
|
||||
// ========== 导出页面按钮 ==========
|
||||
$('#btn-export-page').click(function () {
|
||||
if (!lastOutputId) {
|
||||
layer.msg('请先生成并保存');
|
||||
return;
|
||||
}
|
||||
var url = outputViewUrl.replace('id=0', 'id=' + lastOutputId);
|
||||
window.open(url);
|
||||
});
|
||||
|
||||
// ========== 更多下拉菜单(纯JS实现) ==========
|
||||
var $menu = $('#more-dropdown-menu');
|
||||
$('#btn-more').on('click', function(e) {
|
||||
@@ -408,15 +425,6 @@
|
||||
case 'history':
|
||||
$('#btn-history').trigger('click');
|
||||
break;
|
||||
case 'rerender':
|
||||
doRender();
|
||||
break;
|
||||
case 'download':
|
||||
$('#btn-download-hidden').trigger('click');
|
||||
break;
|
||||
case 'exportLong':
|
||||
$('#btn-export-long-hidden').trigger('click');
|
||||
break;
|
||||
}
|
||||
});
|
||||
// 点击外部关闭
|
||||
@@ -505,40 +513,10 @@
|
||||
});
|
||||
});
|
||||
|
||||
// ========== 打包下载(隐藏按钮,由更多菜单触发) ==========
|
||||
var downloadBtn = $('<button type="button" id="btn-download-hidden" style="display:none;"></button>');
|
||||
$('body').append(downloadBtn);
|
||||
downloadBtn.on('click', function () {
|
||||
if (!lastOutputId) {
|
||||
layer.msg('请先生成并保存图片');
|
||||
return;
|
||||
}
|
||||
var url = downloadBaseUrl.replace('/0/', '/' + lastOutputId + '/');
|
||||
window.open(url);
|
||||
});
|
||||
|
||||
// ========== 导出长图(隐藏按钮,由更多菜单触发) ==========
|
||||
var exportLongBtn = $('<button type="button" id="btn-export-long-hidden" style="display:none;"></button>');
|
||||
$('body').append(exportLongBtn);
|
||||
exportLongBtn.on('click', function () {
|
||||
PhoneImageEngine.exportLongImage().then(function () {
|
||||
layer.msg('长图已导出');
|
||||
}).catch(function (err) {
|
||||
layer.msg('导出失败: ' + err);
|
||||
});
|
||||
});
|
||||
|
||||
// ========== 历史记录(隐藏按钮,由更多菜单和设置旁入口触发) ==========
|
||||
var historyBtn = $('<button type="button" id="btn-history" style="display:none;"></button>');
|
||||
$('body').append(historyBtn);
|
||||
|
||||
// 重新生成(隐藏按钮,由更多菜单触发)
|
||||
var rerenderBtn = $('<button type="button" id="btn-rerender" style="display:none;"></button>');
|
||||
$('body').append(rerenderBtn);
|
||||
rerenderBtn.on('click', function () {
|
||||
doRender();
|
||||
});
|
||||
|
||||
historyBtn.on('click', function () {
|
||||
var loadIdx = layer.load();
|
||||
$.get(historyListUrl, function (res) {
|
||||
|
||||
Reference in New Issue
Block a user