永久会员与模板库后台化:预览门控、轻量首页与 Admin CRUD
- 会员改为永久激活方案;云端文件不再拦截非会员;预览弹窗内导出/打印才校验 - 首页最近文件支持本地记录,登录后与云端合并;移除独立会员页与订阅页 - 模板库入库管理:soon_templates 表、Admin 上传 CRUD、/templates 轻量列表与按需下载 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
// 将 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()
|
||||
@@ -356,29 +354,55 @@ window.display_func = function display_func(img1, img2, img3) {
|
||||
</div>
|
||||
</div>`,
|
||||
btn: btns, //'导出'
|
||||
btn1: function (index, layero) {
|
||||
if (typeof window.savePdf === 'function') {
|
||||
btn1: function () {
|
||||
if (typeof window.soonGuardPreviewDeliver === 'function') {
|
||||
window.soonGuardPreviewDeliver('导出', function () {
|
||||
if (typeof window.savePdf === 'function') window.savePdf(pdfBlob);
|
||||
});
|
||||
} else if (typeof window.savePdf === 'function') {
|
||||
window.savePdf(pdfBlob);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
btn2: function () {
|
||||
if (window.platformBridge && window.platformBridge.printPdf && (printPath3.indexOf('data:') === 0 || printPath4.indexOf('data:') === 0)) {
|
||||
if (typeof window.soonGuardPreviewDeliver === 'function') {
|
||||
window.soonGuardPreviewDeliver('打印', function () {
|
||||
if (window.platformBridge && window.platformBridge.printPdf && (printPath3.indexOf('data:') === 0 || printPath4.indexOf('data:') === 0)) {
|
||||
if (btns[1] === '打印正面') window.platformBridge.printPdf(pdfBlob);
|
||||
else if (btns[1] === '打印背面') window.platformBridge.printPdf(pdfBlob);
|
||||
return;
|
||||
}
|
||||
if (btns[1] === '打印正面') {
|
||||
printJS({ printable: printPath3, type: 'image', style: 'img { width: 100%; height: auto; }' });
|
||||
} else if (btns[1] === '打印背面') {
|
||||
printJS({ printable: printPath4, type: 'image', style: 'img { width: 100%; height: auto; }' });
|
||||
}
|
||||
});
|
||||
} else if (window.platformBridge && window.platformBridge.printPdf && (printPath3.indexOf('data:') === 0 || printPath4.indexOf('data:') === 0)) {
|
||||
if (btns[1] === '打印正面') window.platformBridge.printPdf(pdfBlob);
|
||||
else if (btns[1] === '打印背面') window.platformBridge.printPdf(pdfBlob);
|
||||
return;
|
||||
}
|
||||
if (btns[1] === '打印正面') {
|
||||
} else if (btns[1] === '打印正面') {
|
||||
printJS({ printable: printPath3, type: 'image', style: 'img { width: 100%; height: auto; }' });
|
||||
} else if (btns[1] === '打印背面') {
|
||||
printJS({ printable: printPath4, type: 'image', style: 'img { width: 100%; height: auto; }' });
|
||||
}
|
||||
return false;
|
||||
},
|
||||
btn3: function () {
|
||||
if (window.platformBridge && window.platformBridge.printPdf) {
|
||||
if (typeof window.soonGuardPreviewDeliver === 'function') {
|
||||
window.soonGuardPreviewDeliver('打印', function () {
|
||||
if (window.platformBridge && window.platformBridge.printPdf) {
|
||||
window.platformBridge.printPdf(pdfBlob);
|
||||
return;
|
||||
}
|
||||
printJS({ printable: printPath4, type: 'image', style: 'img { width: 100%; height: auto; }' });
|
||||
});
|
||||
} else if (window.platformBridge && window.platformBridge.printPdf) {
|
||||
window.platformBridge.printPdf(pdfBlob);
|
||||
return;
|
||||
} else {
|
||||
printJS({ printable: printPath4, type: 'image', style: 'img { width: 100%; height: auto; }' });
|
||||
}
|
||||
printJS({ printable: printPath4, type: 'image', style: 'img { width: 100%; height: auto; }' });
|
||||
return false;
|
||||
},
|
||||
end: function () {
|
||||
// 预览窗口关闭后,恢复所有对象的 selectable 和 evented 状态
|
||||
@@ -406,7 +430,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_2.png'), function (i1) {
|
||||
i1.left = background_image.left
|
||||
@@ -1215,7 +1238,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;
|
||||
|
||||
@@ -1311,7 +1311,6 @@ $('#open').click(function () {
|
||||
}
|
||||
)
|
||||
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({ title: '请选择文件', buttonLabel: language_str('comf'), filters: [{ name: 'Soon File Type', extensions: ['soon'] }] })
|
||||
@@ -1327,6 +1326,14 @@ $('#open').click(function () {
|
||||
if (typeof window.openFile === 'function') window.openFile(fileKey, j);
|
||||
}
|
||||
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);
|
||||
@@ -2694,7 +2701,6 @@ $("#help").click(function() {
|
||||
|
||||
// ===========================================================
|
||||
$('#display').off('click').on('click', function () {
|
||||
if (typeof window.soonGuardMemberPreview === 'function' && !window.soonGuardMemberPreview()) return;
|
||||
// 类型改变
|
||||
fabric.Image.fromURL(soonAsset('front_bg') + bg_version + '_2.png', function (i1) {
|
||||
i1.left = background_image.left
|
||||
|
||||
Reference in New Issue
Block a user