Merge branch 'zxrapp' into 'master'
9.26张祥瑞 See merge request cxc/jeecguniapp!41
This commit is contained in:
commit
86c345ae81
2
env/.env.development
vendored
2
env/.env.development
vendored
@ -7,7 +7,7 @@ VITE_SHOW_SOURCEMAP = true
|
|||||||
# 是否启用读取配置文件 min
|
# 是否启用读取配置文件 min
|
||||||
#VITE_WEBAPP = 'D://opt//AppUpdateTest'
|
#VITE_WEBAPP = 'D://opt//AppUpdateTest'
|
||||||
VITE_WEBAPP = ''
|
VITE_WEBAPP = ''
|
||||||
VITE_SERVER_BASEURL = 'http://10.75.166.174:8080/jeecg-boot'
|
VITE_SERVER_BASEURL = 'http://10.75.166.170:8080/jeecg-boot'
|
||||||
#VITE_SERVER_BASEURL = 'https://10.75.166.6/test'
|
#VITE_SERVER_BASEURL = 'https://10.75.166.6/test'
|
||||||
|
|
||||||
#VITE_SERVER_BASEURL = 'https://36.112.48.190/jeecg-boot'
|
#VITE_SERVER_BASEURL = 'https://36.112.48.190/jeecg-boot'
|
||||||
|
|||||||
@ -11,9 +11,27 @@ export function gethomelist(config : object) { // 获取房间信息
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// export function gethomelistforApp(config : object) { // 获取房间信息
|
||||||
|
// return http({
|
||||||
|
// url: '/RoomOperation/RoomOperation/gethomelistforApp',
|
||||||
|
// method: 'GET',
|
||||||
|
// data: config
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
|
||||||
|
//张祥瑞20250925修改为该方法
|
||||||
export function gethomelistforApp(config : object) { // 获取房间信息
|
export function gethomelistforApp(config : object) { // 获取房间信息
|
||||||
return http({
|
return http({
|
||||||
url: '/RoomOperation/RoomOperation/gethomelistforApp',
|
url: '/RoomAPP/RoomAPP/gethomelistforApp',
|
||||||
|
method: 'GET',
|
||||||
|
data: config
|
||||||
|
})
|
||||||
|
}
|
||||||
|
//张祥瑞20250925添加方法,传参为房间表id
|
||||||
|
export function getfjkzbmforfjidApp(config : object) { // 查询开关状态
|
||||||
|
return http({
|
||||||
|
url: mqtturl +
|
||||||
|
"/mqttcontroller/mqttcontroller/getfjkzbmforfjid",
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
data: config
|
data: config
|
||||||
})
|
})
|
||||||
@ -87,9 +105,17 @@ export function listAllRegions(config : object) { // 查询开关状态
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// export function Selecthomelist(config : object) { // 查询开关状态
|
||||||
|
// return http({
|
||||||
|
// url: '/RoomOperation/RoomOperation/Selecthomelist',
|
||||||
|
// method: 'GET',
|
||||||
|
// data: config
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
//张祥瑞,20250925修改为该方法
|
||||||
export function Selecthomelist(config : object) { // 查询开关状态
|
export function Selecthomelist(config : object) { // 查询开关状态
|
||||||
return http({
|
return http({
|
||||||
url: '/RoomOperation/RoomOperation/Selecthomelist',
|
url: '/RoomAPP/RoomAPP/SelecthomelistForApp',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
data: config
|
data: config
|
||||||
})
|
})
|
||||||
|
|||||||
@ -7,7 +7,7 @@ const baseUrl = import.meta.env.VITE_SERVER_BASEURL
|
|||||||
|
|
||||||
class socket {
|
class socket {
|
||||||
constructor() {
|
constructor() {
|
||||||
console.log(77777777777777)
|
// console.log(77777777777777)
|
||||||
this.socketUrl = baseUrl
|
this.socketUrl = baseUrl
|
||||||
this.socketStart = false
|
this.socketStart = false
|
||||||
this.socketType = ''
|
this.socketType = ''
|
||||||
@ -50,7 +50,7 @@ class socket {
|
|||||||
})
|
})
|
||||||
// update-end-author:taoyan date:20220422 for: v2.4.6 的 websocket 服务端,存在性能和安全问题。 #3278
|
// update-end-author:taoyan date:20220422 for: v2.4.6 的 websocket 服务端,存在性能和安全问题。 #3278
|
||||||
uni.onSocketOpen((res) => {
|
uni.onSocketOpen((res) => {
|
||||||
console.log("连接进来了--------53333333333323----")
|
// console.log("连接进来了--------53333333333323----")
|
||||||
this.socketStart = true
|
this.socketStart = true
|
||||||
callback && callback()
|
callback && callback()
|
||||||
console.log('WebSocket连接已打开!')
|
console.log('WebSocket连接已打开!')
|
||||||
@ -85,10 +85,10 @@ class socket {
|
|||||||
socketReceive() {
|
socketReceive() {
|
||||||
const _this = this
|
const _this = this
|
||||||
uni.onSocketMessage(function (res) {
|
uni.onSocketMessage(function (res) {
|
||||||
console.log('APP:--》收到服务器内容:', res)
|
// console.log('APP:--》收到服务器内容:', res)
|
||||||
console.log('连接路径----:', baseUrl)
|
// console.log('连接路径----:', baseUrl)
|
||||||
if (res.data.startsWith('CONNECTED') || res.data.startsWith('MESSAGE') || res.data.startsWith('RECEIPT')) {
|
if (res.data.startsWith('CONNECTED') || res.data.startsWith('MESSAGE') || res.data.startsWith('RECEIPT')) {
|
||||||
console.log('放行----------:', res)
|
// console.log('放行----------:', res)
|
||||||
// 放行 STOMP 协议消息,交给 socketTask.onMessage 处理 by 闵
|
// 放行 STOMP 协议消息,交给 socketTask.onMessage 处理 by 闵
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,7 +39,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!--
|
<!--
|
||||||
<view class="connection-section">
|
<view class="connection-section">
|
||||||
<button v-if="!connected" @click="connectWebSocket" class="connect-btn">
|
<button v-if="!connected" @click="connectWebSocket" class="connect-btn">
|
||||||
连接WebSocket
|
连接WebSocket
|
||||||
@ -84,7 +84,8 @@
|
|||||||
getMqttPushClient,
|
getMqttPushClient,
|
||||||
treeChildList,
|
treeChildList,
|
||||||
listAllRegions,
|
listAllRegions,
|
||||||
Selecthomelist
|
Selecthomelist,
|
||||||
|
getfjkzbmforfjidApp
|
||||||
} from '@/api/devicecontrol/officedevice';
|
} from '@/api/devicecontrol/officedevice';
|
||||||
// import socketforleader from '@/common/socketforleader'
|
// import socketforleader from '@/common/socketforleader'
|
||||||
|
|
||||||
@ -176,6 +177,21 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 房间信息订阅
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
const getfjkzbmforfjid = () => {
|
||||||
|
//查询开关状态
|
||||||
|
for (const item of filteredFloors.value) {
|
||||||
|
console.log("00000000000--------------",item)
|
||||||
|
getfjkzbmforfjidApp({fjbid:item.id}).then((res) => {
|
||||||
|
console.log("订阅成功--------------",res)
|
||||||
|
}).catch((err) => {
|
||||||
|
console.log("订阅失败:"+item.fjh+"。失败信息:"+err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
const getfjkzbm = async (item) => {
|
const getfjkzbm = async (item) => {
|
||||||
// console.log("5555----------",item.id)
|
// console.log("5555----------",item.id)
|
||||||
let fjkzbm = {};
|
let fjkzbm = {};
|
||||||
@ -288,7 +304,9 @@
|
|||||||
filteredFloors.value = groupByFloor(selectBydata)
|
filteredFloors.value = groupByFloor(selectBydata)
|
||||||
// console.log("数据分组-555---", filteredFloors.value[0].rooms)
|
// console.log("数据分组-555---", filteredFloors.value[0].rooms)
|
||||||
//分组完进行房间状态查询,张祥瑞
|
//分组完进行房间状态查询,张祥瑞
|
||||||
getAllswitchByids()
|
console.log("进入房间订阅:")
|
||||||
|
getfjkzbmforfjid();
|
||||||
|
// getAllswitchByids()
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -297,7 +315,7 @@
|
|||||||
//------------------------以上为数据处理---end-------------
|
//------------------------以上为数据处理---end-------------
|
||||||
//处理返回的消息
|
//处理返回的消息
|
||||||
const handlesocketMessage = (jsonString) => {
|
const handlesocketMessage = (jsonString) => {
|
||||||
console.log("1300--666666666666666---", jsonString)
|
// console.log("1300--666666666666666---", jsonString)
|
||||||
try {
|
try {
|
||||||
const messageObj = JSON.parse(jsonString);
|
const messageObj = JSON.parse(jsonString);
|
||||||
|
|
||||||
@ -378,12 +396,12 @@
|
|||||||
uni.sendSocketMessage({
|
uni.sendSocketMessage({
|
||||||
data: connectFrame
|
data: connectFrame
|
||||||
});
|
});
|
||||||
console.log("77777777777")
|
// console.log("77777777777")
|
||||||
});
|
});
|
||||||
|
|
||||||
// 监听消息
|
// 监听消息
|
||||||
socketTask.onMessage((res) => {
|
socketTask.onMessage((res) => {
|
||||||
console.log("8888888888888888888")
|
// console.log("8888888888888888888")
|
||||||
const data = res.data;
|
const data = res.data;
|
||||||
const [commandLine, ...headerLines] = data.split('\n');
|
const [commandLine, ...headerLines] = data.split('\n');
|
||||||
const emptyLineIndex = headerLines.findIndex(line => line === '');
|
const emptyLineIndex = headerLines.findIndex(line => line === '');
|
||||||
@ -395,8 +413,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
const body = headerLines.slice(emptyLineIndex + 1).join('\n').replace(/\x00$/, '');
|
const body = headerLines.slice(emptyLineIndex + 1).join('\n').replace(/\x00$/, '');
|
||||||
console.log("999999999999999", res)
|
// console.log("999999999999999", res)
|
||||||
console.log("121212121212", commandLine)
|
// console.log("121212121212", commandLine)
|
||||||
switch (commandLine) {
|
switch (commandLine) {
|
||||||
case 'CONNECTED':
|
case 'CONNECTED':
|
||||||
connectionStatus.value = 'STOMP已连接';
|
connectionStatus.value = 'STOMP已连接';
|
||||||
|
|||||||
@ -34,7 +34,8 @@
|
|||||||
selectfjkzbmforfjid,
|
selectfjkzbmforfjid,
|
||||||
createdSwitch,
|
createdSwitch,
|
||||||
listAllRegions,
|
listAllRegions,
|
||||||
Selecthomelist
|
Selecthomelist,
|
||||||
|
getfjkzbmforfjidApp
|
||||||
} from '@/api/devicecontrol/officedevice';
|
} from '@/api/devicecontrol/officedevice';
|
||||||
// import useWebSocketService from '@/api/devicecontrol/webSocketService'
|
// import useWebSocketService from '@/api/devicecontrol/webSocketService'
|
||||||
|
|
||||||
@ -77,14 +78,28 @@
|
|||||||
if (res.success) {
|
if (res.success) {
|
||||||
homelist.value = res.result.map((item, index) => ({
|
homelist.value = res.result.map((item, index) => ({
|
||||||
...item,
|
...item,
|
||||||
homezt: 0, // 添加homezt字段,默认为0
|
// homezt: 0, // 添加homezt字段,默认为0
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
});
|
});
|
||||||
filteredFloors.value = groupByFloor(homelist)
|
filteredFloors.value = groupByFloor(homelist)
|
||||||
getAllswitchByids();
|
// getAllswitchByids();
|
||||||
|
//获取完房间信息然后订阅
|
||||||
|
getfjkzbmforfjid();
|
||||||
|
}
|
||||||
|
//订阅房间信息
|
||||||
|
const getfjkzbmforfjid = () => {
|
||||||
|
for (const item of filteredFloors.value) {
|
||||||
|
getfjkzbmforfjidApp({fjbid:item.id}).then((res) => {
|
||||||
|
console.log("订阅成功--------------",res)
|
||||||
|
}).catch((err) => {
|
||||||
|
console.log("订阅失败:"+item.fjh+"。失败信息:"+err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 数据分组处理
|
// 数据分组处理
|
||||||
@ -229,7 +244,7 @@
|
|||||||
if (res.success) {
|
if (res.success) {
|
||||||
selectBydata.value = res.result;
|
selectBydata.value = res.result;
|
||||||
filteredFloors.value = groupByFloor(selectBydata)
|
filteredFloors.value = groupByFloor(selectBydata)
|
||||||
getAllswitchByids()
|
// getAllswitchByids()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//----------------树状展示end-----------
|
//----------------树状展示end-----------
|
||||||
|
|||||||
@ -62,15 +62,15 @@
|
|||||||
|
|
||||||
<view class="ac-controls" v-if="ktpd">
|
<view class="ac-controls" v-if="ktpd">
|
||||||
<button class="ac-btn" :class="{ 'active': acMode === 1 }" @click="conditioning(1)">
|
<button class="ac-btn" :class="{ 'active': acMode === 1 }" @click="conditioning(1)">
|
||||||
<uni-icons type="snow" size="20" color="#3498db"></uni-icons>
|
<!-- <uni-icons type="snow" size="20" color="#3498db"></uni-icons> -->
|
||||||
<text>制冷 25°C</text>
|
<text>制冷 25°C</text>
|
||||||
</button>
|
</button>
|
||||||
<button class="ac-btn" :class="{ 'active': acMode === 2 }" @click="conditioning(2)">
|
<button class="ac-btn" :class="{ 'active': acMode === 2 }" @click="conditioning(2)">
|
||||||
<uni-icons type="fire" size="20" color="#e74c3c"></uni-icons>
|
<!-- <uni-icons type="fire" size="20" color="#e74c3c"></uni-icons> -->
|
||||||
<text>制热 27°C</text>
|
<text>制热 27°C</text>
|
||||||
</button>
|
</button>
|
||||||
<button class="ac-btn" :class="{ 'active': acMode === 0 }" @click="conditioning(0)">
|
<button class="ac-btn" :class="{ 'active': acMode === 0 }" @click="conditioning(0)">
|
||||||
<uni-icons type="close" size="20" color="#7f8c8d"></uni-icons>
|
<!-- <uni-icons type="close" size="20" color="#7f8c8d"></uni-icons> -->
|
||||||
<text>关闭空调</text>
|
<text>关闭空调</text>
|
||||||
</button>
|
</button>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user