⚡ 修改变量规范.
This commit is contained in:
@@ -1,38 +1,74 @@
|
|||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
export interface MessageRecord {
|
/**
|
||||||
|
* 系统消息查询请求
|
||||||
|
*/
|
||||||
|
export interface MessageQueryRequest {
|
||||||
|
limit?: number;
|
||||||
|
maxId?: number;
|
||||||
|
classify?: string;
|
||||||
|
queryUnread?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统消息查询响应
|
||||||
|
*/
|
||||||
|
export interface MessageRecordResponse {
|
||||||
id: number;
|
id: number;
|
||||||
|
classify: string;
|
||||||
type: string;
|
type: string;
|
||||||
|
status: number;
|
||||||
|
relKey: string;
|
||||||
title: string;
|
title: string;
|
||||||
subTitle: string;
|
|
||||||
avatar?: string;
|
|
||||||
content: string;
|
content: string;
|
||||||
time: string;
|
createTime: number;
|
||||||
status: 0 | 1;
|
|
||||||
messageType?: number;
|
|
||||||
}
|
|
||||||
export type MessageListType = MessageRecord[];
|
|
||||||
|
|
||||||
export function queryMessageList() {
|
|
||||||
return axios.post<MessageListType>('/api/message/list');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface MessageStatus {
|
/**
|
||||||
ids: number[];
|
* 查询系统消息列表
|
||||||
|
*/
|
||||||
|
export function getMessageList(request: MessageQueryRequest) {
|
||||||
|
return axios.post<Array<MessageRecordResponse>>('/infra/system-message/list', request);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setMessageStatus(data: MessageStatus) {
|
/**
|
||||||
return axios.post<MessageListType>('/api/message/read', data);
|
* 查询系统消息数量
|
||||||
|
*/
|
||||||
|
export function getMessageCount(queryUnread: boolean) {
|
||||||
|
return axios.get<Record<string, number>>('/infra/system-message/count', { params: { queryUnread } });
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ChatRecord {
|
/**
|
||||||
id: number;
|
* 查询是否有未读消息
|
||||||
username: string;
|
*/
|
||||||
content: string;
|
export function checkHasUnreadMessage() {
|
||||||
time: string;
|
return axios.get<boolean>('/infra/system-message/has-unread');
|
||||||
isCollect: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function queryChatList() {
|
/**
|
||||||
return axios.post<ChatRecord[]>('/api/chat/list');
|
* 更新系统消息为已读
|
||||||
|
*/
|
||||||
|
export function updateMessageRead(id: number) {
|
||||||
|
return axios.put('/infra/system-message/read', undefined, { params: { id } });
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新全部系统消息为已读
|
||||||
|
*/
|
||||||
|
export function updateMessageReadAll(classify: string) {
|
||||||
|
return axios.put('/infra/system-message/read-all', undefined, { params: { classify } });
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除系统消息
|
||||||
|
*/
|
||||||
|
export function deleteMessage(id: number) {
|
||||||
|
return axios.delete('/infra/system-message/delete', { params: { id } });
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清理已读的系统消息
|
||||||
|
*/
|
||||||
|
export function clearMessage(classify: string) {
|
||||||
|
return axios.delete('/infra/system-message/clear', { params: { classify } });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
|
|
||||||
const logViewRef = ref();
|
const logViewRef = ref();
|
||||||
const currentHostExecId = ref();
|
const currentHostExecId = ref();
|
||||||
const statusIntervalId = ref();
|
const pullIntervalId = ref();
|
||||||
const execLog = ref<ExecLogQueryResponse>();
|
const execLog = ref<ExecLogQueryResponse>();
|
||||||
const appender = ref<ILogAppender>();
|
const appender = ref<ILogAppender>();
|
||||||
|
|
||||||
@@ -57,9 +57,9 @@
|
|||||||
if (record.status === execStatus.WAITING ||
|
if (record.status === execStatus.WAITING ||
|
||||||
record.status === execStatus.RUNNING) {
|
record.status === execStatus.RUNNING) {
|
||||||
// 等待一秒后先查询一下状态
|
// 等待一秒后先查询一下状态
|
||||||
setTimeout(fetchTaskStatus, 1000);
|
setTimeout(pullExecStatus, 1000);
|
||||||
// 注册状态轮询
|
// 注册状态轮询
|
||||||
statusIntervalId.value = setInterval(fetchTaskStatus, 5000);
|
pullIntervalId.value = setInterval(pullExecStatus, 5000);
|
||||||
}
|
}
|
||||||
// 打开日志
|
// 打开日志
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
@@ -68,7 +68,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 加载状态
|
// 加载状态
|
||||||
const fetchTaskStatus = async () => {
|
const pullExecStatus = async () => {
|
||||||
if (!execLog.value) {
|
if (!execLog.value) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -150,7 +150,7 @@
|
|||||||
// 清理轮询
|
// 清理轮询
|
||||||
const clearAllInterval = () => {
|
const clearAllInterval = () => {
|
||||||
// 关闭状态轮询
|
// 关闭状态轮询
|
||||||
clearInterval(statusIntervalId.value);
|
clearInterval(pullIntervalId.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 加载字典值
|
// 加载字典值
|
||||||
|
|||||||
@@ -7,12 +7,12 @@ export default ({ mock, setup }: { mock?: boolean; setup: () => void }) => {
|
|||||||
export const successResponseWrap = (data: unknown) => {
|
export const successResponseWrap = (data: unknown) => {
|
||||||
return {
|
return {
|
||||||
data,
|
data,
|
||||||
msg: '请求成功',
|
msg: 'success',
|
||||||
code: 200,
|
code: 200,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export const failResponseWrap = (data: unknown, msg: string, code = 5000) => {
|
export const failResponseWrap = (data: unknown, msg: string, code = 500) => {
|
||||||
return {
|
return {
|
||||||
data,
|
data,
|
||||||
msg,
|
msg,
|
||||||
|
|||||||
@@ -7,99 +7,18 @@ import setupMock, { successResponseWrap } from '@/utils/setup-mock';
|
|||||||
const textList = [
|
const textList = [
|
||||||
{
|
{
|
||||||
key: 1,
|
key: 1,
|
||||||
clickNumber: '346.3w+',
|
clickNumber: '1w+',
|
||||||
title: '经济日报:财政政策要精准提升…',
|
title: 'text...',
|
||||||
increases: 35,
|
increases: 35,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 2,
|
key: 2,
|
||||||
clickNumber: '324.2w+',
|
clickNumber: '2w+',
|
||||||
title: '双12遇冷,消费者厌倦了电商平…',
|
title: 'text...',
|
||||||
increases: 22,
|
increases: 22,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
key: 3,
|
|
||||||
clickNumber: '318.9w+',
|
|
||||||
title: '致敬坚守战“疫”一线的社区工作…',
|
|
||||||
increases: 9,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 4,
|
|
||||||
clickNumber: '257.9w+',
|
|
||||||
title: '普高还是职高?家长们陷入选择…',
|
|
||||||
increases: 17,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 5,
|
|
||||||
clickNumber: '124.2w+',
|
|
||||||
title: '人民快评:没想到“浓眉大眼”的…',
|
|
||||||
increases: 37,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
const imageList = [
|
|
||||||
{
|
|
||||||
key: 1,
|
|
||||||
clickNumber: '15.3w+',
|
|
||||||
title: '杨涛接替陆慷出任外交部美大司…',
|
|
||||||
increases: 15,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 2,
|
|
||||||
clickNumber: '12.2w+',
|
|
||||||
title: '图集:龙卷风袭击美国多州房屋…',
|
|
||||||
increases: 26,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 3,
|
|
||||||
clickNumber: '18.9w+',
|
|
||||||
title: '52岁大姐贴钱照顾自闭症儿童八…',
|
|
||||||
increases: 9,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 4,
|
|
||||||
clickNumber: '7.9w+',
|
|
||||||
title: '杭州一家三口公园宿营取暖中毒',
|
|
||||||
increases: 0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 5,
|
|
||||||
clickNumber: '5.2w+',
|
|
||||||
title: '派出所副所长威胁市民?警方调…',
|
|
||||||
increases: 4,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
const videoList = [
|
|
||||||
{
|
|
||||||
key: 1,
|
|
||||||
clickNumber: '367.6w+',
|
|
||||||
title: '这是今日10点的南京',
|
|
||||||
increases: 5,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 2,
|
|
||||||
clickNumber: '352.2w+',
|
|
||||||
title: '立陶宛不断挑衅致经济受损民众…',
|
|
||||||
increases: 17,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 3,
|
|
||||||
clickNumber: '348.9w+',
|
|
||||||
title: '韩国艺人刘在石确诊新冠',
|
|
||||||
increases: 30,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 4,
|
|
||||||
clickNumber: '346.3w+',
|
|
||||||
title: '关于北京冬奥会,文在寅表态',
|
|
||||||
increases: 12,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 5,
|
|
||||||
clickNumber: '271.2w+',
|
|
||||||
title: '95后现役军人荣立一等功',
|
|
||||||
increases: 2,
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
|
|
||||||
setupMock({
|
setupMock({
|
||||||
setup() {
|
setup() {
|
||||||
Mock.mock(new RegExp('/api/content-data'), () => {
|
Mock.mock(new RegExp('/api/content-data'), () => {
|
||||||
@@ -117,13 +36,11 @@ setupMock({
|
|||||||
});
|
});
|
||||||
Mock.mock(new RegExp('/api/popular/list'), (params: GetParams) => {
|
Mock.mock(new RegExp('/api/popular/list'), (params: GetParams) => {
|
||||||
const { type = 'text' } = qs.parseUrl(params.url).query;
|
const { type = 'text' } = qs.parseUrl(params.url).query;
|
||||||
if (type === 'image') {
|
if (type === 'text') {
|
||||||
return successResponseWrap([...videoList]);
|
return successResponseWrap([...textList]);
|
||||||
|
} else {
|
||||||
|
return successResponseWrap([]);
|
||||||
}
|
}
|
||||||
if (type === 'video') {
|
|
||||||
return successResponseWrap([...imageList]);
|
|
||||||
}
|
|
||||||
return successResponseWrap([...textList]);
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -76,7 +76,7 @@
|
|||||||
|
|
||||||
const { loading, setLoading } = useLoading();
|
const { loading, setLoading } = useLoading();
|
||||||
|
|
||||||
const pullStatusId = ref();
|
const pullIntervalId = ref();
|
||||||
const taskId = ref();
|
const taskId = ref();
|
||||||
const task = ref<UploadTaskQueryResponse>({} as UploadTaskQueryResponse);
|
const task = ref<UploadTaskQueryResponse>({} as UploadTaskQueryResponse);
|
||||||
const selectedHost = ref();
|
const selectedHost = ref();
|
||||||
@@ -266,12 +266,12 @@
|
|||||||
|
|
||||||
// 设置轮询状态
|
// 设置轮询状态
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
pullStatusId.value = setInterval(pullTaskStatus, 5000);
|
pullIntervalId.value = setInterval(pullTaskStatus, 5000);
|
||||||
});
|
});
|
||||||
|
|
||||||
// 卸载状态查询
|
// 卸载状态查询
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
clearInterval(pullStatusId.value);
|
clearInterval(pullIntervalId.value);
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -236,7 +236,7 @@
|
|||||||
const { loading, setLoading } = useLoading();
|
const { loading, setLoading } = useLoading();
|
||||||
const { toOptions, getDictValue } = useDictStore();
|
const { toOptions, getDictValue } = useDictStore();
|
||||||
|
|
||||||
const intervalId = ref();
|
const pullIntervalId = ref();
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
const selectedKeys = ref<number[]>([]);
|
const selectedKeys = ref<number[]>([]);
|
||||||
const tableRenderData = ref<ExecLogQueryResponse[]>([]);
|
const tableRenderData = ref<ExecLogQueryResponse[]>([]);
|
||||||
@@ -343,7 +343,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 加载状态
|
// 加载状态
|
||||||
const fetchTaskStatus = async () => {
|
const pullExecStatus = async () => {
|
||||||
const unCompleteIdList = tableRenderData.value
|
const unCompleteIdList = tableRenderData.value
|
||||||
.filter(s => s.status === execStatus.WAITING || s.status === execStatus.RUNNING)
|
.filter(s => s.status === execStatus.WAITING || s.status === execStatus.RUNNING)
|
||||||
.map(s => s.id);
|
.map(s => s.id);
|
||||||
@@ -409,12 +409,12 @@
|
|||||||
// 加载数据
|
// 加载数据
|
||||||
fetchTableData();
|
fetchTableData();
|
||||||
// 注册状态轮询
|
// 注册状态轮询
|
||||||
intervalId.value = setInterval(fetchTaskStatus, 10000);
|
pullIntervalId.value = setInterval(pullExecStatus, 10000);
|
||||||
});
|
});
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
// 卸载状态轮询
|
// 卸载状态轮询
|
||||||
clearInterval(intervalId.value);
|
clearInterval(pullIntervalId.value);
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -199,7 +199,7 @@
|
|||||||
const { loading, setLoading } = useLoading();
|
const { loading, setLoading } = useLoading();
|
||||||
const { toOptions, getDictValue } = useDictStore();
|
const { toOptions, getDictValue } = useDictStore();
|
||||||
|
|
||||||
const intervalId = ref();
|
const pullIntervalId = ref();
|
||||||
const selectedKeys = ref<number[]>([]);
|
const selectedKeys = ref<number[]>([]);
|
||||||
const tableRenderData = ref<UploadTaskQueryResponse[]>([]);
|
const tableRenderData = ref<UploadTaskQueryResponse[]>([]);
|
||||||
const formModel = reactive<UploadTaskQueryRequest>({
|
const formModel = reactive<UploadTaskQueryRequest>({
|
||||||
@@ -264,7 +264,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 加载状态
|
// 加载状态
|
||||||
const fetchTaskStatus = async () => {
|
const pullTaskStatus = async () => {
|
||||||
const unCompleteIdList = tableRenderData.value
|
const unCompleteIdList = tableRenderData.value
|
||||||
.filter(s => s.status === UploadTaskStatus.WAITING || s.status === UploadTaskStatus.UPLOADING)
|
.filter(s => s.status === UploadTaskStatus.WAITING || s.status === UploadTaskStatus.UPLOADING)
|
||||||
.map(s => s.id);
|
.map(s => s.id);
|
||||||
@@ -311,12 +311,12 @@
|
|||||||
// 加载数据
|
// 加载数据
|
||||||
fetchTableData();
|
fetchTableData();
|
||||||
// 注册状态轮询
|
// 注册状态轮询
|
||||||
intervalId.value = setInterval(fetchTaskStatus, 10000);
|
pullIntervalId.value = setInterval(pullTaskStatus, 10000);
|
||||||
});
|
});
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
// 卸载状态轮询
|
// 卸载状态轮询
|
||||||
clearInterval(intervalId.value);
|
clearInterval(pullIntervalId.value);
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ export default class SftpTransferManager implements ISftpTransferManager {
|
|||||||
|
|
||||||
private run: boolean;
|
private run: boolean;
|
||||||
|
|
||||||
private progressId?: number;
|
private progressIntervalId?: number;
|
||||||
|
|
||||||
private currentItem?: SftpTransferItem;
|
private currentItem?: SftpTransferItem;
|
||||||
|
|
||||||
@@ -136,7 +136,7 @@ export default class SftpTransferManager implements ISftpTransferManager {
|
|||||||
// 处理消息
|
// 处理消息
|
||||||
this.client.onmessage = this.resolveMessage.bind(this);
|
this.client.onmessage = this.resolveMessage.bind(this);
|
||||||
// 计算传输进度
|
// 计算传输进度
|
||||||
this.progressId = setInterval(this.calcProgress.bind(this), 500);
|
this.progressIntervalId = setInterval(this.calcProgress.bind(this), 500);
|
||||||
// 打开后自动传输下一个任务
|
// 打开后自动传输下一个任务
|
||||||
this.transferNextItem();
|
this.transferNextItem();
|
||||||
}
|
}
|
||||||
@@ -275,7 +275,7 @@ export default class SftpTransferManager implements ISftpTransferManager {
|
|||||||
// 重置 run
|
// 重置 run
|
||||||
this.run = false;
|
this.run = false;
|
||||||
// 关闭传输进度
|
// 关闭传输进度
|
||||||
clearInterval(this.progressId);
|
clearInterval(this.progressIntervalId);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export default class TerminalSessionManager implements ITerminalSessionManager {
|
|||||||
|
|
||||||
private sessions: Record<string, ITerminalSession>;
|
private sessions: Record<string, ITerminalSession>;
|
||||||
|
|
||||||
private keepAliveTask?: any;
|
private keepAliveTaskId?: any;
|
||||||
|
|
||||||
private readonly dispatchResizeFn: () => {};
|
private readonly dispatchResizeFn: () => {};
|
||||||
|
|
||||||
@@ -136,7 +136,7 @@ export default class TerminalSessionManager implements ITerminalSessionManager {
|
|||||||
// 注册 resize 事件
|
// 注册 resize 事件
|
||||||
addEventListen(window, 'resize', this.dispatchResizeFn);
|
addEventListen(window, 'resize', this.dispatchResizeFn);
|
||||||
// 注册 ping 事件
|
// 注册 ping 事件
|
||||||
this.keepAliveTask = setInterval(() => {
|
this.keepAliveTaskId = setInterval(() => {
|
||||||
this.channel.send(InputProtocol.PING, {});
|
this.channel.send(InputProtocol.PING, {});
|
||||||
}, 15000);
|
}, 15000);
|
||||||
}
|
}
|
||||||
@@ -158,10 +158,7 @@ export default class TerminalSessionManager implements ITerminalSessionManager {
|
|||||||
// 关闭 channel
|
// 关闭 channel
|
||||||
this.channel.close();
|
this.channel.close();
|
||||||
// 清除 ping 事件
|
// 清除 ping 事件
|
||||||
if (this.keepAliveTask) {
|
clearInterval(this.keepAliveTaskId);
|
||||||
clearInterval(this.keepAliveTask);
|
|
||||||
this.keepAliveTask = undefined;
|
|
||||||
}
|
|
||||||
// 移除 resize 事件
|
// 移除 resize 事件
|
||||||
removeEventListen(window, 'resize', this.dispatchResizeFn);
|
removeEventListen(window, 'resize', this.dispatchResizeFn);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@@ -217,7 +217,7 @@
|
|||||||
const { loading, setLoading } = useLoading();
|
const { loading, setLoading } = useLoading();
|
||||||
const { toOptions, getDictValue } = useDictStore();
|
const { toOptions, getDictValue } = useDictStore();
|
||||||
|
|
||||||
const intervalId = ref();
|
const pullIntervalId = ref();
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
const selectedKeys = ref<number[]>([]);
|
const selectedKeys = ref<number[]>([]);
|
||||||
const tableRenderData = ref<ExecLogQueryResponse[]>([]);
|
const tableRenderData = ref<ExecLogQueryResponse[]>([]);
|
||||||
@@ -308,7 +308,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 加载状态
|
// 加载状态
|
||||||
const fetchTaskStatus = async () => {
|
const pullJobStatus = async () => {
|
||||||
const unCompleteIdList = tableRenderData.value
|
const unCompleteIdList = tableRenderData.value
|
||||||
.filter(s => s.status === execStatus.WAITING || s.status === execStatus.RUNNING)
|
.filter(s => s.status === execStatus.WAITING || s.status === execStatus.RUNNING)
|
||||||
.map(s => s.id);
|
.map(s => s.id);
|
||||||
@@ -374,12 +374,12 @@
|
|||||||
// 加载数据
|
// 加载数据
|
||||||
fetchTableData();
|
fetchTableData();
|
||||||
// 注册状态轮询
|
// 注册状态轮询
|
||||||
intervalId.value = setInterval(fetchTaskStatus, 10000);
|
pullIntervalId.value = setInterval(pullJobStatus, 10000);
|
||||||
});
|
});
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
// 卸载状态轮询
|
// 卸载状态轮询
|
||||||
clearInterval(intervalId.value);
|
clearInterval(pullIntervalId.value);
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user