自动退出,成绩管理

master
yujialong 4 years ago
parent ff8accf631
commit 7ae8cc955f
  1. 2
      src/components/page/Achievement.vue
  2. 34
      src/components/page/ExperimentAss.vue
  3. 14
      src/components/page/ExperimentTeach.vue
  4. 1
      src/components/page/Login.vue
  5. 4
      src/config/index.js
  6. 3
      src/main.js
  7. 4
      src/store/index.js
  8. 1
      src/utils/api.js
  9. 28
      src/utils/core.js
  10. 29
      src/utils/http.js

@ -123,6 +123,7 @@ export default {
data() {
return {
userId: this.$store.state.userLoginId,
roleId: this.$store.state.userRoleId.includes(',') ? 13 : Number(this.$store.state.userRoleId),
keyword: '',
systemId: this.$config.systemId,
projectPermissions: 0,
@ -213,6 +214,7 @@ export default {
type: '',
status: '',
classId: '',
role: this.roleId
}
this.$post(this.api.getAssessmentList,data).then(res => {
this.listData = res.data.list

@ -114,10 +114,10 @@ export default {
not: 0,
reviewList: [
{
id: 0,
id: 1,
name: '已批阅'
},{
id: 1,
id: 0,
name: '待批阅'
}
]
@ -132,25 +132,27 @@ export default {
let data = {
id: this.id,
classId: this.classId,
isRead: this.isRead == 1 ? '' : (this.isRead == 2 ? 0 : 1), //''01
isRead: this.isRead == 1 ? '' : (this.isRead == 2 ? 1 : 0), //''10
searchContent: this.encodeString(this.keyword),
}
this.$get(this.api.getKdAchievement,data).then(res => {
let list = res.data
let score = 0
let already = 0
let not = 0
list.map(n => {
n.class = this.className
score += n.score
if(!n.isRead){
already++
}else{
not++
}
})
this.already = already
this.not = not
if(this.isRead == '1'){
let already = 0
let not = 0
list.map(n => {
n.class = this.className
score += n.score
if(!n.isRead){
not++
}else{
already++
}
})
this.already = already
this.not = not
}
this.listDataAll = list
this.handlePage()

@ -67,6 +67,11 @@
<el-table-column prop="score" label="分数" align="center"></el-table-column>
<el-table-column prop="creationTime" label="提交时间" align="center">
</el-table-column>
<el-table-column prop="experimentalName" label="批阅状态" align="center">
<template slot-scope="scope">
{{reviewList.find(n => n.id == scope.row.isRead).name}}
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="220">
<template slot-scope="scope">
<el-button type="text" @click="edit(scope.row)">批阅</el-button>
@ -103,6 +108,15 @@ export default {
pageSize: 10,
totals: 0,
avg: 0,
reviewList: [
{
id: 1,
name: '已批阅'
},{
id: 0,
name: '待批阅'
}
]
};
},
mounted() {

@ -102,6 +102,7 @@ export default {
this.$message.success('登录成功');
sessionStorage.setItem('kd_server_username', this.activeName == '0' ? this.param.username : this.phoneParam.userphone);
res.message.retvalue.userAvatars && this.$store.commit("userPhoto", { avatar : res.message.retvalue.userAvatars})
this.$store.commit("dataTime", { dataTime : res.message.retvalue.dataTime});
this.$store.commit("userLoginData", { userLogin_id : data.userId,userRole_id: data.roleId,schoolId: data.schoolId,token: data.token,userName: data.userName});
let redirect = decodeURIComponent(this.$route.query.redirect || '/dashboard')

@ -25,6 +25,10 @@ export default {
* @description 系统id
*/
systemId: 3,
/**
* @description 长时间未操作自动退出登录时间
*/
autoLogoutTime: 3600000,
/**
* @description 是否使用动态路由
*/

@ -17,7 +17,7 @@ import store from './store'
import config from '@/config'
import permission from '@/router/permission';
import { systemStatus, systemTypeStatus, systemAttributionStatus, courseTypeStatus,
hoursStatus, roleStatus, orderTypeFn, orderStatusFn, orderNatureFn, Percentage, removeByValue, formatDate, formateTime, orderRoleType, orderRoleAttribute, setCookie, encodeString } from './utils/core';
hoursStatus, roleStatus, orderTypeFn, orderStatusFn, orderNatureFn, Percentage, removeByValue, formatDate, formateTime, orderRoleType, orderRoleAttribute, setCookie, encodeString,logout } from './utils/core';
import preventReClick from './store/preventReClick' //防多次点击,重复提交
// 插件
@ -50,6 +50,7 @@ Vue.prototype.orderRoleAttribute = orderRoleAttribute;
Vue.prototype.formateTime = formateTime;
Vue.prototype.setCookie = setCookie;
Vue.prototype.encodeString = encodeString;
Vue.prototype.logout = logout;
Vue.config.productionTip = false;
Vue.use(VueI18n);

@ -26,6 +26,7 @@ const store = new Vuex.Store({
userName: '',
routes: [],
btnPermissions: [],
dataTime: ''
},
mutations:{
userData (state, payload) {
@ -35,6 +36,9 @@ const store = new Vuex.Store({
userPhoto(state,payload){
state.avatar = payload.avatar
},
dataTime(state,payload){
state.dataTime = payload.dataTime
},
customerData (state, payload) {
state.customerId = payload.customer_id
},

@ -13,6 +13,7 @@ if(process.env.NODE_ENV === 'development'){
export default {
logins: `${host}/liuwanr/userInfo/adminLogins`, //登录
queryToken: `${host}/liuwanr/userInfo/queryToken`,
fileupload: `${uploadURL}/oss/manage/fileupload`,
updateLogInNumber: `${host}/liuwanr/userInfo/updateLogInNumber`, //用户登录修改登录次数和登陆时间

@ -1,3 +1,7 @@
import config from '@/config'
import store from '@/store'
import { Message } from 'element-ui'
const pad2 = str => ('0' + str).substr(-2)
function fMoney (s, n) {
@ -217,6 +221,27 @@ function setCookie(name, value, expiredays) {
document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString+";path=/;";
}
function logout(){
store.replaceState({})
sessionStorage.removeItem('kd_server_username')
location.reload()
}
function autoLogout(){
let lastTime = new Date().getTime()
document.onmousedown = () => {
lastTime = new Date().getTime()
}
setInterval(() => {
if(sessionStorage.getItem('kd_server_username') && (new Date().getTime() - lastTime) > config.autoLogoutTime){
Message.error('用户登录过期,请重新登录')
setTimeout(logout,1500)
}
},1000)
}
autoLogout()
export {
fMoney,
formateTime,
@ -239,5 +264,6 @@ export {
removeByValue,
formatDate,
setCookie,
encodeString
encodeString,
logout
}

@ -101,21 +101,26 @@ axios.interceptors.request.use(config => {
// }
// );
function logouts(){
store.replaceState({})
sessionStorage.removeItem('kd_server_username')
location.reload()
}
let logout = false
export function getToken(){
// console.log(store.state.dataTime,logout)
if(process.env.NODE_ENV == 'production'){
// if(store.state.dataTime && !logout){
// axios.get(`${api.queryToken}?token=${store.state.token}`).then(res => {
// if(store.state.dataTime && (res.data.message != store.state.dataTime)){
// logout || Message.error('您已在另一台设备登录,本次登录已下线!')
// logout = true
// setTimeout(() => {
// core.logout()
// },1500)
// }
// }).catch(err => {})
// }
if(store.state.dataTime && !logout){
axios.get(`${api.queryToken}?token=${store.state.token}`).then(res => {
if(store.state.dataTime && (res.data.message != store.state.dataTime)){
logout || Message.error('您已在另一台设备登录,本次登录已下线!')
logout = true
setTimeout(() => {
logouts()
},1500)
}
}).catch(err => {})
}
}
}

Loading…
Cancel
Save