Files
WXProgram/miniprogram/pages/index/modules/adminModule.ts
2025-10-21 21:51:51 +08:00

72 lines
1.7 KiB
TypeScript

// 管理员模块 - 专门处理管理员相关功能
import { showToast } from '../../utils/helpers';
import { DataModule } from './dataModule';
export class AdminModule {
private pageContext: any;
private dataModule: DataModule;
constructor(pageContext: any, dataModule: DataModule) {
this.pageContext = pageContext;
this.dataModule = dataModule;
}
/**
* 处理管理员标记点点击
*/
onAdminMarkerClick(admin: any, position: { x: number, y: number }): void {
console.log('管理员被点击:', admin);
// 显示管理员详情面板
this.showAdminPanel(admin, position);
}
/**
* 显示管理员详情面板
*/
private showAdminPanel(admin: any, position: { x: number, y: number }): void {
console.log('显示管理员详情面板:', admin);
// 设置当前管理员
this.dataModule.setCurrentDeliveryPerson(admin);
// 显示面板
this.dataModule.toggleDeliveryPersonModal(true, 'bottom');
}
/**
* 隐藏管理员详情面板
*/
hideAdminPanel(): void {
this.dataModule.toggleDeliveryPersonModal(false);
this.dataModule.setCurrentDeliveryPerson(null);
}
/**
* 展开管理员详情面板
*/
expandAdminPanel(): void {
this.dataModule.toggleDeliveryPersonModal(true, 'full');
}
/**
* 收起管理员详情面板
*/
collapseAdminPanel(): void {
this.dataModule.toggleDeliveryPersonModal(true, 'bottom');
}
/**
* 获取管理员信息摘要
*/
getAdminSummary(admin: any): string {
return `${admin.name || '管理员'} - ${admin.role || 'ADMIN'}`;
}
/**
* 清理资源
*/
cleanup(): void {
console.log('清理管理员模块资源');
}
}