2025-03-27 16:27:41 +08:00

70 lines
3.7 KiB
HTML

<div class="mb-6 flex justify-between items-center">
<h1 class="text-2xl font-bold text-gray-800">机器人列表</h1>
<a href="/admin/robots/new" class="bg-indigo-600 hover:bg-indigo-700 text-white py-2 px-4 rounded-md shadow-sm flex items-center">
<i class="fas fa-plus mr-2"></i> 新建机器人
</a>
</div>
<!-- 机器人卡片网格 -->
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
{{if .Robots}}
{{range .Robots}}
<div class="bg-white rounded-lg shadow-md overflow-hidden">
<div class="p-4 border-b">
<div class="flex items-center justify-between">
<h2 class="text-lg font-semibold text-gray-800">{{.Nickname}}</h2>
{{if eq .Status "online"}}
<span class="px-2 py-1 text-xs rounded-full bg-green-100 text-green-800">在线</span>
{{else if eq .Status "error"}}
<span class="px-2 py-1 text-xs rounded-full bg-red-100 text-red-800">错误</span>
{{else}}
<span class="px-2 py-1 text-xs rounded-full bg-gray-100 text-gray-800">离线</span>
{{end}}
</div>
</div>
<div class="p-4">
<div class="flex items-center mb-4">
{{if .Avatar}}
<img src="{{.Avatar}}" alt="{{.Nickname}}" class="w-16 h-16 rounded-full mr-4">
{{else}}
<div class="w-16 h-16 rounded-full bg-gray-200 flex items-center justify-center text-gray-500 mr-4">
<i class="fas fa-user text-2xl"></i>
</div>
{{end}}
<div>
<div class="text-sm text-gray-600 mb-1">容器ID: {{.ContainerID | slice 0 12}}</div>
{{if .WechatID}}
<div class="text-sm text-gray-600">微信ID: {{.WechatID}}</div>
{{else}}
<div class="text-sm text-gray-400">未登录微信</div>
{{end}}
</div>
</div>
<div class="flex justify-between">
<a href="/admin/robots/{{.ID}}" class="text-indigo-600 hover:text-indigo-800">
<i class="fas fa-info-circle mr-1"></i> 详情
</a>
{{if eq .Status "online"}}
<a href="/admin/robots/{{.ID}}/contacts" class="text-indigo-600 hover:text-indigo-800">
<i class="fas fa-address-book mr-1"></i> 联系人
</a>
{{else}}
<a href="/admin/robots/{{.ID}}/login" class="text-indigo-600 hover:text-indigo-800">
<i class="fas fa-sign-in-alt mr-1"></i> 登录
</a>
{{end}}
</div>
</div>
</div>
{{end}}
{{else}}
<div class="col-span-full flex flex-col items-center justify-center bg-white rounded-lg shadow-md p-8">
<i class="fas fa-robot text-5xl text-gray-300 mb-4"></i>
<p class="text-gray-500 mb-4">没有找到任何机器人</p>
<a href="/admin/robots/new" class="bg-indigo-600 hover:bg-indigo-700 text-white py-2 px-4 rounded-md">
创建第一个机器人
</a>
</div>
{{end}}
</div>