wangming 4 тижнів тому
батько
коміт
63494ea083
5 змінених файлів з 211 додано та 313 видалено
  1. 74 0
      ppp.json
  2. 1 11
      src/pages.json
  3. 0 276
      src/pagesA/OTA/OTA.vue
  4. 136 2
      src/pagesA/deviceSetting/deviceSetting.vue
  5. 0 24
      www.vue

+ 74 - 0
ppp.json

@@ -0,0 +1,74 @@
+[
+    {
+        "fileId": "1970659142427049986",
+        "fileName": "LNRadar500M-V2.2.5.bin",
+        "ossUrl": "http://hflnxx.oss-cn-shanghai.aliyuncs.com/ota/20250924/1c8147af8f9f436ab4d00211f448f067_LNRadar500M-V2.2.5.bin",
+        "createTime": "2025-09-24 09:18:47"
+    },
+    {
+        "fileId": "1965968157210169345",
+        "fileName": "LNRadar500M-V2.2.4.bin",
+        "ossUrl": "http://hflnxx.oss-cn-shanghai.aliyuncs.com/ota/20250911/92764551d2df499499b12e9a32b784b5_LNRadar500M-V2.2.4.bin",
+        "createTime": "2025-09-11 10:38:29"
+    },
+    {
+        "fileId": "1965966601240825858",
+        "fileName": "LNRadar500M-V2.2.4.bin",
+        "ossUrl": "http://hflnxx.oss-cn-shanghai.aliyuncs.com/ota/20250911/d8ff977f5fdb476799c53cf9bcd76c8f_LNRadar500M-V2.2.4.bin",
+        "createTime": "2025-09-11 10:32:18"
+    },
+    {
+        "fileId": "1965966216807698433",
+        "fileName": "LNRadar500M-V2.2.4.bin",
+        "ossUrl": "http://hflnxx.oss-cn-shanghai.aliyuncs.com/ota/20250911/20cdef4495e844e7b89d588b505b7e33_LNRadar500M-V2.2.4.bin",
+        "createTime": "2025-09-11 10:30:46"
+    },
+    {
+        "fileId": "1965597184728240129",
+        "fileName": "LNRadar500M-V2.2.4.bin",
+        "ossUrl": "http://hflnxx.oss-cn-shanghai.aliyuncs.com/ota/20250910/a1c3f82e8b72469cbd4cbf586f6c5ef4_LNRadar500M-V2.2.4.bin",
+        "createTime": "2025-09-10 10:04:22"
+    },
+    {
+        "fileId": "1963785469820727298",
+        "fileName": "LNRadar500M-V2.2.2.bin",
+        "ossUrl": "http://hflnxx.oss-cn-shanghai.aliyuncs.com/ota/20250905/da6d87a251b04654be465850e760d53a_LNRadar500M-V2.2.2.bin",
+        "createTime": "2025-09-05 10:05:16"
+    },
+    {
+        "fileId": "1963551893992828929",
+        "fileName": "LNRadar500M-V2.2.2.bin",
+        "ossUrl": "http://hflnxx.oss-cn-shanghai.aliyuncs.com/ota/20250904/2f3a4b8f31e243728cfefea7ac0920b8_LNRadar500M-V2.2.2.bin",
+        "createTime": "2025-09-04 18:37:07"
+    },
+    {
+        "fileId": "1962391807513706498",
+        "fileName": "LNRadar500M-V2.2.1.bin",
+        "ossUrl": "http://hflnxx.oss-cn-shanghai.aliyuncs.com/ota/20250901/f86b9df22c0547ec9ee524f497edc173_LNRadar500M-V2.2.1.bin",
+        "createTime": "2025-09-01 13:47:21"
+    },
+    {
+        "fileId": "1962390646035431426",
+        "fileName": "LNRadar500M-V2.1.1.bin",
+        "ossUrl": "http://hflnxx.oss-cn-shanghai.aliyuncs.com/ota/20250901/09622c43b6e2414c98b51694945e24f7_LNRadar500M-V2.1.1.bin",
+        "createTime": "2025-09-01 13:42:44"
+    },
+    {
+        "fileId": "1961227753139019778",
+        "fileName": "LNRadar500M-V2.2.0.bin",
+        "ossUrl": "http://hflnxx.oss-cn-shanghai.aliyuncs.com/ota/20250829/6de6e635c593487a948cc9e9fcf840cf_LNRadar500M-V2.2.0.bin",
+        "createTime": "2025-08-29 08:41:48"
+    },
+    {
+        "fileId": "1960609476645822465",
+        "fileName": "LNRadar500M-V2.1.4-RPM.bin",
+        "ossUrl": "http://hflnxx.oss-cn-shanghai.aliyuncs.com/ota/20250827/719f300351194bc3b9b33f05f23efde0_LNRadar500M-V2.1.4-RPM.bin",
+        "createTime": "2025-08-27 15:45:00"
+    },
+    {
+        "fileId": "1950861541545598977",
+        "fileName": "LNRadar500M-V2.1.2.bin",
+        "ossUrl": "http://hflnxx.oss-cn-shanghai.aliyuncs.com/ota/20250731/6f52e879ab9d4e43b72f5a9aab7c7825_LNRadar500M-V2.1.2.bin",
+        "createTime": "2025-07-31 18:10:11"
+    }
+]

+ 1 - 11
src/pages.json

@@ -77,16 +77,6 @@
                     "usingComponents": {}
                 },
                 {
-                    "path": "OTA/OTA",
-                    "style": {
-                        "enablePullDownRefresh": true,
-                        "navigationBarTitleText": "OTA升级",
-                        "navigationBarBackgroundColor": "#faede2",
-                        "navigationBarTextStyle": "black"
-                    },
-                    "usingComponents": {}
-                },
-                {
                     "path": "shareList/shareList",
                     "style": {
                         "enablePullDownRefresh": true,
@@ -173,7 +163,7 @@
                     "path": "shareCountList/shareCountList",
                     "style": {
                         "enablePullDownRefresh": true,
-                        "navigationBarTitleText": "分享账户",
+                        "navigationBarTitleText": "分享记录",
                         "navigationBarBackgroundColor": "#faede2",
                         "navigationBarTextStyle": "black"
                     }

+ 0 - 276
src/pagesA/OTA/OTA.vue

@@ -1,276 +0,0 @@
-<template>
-    <view class="box">
-        <view
-            class="OTA-info"
-            v-if="devsClientId.length > 0 && otaList.length > 0"
-        >
-            <view class="meauList">
-                <view class="title">OTA信息</view>
-                <view class="menu-item">
-                    <view class="meanLeft"> 设备序列号 </view>
-                    <view class="meanRight">
-                        <picker
-                            @change="bindPickerChange"
-                            :value="index"
-                            :range="devsClientId"
-                        >
-                            <view class="uni-input">{{
-                                devsClientId[index]
-                            }}</view>
-                        </picker>
-                        <image
-                            src="../../static/rightArrow.png"
-                            alt=""
-                            @click="showPicker"
-                        ></image>
-                    </view>
-                </view>
-                <view class="menu-item" bind:tap="gotoPath">
-                    <view class="meanLeft">
-                        <text>设备名称</text>
-                    </view>
-                    <view class="meanRight">
-                        {{ devs[index].devName }}
-                    </view>
-                </view>
-                <view class="menu-item" bind:tap="logout">
-                    <view class="meanLeft">
-                        <text>雷达型号</text>
-                    </view>
-                    <view class="meanRight">
-                        {{ devs[index].devType }}
-                    </view>
-                </view>
-                <view class="menu-item" bind:tap="logout">
-                    <view class="meanLeft">
-                        <text>当前版本</text>
-                    </view>
-                    <view class="meanRight">
-                        {{ devs[index].hardware }}
-                    </view>
-                </view>
-            </view>
-
-            <view class="meauList">
-                <view class="title">OTA版本</view>
-                <view class="menu-item">
-                    <view class="meanLeft">OTA版本</view>
-                    <view class="meanRight">
-                        <picker
-                            @change="bindPickerChangeTwo"
-                            :value="otaIndex"
-                            :range="otaListName"
-                        >
-                            <view class="uni-input">{{ otaListName[0] }}</view>
-                        </picker>
-                        <image
-                            src="../../static/rightArrow.png"
-                            alt=""
-                            @click="showPicker"
-                        ></image>
-                    </view>
-                </view>
-            </view>
-        </view>
-
-        <view
-            class="updateOta"
-            @click="freshOTA()"
-            v-if="devsClientId.length > 0 && otaList.length > 0"
-            >更新OTA</view
-        >
-    </view>
-</template>
-
-<script>
-export default {
-    data() {
-        return {
-            ota: "",
-            devs: [],
-            devsClientId: [],
-            index: 0,
-            selectClientId: "",
-            // ota部分
-            otaList: [],
-            otaListName: [],
-            otaIndex: 0,
-        };
-    },
-    methods: {
-        queryList() {
-            this.$http
-                .post("wap/device/deviceList", {
-                    userId: uni.getStorageSync("userId"),
-                    keyword: "",
-                    status: "",
-                })
-                .then((res) => {
-                    if (res.data.code == 200) {
-                        let devs = res.data.data;
-                        for (let i = 0; i < devs.length; i++) {
-                            if (
-                                devs[i].installPosition == "Toilet" &&
-                                devs[i].stayTimes?.length > 0
-                            ) {
-                                devs[i].wcTimes = devs[i].stayTimes.length;
-                            } else {
-                                devs[i].wcTimes = 0;
-                            }
-                            const signalTime = devs[i].signal_time;
-                            const currentTime = Date.now();
-                        }
-                        this.devs = devs;
-                        this.devsClientId = this.devs.map(
-                            (ele) => ele.clientId
-                        );
-                    } else {
-                        uni.showModal({
-                            content: res.data.message,
-                            showCancel: false,
-                        });
-                    }
-                });
-        },
-        freshOTA() {
-            if (this.devs[this.index].online == 0) {
-                uni.showModal({
-                    content: "设备离线,无法升级",
-                    complete: (res) => {
-                        if (res.confirm) {
-                        } else {
-                        }
-                    },
-                });
-                return;
-            }
-            let clientIds = [];
-            clientIds.push(this.devs[this.index].clientId);
-            let ossUrl = this.otaList[this.otaIndex].ossUrl;
-            this.$http
-                .post(
-                    "pub/OTA/update",
-                    { clientIds: clientIds, ossUrl: ossUrl },
-                    {
-                        header: {
-                            "Content-Type": "application/json;charset=UTF-8",
-                        },
-                    }
-                )
-                .then((res) => {
-                    if (res.data.code == 200) {
-                        uni.showToast({
-                            title: "OTA升级成功",
-                            icon: "success",
-                            duration: 1500,
-                        });
-                    } else {
-                        uni.showToast({
-                            title: res.data.message,
-                            icon: "none",
-                            duration: 1500,
-                        });
-                    }
-                });
-        },
-        bindPickerChange(e) {
-            this.index = e.detail.value;
-        },
-        // OTA部分
-        bindPickerChangeTwo(e) {
-            this.otaIndex = e.detail.value;
-        },
-        queryOtaList() {
-            this.$http.get("pub/OTA/query", {}).then((res) => {
-                this.otaList = res.data.data;
-                this.otaListName = this.otaList.map((ele) => ele.fileName);
-            });
-        },
-    },
-    onLoad() {},
-    onShow() {
-        this.queryList();
-        this.queryOtaList();
-    },
-};
-</script>
-
-<style lang="less" scoped>
-.box {
-    padding: 10rpx 18rpx;
-    width: 100vw;
-    height: 100vh;
-    background: linear-gradient(180deg, #faede2 0%, #f4f4f4 100%);
-    box-sizing: border-box;
-    .meauList {
-        .title {
-            padding-top: 20rpx;
-            margin-left: 25rpx;
-            font-weight: 500;
-            color: #784c41;
-            font-size: 32rpx;
-        }
-        width: 710rpx;
-        margin: 18rpx auto 0 auto;
-        background: #fff;
-        border-radius: 37rpx;
-        box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.03);
-        padding: 0;
-        box-sizing: border-box;
-
-        .menu-item {
-            display: flex;
-            align-items: center;
-            justify-content: space-between;
-            margin: 0 32rpx;
-            padding: 32rpx 0;
-            border-bottom: 1rpx solid #f0f0f0;
-
-            &:last-child {
-                border-bottom: none;
-            }
-
-            .meanLeft {
-                display: flex;
-                align-items: center;
-                justify-content: center;
-
-                image {
-                    width: 38rpx;
-                    height: 38rpx;
-                }
-
-                text {
-                    margin-left: 10rpx;
-                    color: #111111;
-                    font-size: 32rpx;
-                }
-            }
-            .meanRight {
-                display: flex;
-                align-items: center;
-            }
-
-            .meanRight image {
-                margin-left: 4rpx;
-                width: 16rpx;
-                height: 26rpx;
-            }
-        }
-    }
-
-    .updateOta {
-        width: 710rpx;
-        margin: 48rpx auto 0 auto;
-        height: 88rpx;
-        background: #fff;
-        color: #b48a7c;
-        font-size: 32rpx;
-        border-radius: 30rpx;
-        display: flex;
-        align-items: center;
-        justify-content: center;
-        box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.03);
-    }
-}
-</style>

+ 136 - 2
src/pagesA/deviceSetting/deviceSetting.vue

@@ -17,13 +17,36 @@
                 <text>安装位置</text>
                 <text>{{ position }}</text>
             </view>
+            <view class="wifItem">
+                <text>硬件版本</text>
+                <text>{{ devInfo.hardware }}</text>
+            </view>
+
+            <view class="menu-item">
+                <view class="meanLeft">设备升级</view>
+                <view class="meanRight" v-if="otaList.length > 0">
+                    <picker
+                        @change="bindPickerChangeTwo"
+                        :value="otaIndex"
+                        :range="otaListName"
+                    >
+                        <view class="uni-input">{{ otaListName[0] }}</view>
+                    </picker>
+                    <image
+                        src="../../static/rightArrow.png"
+                        alt=""
+                        @click="showPicker"
+                    ></image>
+                </view>
+                <view class="meanRight"> 已是最新版本,无需升级 </view>
+            </view>
         </view>
         <view class="clientInfo" style="margin-top: 40rpx">
             <view class="wifItem" @click="goShareCount">
-                <text>分享账户</text>
+                <text>分享记录</text>
                 <image
                     src="../../static/rightArrow.png"
-                    style="width: 40rpx; height: 40rpx"
+                    style="width: 30rpx; height: 30rpx"
                 ></image>
             </view>
             <!-- <view class="wifItem">
@@ -110,6 +133,10 @@ export default {
             isIniTenMinutes: "",
             sharedPhone: "",
             removeDeviceModle: false,
+            // ota部分
+            otaList: [],
+            otaListName: [],
+            otaIndex: 0,
         };
     },
     methods: {
@@ -240,6 +267,71 @@ export default {
                     }
                 });
         },
+        queryOtaList() {
+            this.$http.get("wap/device/OTA/query", {}).then((res) => {
+                this.otaList = this.filterFilesByVersion(
+                    res.data.data,
+                    this.devInfo.hardware
+                );
+                this.otaListName = this.otaList.map((ele) => ele.fileName);
+            });
+        },
+        bindPickerChangeTwo(e) {
+            this.otaIndex = e.detail.value;
+            this.freshOTA();
+        },
+
+        freshOTA() {
+            let clientIds = [];
+            clientIds.push(this.devInfo.clientId);
+            let ossUrl = this.otaList[this.otaIndex].ossUrl;
+            this.$http
+                .post(
+                    "wap/device/OTA/update",
+                    { clientIds: clientIds, ossUrl: ossUrl },
+                    {
+                        header: {
+                            "Content-Type": "application/json;charset=UTF-8",
+                        },
+                    }
+                )
+                .then((res) => {
+                    if (res.data.code == 200) {
+                        uni.showToast({
+                            title: "设备升级成功",
+                            icon: "success",
+                            duration: 1500,
+                        });
+                    } else {
+                        uni.showToast({
+                            title: res.data.message,
+                            icon: "none",
+                            duration: 1500,
+                        });
+                    }
+                });
+        },
+
+        parseVersion(fileName) {
+            const match = fileName.match(/V(\d+\.\d+\.\d+)/);
+            return match ? match[1].split(".").map(Number) : [0, 0, 0];
+        },
+        compareVersion(v1, v2) {
+            for (let i = 0; i < Math.max(v1.length, v2.length); i++) {
+                const num1 = v1[i] || 0;
+                const num2 = v2[i] || 0;
+                if (num1 > num2) return 1;
+                if (num1 < num2) return -1;
+            }
+            return 0;
+        },
+        filterFilesByVersion(files, minVersionStr) {
+            const minVersion = minVersionStr.split(".").map(Number);
+            return files.filter((file) => {
+                const version = this.parseVersion(file.fileName);
+                return this.compareVersion(version, minVersion) > 0;
+            });
+        },
     },
     onLoad(options) {
         this.isIniTenMinutes = true;
@@ -248,6 +340,7 @@ export default {
     onShow() {
         this.isIniTenMinutes = true;
         this.getPosition(this.devInfo.installPosition);
+        this.queryOtaList();
     },
     onUnload() {
         this.isIniTenMinutes = false;
@@ -288,6 +381,47 @@ export default {
                 text-align: right;
             }
         }
+
+        .menu-item {
+            width: 640rpx;
+            display: flex;
+            align-content: center;
+            justify-content: space-between;
+            border-bottom: 2rpx solid #ebeff5;
+            padding-top: 30rpx;
+            padding-bottom: 20rpx;
+
+            &:last-child {
+                border-bottom: none;
+            }
+
+            .meanLeft {
+                display: flex;
+                align-items: center;
+                justify-content: center;
+
+                image {
+                    width: 38rpx;
+                    height: 38rpx;
+                }
+
+                text {
+                    margin-left: 10rpx;
+                    color: #111111;
+                    font-size: 32rpx;
+                }
+            }
+            .meanRight {
+                display: flex;
+                align-items: center;
+            }
+
+            .meanRight image {
+                margin-left: 4rpx;
+                width: 16rpx;
+                height: 26rpx;
+            }
+        }
     }
     .box {
         position: fixed;

+ 0 - 24
www.vue

@@ -1,24 +0,0 @@
-export default { data() { return { clientId: "", mqttClientData: null,
-mqttMessageBound: false, // 确保 message 事件只绑定一次 }; }, onLoad(options) {
-const devItem = JSON.parse(options.devItem); this.clientId =
-uni.getStorageSync("clientIDetail") || devItem.clientId; // 获取全局 MQTT 客户端
-this.mqttClientData = this.$mqttClientData; // 如果还没创建或者未连接,等待连接
-ready if (!this.mqttClientData || !this.mqttClientData.mqttDataConnected) {
-uni.$once("mqttData-ready", (mqtt) => { this.mqttClientData = mqtt;
-this.subscribeMqttData(); }); } else { this.subscribeMqttData(); } }, methods: {
-subscribeMqttData() { const mqtt = this.mqttClientData; if (!mqtt) return; //
-只绑定一次 message 回调 if (!this.mqttMessageBound) { mqtt.on("message", (topic,
-message) => { console.log("收到消息:", topic, message.toString()); const
-dataMatch = topic.match(/^\/dev\/(.+)\/tracker_targets$/); const cmdMatch =
-topic.match(/^\/mps\/wx_(.+)\/notice$/); if (dataMatch && dataMatch[1] ===
-this.clientId) { this.handleMessage(topic, message, this.clientId); } else if
-(cmdMatch) { this.$refs.alarmModel?.hanOtherMessage?.(topic, message); } });
-this.mqttMessageBound = true; } // 如果已连接,立即订阅 if
-(mqtt.mqttDataConnected) { mqtt.subscribeTopic(this.clientId); } else { //
-未连接时监听 connect 再订阅 mqtt.on("connect", () => { console.log("DATA MQTT
-连接成功,订阅 topic"); mqtt.subscribeTopic(this.clientId); }); } }, },
-onUnload() { // 页面卸载取消订阅 if (this.mqttClientData) {
-this.mqttClientData.unsubscribe(`/dev/${this.clientId}/tracker_targets`, (err)
-=> { if (err) console.error("取消订阅失败", err); else
-console.log(`取消订阅成功: /dev/${this.clientId}/tracker_targets`); }); }
-this.mqttMessageBound = false; }, };