update:
1. 增加用户锁定接口操作按钮 2. 心跳间隔调整至90秒一次
正在显示
3 个修改的文件
包含
44 行增加
和
9 行删除
@@ -10,21 +10,24 @@ export const getRandCode = params => { return http.get(`/cloud-user-center/anony | @@ -10,21 +10,24 @@ export const getRandCode = params => { return http.get(`/cloud-user-center/anony | ||
10 | 10 | ||
11 | export const getUserListPage = params => { return http.get(`/user/list`,params) }; | 11 | export const getUserListPage = params => { return http.get(`/user/list`,params) }; |
12 | 12 | ||
13 | -export const removeUser = params => { return http.del(`${baseUrl}/del`,params)}; | 13 | +export const removeUser = params => { return http.post(`${baseUrl}/del`,params)}; |
14 | 14 | ||
15 | -export const batchRemoveUser = params => { return http.del(`${baseUrl}/batchremove`, { params: params }); }; | 15 | +export const batchRemoveUser = params => { return http.post(`${baseUrl}/batchremove`, { params: params }); }; |
16 | 16 | ||
17 | -export const editPass = params => { return http.put(`${baseUrl}/password`,params)}; | 17 | +export const editPass = params => { return http.post(`${baseUrl}/password`,params)}; |
18 | 18 | ||
19 | -export const editUser = params => { return http.put(`${baseUrl}/edit`,params)}; | 19 | +export const editUser = params => { return http.post(`${baseUrl}/edit`,params)}; |
20 | 20 | ||
21 | export const addUser = params => { return http.post(`${baseUrl}/add`,params)}; | 21 | export const addUser = params => { return http.post(`${baseUrl}/add`,params)}; |
22 | 22 | ||
23 | export const heartBeat = params => { return http.post(`${serviceName}/heartbeat`,params)}; | 23 | export const heartBeat = params => { return http.post(`${serviceName}/heartbeat`,params)}; |
24 | 24 | ||
25 | -export const setUserRole = params => { return http.put(`${baseUrl}/roleset`,params)}; | 25 | +export const userLock = params => { return http.post(`${baseUrl}/lock`,params)}; |
26 | + | ||
27 | +export const setUserRole = params => { return http.post(`${baseUrl}/roleset`,params)}; | ||
28 | + | ||
29 | +export const resetToken = params => { return http.post(`${baseUrl}/resetToken`,params)}; | ||
26 | 30 | ||
27 | -export const resetToken = params => { return http.put(`${baseUrl}/resetToken`,params)}; | ||
28 | 31 | ||
29 | 32 | ||
30 | export const loginedUserInfo = () => { | 33 | export const loginedUserInfo = () => { |
@@ -286,6 +286,11 @@ | @@ -286,6 +286,11 @@ | ||
286 | heartBeatAPI:function () { | 286 | heartBeatAPI:function () { |
287 | heartBeat().then(response => { | 287 | heartBeat().then(response => { |
288 | 288 | ||
289 | + }).catch(e=>{ | ||
290 | + this.$notify.error({ | ||
291 | + title: '心跳', | ||
292 | + message: '心跳失败' | ||
293 | + }); | ||
289 | }); | 294 | }); |
290 | } | 295 | } |
291 | }, | 296 | }, |
@@ -310,8 +315,10 @@ | @@ -310,8 +315,10 @@ | ||
310 | this.checkUpdate(); | 315 | this.checkUpdate(); |
311 | }, 30000); | 316 | }, 30000); |
312 | setInterval(() => { | 317 | setInterval(() => { |
318 | + if (this.sysUserName){ | ||
313 | this.heartBeatAPI(); | 319 | this.heartBeatAPI(); |
314 | - }, 60000); | 320 | + } |
321 | + }, 90000); | ||
315 | this.$nextTick(function(){ | 322 | this.$nextTick(function(){ |
316 | this.initUserInfo(); | 323 | this.initUserInfo(); |
317 | // this.rowDrop(); //行拖拽效果 | 324 | // this.rowDrop(); //行拖拽效果 |
@@ -50,6 +50,9 @@ | @@ -50,6 +50,9 @@ | ||
50 | <template slot-scope="scope"> | 50 | <template slot-scope="scope"> |
51 | <el-tag type="success" v-if="scope.row.state">启用</el-tag> | 51 | <el-tag type="success" v-if="scope.row.state">启用</el-tag> |
52 | <el-tag type="danger" v-else>禁用</el-tag> | 52 | <el-tag type="danger" v-else>禁用</el-tag> |
53 | + | ||
54 | + <el-button type="text" @click="lockUser(scope.$index, scope.row, false)" v-if="scope.row.state">禁用</el-button> | ||
55 | + <el-button type="text" @click="lockUser(scope.$index, scope.row, true)" v-else>启用</el-button> | ||
53 | </template> | 56 | </template> |
54 | </el-table-column> | 57 | </el-table-column> |
55 | <el-table-column prop="userStatus" label="状态" width="100"> | 58 | <el-table-column prop="userStatus" label="状态" width="100"> |
@@ -228,7 +231,7 @@ | @@ -228,7 +231,7 @@ | ||
228 | <script> | 231 | <script> |
229 | import util from '../../common/js/util' | 232 | import util from '../../common/js/util' |
230 | import NProgress from 'nprogress' | 233 | import NProgress from 'nprogress' |
231 | - import { getUserList, removeUser, batchRemoveUser, editUser, addUser, setUserRole } from '../../api/user'; | 234 | + import { getUserList, removeUser, batchRemoveUser, editUser, addUser, setUserRole,userLock } from '../../api/user'; |
232 | import { getList} from '../../api/role_api'; | 235 | import { getList} from '../../api/role_api'; |
233 | import { getList as getRoleList} from '../../api/role_api'; | 236 | import { getList as getRoleList} from '../../api/role_api'; |
234 | import moment from 'moment' | 237 | import moment from 'moment' |
@@ -340,7 +343,29 @@ | @@ -340,7 +343,29 @@ | ||
340 | }); | 343 | }); |
341 | 344 | ||
342 | }, | 345 | }, |
343 | - | 346 | + // 禁用与启用用户 |
347 | + lockUser: function(index, row, stateCode){ | ||
348 | + this.listLoading = true; | ||
349 | + let para = { | ||
350 | + userId: row.userId, | ||
351 | + username:row.username, | ||
352 | + state: stateCode | ||
353 | + }; | ||
354 | + userLock(para).then((res) => { | ||
355 | + this.$message({ | ||
356 | + message: '操作成功', | ||
357 | + type: 'success' | ||
358 | + }); | ||
359 | + this.getUsers(); | ||
360 | + }).catch((e) => { | ||
361 | + this.$message({ | ||
362 | + message: '操作失败', | ||
363 | + type: 'error' | ||
364 | + }); | ||
365 | + }).finally(()=>{ | ||
366 | + this.listLoading = false; | ||
367 | + }); | ||
368 | + }, | ||
344 | // 获取公司列表 | 369 | // 获取公司列表 |
345 | getCompanyNmae(){ | 370 | getCompanyNmae(){ |
346 | let para = { | 371 | let para = { |
-
请 注册 或 登录 后发表评论