home1020
This commit is contained in:
@@ -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>
|
||||
Reference in New Issue
Block a user