670增加跳转至地图,修改mqtt.js,使用request中的环境配置

This commit is contained in:
liub
2025-09-24 10:18:31 +08:00
parent ab696c3076
commit 8a54aa85d1
6 changed files with 67 additions and 16 deletions

View File

@ -5,6 +5,9 @@ export const showLoading = (ev,options) => {
if(!ev){
return;
}
if(!ev.$refs.loading){
return;
}
let defaultTxt="请稍候...";
if(!options){
options={text:defaultTxt};
@ -23,6 +26,9 @@ export const hideLoading = (ev) => {
if(!ev){
return;
}
if(!ev.$refs.loading){
return;
}
ev.$refs.loading.hide();
@ -34,6 +40,9 @@ export const updateLoading = (ev,options) => {
if(!ev){
return;
}
if(!ev.$refs.loading){
return;
}
if(!options){
options={a:1};
}

View File

@ -117,8 +117,9 @@
*/
import Paho from 'paho-mqtt';
import allConfigs from '../config/index.js';
import {env} from '@/utils/request.js'
// 根据环境选择正确的配置
const env = 'production'; //production development
// const env = 'development'; //production development
const envConfig = allConfigs[env];
const mqttProtocol = env === 'production' ? 'wss' : 'ws';
const useSSL = env === 'production';
@ -214,7 +215,7 @@ class MqttClient {
}
},
onFailure: (message) => {
console.error('MQTT连接失败:', message.errorMessage);
console.error('MQTT连接失败:', message);
if (!this.manualDisconnect) {
this.startReconnecting();
}

View File

@ -1,5 +1,5 @@
import config from '../config/index.js';
const env = 'development'; //production development //开发of线上 改这里就行
export const env = 'development'; //production development //开发of线上 改这里就行
const BASE = config[env];
const request = (options) => {
console.log("options"+JSON.stringify(options),BASE.BASE_URL)
@ -46,7 +46,7 @@ const request = (options) => {
});
};
// 导出基础URL以便其他地方使用
export const baseURL = BASE.BASE_URL
export const getToken = () => uni.getStorageSync('token') // 获取token的方法
export const baseURL = BASE.BASE_URL;
export const getToken = () => uni.getStorageSync('token'); // 获取token的方法
export const clientid =() => uni.getStorageSync('clientID');
export default request;
export default request;