From 07b3495575cb7c3f1274b198bf640b4b28b630a3 Mon Sep 17 00:00:00 2001
From: xiayuping666 <1269237624@qq.com>
Date: Wed, 3 Apr 2024 09:55:45 +0800
Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E6=8E=A5=E7=8F=AD=E7=BA=A7=E7=AE=A1?=
=?UTF-8?q?=E7=90=86=E5=88=97=E8=A1=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/admin.js | 34 +++-
src/i18n/lang/en.js | 2 +
src/i18n/lang/zh-cn.js | 2 +
src/i18n/lang/zh-tw.js | 2 +
src/router/index.js | 8 +-
src/store/index.js | 16 +-
src/utils/request.js | 6 +-
src/views/classList/classList/api.js | 20 ++
src/views/classList/classList/columns.js | 52 ++++++
.../classList/components/CommonHead.vue | 75 ++++++++
.../classList/components/CommonTablesImg.vue | 115 ++++++++++++
src/views/classList/classList/index.vue | 175 ++++++++++++++++++
src/views/department/api.js | 20 ++
src/views/department/columns.js | 52 ++++++
.../department/components/CommonHead.vue | 75 ++++++++
.../department/components/CommonTablesImg.vue | 115 ++++++++++++
src/views/department/index.vue | 158 ++++++++++++++++
src/views/login/api.js | 2 +-
src/views/login/index.vue | 15 +-
19 files changed, 931 insertions(+), 13 deletions(-)
create mode 100644 src/views/classList/classList/api.js
create mode 100644 src/views/classList/classList/columns.js
create mode 100644 src/views/classList/classList/components/CommonHead.vue
create mode 100644 src/views/classList/classList/components/CommonTablesImg.vue
create mode 100644 src/views/classList/classList/index.vue
create mode 100644 src/views/department/api.js
create mode 100644 src/views/department/columns.js
create mode 100644 src/views/department/components/CommonHead.vue
create mode 100644 src/views/department/components/CommonTablesImg.vue
create mode 100644 src/views/department/index.vue
diff --git a/public/admin.js b/public/admin.js
index c63bc07..aa88ad6 100644
--- a/public/admin.js
+++ b/public/admin.js
@@ -626,8 +626,40 @@ export default {
"isAffix": true,
"isIframe": false,
"roles": ["admin", "common"],
- "icon": "el-icon-s-opportunity"
+ "icon": "el-icon-connection"
+ },
+
+ },
+ {
+ "path": "/classList/classList",
+ "name": "classList",
+ "component": "classList/classList",
+ "meta": {
+ "title": "message.router.classList",
+ "isLink": "",
+ "isHide": false,
+ "isKeepAlive": true,
+ "isAffix": true,
+ "isIframe": false,
+ "roles": ["admin", "common"],
+ "icon": "el-icon-coordinate"
+ }
+ },
+ {
+ "path": "/department",
+ "name": "department",
+ "component": "department",
+ "meta": {
+ "title": "message.router.department",
+ "isLink": "",
+ "isHide": false,
+ "isKeepAlive": true,
+ "isAffix": true,
+ "isIframe": false,
+ "roles": ["admin", "common"],
+ "icon": "el-icon-collection"
}
}
+
]
}
diff --git a/src/i18n/lang/en.js b/src/i18n/lang/en.js
index e0b0697..a9f6144 100644
--- a/src/i18n/lang/en.js
+++ b/src/i18n/lang/en.js
@@ -56,6 +56,8 @@ export default {
attendanceMachineEquipmentManagement:'attendanceMachineEquipmentManagement',
recipe: 'recipe',
evaluate: 'evaluate',
+ classList: 'classList',
+ department: 'department',
},
staticRoutes: {
signIn: 'signIn',
diff --git a/src/i18n/lang/zh-cn.js b/src/i18n/lang/zh-cn.js
index 56b88dc..f8f7aae 100644
--- a/src/i18n/lang/zh-cn.js
+++ b/src/i18n/lang/zh-cn.js
@@ -56,6 +56,8 @@ export default {
attendanceMachineEquipmentManagement:'考勤机设备管理',
recipe: '每周食谱',
evaluate: '幼儿评价表',
+ classList: '班级管理',
+ department: '部门管理'
},
staticRoutes: {
diff --git a/src/i18n/lang/zh-tw.js b/src/i18n/lang/zh-tw.js
index b3ef425..3cb501d 100644
--- a/src/i18n/lang/zh-tw.js
+++ b/src/i18n/lang/zh-tw.js
@@ -56,6 +56,8 @@ export default {
attendanceMachineEquipmentManagement:'考勤機設備管理',
recipe: '每周食谱',
evaluate: '幼儿评价表',
+ classList: '班级管理',
+ department: '部门管理',
},
staticRoutes: {
signIn: '登入',
diff --git a/src/router/index.js b/src/router/index.js
index f4d330f..6b8bcc7 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -258,30 +258,24 @@ router.beforeEach((to, from, next) => {
keepAliveSplice(to);
NProgress.configure({ showSpinner: false });
if (to.meta.title && to.path !== '/login') NProgress.start();
- let token = localStorage.getItem('token');
+ let token = Session.get('token');
if (to.path === '/login' && !token) {
- console.log(111111111)
NProgress.start();
next();
delayNProgressDone();
} else {
if (!token) {
- console.log(2222222222)
NProgress.start();
next('/login');
Session.clear();
delayNProgressDone();
} else if (token && to.path === '/login') {
- console.log(33333333333)
next('/home');
delayNProgressDone();
} else {
- console.log(4444444444)
if (Object.keys(store.state.routesList.routesList).length <= 0) {
- console.log(55555)
getRouterList(router, to, next);
} else {
- console.log(6666666666)
next();
delayNProgressDone(0);
}
diff --git a/src/store/index.js b/src/store/index.js
index 67d3e9b..5769b4a 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -26,7 +26,9 @@ const state = {
token: localStorage.getItem('token') || '',
refreshToken: localStorage.getItem('refreshToken') || '', // 刷新token
user: localStorage.getItem('user') ? JSON.parse(localStorage.getItem('user')) : {}, // 用户信息
-
+ school: localStorage.getItem('school') ? JSON.parse(localStorage.getItem('school')) : {}, // 学校 默认获取的第一个
+ roles: localStorage.getItem('roles') ? JSON.parse(localStorage.getItem('roles')) : [], // 权限 是家长或教师
+ classify: localStorage.getItem('classify') ? JSON.parse(localStorage.getItem('classify')) : {} // 用户为班主任的班级 默认查找的第一个
}
@@ -43,6 +45,18 @@ const mutations = {
state.user = newUser
localStorage.setItem('user', JSON.stringify(newUser) )
},
+ setSchool( state, newSchool){
+ localStorage.setItem('school', JSON.stringify(newSchool) )
+ state.school = newSchool
+ },
+ setRoles( state, newRoles){
+ localStorage.setItem('roles', JSON.stringify(newRoles) )
+ state.roles = newRoles
+ },
+ setClassify( state, newClassify){
+ localStorage.setItem('classify', JSON.stringify(newClassify) )
+ state.classify = newClassify
+ },
}
const actions = {
diff --git a/src/utils/request.js b/src/utils/request.js
index de9cb2a..ec3f094 100644
--- a/src/utils/request.js
+++ b/src/utils/request.js
@@ -3,7 +3,7 @@ import router, { resetRouter } from '@/router/index';
import axios from 'axios';
import { Message, MessageBox } from 'element-ui';
import { Session } from '@/utils/storage';
-const getToken = localStorage.getItem('token');
+
const errorCode = {
'401': '登录状态已过期,即将返回首页重新登录。',
'403': '当前操作没有权限',
@@ -20,10 +20,12 @@ const service = axios.create({
// 添加请求拦截器
service.interceptors.request.use(
(config) => {
+ console.log('---------------------')
// 是否需要设置 token
const isToken = (config.headers || {}).isToken === false
+ let getToken = Session.get('token');
if (getToken && !isToken) {
- config.headers['Authorization'] = localStorage.getItem('token') // 让每个请求携带自定义token 请根据实际情况自行修改
+ config.headers['Authorization'] = getToken // 让每个请求携带自定义token 请根据实际情况自行修改
}
return config;
},
diff --git a/src/views/classList/classList/api.js b/src/views/classList/classList/api.js
new file mode 100644
index 0000000..d1b1aac
--- /dev/null
+++ b/src/views/classList/classList/api.js
@@ -0,0 +1,20 @@
+import request from '@/utils/request';
+
+// 获取组织结构
+export function getClass () {
+ return request({
+ url: '/manager/class/list',
+ method: 'get',
+ })
+}
+// 获取班级用户列表
+export function getClassStudent (classId, params) {
+ return request({
+ url: `/manager/class/student/list/${classId}`,
+ method: 'get',
+ params
+ })
+}
+
+
+
diff --git a/src/views/classList/classList/columns.js b/src/views/classList/classList/columns.js
new file mode 100644
index 0000000..44ca9f0
--- /dev/null
+++ b/src/views/classList/classList/columns.js
@@ -0,0 +1,52 @@
+export default [
+ {
+ label: "设备id",
+ prop: "deviceId",
+ type: "text",
+ },
+ {
+ label: "账号名称",
+ prop: "username",
+ type: "text",
+ },
+
+ {
+ label: "设备名称",
+ prop: "deviceName",
+ type: "text",
+ },
+ {
+ label: "用户名",
+ prop: "username",
+ type: "image",
+ },
+ {
+ label: "密码",
+ prop: "password",
+ type: "text",
+ },
+
+
+ {
+ label: "设备标签",
+ prop: "deviceLabel",
+ type: "text",
+ },
+ {
+ label: "设备地址",
+ prop: "deviceUrl",
+ type: "text",
+ },
+ {
+ label: "设备状态",
+ prop: "deviceStatus",
+ type: "text",
+ },
+
+ {
+ label: "设备物理地址",
+ prop: "macAddress",
+ type: "text",
+ },
+
+]
\ No newline at end of file
diff --git a/src/views/classList/classList/components/CommonHead.vue b/src/views/classList/classList/components/CommonHead.vue
new file mode 100644
index 0000000..ab2b29c
--- /dev/null
+++ b/src/views/classList/classList/components/CommonHead.vue
@@ -0,0 +1,75 @@
+
+
+ 新增食谱
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/classList/classList/components/CommonTablesImg.vue b/src/views/classList/classList/components/CommonTablesImg.vue
new file mode 100644
index 0000000..c5d3705
--- /dev/null
+++ b/src/views/classList/classList/components/CommonTablesImg.vue
@@ -0,0 +1,115 @@
+
+
+
+
+ {{ scope.row[column.prop] }}
+
+
![]()
+
+
+
+
+
+
+ 编辑
+
+ 删除
+
+
+
+
+
+
+
diff --git a/src/views/classList/classList/index.vue b/src/views/classList/classList/index.vue
new file mode 100644
index 0000000..6ac74a8
--- /dev/null
+++ b/src/views/classList/classList/index.vue
@@ -0,0 +1,175 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/department/api.js b/src/views/department/api.js
new file mode 100644
index 0000000..3bb9751
--- /dev/null
+++ b/src/views/department/api.js
@@ -0,0 +1,20 @@
+import request from '@/utils/request';
+
+// 获取部门列表
+export function getClass () {
+ return request({
+ url: '/manager/dept/list',
+ method: 'get',
+ })
+}
+// 获取部门用户列表
+export function getClassStudent (deptId, params) {
+ return request({
+ url: `/manager/user/list/${deptId}`,
+ method: 'get',
+ params
+ })
+}
+
+
+
diff --git a/src/views/department/columns.js b/src/views/department/columns.js
new file mode 100644
index 0000000..44ca9f0
--- /dev/null
+++ b/src/views/department/columns.js
@@ -0,0 +1,52 @@
+export default [
+ {
+ label: "设备id",
+ prop: "deviceId",
+ type: "text",
+ },
+ {
+ label: "账号名称",
+ prop: "username",
+ type: "text",
+ },
+
+ {
+ label: "设备名称",
+ prop: "deviceName",
+ type: "text",
+ },
+ {
+ label: "用户名",
+ prop: "username",
+ type: "image",
+ },
+ {
+ label: "密码",
+ prop: "password",
+ type: "text",
+ },
+
+
+ {
+ label: "设备标签",
+ prop: "deviceLabel",
+ type: "text",
+ },
+ {
+ label: "设备地址",
+ prop: "deviceUrl",
+ type: "text",
+ },
+ {
+ label: "设备状态",
+ prop: "deviceStatus",
+ type: "text",
+ },
+
+ {
+ label: "设备物理地址",
+ prop: "macAddress",
+ type: "text",
+ },
+
+]
\ No newline at end of file
diff --git a/src/views/department/components/CommonHead.vue b/src/views/department/components/CommonHead.vue
new file mode 100644
index 0000000..ab2b29c
--- /dev/null
+++ b/src/views/department/components/CommonHead.vue
@@ -0,0 +1,75 @@
+
+
+ 新增食谱
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/department/components/CommonTablesImg.vue b/src/views/department/components/CommonTablesImg.vue
new file mode 100644
index 0000000..c5d3705
--- /dev/null
+++ b/src/views/department/components/CommonTablesImg.vue
@@ -0,0 +1,115 @@
+
+
+
+
+ {{ scope.row[column.prop] }}
+
+
![]()
+
+
+
+
+
+
+ 编辑
+
+ 删除
+
+
+
+
+
+
+
diff --git a/src/views/department/index.vue b/src/views/department/index.vue
new file mode 100644
index 0000000..174bf08
--- /dev/null
+++ b/src/views/department/index.vue
@@ -0,0 +1,158 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/login/api.js b/src/views/login/api.js
index 37a882f..5865557 100644
--- a/src/views/login/api.js
+++ b/src/views/login/api.js
@@ -1,4 +1,4 @@
-import request from '@/utils/request';
+import request from '@/utils/logoRequest';
// 登录
export function login (data) {
diff --git a/src/views/login/index.vue b/src/views/login/index.vue
index 2903cbd..66983d7 100644
--- a/src/views/login/index.vue
+++ b/src/views/login/index.vue
@@ -174,7 +174,6 @@ export default {
this.submit.loading = true;
this.$router.push('/evaluate')
console.log(this.$router)
- localStorage.setItem('token', 123)
if( rulesPhone(this.loginForm.phone) ){ // 判断是否存在手机号验证码
if(this.loginForm.code){
@@ -186,9 +185,23 @@ export default {
}
this.$store.dispatch('loginIn', formData).then(res =>{
this.$message.success('登录成功!')
+ Session.set('token',res.token_type +' ' + res.access_token)
// this.$router.push('/evaluate')
+ // 设置用户信息 学校信息 班级信息
+ let user = this.$store.state.user
+ if(user.campusInfo ){
+ if(user.campusInfo.length >= 1){ // 说明只有一个校区
+ if(user.campusInfo[0].classInfo){
+ this.$store.commit('setSchool', user.campusInfo[0] ); // 设置默认校区
+ }
+ }
+ }else { // 未查到校区信息
+
+ }
+
this.oldSet()
+
}).finally(err =>{
this.submit.loading = false;
this.sendText = '发送'