home1020
This commit is contained in:
@@ -0,0 +1,326 @@
|
|||||||
|
# Element UI 配置指南
|
||||||
|
|
||||||
|
本文档提供了在项目中正确使用Element UI的配置步骤和最佳实践,替代之前的Tailwind CSS方案。
|
||||||
|
|
||||||
|
## Element UI 简介
|
||||||
|
|
||||||
|
Element UI 是一套基于 Vue 2.0 的桌面端组件库,提供了丰富的UI组件,可以快速构建美观、一致的用户界面。对于我们的图片收集小程序后台管理页面,Element UI提供了完善的PC端组件支持,非常适合构建企业级应用界面。
|
||||||
|
|
||||||
|
## 配置步骤
|
||||||
|
|
||||||
|
### 方法一:使用CDN引入(适合原型开发)
|
||||||
|
|
||||||
|
1. **在HTML文件头部引入Element UI**
|
||||||
|
|
||||||
|
```html
|
||||||
|
<!-- 引入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>
|
||||||
|
|
||||||
|
<!-- 引入Element UI 图标库 -->
|
||||||
|
<link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **初始化Vue实例**
|
||||||
|
|
||||||
|
```html
|
||||||
|
<script>
|
||||||
|
new Vue({
|
||||||
|
el: '#app',
|
||||||
|
data: {
|
||||||
|
// 数据定义
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 方法定义
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
```
|
||||||
|
|
||||||
|
### 方法二:使用npm安装(适合生产环境)
|
||||||
|
|
||||||
|
1. **初始化项目**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm init -y
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **安装依赖**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install vue@2.6.14 element-ui@2.15.8
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **在项目入口文件中引入Element UI**
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// main.js
|
||||||
|
import Vue from 'vue'
|
||||||
|
import ElementUI from 'element-ui'
|
||||||
|
import 'element-ui/lib/theme-chalk/index.css'
|
||||||
|
|
||||||
|
Vue.use(ElementUI)
|
||||||
|
|
||||||
|
new Vue({
|
||||||
|
el: '#app',
|
||||||
|
render: h => h(App)
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
## 核心组件使用示例
|
||||||
|
|
||||||
|
### 1. 布局组件
|
||||||
|
|
||||||
|
```html
|
||||||
|
<div id="app">
|
||||||
|
<!-- 后台管理页面布局 -->
|
||||||
|
<el-container>
|
||||||
|
<!-- 侧边栏导航 -->
|
||||||
|
<el-aside width="200px">
|
||||||
|
<el-menu :default-active="activeIndex" class="el-menu-vertical">
|
||||||
|
<el-submenu index="1">
|
||||||
|
<template slot="title">
|
||||||
|
<i class="fa fa-users"></i>
|
||||||
|
<span>用户管理</span>
|
||||||
|
</template>
|
||||||
|
<el-menu-item index="1-1">用户列表</el-menu-item>
|
||||||
|
<el-menu-item index="1-2">角色权限</el-menu-item>
|
||||||
|
</el-submenu>
|
||||||
|
<el-submenu index="2">
|
||||||
|
<template slot="title">
|
||||||
|
<i class="fa fa-building"></i>
|
||||||
|
<span>部门管理</span>
|
||||||
|
</template>
|
||||||
|
<el-menu-item index="2-1">部门结构</el-menu-item>
|
||||||
|
</el-submenu>
|
||||||
|
<!-- 更多菜单项 -->
|
||||||
|
</el-menu>
|
||||||
|
</el-aside>
|
||||||
|
|
||||||
|
<el-container>
|
||||||
|
<!-- 顶部导航 -->
|
||||||
|
<el-header>
|
||||||
|
<div class="flex justify-between items-center">
|
||||||
|
<div class="text-lg font-medium">图片收集管理系统</div>
|
||||||
|
<div class="flex items-center">
|
||||||
|
<el-dropdown>
|
||||||
|
<span class="el-dropdown-link">
|
||||||
|
<i class="fa fa-bell-o"></i>
|
||||||
|
</span>
|
||||||
|
<el-dropdown-menu slot="dropdown">
|
||||||
|
<el-dropdown-item>通知1</el-dropdown-item>
|
||||||
|
<el-dropdown-item>通知2</el-dropdown-item>
|
||||||
|
</el-dropdown-menu>
|
||||||
|
</el-dropdown>
|
||||||
|
<div class="ml-4">管理员</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-header>
|
||||||
|
|
||||||
|
<!-- 主内容区 -->
|
||||||
|
<el-main>
|
||||||
|
<!-- 页面内容 -->
|
||||||
|
</el-main>
|
||||||
|
</el-container>
|
||||||
|
</el-container>
|
||||||
|
</div>
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. 表格组件(适合数据管理页面)
|
||||||
|
|
||||||
|
```html
|
||||||
|
<el-table :data="tableData" style="width: 100%">
|
||||||
|
<el-table-column prop="id" label="ID" width="80"></el-table-column>
|
||||||
|
<el-table-column prop="name" label="名称"></el-table-column>
|
||||||
|
<el-table-column prop="status" label="状态">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-tag :type="scope.row.status === 'active' ? 'success' : 'danger'">
|
||||||
|
{{ scope.row.status === 'active' ? '启用' : '禁用' }}
|
||||||
|
</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="createTime" label="创建时间"></el-table-column>
|
||||||
|
<el-table-column label="操作" width="150">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button size="small" @click="handleEdit(scope.row)">编辑</el-button>
|
||||||
|
<el-button size="small" type="danger" @click="handleDelete(scope.row)">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<!-- 分页组件 -->
|
||||||
|
<el-pagination
|
||||||
|
layout="prev, pager, next"
|
||||||
|
:total="total"
|
||||||
|
:page-size="10"
|
||||||
|
@current-change="handleCurrentChange"
|
||||||
|
></el-pagination>
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. 表单组件
|
||||||
|
|
||||||
|
```html
|
||||||
|
<el-form :model="formData" :rules="rules" ref="form">
|
||||||
|
<el-form-item label="名称" prop="name">
|
||||||
|
<el-input v-model="formData.name"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="描述">
|
||||||
|
<el-input type="textarea" v-model="formData.description"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="状态">
|
||||||
|
<el-switch v-model="formData.status"></el-switch>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" @click="submitForm('form')">提交</el-button>
|
||||||
|
<el-button @click="resetForm('form')">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
new Vue({
|
||||||
|
el: '#app',
|
||||||
|
data: {
|
||||||
|
formData: {
|
||||||
|
name: '',
|
||||||
|
description: '',
|
||||||
|
status: true
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
name: [
|
||||||
|
{ required: true, message: '请输入名称', trigger: 'blur' },
|
||||||
|
{ min: 2, max: 20, message: '长度在 2 到 20 个字符', trigger: 'blur' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
submitForm(formName) {
|
||||||
|
this.$refs[formName].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
this.$message.success('提交成功!');
|
||||||
|
// 提交表单数据
|
||||||
|
} else {
|
||||||
|
this.$message.error('请检查表单信息');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
resetForm(formName) {
|
||||||
|
this.$refs[formName].resetFields();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. 图片上传组件
|
||||||
|
|
||||||
|
```html
|
||||||
|
<el-upload
|
||||||
|
action="#"
|
||||||
|
list-type="picture-card"
|
||||||
|
:on-preview="handlePictureCardPreview"
|
||||||
|
:on-remove="handleRemove"
|
||||||
|
:before-upload="beforeUpload"
|
||||||
|
multiple
|
||||||
|
>
|
||||||
|
<i class="el-icon-plus"></i>
|
||||||
|
</el-upload>
|
||||||
|
<el-dialog :visible.sync="dialogVisible">
|
||||||
|
<img width="100%" :src="dialogImageUrl" alt="">
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
new Vue({
|
||||||
|
el: '#app',
|
||||||
|
data: {
|
||||||
|
dialogImageUrl: '',
|
||||||
|
dialogVisible: false
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleRemove(file, fileList) {
|
||||||
|
console.log(file, fileList);
|
||||||
|
},
|
||||||
|
handlePictureCardPreview(file) {
|
||||||
|
this.dialogImageUrl = file.url;
|
||||||
|
this.dialogVisible = true;
|
||||||
|
},
|
||||||
|
beforeUpload(file) {
|
||||||
|
const isJPG = file.type === 'image/jpeg' || file.type === 'image/png';
|
||||||
|
const isLt2M = file.size / 1024 / 1024 < 2;
|
||||||
|
|
||||||
|
if (!isJPG) {
|
||||||
|
this.$message.error('上传图片只能是 JPG/PNG 格式!');
|
||||||
|
}
|
||||||
|
if (!isLt2M) {
|
||||||
|
this.$message.error('上传图片大小不能超过 2MB!');
|
||||||
|
}
|
||||||
|
return isJPG && isLt2M;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
```
|
||||||
|
|
||||||
|
## 响应式设计
|
||||||
|
|
||||||
|
Element UI 提供了响应式工具类,可以适配不同的屏幕尺寸:
|
||||||
|
|
||||||
|
```html
|
||||||
|
<div class="el-col-xs-24 el-col-sm-12 el-col-md-8 el-col-lg-6">
|
||||||
|
<!-- 在不同屏幕尺寸下有不同的宽度 -->
|
||||||
|
</div>
|
||||||
|
```
|
||||||
|
|
||||||
|
## 自定义主题
|
||||||
|
|
||||||
|
Element UI 支持自定义主题,可以通过以下方式修改:
|
||||||
|
|
||||||
|
1. **使用在线主题生成工具**
|
||||||
|
访问 Element UI 官方主题生成器,生成自定义主题包。
|
||||||
|
|
||||||
|
2. **通过SCSS变量自定义**
|
||||||
|
```scss
|
||||||
|
// 引入官方样式文件
|
||||||
|
@import "~element-ui/packages/theme-chalk/src/index";
|
||||||
|
|
||||||
|
// 修改变量
|
||||||
|
$--color-primary: #1989fa;
|
||||||
|
$--color-success: #67c23a;
|
||||||
|
$--color-warning: #e6a23c;
|
||||||
|
$--color-danger: #f56c6c;
|
||||||
|
$--color-info: #909399;
|
||||||
|
```
|
||||||
|
|
||||||
|
## 生产环境注意事项
|
||||||
|
|
||||||
|
1. **按需引入**:在生产环境中,可以使用 babel-plugin-component 实现按需引入,减小打包体积
|
||||||
|
```bash
|
||||||
|
npm install babel-plugin-component -D
|
||||||
|
```
|
||||||
|
|
||||||
|
配置 .babelrc:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"presets": ["@babel/preset-env"],
|
||||||
|
"plugins": [
|
||||||
|
[
|
||||||
|
"component",
|
||||||
|
{
|
||||||
|
"libraryName": "element-ui",
|
||||||
|
"styleLibraryName": "theme-chalk"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **CDN优化**:使用稳定的CDN源,如BootCDN,提高加载速度和稳定性
|
||||||
|
|
||||||
|
3. **组件缓存**:对于频繁使用的组件,可以考虑缓存策略,提高性能
|
||||||
|
|
||||||
|
4. **按需加载路由**:结合Vue Router的路由懒加载,提高应用启动速度
|
||||||
+289
@@ -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>
|
||||||
@@ -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>
|
||||||
@@ -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>
|
||||||
@@ -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>
|
||||||
@@ -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>
|
||||||
@@ -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>
|
||||||
@@ -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>
|
||||||
@@ -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>
|
||||||
@@ -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>
|
||||||
+321
@@ -0,0 +1,321 @@
|
|||||||
|
# 图片收集小程序界面原型提示词
|
||||||
|
|
||||||
|
请根据以下详细要求,生成清晰、直观、符合企业形象的图片收集小程序界面原型。
|
||||||
|
|
||||||
|
## 1. 设计目标
|
||||||
|
使用HTML+Element UI生成清晰、直观、符合企业形象的界面原型,为开发团队提供可直接查看、可交互的视觉参考。
|
||||||
|
|
||||||
|
## 2. 整体设计规范
|
||||||
|
|
||||||
|
### 2.1 风格要求
|
||||||
|
请严格遵循以下风格要求:
|
||||||
|
- **风格定位**:简洁、专业,符合企业形象
|
||||||
|
- **主色调**:蓝色系(代表专业、信任),使用Element UI的主题色 `primary` (#1989fa)
|
||||||
|
- **辅助色**:灰色系(用于中性背景和次要元素),使用Element UI的 `--el-bg-color` (#f5f7fa) 和 `--el-text-color-secondary` (#909399)
|
||||||
|
- **字体**:使用Element UI默认字体,保持良好的可读性
|
||||||
|
- **图标**:使用Element UI内置图标库 ElIcon,确保风格统一
|
||||||
|
|
||||||
|
### 2.2 布局规范
|
||||||
|
请严格遵循以下布局规范:
|
||||||
|
- **尺寸**:以iPhone 12/13 (375×812px) 为基准设计,使用Element UI的响应式断点
|
||||||
|
- **安全区域**:必须遵循小程序顶部和底部安全区域规范,使用 `padding-top` 和 `padding-bottom` 适配安全区域
|
||||||
|
- **间距**:组件间距保持一致,使用Element UI的间距规范,确保是8px的倍数
|
||||||
|
- **圆角**:卡片、按钮等元素使用Element UI默认圆角,保持一致性
|
||||||
|
- **Element UI配置**:在HTML头部引入Element UI的CSS和JavaScript,并可进行主题配置
|
||||||
|
|
||||||
|
## 3. 页面原型设计要求
|
||||||
|
|
||||||
|
请为以下所有页面创建详细的原型设计:
|
||||||
|
|
||||||
|
### 3.1 登录页
|
||||||
|
**请包含以下核心元素:**
|
||||||
|
- 应用Logo和名称居中显示
|
||||||
|
- 手机号输入框(带国家代码选择)
|
||||||
|
- 验证码输入框和获取按钮
|
||||||
|
- 登录按钮
|
||||||
|
- 服务协议和隐私政策链接
|
||||||
|
- 版权信息
|
||||||
|
|
||||||
|
**交互要求:**
|
||||||
|
- 手机号格式校验
|
||||||
|
- 获取验证码按钮倒计时功能
|
||||||
|
- 登录失败提示信息
|
||||||
|
|
||||||
|
### 3.2 首页
|
||||||
|
**请根据不同用户角色设计差异化首页:**
|
||||||
|
|
||||||
|
#### 3.2.1 管理员/信息员首页
|
||||||
|
**请包含以下核心元素:**
|
||||||
|
- 顶部导航栏(应用名称、用户头像/切换)
|
||||||
|
- 待处理任务卡片(显示待审核图片数量)
|
||||||
|
- 统计图表区域(柱状图显示各部门上传数量)
|
||||||
|
- 任务进度查询入口或统计卡片(重要:必须包含)
|
||||||
|
- 最新上传图片列表(卡片式展示)
|
||||||
|
- 底部导航栏(首页、任务、我的)
|
||||||
|
|
||||||
|
**交互要求:**
|
||||||
|
- 点击统计图表可查看详细统计信息
|
||||||
|
- 点击图片卡片进入图片详情
|
||||||
|
- 点击任务进度查询入口可查看所有任务的进度情况
|
||||||
|
- 支持下拉刷新
|
||||||
|
|
||||||
|
#### 3.2.2 部门负责人首页
|
||||||
|
**请包含以下核心元素:**
|
||||||
|
- 顶部导航栏(应用名称、部门切换器、用户头像)
|
||||||
|
- 待处理任务卡片(显示该部门待审核图片数量)
|
||||||
|
- 部门图片统计(饼图显示该部门不同分类的图片占比)
|
||||||
|
- 待审核图片列表(显示该部门待审核的图片)
|
||||||
|
- 底部导航栏(首页、审核、我的)
|
||||||
|
|
||||||
|
**交互要求:**
|
||||||
|
- 部门切换器可选择不同管理部门
|
||||||
|
- 数据随部门切换实时更新
|
||||||
|
|
||||||
|
#### 3.2.3 普通用户首页
|
||||||
|
**请包含以下核心元素:**
|
||||||
|
- 顶部导航栏(应用名称、用户头像)
|
||||||
|
- 待完成任务列表(显示分配给用户的任务)
|
||||||
|
- 我的上传图片列表(显示用户最近上传的图片)
|
||||||
|
- 快速上传入口(浮动按钮或明显的上传按钮)
|
||||||
|
- 底部导航栏(首页、上传、我的)
|
||||||
|
|
||||||
|
**交互要求:**
|
||||||
|
- 点击任务进入任务详情
|
||||||
|
- 点击图片进入图片详情
|
||||||
|
- 点击上传按钮跳转到上传页面
|
||||||
|
|
||||||
|
### 3.3 上传页
|
||||||
|
**请包含以下核心元素:**
|
||||||
|
- 顶部导航栏(标题、取消/保存按钮)
|
||||||
|
- 图片选择区域(支持点击拍照或从相册选择)
|
||||||
|
- 已选择图片预览区域(支持多图预览和删除)
|
||||||
|
- 图片信息表单:
|
||||||
|
- 标题输入框
|
||||||
|
- 描述文本域
|
||||||
|
- 分类标签选择器(可多选)
|
||||||
|
- 关联任务选择器(可选)
|
||||||
|
- 所属部门显示(当前用户所在部门)
|
||||||
|
- 提交按钮
|
||||||
|
|
||||||
|
**交互要求:**
|
||||||
|
- 支持单张/批量上传
|
||||||
|
- 实时显示上传进度
|
||||||
|
- 表单验证和错误提示
|
||||||
|
- 上传失败时支持重试
|
||||||
|
|
||||||
|
### 3.4 图片列表页
|
||||||
|
**请包含以下核心元素:**
|
||||||
|
- 顶部导航栏(标题、筛选/排序按钮)
|
||||||
|
- 搜索框(支持关键词搜索)
|
||||||
|
- 筛选条件栏(部门、分类、状态等)
|
||||||
|
- 图片卡片列表(网格布局,2-3列)
|
||||||
|
- 分页或下拉加载更多
|
||||||
|
|
||||||
|
**交互要求:**
|
||||||
|
- 点击筛选按钮弹出筛选面板
|
||||||
|
- 点击图片卡片进入图片详情
|
||||||
|
- 长按图片可显示操作菜单(分享、删除等)
|
||||||
|
|
||||||
|
### 3.5 图片详情页
|
||||||
|
**请包含以下核心元素:**
|
||||||
|
- 顶部导航栏(返回按钮、操作菜单)
|
||||||
|
- 图片大图展示区域(支持缩放、滑动查看多张)
|
||||||
|
- 图片信息展示区域:
|
||||||
|
- 标题、描述
|
||||||
|
- 上传者、上传时间
|
||||||
|
- 所属部门、分类标签
|
||||||
|
- 审核状态(带状态标识)
|
||||||
|
- 关联任务信息
|
||||||
|
- 操作按钮(根据用户角色和图片状态显示)
|
||||||
|
|
||||||
|
**交互要求:**
|
||||||
|
- 支持图片缩放查看
|
||||||
|
- 根据用户权限显示不同操作按钮
|
||||||
|
- 显示审核历史记录
|
||||||
|
|
||||||
|
### 3.6 审核页
|
||||||
|
**请包含以下核心元素:**
|
||||||
|
- 顶部导航栏(标题、筛选按钮)
|
||||||
|
- 待审核图片列表(卡片式或列表式)
|
||||||
|
- 每张图片显示:缩略图、标题、上传者、上传时间
|
||||||
|
- 快速操作按钮(通过/拒绝)
|
||||||
|
- 批量审核功能入口
|
||||||
|
|
||||||
|
**交互要求:**
|
||||||
|
- 点击图片可预览大图
|
||||||
|
- 点击通过/拒绝按钮执行审核操作
|
||||||
|
- 拒绝时弹出原因输入框
|
||||||
|
- 支持批量选择多张图片进行审核
|
||||||
|
|
||||||
|
### 3.7 任务管理页(信息员专属)
|
||||||
|
**请包含以下核心元素:**
|
||||||
|
- 顶部导航栏(标题、创建任务按钮)
|
||||||
|
- 任务列表(显示所有任务)
|
||||||
|
- 每项任务显示:任务名称、创建时间、截止时间、参与部门数、完成情况、当前进度(重要:必须包含进度显示)
|
||||||
|
- 任务状态筛选器
|
||||||
|
- 任务进度查询功能(重要:必须实现)
|
||||||
|
|
||||||
|
**交互要求:**
|
||||||
|
- 点击任务进入任务详情
|
||||||
|
- 点击创建任务按钮进入创建任务页面
|
||||||
|
- 支持任务搜索和筛选
|
||||||
|
- 提供任务进度查询和数据统计功能
|
||||||
|
|
||||||
|
### 3.8 任务详情页
|
||||||
|
**请包含以下核心元素:**
|
||||||
|
- 顶部导航栏(返回按钮、编辑/删除按钮)
|
||||||
|
- 任务基本信息展示:
|
||||||
|
- 任务名称、描述
|
||||||
|
- 创建人、创建时间
|
||||||
|
- 截止时间、目标部门列表
|
||||||
|
- 任务状态
|
||||||
|
- 任务进度统计(饼图显示各部门完成情况)
|
||||||
|
- 相关图片列表(显示与该任务关联的图片)
|
||||||
|
|
||||||
|
**交互要求:**
|
||||||
|
- 点击编辑按钮进入编辑任务页面
|
||||||
|
- 点击图片进入图片详情
|
||||||
|
- 显示各部门提交进度详情
|
||||||
|
|
||||||
|
### 3.9 个人中心
|
||||||
|
**请包含以下核心元素:**
|
||||||
|
- 用户信息区域(头像、姓名、角色、所属部门)
|
||||||
|
- 功能菜单列表:
|
||||||
|
- 我的上传
|
||||||
|
- 消息通知
|
||||||
|
- 个人设置
|
||||||
|
- 帮助中心
|
||||||
|
- 关于我们
|
||||||
|
- 退出登录
|
||||||
|
|
||||||
|
**交互要求:**
|
||||||
|
- 点击各菜单项跳转到相应页面
|
||||||
|
- 点击用户信息区域可编辑个人资料
|
||||||
|
|
||||||
|
### 3.10 管理中心(管理员专属)
|
||||||
|
**请包含以下核心元素:**
|
||||||
|
- 顶部导航栏(标题)
|
||||||
|
- 管理功能菜单列表:
|
||||||
|
- 用户管理
|
||||||
|
- 部门管理
|
||||||
|
- 系统设置
|
||||||
|
- 数据统计
|
||||||
|
- 操作日志
|
||||||
|
|
||||||
|
**交互要求:**
|
||||||
|
- 点击各菜单项跳转到相应管理页面
|
||||||
|
|
||||||
|
## 4. 后台管理页面(uni-admin)
|
||||||
|
|
||||||
|
### 4.1 整体布局
|
||||||
|
**请遵循以下布局规范:**
|
||||||
|
- **左侧菜单**:功能模块导航
|
||||||
|
- **顶部导航**:面包屑、用户信息、系统通知
|
||||||
|
- **主内容区**:根据选择的功能显示对应管理界面
|
||||||
|
- **PC界面适配**:后台管理页面需要完全适配PC端界面,设计应充分利用PC端宽屏优势,提供更丰富的数据展示和操作空间,确保在1024px及以上分辨率下的良好用户体验
|
||||||
|
|
||||||
|
### 4.2 关键管理页面
|
||||||
|
**请为以下关键页面创建详细原型:**
|
||||||
|
|
||||||
|
#### 用户管理页面
|
||||||
|
**请包含以下核心元素:**
|
||||||
|
- 用户列表(表格形式)
|
||||||
|
- 搜索、筛选功能
|
||||||
|
- 批量操作(启用/禁用、删除)
|
||||||
|
- 新增、编辑用户功能
|
||||||
|
- 角色分配功能
|
||||||
|
|
||||||
|
#### 部门管理页面
|
||||||
|
**请包含以下核心元素:**
|
||||||
|
- 部门树形结构展示
|
||||||
|
- 部门添加、编辑、删除功能
|
||||||
|
- 部门负责人设置
|
||||||
|
|
||||||
|
#### 图片管理页面
|
||||||
|
**请包含以下核心元素:**
|
||||||
|
- 图片列表(表格形式,带缩略图)
|
||||||
|
- 多条件搜索和筛选
|
||||||
|
- 批量操作(删除、审核)
|
||||||
|
- 图片详情查看
|
||||||
|
|
||||||
|
#### 任务管理页面
|
||||||
|
**请包含以下核心元素:**
|
||||||
|
- 任务进度概览区域(重要:必须包含)
|
||||||
|
- 任务列表(表格形式)
|
||||||
|
- 任务创建、编辑、删除功能
|
||||||
|
- 任务进度查询功能(重要:必须实现)
|
||||||
|
- 进度筛选器
|
||||||
|
- 关键指标卡片(总任务数、已完成、逾期等)
|
||||||
|
|
||||||
|
## 5. 交互与动画要求
|
||||||
|
|
||||||
|
### 5.1 通用交互
|
||||||
|
**请实现以下通用交互效果:**
|
||||||
|
- **页面切换**:使用JavaScript实现页面导航,结合Element UI的过渡动画实现平滑效果
|
||||||
|
- **加载状态**:使用Element UI的Loading组件实现加载动画,通过JavaScript控制显示/隐藏
|
||||||
|
- **操作反馈**:使用Element UI的按钮组件的默认交互效果,通过Message组件显示提示信息
|
||||||
|
- **下拉刷新**:使用JavaScript监听触摸事件实现下拉刷新功能
|
||||||
|
- **上拉加载**:使用JavaScript监听滚动事件实现上拉加载更多数据
|
||||||
|
|
||||||
|
### 5.2 特殊交互
|
||||||
|
**请实现以下特殊交互效果:**
|
||||||
|
- **图片上传**:使用Element UI的Upload组件实现图片上传、预览和进度条显示
|
||||||
|
- **审核操作**:使用Element UI的Dialog组件实现模态对话框,添加确认功能
|
||||||
|
- **批量操作**:使用Element UI的Checkbox组件实现多选逻辑,配合Button组件实现批量操作
|
||||||
|
- **权限提示**:使用JavaScript根据用户角色控制UI元素显示,通过Element UI的Message组件提供友好提示
|
||||||
|
- **表单验证**:使用Element UI的Form组件实现表单验证逻辑,自动显示错误状态
|
||||||
|
|
||||||
|
## 6. 原型交付要求
|
||||||
|
|
||||||
|
### 6.1 存放位置要求
|
||||||
|
**请严格按照以下路径存放文件:**
|
||||||
|
- 所有界面原型HTML文件必须存放在项目根目录下的 `原型` 子目录中
|
||||||
|
- 小程序页面存放在 `原型/小程序页面/` 目录下
|
||||||
|
- 后台管理页面存放在 `原型/后台管理页面/` 目录下
|
||||||
|
- 每个原型文件需使用语义化的文件名,如 `login.html`、`home.html`
|
||||||
|
|
||||||
|
### 6.2 格式要求
|
||||||
|
**请严格遵循以下格式规范:**
|
||||||
|
- 使用HTML+Element UI设计原型页面
|
||||||
|
- 确保所有样式通过Element UI组件和类实现,避免自定义CSS
|
||||||
|
- 在HTML文件中引入Element UI的CSS和JavaScript CDN
|
||||||
|
- 提供响应式布局,适配不同设备尺寸
|
||||||
|
- **强制要求**:所有原型页面必须汇总到 `原型/index.html` 文件中,方便查阅和管理
|
||||||
|
|
||||||
|
### 6.3 内容要求
|
||||||
|
**请遵循以下内容规范:**
|
||||||
|
- 包含所有主要页面和关键交互
|
||||||
|
- 为不同用户角色(管理员、信息员、部门负责人、普通用户)设计对应的差异化界面
|
||||||
|
- 使用Tailwind CSS实现所有布局、颜色、字体和间距要求
|
||||||
|
- 添加必要的交互逻辑(使用简单的JavaScript实现)
|
||||||
|
- 确保页面在浏览器中可以直接打开查看
|
||||||
|
|
||||||
|
### 6.4 index.html汇总要求
|
||||||
|
**请创建以下汇总文件:**
|
||||||
|
- **必须包含**:所有页面原型的链接、页面名称、功能描述
|
||||||
|
- **必须包含**:页面之间的跳转关系图或说明
|
||||||
|
- **必须包含**:不同用户角色的界面差异化说明
|
||||||
|
- **必须包含**:版本信息、更新日志、设计规范链接
|
||||||
|
- **格式要求**:使用HTML+Tailwind CSS实现,响应式设计,支持不同设备查看
|
||||||
|
- **交互要求**:点击链接可直接打开对应HTML页面,提供导航菜单快速定位页面
|
||||||
|
- **嵌入要求**:**使用iframe元素嵌入其他页面的HTML文件**,实现无需跳转即可在当前页面查看所有原型内容,提供页面切换功能
|
||||||
|
|
||||||
|
### 6.5 文档要求
|
||||||
|
**请遵循以下文档规范:**
|
||||||
|
- 提供原型说明文档,解释设计思路和交互逻辑
|
||||||
|
- 标注各页面功能点和特殊交互要求
|
||||||
|
- 说明如何使用Tailwind CSS实现设计规范
|
||||||
|
- 提供关键组件的HTML结构和Tailwind类示例
|
||||||
|
- 说明页面跳转关系和交互实现方式
|
||||||
|
|
||||||
|
## 7. 参考资源
|
||||||
|
**请参考以下设计资源:**
|
||||||
|
- 参考软件需求文档中的用户角色和功能需求
|
||||||
|
- 遵循uni-app和uView的组件设计规范
|
||||||
|
- 参考微信小程序设计指南
|
||||||
|
- 参考Ant Design设计系统的布局和组件规范
|
||||||
|
- 参考uni-admin的后台管理界面设计风格
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
以上指令基于《软件需求文档》制定,如有任何疑问或需要调整,请及时与需求方沟通确认。
|
||||||
@@ -0,0 +1,229 @@
|
|||||||
|
# 图片收集小程序需求文档
|
||||||
|
|
||||||
|
## 1. 产品概述
|
||||||
|
|
||||||
|
### 1.1 产品名称
|
||||||
|
图片收集小程序
|
||||||
|
|
||||||
|
### 1.2 产品定位
|
||||||
|
专为企业内部设计的图片收集与管理工具,用于上级公司统一收集、整理和管理各下级部门提交的图片资料。
|
||||||
|
|
||||||
|
### 1.3 产品目标
|
||||||
|
- 提供便捷的图片上传功能,支持多部门、多用户操作
|
||||||
|
- 建立统一的图片管理体系,便于分类、查询和统计
|
||||||
|
- 简化图片审核流程,提高工作效率
|
||||||
|
- 确保图片资料的安全存储和访问权限控制
|
||||||
|
|
||||||
|
## 2. 用户分析
|
||||||
|
|
||||||
|
### 2.1 用户角色
|
||||||
|
- **管理员**:系统最高权限,负责用户管理、系统配置、部门管理
|
||||||
|
- **信息员**:负责发表收集任务,指定要收集的部门,同时审核图片是否符合要求,查询任务进度
|
||||||
|
- **部门负责人**:可同时管理多个部门,对所有管理部门的图片上传、审核和查询拥有权限
|
||||||
|
- **普通用户**:仅能上传本部门图片并查看自己上传的图片状态
|
||||||
|
|
||||||
|
### 2.2 用户痛点
|
||||||
|
- 传统邮件或聊天软件传输图片效率低下,易丢失
|
||||||
|
- 图片资料分散,难以统一管理和查找
|
||||||
|
- 缺乏有效的审核机制,无法确保图片质量
|
||||||
|
- 难以追踪图片提交进度和完成情况
|
||||||
|
|
||||||
|
## 3. 功能需求
|
||||||
|
|
||||||
|
### 3.1 用户管理模块
|
||||||
|
- **用户注册/登录**:支持手机号注册,验证码登录
|
||||||
|
- **角色分配**:管理员可设置用户角色(管理员、信息员、部门负责人、普通用户)
|
||||||
|
- **部门管理**:管理员可创建、编辑、删除部门信息
|
||||||
|
- **用户绑定部门**:管理员可将用户分配到一个或多个部门,支持一个用户管理多个部门的场景
|
||||||
|
|
||||||
|
### 3.2 图片上传模块
|
||||||
|
- **单张/批量上传**:支持选择本地图片单张上传或多张批量上传
|
||||||
|
- **图片预览**:上传前可预览图片
|
||||||
|
- **图片信息填写**:上传时需填写图片标题、描述、分类标签等信息
|
||||||
|
- **上传状态显示**:显示上传进度和结果
|
||||||
|
- **失败重试机制**:上传失败时支持重试
|
||||||
|
|
||||||
|
### 3.3 图片审核模块
|
||||||
|
- **待审核列表**:显示所有待审核的图片,信息员和管理员可查看所有待审核图片,部门负责人可查看其负责的所有部门的待审核图片
|
||||||
|
- **审核操作**:支持通过或拒绝,拒绝时需填写原因(信息员、部门负责人和管理员均有审核权限)
|
||||||
|
- **审核历史记录**:记录每张图片的审核状态和审核人
|
||||||
|
- **批量审核**:支持多张图片批量审核
|
||||||
|
|
||||||
|
### 3.4 图片管理模块
|
||||||
|
- **图片列表**:显示所有图片,支持分页(管理员和信息员可查看所有图片,部门负责人可查看其负责的所有部门的图片,普通用户仅可查看自己上传的图片)
|
||||||
|
- **图片分类**:按部门、分类标签等进行分类展示
|
||||||
|
- **搜索功能**:支持按图片标题、描述、上传人、日期等条件搜索,部门负责人可按负责部门筛选
|
||||||
|
- **图片查看**:点击图片可放大查看详细信息
|
||||||
|
- **图片删除**:管理员和部门负责人可删除各自权限范围内的图片
|
||||||
|
- **图片统计**:显示各部门图片上传数量、审核通过率等统计信息(管理员和信息员可见全部,部门负责人可见其负责部门的统计)
|
||||||
|
- **收集任务管理**:信息员可创建、编辑、删除图片收集任务,指定任务名称、描述、截止时间、目标部门等信息
|
||||||
|
|
||||||
|
### 3.5 消息通知模块
|
||||||
|
- **审核通知**:图片审核结果通过小程序消息通知用户
|
||||||
|
- **任务提醒**:提醒用户完成图片上传任务
|
||||||
|
- **系统通知**:发布系统公告和重要信息
|
||||||
|
|
||||||
|
## 4. 非功能需求
|
||||||
|
|
||||||
|
### 4.1 性能需求
|
||||||
|
- **响应时间**:页面加载时间不超过3秒
|
||||||
|
- **并发处理**:支持至少500名用户同时在线使用
|
||||||
|
- **上传速度**:5MB图片上传时间不超过10秒
|
||||||
|
- **图片格式与大小**:支持JPG、PNG、WEBP格式,单张图片大小不超过10MB,建议使用压缩后的图片以提高加载速度
|
||||||
|
|
||||||
|
### 4.2 安全需求
|
||||||
|
- **数据加密**:用户密码加密存储,图片传输加密
|
||||||
|
- **访问控制**:基于角色的访问控制,确保数据安全
|
||||||
|
- **数据备份**:定期对图片数据进行备份
|
||||||
|
|
||||||
|
### 4.3 兼容性需求
|
||||||
|
- **设备兼容**:支持主流手机型号(iOS 13+,Android 8+)
|
||||||
|
- **网络环境**:支持WiFi和4G/5G网络环境
|
||||||
|
|
||||||
|
### 4.4 可用性需求
|
||||||
|
- **界面简洁**:操作流程简单明了,易于上手
|
||||||
|
- **错误提示**:提供清晰的错误提示和操作引导
|
||||||
|
- **离线功能**:
|
||||||
|
- 支持在无网络环境下缓存已上传的图片信息
|
||||||
|
- 支持在离线状态下编写图片描述和标签,待网络恢复后自动提交
|
||||||
|
- 提供离线任务提醒功能
|
||||||
|
|
||||||
|
## 5. 数据需求
|
||||||
|
|
||||||
|
### 5.1 用户数据
|
||||||
|
- 用户ID、手机号、密码(加密)、姓名、角色、所属部门列表(支持多部门关联)、注册时间、最后登录时间
|
||||||
|
|
||||||
|
### 5.2 部门数据
|
||||||
|
- 部门ID、部门名称、负责人ID列表(支持多负责人)、创建时间、描述
|
||||||
|
|
||||||
|
### 5.3 图片数据
|
||||||
|
- 图片ID、图片URL、标题、描述、上传者ID、所属部门ID、上传时间、审核状态、审核人ID、审核时间、分类标签
|
||||||
|
|
||||||
|
### 5.4 任务数据
|
||||||
|
- 任务ID、任务名称、任务描述、创建人ID(信息员)、创建时间、截止时间、目标部门ID列表、任务状态、完成情况统计
|
||||||
|
|
||||||
|
### 5.5 操作日志数据
|
||||||
|
- 日志ID、操作人ID、操作类型、操作时间、操作对象、操作结果
|
||||||
|
|
||||||
|
## 6. 界面设计
|
||||||
|
|
||||||
|
### 6.1 整体风格
|
||||||
|
- 简洁、专业,符合企业形象
|
||||||
|
- 主色调:蓝色系(代表专业、信任)
|
||||||
|
- 辅助色:灰色系(用于中性背景和次要元素)
|
||||||
|
|
||||||
|
### 6.2 主要页面
|
||||||
|
- **登录页**:简洁的登录界面,包含手机号输入框、验证码输入框和登录按钮
|
||||||
|
- **首页**:
|
||||||
|
- 管理员/信息员:显示待处理任务、统计图表、最新上传图片
|
||||||
|
- 部门负责人:可切换查看所有管理部门的待处理任务、待审核图片、部门图片统计
|
||||||
|
- 普通用户:显示个人待完成任务、我的上传图片列表
|
||||||
|
- **上传页**:简洁的图片选择区域、信息填写表单,可选择关联任务
|
||||||
|
- **图片列表页**:图片卡片式展示,支持筛选和搜索
|
||||||
|
- **图片详情页**:大图展示、详细信息、审核状态、关联任务
|
||||||
|
- **审核页**:待审核图片列表、快速审核按钮
|
||||||
|
- **任务管理页**(信息员专属):任务列表、创建任务、任务详情、任务进度统计
|
||||||
|
- **任务详情页**:显示任务信息、参与部门、提交状态统计、相关图片列表
|
||||||
|
- **个人中心**:用户信息、我的上传、消息通知等
|
||||||
|
- **管理中心**:用户管理、部门管理、系统设置等
|
||||||
|
|
||||||
|
## 7. 技术实现建议
|
||||||
|
|
||||||
|
### 7.1 前端技术
|
||||||
|
- **开发工具**:HBuilderX
|
||||||
|
- **开发框架**:uni-app
|
||||||
|
- **后台管理框架**:uni-admin
|
||||||
|
- **UI框架**:uView
|
||||||
|
- **技术要点**:
|
||||||
|
- 采用组件化开发提高代码复用性
|
||||||
|
- 使用Vue.js语法规范
|
||||||
|
- 遵循uni-app项目结构规范
|
||||||
|
- 利用uView组件库构建统一的UI界面
|
||||||
|
- 利用uni-app跨平台能力适配不同端
|
||||||
|
- 前端权限控制与后端权限管理保持一致
|
||||||
|
- 后台管理页面遵循uni-admin的界面设计规范
|
||||||
|
|
||||||
|
### 7.2 后端技术
|
||||||
|
- **云开发平台**:uni-cloud
|
||||||
|
- **数据库**:uniCloud数据库
|
||||||
|
- **文件存储**:uniCloud云存储
|
||||||
|
- **后端逻辑**:云函数(JavaScript/TypeScript)
|
||||||
|
- **数据安全**:
|
||||||
|
- 利用uniCloud数据库权限规则控制数据访问
|
||||||
|
- 敏感数据加密存储
|
||||||
|
- 实现基于角色的权限控制
|
||||||
|
- 关键操作记录审计日志
|
||||||
|
|
||||||
|
### 7.3 API设计
|
||||||
|
- 基于uniCloud云函数的API设计
|
||||||
|
- 统一的错误处理机制
|
||||||
|
- 定义统一的错误码体系
|
||||||
|
- 提供友好的错误提示信息
|
||||||
|
- 记录详细的错误日志用于调试
|
||||||
|
- 完善的接口文档
|
||||||
|
- 利用uniCloud权限控制实现用户鉴权
|
||||||
|
- 支持请求缓存和限流机制
|
||||||
|
|
||||||
|
## 8. 项目实施计划
|
||||||
|
|
||||||
|
### 8.1 开发阶段
|
||||||
|
- 需求分析与设计:2周
|
||||||
|
- 详细功能设计
|
||||||
|
- 数据库设计
|
||||||
|
- 接口设计
|
||||||
|
- UI原型设计
|
||||||
|
- 前端开发:4周
|
||||||
|
- 基础框架搭建
|
||||||
|
- 小程序端开发
|
||||||
|
- 后台管理端(uni-admin)开发
|
||||||
|
- UI组件封装与优化
|
||||||
|
- 后端开发:4周
|
||||||
|
- uni-cloud环境配置
|
||||||
|
- 数据库表结构设计
|
||||||
|
- 云函数开发
|
||||||
|
- 权限体系实现
|
||||||
|
- 联调测试:2周
|
||||||
|
- 功能测试
|
||||||
|
- 性能测试
|
||||||
|
- 兼容性测试
|
||||||
|
- 安全测试
|
||||||
|
|
||||||
|
### 8.2 上线计划
|
||||||
|
- 内部测试:1周
|
||||||
|
- 修复bug
|
||||||
|
- 性能优化
|
||||||
|
- 试点部门使用:1周
|
||||||
|
- 收集反馈
|
||||||
|
- 迭代优化
|
||||||
|
- 全公司推广使用:持续进行
|
||||||
|
- 用户培训
|
||||||
|
- 系统维护与升级
|
||||||
|
|
||||||
|
## 9. 风险评估与应对策略
|
||||||
|
|
||||||
|
### 9.1 潜在风险
|
||||||
|
- 用户操作不熟悉导致使用困难
|
||||||
|
- 图片存储容量和成本控制
|
||||||
|
- 网络环境不佳影响上传体验
|
||||||
|
|
||||||
|
### 9.2 应对策略
|
||||||
|
- 提供详细的使用指南和在线帮助
|
||||||
|
- 制定合理的存储策略,定期清理无效图片
|
||||||
|
- 优化上传机制,支持断点续传
|
||||||
|
|
||||||
|
## 10. 附录
|
||||||
|
|
||||||
|
### 10.1 术语定义
|
||||||
|
- 图片分类:为便于管理,根据图片内容或用途设定的标签
|
||||||
|
- 审核状态:包括待审核、已通过、已拒绝
|
||||||
|
- 部门负责人:可同时负责管理多个部门的用户和图片审核的人员,系统支持一个用户关联多个部门
|
||||||
|
- 信息员:负责创建收集任务并审核图片的人员
|
||||||
|
- 收集任务:由信息员创建的特定图片收集活动,包含任务要求、截止时间和目标部门
|
||||||
|
|
||||||
|
### 10.2 参考资料
|
||||||
|
- 微信小程序开发文档
|
||||||
|
- 企业信息管理系统最佳实践
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
本文档为初步需求分析,实际开发过程中可能根据具体情况进行调整和完善。
|
||||||
@@ -0,0 +1,232 @@
|
|||||||
|
# 项目规则文件
|
||||||
|
|
||||||
|
## 1. 总则
|
||||||
|
|
||||||
|
本文档定义了图片收集小程序项目的核心开发规则、编码规范和工作流程,适合个人工作室开发环境使用。
|
||||||
|
|
||||||
|
## 2. 代码规范
|
||||||
|
|
||||||
|
### 2.1 开发工具与框架
|
||||||
|
|
||||||
|
- **开发工具**:HBuilderX
|
||||||
|
- **开发框架**:uni-app(Vue.js)
|
||||||
|
- **后台管理框架**:uni-admin
|
||||||
|
- **云开发平台**:uni-cloud
|
||||||
|
- **UI框架**:uView
|
||||||
|
- **uView版本**:建议使用最新稳定版
|
||||||
|
|
||||||
|
### 2.2 代码风格
|
||||||
|
|
||||||
|
- **缩进**:使用4个空格进行缩进,禁止使用Tab
|
||||||
|
- **行长度**:每行代码长度不超过120个字符
|
||||||
|
- **文件编码**:统一使用UTF-8编码
|
||||||
|
- **换行符**:使用LF(\n)作为换行符
|
||||||
|
- **注释**:
|
||||||
|
- 函数/方法必须包含注释,说明功能、参数和返回值
|
||||||
|
- 复杂逻辑必须添加注释说明
|
||||||
|
- 避免不必要的注释,代码应当自解释
|
||||||
|
- **uView使用规范**:
|
||||||
|
- 优先使用uView提供的组件,保持UI一致性
|
||||||
|
- 遵循uView的主题配置机制进行样式定制
|
||||||
|
- 组件属性值优先使用uView提供的常量或枚举值
|
||||||
|
- 自定义样式时,避免直接覆盖uView组件的样式,应使用`custom-class`属性
|
||||||
|
- 对于常用的uView组件配置,可封装为业务组件以提高复用性
|
||||||
|
- **uni-admin使用规范**:
|
||||||
|
- 遵循uni-admin的目录结构和文件命名规范
|
||||||
|
- 使用uni-admin提供的权限管理机制
|
||||||
|
- 扩展uni-admin功能时,应遵循其插件机制
|
||||||
|
- 后台页面开发时,复用uni-admin提供的基础组件
|
||||||
|
- 遵循uni-admin的页面布局规范,确保后台管理界面风格统一
|
||||||
|
- **uni-cloud使用规范**:
|
||||||
|
- 云函数命名应清晰表达其功能,使用小驼峰命名法
|
||||||
|
- 数据库集合命名使用复数形式,全小写
|
||||||
|
- 严格遵循uni-cloud权限控制规则
|
||||||
|
- 避免在云函数中执行耗时操作,复杂业务逻辑应拆分处理
|
||||||
|
- 使用云函数时,需要对入参进行严格校验
|
||||||
|
- 云函数代码需进行模块化设计,提高复用性
|
||||||
|
- 数据库查询应添加合理索引,优化查询性能
|
||||||
|
- 云存储文件命名应包含时间戳或随机字符串,避免文件名冲突
|
||||||
|
|
||||||
|
### 2.3 命名规范
|
||||||
|
|
||||||
|
- **变量名**:使用小驼峰命名法(camelCase)
|
||||||
|
- 示例:`userName`, `departmentList`, `imageCount`
|
||||||
|
- **常量名**:使用全大写,下划线分隔
|
||||||
|
- 示例:`MAX_UPLOAD_SIZE`, `API_BASE_URL`
|
||||||
|
- **函数/方法名**:使用小驼峰命名法,动词开头
|
||||||
|
- 示例:`uploadImage()`, `verifyUser()`, `getDepartmentList()`
|
||||||
|
- **组件名**:
|
||||||
|
- 自定义组件:使用大驼峰命名法(PascalCase)或短横线命名法(kebab-case)
|
||||||
|
- 示例:`UserManager.vue`, `image-uploader.vue`
|
||||||
|
- uView组件:遵循uView官方命名规范,使用`u-`前缀
|
||||||
|
- 示例:`u-button`, `u-upload`, `u-table`
|
||||||
|
- **文件名**:遵循uni-app命名规范,页面文件名建议与页面路由保持一致
|
||||||
|
- 示例:`index.vue`, `upload.vue`, `user-detail.vue`
|
||||||
|
- **云函数命名**:使用小驼峰命名法,前缀表示模块
|
||||||
|
- 示例:`userLogin`, `imageUpload`, `taskCreate`
|
||||||
|
- **数据库集合命名**:使用复数形式,全小写
|
||||||
|
- 示例:`users`, `departments`, `images`, `tasks`, `logs`
|
||||||
|
|
||||||
|
### 2.4 目录结构规范(uni-app + uView + uni-admin)
|
||||||
|
|
||||||
|
- `/pages` - 页面文件目录
|
||||||
|
- `/admin` - 后台管理页面目录(uni-admin相关)
|
||||||
|
- `/components` - 自定义组件目录
|
||||||
|
- `/uview-ui` - uView UI组件目录(通过插件安装)
|
||||||
|
- `/static` - 静态资源目录
|
||||||
|
- `/common` - 公共资源目录
|
||||||
|
- `/api` - 网络请求接口目录
|
||||||
|
- `/utils` - 工具函数目录
|
||||||
|
- `/services` - 业务逻辑层目录
|
||||||
|
- `/config` - 配置文件目录
|
||||||
|
- `/theme.scss` - uView主题变量配置文件
|
||||||
|
- `/store` - Vuex状态管理目录(可选)
|
||||||
|
- `/uniCloud` - uni-cloud云开发目录
|
||||||
|
- `/database` - 数据库相关配置
|
||||||
|
- `/functions` - 云函数目录
|
||||||
|
- `/cloud-storage` - 云存储相关文件
|
||||||
|
- `/uni_modules` - uni-modules插件目录(包含uni-admin等)
|
||||||
|
|
||||||
|
## 3. 开发流程
|
||||||
|
|
||||||
|
### 3.1 分支管理(简化)
|
||||||
|
|
||||||
|
- **main**:主分支,存放稳定版本代码
|
||||||
|
- **feature**:功能开发分支
|
||||||
|
- **bugfix**:bug修复分支(可选)
|
||||||
|
|
||||||
|
### 3.2 代码提交规范
|
||||||
|
|
||||||
|
提交信息建议使用简洁格式:
|
||||||
|
```
|
||||||
|
<类型>: <描述>
|
||||||
|
```
|
||||||
|
|
||||||
|
常用类型:
|
||||||
|
- **feat**: 新功能
|
||||||
|
- **fix**: 修复bug
|
||||||
|
- **docs**: 文档更新
|
||||||
|
- **refactor**: 代码重构
|
||||||
|
|
||||||
|
## 4. 安全规范
|
||||||
|
|
||||||
|
### 4.1 数据安全
|
||||||
|
|
||||||
|
- 敏感数据必须加密存储
|
||||||
|
- API接口必须进行权限验证
|
||||||
|
- 防止SQL注入、XSS攻击等常见安全问题
|
||||||
|
- 文件上传必须验证文件类型和大小
|
||||||
|
- 使用uniCloud的环境变量存储敏感配置信息,避免硬编码
|
||||||
|
- 云函数中避免打印敏感信息到日志
|
||||||
|
|
||||||
|
### 4.2 权限管理
|
||||||
|
|
||||||
|
- 严格按照用户角色分配权限(管理员、信息员、部门负责人、普通用户)
|
||||||
|
- 确保部门负责人只能访问其负责的部门数据
|
||||||
|
- 实现细粒度的权限控制
|
||||||
|
- 在uniCloud数据库中设置合理的权限规则
|
||||||
|
- 所有数据查询操作必须包含权限过滤条件
|
||||||
|
- 对关键操作(如删除、修改权限)添加二次确认机制
|
||||||
|
|
||||||
|
## 5. 测试规范
|
||||||
|
|
||||||
|
### 5.1 测试要求
|
||||||
|
|
||||||
|
- 核心功能建议编写基本测试用例
|
||||||
|
- 确保主要业务流程正常运行
|
||||||
|
- 重要接口进行必要的测试验证
|
||||||
|
- 云函数测试:使用uniCloud提供的本地调试工具进行云函数测试
|
||||||
|
- 权限测试:验证不同角色用户的权限控制是否正确
|
||||||
|
|
||||||
|
### 5.2 测试环境
|
||||||
|
|
||||||
|
- 开发环境:本地开发环境
|
||||||
|
- 测试环境:uniCloud测试环境
|
||||||
|
- 生产环境:uniCloud正式运行环境
|
||||||
|
|
||||||
|
## 6. 文档规范
|
||||||
|
|
||||||
|
### 6.1 代码文档
|
||||||
|
|
||||||
|
- 复杂函数和关键逻辑添加注释说明
|
||||||
|
- 保持代码自解释性
|
||||||
|
|
||||||
|
### 6.2 项目文档
|
||||||
|
|
||||||
|
- 维护基础需求文档
|
||||||
|
- 记录主要技术决策
|
||||||
|
- 编写简明部署说明
|
||||||
|
|
||||||
|
## 7. 性能优化
|
||||||
|
|
||||||
|
### 7.1 前端性能优化
|
||||||
|
|
||||||
|
- 图片适当压缩和懒加载
|
||||||
|
- 避免明显的性能瓶颈
|
||||||
|
- 优化关键操作的响应速度
|
||||||
|
- 减少网络请求次数,合理使用缓存
|
||||||
|
- 页面组件按需加载,避免一次性加载过多内容
|
||||||
|
- 使用uni-app提供的性能优化API
|
||||||
|
|
||||||
|
### 7.2 uni-cloud性能优化
|
||||||
|
|
||||||
|
- 云函数保持轻量化,避免不必要的计算
|
||||||
|
- 合理设置数据库索引,优化查询性能
|
||||||
|
- 使用事务处理复杂的数据库操作
|
||||||
|
- 云存储文件进行合理分类和命名
|
||||||
|
- 利用云函数缓存机制减少重复计算
|
||||||
|
- 定期清理无效数据,优化存储使用效率
|
||||||
|
|
||||||
|
## 8. 版本号规范
|
||||||
|
|
||||||
|
采用语义化版本号(Semantic Versioning):
|
||||||
|
|
||||||
|
`主版本号.次版本号.修订号`
|
||||||
|
|
||||||
|
- **主版本号**:不兼容的API变更
|
||||||
|
- **次版本号**:向下兼容的功能性新增
|
||||||
|
- **修订号**:向下兼容的问题修正
|
||||||
|
|
||||||
|
## 9. 多部门管理特殊规则
|
||||||
|
|
||||||
|
### 9.1 数据访问控制
|
||||||
|
|
||||||
|
- 确保部门负责人只能访问和管理其负责的所有部门数据
|
||||||
|
- 在数据查询时必须包含部门权限过滤条件
|
||||||
|
|
||||||
|
### 9.2 用户界面
|
||||||
|
|
||||||
|
- 为管理多个部门的用户提供部门切换功能
|
||||||
|
- 显示数据时必须明确标识所属部门
|
||||||
|
|
||||||
|
## 10. 部署规范
|
||||||
|
|
||||||
|
### 10.1 部署流程
|
||||||
|
|
||||||
|
- 使用HBuilderX提供的uniCloud部署功能
|
||||||
|
- 遵循环境分离原则,开发、测试、生产环境严格隔离
|
||||||
|
- 正式发布前进行完整的回归测试
|
||||||
|
|
||||||
|
### 10.2 环境配置
|
||||||
|
|
||||||
|
- 使用uniCloud环境变量管理不同环境的配置
|
||||||
|
- 敏感配置信息通过环境变量注入,不硬编码到代码中
|
||||||
|
- 定期备份数据库和云存储中的重要数据
|
||||||
|
|
||||||
|
### 10.3 版本管理
|
||||||
|
|
||||||
|
- 每次发布需记录详细的版本说明
|
||||||
|
- 重要版本进行数据库备份
|
||||||
|
- 建立回滚机制,确保问题出现时可快速恢复
|
||||||
|
|
||||||
|
## 11. 附则
|
||||||
|
|
||||||
|
- 本规则根据个人工作室实际情况可灵活调整
|
||||||
|
- 核心规范建议严格遵守以保证代码质量
|
||||||
|
- 随着项目发展可逐步完善规则
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**文档版本**:v1.0.0
|
||||||
|
**发布日期**:2024年
|
||||||
|
**编制**:个人工作室
|
||||||
Reference in New Issue
Block a user