diff --git a/code/app/app-rn4/src/app/money/(tabs)/_layout.tsx b/code/app/app-rn4/src/app/finance/(tabs)/_layout.tsx similarity index 100% rename from code/app/app-rn4/src/app/money/(tabs)/_layout.tsx rename to code/app/app-rn4/src/app/finance/(tabs)/_layout.tsx diff --git a/code/app/app-rn4/src/app/money/(tabs)/add/index.tsx b/code/app/app-rn4/src/app/finance/(tabs)/add/index.tsx similarity index 100% rename from code/app/app-rn4/src/app/money/(tabs)/add/index.tsx rename to code/app/app-rn4/src/app/finance/(tabs)/add/index.tsx diff --git a/code/app/app-rn4/src/app/money/(tabs)/ana/index.tsx b/code/app/app-rn4/src/app/finance/(tabs)/ana/index.tsx similarity index 100% rename from code/app/app-rn4/src/app/money/(tabs)/ana/index.tsx rename to code/app/app-rn4/src/app/finance/(tabs)/ana/index.tsx diff --git a/code/app/app-rn4/src/app/money/(tabs)/home/index.tsx b/code/app/app-rn4/src/app/finance/(tabs)/home/index.tsx similarity index 100% rename from code/app/app-rn4/src/app/money/(tabs)/home/index.tsx rename to code/app/app-rn4/src/app/finance/(tabs)/home/index.tsx diff --git a/code/app/app-rn4/src/app/money/sub/index.tsx b/code/app/app-rn4/src/app/finance/sub/index.tsx similarity index 100% rename from code/app/app-rn4/src/app/money/sub/index.tsx rename to code/app/app-rn4/src/app/finance/sub/index.tsx diff --git a/code/app/app-rn4/src/configs/pages.ts b/code/app/app-rn4/src/configs/pages.ts index 3ffaac38..405f7187 100644 --- a/code/app/app-rn4/src/configs/pages.ts +++ b/code/app/app-rn4/src/configs/pages.ts @@ -23,7 +23,7 @@ export type AppListItem = HeaderItem | GroupItem; export const SUB_APPS: SubAppItem[] = [ { - id: "/money/home", + id: "/finance/home", title: "记账", icon: IconAppFinance, group: "J", diff --git a/code/app/app-rn4/text.html b/code/app/app-rn4/text.html index 70d423f6..7039ad61 100644 --- a/code/app/app-rn4/text.html +++ b/code/app/app-rn4/text.html @@ -1,272 +1,264 @@ - - - 家庭系统 Pro Demo + +附件组件(最终版) - + +/* card */ +.card { + position: relative; + background: #fff; + border-radius: 10px; + border: 1px solid transparent; + display: flex; + flex-direction: column; + cursor: pointer; +} + +.card:hover { + border-color: #1677ff; +} + +.card.selected { + background: #eaf2ff; + border-color: #1677ff; +} + +/* checkbox(左上) */ +.check { + position: absolute; + top: 6px; + left: 6px; + z-index: 5; +} + +/* 状态(右上) */ +.status { + position: absolute; + top: 6px; + right: 6px; + background: #ff4d4f; + color: #fff; + font-size: 10px; + padding: 2px 5px; + border-radius: 3px; +} + +/* thumb */ +.thumb { + height: 90px; + background: #f0f2f5; + display:flex; + align-items:center; + justify-content:center; +} + +.thumb img { + width:100%; + height:100%; + object-fit:cover; +} + +/* info */ +.info { + padding: 8px; +} + +.name { + font-size: 13px; +} + +.meta { + font-size: 12px; + color: #888; +} + +/* actions */ +.actions { + display: flex; + border-top: 1px solid #eee; +} + +.actions button { + flex: 1; + border: none; + background: #fff; + padding: 6px 0; + cursor: pointer; + font-size: 12px; +} + +.actions button:hover { + background: #f5f6f8; +} + +.danger { + color: #ff4d4f; +} + +.more-menu { + position: absolute; + bottom: 35px; + right: 6px; + background: #fff; + border: 1px solid #eee; + border-radius: 6px; + box-shadow: 0 2px 8px rgba(0,0,0,0.1); + display: none; +} + +.more-menu div { + padding: 6px 10px; + cursor: pointer; +} + +.more-menu div:hover { + background: #f5f6f8; +} + - + -
+
- -
-
+ +function deleteFile(id) { + if (!confirm("确定删除?")) return; + const i = files.findIndex(f => f.id === id); + if (i > -1) files.splice(i, 1); + selected.delete(id); + render(); +} + +render(); + \ No newline at end of file diff --git a/code/file-preview/custom-file/index.js b/code/file-preview/custom-file/index.js index c92133aa..2be15b3b 100644 --- a/code/file-preview/custom-file/index.js +++ b/code/file-preview/custom-file/index.js @@ -1,5 +1,5 @@ (function ($) { - 'use strict'; + "use strict"; // ===================== @@ -236,7 +236,7 @@ // 生成唯一ID // ===================== generateUniqueId: function () { - return 'file_' + Math.random().toString(36).slice(2) + Date.now(); + return "file_" + Math.random().toString(36).slice(2) + Date.now(); }, // ===================== @@ -1146,10 +1146,10 @@ // 判断是否为图片文件 // ===================== isImageFile: function (filename) { - if (!filename || typeof filename !== 'string') return false; + if (!filename || typeof filename !== "string") return false; - const ext = filename.slice(filename.lastIndexOf('.') + 1).toLowerCase(); - const imageExts = new Set(['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp']); + const ext = filename.slice(filename.lastIndexOf(".") + 1).toLowerCase(); + const imageExts = new Set(["jpg", "jpeg", "png", "gif", "bmp", "webp"]); return imageExts.has(ext); }, @@ -1159,38 +1159,50 @@ // ===================== formatFileSize: function (bytes) { if (bytes === null || bytes === undefined || isNaN(bytes) || bytes <= 0) { - return '-'; + return "-"; } var k = 1024; - var sizes = ['B', 'KB', 'MB', 'GB', 'TB']; + var sizes = ["B", "KB", "MB", "GB", "TB"]; var i = Math.floor(Math.log(bytes) / Math.log(k)); i = Math.max(0, Math.min(i, sizes.length - 1)); - return (bytes / Math.pow(k, i)).toFixed(2) + ' ' + sizes[i]; + return (bytes / Math.pow(k, i)).toFixed(2) + " " + sizes[i]; }, // ===================== // 格式化日期 // ===================== formatDate: function (dateStr) { - if (!dateStr) return '-'; + if (!dateStr) return "-"; var date = new Date(dateStr); if (isNaN(date.getTime())) { - return '-'; + return "-"; } var year = date.getFullYear(); - var month = ('0' + (date.getMonth() + 1)).slice(-2); - var day = ('0' + date.getDate()).slice(-2); - var hours = ('0' + date.getHours()).slice(-2); - var minutes = ('0' + date.getMinutes()).slice(-2); - var seconds = ('0' + date.getSeconds()).slice(-2); + var month = ("0" + (date.getMonth() + 1)).slice(-2); + var day = ("0" + date.getDate()).slice(-2); + var hours = ("0" + date.getHours()).slice(-2); + var minutes = ("0" + date.getMinutes()).slice(-2); + var seconds = ("0" + date.getSeconds()).slice(-2); - return year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds; + return ( + year + + "-" + + month + + "-" + + day + + " " + + hours + + ":" + + minutes + + ":" + + seconds + ); }, // ===================== @@ -1201,7 +1213,7 @@ const downloadDisabled = !this.hasPermission(file, 'download'); const deleteDisabled = !this.hasPermission(file, 'delete'); - let content = ''; + let content = ""; if (this.isImageFile(file.name)) { content = ` @@ -1228,6 +1240,12 @@
`; + // 预览状态(使用class标识) + const isPreview = this.previewFiles.has(file._id); + + // 选中状态 + const isSelected = this.selectedFiles.has(file._id); + return `
@@ -1492,10 +1510,11 @@ $.fn.G3File = function (options) { var args = Array.prototype.slice.call(arguments, 1); var instance; + var methodResult; // 存储方法调用结果 this.each(function () { var $this = $(this); - instance = $this.data('G3File'); + instance = $this.data("G3File"); if (!instance) { instance = new G3File(this, options); @@ -1503,12 +1522,12 @@ } else if (typeof options === 'string') { var method = options; if (instance[method]) { - instance[method].apply(instance, args); + // 保存方法调用结果 + methodResult = instance[method].apply(instance, args); } } }); return instance || this; }; - -})(jQuery); \ No newline at end of file +})(jQuery); diff --git a/code/file-preview/test.html b/code/file-preview/test.html index 31e35c46..9ea7e812 100644 --- a/code/file-preview/test.html +++ b/code/file-preview/test.html @@ -202,4 +202,4 @@ - \ No newline at end of file +