This commit is contained in:
bwstudio
2025-10-20 07:11:14 +08:00
parent 78f6022827
commit 467b04e5b0
18 changed files with 10466 additions and 0 deletions
+289
View File
@@ -0,0 +1,289 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>图片收集小程序 - 原型汇总</title>
<!-- 引入Vue.js -->
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.min.js"></script>
<!-- 引入Element UI CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/element-ui@2.15.8/lib/theme-chalk/index.css">
<!-- 引入Element UI JavaScript -->
<script src="https://cdn.jsdelivr.net/npm/element-ui@2.15.8/lib/index.js"></script>
<!-- 引入Font Awesome -->
<link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
body {
margin: 0;
padding: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
.preview-container {
height: 70vh;
width: 100%;
border: 1px solid #e4e7ed;
border-radius: 4px;
overflow: hidden;
}
.preview-container iframe {
width: 100%;
height: 100%;
border: none;
}
.nav-item {
cursor: pointer;
padding: 10px;
border-radius: 4px;
transition: all 0.3s;
}
.nav-item:hover {
background-color: #f5f7fa;
}
.nav-item.active {
background-color: #ecf5ff;
color: #1989fa;
}
.role-badge {
margin-left: 5px;
}
</style>
</head>
<body>
<div id="app">
<el-container style="min-height: 100vh;">
<el-header style="background-color: #1989fa; color: white;">
<div style="display: flex; justify-content: space-between; align-items: center;">
<h1 style="margin: 0; font-size: 20px;">图片收集小程序界面原型</h1>
<div>
<el-tag type="success">版本 1.0</el-tag>
</div>
</div>
</el-header>
<el-container>
<el-aside width="250px" style="background-color: #f5f7fa; padding: 20px;">
<el-card>
<template #header>
<div class="card-header">
<span>页面导航</span>
</div>
</template>
<div style="margin-bottom: 20px;">
<h3 style="font-size: 16px; margin-bottom: 10px;">小程序页面</h3>
<div class="nav-item" :class="{active: activePage === 'login'}" @click="openPage('login')">
<i class="fa fa-sign-in mr-2"></i>登录页
</div>
<div class="nav-item" :class="{active: activePage === 'user-home'}" @click="openPage('user-home')">
<i class="fa fa-home mr-2"></i>普通用户首页
<el-tag size="small" type="primary" class="role-badge">用户</el-tag>
</div>
<div class="nav-item" :class="{active: activePage === 'dept-home'}" @click="openPage('dept-home')">
<i class="fa fa-home mr-2"></i>部门负责人首页
<el-tag size="small" type="warning" class="role-badge">部门</el-tag>
</div>
<div class="nav-item" :class="{active: activePage === 'admin-home'}" @click="openPage('admin-home')">
<i class="fa fa-home mr-2"></i>管理员/信息员首页
<el-tag size="small" type="danger" class="role-badge">管理员</el-tag>
</div>
<div class="nav-item" :class="{active: activePage === 'image-upload'}" @click="openPage('image-upload')">
<i class="fa fa-upload mr-2"></i>上传页
</div>
<div class="nav-item" :class="{active: activePage === 'image-detail'}" @click="openPage('image-detail')">
<i class="fa fa-image mr-2"></i>图片详情页
</div>
<div class="nav-item" :class="{active: activePage === 'message-list'}" @click="openPage('message-list')">
<i class="fa fa-list mr-2"></i>消息列表页
</div>
</div>
<div>
<h3 style="font-size: 16px; margin-bottom: 10px;">后台管理页面</h3>
<div class="nav-item" :class="{active: activePage === 'user-management'}" @click="openPage('后台管理页面/user-management')">
<i class="fa fa-users mr-2"></i>用户管理
</div>
<div class="nav-item" :class="{active: activePage === 'department-management'}" @click="openPage('后台管理页面/department-management')">
<i class="fa fa-building mr-2"></i>部门管理
</div>
<div class="nav-item" :class="{active: activePage === 'image-management'}" @click="openPage('后台管理页面/image-management')">
<i class="fa fa-picture-o mr-2"></i>图片管理
</div>
<div class="nav-item" :class="{active: activePage === 'task-management'}" @click="openPage('后台管理页面/task-management')">
<i class="fa fa-tasks mr-2"></i>任务管理
</div>
</div>
</el-card>
<el-card style="margin-top: 20px;">
<template #header>
<div class="card-header">
<span>用户角色说明</span>
</div>
</template>
<el-table :data="roles" style="width: 100%;">
<el-table-column prop="name" label="角色" width="80"></el-table-column>
<el-table-column prop="description" label="描述"></el-table-column>
</el-table>
</el-card>
</el-aside>
<el-main>
<el-card>
<template #header>
<div class="card-header">
<span>{{ currentPageTitle }}</span>
<el-button type="text" @click="refreshPreview" size="small">
<i class="fa fa-refresh"></i> 刷新
</el-button>
</div>
</template>
<div class="preview-container">
<iframe :src="currentPageUrl" ref="previewFrame"></iframe>
</div>
<div style="margin-top: 20px;">
<h3 style="font-size: 16px; margin-bottom: 10px;">页面说明</h3>
<el-descriptions :column="1" border>
<el-descriptions-item label="页面名称">{{ currentPageTitle }}</el-descriptions-item>
<el-descriptions-item label="文件路径">{{ currentPageUrl }}</el-descriptions-item>
<el-descriptions-item label="功能描述">{{ currentPageDescription }}</el-descriptions-item>
<el-descriptions-item label="适用角色">{{ currentPageRoles }}</el-descriptions-item>
</el-descriptions>
</div>
</el-card>
<el-card style="margin-top: 20px;">
<template #header>
<div class="card-header">
<span>更新日志</span>
</div>
</template>
<el-timeline>
<el-timeline-item timestamp="2023-10-01" placement="top">
<el-card>
<h4>版本 1.0</h4>
<p>初始原型版本,使用Element UI实现所有页面</p>
</el-card>
</el-timeline-item>
</el-timeline>
</el-card>
</el-main>
</el-container>
<el-footer style="text-align: center; padding: 20px; background-color: #f5f7fa;">
<p>© 2023 图片收集小程序原型设计</p>
</el-footer>
</el-container>
</div>
<script>
new Vue({
el: '#app',
data() {
return {
activePage: 'login',
currentPageUrl: '小程序页面/login.html',
currentPageTitle: '登录页',
currentPageDescription: '用户登录入口,支持手机号验证码登录',
currentPageRoles: '所有用户',
roles: [
{
name: '管理员',
description: '系统最高权限,管理用户、部门、任务等'
},
{
name: '信息员',
description: '管理任务,查看统计数据'
},
{
name: '部门负责人',
description: '审核部门内图片,查看部门数据'
},
{
name: '普通用户',
description: '上传图片,查看分配任务'
}
],
pageInfo: {
'login': {
title: '登录页',
description: '用户登录入口,支持手机号验证码登录',
roles: '所有用户'
},
'user-home': {
title: '普通用户首页',
description: '显示待完成任务、已上传图片列表和快速上传入口',
roles: '普通用户'
},
'dept-home': {
title: '部门负责人首页',
description: '显示部门待审核图片、部门统计和部门切换功能',
roles: '部门负责人'
},
'admin-home': {
title: '管理员/信息员首页',
description: '显示待处理任务、统计图表和任务进度查询入口',
roles: '管理员、信息员'
},
'image-upload': {
title: '上传页',
description: '支持图片选择、预览、信息填写和提交',
roles: '普通用户'
},
'image-detail': {
title: '图片详情页',
description: '显示图片大图、详细信息和操作按钮',
roles: '所有用户(权限不同显示不同操作)'
},
'message-list': {
title: '消息列表页',
description: '显示系统通知和消息',
roles: '所有用户'
},
'后台管理页面/user-management': {
title: '用户管理',
description: '管理系统用户,包括增删改查和角色分配',
roles: '管理员'
},
'后台管理页面/department-management': {
title: '部门管理',
description: '管理部门结构,支持部门树形展示和编辑',
roles: '管理员'
},
'后台管理页面/image-management': {
title: '图片管理',
description: '管理所有上传的图片,支持搜索、筛选和批量操作',
roles: '管理员、信息员'
},
'后台管理页面/task-management': {
title: '任务管理',
description: '管理系统任务,支持创建、编辑、删除和进度查询',
roles: '管理员、信息员'
}
}
}
},
methods: {
openPage(page) {
this.activePage = page;
this.currentPageUrl = page.includes('后台管理页面') ? page + '.html' : '小程序页面/' + page + '.html';
if (this.pageInfo[page]) {
this.currentPageTitle = this.pageInfo[page].title;
this.currentPageDescription = this.pageInfo[page].description;
this.currentPageRoles = this.pageInfo[page].roles;
}
},
refreshPreview() {
this.$refs.previewFrame.src = this.currentPageUrl;
}
},
mounted() {
// 确保所有原型文件都已创建
console.log('图片收集小程序原型汇总页面加载完成');
}
})
</script>
</body>
</html>
+332
View File
@@ -0,0 +1,332 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>后台管理系统 - 登录</title>
<!-- 引入Vue.js -->
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.min.js"></script>
<!-- 引入Element UI CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/element-ui@2.15.8/lib/theme-chalk/index.css">
<!-- 引入Element UI JavaScript -->
<script src="https://cdn.jsdelivr.net/npm/element-ui@2.15.8/lib/index.js"></script>
<!-- 引入Font Awesome -->
<link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
body {
margin: 0;
padding: 0;
height: 100vh;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
display: flex;
align-items: center;
justify-content: center;
}
.login-container {
width: 90%;
max-width: 400px;
background-color: white;
border-radius: 12px;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
overflow: hidden;
animation: fadeInUp 0.6s ease-out;
}
.login-header {
background-color: #1989fa;
color: white;
padding: 20px;
text-align: center;
}
.logo {
width: 60px;
height: 60px;
border-radius: 50%;
background-color: white;
margin: 0 auto 15px;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.logo-icon {
font-size: 32px;
color: #1989fa;
}
.title {
font-size: 20px;
font-weight: 600;
margin-bottom: 5px;
}
.subtitle {
font-size: 14px;
opacity: 0.9;
}
.login-body {
padding: 30px 25px;
}
.form-item {
margin-bottom: 20px;
}
.form-label {
display: block;
font-size: 14px;
font-weight: 500;
color: #303133;
margin-bottom: 8px;
}
.input-wrapper {
position: relative;
}
.input-icon {
position: absolute;
left: 12px;
top: 50%;
transform: translateY(-50%);
color: #909399;
font-size: 16px;
}
.form-input {
padding-left: 38px;
height: 40px;
border-radius: 6px;
}
.form-input::-webkit-input-placeholder {
color: #c0c4cc;
}
.form-input::-moz-placeholder {
color: #c0c4cc;
}
.form-input:-ms-input-placeholder {
color: #c0c4cc;
}
.options {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 25px;
}
.remember-me {
display: flex;
align-items: center;
font-size: 13px;
color: #606266;
}
.el-checkbox__label {
font-size: 13px;
color: #606266;
}
.forgot-password {
font-size: 13px;
color: #1989fa;
cursor: pointer;
}
.login-button {
width: 100%;
height: 40px;
font-size: 16px;
font-weight: 500;
border-radius: 6px;
}
.system-info {
text-align: center;
margin-top: 20px;
font-size: 12px;
color: #909399;
}
.version {
margin-top: 5px;
}
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(30px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.loading-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.5);
display: flex;
align-items: center;
justify-content: center;
z-index: 9999;
}
.loading-content {
background-color: white;
padding: 20px 30px;
border-radius: 8px;
text-align: center;
}
</style>
</head>
<body>
<div id="app">
<div class="login-container">
<!-- 登录头部 -->
<div class="login-header">
<div class="logo">
<i class="fa fa-tachometer logo-icon"></i>
</div>
<div class="title">图片收集系统</div>
<div class="subtitle">后台管理平台</div>
</div>
<!-- 登录表单 -->
<div class="login-body">
<form @submit.prevent="handleLogin">
<div class="form-item">
<div class="form-label">用户名</div>
<div class="input-wrapper">
<i class="fa fa-user input-icon"></i>
<el-input
v-model="loginForm.username"
class="form-input"
placeholder="请输入用户名"
autofocus
@keyup.enter.native="handleLogin"
></el-input>
</div>
</div>
<div class="form-item">
<div class="form-label">密码</div>
<div class="input-wrapper">
<i class="fa fa-lock input-icon"></i>
<el-input
v-model="loginForm.password"
class="form-input"
placeholder="请输入密码"
show-password
@keyup.enter.native="handleLogin"
></el-input>
</div>
</div>
<div class="options">
<div class="remember-me">
<el-checkbox v-model="loginForm.rememberMe">记住登录</el-checkbox>
</div>
<div class="forgot-password" @click="forgotPassword">忘记密码?</div>
</div>
<el-button
type="primary"
class="login-button"
@click="handleLogin"
:loading="loading"
>
登录
</el-button>
<div class="system-info">
<div>图片收集系统管理平台</div>
<div class="version">版本 1.0.0</div>
</div>
</form>
</div>
</div>
<!-- 加载遮罩层 -->
<transition name="fade">
<div v-if="loading" class="loading-overlay">
<div class="loading-content">
<el-loading-spinner></el-loading-spinner>
<div style="margin-top: 10px;">登录中...</div>
</div>
</div>
</transition>
</div>
<script>
new Vue({
el: '#app',
data() {
return {
loading: false,
loginForm: {
username: '',
password: '',
rememberMe: false
}
}
},
methods: {
// 处理登录
handleLogin() {
// 表单验证
if (!this.loginForm.username.trim()) {
this.$message.error('请输入用户名');
return;
}
if (!this.loginForm.password.trim()) {
this.$message.error('请输入密码');
return;
}
this.loading = true;
// 模拟登录请求
setTimeout(() => {
// 模拟成功登录
if (this.loginForm.username && this.loginForm.password) {
this.$message.success('登录成功');
// 保存登录状态(如果选择记住登录)
if (this.loginForm.rememberMe) {
localStorage.setItem('rememberedUser', this.loginForm.username);
} else {
localStorage.removeItem('rememberedUser');
}
// 跳转到部门管理页面
setTimeout(() => {
window.location.href = 'department-management.html';
}, 1000);
} else {
this.$message.error('用户名或密码错误');
this.loading = false;
}
}, 1500);
},
// 忘记密码
forgotPassword() {
this.$alert('请联系系统管理员重置密码', '忘记密码', {
confirmButtonText: '确定',
dangerouslyUseHTMLString: true
});
},
// 自动填充保存的用户名
fillRememberedUser() {
const rememberedUser = localStorage.getItem('rememberedUser');
if (rememberedUser) {
this.loginForm.username = rememberedUser;
this.loginForm.rememberMe = true;
}
}
},
mounted() {
// 尝试填充记住的用户名
this.fillRememberedUser();
// 添加键盘事件监听
document.addEventListener('keydown', (e) => {
if (e.key === 'Enter') {
this.handleLogin();
}
});
}
})
</script>
</body>
</html>
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,655 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>部门管理 - 图片收集系统</title>
<!-- 引入Vue.js -->
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.min.js"></script>
<!-- 引入Element UI CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/element-ui@2.15.8/lib/theme-chalk/index.css">
<!-- 引入Element UI JavaScript -->
<script src="https://cdn.jsdelivr.net/npm/element-ui@2.15.8/lib/index.js"></script>
<!-- 引入Font Awesome -->
<link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
body {
margin: 0;
padding: 0;
height: 100vh;
background-color: #f0f2f5;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
.container {
height: 100vh;
display: flex;
}
.sidebar {
width: 220px;
background-color: #001529;
color: white;
display: flex;
flex-direction: column;
}
.sidebar-header {
padding: 20px;
text-align: center;
border-bottom: 1px solid #1f2937;
}
.logo {
font-size: 20px;
font-weight: 600;
display: flex;
align-items: center;
justify-content: center;
}
.logo-icon {
margin-right: 8px;
font-size: 22px;
}
.menu-item {
padding: 15px 20px;
cursor: pointer;
transition: background-color 0.3s;
display: flex;
align-items: center;
}
.menu-item:hover {
background-color: #1f2937;
}
.menu-item.active {
background-color: #1989fa;
}
.menu-icon {
margin-right: 10px;
font-size: 16px;
}
.main-content {
flex: 1;
display: flex;
flex-direction: column;
overflow: hidden;
}
.header {
background-color: white;
padding: 15px 20px;
display: flex;
justify-content: space-between;
align-items: center;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.header-title {
font-size: 18px;
font-weight: 600;
color: #303133;
}
.header-actions {
display: flex;
align-items: center;
gap: 15px;
}
.user-info {
display: flex;
align-items: center;
}
.user-avatar {
width: 32px;
height: 32px;
border-radius: 50%;
background-color: #1989fa;
color: white;
display: flex;
align-items: center;
justify-content: center;
margin-right: 8px;
font-size: 14px;
}
.user-name {
color: #606266;
}
.content-wrapper {
flex: 1;
padding: 20px;
overflow-y: auto;
}
.card {
background-color: white;
border-radius: 8px;
padding: 20px;
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
margin-bottom: 20px;
}
.search-section {
display: flex;
gap: 15px;
margin-bottom: 20px;
}
.search-input {
width: 300px;
}
.table-wrapper {
overflow-x: auto;
}
.table-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
}
.table-title {
font-size: 16px;
font-weight: 600;
color: #303133;
}
.btn-primary {
background-color: #1989fa;
border-color: #1989fa;
}
.btn-primary:hover {
background-color: #409eff;
border-color: #409eff;
}
.operation-buttons {
display: flex;
gap: 8px;
}
.el-button {
padding: 6px 12px;
font-size: 14px;
}
.dialog-form-item {
margin-bottom: 20px;
}
.dialog-form-label {
font-weight: 500;
color: #303133;
margin-bottom: 8px;
font-size: 14px;
}
.status-badge {
padding: 4px 8px;
border-radius: 4px;
font-size: 12px;
}
.status-active {
background-color: #f0f9eb;
color: #67c23a;
}
.status-inactive {
background-color: #f5f7fa;
color: #909399;
}
.statistics-cards {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 20px;
margin-bottom: 20px;
}
.stat-card {
background-color: white;
border-radius: 8px;
padding: 20px;
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
display: flex;
align-items: center;
}
.stat-icon {
width: 48px;
height: 48px;
border-radius: 50%;
background-color: #ecf5ff;
color: #1989fa;
display: flex;
align-items: center;
justify-content: center;
font-size: 24px;
margin-right: 15px;
}
.stat-content {
flex: 1;
}
.stat-value {
font-size: 24px;
font-weight: 600;
color: #303133;
margin-bottom: 5px;
}
.stat-label {
font-size: 14px;
color: #909399;
}
.logout-btn {
cursor: pointer;
color: #606266;
transition: color 0.3s;
}
.logout-btn:hover {
color: #f56c6c;
}
</style>
</head>
<body>
<div id="app">
<div class="container">
<!-- 侧边栏 -->
<div class="sidebar">
<div class="sidebar-header">
<div class="logo">
<i class="fa fa-tachometer logo-icon"></i>
<span>管理平台</span>
</div>
</div>
<div class="menu-item active" @click="navigateTo('department')">
<i class="fa fa-building-o menu-icon"></i>
<span>部门管理</span>
</div>
<div class="menu-item" @click="navigateTo('user')">
<i class="fa fa-users menu-icon"></i>
<span>用户管理</span>
</div>
<div class="menu-item" @click="navigateTo('task')">
<i class="fa fa-tasks menu-icon"></i>
<span>任务管理</span>
</div>
<div class="menu-item" @click="navigateTo('image')">
<i class="fa fa-picture-o menu-icon"></i>
<span>图片管理</span>
</div>
</div>
<!-- 主内容区 -->
<div class="main-content">
<!-- 顶部导航栏 -->
<div class="header">
<div class="header-title">部门管理</div>
<div class="header-actions">
<div class="user-info">
<div class="user-avatar"></div>
<span class="user-name">系统管理员</span>
</div>
<div class="logout-btn" @click="handleLogout">
<i class="fa fa-sign-out"></i> 退出
</div>
</div>
</div>
<!-- 内容区域 -->
<div class="content-wrapper">
<!-- 统计卡片 -->
<div class="statistics-cards">
<div class="stat-card">
<div class="stat-icon">
<i class="fa fa-building"></i>
</div>
<div class="stat-content">
<div class="stat-value">{{ departmentStats.total }}</div>
<div class="stat-label">总部门数</div>
</div>
</div>
<div class="stat-card">
<div class="stat-icon" style="background-color: #f0f9eb; color: #67c23a;">
<i class="fa fa-check-circle"></i>
</div>
<div class="stat-content">
<div class="stat-value">{{ departmentStats.active }}</div>
<div class="stat-label">活跃部门</div>
</div>
</div>
<div class="stat-card">
<div class="stat-icon" style="background-color: #fef0f0; color: #f56c6c;">
<i class="fa fa-users"></i>
</div>
<div class="stat-content">
<div class="stat-value">{{ departmentStats.totalUsers }}</div>
<div class="stat-label">总用户数</div>
</div>
</div>
</div>
<!-- 搜索和操作区域 -->
<div class="card">
<div class="search-section">
<el-input
v-model="searchQuery"
placeholder="搜索部门名称"
prefix-icon="el-icon-search"
class="search-input"
></el-input>
<el-button
type="primary"
class="btn-primary"
@click="addDepartment"
>
<i class="fa fa-plus"></i> 新增部门
</el-button>
</div>
</div>
<!-- 部门列表 -->
<div class="card">
<div class="table-header">
<div class="table-title">部门列表</div>
</div>
<div class="table-wrapper">
<el-table :data="filteredDepartments" stripe style="width: 100%">
<el-table-column prop="id" label="部门ID" width="80"></el-table-column>
<el-table-column prop="name" label="部门名称" min-width="150"></el-table-column>
<el-table-column prop="manager" label="部门负责人" min-width="120"></el-table-column>
<el-table-column prop="userCount" label="用户数量" width="100"></el-table-column>
<el-table-column prop="createTime" label="创建时间" min-width="150">
<template slot-scope="scope">
{{ formatDate(scope.row.createTime) }}
</template>
</el-table-column>
<el-table-column prop="status" label="状态" width="100">
<template slot-scope="scope">
<span
class="status-badge"
:class="scope.row.status === 'active' ? 'status-active' : 'status-inactive'"
>
{{ scope.row.status === 'active' ? '活跃' : '禁用' }}
</span>
</template>
</el-table-column>
<el-table-column label="操作" width="180" fixed="right">
<template slot-scope="scope">
<div class="operation-buttons">
<el-button
type="primary"
size="small"
@click="editDepartment(scope.row)"
>
编辑
</el-button>
<el-button
type="danger"
size="small"
@click="deleteDepartment(scope.row.id)"
:disabled="scope.row.id === 1"
>
删除
</el-button>
</div>
</template>
</el-table-column>
</el-table>
</div>
</div>
</div>
</div>
</div>
<!-- 部门对话框 -->
<el-dialog
:title="dialogTitle"
:visible.sync="showDialog"
width="500px"
>
<div class="dialog-form-item">
<div class="dialog-form-label">部门名称</div>
<el-input
v-model="departmentForm.name"
placeholder="请输入部门名称"
></el-input>
</div>
<div class="dialog-form-item">
<div class="dialog-form-label">部门负责人</div>
<el-select
v-model="departmentForm.manager"
placeholder="请选择部门负责人"
>
<el-option
v-for="user in availableManagers"
:key="user.id"
:label="user.name"
:value="user.name"
></el-option>
</el-select>
</div>
<div class="dialog-form-item">
<div class="dialog-form-label">部门状态</div>
<el-radio-group v-model="departmentForm.status">
<el-radio label="active">活跃</el-radio>
<el-radio label="inactive">禁用</el-radio>
</el-radio-group>
</div>
<div slot="footer">
<el-button @click="showDialog = false">取消</el-button>
<el-button
type="primary"
@click="saveDepartment"
:loading="saving"
>
保存
</el-button>
</div>
</el-dialog>
</div>
<script>
new Vue({
el: '#app',
data() {
return {
searchQuery: '',
showDialog: false,
dialogTitle: '新增部门',
saving: false,
departments: [
{
id: 1,
name: '技术部',
manager: '张经理',
userCount: 15,
createTime: '2023-01-15',
status: 'active'
},
{
id: 2,
name: '市场部',
manager: '李经理',
userCount: 12,
createTime: '2023-01-20',
status: 'active'
},
{
id: 3,
name: '人力资源部',
manager: '王经理',
userCount: 5,
createTime: '2023-02-05',
status: 'active'
},
{
id: 4,
name: '财务部',
manager: '赵经理',
userCount: 8,
createTime: '2023-02-10',
status: 'active'
},
{
id: 5,
name: '行政部',
manager: '刘经理',
userCount: 6,
createTime: '2023-03-01',
status: 'inactive'
}
],
departmentForm: {
id: '',
name: '',
manager: '',
status: 'active'
},
availableManagers: [
{ id: 1, name: '张经理' },
{ id: 2, name: '李经理' },
{ id: 3, name: '王经理' },
{ id: 4, name: '赵经理' },
{ id: 5, name: '刘经理' }
],
departmentStats: {
total: 5,
active: 4,
totalUsers: 46
}
}
},
computed: {
filteredDepartments() {
if (!this.searchQuery) {
return this.departments;
}
const query = this.searchQuery.toLowerCase();
return this.departments.filter(dept =>
dept.name.toLowerCase().includes(query) ||
dept.manager.toLowerCase().includes(query)
);
}
},
methods: {
// 导航到其他页面
navigateTo(page) {
let url = '';
switch (page) {
case 'department':
url = 'department-management.html';
break;
case 'user':
url = 'user-management.html';
break;
case 'task':
url = 'task-management.html';
break;
case 'image':
url = 'image-management.html';
break;
}
if (url && url !== window.location.pathname) {
window.location.href = url;
}
},
// 格式化日期
formatDate(dateStr) {
return dateStr;
},
// 新增部门
addDepartment() {
this.dialogTitle = '新增部门';
this.departmentForm = {
id: '',
name: '',
manager: '',
status: 'active'
};
this.showDialog = true;
},
// 编辑部门
editDepartment(department) {
this.dialogTitle = '编辑部门';
this.departmentForm = { ...department };
this.showDialog = true;
},
// 保存部门
saveDepartment() {
// 表单验证
if (!this.departmentForm.name.trim()) {
this.$message.error('请输入部门名称');
return;
}
if (!this.departmentForm.manager) {
this.$message.error('请选择部门负责人');
return;
}
this.saving = true;
// 模拟保存操作
setTimeout(() => {
if (this.departmentForm.id) {
// 编辑现有部门
const index = this.departments.findIndex(d => d.id === this.departmentForm.id);
if (index > -1) {
this.departments[index] = { ...this.departmentForm };
this.$message.success('部门信息已更新');
}
} else {
// 添加新部门
const newId = Math.max(...this.departments.map(d => d.id), 0) + 1;
const newDepartment = {
...this.departmentForm,
id: newId,
userCount: 0,
createTime: new Date().toISOString().split('T')[0]
};
this.departments.unshift(newDepartment);
this.departmentStats.total++;
if (newDepartment.status === 'active') {
this.departmentStats.active++;
}
this.$message.success('部门已创建');
}
this.saving = false;
this.showDialog = false;
}, 1000);
},
// 删除部门
deleteDepartment(id) {
if (id === 1) {
this.$message.warning('默认部门不能删除');
return;
}
this.$confirm(`确定要删除该部门吗?删除后将无法恢复。`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const index = this.departments.findIndex(d => d.id === id);
if (index > -1) {
const department = this.departments[index];
this.departments.splice(index, 1);
this.departmentStats.total--;
if (department.status === 'active') {
this.departmentStats.active--;
}
this.departmentStats.totalUsers -= department.userCount;
this.$message.success('部门已删除');
}
}).catch(() => {
// 取消删除
});
},
// 处理退出登录
handleLogout() {
this.$confirm('确定要退出登录吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$message.success('退出成功');
setTimeout(() => {
window.location.href = 'admin-login.html';
}, 1000);
}).catch(() => {
// 取消退出
});
}
}
})
</script>
</body>
</html>
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,942 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>用户管理 - 图片收集系统</title>
<!-- 引入Vue.js -->
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.min.js"></script>
<!-- 引入Element UI CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/element-ui@2.15.8/lib/theme-chalk/index.css">
<!-- 引入Element UI JavaScript -->
<script src="https://cdn.jsdelivr.net/npm/element-ui@2.15.8/lib/index.js"></script>
<!-- 引入Font Awesome -->
<link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
body {
margin: 0;
padding: 0;
height: 100vh;
background-color: #f0f2f5;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
.container {
height: 100vh;
display: flex;
}
.sidebar {
width: 220px;
background-color: #001529;
color: white;
display: flex;
flex-direction: column;
}
.sidebar-header {
padding: 20px;
text-align: center;
border-bottom: 1px solid #1f2937;
}
.logo {
font-size: 20px;
font-weight: 600;
display: flex;
align-items: center;
justify-content: center;
}
.logo-icon {
margin-right: 8px;
font-size: 22px;
}
.menu-item {
padding: 15px 20px;
cursor: pointer;
transition: background-color 0.3s;
display: flex;
align-items: center;
}
.menu-item:hover {
background-color: #1f2937;
}
.menu-item.active {
background-color: #1989fa;
}
.menu-icon {
margin-right: 10px;
font-size: 16px;
}
.main-content {
flex: 1;
display: flex;
flex-direction: column;
overflow: hidden;
}
.header {
background-color: white;
padding: 15px 20px;
display: flex;
justify-content: space-between;
align-items: center;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.header-title {
font-size: 18px;
font-weight: 600;
color: #303133;
}
.header-actions {
display: flex;
align-items: center;
gap: 15px;
}
.user-info {
display: flex;
align-items: center;
}
.user-avatar {
width: 32px;
height: 32px;
border-radius: 50%;
background-color: #1989fa;
color: white;
display: flex;
align-items: center;
justify-content: center;
margin-right: 8px;
font-size: 14px;
}
.user-name {
color: #606266;
}
.content-wrapper {
flex: 1;
padding: 20px;
overflow-y: auto;
}
.card {
background-color: white;
border-radius: 8px;
padding: 20px;
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
margin-bottom: 20px;
}
.search-section {
display: flex;
gap: 15px;
margin-bottom: 20px;
}
.search-input {
width: 250px;
}
.department-select {
width: 200px;
}
.table-wrapper {
overflow-x: auto;
}
.table-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
}
.table-title {
font-size: 16px;
font-weight: 600;
color: #303133;
}
.btn-primary {
background-color: #1989fa;
border-color: #1989fa;
}
.btn-primary:hover {
background-color: #409eff;
border-color: #409eff;
}
.operation-buttons {
display: flex;
gap: 8px;
}
.el-button {
padding: 6px 12px;
font-size: 14px;
}
.dialog-form-item {
margin-bottom: 20px;
}
.dialog-form-label {
font-weight: 500;
color: #303133;
margin-bottom: 8px;
font-size: 14px;
}
.status-badge {
padding: 4px 8px;
border-radius: 4px;
font-size: 12px;
}
.status-active {
background-color: #f0f9eb;
color: #67c23a;
}
.status-inactive {
background-color: #f5f7fa;
color: #909399;
}
.role-badge {
padding: 4px 8px;
border-radius: 4px;
font-size: 12px;
}
.role-admin {
background-color: #fef0f0;
color: #f56c6c;
}
.role-manager {
background-color: #f0f5ff;
color: #409eff;
}
.role-user {
background-color: #f0f9eb;
color: #67c23a;
}
.statistics-cards {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 20px;
margin-bottom: 20px;
}
.stat-card {
background-color: white;
border-radius: 8px;
padding: 20px;
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
display: flex;
align-items: center;
}
.stat-icon {
width: 48px;
height: 48px;
border-radius: 50%;
background-color: #ecf5ff;
color: #1989fa;
display: flex;
align-items: center;
justify-content: center;
font-size: 24px;
margin-right: 15px;
}
.stat-content {
flex: 1;
}
.stat-value {
font-size: 24px;
font-weight: 600;
color: #303133;
margin-bottom: 5px;
}
.stat-label {
font-size: 14px;
color: #909399;
}
.logout-btn {
cursor: pointer;
color: #606266;
transition: color 0.3s;
}
.logout-btn:hover {
color: #f56c6c;
}
.avatar-preview {
width: 80px;
height: 80px;
border-radius: 50%;
object-fit: cover;
border: 2px solid #dcdfe6;
margin: 0 auto 15px;
display: block;
}
.avatar-uploader {
text-align: center;
}
.password-toggle {
cursor: pointer;
margin-left: 5px;
color: #909399;
}
.password-toggle:hover {
color: #1989fa;
}
</style>
</head>
<body>
<div id="app">
<div class="container">
<!-- 侧边栏 -->
<div class="sidebar">
<div class="sidebar-header">
<div class="logo">
<i class="fa fa-tachometer logo-icon"></i>
<span>管理平台</span>
</div>
</div>
<div class="menu-item" @click="navigateTo('department')">
<i class="fa fa-building-o menu-icon"></i>
<span>部门管理</span>
</div>
<div class="menu-item active" @click="navigateTo('user')">
<i class="fa fa-users menu-icon"></i>
<span>用户管理</span>
</div>
<div class="menu-item" @click="navigateTo('task')">
<i class="fa fa-tasks menu-icon"></i>
<span>任务管理</span>
</div>
<div class="menu-item" @click="navigateTo('image')">
<i class="fa fa-picture-o menu-icon"></i>
<span>图片管理</span>
</div>
</div>
<!-- 主内容区 -->
<div class="main-content">
<!-- 顶部导航栏 -->
<div class="header">
<div class="header-title">用户管理</div>
<div class="header-actions">
<div class="user-info">
<div class="user-avatar"></div>
<span class="user-name">系统管理员</span>
</div>
<div class="logout-btn" @click="handleLogout">
<i class="fa fa-sign-out"></i> 退出
</div>
</div>
</div>
<!-- 内容区域 -->
<div class="content-wrapper">
<!-- 统计卡片 -->
<div class="statistics-cards">
<div class="stat-card">
<div class="stat-icon">
<i class="fa fa-user"></i>
</div>
<div class="stat-content">
<div class="stat-value">{{ userStats.total }}</div>
<div class="stat-label">总用户数</div>
</div>
</div>
<div class="stat-card">
<div class="stat-icon" style="background-color: #f0f9eb; color: #67c23a;">
<i class="fa fa-check-circle"></i>
</div>
<div class="stat-content">
<div class="stat-value">{{ userStats.active }}</div>
<div class="stat-label">活跃用户</div>
</div>
</div>
<div class="stat-card">
<div class="stat-icon" style="background-color: #fef0f0; color: #f56c6c;">
<i class="fa fa-user-circle"></i>
</div>
<div class="stat-content">
<div class="stat-value">{{ userStats.admins }}</div>
<div class="stat-label">管理员</div>
</div>
</div>
<div class="stat-card">
<div class="stat-icon" style="background-color: #e6f7ff; color: #1890ff;">
<i class="fa fa-id-card"></i>
</div>
<div class="stat-content">
<div class="stat-value">{{ userStats.managers }}</div>
<div class="stat-label">部门负责人</div>
</div>
</div>
</div>
<!-- 搜索和操作区域 -->
<div class="card">
<div class="search-section">
<el-input
v-model="searchQuery"
placeholder="搜索用户名或姓名"
prefix-icon="el-icon-search"
class="search-input"
></el-input>
<el-select
v-model="departmentFilter"
placeholder="选择部门"
class="department-select"
clearable
>
<el-option
v-for="dept in departments"
:key="dept.id"
:label="dept.name"
:value="dept.id"
></el-option>
</el-select>
<el-select
v-model="roleFilter"
placeholder="选择角色"
class="department-select"
clearable
>
<el-option label="管理员" value="admin"></el-option>
<el-option label="部门负责人" value="dept_manager"></el-option>
<el-option label="普通用户" value="user"></el-option>
</el-select>
<el-button
type="primary"
class="btn-primary"
@click="addUser"
>
<i class="fa fa-plus"></i> 新增用户
</el-button>
</div>
</div>
<!-- 用户列表 -->
<div class="card">
<div class="table-header">
<div class="table-title">用户列表</div>
</div>
<div class="table-wrapper">
<el-table :data="filteredUsers" stripe style="width: 100%">
<el-table-column prop="id" label="用户ID" width="80"></el-table-column>
<el-table-column label="头像" width="80">
<template slot-scope="scope">
<img
:src="scope.row.avatar"
:alt="scope.row.name"
style="width: 40px; height: 40px; border-radius: 50%;"
>
</template>
</el-table-column>
<el-table-column prop="username" label="用户名" min-width="120"></el-table-column>
<el-table-column prop="name" label="姓名" min-width="100"></el-table-column>
<el-table-column prop="departmentName" label="所属部门" min-width="120"></el-table-column>
<el-table-column prop="position" label="职位" min-width="100"></el-table-column>
<el-table-column prop="phone" label="手机号" min-width="120"></el-table-column>
<el-table-column prop="email" label="邮箱" min-width="180"></el-table-column>
<el-table-column prop="role" label="角色" min-width="100">
<template slot-scope="scope">
<span
class="role-badge"
:class="{
'role-admin': scope.row.role === 'admin',
'role-manager': scope.row.role === 'dept_manager',
'role-user': scope.row.role === 'user'
}"
>
{{ getRoleText(scope.row.role) }}
</span>
</template>
</el-table-column>
<el-table-column prop="status" label="状态" width="100">
<template slot-scope="scope">
<span
class="status-badge"
:class="scope.row.status === 'active' ? 'status-active' : 'status-inactive'"
>
{{ scope.row.status === 'active' ? '活跃' : '禁用' }}
</span>
</template>
</el-table-column>
<el-table-column prop="createTime" label="创建时间" min-width="150">
<template slot-scope="scope">
{{ formatDate(scope.row.createTime) }}
</template>
</el-table-column>
<el-table-column label="操作" width="200" fixed="right">
<template slot-scope="scope">
<div class="operation-buttons">
<el-button
type="primary"
size="small"
@click="editUser(scope.row)"
:disabled="scope.row.id === 1"
>
编辑
</el-button>
<el-button
type="success"
size="small"
@click="resetPassword(scope.row.id)"
>
重置密码
</el-button>
<el-button
type="danger"
size="small"
@click="deleteUser(scope.row.id)"
:disabled="scope.row.id === 1"
>
删除
</el-button>
</div>
</template>
</el-table-column>
</el-table>
</div>
</div>
</div>
</div>
</div>
<!-- 用户对话框 -->
<el-dialog
:title="dialogTitle"
:visible.sync="showDialog"
width="600px"
>
<div class="dialog-form-item avatar-uploader">
<img
v-if="userForm.avatar"
:src="userForm.avatar"
class="avatar-preview"
:alt="userForm.name"
>
<div v-else class="avatar-preview" style="background-color: #f5f7fa; display: flex; align-items: center; justify-content: center; color: #909399;">
<i class="fa fa-user-circle" style="font-size: 40px;"></i>
</div>
<el-button type="primary" size="small" style="margin-top: 10px;">
<i class="fa fa-upload"></i> 上传头像
</el-button>
</div>
<div class="dialog-form-item">
<div class="dialog-form-label">用户名</div>
<el-input
v-model="userForm.username"
placeholder="请输入用户名"
:disabled="!isNewUser"
></el-input>
</div>
<div class="dialog-form-item">
<div class="dialog-form-label">姓名</div>
<el-input
v-model="userForm.name"
placeholder="请输入姓名"
></el-input>
</div>
<div class="dialog-form-item">
<div class="dialog-form-label">所属部门</div>
<el-select
v-model="userForm.departmentId"
placeholder="请选择部门"
>
<el-option
v-for="dept in departments"
:key="dept.id"
:label="dept.name"
:value="dept.id"
></el-option>
</el-select>
</div>
<div class="dialog-form-item">
<div class="dialog-form-label">职位</div>
<el-input
v-model="userForm.position"
placeholder="请输入职位"
></el-input>
</div>
<div class="dialog-form-item">
<div class="dialog-form-label">手机号</div>
<el-input
v-model="userForm.phone"
placeholder="请输入手机号"
></el-input>
</div>
<div class="dialog-form-item">
<div class="dialog-form-label">邮箱</div>
<el-input
v-model="userForm.email"
placeholder="请输入邮箱"
></el-input>
</div>
<div class="dialog-form-item">
<div class="dialog-form-label">角色</div>
<el-radio-group v-model="userForm.role">
<el-radio label="admin">管理员</el-radio>
<el-radio label="dept_manager">部门负责人</el-radio>
<el-radio label="user">普通用户</el-radio>
</el-radio-group>
</div>
<div class="dialog-form-item" v-if="isNewUser">
<div class="dialog-form-label">初始密码</div>
<el-input
v-model="userForm.password"
type="password"
placeholder="请输入初始密码"
></el-input>
</div>
<div class="dialog-form-item">
<div class="dialog-form-label">用户状态</div>
<el-radio-group v-model="userForm.status">
<el-radio label="active">活跃</el-radio>
<el-radio label="inactive">禁用</el-radio>
</el-radio-group>
</div>
<div slot="footer">
<el-button @click="showDialog = false">取消</el-button>
<el-button
type="primary"
@click="saveUser"
:loading="saving"
>
保存
</el-button>
</div>
</el-dialog>
</div>
<script>
new Vue({
el: '#app',
data() {
return {
searchQuery: '',
departmentFilter: '',
roleFilter: '',
showDialog: false,
dialogTitle: '新增用户',
saving: false,
departments: [
{ id: 1, name: '技术部' },
{ id: 2, name: '市场部' },
{ id: 3, name: '人力资源部' },
{ id: 4, name: '财务部' },
{ id: 5, name: '行政部' }
],
users: [
{
id: 1,
username: 'admin',
name: '系统管理员',
avatar: 'https://cdn.jsdelivr.net/npm/element-ui@2.15.8/lib/theme-chalk/avatar.jpg',
departmentId: 1,
departmentName: '技术部',
position: '系统管理员',
phone: '13800138000',
email: 'admin@example.com',
role: 'admin',
status: 'active',
createTime: '2023-01-01'
},
{
id: 2,
username: 'zhangjingli',
name: '张经理',
avatar: 'https://cdn.jsdelivr.net/npm/element-ui@2.15.8/lib/theme-chalk/avatar.jpg',
departmentId: 1,
departmentName: '技术部',
position: '部门经理',
phone: '13812345678',
email: 'zhang@example.com',
role: 'dept_manager',
status: 'active',
createTime: '2023-01-15'
},
{
id: 3,
username: 'liming',
name: '李明',
avatar: 'https://cdn.jsdelivr.net/npm/element-ui@2.15.8/lib/theme-chalk/avatar.jpg',
departmentId: 2,
departmentName: '市场部',
position: '专员',
phone: '13987654321',
email: 'liming@example.com',
role: 'user',
status: 'active',
createTime: '2023-02-01'
},
{
id: 4,
username: 'wanghong',
name: '王红',
avatar: 'https://cdn.jsdelivr.net/npm/element-ui@2.15.8/lib/theme-chalk/avatar.jpg',
departmentId: 3,
departmentName: '人力资源部',
position: 'HR',
phone: '13765432198',
email: 'wanghong@example.com',
role: 'user',
status: 'active',
createTime: '2023-02-15'
},
{
id: 5,
username: 'zhaoming',
name: '赵明',
avatar: 'https://cdn.jsdelivr.net/npm/element-ui@2.15.8/lib/theme-chalk/avatar.jpg',
departmentId: 4,
departmentName: '财务部',
position: '会计',
phone: '13654321987',
email: 'zhaoming@example.com',
role: 'user',
status: 'inactive',
createTime: '2023-03-01'
}
],
userForm: {
id: '',
username: '',
name: '',
avatar: '',
departmentId: '',
departmentName: '',
position: '',
phone: '',
email: '',
role: 'user',
password: '',
status: 'active'
},
userStats: {
total: 5,
active: 4,
admins: 1,
managers: 1
}
}
},
computed: {
filteredUsers() {
return this.users.filter(user => {
// 搜索用户名或姓名
const matchesSearch = !this.searchQuery ||
user.username.toLowerCase().includes(this.searchQuery.toLowerCase()) ||
user.name.toLowerCase().includes(this.searchQuery.toLowerCase());
// 部门筛选
const matchesDepartment = !this.departmentFilter ||
user.departmentId === this.departmentFilter;
// 角色筛选
const matchesRole = !this.roleFilter ||
user.role === this.roleFilter;
return matchesSearch && matchesDepartment && matchesRole;
});
},
isNewUser() {
return !this.userForm.id;
}
},
methods: {
// 导航到其他页面
navigateTo(page) {
let url = '';
switch (page) {
case 'department':
url = 'department-management.html';
break;
case 'user':
url = 'user-management.html';
break;
case 'task':
url = 'task-management.html';
break;
case 'image':
url = 'image-management.html';
break;
}
if (url && url !== window.location.pathname) {
window.location.href = url;
}
},
// 格式化日期
formatDate(dateStr) {
return dateStr;
},
// 获取角色文本
getRoleText(role) {
const roleMap = {
'admin': '管理员',
'dept_manager': '部门负责人',
'user': '普通用户'
};
return roleMap[role] || '普通用户';
},
// 新增用户
addUser() {
this.dialogTitle = '新增用户';
this.userForm = {
id: '',
username: '',
name: '',
avatar: '',
departmentId: '',
departmentName: '',
position: '',
phone: '',
email: '',
role: 'user',
password: '',
status: 'active'
};
this.showDialog = true;
},
// 编辑用户
editUser(user) {
this.dialogTitle = '编辑用户';
this.userForm = { ...user };
this.showDialog = true;
},
// 保存用户
saveUser() {
// 表单验证
if (!this.userForm.username.trim()) {
this.$message.error('请输入用户名');
return;
}
if (!this.userForm.name.trim()) {
this.$message.error('请输入姓名');
return;
}
if (!this.userForm.departmentId) {
this.$message.error('请选择所属部门');
return;
}
if (this.isNewUser && !this.userForm.password.trim()) {
this.$message.error('请输入初始密码');
return;
}
// 更新部门名称
const dept = this.departments.find(d => d.id === this.userForm.departmentId);
if (dept) {
this.userForm.departmentName = dept.name;
}
this.saving = true;
// 模拟保存操作
setTimeout(() => {
if (this.userForm.id) {
// 编辑现有用户
const index = this.users.findIndex(u => u.id === this.userForm.id);
if (index > -1) {
this.users[index] = { ...this.userForm };
this.$message.success('用户信息已更新');
}
} else {
// 添加新用户
const newId = Math.max(...this.users.map(u => u.id), 0) + 1;
const newUser = {
...this.userForm,
id: newId,
avatar: this.userForm.avatar || 'https://cdn.jsdelivr.net/npm/element-ui@2.15.8/lib/theme-chalk/avatar.jpg',
createTime: new Date().toISOString().split('T')[0]
};
this.users.unshift(newUser);
// 更新统计数据
this.userStats.total++;
if (newUser.status === 'active') {
this.userStats.active++;
}
if (newUser.role === 'admin') {
this.userStats.admins++;
} else if (newUser.role === 'dept_manager') {
this.userStats.managers++;
}
this.$message.success('用户已创建');
}
this.saving = false;
this.showDialog = false;
}, 1000);
},
// 重置密码
resetPassword(userId) {
this.$confirm(`确定要重置该用户的密码吗?重置后密码将变为123456。`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$message.success('密码已重置为:123456');
}).catch(() => {
// 取消重置
});
},
// 删除用户
deleteUser(userId) {
if (userId === 1) {
this.$message.warning('系统管理员不能删除');
return;
}
this.$confirm(`确定要删除该用户吗?删除后将无法恢复。`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const index = this.users.findIndex(u => u.id === userId);
if (index > -1) {
const user = this.users[index];
this.users.splice(index, 1);
// 更新统计数据
this.userStats.total--;
if (user.status === 'active') {
this.userStats.active--;
}
if (user.role === 'admin') {
this.userStats.admins--;
} else if (user.role === 'dept_manager') {
this.userStats.managers--;
}
this.$message.success('用户已删除');
}
}).catch(() => {
// 取消删除
});
},
// 处理退出登录
handleLogout() {
this.$confirm('确定要退出登录吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$message.success('退出成功');
setTimeout(() => {
window.location.href = 'admin-login.html';
}, 1000);
}).catch(() => {
// 取消退出
});
}
}
})
</script>
</body>
</html>
+472
View File
@@ -0,0 +1,472 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>管理员首页 - 图片收集小程序</title>
<!-- 引入Vue.js -->
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.min.js"></script>
<!-- 引入Element UI CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/element-ui@2.15.8/lib/theme-chalk/index.css">
<!-- 引入Element UI JavaScript -->
<script src="https://cdn.jsdelivr.net/npm/element-ui@2.15.8/lib/index.js"></script>
<!-- 引入Font Awesome -->
<link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
body {
margin: 0;
padding: 0;
height: 100vh;
background-color: #f5f7fa;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
padding-top: env(safe-area-inset-top);
padding-bottom: calc(env(safe-area-inset-bottom) + 60px);
overflow-x: hidden;
}
.container {
height: 100vh;
display: flex;
flex-direction: column;
}
.header {
background-color: #1989fa;
color: white;
padding: 15px;
display: flex;
justify-content: space-between;
align-items: center;
position: sticky;
top: 0;
z-index: 100;
}
.header-title {
font-size: 18px;
font-weight: bold;
}
.header-actions {
display: flex;
align-items: center;
}
.notification-icon {
position: relative;
margin-right: 15px;
font-size: 20px;
}
.notification-badge {
position: absolute;
top: -5px;
right: -5px;
background-color: #f56c6c;
color: white;
border-radius: 50%;
width: 16px;
height: 16px;
font-size: 10px;
display: flex;
align-items: center;
justify-content: center;
}
.user-avatar {
width: 36px;
height: 36px;
border-radius: 50%;
background-color: white;
display: flex;
align-items: center;
justify-content: center;
color: #1989fa;
font-size: 16px;
}
.content {
flex: 1;
padding: 15px;
overflow-y: auto;
}
.card {
background-color: white;
border-radius: 8px;
padding: 15px;
margin-bottom: 15px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);
}
.pending-tasks {
background-color: #ecf5ff;
border-left: 4px solid #1989fa;
padding: 15px;
border-radius: 8px;
margin-bottom: 15px;
cursor: pointer;
transition: all 0.3s;
}
.pending-tasks:hover {
background-color: #ebeef5;
}
.pending-title {
font-size: 16px;
font-weight: bold;
color: #303133;
margin-bottom: 5px;
}
.pending-count {
display: inline-block;
background-color: #1989fa;
color: white;
border-radius: 10px;
padding: 2px 8px;
font-size: 14px;
margin-left: 10px;
}
.pending-desc {
font-size: 14px;
color: #606266;
}
.chart-container {
height: 200px;
margin: 15px 0;
}
.chart-bar {
display: flex;
align-items: flex-end;
height: 180px;
padding: 0 10px;
}
.bar-item {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
margin: 0 5px;
}
.bar {
width: 30px;
background-color: #1989fa;
border-radius: 4px 4px 0 0;
transition: height 0.3s;
}
.bar-label {
margin-top: 5px;
font-size: 12px;
color: #909399;
}
.bar-value {
margin-bottom: 5px;
font-size: 12px;
color: #606266;
}
.progress-card {
display: flex;
justify-content: space-between;
align-items: center;
padding: 15px;
background-color: #f0f9eb;
border: 1px solid #e1f3d8;
border-radius: 8px;
margin-bottom: 15px;
cursor: pointer;
}
.progress-text {
flex: 1;
}
.progress-title {
font-size: 16px;
font-weight: 500;
color: #303133;
}
.progress-subtitle {
font-size: 12px;
color: #67c23a;
margin-top: 5px;
}
.progress-icon {
font-size: 24px;
color: #67c23a;
}
.image-list {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 10px;
}
.image-item {
position: relative;
border-radius: 8px;
overflow: hidden;
padding-bottom: 100%;
background-color: #f5f7fa;
}
.image-item img {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: cover;
}
.image-overlay {
position: absolute;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.5);
color: white;
padding: 8px;
font-size: 12px;
}
.image-uploader {
font-size: 10px;
opacity: 0.8;
}
.footer-nav {
position: fixed;
bottom: 0;
left: 0;
right: 0;
height: 60px;
background-color: white;
display: flex;
justify-content: space-around;
align-items: center;
box-shadow: 0 -2px 12px 0 rgba(0, 0, 0, 0.05);
z-index: 99;
padding-bottom: env(safe-area-inset-bottom);
}
.nav-item {
display: flex;
flex-direction: column;
align-items: center;
font-size: 12px;
color: #909399;
}
.nav-item.active {
color: #1989fa;
}
.nav-icon {
font-size: 20px;
margin-bottom: 4px;
}
.section-title {
font-size: 16px;
font-weight: bold;
color: #303133;
margin-bottom: 10px;
display: flex;
justify-content: space-between;
align-items: center;
}
.view-more {
font-size: 14px;
color: #1989fa;
}
</style>
</head>
<body>
<div id="app">
<div class="container">
<!-- 顶部导航栏 -->
<div class="header">
<div class="header-title">图片收集小程序</div>
<div class="header-actions">
<el-dropdown>
<span class="notification-icon cursor-pointer">
<i class="fa fa-bell-o"></i>
<span class="notification-badge">{{ notificationCount }}</span>
</span>
<el-dropdown-menu slot="dropdown" style="width: 280px;">
<el-dropdown-item disabled style="text-align: center;">通知消息</el-dropdown-item>
<el-dropdown-item v-for="(notification, index) in notifications" :key="index">
<div style="font-size: 12px;">
<div style="color: #303133;">{{ notification.title }}</div>
<div style="color: #909399; margin-top: 4px;">{{ notification.time }}</div>
</div>
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-dropdown>
<span class="user-avatar cursor-pointer">
<i class="fa fa-user"></i>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click="goToProfile">个人中心</el-dropdown-item>
<el-dropdown-item @click="logout" divided>退出登录</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
</div>
<!-- 主内容区 -->
<div class="content">
<!-- 待处理任务卡片 -->
<div class="pending-tasks" @click="viewPendingTasks">
<div class="pending-title">
待处理任务
<span class="pending-count">{{ pendingCount }}</span>
</div>
<div class="pending-desc">点击查看所有待审核的图片</div>
</div>
<!-- 统计图表区域 -->
<div class="card">
<div class="section-title">部门上传统计</div>
<div class="chart-container">
<div class="chart-bar">
<div v-for="dept in departmentStats" :key="dept.name" class="bar-item">
<div class="bar-value">{{ dept.count }}</div>
<div class="bar" :style="{ height: dept.height + '%' }"></div>
<div class="bar-label">{{ dept.name }}</div>
</div>
</div>
</div>
</div>
<!-- 任务进度查询入口 -->
<div class="progress-card" @click="queryTaskProgress">
<div class="progress-text">
<div class="progress-title">任务进度查询</div>
<div class="progress-subtitle">查看所有任务的完成情况</div>
</div>
<i class="progress-icon fa fa-bar-chart"></i>
</div>
<!-- 最新上传图片列表 -->
<div class="card">
<div class="section-title">
最新上传
<span class="view-more" @click="viewAllImages">查看全部</span>
</div>
<div class="image-list">
<div
v-for="image in recentImages"
:key="image.id"
class="image-item"
@click="viewImageDetail(image.id)"
>
<img :src="image.url" :alt="image.title">
<div class="image-overlay">
<div>{{ image.title }}</div>
<div class="image-uploader">{{ image.uploader }} · {{ image.department }}</div>
</div>
</div>
</div>
</div>
</div>
<!-- 底部导航栏 -->
<div class="footer-nav">
<div class="nav-item active" @click="goToHome">
<i class="nav-icon fa fa-home"></i>
<span>首页</span>
</div>
<div class="nav-item" @click="goToTasks">
<i class="nav-icon fa fa-tasks"></i>
<span>任务</span>
</div>
<div class="nav-item" @click="goToProfile">
<i class="nav-icon fa fa-user"></i>
<span>我的</span>
</div>
</div>
</div>
</div>
<script>
new Vue({
el: '#app',
data() {
return {
pendingCount: 12,
notificationCount: 3,
notifications: [
{ title: '有5张新的图片需要审核', time: '10分钟前' },
{ title: '市场部完成了本月任务', time: '1小时前' },
{ title: '系统将于今晚22:00进行维护', time: '昨天' }
],
departmentStats: [
{ name: '市场部', count: 45, height: 100 },
{ name: '技术部', count: 28, height: 62 },
{ name: '产品部', count: 32, height: 71 },
{ name: '行政部', count: 15, height: 33 },
{ name: '财务部', count: 8, height: 18 }
],
recentImages: [
{
id: 1,
title: '产品包装设计',
url: 'https://via.placeholder.com/300x300',
uploader: '张三',
department: '市场部'
},
{
id: 2,
title: '新品发布会',
url: 'https://via.placeholder.com/300x300',
uploader: '李四',
department: '品牌部'
},
{
id: 3,
title: '办公室环境',
url: 'https://via.placeholder.com/300x300',
uploader: '王五',
department: '行政部'
},
{
id: 4,
title: '团建活动',
url: 'https://via.placeholder.com/300x300',
uploader: '赵六',
department: '人力资源部'
}
]
}
},
methods: {
// 查看待处理任务
viewPendingTasks() {
this.$message.info('查看所有待处理任务');
},
// 查询任务进度
queryTaskProgress() {
this.$message.info('查询任务进度');
},
// 查看图片详情
viewImageDetail(imageId) {
window.location.href = 'image-detail.html?id=' + imageId;
},
// 查看所有图片
viewAllImages() {
this.$message.info('查看所有图片');
},
// 跳转到任务页面
goToTasks() {
this.$message.info('跳转到任务页面');
},
// 跳转到个人中心
goToProfile() {
this.$message.info('跳转到个人中心');
},
// 返回首页
goToHome() {
// 已经在首页
},
// 退出登录
logout() {
this.$confirm('确定要退出登录吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
window.location.href = 'login.html';
});
}
}
})
</script>
</body>
</html>
+505
View File
@@ -0,0 +1,505 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>部门负责人首页 - 图片收集小程序</title>
<!-- 引入Vue.js -->
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.min.js"></script>
<!-- 引入Element UI CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/element-ui@2.15.8/lib/theme-chalk/index.css">
<!-- 引入Element UI JavaScript -->
<script src="https://cdn.jsdelivr.net/npm/element-ui@2.15.8/lib/index.js"></script>
<!-- 引入Font Awesome -->
<link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
body {
margin: 0;
padding: 0;
height: 100vh;
background-color: #f5f7fa;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
padding-top: env(safe-area-inset-top);
padding-bottom: calc(env(safe-area-inset-bottom) + 60px);
overflow-x: hidden;
}
.container {
height: 100vh;
display: flex;
flex-direction: column;
}
.header {
background-color: #1989fa;
color: white;
padding: 15px;
display: flex;
justify-content: space-between;
align-items: center;
position: sticky;
top: 0;
z-index: 100;
}
.header-title {
font-size: 18px;
font-weight: bold;
}
.dept-selector {
background-color: rgba(255, 255, 255, 0.2);
border-radius: 4px;
padding: 4px 8px;
font-size: 14px;
display: flex;
align-items: center;
}
.user-avatar {
width: 36px;
height: 36px;
border-radius: 50%;
background-color: white;
display: flex;
align-items: center;
justify-content: center;
color: #1989fa;
font-size: 16px;
}
.content {
flex: 1;
padding: 15px;
overflow-y: auto;
}
.card {
background-color: white;
border-radius: 8px;
padding: 15px;
margin-bottom: 15px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);
}
.stats-card {
display: flex;
justify-content: space-between;
margin-bottom: 15px;
}
.stat-item {
flex: 1;
background-color: white;
border-radius: 8px;
padding: 15px;
text-align: center;
margin: 0 5px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);
}
.stat-number {
font-size: 24px;
font-weight: bold;
color: #1989fa;
}
.stat-label {
font-size: 12px;
color: #909399;
margin-top: 5px;
}
.chart-container {
height: 200px;
margin: 20px 0;
}
.pending-image {
display: flex;
padding: 12px;
border: 1px solid #ebeef5;
border-radius: 8px;
margin-bottom: 10px;
transition: all 0.3s;
}
.pending-image:hover {
border-color: #1989fa;
box-shadow: 0 2px 12px 0 rgba(25, 136, 250, 0.1);
}
.image-thumbnail {
width: 60px;
height: 60px;
border-radius: 4px;
overflow: hidden;
background-color: #f5f7fa;
}
.image-thumbnail img {
width: 100%;
height: 100%;
object-fit: cover;
}
.image-info {
flex: 1;
margin-left: 12px;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.image-title {
font-size: 14px;
font-weight: 500;
color: #303133;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.image-meta {
font-size: 12px;
color: #909399;
}
.action-buttons {
display: flex;
justify-content: flex-end;
margin-top: 8px;
}
.approve-btn {
background-color: #67c23a;
color: white;
border: none;
padding: 4px 12px;
border-radius: 4px;
font-size: 12px;
margin-right: 8px;
}
.reject-btn {
background-color: #f56c6c;
color: white;
border: none;
padding: 4px 12px;
border-radius: 4px;
font-size: 12px;
}
.footer-nav {
position: fixed;
bottom: 0;
left: 0;
right: 0;
height: 60px;
background-color: white;
display: flex;
justify-content: space-around;
align-items: center;
box-shadow: 0 -2px 12px 0 rgba(0, 0, 0, 0.05);
z-index: 99;
padding-bottom: env(safe-area-inset-bottom);
}
.nav-item {
display: flex;
flex-direction: column;
align-items: center;
font-size: 12px;
color: #909399;
}
.nav-item.active {
color: #1989fa;
}
.nav-icon {
font-size: 20px;
margin-bottom: 4px;
}
.section-title {
font-size: 16px;
font-weight: bold;
color: #303133;
margin-bottom: 10px;
display: flex;
justify-content: space-between;
align-items: center;
}
.view-more {
font-size: 14px;
color: #1989fa;
}
</style>
</head>
<body>
<div id="app">
<div class="container">
<!-- 顶部导航栏 -->
<div class="header">
<div class="header-title">图片收集小程序</div>
<div style="display: flex; align-items: center;">
<!-- 部门切换器 -->
<el-dropdown @command="changeDepartment">
<span class="dept-selector cursor-pointer">
{{ currentDepartment.name }}
<i class="fa fa-chevron-down ml-2" style="font-size: 12px;"></i>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item
v-for="dept in departments"
:key="dept.id"
:command="dept"
:disabled="dept.id === currentDepartment.id"
>
{{ dept.name }}
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<!-- 用户头像 -->
<el-dropdown style="margin-left: 15px;">
<span class="user-avatar cursor-pointer">
<i class="fa fa-user"></i>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click="goToProfile">个人中心</el-dropdown-item>
<el-dropdown-item @click="logout" divided>退出登录</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
</div>
<!-- 主内容区 -->
<div class="content">
<!-- 统计卡片 -->
<div class="stats-card">
<div class="stat-item">
<div class="stat-number">{{ stats.pending }}</div>
<div class="stat-label">待审核</div>
</div>
<div class="stat-item">
<div class="stat-number">{{ stats.approved }}</div>
<div class="stat-label">已通过</div>
</div>
<div class="stat-item">
<div class="stat-number">{{ stats.total }}</div>
<div class="stat-label">总数量</div>
</div>
</div>
<!-- 部门图片统计(饼图) -->
<div class="card">
<div class="section-title">图片分类统计</div>
<div class="chart-container">
<!-- 使用Element UI的进度条模拟饼图 -->
<div v-for="category in categories" :key="category.name" class="mb-4">
<div style="display: flex; justify-content: space-between; margin-bottom: 5px;">
<span style="font-size: 14px;">{{ category.name }}</span>
<span style="font-size: 14px; color: #909399;">{{ category.count }} ({{ category.percentage }}%)</span>
</div>
<el-progress
:percentage="category.percentage"
:color="category.color"
:stroke-width="8"
></el-progress>
</div>
</div>
</div>
<!-- 待审核图片列表 -->
<div class="card">
<div class="section-title">
待审核图片
<span class="view-more" @click="viewAllPending">查看全部</span>
</div>
<div v-if="pendingImages.length > 0">
<div
v-for="image in pendingImages"
:key="image.id"
class="pending-image"
>
<div class="image-thumbnail">
<img :src="image.url" :alt="image.title">
</div>
<div class="image-info">
<div class="image-title">{{ image.title }}</div>
<div class="image-meta">{{ image.uploader }} · {{ formatDate(image.uploadTime) }}</div>
<div class="action-buttons">
<button class="approve-btn" @click="approveImage(image.id)">通过</button>
<button class="reject-btn" @click="rejectImage(image.id)">拒绝</button>
</div>
</div>
</div>
</div>
<div v-else class="text-center text-gray-400 py-10">
暂无待审核图片
</div>
</div>
</div>
<!-- 底部导航栏 -->
<div class="footer-nav">
<div class="nav-item active" @click="goToHome">
<i class="nav-icon fa fa-home"></i>
<span>首页</span>
</div>
<div class="nav-item" @click="goToReview">
<i class="nav-icon fa fa-check-square-o"></i>
<span>审核</span>
</div>
<div class="nav-item" @click="goToProfile">
<i class="nav-icon fa fa-user"></i>
<span>我的</span>
</div>
</div>
</div>
</div>
<!-- 拒绝原因对话框 -->
<el-dialog
title="拒绝原因"
:visible.sync="dialogVisible"
width="300px"
>
<el-input
type="textarea"
:rows="3"
v-model="rejectReason"
placeholder="请输入拒绝原因"
></el-input>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="confirmReject">确定</el-button>
</span>
</el-dialog>
<script>
new Vue({
el: '#app',
data() {
return {
departments: [
{ id: 1, name: '市场部' },
{ id: 2, name: '技术部' },
{ id: 3, name: '产品部' }
],
currentDepartment: { id: 1, name: '市场部' },
stats: {
pending: 5,
approved: 28,
total: 45
},
categories: [
{ name: '产品包装', count: 15, percentage: 33, color: '#1989fa' },
{ name: '活动现场', count: 10, percentage: 22, color: '#67c23a' },
{ name: '办公环境', count: 8, percentage: 18, color: '#e6a23c' },
{ name: '其他', count: 12, percentage: 27, color: '#909399' }
],
pendingImages: [
{
id: 1,
title: '产品新包装设计',
url: 'https://via.placeholder.com/300x300',
uploader: '张三',
uploadTime: '2023-10-10 10:30'
},
{
id: 2,
title: '促销活动现场',
url: 'https://via.placeholder.com/300x300',
uploader: '李四',
uploadTime: '2023-10-10 09:15'
},
{
id: 3,
title: '客户交流会',
url: 'https://via.placeholder.com/300x300',
uploader: '王五',
uploadTime: '2023-10-09 16:45'
}
],
dialogVisible: false,
rejectReason: '',
currentImageId: null
}
},
methods: {
// 切换部门
changeDepartment(dept) {
this.currentDepartment = dept;
// 模拟部门切换后数据更新
this.updateDepartmentData(dept.id);
this.$message.success('已切换至' + dept.name);
},
// 更新部门数据
updateDepartmentData(deptId) {
// 这里模拟不同部门的数据
switch(deptId) {
case 1:
this.stats = { pending: 5, approved: 28, total: 45 };
break;
case 2:
this.stats = { pending: 3, approved: 15, total: 20 };
break;
case 3:
this.stats = { pending: 2, approved: 22, total: 30 };
break;
}
},
// 格式化日期
formatDate(dateStr) {
return dateStr;
},
// 审核通过
approveImage(imageId) {
this.$confirm('确定要通过这个图片吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
// 模拟审核通过
this.pendingImages = this.pendingImages.filter(img => img.id !== imageId);
this.stats.pending--;
this.stats.approved++;
this.$message.success('审核通过');
});
},
// 拒绝审核
rejectImage(imageId) {
this.currentImageId = imageId;
this.rejectReason = '';
this.dialogVisible = true;
},
// 确认拒绝
confirmReject() {
if (!this.rejectReason.trim()) {
this.$message.error('请输入拒绝原因');
return;
}
// 模拟拒绝操作
this.pendingImages = this.pendingImages.filter(img => img.id !== this.currentImageId);
this.stats.pending--;
this.dialogVisible = false;
this.$message.success('已拒绝,原因已通知上传者');
},
// 查看全部待审核
viewAllPending() {
this.$message.info('查看全部待审核图片');
},
// 跳转到审核页面
goToReview() {
this.$message.info('跳转到审核页面');
},
// 跳转到个人中心
goToProfile() {
this.$message.info('跳转到个人中心');
},
// 返回首页
goToHome() {
// 已经在首页
},
// 退出登录
logout() {
this.$confirm('确定要退出登录吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
window.location.href = 'login.html';
});
}
}
})
</script>
</body>
</html>
+501
View File
@@ -0,0 +1,501 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>图片上传 - 图片收集小程序</title>
<!-- 引入Vue.js -->
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.min.js"></script>
<!-- 引入Element UI CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/element-ui@2.15.8/lib/theme-chalk/index.css">
<!-- 引入Element UI JavaScript -->
<script src="https://cdn.jsdelivr.net/npm/element-ui@2.15.8/lib/index.js"></script>
<!-- 引入Font Awesome -->
<link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
body {
margin: 0;
padding: 0;
height: 100vh;
background-color: #f5f7fa;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
padding-top: env(safe-area-inset-top);
overflow-x: hidden;
}
.container {
height: 100vh;
display: flex;
flex-direction: column;
}
.header {
background-color: #1989fa;
color: white;
padding: 15px;
display: flex;
justify-content: space-between;
align-items: center;
position: sticky;
top: 0;
z-index: 100;
}
.header-title {
font-size: 18px;
font-weight: bold;
}
.header-action {
font-size: 16px;
}
.content {
flex: 1;
padding: 15px;
overflow-y: auto;
}
.card {
background-color: white;
border-radius: 8px;
padding: 15px;
margin-bottom: 15px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);
}
.upload-area {
border: 2px dashed #dcdfe6;
border-radius: 8px;
padding: 30px;
text-align: center;
cursor: pointer;
transition: all 0.3s;
background-color: #fafafa;
}
.upload-area:hover {
border-color: #1989fa;
background-color: #ecf5ff;
}
.upload-icon {
font-size: 48px;
color: #dcdfe6;
margin-bottom: 10px;
}
.upload-text {
font-size: 16px;
color: #606266;
margin-bottom: 5px;
}
.upload-hint {
font-size: 12px;
color: #909399;
}
.preview-list {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 10px;
margin-top: 15px;
}
.preview-item {
position: relative;
border-radius: 8px;
overflow: hidden;
padding-bottom: 100%;
background-color: #f5f7fa;
}
.preview-item img {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: cover;
}
.delete-btn {
position: absolute;
top: 5px;
right: 5px;
background-color: rgba(0, 0, 0, 0.5);
color: white;
border: none;
border-radius: 50%;
width: 20px;
height: 20px;
display: flex;
align-items: center;
justify-content: center;
font-size: 12px;
}
.progress-container {
position: absolute;
bottom: 0;
left: 0;
right: 0;
background-color: rgba(0, 0, 0, 0.5);
padding: 5px;
}
.progress-bar {
height: 4px;
background-color: rgba(255, 255, 255, 0.3);
border-radius: 2px;
overflow: hidden;
}
.progress-fill {
height: 100%;
background-color: #1989fa;
transition: width 0.3s;
}
.form-item {
margin-bottom: 20px;
}
.form-label {
font-size: 14px;
font-weight: 500;
color: #303133;
margin-bottom: 8px;
}
.tag-list {
display: flex;
flex-wrap: wrap;
gap: 8px;
margin-top: 8px;
}
.tag {
padding: 4px 12px;
border-radius: 12px;
font-size: 12px;
cursor: pointer;
transition: all 0.3s;
}
.tag-default {
background-color: #f0f2f5;
color: #606266;
}
.tag-selected {
background-color: #ecf5ff;
color: #1989fa;
border-color: #1989fa;
border: 1px solid;
}
.submit-btn {
width: 100%;
margin-top: 20px;
}
.department-info {
display: flex;
align-items: center;
padding: 10px;
background-color: #f0f9eb;
border-radius: 4px;
font-size: 14px;
}
.department-icon {
font-size: 16px;
color: #67c23a;
margin-right: 8px;
}
.textarea-container {
position: relative;
}
.char-count {
position: absolute;
bottom: 5px;
right: 10px;
font-size: 12px;
color: #909399;
}
input[type="file"] {
display: none;
}
</style>
</head>
<body>
<div id="app">
<div class="container">
<!-- 顶部导航栏 -->
<div class="header">
<div class="header-action" @click="goBack">取消</div>
<div class="header-title">图片上传</div>
<div class="header-action" @click="handleSubmit">保存</div>
</div>
<!-- 主内容区 -->
<div class="content">
<!-- 图片选择区域 -->
<div class="card">
<div class="form-label">选择图片</div>
<label for="file-upload" class="upload-area">
<i class="fa fa-cloud-upload upload-icon"></i>
<div class="upload-text">点击或拖拽上传</div>
<div class="upload-hint">支持JPG、PNG格式,单张不超过2MB</div>
<input
type="file"
id="file-upload"
accept="image/*"
multiple
@change="handleFileSelect"
>
</label>
<!-- 已选择图片预览 -->
<div v-if="selectedImages.length > 0" class="preview-list">
<div
v-for="(image, index) in selectedImages"
:key="index"
class="preview-item"
>
<img :src="image.url" :alt="'预览图 ' + (index + 1)">
<button class="delete-btn" @click="removeImage(index)">
<i class="fa fa-times"></i>
</button>
<div v-if="image.uploading" class="progress-container">
<div class="progress-bar">
<div class="progress-fill" :style="{ width: image.progress + '%' }"></div>
</div>
</div>
</div>
</div>
</div>
<!-- 图片信息表单 -->
<div class="card">
<div class="form-label">图片信息</div>
<!-- 所属部门显示 -->
<div class="department-info mb-4">
<i class="fa fa-building department-icon"></i>
<span>所属部门:{{ currentDepartment }}</span>
</div>
<!-- 标题输入框 -->
<div class="form-item">
<div class="form-label">标题</div>
<el-input
v-model="imageForm.title"
placeholder="请输入图片标题"
maxlength="50"
show-word-limit
></el-input>
</div>
<!-- 描述文本域 -->
<div class="form-item">
<div class="form-label">描述</div>
<div class="textarea-container">
<el-input
v-model="imageForm.description"
type="textarea"
:rows="3"
placeholder="请输入图片描述"
maxlength="200"
></el-input>
<div class="char-count">{{ imageForm.description.length }}/200</div>
</div>
</div>
<!-- 分类标签选择器 -->
<div class="form-item">
<div class="form-label">分类标签(可多选)</div>
<div class="tag-list">
<div
v-for="tag in availableTags"
:key="tag.value"
class="tag"
:class="{ 'tag-selected': imageForm.tags.includes(tag.value), 'tag-default': !imageForm.tags.includes(tag.value) }"
@click="toggleTag(tag.value)"
>
{{ tag.label }}
</div>
</div>
</div>
<!-- 关联任务选择器 -->
<div class="form-item">
<div class="form-label">关联任务(可选)</div>
<el-select
v-model="imageForm.taskId"
placeholder="请选择关联任务"
filterable
>
<el-option
v-for="task in availableTasks"
:key="task.id"
:label="task.name"
:value="task.id"
></el-option>
</el-select>
</div>
<!-- 提交按钮 -->
<el-button
type="primary"
class="submit-btn"
:loading="submitting"
@click="handleSubmit"
>
提交
</el-button>
</div>
</div>
</div>
</div>
<script>
new Vue({
el: '#app',
data() {
return {
selectedImages: [],
imageForm: {
title: '',
description: '',
tags: [],
taskId: ''
},
availableTags: [
{ label: '产品包装', value: 'product_package' },
{ label: '活动现场', value: 'event' },
{ label: '办公环境', value: 'office' },
{ label: '员工活动', value: 'employee' },
{ label: '客户交流', value: 'customer' },
{ label: '其他', value: 'other' }
],
availableTasks: [
{ id: 1, name: '产品包装收集' },
{ id: 2, name: '活动现场拍摄' },
{ id: 3, name: '办公环境更新' }
],
currentDepartment: '市场部',
submitting: false,
uploading: false
}
},
methods: {
// 处理文件选择
handleFileSelect(event) {
const files = event.target.files;
if (files && files.length > 0) {
// 限制最多上传9张
const maxFiles = 9 - this.selectedImages.length;
const filesToAdd = Math.min(files.length, maxFiles);
if (filesToAdd === 0) {
this.$message.warning('最多只能上传9张图片');
return;
}
for (let i = 0; i < filesToAdd; i++) {
const file = files[i];
// 检查文件类型
if (!file.type.match('image/jpeg') && !file.type.match('image/png')) {
this.$message.error('只能上传JPG或PNG格式的图片');
continue;
}
// 检查文件大小
if (file.size > 2 * 1024 * 1024) {
this.$message.error('图片大小不能超过2MB');
continue;
}
// 创建预览URL
const reader = new FileReader();
reader.onload = (e) => {
this.selectedImages.push({
file: file,
url: e.target.result,
uploading: false,
progress: 0
});
};
reader.readAsDataURL(file);
}
// 清空input,允许重复选择相同文件
event.target.value = '';
}
},
// 移除图片
removeImage(index) {
this.selectedImages.splice(index, 1);
},
// 切换标签选择
toggleTag(tagValue) {
const index = this.imageForm.tags.indexOf(tagValue);
if (index > -1) {
this.imageForm.tags.splice(index, 1);
} else {
this.imageForm.tags.push(tagValue);
}
},
// 模拟上传进度
simulateUpload() {
this.selectedImages.forEach((image, index) => {
image.uploading = true;
image.progress = 0;
const interval = setInterval(() => {
image.progress += 10;
if (image.progress >= 100) {
clearInterval(interval);
image.uploading = false;
}
}, 200);
});
},
// 提交表单
handleSubmit() {
// 表单验证
if (this.selectedImages.length === 0) {
this.$message.error('请至少选择一张图片');
return;
}
if (!this.imageForm.title.trim()) {
this.$message.error('请输入图片标题');
return;
}
this.submitting = true;
this.uploading = true;
// 模拟上传
this.simulateUpload();
// 模拟提交请求
setTimeout(() => {
this.submitting = false;
this.$message.success('上传成功');
// 重置表单
this.selectedImages = [];
this.imageForm = {
title: '',
description: '',
tags: [],
taskId: ''
};
// 返回首页
setTimeout(() => {
window.location.href = 'user-home.html';
}, 1000);
}, 2000);
},
// 返回上一页
goBack() {
if (this.selectedImages.length > 0 || this.imageForm.title || this.imageForm.description) {
this.$confirm('确定要离开吗?当前编辑内容将会丢失。', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
window.history.back();
});
} else {
window.history.back();
}
}
}
})
</script>
</body>
</html>
+284
View File
@@ -0,0 +1,284 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>登录 - 图片收集小程序</title>
<!-- 引入Vue.js -->
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.min.js"></script>
<!-- 引入Element UI CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/element-ui@2.15.8/lib/theme-chalk/index.css">
<!-- 引入Element UI JavaScript -->
<script src="https://cdn.jsdelivr.net/npm/element-ui@2.15.8/lib/index.js"></script>
<!-- 引入Font Awesome -->
<link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
body {
margin: 0;
padding: 0;
height: 100vh;
background-color: #f5f7fa;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
padding-top: env(safe-area-inset-top);
padding-bottom: env(safe-area-inset-bottom);
}
.login-container {
max-width: 400px;
margin: 0 auto;
padding: 40px 20px;
height: 100vh;
box-sizing: border-box;
display: flex;
flex-direction: column;
}
.logo-container {
text-align: center;
margin-bottom: 40px;
}
.logo {
width: 80px;
height: 80px;
background-color: #1989fa;
border-radius: 16px;
margin: 0 auto 16px;
display: flex;
align-items: center;
justify-content: center;
color: white;
font-size: 32px;
}
.app-name {
font-size: 20px;
font-weight: bold;
color: #303133;
}
.form-container {
flex: 1;
}
.form-item {
margin-bottom: 20px;
}
.login-button {
width: 100%;
margin-top: 30px;
}
.agreement {
text-align: center;
margin-top: 20px;
font-size: 12px;
color: #909399;
}
.agreement a {
color: #1989fa;
text-decoration: none;
}
.footer {
margin-top: auto;
text-align: center;
padding: 20px 0;
font-size: 12px;
color: #909399;
}
.el-input-group__append {
padding: 0 10px;
}
.code-button {
background: none;
color: #1989fa;
border: none;
padding: 0;
height: 100%;
font-size: 14px;
cursor: pointer;
}
.code-button:disabled {
color: #c0c4cc;
}
</style>
</head>
<body>
<div id="app">
<div class="login-container">
<!-- Logo和应用名称 -->
<div class="logo-container">
<div class="logo">
<i class="fa fa-camera"></i>
</div>
<div class="app-name">图片收集小程序</div>
</div>
<!-- 登录表单 -->
<div class="form-container">
<el-form :model="loginForm" :rules="rules" ref="loginForm" label-position="top">
<!-- 手机号输入 -->
<el-form-item label="手机号" prop="phone">
<el-input-group>
<el-input-group__append>+86</el-input-group__append>
<el-input
v-model="loginForm.phone"
placeholder="请输入手机号码"
type="tel"
maxlength="11"
clearable
></el-input>
</el-input-group>
</el-form-item>
<!-- 验证码输入 -->
<el-form-item label="验证码" prop="code">
<el-input-group>
<el-input
v-model="loginForm.code"
placeholder="请输入验证码"
type="number"
maxlength="6"
></el-input>
<el-input-group__append>
<button
type="button"
class="code-button"
:disabled="countdown > 0"
@click="sendCode"
>
{{ countdown > 0 ? countdown + 's后重试' : '获取验证码' }}
</button>
</el-input-group__append>
</el-input-group>
</el-form-item>
<!-- 登录按钮 -->
<el-form-item>
<el-button
type="primary"
class="login-button"
:loading="loading"
@click="handleLogin"
>
登录
</el-button>
</el-form-item>
<!-- 协议链接 -->
<div class="agreement">
登录即表示同意
<a href="#" @click.prevent="showAgreement('service')">《服务协议》</a>
<a href="#" @click.prevent="showAgreement('privacy')">《隐私政策》</a>
</div>
</el-form>
</div>
<!-- 版权信息 -->
<div class="footer">
<p>© 2023 图片收集小程序 版权所有</p>
</div>
</div>
</div>
<script>
new Vue({
el: '#app',
data() {
return {
loginForm: {
phone: '',
code: ''
},
rules: {
phone: [
{ required: true, message: '请输入手机号', trigger: 'blur' },
{ pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号', trigger: 'blur' }
],
code: [
{ required: true, message: '请输入验证码', trigger: 'blur' },
{ pattern: /^\d{6}$/, message: '请输入6位数字验证码', trigger: 'blur' }
]
},
countdown: 0,
loading: false,
timer: null
}
},
methods: {
// 发送验证码
sendCode() {
this.$refs.loginForm.validateField('phone', (errorMessage) => {
if (!errorMessage) {
// 模拟发送验证码
this.countdown = 60;
this.startCountdown();
this.$message.success('验证码已发送');
}
});
},
// 倒计时
startCountdown() {
clearInterval(this.timer);
this.timer = setInterval(() => {
if (this.countdown > 0) {
this.countdown--;
} else {
clearInterval(this.timer);
}
}, 1000);
},
// 处理登录
handleLogin() {
this.$refs.loginForm.validate((valid) => {
if (valid) {
this.loading = true;
// 模拟登录请求
setTimeout(() => {
this.loading = false;
// 根据不同手机号模拟不同角色登录
if (this.loginForm.phone === '13800138000') {
// 管理员登录
this.$message.success('登录成功,欢迎管理员');
this.redirectToHome('admin');
} else if (this.loginForm.phone === '13800138001') {
// 部门负责人登录
this.$message.success('登录成功,欢迎部门负责人');
this.redirectToHome('dept');
} else {
// 普通用户登录
this.$message.success('登录成功');
this.redirectToHome('user');
}
}, 1000);
}
});
},
// 跳转到首页
redirectToHome(role) {
switch (role) {
case 'admin':
window.location.href = 'admin-home.html';
break;
case 'dept':
window.location.href = 'dept-home.html';
break;
default:
window.location.href = 'user-home.html';
}
},
// 显示协议
showAgreement(type) {
const title = type === 'service' ? '服务协议' : '隐私政策';
this.$alert('这是' + title + '的内容。在实际应用中,这里会显示完整的协议文本。', title, {
confirmButtonText: '我知道了'
});
}
},
beforeDestroy() {
if (this.timer) {
clearInterval(this.timer);
}
}
})
</script>
</body>
</html>
+735
View File
@@ -0,0 +1,735 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>任务管理 - 图片收集小程序</title>
<!-- 引入Vue.js -->
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.min.js"></script>
<!-- 引入Element UI CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/element-ui@2.15.8/lib/theme-chalk/index.css">
<!-- 引入Element UI JavaScript -->
<script src="https://cdn.jsdelivr.net/npm/element-ui@2.15.8/lib/index.js"></script>
<!-- 引入Font Awesome -->
<link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
body {
margin: 0;
padding: 0;
height: 100vh;
background-color: #f5f7fa;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
padding-top: env(safe-area-inset-top);
overflow-x: hidden;
}
.container {
height: 100vh;
display: flex;
flex-direction: column;
}
.header {
background-color: #1989fa;
color: white;
padding: 15px;
display: flex;
justify-content: space-between;
align-items: center;
position: sticky;
top: 0;
z-index: 100;
}
.header-title {
font-size: 18px;
font-weight: bold;
}
.header-action {
font-size: 16px;
}
.content {
flex: 1;
padding: 15px;
overflow-y: auto;
}
.filter-section {
background-color: white;
border-radius: 8px;
padding: 15px;
margin-bottom: 15px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);
}
.filter-row {
display: flex;
gap: 10px;
margin-bottom: 15px;
}
.filter-item {
flex: 1;
}
.search-input {
margin-bottom: 0;
}
.task-card {
background-color: white;
border-radius: 8px;
padding: 15px;
margin-bottom: 15px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);
transition: transform 0.2s, box-shadow 0.2s;
}
.task-card:active {
transform: scale(0.98);
}
.task-header {
display: flex;
justify-content: space-between;
align-items: flex-start;
margin-bottom: 10px;
}
.task-title {
font-size: 16px;
font-weight: 600;
color: #303133;
flex: 1;
margin-right: 10px;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
.task-status {
font-size: 12px;
padding: 2px 8px;
border-radius: 4px;
}
.status-active {
background-color: #ecf5ff;
color: #1989fa;
}
.status-completed {
background-color: #f0f9eb;
color: #67c23a;
}
.status-expired {
background-color: #fef0f0;
color: #f56c6c;
}
.task-info {
display: flex;
flex-wrap: wrap;
gap: 10px;
margin-bottom: 10px;
}
.info-item {
display: flex;
align-items: center;
font-size: 12px;
color: #606266;
}
.info-icon {
margin-right: 4px;
font-size: 12px;
}
.task-progress {
margin-top: 10px;
}
.progress-info {
display: flex;
justify-content: space-between;
font-size: 12px;
margin-bottom: 5px;
}
.progress-text {
color: #606266;
}
.progress-percent {
color: #1989fa;
font-weight: 500;
}
.progress-bar {
height: 6px;
background-color: #f0f2f5;
border-radius: 3px;
overflow: hidden;
}
.progress-fill {
height: 100%;
border-radius: 3px;
transition: width 0.3s;
}
.progress-active {
background-color: #1989fa;
}
.progress-completed {
background-color: #67c23a;
}
.progress-low {
background-color: #f56c6c;
}
.empty-state {
text-align: center;
padding: 40px 20px;
color: #909399;
}
.empty-icon {
font-size: 48px;
margin-bottom: 16px;
color: #dcdfe6;
}
.empty-text {
font-size: 14px;
}
.bottom-nav {
background-color: white;
display: flex;
justify-content: space-around;
padding: 10px 0;
box-shadow: 0 -2px 12px 0 rgba(0, 0, 0, 0.05);
position: sticky;
bottom: 0;
z-index: 100;
padding-bottom: env(safe-area-inset-bottom, 10px);
}
.nav-item {
display: flex;
flex-direction: column;
align-items: center;
font-size: 12px;
color: #909399;
width: 25%;
}
.nav-icon {
font-size: 20px;
margin-bottom: 4px;
}
.nav-item.active {
color: #1989fa;
}
.task-deadline {
display: flex;
align-items: center;
font-size: 12px;
margin-top: 8px;
}
.deadline-icon {
margin-right: 5px;
color: #e6a23c;
}
.overdue {
color: #f56c6c;
}
.normal {
color: #606266;
}
.urgent {
color: #e6a23c;
}
.task-actions {
display: flex;
gap: 10px;
margin-top: 15px;
border-top: 1px solid #ebeef5;
padding-top: 10px;
}
.action-btn {
flex: 1;
font-size: 14px;
padding: 6px 0;
}
.avatar-list {
display: flex;
align-items: center;
}
.avatar {
width: 24px;
height: 24px;
border-radius: 50%;
border: 2px solid white;
background-color: #dcdfe6;
display: flex;
align-items: center;
justify-content: center;
font-size: 10px;
color: #606266;
margin-left: -8px;
}
.avatar:first-child {
margin-left: 0;
}
.avatar-more {
background-color: #ecf5ff;
color: #1989fa;
}
</style>
</head>
<body>
<div id="app">
<div class="container">
<!-- 顶部导航栏 -->
<div class="header">
<div class="header-action" @click="toggleFilter">
<i class="fa fa-filter"></i> 筛选
</div>
<div class="header-title">任务管理</div>
<div class="header-action" @click="refreshTasks">
<i class="fa fa-refresh"></i>
</div>
</div>
<!-- 筛选区域 -->
<transition name="fade">
<div v-if="showFilter" class="filter-section">
<div class="filter-row">
<div class="filter-item">
<el-select
v-model="filter.status"
placeholder="任务状态"
size="small"
clearable
>
<el-option label="进行中" value="active"></el-option>
<el-option label="已完成" value="completed"></el-option>
<el-option label="已过期" value="expired"></el-option>
</el-select>
</div>
<div class="filter-item">
<el-select
v-model="filter.priority"
placeholder="优先级"
size="small"
clearable
>
<el-option label="紧急" value="high"></el-option>
<el-option label="普通" value="normal"></el-option>
<el-option label="低" value="low"></el-option>
</el-select>
</div>
</div>
<el-input
v-model="filter.keyword"
placeholder="搜索任务名称或描述"
size="small"
class="search-input"
prefix-icon="el-icon-search"
clearable
></el-input>
</div>
</transition>
<!-- 任务列表 -->
<div class="content">
<!-- 任务卡片列表 -->
<div v-if="filteredTasks.length > 0">
<div
v-for="task in filteredTasks"
:key="task.id"
class="task-card"
@click="viewTaskDetail(task.id)"
>
<div class="task-header">
<div class="task-title">{{ task.title }}</div>
<div
class="task-status"
:class="{
'status-active': task.status === 'active',
'status-completed': task.status === 'completed',
'status-expired': task.status === 'expired'
}"
>
{{ getStatusText(task.status) }}
</div>
</div>
<div class="task-info">
<div class="info-item">
<i class="fa fa-calendar info-icon"></i>
{{ formatDate(task.createTime) }}
</div>
<div class="info-item">
<i class="fa fa-user-o info-icon"></i>
{{ task.creator }}
</div>
<div class="info-item">
<i class="fa fa-picture-o info-icon"></i>
{{ task.uploadedCount }}/{{ task.totalCount }}
</div>
</div>
<div class="task-deadline" :class="getDeadlineClass(task.deadline)">
<i class="fa fa-clock-o deadline-icon"></i>
截止日期:{{ formatDate(task.deadline) }}
<span v-if="getDeadlineClass(task.deadline) === 'overdue'">(已过期)</span>
<span v-else-if="getDeadlineClass(task.deadline) === 'urgent'">(即将到期)</span>
</div>
<div class="task-progress">
<div class="progress-info">
<div class="progress-text">完成进度</div>
<div class="progress-percent">{{ task.progress }}%</div>
</div>
<div class="progress-bar">
<div
class="progress-fill"
:class="{
'progress-active': task.status === 'active',
'progress-completed': task.status === 'completed',
'progress-low': task.progress < 30
}"
:style="{ width: task.progress + '%' }"
></div>
</div>
</div>
<div v-if="task.participants.length > 0" style="margin-top: 10px;">
<div class="info-item" style="font-size: 12px; color: #909399;">
<i class="fa fa-users info-icon"></i>
参与人员:
</div>
<div class="avatar-list" style="margin-top: 5px;">
<div
v-for="(participant, index) in task.participants.slice(0, 4)"
:key="index"
class="avatar"
:title="participant.name"
>
{{ participant.name.substring(0, 1) }}
</div>
<div v-if="task.participants.length > 4" class="avatar avatar-more">
+{{ task.participants.length - 4 }}
</div>
</div>
</div>
<!-- 任务操作按钮(仅对进行中的任务显示) -->
<div v-if="task.status === 'active' && userRole === 'user'" class="task-actions">
<el-button
type="primary"
size="small"
class="action-btn"
@click.stop="uploadForTask(task.id)"
>
<i class="fa fa-upload"></i> 上传图片
</el-button>
<el-button
type="default"
size="small"
class="action-btn"
@click.stop="viewTaskImages(task.id)"
>
<i class="fa fa-eye"></i> 查看图片
</el-button>
</div>
</div>
</div>
<!-- 空状态 -->
<div v-else class="empty-state">
<i class="fa fa-tasks empty-icon"></i>
<div class="empty-text">暂无符合条件的任务</div>
<el-button
type="primary"
size="small"
style="margin-top: 20px;"
@click="resetFilter"
>
重置筛选
</el-button>
</div>
</div>
<!-- 底部导航栏 -->
<div class="bottom-nav">
<div
class="nav-item"
:class="{ active: currentPage === 'home' }"
@click="navigateTo('home')"
>
<i class="fa fa-home nav-icon"></i>
<span>首页</span>
</div>
<div
class="nav-item"
:class="{ active: currentPage === 'task' }"
@click="navigateTo('task')"
>
<i class="fa fa-tasks nav-icon"></i>
<span>任务</span>
</div>
<div
class="nav-item"
:class="{ active: currentPage === 'upload' }"
@click="navigateTo('upload')"
>
<i class="fa fa-cloud-upload nav-icon"></i>
<span>上传</span>
</div>
<div
class="nav-item"
:class="{ active: currentPage === 'profile' }"
@click="navigateTo('profile')"
>
<i class="fa fa-user-o nav-icon"></i>
<span>我的</span>
</div>
</div>
</div>
</div>
<script>
new Vue({
el: '#app',
data() {
return {
showFilter: false,
filter: {
status: '',
priority: '',
keyword: ''
},
tasks: [
{
id: 1,
title: '产品包装图片收集 - 2023夏季新品',
description: '收集所有2023夏季新品的包装图片,包括正面、侧面、背面和细节特写',
status: 'active',
priority: 'high',
createTime: '2023-06-10',
deadline: '2023-06-20',
creator: '张经理',
uploadedCount: 15,
totalCount: 30,
progress: 50,
participants: [
{ id: 1, name: '李明' },
{ id: 2, name: '王华' },
{ id: 3, name: '赵小红' },
{ id: 4, name: '陈强' },
{ id: 5, name: '刘芳' }
]
},
{
id: 2,
title: '办公环境升级照片拍摄',
description: '拍摄新装修办公区域的照片,包括工位区、会议室、休闲区等',
status: 'completed',
priority: 'normal',
createTime: '2023-05-25',
deadline: '2023-06-05',
creator: '李总监',
uploadedCount: 25,
totalCount: 25,
progress: 100,
participants: [
{ id: 6, name: '摄影部小王' }
]
},
{
id: 3,
title: '618活动现场照片采集',
description: '收集618促销活动的现场照片,重点拍摄顾客互动和产品展示环节',
status: 'expired',
priority: 'high',
createTime: '2023-06-15',
deadline: '2023-06-18',
creator: '市场部陈经理',
uploadedCount: 12,
totalCount: 40,
progress: 30,
participants: [
{ id: 7, name: '市场部团队' }
]
},
{
id: 4,
title: '员工活动照片记录',
description: '拍摄公司团建活动的照片,记录员工参与的各种活动场景',
status: 'active',
priority: 'low',
createTime: '2023-06-18',
deadline: '2023-06-25',
creator: '人力资源部',
uploadedCount: 5,
totalCount: 20,
progress: 25,
participants: []
},
{
id: 5,
title: '客户案例照片收集',
description: '收集各部门合作的成功客户案例照片,用于公司宣传材料',
status: 'active',
priority: 'normal',
createTime: '2023-06-05',
deadline: '2023-07-05',
creator: '市场部',
uploadedCount: 8,
totalCount: 35,
progress: 23,
participants: [
{ id: 8, name: '销售部张经理' },
{ id: 9, name: '技术部王工' }
]
}
],
userRole: 'user', // 可以是 'user', 'dept_manager', 'admin'
currentPage: 'task'
}
},
computed: {
filteredTasks() {
let result = this.tasks;
// 按状态筛选
if (this.filter.status) {
result = result.filter(task => task.status === this.filter.status);
}
// 按优先级筛选
if (this.filter.priority) {
result = result.filter(task => task.priority === this.filter.priority);
}
// 按关键词搜索
if (this.filter.keyword) {
const keyword = this.filter.keyword.toLowerCase();
result = result.filter(task =>
task.title.toLowerCase().includes(keyword) ||
task.description.toLowerCase().includes(keyword)
);
}
// 排序:进行中的任务优先,然后按截止日期排序
result.sort((a, b) => {
// 状态排序
const statusOrder = { active: 0, expired: 1, completed: 2 };
if (statusOrder[a.status] !== statusOrder[b.status]) {
return statusOrder[a.status] - statusOrder[b.status];
}
// 优先级排序
const priorityOrder = { high: 0, normal: 1, low: 2 };
if (priorityOrder[a.priority] !== priorityOrder[b.priority]) {
return priorityOrder[a.priority] - priorityOrder[b.priority];
}
// 截止日期排序
return new Date(a.deadline) - new Date(b.deadline);
});
return result;
}
},
methods: {
// 切换筛选面板
toggleFilter() {
this.showFilter = !this.showFilter;
},
// 重置筛选条件
resetFilter() {
this.filter = {
status: '',
priority: '',
keyword: ''
};
},
// 刷新任务列表
refreshTasks() {
this.$message.success('任务列表已刷新');
// 模拟刷新动画
const content = document.querySelector('.content');
content.style.opacity = '0.5';
setTimeout(() => {
content.style.opacity = '1';
}, 300);
},
// 格式化日期
formatDate(dateStr) {
const date = new Date(dateStr);
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
},
// 获取状态文本
getStatusText(status) {
const statusMap = {
active: '进行中',
completed: '已完成',
expired: '已过期'
};
return statusMap[status] || status;
},
// 获取截止日期样式类
getDeadlineClass(deadlineStr) {
const now = new Date();
const deadline = new Date(deadlineStr);
const diffTime = deadline - now;
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
if (diffDays < 0) {
return 'overdue';
} else if (diffDays <= 3) {
return 'urgent';
} else {
return 'normal';
}
},
// 查看任务详情
viewTaskDetail(taskId) {
this.$router && this.$router.push(`/task/detail/${taskId}`);
this.$message.info(`查看任务ID: ${taskId} 的详情`);
},
// 上传图片到指定任务
uploadForTask(taskId) {
// 跳转到上传页面,并带上任务ID参数
window.location.href = `image-upload.html?taskId=${taskId}`;
},
// 查看任务的图片列表
viewTaskImages(taskId) {
// 跳转到任务图片列表页面
this.$message.info(`查看任务ID: ${taskId} 的图片`);
},
// 导航到其他页面
navigateTo(page) {
this.currentPage = page;
let url = '';
switch (page) {
case 'home':
url = this.userRole === 'admin' ? 'admin-home.html' :
this.userRole === 'dept_manager' ? 'dept-home.html' : 'user-home.html';
break;
case 'task':
url = 'task-management.html';
break;
case 'upload':
url = 'image-upload.html';
break;
case 'profile':
url = 'user-profile.html';
break;
}
if (url && url !== window.location.pathname) {
window.location.href = url;
}
}
},
mounted() {
// 检查URL参数,判断用户角色
const urlParams = new URLSearchParams(window.location.search);
const role = urlParams.get('role');
if (role) {
this.userRole = role;
}
}
})
</script>
</body>
</html>
+457
View File
@@ -0,0 +1,457 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>首页 - 图片收集小程序</title>
<!-- 引入Vue.js -->
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.min.js"></script>
<!-- 引入Element UI CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/element-ui@2.15.8/lib/theme-chalk/index.css">
<!-- 引入Element UI JavaScript -->
<script src="https://cdn.jsdelivr.net/npm/element-ui@2.15.8/lib/index.js"></script>
<!-- 引入Font Awesome -->
<link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
body {
margin: 0;
padding: 0;
height: 100vh;
background-color: #f5f7fa;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
padding-top: env(safe-area-inset-top);
padding-bottom: calc(env(safe-area-inset-bottom) + 60px);
overflow-x: hidden;
}
.container {
height: 100vh;
display: flex;
flex-direction: column;
}
.header {
background-color: #1989fa;
color: white;
padding: 15px;
display: flex;
justify-content: space-between;
align-items: center;
position: sticky;
top: 0;
z-index: 100;
}
.header-title {
font-size: 18px;
font-weight: bold;
}
.user-avatar {
width: 36px;
height: 36px;
border-radius: 50%;
background-color: white;
display: flex;
align-items: center;
justify-content: center;
color: #1989fa;
font-size: 16px;
}
.content {
flex: 1;
padding: 15px;
overflow-y: auto;
}
.card {
background-color: white;
border-radius: 8px;
padding: 15px;
margin-bottom: 15px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);
}
.task-item {
padding: 12px;
border: 1px solid #ebeef5;
border-radius: 8px;
margin-bottom: 10px;
transition: all 0.3s;
}
.task-item:hover {
border-color: #1989fa;
box-shadow: 0 2px 12px 0 rgba(25, 136, 250, 0.1);
}
.task-title {
font-size: 16px;
font-weight: 500;
color: #303133;
margin-bottom: 5px;
}
.task-info {
font-size: 12px;
color: #909399;
}
.task-deadline {
color: #f56c6c;
}
.image-grid {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 10px;
}
.image-card {
position: relative;
border-radius: 8px;
overflow: hidden;
padding-bottom: 100%;
background-color: #f5f7fa;
}
.image-card img {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: cover;
}
.image-info {
position: absolute;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.5);
color: white;
padding: 8px;
font-size: 12px;
}
.image-status {
position: absolute;
top: 8px;
right: 8px;
padding: 2px 6px;
border-radius: 10px;
font-size: 10px;
}
.status-pending {
background-color: #e6a23c;
color: white;
}
.status-approved {
background-color: #67c23a;
color: white;
}
.status-rejected {
background-color: #f56c6c;
color: white;
}
.upload-btn {
position: fixed;
bottom: 80px;
right: 20px;
width: 56px;
height: 56px;
border-radius: 50%;
background-color: #1989fa;
color: white;
display: flex;
align-items: center;
justify-content: center;
font-size: 24px;
box-shadow: 0 4px 12px rgba(25, 136, 250, 0.4);
z-index: 90;
}
.footer-nav {
position: fixed;
bottom: 0;
left: 0;
right: 0;
height: 60px;
background-color: white;
display: flex;
justify-content: space-around;
align-items: center;
box-shadow: 0 -2px 12px 0 rgba(0, 0, 0, 0.05);
z-index: 99;
padding-bottom: env(safe-area-inset-bottom);
}
.nav-item {
display: flex;
flex-direction: column;
align-items: center;
font-size: 12px;
color: #909399;
}
.nav-item.active {
color: #1989fa;
}
.nav-icon {
font-size: 20px;
margin-bottom: 4px;
}
.section-title {
font-size: 16px;
font-weight: bold;
color: #303133;
margin-bottom: 10px;
display: flex;
justify-content: space-between;
align-items: center;
}
.view-more {
font-size: 14px;
color: #1989fa;
}
</style>
</head>
<body>
<div id="app">
<div class="container">
<!-- 顶部导航栏 -->
<div class="header">
<div class="header-title">图片收集小程序</div>
<el-dropdown>
<span class="user-avatar cursor-pointer">
<i class="fa fa-user"></i>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click="goToProfile">个人中心</el-dropdown-item>
<el-dropdown-item @click="logout" divided>退出登录</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
<!-- 主内容区 -->
<div class="content" ref="content" @touchstart="touchStart" @touchmove="touchMove" @touchend="touchEnd">
<!-- 下拉刷新提示 -->
<div class="pull-refresh" v-if="pulling" :style="{ height: pullHeight + 'px', textAlign: 'center', lineHeight: pullHeight + 'px' }">
<i class="fa fa-refresh" :class="{ 'fa-spin': refreshing }"></i>
<span>{{ refreshText }}</span>
</div>
<!-- 待完成任务卡片 -->
<div class="card">
<div class="section-title">
待完成任务
</div>
<div v-if="tasks.length > 0">
<div
v-for="task in tasks"
:key="task.id"
class="task-item"
@click="viewTaskDetail(task.id)"
>
<div class="task-title">{{ task.name }}</div>
<div class="task-info">
<span>{{ task.department }}</span>
<span class="ml-2 task-deadline">截止: {{ task.deadline }}</span>
</div>
<div class="task-info mt-1">
<span>{{ task.progress }}%</span>
<el-progress :percentage="task.progress" :stroke-width="4" :show-text="false" class="ml-2"></el-progress>
</div>
</div>
</div>
<div v-else class="text-center text-gray-400 py-10">
暂无待完成任务
</div>
</div>
<!-- 我的上传图片列表 -->
<div class="card">
<div class="section-title">
我的上传
<span class="view-more" @click="viewAllUploads">查看全部</span>
</div>
<div class="image-grid">
<div
v-for="image in recentImages"
:key="image.id"
class="image-card"
@click="viewImageDetail(image.id)"
>
<img :src="image.url" :alt="image.title">
<div class="image-info">{{ image.title }}</div>
<div class="image-status" :class="`status-${image.status}`">
{{ getStatusText(image.status) }}
</div>
</div>
</div>
</div>
</div>
<!-- 快速上传按钮 -->
<div class="upload-btn" @click="goToUpload">
<i class="fa fa-camera"></i>
</div>
<!-- 底部导航栏 -->
<div class="footer-nav">
<div class="nav-item active" @click="goToHome">
<i class="nav-icon fa fa-home"></i>
<span>首页</span>
</div>
<div class="nav-item" @click="goToUpload">
<i class="nav-icon fa fa-upload"></i>
<span>上传</span>
</div>
<div class="nav-item" @click="goToProfile">
<i class="nav-icon fa fa-user"></i>
<span>我的</span>
</div>
</div>
</div>
</div>
<script>
new Vue({
el: '#app',
data() {
return {
tasks: [
{
id: 1,
name: '产品包装收集',
department: '市场部',
deadline: '2023-10-15',
progress: 30
},
{
id: 2,
name: '活动现场拍摄',
department: '品牌部',
deadline: '2023-10-20',
progress: 0
}
],
recentImages: [
{
id: 1,
title: '产品正面照',
url: 'https://via.placeholder.com/300x300',
status: 'pending'
},
{
id: 2,
title: '产品侧面照',
url: 'https://via.placeholder.com/300x300',
status: 'approved'
},
{
id: 3,
title: '产品背面照',
url: 'https://via.placeholder.com/300x300',
status: 'pending'
},
{
id: 4,
title: '使用场景',
url: 'https://via.placeholder.com/300x300',
status: 'rejected'
}
],
// 下拉刷新相关
pulling: false,
pullHeight: 0,
maxPullHeight: 80,
startY: 0,
refreshing: false,
refreshText: '下拉刷新'
}
},
methods: {
// 获取状态文本
getStatusText(status) {
const statusMap = {
pending: '待审核',
approved: '已通过',
rejected: '已拒绝'
};
return statusMap[status] || '未知';
},
// 查看任务详情
viewTaskDetail(taskId) {
this.$message.info('查看任务详情:' + taskId);
},
// 查看图片详情
viewImageDetail(imageId) {
window.location.href = 'image-detail.html?id=' + imageId;
},
// 查看全部上传
viewAllUploads() {
this.$message.info('查看全部上传图片');
},
// 跳转到上传页面
goToUpload() {
window.location.href = 'image-upload.html';
},
// 跳转到个人中心
goToProfile() {
this.$message.info('跳转到个人中心');
},
// 退出登录
logout() {
this.$confirm('确定要退出登录吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
window.location.href = 'login.html';
});
},
// 下拉刷新相关方法
touchStart(event) {
if (this.$refs.content.scrollTop === 0) {
this.startY = event.touches[0].clientY;
this.pulling = true;
}
},
touchMove(event) {
if (this.pulling && !this.refreshing) {
const moveY = event.touches[0].clientY;
const pullDistance = moveY - this.startY;
if (pullDistance > 0) {
event.preventDefault();
this.pullHeight = Math.min(pullDistance, this.maxPullHeight);
if (this.pullHeight > this.maxPullHeight * 0.7) {
this.refreshText = '释放刷新';
} else {
this.refreshText = '下拉刷新';
}
}
}
},
touchEnd() {
if (this.pulling && !this.refreshing) {
if (this.pullHeight > this.maxPullHeight * 0.7) {
this.refreshData();
} else {
this.pullHeight = 0;
this.pulling = false;
}
}
},
refreshData() {
this.refreshing = true;
this.refreshText = '刷新中...';
// 模拟刷新数据
setTimeout(() => {
this.pulling = false;
this.pullHeight = 0;
this.refreshing = false;
this.$message.success('刷新成功');
}, 1500);
}
}
})
</script>
</body>
</html>
+627
View File
@@ -0,0 +1,627 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>个人中心 - 图片收集小程序</title>
<!-- 引入Vue.js -->
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.min.js"></script>
<!-- 引入Element UI CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/element-ui@2.15.8/lib/theme-chalk/index.css">
<!-- 引入Element UI JavaScript -->
<script src="https://cdn.jsdelivr.net/npm/element-ui@2.15.8/lib/index.js"></script>
<!-- 引入Font Awesome -->
<link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
body {
margin: 0;
padding: 0;
height: 100vh;
background-color: #f5f7fa;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
padding-top: env(safe-area-inset-top);
overflow-x: hidden;
}
.container {
height: 100vh;
display: flex;
flex-direction: column;
}
.header {
background-color: #1989fa;
color: white;
padding: 15px;
display: flex;
justify-content: space-between;
align-items: center;
position: sticky;
top: 0;
z-index: 100;
}
.header-title {
font-size: 18px;
font-weight: bold;
}
.header-action {
font-size: 16px;
}
.profile-header {
background: linear-gradient(135deg, #1989fa 0%, #36cfc9 100%);
color: white;
padding: 25px 15px;
position: relative;
}
.avatar-container {
display: flex;
align-items: center;
}
.avatar {
width: 70px;
height: 70px;
border-radius: 50%;
border: 3px solid rgba(255, 255, 255, 0.3);
object-fit: cover;
background-color: white;
}
.user-info {
margin-left: 15px;
flex: 1;
}
.user-name {
font-size: 18px;
font-weight: 600;
margin-bottom: 5px;
}
.user-meta {
font-size: 14px;
opacity: 0.9;
display: flex;
align-items: center;
}
.badge {
background-color: rgba(255, 255, 255, 0.2);
padding: 2px 8px;
border-radius: 10px;
font-size: 12px;
margin-left: 10px;
}
.stat-card {
background-color: white;
border-radius: 8px;
margin: -25px 15px 15px 15px;
padding: 15px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);
display: flex;
justify-content: space-around;
}
.stat-item {
text-align: center;
flex: 1;
}
.stat-value {
font-size: 18px;
font-weight: 600;
color: #303133;
margin-bottom: 5px;
}
.stat-label {
font-size: 12px;
color: #909399;
}
.menu-section {
background-color: white;
border-radius: 8px;
margin: 0 15px 15px 15px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);
overflow: hidden;
}
.menu-group {
border-bottom: 1px solid #ebeef5;
}
.menu-group:last-child {
border-bottom: none;
}
.menu-item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 15px;
border-bottom: 1px solid #f0f2f5;
}
.menu-item:last-child {
border-bottom: none;
}
.menu-item:active {
background-color: #f5f7fa;
}
.menu-left {
display: flex;
align-items: center;
}
.menu-icon {
font-size: 18px;
width: 24px;
text-align: center;
margin-right: 12px;
color: #1989fa;
}
.menu-text {
font-size: 15px;
color: #303133;
}
.menu-right {
display: flex;
align-items: center;
color: #909399;
}
.menu-arrow {
font-size: 16px;
margin-left: 5px;
}
.menu-badge {
background-color: #f56c6c;
color: white;
font-size: 12px;
padding: 2px 6px;
border-radius: 10px;
margin-right: 5px;
}
.logout-btn {
margin: 20px 15px;
width: calc(100% - 30px);
}
.settings-row {
display: flex;
justify-content: space-between;
align-items: center;
padding: 15px;
background-color: white;
border-bottom: 1px solid #f0f2f5;
}
.settings-label {
font-size: 15px;
color: #303133;
}
.settings-value {
font-size: 14px;
color: #909399;
}
.bottom-nav {
background-color: white;
display: flex;
justify-content: space-around;
padding: 10px 0;
box-shadow: 0 -2px 12px 0 rgba(0, 0, 0, 0.05);
position: sticky;
bottom: 0;
z-index: 100;
padding-bottom: env(safe-area-inset-bottom, 10px);
}
.nav-item {
display: flex;
flex-direction: column;
align-items: center;
font-size: 12px;
color: #909399;
width: 25%;
}
.nav-icon {
font-size: 20px;
margin-bottom: 4px;
}
.nav-item.active {
color: #1989fa;
}
.divider {
height: 10px;
background-color: #f5f7fa;
}
.role-specific {
display: none;
}
.admin-role .admin-only,
.dept-role .dept-only {
display: block;
}
.info-card {
background-color: #ecf5ff;
border-left: 4px solid #1989fa;
padding: 10px;
margin: 15px;
border-radius: 4px;
font-size: 13px;
color: #606266;
}
</style>
</head>
<body>
<div id="app" :class="userRole === 'admin' ? 'admin-role' : userRole === 'dept_manager' ? 'dept-role' : ''">
<div class="container">
<!-- 顶部导航栏 -->
<div class="header">
<div class="header-action"></div>
<div class="header-title">个人中心</div>
<div class="header-action" @click="showSettings = !showSettings">
<i class="fa fa-cog"></i>
</div>
</div>
<!-- 个人信息头部 -->
<div class="profile-header">
<div class="avatar-container">
<img :src="userInfo.avatar" class="avatar" :alt="userInfo.name">
<div class="user-info">
<div class="user-name">{{ userInfo.name }}</div>
<div class="user-meta">
<span>{{ userInfo.department }} | {{ userInfo.position }}</span>
<span class="badge">{{ getRoleText() }}</span>
</div>
</div>
</div>
</div>
<!-- 统计卡片 -->
<div class="stat-card">
<div class="stat-item">
<div class="stat-value">{{ userStats.uploadedImages }}</div>
<div class="stat-label">已上传图片</div>
</div>
<div class="stat-item">
<div class="stat-value">{{ userStats.completedTasks }}</div>
<div class="stat-label">已完成任务</div>
</div>
<div class="stat-item">
<div class="stat-value">{{ userStats.approvalRate }}%</div>
<div class="stat-label">通过率</div>
</div>
</div>
<!-- 信息提示卡片(仅管理员/部门负责人可见) -->
<div v-if="userRole === 'admin' || userRole === 'dept_manager'" class="info-card">
<i class="fa fa-info-circle"></i> 您有 {{ pendingActions.count }} 个待处理事项
</div>
<!-- 功能菜单区域 -->
<div class="menu-section">
<div class="menu-group">
<div class="menu-item" @click="viewMyUploads">
<div class="menu-left">
<i class="fa fa-picture-o menu-icon"></i>
<span class="menu-text">我的上传</span>
</div>
<div class="menu-right">
<i class="fa fa-angle-right menu-arrow"></i>
</div>
</div>
<div class="menu-item" @click="viewMyTasks">
<div class="menu-left">
<i class="fa fa-tasks menu-icon"></i>
<span class="menu-text">我的任务</span>
</div>
<div class="menu-right">
<span v-if="userStats.pendingTasks > 0" class="menu-badge">{{ userStats.pendingTasks }}</span>
<i class="fa fa-angle-right menu-arrow"></i>
</div>
</div>
<div class="menu-item" @click="viewFavorites">
<div class="menu-left">
<i class="fa fa-star menu-icon"></i>
<span class="menu-text">我的收藏</span>
</div>
<div class="menu-right">
<i class="fa fa-angle-right menu-arrow"></i>
</div>
</div>
</div>
<!-- 管理员特定菜单 -->
<div class="menu-group admin-only">
<div class="menu-item" @click="manageDepartments">
<div class="menu-left">
<i class="fa fa-building-o menu-icon"></i>
<span class="menu-text">部门管理</span>
</div>
<div class="menu-right">
<i class="fa fa-angle-right menu-arrow"></i>
</div>
</div>
<div class="menu-item" @click="manageUsers">
<div class="menu-left">
<i class="fa fa-users menu-icon"></i>
<span class="menu-text">用户管理</span>
</div>
<div class="menu-right">
<i class="fa fa-angle-right menu-arrow"></i>
</div>
</div>
<div class="menu-item" @click="manageTasks">
<div class="menu-left">
<i class="fa fa-list-alt menu-icon"></i>
<span class="menu-text">任务管理</span>
</div>
<div class="menu-right">
<i class="fa fa-angle-right menu-arrow"></i>
</div>
</div>
</div>
<!-- 部门负责人特定菜单 -->
<div class="menu-group dept-only">
<div class="menu-item" @click="reviewImages">
<div class="menu-left">
<i class="fa fa-check-circle menu-icon"></i>
<span class="menu-text">图片审核</span>
</div>
<div class="menu-right">
<span v-if="pendingActions.reviewCount > 0" class="menu-badge">{{ pendingActions.reviewCount }}</span>
<i class="fa fa-angle-right menu-arrow"></i>
</div>
</div>
<div class="menu-item" @click="manageDeptTasks">
<div class="menu-left">
<i class="fa fa-calendar-check-o menu-icon"></i>
<span class="menu-text">部门任务</span>
</div>
<div class="menu-right">
<i class="fa fa-angle-right menu-arrow"></i>
</div>
</div>
</div>
</div>
<div class="divider"></div>
<!-- 其他功能 -->
<div class="menu-section">
<div class="menu-group">
<div class="menu-item" @click="openFeedback">
<div class="menu-left">
<i class="fa fa-commenting-o menu-icon"></i>
<span class="menu-text">意见反馈</span>
</div>
<div class="menu-right">
<i class="fa fa-angle-right menu-arrow"></i>
</div>
</div>
<div class="menu-item" @click="openAbout">
<div class="menu-left">
<i class="fa fa-info-circle menu-icon"></i>
<span class="menu-text">关于我们</span>
</div>
<div class="menu-right">
<span class="settings-value">v1.0.0</span>
<i class="fa fa-angle-right menu-arrow"></i>
</div>
</div>
</div>
</div>
<!-- 退出登录按钮 -->
<el-button
type="danger"
class="logout-btn"
@click="handleLogout"
>
退出登录
</el-button>
<!-- 底部导航栏 -->
<div class="bottom-nav">
<div
class="nav-item"
:class="{ active: currentPage === 'home' }"
@click="navigateTo('home')"
>
<i class="fa fa-home nav-icon"></i>
<span>首页</span>
</div>
<div
class="nav-item"
:class="{ active: currentPage === 'task' }"
@click="navigateTo('task')"
>
<i class="fa fa-tasks nav-icon"></i>
<span>任务</span>
</div>
<div
class="nav-item"
:class="{ active: currentPage === 'upload' }"
@click="navigateTo('upload')"
>
<i class="fa fa-cloud-upload nav-icon"></i>
<span>上传</span>
</div>
<div
class="nav-item"
:class="{ active: currentPage === 'profile' }"
@click="navigateTo('profile')"
>
<i class="fa fa-user-o nav-icon"></i>
<span>我的</span>
</div>
</div>
</div>
</div>
<script>
new Vue({
el: '#app',
data() {
return {
showSettings: false,
currentPage: 'profile',
userRole: 'user', // 'user', 'dept_manager', 'admin'
userInfo: {
name: '李明',
avatar: 'https://cdn.jsdelivr.net/npm/element-ui@2.15.8/lib/theme-chalk/avatar.jpg',
department: '市场部',
position: '专员',
phone: '138****6789',
email: 'liming@example.com',
joinDate: '2022-03-15'
},
userStats: {
uploadedImages: 42,
completedTasks: 12,
pendingTasks: 3,
approvalRate: 95
},
pendingActions: {
count: 8,
reviewCount: 5,
taskCount: 3
}
}
},
methods: {
// 获取角色文本
getRoleText() {
const roleMap = {
'user': '普通用户',
'dept_manager': '部门负责人',
'admin': '管理员'
};
return roleMap[this.userRole] || '普通用户';
},
// 查看我的上传
viewMyUploads() {
this.$message.info('查看我的上传记录');
},
// 查看我的任务
viewMyTasks() {
window.location.href = 'task-management.html';
},
// 查看我的收藏
viewFavorites() {
this.$message.info('查看我的收藏');
},
// 部门管理(管理员)
manageDepartments() {
this.$message.info('管理部门');
},
// 用户管理(管理员)
manageUsers() {
this.$message.info('管理用户');
},
// 任务管理(管理员)
manageTasks() {
this.$message.info('管理任务');
},
// 图片审核(部门负责人)
reviewImages() {
this.$message.info('审核图片');
},
// 部门任务管理(部门负责人)
manageDeptTasks() {
this.$message.info('管理部门任务');
},
// 打开反馈
openFeedback() {
this.$message.info('打开意见反馈');
},
// 打开关于
openAbout() {
this.$message.info('关于我们');
},
// 处理退出登录
handleLogout() {
this.$confirm('确定要退出登录吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
// 模拟退出登录
this.$message.success('退出成功');
// 跳转到登录页
setTimeout(() => {
window.location.href = 'login.html';
}, 1000);
}).catch(() => {
// 取消退出
});
},
// 导航到其他页面
navigateTo(page) {
this.currentPage = page;
let url = '';
switch (page) {
case 'home':
url = this.userRole === 'admin' ? 'admin-home.html' :
this.userRole === 'dept_manager' ? 'dept-home.html' : 'user-home.html';
break;
case 'task':
url = 'task-management.html';
break;
case 'upload':
url = 'image-upload.html';
break;
case 'profile':
url = 'user-profile.html';
break;
}
if (url && url !== window.location.pathname) {
window.location.href = url;
}
}
},
mounted() {
// 检查URL参数,判断用户角色
const urlParams = new URLSearchParams(window.location.search);
const role = urlParams.get('role');
if (role) {
this.userRole = role;
// 根据角色更新用户信息
if (role === 'admin') {
this.userInfo = {
name: '管理员',
avatar: 'https://cdn.jsdelivr.net/npm/element-ui@2.15.8/lib/theme-chalk/avatar.jpg',
department: '管理员',
position: '系统管理员',
phone: '139****1234',
email: 'admin@example.com',
joinDate: '2020-01-01'
};
this.userStats = {
uploadedImages: 120,
completedTasks: 45,
pendingTasks: 8,
approvalRate: 100
};
} else if (role === 'dept_manager') {
this.userInfo = {
name: '王经理',
avatar: 'https://cdn.jsdelivr.net/npm/element-ui@2.15.8/lib/theme-chalk/avatar.jpg',
department: '技术部',
position: '部门经理',
phone: '137****5678',
email: 'wang@example.com',
joinDate: '2019-06-15'
};
this.userStats = {
uploadedImages: 85,
completedTasks: 28,
pendingTasks: 5,
approvalRate: 98
};
}
}
}
})
</script>
</body>
</html>