Flex ant out of memory error.

本文介绍了一个具体的Ant构建文件(build.xml)配置案例。该案例展示了如何设置项目的根目录、默认目标、名称等基本属性,并包含了Flex编译任务、国际化资源定位、服务配置文件指定等高级配置。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

  在build.xml里面加入:
  
  
  就好了。 project basedir="." default="main" name="myapp"> flex" /> en_US fr_BE src src/locale/{locale} true src/services-config.xml width="100%" application="app" swf="index" version-major="9" version-minor="0" version-revision="0" history="true" template="client-side-detection" output="${output.dir}" />
<template> <a-card title="环境管理"> <a-spin size="large" v-if="envLoading" class="spin"/> <div v-else> <a-row :gutter="[48,32]" type="flex" justify="center" style="margin-bottom: 38px"> <a-col :span="8" v-for="(env, index) in environments" :key="index"> <a-card :title="env.envName" class="env-card hover-env-card"> <template #extra> <a-button type="primary" @click="openOperateDrawer(env.envName)">操作</a-button> </template> <svg t="1750909569074" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6580" width="128" height="128"> <path :fill="env.status === '在线' ? '#005bac' : '#bfbfbf'" d="M180.532703 507.367493c158.678976-65.355497 235.486292-30.474059 304.269865 16.21838l-79.440283 273.0447c-69.018933-46.431495-144.083559-84.635609-303.396985-18.776645l77.643358-270.088368L180.532703 507.367493zM526.399965 549.988196c68.989257 46.397726 139.539057 80.43903 301.656341 24.985044l-75.661214 263.243473c-159.14151 65.832358-235.541551 28.585035-304.439734-18.128893L526.399965 549.988196zM498.022661 474.363821c-41.512463-27.970028-86.198198-54.113455-149.667741-54.582129-41.86448-0.322341-91.709725 11.587919-155.011446 37.731346l78.410837-271.752264c159.198815-65.822125 235.701187-28.520567 304.673048 18.128893L498.022661 474.363821zM922.033677 249.996774c-158.988014 65.700351-235.394195 28.753881-304.214606-17.613146l-78.428234 271.986601c68.7672 46.62797 151.876036 84.896552 304.315914 16.685008L922.033677 249.996774z" p-id="6581"></path> </svg> <a-descriptions :column="1" :bordered="true" size="small"> <a-descriptions-item label="状态"> <span v-if="env.status === '在线'">🟢在线</span> <span v-else-if="env.status === '离线'">⚪离线</span> </a-descriptions-item> <a-descriptions-item label="Python版本"> {{ env.pythonVersion }} </a-descriptions-item> <a-descriptions-item label="物理内存总量"> {{ env.totalMemory }} MB </a-descriptions-item> <a-descriptions-item label="可用的物理内存"> {{ env.availableMemory }} MB </a-descriptions-item> <a-descriptions-item label="执行主机"> <span v-for="(host, hostIndex) in env.executeHosts" :key="hostIndex"> {{ host }} <br v-if="hostIndex !== env.executeHosts.length - 1"/> </span> </a-descriptions-item> </a-descriptions> </a-card> </a-col> </a-row> </div> <EnvInstallDrawer ref="EnvInstallDrawer"/> </a-card> </template> <script> import axios from "axios"; import EnvInstallDrawer from "@/vela/win/env/component/envInstallDrawer"; export default { name: "env", components: {EnvInstallDrawer}, data() { return { envLoading: false, installVisible: false, uninstallVisible: false, environments: [], } }, mounted() { this.querySharedHost(); }, methods: { querySharedHost() { this.envLoading = true; axios.get('/win/gateway/querySharedHost').then(res => { this.environments = res; }).catch(() => { this.$message.error({message: '获取共享主机信息失败,请联系管理员!'}); }).finally(() => { this.envLoading = false; } ) }, openOperateDrawer(envName){ this.$refs.EnvInstallDrawer.visible = true; this.$refs.EnvInstallDrawer.envName = envName; } } } </script> <style scoped lang="less"> .env-card { height: 100%; box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2); .ant-card-head-title:before { height: 20px !important; margin-top: 5px; } .ant-btn-icon-only { font-size: 19px; } } .env-card svg { display: block; margin: 0 auto; } .hover-env-card:hover { box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2); /* 更强的阴影 */ transform: translateY(-3px); /* 上移 */ transition: all 0.2s ease; /* 平滑过渡 */ } ::v-deep .ant-descriptions-item-label { font-size: 16px !important; text-align: center; } ::v-deep .ant-descriptions-item-content { font-size: 16px !important; text-align: center; } .uninstall:hover { background-color: rgba(191, 191, 191, 0.5) !important; } .spin { height: 300px; margin-left: 45%; margin-top: 150px; } </style> <template> <a-drawer title="环境操作" placement="right" :visible="visible" @close="visible = false" width="850px" class="drawer" > <svg t="1751269061412" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="24642" width="128" height="128"> <path d="M924 708h-40.54a142.81 142.81 0 0 0-15.41-37.14l28.69-28.68a36 36 0 0 0 0-50.92 36 36 0 0 0-50.92 0L817.14 620A142.81 142.81 0 0 0 780 604.54V564a36 36 0 0 0-36-36 36 36 0 0 0-36 36v40.54A142.81 142.81 0 0 0 670.86 620l-28.68-28.69a36 36 0 0 0-50.92 0 36 36 0 0 0 0 50.92L620 670.86A142.81 142.81 0 0 0 604.54 708H564a36 36 0 0 0-36 36 36 36 0 0 0 36 36h40.54A142.81 142.81 0 0 0 620 817.14l-28.69 28.68a36 36 0 0 0 0 50.92 36 36 0 0 0 50.91 0l28.68-28.69a142.81 142.81 0 0 0 37.1 15.41V924a36 36 0 0 0 36 36 36 36 0 0 0 36-36v-40.54a142.81 142.81 0 0 0 37.14-15.41l28.68 28.69a36 36 0 0 0 50.92 0 36 36 0 0 0 0-50.92l-28.69-28.68A142.81 142.81 0 0 0 883.46 780H924a36 36 0 0 0 36-36 36 36 0 0 0-36-36zM744 816a72 72 0 1 1 72-72 72 72 0 0 1-72 72z" fill="#005bac" p-id="24643"></path> <path d="M860 64H164c-55 0-100 45-100 100v516c0 55 45 100 100 100h220v108H244a36 36 0 0 0-36 36 36 36 0 0 0 36 36h176a36 36 0 0 0 36-36V744a36 36 0 0 0-36-36H186a50.15 50.15 0 0 1-50-50v-59h284a36 36 0 0 0 36-36 36 36 0 0 0-36-36H136V186a50.15 50.15 0 0 1 50-50h652a50.15 50.15 0 0 1 50 50v234a36 36 0 0 0 36 36 36 36 0 0 0 36-36V164c0-55-45-100-100-100z" fill="#005bac" p-id="24644"></path> </svg> <span class="envName">{{ envName }}</span> <a-card title="操作日志" style="margin-top: 18px"> <pre ref="outputPre"> {{ currentOutput }} </pre> <a-form-model :model="command" layout="vertical"> <a-form-model-item label="命令"> <a-input-group compact style="display: flex; align-items: center"> <a-select placeholder="请选择命令类型" style="width: 23%" v-model="command.select" > <a-select-option value="Python环境安装"> Python环境安装 </a-select-option> <a-select-option value="Python环境卸载"> Python环境卸载 </a-select-option> <a-select-option value="依赖安装"> 依赖安装 </a-select-option> </a-select> <a-input-number :min="0" :step="0.1" v-model="command.input" style="width: 20%" @pressEnter="sendCommand" placeholder="请输入Python版本" v-if="command.select === undefined || command.select === 'Python环境安装'" :disabled="!command.select"/> <a-input-number :min="0" :step="0.1" v-model="command.input" style="width: 30%" @pressEnter="sendCommand" placeholder="请仔细核查再发送卸载命令" v-else-if="command.select === 'Python环境卸载'" disabled/> <a-input style="width: 40%" v-model="command.input" @pressEnter="sendCommand" placeholder="请输入" v-else :disabled="!command.select"/> <a-button type="primary" style="margin-left: 18px" @click="sendCommand" :disabled="!command.select" :loading="isExecuting">发送 </a-button> </a-input-group> </a-form-model-item> </a-form-model> </a-card> </a-drawer> </template> <script> import websocket from "@/config/websocket/websocket"; export default { name: "envInstallDrawer", data() { return { envName: '', // account: this.$store.getters['account/user'], account: { username: 'fangpeiyuan' }, visible: false, currentOutput: '', messages: [], stompClient: null, isExecuting: false, // 控制命令是否正在执行 command: { select: undefined, input: '' } } }, mounted() { this.connectWebSocket(); }, methods: { async connectWebSocket() { try { this.stompClient = await websocket.connect(this.account.username); const subscription = this.stompClient.subscribe(`/topic/outputFromGateway/${this.account.username}`, (message) => { const output = message.body; if (output.startsWith("⏹")) { this.isExecuting = false; // 命令执行结束,允许用户继续输入 return; } this.currentOutput += output.trim() + '\n'; this.$nextTick(() => { if (this.$refs.outputPre) { this.$refs.outputPre.scrollTop = this.$refs.outputPre.scrollHeight; } }); }); this.stompClient.onDisconnect = () => { subscription.unsubscribe(); }; // 检查命令执行状态 await this.checkCommandStatus(); } catch (error) { console.error('WebSocket连接失败:', error); } }, async checkCommandStatus() { try { const response = await fetch(`/win/gateway/checkCommandStatus/${this.account.username}`); if (!response.ok) { console.error('无法获取命令状态'); return; } this.isExecuting = await response.json(); // 更新前端状态 if (this.isExecuting) { this.$message.info({'message':'上个命令仍未执行完,已继续执行上个命令。'}); } } catch (error) { console.error('检查命令状态时出错:', error); } }, sendCommand() { this.command.input = ''; if (this.isExecuting){ this.$message.info({'message':'请等待上个命令执行完毕。'}); return; } this.isExecuting = true; this.messages.push(this.index + '. ' + this.command.input); this.index += 1; this.command.input = ''; if (this.stompClient) { // 删除 currentOutput 的最后一个非空行 if (this.currentOutput) { let lastNewLineIndex = this.currentOutput.lastIndexOf('\n'); let lastNonEmptyIndex = -1; // 从后往前遍历,找到最后一个非空行的起始位置 for (let i = this.currentOutput.length - 1; i >= 0; i--) { if (this.currentOutput[i] === '\n') { // 如果当前字符是换行符,并且之前的字符不是空白字符,则记录位置 if (lastNewLineIndex !== -1 && i < lastNewLineIndex) { lastNonEmptyIndex = lastNewLineIndex; break; } lastNewLineIndex = i; } else if (this.currentOutput[i].trim() !== '') { // 找到非空字符,更新 lastNewLineIndex lastNewLineIndex = i; } } // 如果找到了非空行,则删除它 if (lastNonEmptyIndex !== -1) { const nextNewLineIndex = this.currentOutput.indexOf('\n', lastNonEmptyIndex); if (nextNewLineIndex === -1) { this.currentOutput = this.currentOutput.substring(0, lastNonEmptyIndex); } else { this.currentOutput = this.currentOutput.substring(0, lastNonEmptyIndex) + this.currentOutput.substring(nextNewLineIndex); } } // 删除最后一个空行 if (this.currentOutput.endsWith('\n')) { this.currentOutput = this.currentOutput.substring(0, this.currentOutput.length - 1); } } // 发送命令 this.stompClient.publish({ destination: '/gateway/toExecute', body: JSON.stringify({ select: this.command.select, command: this.command.input, envName: this.envName, userId: this.account.username }), }); } }, async abortCommand() { if (this.stompClient) { const response = await fetch(`/win/gateway/toHandleAbort/${this.account.username}`); if (response) { this.messages.push("已发送中止命令"); } } }, } } </script> <style scoped> .drawer svg { display: block; margin: 8px auto 0; } pre { white-space: pre-line; border: 1px solid #ddd; background: #282c34; color: #fff; padding: 15px; border-radius: 4px; height: calc(450px - 14px); overflow-y: auto; } .envName { font-size: 19px; font-weight: bold; display: flex; justify-content: center; margin-top: 8px } </style> 我想让子组件为isExecuting为true的时候,当前执行的环境的操作按钮可点击,其它的置灰。给我详细的代码,不要省略任何一条
07-02
function SystemStatus({}) { // 模拟初始系统状态数据 const initialStatusData = { uptime: "3天12小时45分钟", currentTime: new Date().toLocaleString(), cpuUsage: "24%", memoryUsage: "512MB / 1GB (51%)", temperature: "56°C", wanStatus: { ipv4: "192.168.1.1", ipv6: "2001:db8::1", connectionTime: "2天8小时30分钟", upload: "1.2 Mbps", download: "15.8 Mbps" }, lanStatus: { clients: 8, ipv4: "192.168.1.1/24", ipv6: "2001:db8::1/64" }, wifiStatus: { clients: 12, frequency: "2.4GHz & 5GHz", channel: "6 & 149" } }; const [status, setStatus] = useState(null); const [refreshTime, setRefreshTime] = useState(new Date()); // 模拟获取系统状态 const refresh = () => { return new Promise(resolve => { setTimeout(() => { setStatus({ ...initialStatusData, currentTime: new Date().toLocaleString() }); setRefreshTime(new Date()); resolve(); }, 300); }); }; useEffect(() => { refresh(); // 设置自动刷新 const interval = setInterval(refresh, 60000); return () => clearInterval(interval); }, []); if (!status) return html`<div class="flex justify-center items-center h-32">加载中...</div>`; return html` <div class="m-4 grid grid-cols-1 gap-4"> <div class="py-1 divide-y border rounded bg-white flex flex-col"> <div class="flex items-center justify-between px-4 py-2"> <div class="font-light uppercase text-gray-600">系统状态</div> <div class="text-xs text-gray-500"> 最后更新: ${refreshTime.toLocaleTimeString()} <button class="ml-2 text-blue-600 hover:text-blue-800" onClick=${refresh} > 刷新 </button> </div> <//> <div class="py-2 px-5 flex-1 flex flex-col"> <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4"> <!-- 系统基本信息 --> <div class="border rounded p-3"> <h3 class="text-sm font-medium text-gray-700 mb-2">系统信息</h3> <div class="space-y-2"> <div class="flex justify-between"> <span class="text-sm text-gray-600">运行时间</span> <span class="text-sm font-medium">${status.uptime}</span> </div> <div class="flex justify-between"> <span class="text-sm text-gray-600">当前时间</span> <span class="text-sm font-medium">${status.currentTime}</span> </div> <div class="flex justify-between"> <span class="text-sm text-gray-600">CPU使用率</span> <span class="text-sm font-medium">${status.cpuUsage}</span> </div> <div class="flex justify-between"> <span class="text-sm text-gray-600">内存使用</span> <span class="text-sm font-medium">${status.memoryUsage}</span> </div> <div class="flex justify-between"> <span class="text-sm text-gray-600">设备温度</span> <span class="text-sm font-medium">${status.temperature}</span> </div> </div> <//> <!-- WAN状态 --> <div class="border rounded p-3"> <h3 class="text-sm font-medium text-gray-700 mb-2">WAN状态</h3> <div class="space-y-2"> <div class="flex justify-between"> <span class="text-sm text-gray-600">IPv4地址</span> <span class="text-sm font-medium">${status.wanStatus.ipv4}</span> </div> <div class="flex justify-between"> <span class="text-sm text-gray-600">IPv6地址</span> <span class="text-sm font-medium font-mono">${status.wanStatus.ipv6}</span> </div> <div class="flex justify-between"> <span class="text-sm text-gray-600">连接时间</span> <span class="text-sm font-medium">${status.wanStatus.connectionTime}</span> </div> <div class="flex justify-between"> <span class="text-sm text-gray-600">上传速度</span> <span class="text-sm font-medium">${status.wanStatus.upload}</span> </div> <div class="flex justify-between"> <span class="text-sm text-gray-600">下载速度</span> <span class="text-sm font-medium">${status.wanStatus.download}</span> </div> </div> <//> <!-- LAN状态 --> <div class="border rounded p-3"> <h3 class="text-sm font-medium text-gray-700 mb-2">LAN状态</h3> <div class="space-y-2"> <div class="flex justify-between"> <span class="text-sm text-gray-600">客户端数量</span> <span class="text-sm font-medium">${status.lanStatus.clients}</span> </div> <div class="flex justify-between"> <span class="text-sm text-gray-600">IPv4网络</span> <span class="text-sm font-medium">${status.lanStatus.ipv4}</span> </div> <div class="flex justify-between"> <span class="text-sm text-gray-600">IPv6网络</span> <span class="text-sm font-medium font-mono">${status.lanStatus.ipv6}</span> </div> </div> <//> <!-- WiFi状态 --> <div class="border rounded p-3"> <h3 class="text-sm font-medium text-gray-700 mb-2">WiFi状态</h3> <div class="space-y-2"> <div class="flex justify-between"> <span class="text-sm text-gray-600">客户端数量</span> <span class="text-sm font-medium">${status.wifiStatus.clients}</span> </div> <div class="flex justify-between"> <span class="text-sm text-gray-600">频段</span> <span class="text-sm font-medium">${status.wifiStatus.frequency}</span> </div> <div class="flex justify-between"> <span class="text-sm text-gray-600">信道</span> <span class="text-sm font-medium">${status.wifiStatus.channel}</span> </div> </div> <//> <!-- 系统资源图表 --> <div class="border rounded p-3 md:col-span-2"> <h3 class="text-sm font-medium text-gray-700 mb-2">资源监控</h3> <div class="grid grid-cols-2 gap-4"> <div> <div class="flex justify-between mb-1"> <span class="text-xs text-gray-600">CPU使用率</span> <span class="text-xs font-medium">${status.cpuUsage}</span> </div> <div class="w-full bg-gray-200 rounded-full h-2"> <div class="bg-blue-600 h-2 rounded-full" style=${{ width: status.cpuUsage }} ></div> </div> </div> <div> <div class="flex justify-between mb-1"> <span class="text-xs text-gray-600">内存使用</span> <span class="text-xs font-medium">${status.memoryUsage.split('(')[1]}</span> </div> <div class="w-full bg-gray-200 rounded-full h-2"> <div class="bg-green-600 h-2 rounded-full" style=${{ width: status.memoryUsage.split('(')[1] }} ></div> </div> </div> </div> <div class="mt-4"> <div class="flex justify-between mb-1"> <span class="text-xs text-gray-600">网络流量</span> <span class="text-xs font-medium">↑${status.wanStatus.upload} ↓${status.wanStatus.download}</span> </div> <div class="flex space-x-2 h-20"> <div class="flex-1 flex flex-col justify-end"> <div class="bg-blue-400 rounded-t" style=${{ height: "30%" }}></div> <div class="bg-blue-300 rounded-t" style=${{ height: "50%" }}></div> <div class="bg-blue-200 rounded-t" style=${{ height: "70%" }}></div> <div class="text-center text-xs text-gray-500 mt-1">上传</div> </div> <div class="flex-1 flex flex-col justify-end"> <div class="bg-green-400 rounded-t" style=${{ height: "60%" }}></div> <div class="bg-green-300 rounded-t" style=${{ height: "80%" }}></div> <div class="bg-green-200 rounded-t" style=${{ height: "40%" }}></div> <div class="text-center text-xs text-gray-500 mt-1">下载</div> </div> </div> </div> <//> </div> <//> <//> <//>`; } 把这个SystemStatus函数的里面的功能改成路由器主页显示,是一个路由器会显示一个路由器图片,然后有上下行的速率,显示WAN口状态:IP地址,子网掩码DNS1 ,DNS2 ;系统状态: 型号 ,主机名,cpu, 内存占用,运行时间;连接状态:在线终端,网络连接数,代码风格和之前一致
07-20
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值