Quellcode durchsuchen

提交我的家庭

wangming vor 1 Monat
Ursprung
Commit
15b2c09d17

+ 2 - 2
src/components/js_sdk/index.js

@@ -5,9 +5,9 @@ http.setConfig(config => {
     if (__wxConfig.envVersion == 'develop') {
         let selectedService = uni.getStorageSync("sercviceChoice")
         if (!selectedService || selectedService == 'aloneServe') {
-            config.baseUrl = "https://api.radar-power.asia:4443/portal-service-server/";
+            // config.baseUrl = "https://api.radar-power.asia:4443/portal-service-server/";
         }
-        // config.baseUrl = "https://radar-power.cn/portal-service-server/";
+        config.baseUrl = "https://radar-power.cn/portal-service-server/";
     }
     if (__wxConfig.envVersion == 'trial') {
         let selectedService = uni.getStorageSync("sercviceChoice")

+ 4 - 1
src/pages/home/home.vue

@@ -26,7 +26,7 @@
                 </view>
                 <view
                     class="rightItem"
-                    @click="gotoDevice('/pagesA/devices/devices')"
+                    @click="gotoDevice('/pagesA/homeManage/homeManage')"
                 >
                     <view class="rightTitle">我的家庭</view>
                     <view class="rightContent"
@@ -232,6 +232,9 @@ export default {
             });
         },
         getperSonInfo() {
+            uni.showLoading({
+                title: "查询中...",
+            });
             this.$http
                 .get("wap/home/homeInfo", {
                     userId: uni.getStorageSync("userId"),

+ 1 - 0
src/pagesA/adDevice/adDevice.vue

@@ -602,6 +602,7 @@ export default {
         } else {
             console.log("没有参数");
         }
+        // this.$refs.alarModel.connectMQTTwo();
     },
 
     onUnload(options) {

+ 13 - 8
src/pagesA/deviceDetail/deviceDetail.vue

@@ -368,11 +368,11 @@
             @sendHealth="receptHealth"
         /> -->
 
-        <alarModel
+        <!-- <alarModel
             v-if="isInitAlarm"
             @sendChange="receptionChange"
             @sendHealth="receptHealth"
-        />
+        /> -->
     </view>
 </template>
 <script>
@@ -880,6 +880,7 @@ export default {
         },
         // 订阅mqtt实时点位
         connectMqtt() {
+            this.mqttClienTwoFlag = false;
             if (this.mqttClienTwoFlag) {
                 console.log("主题已订阅");
                 return;
@@ -928,12 +929,12 @@ export default {
                     );
                 }
             }
+            console.log("主题开始订阅5555");
             // 存储client引用以便后续操作
             this.mqttClientOne = clientTwo;
             clientTwo.on("connect", () => {
-                console.log("MQTT连接成功");
+                console.log("MQTT_DATA连接成功");
                 this.mqttClienTwoFlag = true;
-                let userId = uni.getStorageSync("userId");
                 if (this.clientIdProp !== null) {
                     clientTwo.subscribe(
                         `/dev/${this.clientIdProp}/tracker_targets`,
@@ -965,7 +966,6 @@ export default {
             clientTwo.on("close", () => {});
 
             clientTwo.on("message", (topic, message) => {
-                console.log(JSON.parse(message.toString()), "8870");
                 // 处理点位消息
                 if (this.clientIdProp !== null) {
                     this.handleMessage(topic, message, this.clientIdProp);
@@ -980,8 +980,11 @@ export default {
                 this.targetPoints = {};
             }, 1500);
 
+            console.log(topic, 99999);
+            console.log(JSON.parse(message.toString()), "99999999");
+
             // 验证topic格式
-            const match = topic.match(/^\/dev\/(.+)\/dsp_data$/);
+            const match = topic.match(/^\/dev\/(.+)\/tracker_targets$/);
             if (!match || match[1] !== clientId) return;
 
             try {
@@ -1001,6 +1004,7 @@ export default {
                     }
                 }
                 this.processTrackerData(data.tracker_targets);
+                console.log(data.tracker_targets, "MQTT消息解析成功22222");
             } catch (e) {
                 console.error("MQTT消息解析失败", e);
             }
@@ -1099,12 +1103,10 @@ export default {
             }
         },
     },
-
     onShow() {
         this.clientIdProp = uni.getStorageSync("clientIDetail");
         this.isInitAlarm = true;
         this.todayDate = this.$time(new Date(), 2);
-        this.connectMqtt();
     },
     onLoad(options) {
         const devItem = this.parseDeviceItem(options.devItem);
@@ -1117,6 +1119,9 @@ export default {
         }, 3000);
         this.getCurrentDate();
     },
+    onReady() {
+        this.connectMqtt();
+    },
     onUnload() {
         this.isInitAlarm = false;
         this.inactivityTimer = null;

+ 1 - 1
src/pagesA/devices/devices.vue

@@ -125,7 +125,7 @@ export default {
                     status: status,
                 })
                 .then((res) => {
-                    console.log("设备列表", res);
+                    uni.hideLoading();
                     if (res.data.code == 200) {
                         let devs = res.data.data;
                         for (let i = 0; i < devs.length; i++) {

+ 9 - 22
src/pagesA/healthAlarm/healthAlarm.vue

@@ -31,9 +31,9 @@
                 </view>
             </view>
         </view>
-        <view class="bottomTwo">
-            <view class="addNewAlarm" @click="addNewAlarm">新增守护计划</view>
-        </view>
+        <view class="bottomTwo" @click="addNewAlarm">
+            <text>新增守护计划 </text></view
+        >
 
         <!-- 选择守护计划遮罩层 -->
         <view v-if="showPopup" class="mask" @click="showPopup = false"></view>
@@ -255,7 +255,6 @@ export default {
         position: relative;
     }
     .airbody {
-        background: #ffffff;
         box-sizing: border-box;
         .header_top {
             // padding: 0rpx 40rpx;
@@ -330,6 +329,7 @@ export default {
             }
             .noPlan {
                 background-color: #f9efe5;
+                padding-top: 30rpx;
                 color: #999;
                 font-size: 28rpx;
                 text-align: center;
@@ -337,29 +337,16 @@ export default {
         }
     }
     .bottomTwo {
+        width: 750rpx;
+        height: 120rpx;
+        position: fixed;
         display: flex;
+        justify-content: center;
         align-items: center;
-        justify-content: space-between;
-        position: fixed;
         bottom: 0;
         left: 0;
-        width: 750rpx;
-        height: 120rpx;
+        line-height: 120rpx;
         background: #f3e2dd;
-        .addNewAlarm {
-            margin: 0 auto;
-            display: flex;
-            align-items: center;
-            justify-content: center;
-            width: 700rpx;
-            height: 94rpx;
-            background: #ffebe4;
-            border-radius: 28rpx;
-            font-weight: 500;
-            color: #111111;
-            font-size: 32rpx;
-            text-align: center;
-        }
     }
 
     .mask {

+ 307 - 4
src/pagesA/playSetting/playSetting.vue

@@ -1,15 +1,318 @@
-<template></template>
+<template>
+    <view class="container">
+        <!-- 计划名称输入框 -->
+        <view class="input-container">
+            <text class="input-label">计划名称:</text>
+            <input
+                class="input-field"
+                type="text"
+                v-model="planInfo.name"
+                placeholder="请输入计划名称"
+            />
+        </view>
+
+        <!-- 事件类型选择 -->
+        <view class="select-container">
+            <text class="input-label">事件类型:</text>
+            <input
+                class="input-field"
+                type="text"
+                v-model="eventType.eventDesc"
+                placeholder="请输入计划类型"
+                disabled="true"
+            />
+        </view>
+
+        <!-- 计划时间 -->
+        <view class="time-container" style="margin-bottom: 20rpx">
+            <text class="input-label">计划时间:</text>
+            <view class="time-picker-container">
+                <picker
+                    mode="date"
+                    v-model="startDate"
+                    start="2000-01-01"
+                    end="2099-12-31"
+                    @change="bindStartChange"
+                >
+                    <view class="picker-content">{{ startDate }}</view>
+                </picker>
+                ~
+                <picker
+                    mode="date"
+                    v-model="stopDate"
+                    start="2000-01-01"
+                    end="2099-12-31"
+                    @change="bindEndChange"
+                >
+                    <view class="picker-content">{{ stopDate }}</view>
+                </picker>
+            </view>
+        </view>
+
+        <!-- 生效时段 -->
+        <view class="time-container">
+            <text class="input-label">生效时段:</text>
+            <view class="time-picker-container">
+                <picker
+                    mode="time"
+                    v-model="effectiveStart"
+                    @change="bindEffectiveStartChange"
+                >
+                    <view class="picker-content" style="width: 170rpx">{{
+                        effectiveStart
+                    }}</view>
+                </picker>
+                ~
+                <picker
+                    mode="time"
+                    v-model="effectiveEnd"
+                    @change="bindEffectiveEndChange"
+                >
+                    <view class="picker-content" style="width: 170rpx">{{
+                        effectiveEnd
+                    }}</view>
+                </picker>
+            </view>
+        </view>
+        <view class="time-range-wrapper" v-if="timeRange.length > 0">
+            <view
+                class="time-item"
+                v-for="(item, index) in timeRange"
+                :key="index"
+            >
+                <text class="time-text"
+                    >{{ item.start_time }} - {{ item.end_time }}</text
+                >
+                <text class="delete-btn" @click="removeTime(index)">×</text>
+            </view>
+        </view>
+
+        <!-- 告警提醒 -->
+        <view class="switch-container">
+            <text class="input-label">告警联动(服务号推送):</text>
+            <switch
+                v-model="isAlarmActive"
+                active-color="#07c160"
+                inactive-color="#ccc"
+            />
+        </view>
+
+        <!-- 是否启用 -->
+        <view class="switch-container">
+            <text class="input-label">是否启用:</text>
+            <switch
+                v-model="isEnabled"
+                active-color="#07c160"
+                inactive-color="#ccc"
+            />
+        </view>
+
+        <!-- 保存按钮 -->
+        <view class="save-button" @click="saveTemplate">
+            <text class="save-button-text">保存</text>
+        </view>
+    </view>
+</template>
+
 <script>
 export default {
     data() {
         return {
-            planInfo: "",
+            planName: "",
+            selectedEventType: 0,
+            startDate: "2025-01-01",
+            stopDate: "2025-11-01",
+            effectiveStart: "00:00",
+            effectiveEnd: "23:59",
+            isAlarmActive: true,
+            isEnabled: true,
+            planInfo: {},
+            warmTypeList: [],
+            eventType: "",
+            timeRange: [],
         };
     },
+    methods: {
+        saveTemplate() {
+            uni.showToast({
+                title: "保存成功",
+                icon: "success",
+            });
+        },
+        handlePlanInfo() {
+            console.log(this.planInfo, 9999999);
+        },
+        getWarnType() {
+            this.$http.get("wap/stats/queryEventType").then((res) => {
+                if (res.data.data) {
+                    this.warmTypeList = res.data.data;
+                    this.eventType = this.warmTypeList.find(
+                        (item) => item.eventVal == this.planInfo.eventVal
+                    );
+                }
+            });
+        },
+        bindStartChange(val) {
+            this.startDate = val.detail.value;
+            this.planInfo.startDate = this.startDate + " 00:00:00";
+        },
+        bindEndChange(val) {
+            this.stopDate = val.detail.value;
+            this.planInfo.stopDate = this.stopDate + " 23:59:59";
+        },
+        bindEffectiveStartChange(val) {
+            this.effectiveStart = val.detail.value;
+            console.log(this.effectiveStart, val.detail.value, 88887);
+        },
+        bindEffectiveEndChange(val) {
+            this.effectiveEnd = val.detail.value;
+            console.log(this.effectiveEnd, 9999);
+            this.timeRange.push({
+                start_time: this.effectiveStart,
+                end_time: this.effectiveEnd,
+            });
+        },
+
+        removeTime(index) {
+            this.timeRange.splice(index, 1);
+        },
+    },
     onLoad(options) {
         this.planInfo = JSON.parse(options.planInfo);
-        console.log(this.planInfo, 99999);
+        this.startDate =
+            this.planInfo?.alarmTimePlan.startDate?.slice(0, 10) || "";
+        this.stopDate =
+            this.planInfo?.alarmTimePlan.stopDate?.slice(0, 10) || "";
+        // if (this.planInfo.alarmTimePlan.timeRange) {
+        //     const fixedTimeRange =
+        //         this.planInfo.alarmTimePlan.timeRange.replace(/\]\[/g, "},{");
+        //     const correctedString = "[" + fixedTimeRange + "]";
+        //     try {
+        //         this.timeRange = JSON.parse(correctedString);
+        //         console.log(this.timeRange, 8870);
+        //     } catch (e) {
+        //         console.error("JSON解析失败:", e);
+        //     }
+        // }
+        if (this.planInfo.alarmTimePlan.timeRange) {
+            this.timeRange = JSON.parse(this.planInfo.alarmTimePlan.timeRange);
+        }
+        this.timeRange = JSON.parse(this.timeRange);
+    },
+    onShow() {
+        this.getWarnType();
     },
 };
 </script>
-<style lang="less"></style>
+
+<style scoped>
+.container {
+    padding: 20px;
+    height: 100vh;
+    background-color: #f9eee3;
+    border-radius: 12px;
+}
+.input-container {
+    margin-bottom: 25px;
+}
+.input-label {
+    font-size: 16px;
+    color: #333;
+    margin-bottom: 8px;
+    font-weight: 600;
+}
+.time-picker-container {
+    margin-top: 20rpx;
+    align-items: center;
+    display: flex;
+    justify-content: space-between;
+}
+.input-field {
+    width: 92%;
+    padding: 14px;
+    margin-top: 20rpx;
+    border: 1px solid #ccc;
+    border-radius: 10px;
+    font-size: 16px;
+    background-color: #fff;
+}
+.input-counter {
+    font-size: 12px;
+    color: #999;
+    text-align: right;
+    margin-top: 4px;
+}
+.select-container {
+    margin-bottom: 25px;
+}
+.picker-content {
+    padding: 14px;
+    border: 1px solid #ccc;
+    border-radius: 10px;
+    font-size: 16px;
+    color: #333;
+    background-color: #fff;
+}
+.time-range-wrapper {
+    margin-top: 20rpx;
+    display: flex;
+    flex-wrap: wrap; /* 多行换行显示 */
+    gap: 10rpx; /* 间距 */
+    padding: 10rpx;
+}
+
+.time-item {
+    position: relative;
+    display: flex;
+    align-items: center;
+    padding: 10rpx 20rpx;
+    background-color: #f5f5f5;
+    border-radius: 12rpx;
+}
+
+.time-text {
+    font-size: 28rpx;
+    color: #333;
+}
+
+.delete-btn {
+    position: absolute;
+    top: -6rpx;
+    right: -6rpx;
+    width: 30rpx;
+    height: 30rpx;
+    line-height: 24rpx;
+    text-align: center;
+    background-color: #ff4d4f;
+    color: #fff;
+    border-radius: 50%;
+    font-weight: bold;
+    font-size: 20rpx;
+}
+
+.switch-container {
+    margin-bottom: 25px;
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+}
+
+/* 新的保存按钮样式 */
+.save-button {
+    width: 750rpx;
+    height: 120rpx;
+    position: fixed;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    bottom: 0;
+    left: 0;
+    line-height: 120rpx;
+    background: #f3e2dd;
+    border-radius: 12px;
+}
+.save-button-text {
+    font-size: 18px;
+    /* font-weight: bold; */
+}
+</style>