diff --git a/config/index.js b/config/index.js index 931f053..d093640 100644 --- a/config/index.js +++ b/config/index.js @@ -2,11 +2,11 @@ const config = { // 开发环境 development: { - BASE_URL: 'http://192.168.2.34:8000', + BASE_URL: 'http://192.168.110.56:8000', API_PREFIX: '', // MQTT 配置 - MQTT_HOST: 'www.cnxhyc.com', - MQTT_PORT: 9083, + MQTT_HOST: '47.120.79.150', + MQTT_PORT: 8083, MQTT_USERNAME: 'admin', MQTT_PASSWORD: '#YtvpSfCNG' }, @@ -16,7 +16,7 @@ const config = { API_PREFIX: '', // MQTT 配置 MQTT_HOST: 'www.cnxhyc.com', - MQTT_PORT: 9084, + MQTT_PORT: 8083, MQTT_USERNAME: 'admin', MQTT_PASSWORD: '#YtvpSfCNG' } diff --git a/manifest.json b/manifest.json index c56ae2d..8aa5b30 100644 --- a/manifest.json +++ b/manifest.json @@ -21,8 +21,8 @@ "Bluetooth" : {}, "Barcode" : {}, "Camera" : {}, - "OAuth" : {}, - "Geolocation" : {} + "Geolocation" : {}, + "Maps" : {} }, /* 应用发布信息 */ "distribute" : { diff --git a/pages/670/HBY670.vue b/pages/670/HBY670.vue index 3314997..bea2f8f 100644 --- a/pages/670/HBY670.vue +++ b/pages/670/HBY670.vue @@ -39,7 +39,7 @@ 定位信息 - + {{formData.Lon}} @@ -51,7 +51,10 @@ - {{formData.address}} + + + {{formData.address}} @@ -406,7 +409,29 @@ rgb565Data: [], videoHexArray: [], picPath: "", - permissions: [] //权限列表 + permissions: [], //权限列表 + detailData: { + deviceId: null, + deviceName: null, + deviceImei: null, + deviceMac: null, + communicationMode: null, + devicePic: null, + typeName: null, + bluetoothName: null, + deviceStatus: null, + personnelInfo: null, + onlineStatus: null, + longitude: null, + latitude: null, + address: null, + staDetectGrade: null, + staLightGrade: null, + staSOSGrade: null, + staPowerTime: null, + staPowerPercent: null, + staDetectResult: null + } } }, created() { @@ -490,6 +515,21 @@ }, methods: { + gotoMap() { + this.detailData.longitude=this.formData.Lon; + this.detailData.latitude=this.formData.Lat; + uni.navigateTo({ + url: '/pages/common/map/index', + events: { + ack: function(data) {} + }, + success: (res) => { + res.eventChannel.emit('Map', { + data: this.detailData + }); + } + }) + }, getDetail() { var that = this; api.getDetail(this.device.id).then(res => { @@ -497,6 +537,7 @@ if (res && res.code == 200) { res = res.data; let json = res; + this.detailData = json; console.log("res=", res); that.formData.Lon = res.longitude; that.formData.Lat = res.latitude; @@ -1052,7 +1093,7 @@ }); }, sosSetting: function(type) { -debugger; + debugger; if (!this.permissions.includes('42') && this.Status.apiType !== 'listA') { this.showPop({ diff --git a/utils/loading.js b/utils/loading.js index c5625b0..3a30200 100644 --- a/utils/loading.js +++ b/utils/loading.js @@ -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}; } diff --git a/utils/mqtt.js b/utils/mqtt.js index 1fdfafb..b92530b 100644 --- a/utils/mqtt.js +++ b/utils/mqtt.js @@ -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(); } diff --git a/utils/request.js b/utils/request.js index 9bdd4b6..db503ab 100644 --- a/utils/request.js +++ b/utils/request.js @@ -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; \ No newline at end of file +export default request;