Files
abot/admin/dashboard/templates/base.html

178 lines
7.0 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% block title %}机器人管理后台{% endblock %}</title>
<!-- 添加favicon -->
<link rel="icon" href="/static/favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="/static/favicon.ico" type="image/x-icon">
<!-- Element UI CSS -->
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<!-- 自定义样式 -->
<link rel="stylesheet" href="/static/css/style.css">
{% block head %}{% endblock %}
</head>
<body>
<div id="app">
<el-container>
<el-aside width="200px">
<el-menu
default-active="{{ request.path }}"
class="el-menu-vertical-demo"
background-color="#545c64"
text-color="#fff"
active-text-color="#ffd04b"
router>
<div class="logo">WeChatRobot</div>
<el-menu-item index="/">
<i class="el-icon-s-home"></i>
<span slot="title">首页概览</span>
</el-menu-item>
<el-menu-item index="/plugins">
<i class="el-icon-s-grid"></i>
<span slot="title">插件统计</span>
</el-menu-item>
<el-menu-item index="/users">
<i class="el-icon-user"></i>
<span slot="title">用户统计</span>
</el-menu-item>
<el-menu-item index="/groups">
<i class="el-icon-s-cooperation"></i>
<span slot="title">群组统计</span>
</el-menu-item>
<el-menu-item index="/errors">
<i class="el-icon-warning"></i>
<span slot="title">错误日志</span>
</el-menu-item>
<el-menu-item index="/robot_management">
<i class="el-icon-setting"></i>
<span slot="title">群机器人管理</span>
</el-menu-item>
</el-menu>
</el-aside>
<el-container>
<el-header>
<div class="header-title">{% block header_title %}机器人管理后台{% endblock %}</div>
<div class="header-actions">
<el-dropdown @command="handleCommand">
<span class="el-dropdown-link">
管理员<i class="el-icon-arrow-down el-icon--right"></i>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="logout">退出登录</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
</el-header>
<el-main>
<!-- 时间范围选择器 -->
<el-row :gutter="20" style="margin-bottom: 20px;">
<el-col :span="24">
<el-card shadow="hover">
<el-form :inline="true" size="small">
<el-form-item label="统计时间范围">
<el-select v-model="timeRange" @change="loadData">
<el-option label="最近7天" value="7"></el-option>
<el-option label="最近30天" value="30"></el-option>
<el-option label="最近90天" value="90"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="loadData">刷新数据</el-button>
</el-form-item>
</el-form>
</el-card>
</el-col>
</el-row>
{% block content %}{% endblock %}
</el-main>
<el-footer>
<div class="footer-content">
WeChatRobot © 2024 - 由 Trae AI 提供技术支持
</div>
</el-footer>
</el-container>
</el-container>
</div>
<!-- 先加载基础库 -->
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script>
<!-- 然后加载依赖库 -->
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js@3.9.1/dist/chart.min.js"></script>
<!-- 最后加载Element UI -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<!-- 添加基础样式 -->
<style>
.el-header {
background-color: #409EFF;
color: white;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 20px;
}
.el-footer {
background-color: #f5f7fa;
color: #606266;
text-align: center;
line-height: 60px;
}
.logo {
height: 60px;
line-height: 60px;
text-align: center;
color: white;
font-size: 20px;
font-weight: bold;
}
.el-dropdown-link {
color: white;
cursor: pointer;
}
.footer-content {
font-size: 14px;
}
.header-title {
font-size: 18px;
font-weight: bold;
}
</style>
<script>
var app = new Vue({
el: '#app',
data() {
return {
timeRange: '7'
}
},
methods: {
handleCommand(command) {
if (command === 'logout') {
window.location.href = '/logout';
}
},
loadData() {
// 由子组件实现
console.log('父组件loadData被调用时间范围:', this.timeRange);
// 不使用事件发射,而是直接调用子组件方法
if (window.pageComponent && typeof window.pageComponent.loadData === 'function') {
window.pageComponent.loadData(this.timeRange);
}
}
},
mounted() {
console.log('基础Vue实例已挂载');
}
});
// 导出Vue实例供子组件使用
window.baseApp = app;
</script>
{% block scripts %}{% endblock %}
</body>
</html>