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
+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>