zhuguifei
2025-07-04 186d172fc06dfe44dc2a61d238356e6a7db652d5
common/api.js
@@ -2,12 +2,14 @@
   fly
} from '@/common/request/fly.js'
//配置请求基地址
fly.config.baseURL = "http://192.168.2.6:8800/herb"
const url = uni.getStorageSync('baseurl');
if (url) {
   fly.config.baseURL = url + "/herb"
fly.config.baseURL = "http://lanpucloud.cn/herb"
const ip = uni.getStorageSync('lan_ip');
if (ip) {
   fly.config.baseURL = "http://" + ip + ":9999"
}
const mqttBaseUrl = "lanpucloud.cn";
const emqxBaseUrl = "http://" + mqttBaseUrl + ":1883/api/v5"
// 测试
function test(params) {
@@ -36,7 +38,17 @@
   fly.config.loading = true
   return fly.get('/dry/dryOrder/list', params);
}
//设备列表
function queryEquList(params) {
   fly.config.loading = true
   return fly.get('/mobile/equ/list', params);
}
//仅用作下拉刷新,无实际意义
function querySampleList(params) {
   fly.config.loading = true
   return fly.get('/mobile/sample/list', params);
}
//
function getMonth(params) {
@@ -49,6 +61,32 @@
   return fly.post('/dry/real/sendCommand', params);
}
//历史故障,查询最近数据
function queryHisFaultList(params) {
   fly.config.loading = true
   return fly.get('/mobile/fault/list', params);
}
//历史故障,查询图表需要数据
function queryHisFaultChartList(params) {
   fly.config.loading = true
   return fly.get('/mobile/fault/chart', params);
}
//emqx 接口
function emqxClients() {
   fly.config.loading = true
   return fly.get(emqxBaseUrl + "/clients", {
      auth: {
         username: "a3dc6758f6abc41a",
         password: "FvBwJcmqhAuQ0aBg4FLl5gQA9A9BE64bpl0oJTg9A6I0bK"
      },
      headers: {
         'Content-Type': 'application/json',
      },
   });
}
@@ -58,6 +96,13 @@
   getRealTimeData,
   getAnalyList,
   getOrderList,
   queryEquList,
   querySampleList,
   queryHisFaultList,
   queryHisFaultChartList,
   getMonth,
   sendCommand
   sendCommand,
   emqxClients,
   mqttBaseUrl
}