9.26张祥瑞

This commit is contained in:
张祥瑞 2025-09-26 09:46:31 +08:00
parent 7df7696fe1
commit 1add87973a
6 changed files with 83 additions and 24 deletions

View File

@ -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'

View File

@ -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
})
}
//20250925id
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
}) })

View File

@ -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;
} }

View File

@ -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,8 +304,10 @@
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()
} }
} }
//----------------end----------- //----------------end-----------
@ -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已连接';

View File

@ -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, // homezt0 // homezt: 0, // homezt0
})); }));
} }
}).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-----------

View File

@ -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>