fix:xiug
Build and Deploy Vue3 / build (push) Successful in 1m6s
Build and Deploy Vue3 / deploy (push) Successful in 56s

This commit is contained in:
2025-10-23 14:10:18 +08:00
parent d0c706f645
commit fca272f8fa
+16 -3
View File
@@ -15,6 +15,7 @@
<div class="actions">
<el-button @click="goBack" :icon="Back">返回</el-button>
<el-button type="primary" @click="refreshData" :icon="Refresh">刷新数据</el-button>
<el-button type="info" @click="clearAllCache" plain>清除缓存</el-button>
</div>
</div>
@@ -99,7 +100,7 @@
<div class="info-content">
<div class="info-item">
<div class="info-label">链接端口号</div>
<div class="info-value">{{ vmInfo.link_port || '10006' }}</div>
<div class="info-value">{{ vmInfo.node_port || (portsList.length > 0 ? portsList[0].node_port : '10006') }}</div>
</div>
<div class="info-item">
<div class="info-label">虚拟机用户名</div>
@@ -825,7 +826,7 @@ const setCachedData = (instanceId, data) => {
console.log(`缓存虚拟机数据: ${instanceId}`, cacheData);
};
const isCacheValid = (cachedData, maxAge = 5 * 60 * 1000) => { // 默认5分钟有效期
const isCacheValid = (cachedData, maxAge = 10 * 60 * 1000) => { // 默认10分钟有效期
if (!cachedData || !cachedData.timestamp) return false;
return (Date.now() - cachedData.timestamp) < maxAge;
};
@@ -1379,12 +1380,17 @@ const fetchVmInfo = async (instanceId = null, useCache = true) => {
const serverRes = await selectServer({server_id:res.data.data.server_id})
const planRes = await selectServerPlan({plan_id:res.data.data.plan_id,server_type:"hyperV"})
const imageRes= await Mirrorinfo({image_id:res.data.data.image_id,server_type:"hyperV"})
// 如果端口列表已加载,获取第一个端口号
const firstPort = portsList.value.length > 0 ? portsList.value[0].node_port : null;
const data = {
...res.data.data,
server_name:serverRes.data.data.name,
server_ip:serverRes.data.data.server_ip,
plan_name:planRes.data.data.name,
image_name:imageRes.data.data.name
image_name:imageRes.data.data.name,
node_port: res.data.data.node_port || firstPort // 优先使用API返回的,否则用端口列表的第一个
}
if (res && res.data && res.data.code === 200) {
vmInfo.value = data || {};
@@ -1554,6 +1560,13 @@ const refreshData = () => {
loadAllData(instanceId, false);
};
// 清除所有缓存
const clearAllCache = () => {
console.log('清除所有虚拟机缓存');
dataCache.value.clear();
ElMessage.success('已清除所有缓存');
};
// 启动虚拟机
const handleStart = async () => {
try {