|
@@ -45,11 +45,13 @@ class MqttService {
|
|
|
|
|
|
// 连接 DATA
|
|
// 连接 DATA
|
|
connectData(userId) {
|
|
connectData(userId) {
|
|
|
|
+
|
|
uni.showToast({
|
|
uni.showToast({
|
|
- title: "mqtt连接中...",
|
|
|
|
- icon: "none",
|
|
|
|
- duration: 1500,
|
|
|
|
|
|
+ title: "正在连接平台中...",
|
|
|
|
+ icon: "loading",
|
|
|
|
+ duration: 2000, //持续的时间
|
|
});
|
|
});
|
|
|
|
+
|
|
if (this.dataConnected && this.dataClient) {
|
|
if (this.dataConnected && this.dataClient) {
|
|
uni.hideToast()
|
|
uni.hideToast()
|
|
console.log("DATA MQTT 已连接,复用现有实例");
|
|
console.log("DATA MQTT 已连接,复用现有实例");
|
|
@@ -125,7 +127,7 @@ class MqttService {
|
|
client.on('error', (err) => {
|
|
client.on('error', (err) => {
|
|
uni.showModal({
|
|
uni.showModal({
|
|
title: '提示',
|
|
title: '提示',
|
|
- content: 'mqtt连接失败,请重新登录',
|
|
|
|
|
|
+ content: '连接平台失败,请重新登录',
|
|
showCancel: false,
|
|
showCancel: false,
|
|
success: (res) => {
|
|
success: (res) => {
|
|
if (res.confirm) {
|
|
if (res.confirm) {
|
|
@@ -135,10 +137,7 @@ class MqttService {
|
|
})
|
|
})
|
|
}
|
|
}
|
|
if (res.cancel) {
|
|
if (res.cancel) {
|
|
- uni.clearStorageSync();
|
|
|
|
- uni.reLaunch({
|
|
|
|
- url: "/pagesA/loginNew/loginNew"
|
|
|
|
- })
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|
|
})
|