Browse Source

签到管理系统

kqqd
lzp 10 months ago
parent
commit
82d0235c87
  1. 8
      .env.production
  2. 2
      src/api/login.js
  3. 119
      src/api/school.js
  4. 15
      src/store/modules/user.js
  5. 157
      src/views/index.vue
  6. 2
      src/views/login.vue
  7. 2
      vue.config.js

8
.env.production

@ -6,11 +6,11 @@ NODE_ENV = 'production'
# 大唐 # 大唐
VUE_APP_BASE_API = '/commen_api/' VUE_APP_BASE_API = '/multimodal/'
VUE_APP_IMG_URL = '/commen_api/' VUE_APP_IMG_URL = '/multimodal/'
VUE_APP_API_QZURL = '/commen_api/' VUE_APP_API_QZURL = '/multimodal/'
# 访问路径 # 访问路径
VUE_APP_PUBLIC_PATH = '/commen/' VUE_APP_PUBLIC_PATH = '/multimodal_yf/attendSys/'

2
src/api/login.js

@ -9,7 +9,7 @@ export function login(username, password, code, uuid) {
uuid, uuid,
}; };
return request({ return request({
url: "/login", url: "/app/user/login",
headers: { headers: {
isToken: false, isToken: false,
repeatSubmit: false, repeatSubmit: false,

119
src/api/school.js

@ -1,115 +1,48 @@
import request from "@/utils/request"; import request from "@/utils/request";
// ------ 教务处学校管理 ------ // 获取设备信息
export function attributes(data) {
// 学校列表
export function schoolList(data) {
return request({ return request({
url: "/school/list", url: "/app/device/attributes",
method: "post", method: "get",
data: data, params: data,
});
}
// 新增/修改学校
export function schoolAdd(data) {
return request({
url: "/school/add",
method: "post",
data: data,
});
}
// 新增/修改学校
export function schoolDel(data) {
return request({
url: "/school/del",
method: "post",
data: data,
}); });
} }
// 根据项目key查找项目id
// ------ 教务处评审管理 ------ export function queryProjectInfoByKey(data) {
// 评审列表
export function commentList(data) {
return request({ return request({
url: "/come/list", url: "/app/device/queryProjectInfoByKey",
method: "post", method: "get",
data: data, params: data,
}); });
} }
// 评审详情 // 根据项目id查找设备列表
export function reviewDetails(data) { export function deviceList(data) {
return request({ return request({
url: "/come/detail", url: "/app/device/list",
method: "post", method: "get",
data: data, params: data,
}); });
} }
// ------ 专家评审 ------ // 设备日志
// 学校列表 export function attributesRecord(data) {
export function expertschoolist(data) {
return request({ return request({
url: "/expert/school/list", url: "/app/device/attributes/record",
method: "post", method: "get",
data: data, params: data,
});
}
// 评审详情
export function expertReviewDetails(data) {
return request({
url: "/expert/comment/list",
method: "post",
data: data,
});
}
// 评审
export function expertReviewAdd(data) {
return request({
url: "/expert/comment/add",
method: "post",
data: data,
});
}
// ------ 分片相关接口 ------
// 校验文件是否已上传
export function register(data) {
return request({
url: "/mediaUpload/register",
method: "post",
data: data,
});
}
// 校验分片是否已上传
export function checkchunk(data) {
return request({
url: "/mediaUpload/checkchunk",
method: "post",
data: data,
});
}
// 循环上传分片
export function uploadchunk(data) {
return request({
url: "/mediaUpload/uploadchunk",
method: "post",
data: data,
headers: {
"Content-Type": "multipart/form-data",
},
}); });
} }
// 合并分片 // 下发属性
export function mergechunks(data) { export function sendAttribute(data) {
return request({ return request({
url: "/mediaUpload/mergechunks", url: "/app/device/sendAttribute",
method: "post", method: "post",
data: data, data: data,
}); });
} }
// 合并后上传文件 // 下发命令
export function addFile(data) { export function sendCommand(data) {
return request({ return request({
url: "/netdisk/file/add", url: "/app/device/sendCommand",
method: "post", method: "post",
data: data, data: data,
}); });

15
src/store/modules/user.js

@ -43,8 +43,10 @@ const user = {
const uuid = userInfo.uuid const uuid = userInfo.uuid
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
login(username, password, code, uuid).then(res => { login(username, password, code, uuid).then(res => {
setToken(res.token) console.log('res.data',res.data);
commit('SET_TOKEN', res.token)
setToken(res.data.token)
commit('SET_TOKEN', res.data.token)
resolve() resolve()
}).catch(error => { }).catch(error => {
reject(error) reject(error)
@ -56,14 +58,15 @@ const user = {
GetInfo({ commit, state }) { GetInfo({ commit, state }) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
getInfo().then(res => { getInfo().then(res => {
const user = res.user console.log('获取用户信息',res);
const user = res.data.user
let avatar = user.avatar || "" let avatar = user.avatar || ""
if (!isHttp(avatar)) { if (!isHttp(avatar)) {
avatar = (isEmpty(avatar)) ? defAva : process.env.VUE_APP_BASE_API + avatar avatar = (isEmpty(avatar)) ? defAva : process.env.VUE_APP_BASE_API + avatar
} }
if (res.roles && res.roles.length > 0) { // 验证返回的roles是否是一个非空数组 if (res.data.roles && res.data.roles.length > 0) { // 验证返回的roles是否是一个非空数组
commit('SET_ROLES', res.roles) commit('SET_ROLES', res.data.roles)
commit('SET_PERMISSIONS', res.permissions) commit('SET_PERMISSIONS', res.data.permissions)
} else { } else {
commit('SET_ROLES', ['ROLE_DEFAULT']) commit('SET_ROLES', ['ROLE_DEFAULT'])
} }

157
src/views/index.vue

@ -1,58 +1,71 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<!-- <el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <!-- <el-col :span="1.5">
<el-button <el-button
type="primary" type="primary"
plain plain
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
>远程开锁</el-button> >远程开锁</el-button>
</el-col> </el-col> -->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getAttributes(deviceId)"></right-toolbar>
</el-row> --> </el-row>
<el-table v-loading="loading" :data="tableList" max-height="600">
<el-table-column label="序号" align="center" prop="noticeId" width="100" >
<template slot-scope="scope">
{{ (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1 }}
</template>
</el-table-column>
<el-table v-loading="loading" :data="noticeList" max-height="600">
<el-table-column label="序号" align="center" prop="noticeId" width="100" />
<el-table-column <el-table-column
label="ID" label="时间"
align="center" align="center"
prop="noticeTitle" prop="reportTime"
:show-overflow-tooltip="true" :show-overflow-tooltip="true"
min-width="100" min-width="100"
/> />
<el-table-column <el-table-column
label="时间" label="类型"
align="center" align="center"
prop="noticeTitle" prop="tips"
:show-overflow-tooltip="true"
min-width="100"
/>
<el-table-column
label="ID"
align="center"
prop="attributeValue.id"
:show-overflow-tooltip="true" :show-overflow-tooltip="true"
min-width="100" min-width="100"
/> />
<el-table-column label="类型" align="center" prop="noticeType" min-width="100">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_notice_type" :value="scope.row.noticeType"/>
</template>
</el-table-column>
</el-table> </el-table>
<pagination <pagination
v-show="total>0" v-show="total>0"
:total="total" :total="total"
:page.sync="queryParams.pageNum" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@pagination="getList" @pagination="getqueryProjectInfoByKey"
/> />
</div> </div>
</template> </template>
<script> <script>
import { listNotice, getNotice, delNotice, addNotice, updateNotice } from "@/api/system/notice"; import {
queryProjectInfoByKey,
deviceList,
attributes,
sendAttribute,
sendCommand,
attributesRecord,
} from "@/api/school";
export default { export default {
name: "Notice", name: "Notice",
dicts: ['sys_notice_status', 'sys_notice_type'],
data() { data() {
return { return {
deviceId: "", // id
// //
loading: true, loading: true,
// //
@ -66,7 +79,7 @@ export default {
// //
total: 0, total: 0,
// //
noticeList: [], tableList: [],
// //
title: "", title: "",
// //
@ -75,40 +88,112 @@ export default {
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
noticeTitle: undefined,
createBy: undefined,
status: undefined
}, },
// //
form: {}, form: {},
// //
rules: { rules: {
noticeTitle: [ noticeTitle: [
{ required: true, message: "公告标题不能为空", trigger: "blur" } { required: true, message: "公告标题不能为空", trigger: "blur" },
], ],
noticeType: [ noticeType: [
{ required: true, message: "公告类型不能为空", trigger: "change" } { required: true, message: "公告类型不能为空", trigger: "change" },
] ],
} },
}; };
}, },
created() { created() {
this.getList(); this.getqueryProjectInfoByKey();
}, },
methods: { methods: {
/** 查询公告列表 */ handleSendCommand() {
getList() { sendCommand({
commandId: "447242774207233", // ID,
commandParams: 1, // ,
deviceId: this.deviceId,
}).then((res) => {
this.$message.success("操作成功");
this.getAttributes(this.deviceId); // id
});
},
//
handleSettings() {
this.open = true;
this.form = {
threshold: this.deviceInfo.threshold,
};
// this.$message.success('');
},
// keyid
getqueryProjectInfoByKey() {
this.loading = true; this.loading = true;
listNotice(this.queryParams).then(response => { queryProjectInfoByKey({
this.noticeList = response.rows; projectKey: "qKStHKKt",
this.total = response.total; }).then((res) => {
this.getDeviceList(res.data.id); // id
});
},
// id
getDeviceList(_id) {
deviceList({
projectId: _id,
}).then((res) => {
const w2Device = res.rows.find((device) => device.deviceName === "A1");
this.deviceId = w2Device.id;
this.getAttributes(this.deviceId); // id
});
},
// id
getAttributes(_id) {
attributesRecord({
pageNum: this.queryParams.pageNum,
pageSize: this.queryParams.pageSize,
deviceId: _id,
}).then((res) => {
this.loading = false; this.loading = false;
let isOpenValue = {
0: "开锁失败",
1: "开锁成功",
};
let typeValue = {
A1: "指纹",
A2: "人脸",
};
res.rows.forEach((item) => {
item.attributeValue = JSON.parse(item.attributeValue);
item.tips = `${typeValue[item.attributeValue.type]}`;
});
this.tableList = res.rows;
this.total = res.total;
});
},
/** 下发属性 */
submitForm: function () {
this.$refs["form"].validate((valid) => {
if (valid) {
let param = { Wen: `#${this.form.threshold}` }; //
sendAttribute({
attributeParams: JSON.stringify(param), // JSON
deviceId: this.deviceId, // id
}).then((response) => {
this.getAttributes(this.deviceId); // id
this.$modal.msgSuccess("操作成功");
this.open = false;
});
}
}); });
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.$message.success('操作成功'); this.$message.success("操作成功");
}, },
} },
}; };
</script> </script>
<style scoped >
>>> .top-right-btn .el-button:nth-of-type(1) {
display: none;
}
</style>

2
src/views/login.vue

@ -139,7 +139,7 @@ export default {
this.captchaEnabled = this.captchaEnabled =
res.captchaEnabled === undefined ? true : res.captchaEnabled; res.captchaEnabled === undefined ? true : res.captchaEnabled;
if (this.captchaEnabled) { if (this.captchaEnabled) {
this.codeUrl = "data:image/gif;base64," + res.img; this.codeUrl = "data:image/gif;base64," + res.data.img;
this.loginForm.uuid = res.uuid; this.loginForm.uuid = res.uuid;
} }
}); });

2
vue.config.js

@ -40,7 +40,7 @@ module.exports = {
proxy: { proxy: {
// detail: https://cli.vuejs.org/config/#devserver-proxy // detail: https://cli.vuejs.org/config/#devserver-proxy
[process.env.VUE_APP_BASE_API]: { [process.env.VUE_APP_BASE_API]: {
target: `https://test.tall.wiki/commen/`, target: `http://121.37.81.216/multimodal/`,
changeOrigin: true, changeOrigin: true,
pathRewrite: { pathRewrite: {
["^" + process.env.VUE_APP_BASE_API]: "", ["^" + process.env.VUE_APP_BASE_API]: "",

Loading…
Cancel
Save