From 910edcb04731501f0b9ec335f03c00af017f17fb Mon Sep 17 00:00:00 2001 From: zhuyu Date: Tue, 27 May 2025 09:30:20 +0800 Subject: [PATCH] =?UTF-8?q?feature:=20=E9=9D=A2=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/view/dashboard/task.html | 68 ++++++++++++++++--- .../admin/view/dashboard/task_complete.html | 5 +- public/assets/js/backend/dashboard.js | 34 ++++++++++ 3 files changed, 96 insertions(+), 11 deletions(-) diff --git a/application/admin/view/dashboard/task.html b/application/admin/view/dashboard/task.html index d0f4c27..ad0e281 100644 --- a/application/admin/view/dashboard/task.html +++ b/application/admin/view/dashboard/task.html @@ -30,6 +30,7 @@ /* 卡片样式 */ .card { + position: relative; /* ✅ 这行是关键,必须有 */ background: #fff; border: 1px solid #e0e4e8; border-radius: 6px; @@ -40,6 +41,7 @@ gap: 8px; transition: transform .15s ease, box-shadow .15s ease; } + .card:hover { transform: translateY(-2px); box-shadow: 0 6px 12px rgba(0, 0, 0, .08); @@ -67,6 +69,27 @@ color: #999; } + /* 状态角标 */ + .badge { + position: absolute; + top: 8px; + right: 8px; + font-size: 12px; + padding: 2px 8px; + border-radius: 12px; + color: white; + background-color: #999; + z-index: 1; /* 避免被遮挡 */ + } + + /* 按状态区分颜色 */ + .status-1 { background-color: #f39c12; } /* 待完成 - 橙色 */ + .status-2 { background-color: #2ecc71; } /* 已完成 - 绿色 */ + .status-3 { background-color: #3498db; } /* 待审核 - 蓝色 */ + .status-4 { background-color: #1abc9c; } /* 已通过 - 青色 */ + .status-5 { background-color: #e74c3c; } /* 已驳回 - 红色 */ + .status-6 { background-color: #9b59b6; } /* 待执行 - 紫色 */ + /* 响应式:小屏变成1列 */ @media (max-width: 1024px) { .dashboard { @@ -92,11 +115,20 @@

每日任务

{if $day} {foreach $day as $item} - {if $item->status != 1} -
- {else} + {if $item->status == 1 || $item->status == 5}
+ {else} +
{/if} +
+ {if $item.status == 1}待完成 + {elseif $item.status == 2}已完成 + {elseif $item.status == 3}待审核 + {elseif $item.status == 4}已通过 + {elseif $item.status == 5}已驳回 + {elseif $item.status == 6}待执行 + {/if} +
{$item->title}
{$item->desc}
@@ -111,11 +143,20 @@

每周任务

{if $week} {foreach $week as $item} - {if $item->status != 1} -
- {else} + {if $item->status == 1 || $item->status == 5}
+ {else} +
{/if} +
+ {if $item.status == 1}待完成 + {elseif $item.status == 2}已完成 + {elseif $item.status == 3}待审核 + {elseif $item.status == 4}已通过 + {elseif $item.status == 5}已驳回 + {elseif $item.status == 6}待执行 + {/if} +
{$item->title}
{$item->desc}
@@ -130,11 +171,20 @@

每月任务

{if $month} {foreach $month as $item} - {if $item->status != 1} -
- {else} + {if $item->status == 1 || $item->status == 5}
+ {else} +
{/if} +
+ {if $item.status == 1}待完成 + {elseif $item.status == 2}已完成 + {elseif $item.status == 3}待审核 + {elseif $item.status == 4}已通过 + {elseif $item.status == 5}已驳回 + {elseif $item.status == 6}待执行 + {/if} +
{$item->title}
{$item->desc}
diff --git a/application/admin/view/dashboard/task_complete.html b/application/admin/view/dashboard/task_complete.html index 7938865..4b8b140 100644 --- a/application/admin/view/dashboard/task_complete.html +++ b/application/admin/view/dashboard/task_complete.html @@ -16,7 +16,7 @@
- +
@@ -24,9 +24,10 @@
- +
+ 预览
diff --git a/public/assets/js/backend/dashboard.js b/public/assets/js/backend/dashboard.js index 532506d..6544131 100755 --- a/public/assets/js/backend/dashboard.js +++ b/public/assets/js/backend/dashboard.js @@ -96,6 +96,40 @@ define(['jquery', 'bootstrap', 'backend', 'addtabs', 'table', 'echarts', 'echart }, task_complete: function () { + + + $(document).on('click', '.btn-preview', function (e) { + e.preventDefault(); + var fileType = $(this).data('type'); // 自动从 data-type 获取,比如 pdf, jpg, doc + var url = $(this).data('url'); + + if (fileType === 'pdf') { + Layer.open({ + type: 2, + title: '预览PDF文件', + area: ['80%', '80%'], + content: url + }); + } else if (['jpg', 'jpeg', 'png', 'gif', 'webp'].includes(fileType)) { + Layer.photos({ + photos: { + "title": "图片预览", + "data": [{"src": url}] + }, + anim: 5 + }); + } else if (['mp4', 'webm', 'ogg'].includes(fileType)) { + Layer.open({ + type: 1, + title: '视频预览', + area: ['800px', '500px'], + content: `` + }); + } else { + window.open(url, '_blank'); + } + }); + Form.api.bindevent($("form[role=form]"), function(data, ret){ //这里是表单提交处理成功后的回调函数,接收来自php的返回数据 Fast.api.close(data);//这里是重点