mirror of
https://gitee.com/ulthon/ulthon_information.git
synced 2026-07-08 22:22:47 +08:00
feat(phone-image): add save button and state management
This commit is contained in:
@@ -141,6 +141,8 @@
|
||||
|
||||
<!-- 操作按钮 -->
|
||||
<div class="action-btns">
|
||||
<button type="button" class="layui-btn layui-btn-normal" id="btn-save"><i
|
||||
class="layui-icon layui-icon-ok"></i> 保存</button>
|
||||
<button type="button" class="layui-btn layui-btn-normal" id="btn-generate"><i
|
||||
class="layui-icon layui-icon-picture"></i> 生成并保存</button>
|
||||
<button type="button" class="layui-btn layui-btn-warm" id="btn-download"><i
|
||||
@@ -174,6 +176,7 @@
|
||||
|
||||
var lastOutputId = null;
|
||||
var downloadBaseUrl = '{:url("post/downloadPostOutputZip", ["id" => 0])}';
|
||||
var saveConfigUrl = '{:url("post/savePostOutputConfig")}';
|
||||
|
||||
var postData = {
|
||||
postId: {$post.id},
|
||||
@@ -233,6 +236,27 @@
|
||||
}, 300);
|
||||
}
|
||||
|
||||
// 保存配置(不生成图片)
|
||||
$('#btn-save').click(function () {
|
||||
var btn = $(this);
|
||||
btn.prop('disabled', true);
|
||||
layer.msg('保存中...');
|
||||
|
||||
PhoneImageEngine.saveConfig(postData.postId, {
|
||||
size: $('[name="size"]').val(),
|
||||
fontSize: parseInt($('[name="fontSize"]').val()) || 14,
|
||||
watermark: $('[name="watermark"]').val(),
|
||||
content_html: $('#post-content-html').html()
|
||||
}, saveConfigUrl).then(function (data) {
|
||||
if (data.output_id) lastOutputId = data.output_id;
|
||||
layer.msg('保存成功');
|
||||
}).catch(function (err) {
|
||||
layer.msg('保存失败: ' + err);
|
||||
}).always(function () {
|
||||
setTimeout(function () { btn.prop('disabled', false); }, 2000);
|
||||
});
|
||||
});
|
||||
|
||||
// 生成并保存
|
||||
$('#btn-generate').click(function () {
|
||||
var btn = $(this);
|
||||
|
||||
Reference in New Issue
Block a user