作者 朱兆平

update:

1. 增加用户锁定接口操作按钮
2. 心跳间隔调整至90秒一次
... ... @@ -10,21 +10,24 @@ export const getRandCode = params => { return http.get(`/cloud-user-center/anony
export const getUserListPage = params => { return http.get(`/user/list`,params) };
export const removeUser = params => { return http.del(`${baseUrl}/del`,params)};
export const removeUser = params => { return http.post(`${baseUrl}/del`,params)};
export const batchRemoveUser = params => { return http.del(`${baseUrl}/batchremove`, { params: params }); };
export const batchRemoveUser = params => { return http.post(`${baseUrl}/batchremove`, { params: params }); };
export const editPass = params => { return http.put(`${baseUrl}/password`,params)};
export const editPass = params => { return http.post(`${baseUrl}/password`,params)};
export const editUser = params => { return http.put(`${baseUrl}/edit`,params)};
export const editUser = params => { return http.post(`${baseUrl}/edit`,params)};
export const addUser = params => { return http.post(`${baseUrl}/add`,params)};
export const heartBeat = params => { return http.post(`${serviceName}/heartbeat`,params)};
export const setUserRole = params => { return http.put(`${baseUrl}/roleset`,params)};
export const userLock = params => { return http.post(`${baseUrl}/lock`,params)};
export const setUserRole = params => { return http.post(`${baseUrl}/roleset`,params)};
export const resetToken = params => { return http.post(`${baseUrl}/resetToken`,params)};
export const resetToken = params => { return http.put(`${baseUrl}/resetToken`,params)};
export const loginedUserInfo = () => {
... ...
... ... @@ -286,6 +286,11 @@
heartBeatAPI:function () {
heartBeat().then(response => {
}).catch(e=>{
this.$notify.error({
title: '心跳',
message: '心跳失败'
});
});
}
},
... ... @@ -310,8 +315,10 @@
this.checkUpdate();
}, 30000);
setInterval(() => {
if (this.sysUserName){
this.heartBeatAPI();
}, 60000);
}
}, 90000);
this.$nextTick(function(){
this.initUserInfo();
// this.rowDrop(); //行拖拽效果
... ...
... ... @@ -50,6 +50,9 @@
<template slot-scope="scope">
<el-tag type="success" v-if="scope.row.state">启用</el-tag>
<el-tag type="danger" v-else>禁用</el-tag>
<el-button type="text" @click="lockUser(scope.$index, scope.row, false)" v-if="scope.row.state">禁用</el-button>
<el-button type="text" @click="lockUser(scope.$index, scope.row, true)" v-else>启用</el-button>
</template>
</el-table-column>
<el-table-column prop="userStatus" label="状态" width="100">
... ... @@ -228,7 +231,7 @@
<script>
import util from '../../common/js/util'
import NProgress from 'nprogress'
import { getUserList, removeUser, batchRemoveUser, editUser, addUser, setUserRole } from '../../api/user';
import { getUserList, removeUser, batchRemoveUser, editUser, addUser, setUserRole,userLock } from '../../api/user';
import { getList} from '../../api/role_api';
import { getList as getRoleList} from '../../api/role_api';
import moment from 'moment'
... ... @@ -340,7 +343,29 @@
});
},
// 禁用与启用用户
lockUser: function(index, row, stateCode){
this.listLoading = true;
let para = {
userId: row.userId,
username:row.username,
state: stateCode
};
userLock(para).then((res) => {
this.$message({
message: '操作成功',
type: 'success'
});
this.getUsers();
}).catch((e) => {
this.$message({
message: '操作失败',
type: 'error'
});
}).finally(()=>{
this.listLoading = false;
});
},
// 获取公司列表
getCompanyNmae(){
let para = {
... ...