26 lines
858 B
JavaScript
26 lines
858 B
JavaScript
// config.js
|
|
const dtConfig = {
|
|
serverAddress: 'http://124.220.32.217:41110/api/database/command',
|
|
// serverAddress: 'http://192.168.0.222:41101/api/database/command',
|
|
mqttIp: '124.220.32.217',
|
|
// mqttIp: '192.168.1.182',
|
|
mqttPort: '8083',
|
|
topBoxTitle: '智能三轴机床数字孪生系统',
|
|
mqttTopic: 'SCADAMain/demo_device_mqtt_tfjj', // 默认值,登录后会被覆盖
|
|
}
|
|
|
|
// 更新 MQTT Topic 的方法
|
|
const updateMqttTopic = (newTopic) => {
|
|
dtConfig.mqttTopic = newTopic
|
|
// 同时更新到 localStorage 以便其他页面使用
|
|
localStorage.setItem('mqttTopic', newTopic)
|
|
console.log('MQTT Topic 已更新:', newTopic)
|
|
}
|
|
|
|
// 确保在全局对象上设置配置
|
|
if (typeof window !== 'undefined') {
|
|
window.dt_Config = dtConfig
|
|
window.updateMqttTopic = updateMqttTopic
|
|
// console.log('全局配置已设置:', dtConfig)
|
|
}
|