feat: 增强组件功能与样式优化

- 在多个组件中添加了新的属性和方法以提升功能性,如在卡片组件中引入 _ActiveTab 属性以管理活动标签。
- 优化了商品详情和商户页面的收藏逻辑,确保在未登录状态下引导用户登录。
- 更新了轮播组件的路由解析逻辑,增强了用户体验。
- 改进了投诉列表和收藏列表的样式,提升了响应式布局和可读性。
- 在全局配置中添加了对开发环境的错误处理,提升了调试体验。
This commit is contained in:
田香琪
2026-06-25 16:52:46 +08:00
parent 1b2e980fb6
commit ec948b5496
86 changed files with 1741 additions and 1050 deletions

View File

@@ -0,0 +1,35 @@
/**
* 打印指定 DOM 区域(替代 vue-print-nb)
*/
export function printElement(elementId, title = "打印") {
const el = document.getElementById(elementId);
if (!el) {
console.warn(`[print] element #${elementId} not found`);
return;
}
const iframe = document.createElement("iframe");
iframe.style.cssText = "position:fixed;right:0;bottom:0;width:0;height:0;border:0";
document.body.appendChild(iframe);
const doc = iframe.contentWindow.document;
doc.open();
doc.write(
`<!DOCTYPE html><html><head><title>${title}</title><style>
body{font-family:Arial,sans-serif;padding:12px;color:#333}
table{width:100%;border-collapse:collapse}
td,th{border:1px solid #ddd;padding:6px}
.lineH30{line-height:30px}
.f14{font-size:14px;color:#333}
.printgoodtitle{font-size:14px;line-height:1.5;margin-top:15px;color:#333}
.printgoodinfo{padding:10px}
.printgooditem{display:flex;justify-content:space-between;padding:8px 0;border-bottom:1px solid #eee}
.printgoodname{flex:1}
.printgoodguid{margin-top:4px;color:#666;font-size:12px}
.printgoodguiditem{margin-right:8px}
.printgoodnumber{white-space:nowrap;margin-left:12px}
</style></head><body>${el.innerHTML}</body></html>`
);
doc.close();
iframe.contentWindow.focus();
iframe.contentWindow.print();
setTimeout(() => document.body.removeChild(iframe), 1000);
}