修改刷新在线用户
This commit is contained in:
parent
0e39672b16
commit
f3d97d5b08
|
|
@ -29,6 +29,8 @@ declare module '@vue/runtime-core' {
|
||||||
ElDialog: typeof import('element-plus/es')['ElDialog']
|
ElDialog: typeof import('element-plus/es')['ElDialog']
|
||||||
ElDivider: typeof import('element-plus/es')['ElDivider']
|
ElDivider: typeof import('element-plus/es')['ElDivider']
|
||||||
ElDropdown: typeof import('element-plus/es')['ElDropdown']
|
ElDropdown: typeof import('element-plus/es')['ElDropdown']
|
||||||
|
ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem']
|
||||||
|
ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu']
|
||||||
ElEmpty: typeof import('element-plus/es')['ElEmpty']
|
ElEmpty: typeof import('element-plus/es')['ElEmpty']
|
||||||
ElForm: typeof import('element-plus/es')['ElForm']
|
ElForm: typeof import('element-plus/es')['ElForm']
|
||||||
ElFormItem: typeof import('element-plus/es')['ElFormItem']
|
ElFormItem: typeof import('element-plus/es')['ElFormItem']
|
||||||
|
|
@ -37,6 +39,8 @@ declare module '@vue/runtime-core' {
|
||||||
ElInput: typeof import('element-plus/es')['ElInput']
|
ElInput: typeof import('element-plus/es')['ElInput']
|
||||||
ElInputNumber: typeof import('element-plus/es')['ElInputNumber']
|
ElInputNumber: typeof import('element-plus/es')['ElInputNumber']
|
||||||
ElLink: typeof import('element-plus/es')['ElLink']
|
ElLink: typeof import('element-plus/es')['ElLink']
|
||||||
|
ElMenu: typeof import('element-plus/es')['ElMenu']
|
||||||
|
ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
|
||||||
ElOption: typeof import('element-plus/es')['ElOption']
|
ElOption: typeof import('element-plus/es')['ElOption']
|
||||||
ElPagination: typeof import('element-plus/es')['ElPagination']
|
ElPagination: typeof import('element-plus/es')['ElPagination']
|
||||||
ElProgress: typeof import('element-plus/es')['ElProgress']
|
ElProgress: typeof import('element-plus/es')['ElProgress']
|
||||||
|
|
@ -53,6 +57,7 @@ declare module '@vue/runtime-core' {
|
||||||
ElStatistic: typeof import('element-plus/es')['ElStatistic']
|
ElStatistic: typeof import('element-plus/es')['ElStatistic']
|
||||||
ElStep: typeof import('element-plus/es')['ElStep']
|
ElStep: typeof import('element-plus/es')['ElStep']
|
||||||
ElSteps: typeof import('element-plus/es')['ElSteps']
|
ElSteps: typeof import('element-plus/es')['ElSteps']
|
||||||
|
ElSubMenu: typeof import('element-plus/es')['ElSubMenu']
|
||||||
ElSwitch: typeof import('element-plus/es')['ElSwitch']
|
ElSwitch: typeof import('element-plus/es')['ElSwitch']
|
||||||
ElTable: typeof import('element-plus/es')['ElTable']
|
ElTable: typeof import('element-plus/es')['ElTable']
|
||||||
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
|
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,6 @@
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
v-loading="loading"
|
v-loading="loading"
|
||||||
stripe
|
stripe
|
||||||
border
|
|
||||||
>
|
>
|
||||||
<el-table-column prop="id" label="密钥ID" width="120" />
|
<el-table-column prop="id" label="密钥ID" width="120" />
|
||||||
<el-table-column prop="user_name" label="用户名" width="120" />
|
<el-table-column prop="user_name" label="用户名" width="120" />
|
||||||
|
|
@ -224,6 +223,30 @@ const getOnlineUsers = async (serverId: string) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getOnlineUsers2 = async (serverId: string) => {
|
||||||
|
if (!serverId) return;
|
||||||
|
|
||||||
|
//loading.value = true;
|
||||||
|
try {
|
||||||
|
const response = await GetServerOnlineUsers(serverId);
|
||||||
|
if (response["code"] === 0) {
|
||||||
|
if(response.data){
|
||||||
|
onlineUsers.value = response.data;
|
||||||
|
}else{
|
||||||
|
onlineUsers.value = [];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ElMessage.error(response["message"]);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取在线用户失败:', error);
|
||||||
|
ElMessage.error('获取在线用户失败');
|
||||||
|
onlineUsers.value = [];
|
||||||
|
} finally {
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// 刷新在线用户
|
// 刷新在线用户
|
||||||
const refreshOnlineUsers = () => {
|
const refreshOnlineUsers = () => {
|
||||||
if (selectedServer.value) {
|
if (selectedServer.value) {
|
||||||
|
|
@ -261,9 +284,9 @@ const startOnlineStatusTimer = () => {
|
||||||
}, 10000);
|
}, 10000);
|
||||||
timer2 = window.setInterval(() => {
|
timer2 = window.setInterval(() => {
|
||||||
if (selectedServer.value){
|
if (selectedServer.value){
|
||||||
GetServerOnlineUsers(selectedServer.value.server_id);
|
getOnlineUsers2(selectedServer.value.server_id);
|
||||||
}
|
}
|
||||||
}, 2000);
|
}, 3000);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 停止定时查询
|
// 停止定时查询
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue