永久会员与模板库后台化:预览门控、轻量首页与 Admin CRUD
- 会员改为永久激活方案;云端文件不再拦截非会员;预览弹窗内导出/打印才校验 - 首页最近文件支持本地记录,登录后与云端合并;移除独立会员页与订阅页 - 模板库入库管理:soon_templates 表、Admin 上传 CRUD、/templates 轻量列表与按需下载 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -52,9 +52,7 @@ async function saveImageAsPNG(buffer) {
|
||||
}
|
||||
}
|
||||
|
||||
// 将 display_func 附加到 window 对象,确保全局可访问
|
||||
window.display_func = function display_func(img1, img2, img3) {
|
||||
if (typeof window.soonGuardMemberPreview === 'function' && !window.soonGuardMemberPreview()) return;
|
||||
$("#base_control").hide();
|
||||
$("#line_control").hide();
|
||||
$("#pic_control").hide();
|
||||
@@ -418,16 +416,33 @@ window.display_func = function display_func(img1, img2, img3) {
|
||||
</div>
|
||||
</div>`,
|
||||
btn: [language_str("output"), "打印"],//'导出'
|
||||
btn1: function (index, layero) {
|
||||
saveImageAsPNG(buffer);
|
||||
btn1: function () {
|
||||
if (typeof window.soonGuardPreviewDeliver === 'function') {
|
||||
window.soonGuardPreviewDeliver(language_str('output') || '导出', function () {
|
||||
saveImageAsPNG(buffer);
|
||||
});
|
||||
} else {
|
||||
saveImageAsPNG(buffer);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
btn2: function () {
|
||||
if (window.platformBridge && window.platformBridge.printPdf) {
|
||||
if (typeof window.soonGuardPreviewDeliver === 'function') {
|
||||
window.soonGuardPreviewDeliver('打印', function () {
|
||||
if (window.platformBridge && window.platformBridge.printPdf) {
|
||||
var blob = buffer instanceof Uint8Array ? new Blob([buffer], { type: 'image/png' }) : new Blob([buffer], { type: 'image/png' });
|
||||
window.platformBridge.printPdf(blob);
|
||||
} else if (typeof printJS === 'function') {
|
||||
printJS({ printable: url3, type: 'image', style: 'img { width: 100%; height: auto; }' });
|
||||
}
|
||||
});
|
||||
} else if (window.platformBridge && window.platformBridge.printPdf) {
|
||||
var blob = buffer instanceof Uint8Array ? new Blob([buffer], { type: 'image/png' }) : new Blob([buffer], { type: 'image/png' });
|
||||
window.platformBridge.printPdf(blob);
|
||||
} else if (typeof printJS === 'function') {
|
||||
printJS({ printable: url3, type: 'image', style: 'img { width: 100%; height: auto; }' });
|
||||
}
|
||||
return false;
|
||||
},
|
||||
end: function () {
|
||||
if (printBlobUrl) try { URL.revokeObjectURL(printBlobUrl); } catch (e) {}
|
||||
@@ -456,7 +471,6 @@ window.display_func = function display_func(img1, img2, img3) {
|
||||
|
||||
// 将 output 附加到 window 对象,确保全局可访问
|
||||
window.output = function output(callback = null, _save = save) {
|
||||
if (typeof window.soonGuardMemberExport === 'function' && !window.soonGuardMemberExport()) return;
|
||||
// 类型改变
|
||||
fabric.Image.fromURL(soonAsset('op_1.png'), function (i1) {
|
||||
i1.left = background_image.left;
|
||||
@@ -1395,7 +1409,6 @@ function save(op1, callback) {
|
||||
}
|
||||
|
||||
window.saveHistory = function saveHistory() {
|
||||
if (typeof window.soonIsWebPortal === 'function' && window.soonIsWebPortal()) return;
|
||||
function doWrite(j) {
|
||||
var currentPath = openAs.name;
|
||||
if (!currentPath) return;
|
||||
|
||||
@@ -1355,7 +1355,6 @@ $("#open").click(function () {
|
||||
OpenDialog();
|
||||
});
|
||||
function OpenDialog() {
|
||||
if (typeof window.soonRequireLogin === 'function' && !window.soonRequireLogin('打开文件')) return;
|
||||
var dialogApi = (typeof dialog !== 'undefined' && dialog) ? dialog : (window.platformBridge && window.platformBridge.showOpenDialog ? { showOpenDialog: function(opts) { return window.platformBridge.showOpenDialog(opts); } } : null);
|
||||
if (!dialogApi) return;
|
||||
dialogApi.showOpenDialog({
|
||||
@@ -1376,6 +1375,14 @@ $("#open").click(function () {
|
||||
}
|
||||
}
|
||||
function importAndOpen(j, fileName) {
|
||||
var tok = typeof window.soonGetAccessToken === 'function'
|
||||
? window.soonGetAccessToken()
|
||||
: (localStorage.getItem('soon_access') || '');
|
||||
if (!tok && typeof window.soonPutSoonSession === 'function') {
|
||||
var localKey = window.soonPutSoonSession(j, fileName || 'design.soon');
|
||||
if (localKey) openWithKey(localKey, j);
|
||||
return;
|
||||
}
|
||||
if (!window.platformBridge || !window.platformBridge.importSoonFile) return;
|
||||
window.platformBridge.importSoonFile(fileName || 'design.soon', j).then(function(res) {
|
||||
if (res && res.fileKey) openWithKey(res.fileKey, j);
|
||||
@@ -2365,7 +2372,6 @@ $("#help").click(function() {
|
||||
|
||||
// ===========================================================
|
||||
$('#display').on('click', function () {
|
||||
if (typeof window.soonGuardMemberPreview === 'function' && !window.soonGuardMemberPreview()) return;
|
||||
// 类型改变
|
||||
fabric.Image.fromURL(soonAsset('front_bg') + bg_version + '_1.png', function (i1) {
|
||||
i1.left = background_image.left;
|
||||
|
||||
Reference in New Issue
Block a user