|
@@ -0,0 +1,378 @@
|
|
|
+<template>
|
|
|
+ <view class="home-warp">
|
|
|
+ <view class="clientInfo">
|
|
|
+ <view class="wifItem" @click="godeviceApparatus">
|
|
|
+ <text>设备参数</text>
|
|
|
+ <image
|
|
|
+ src="../../static/rightArrow.png"
|
|
|
+ style="width: 30rpx; height: 30rpx"
|
|
|
+ ></image>
|
|
|
+ </view>
|
|
|
+ <view class="wifItem" @click="roomSetting">
|
|
|
+ <text>房间配置</text>
|
|
|
+ <image
|
|
|
+ src="../../static/rightArrow.png"
|
|
|
+ style="width: 30rpx; height: 30rpx"
|
|
|
+ ></image>
|
|
|
+ </view>
|
|
|
+ <view class="wifItem">
|
|
|
+ <text>坐摔检测</text>
|
|
|
+ <view class="inputBox">
|
|
|
+ <switch
|
|
|
+ :checked="fallSettingEnabled == 1"
|
|
|
+ @change="onFallSettingChange"
|
|
|
+ :active-value="1"
|
|
|
+ :inactive-value="0"
|
|
|
+ size="24px"
|
|
|
+ active-color="#07c160"
|
|
|
+ inactive-color="#eeeff1"
|
|
|
+ style="transform: scale(0.8); margin-left: auto"
|
|
|
+ />
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <view class="modal-mask" v-if="showFallSettingModle">
|
|
|
+ <view class="modal-container">
|
|
|
+ <view class="modal-header">
|
|
|
+ <text class="title">坐摔参数配置</text>
|
|
|
+ </view>
|
|
|
+ <view class="modal-body">
|
|
|
+ <view class="wifItem" style="margin-top: 30rpx">
|
|
|
+ <text>坐摔最低高度</text>
|
|
|
+ <view class="inputBox">
|
|
|
+ <input
|
|
|
+ type="number"
|
|
|
+ v-model="lowZMax"
|
|
|
+ placeholder="请输入坐摔最低高度"
|
|
|
+ />
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="wifItem" style="margin-top: 30rpx">
|
|
|
+ <text>坐摔门限</text>
|
|
|
+ <view class="inputBox">
|
|
|
+ <input
|
|
|
+ type="number"
|
|
|
+ v-model="humanPredThreshold"
|
|
|
+ placeholder="请输入坐摔门限"
|
|
|
+ />
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="wifItem" style="margin-top: 30rpx">
|
|
|
+ <text>坐摔判断阈值</text>
|
|
|
+ <view class="inputBox">
|
|
|
+ <input
|
|
|
+ type="number"
|
|
|
+ v-model="minEventsForDetection"
|
|
|
+ placeholder="请输入最坐摔判断阈值"
|
|
|
+ />
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="wifItem" style="margin-top: 30rpx">
|
|
|
+ <text>坐摔状态阈值</text>
|
|
|
+ <view class="inputBox">
|
|
|
+ <input
|
|
|
+ type="number"
|
|
|
+ v-model="minHumanEventsForDetection"
|
|
|
+ placeholder="请输入坐摔状态阈值"
|
|
|
+ />
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="modal-buttons">
|
|
|
+ <button class="btn cancle-btn" @click="cancleFall">
|
|
|
+ <text>取消</text>
|
|
|
+ </button>
|
|
|
+ <button class="btn phone-btn" @click="saveFallSetting">
|
|
|
+ <text>保存</text>
|
|
|
+ </button>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+import { save } from "../../utils/mqtt";
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: "my",
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ devInfo: "",
|
|
|
+ // 坐摔参数
|
|
|
+ preFallSettingEnabled: 0,
|
|
|
+ fallSettingEnabled: 0,
|
|
|
+ lowZMax: 0.5,
|
|
|
+ humanPredThreshold: 0.78,
|
|
|
+ minEventsForDetection: 3,
|
|
|
+ minHumanEventsForDetection: 2,
|
|
|
+ lowHighSnrRatio: false,
|
|
|
+ lowMidSnrRatio: false,
|
|
|
+ // 坐摔检测弹窗
|
|
|
+ showFallSettingModle: false,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ computed: {},
|
|
|
+ watch: {
|
|
|
+ fallSettingEnabled: {
|
|
|
+ handler(newVal, oldVal) {
|
|
|
+ console.log("fallSettingEnabled", newVal, oldVal);
|
|
|
+ if (newVal == 1) {
|
|
|
+ // this.showFallSettingModle = true;
|
|
|
+ } else {
|
|
|
+ this.showFallSettingModle = false;
|
|
|
+ this.closeFallSetting();
|
|
|
+ }
|
|
|
+ this.preFallSettingEnabled = oldVal;
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+
|
|
|
+ methods: {
|
|
|
+ godeviceApparatus() {
|
|
|
+ uni.navigateTo({
|
|
|
+ url:
|
|
|
+ "/pagesA/adDevice/adDevice?devInfo=" +
|
|
|
+ JSON.stringify(this.devInfo),
|
|
|
+ });
|
|
|
+ },
|
|
|
+ roomSetting() {
|
|
|
+ uni.navigateTo({
|
|
|
+ url:
|
|
|
+ "/pagesA/roomSetting/roomSetting?devId=" +
|
|
|
+ this.devInfo.devId +
|
|
|
+ "&clientId=" +
|
|
|
+ this.devInfo.clientId,
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 初始化坐摔参数
|
|
|
+ setFallSetting(devInfo) {
|
|
|
+ console.log("devInfo", devInfo);
|
|
|
+ if (devInfo.fallSettingEnabled == 1) {
|
|
|
+ this.preFallSettingEnabled = devInfo.preFallSettingEnabled;
|
|
|
+ this.fallSettingEnabled = devInfo.fallSettingEnabled;
|
|
|
+ this.lowZMax = devInfo.lowZMax;
|
|
|
+ this.humanPredThreshold = devInfo.humanPredThreshold;
|
|
|
+ this.minEventsForDetection = devInfo.minEventsForDetection;
|
|
|
+ this.minHumanEventsForDetection =
|
|
|
+ devInfo.minHumanEventsForDetection;
|
|
|
+ }
|
|
|
+ this.showFallSettingModle = false;
|
|
|
+ },
|
|
|
+
|
|
|
+ onFallSettingChange({ detail }) {
|
|
|
+ this.fallSettingEnabled = detail.value == true ? 1 : 0;
|
|
|
+ if (this.fallSettingEnabled == 1) {
|
|
|
+ this.showFallSettingModle = true;
|
|
|
+ } else {
|
|
|
+ this.showFallSettingModle = false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ cancleFall() {
|
|
|
+ this.fallSettingEnabled = this.preFallSettingEnabled;
|
|
|
+ this.showFallSettingModle = false;
|
|
|
+ },
|
|
|
+
|
|
|
+ // 取消坐摔设置
|
|
|
+ closeFallSetting() {
|
|
|
+ this.showFallSettingModle = false;
|
|
|
+ delete this.devInfo.preFallSettingEnabled;
|
|
|
+ delete this.devInfo.fallSettingEnabled;
|
|
|
+ delete this.devInfo.lowZMax;
|
|
|
+ delete this.devInfo.humanPredThreshold;
|
|
|
+ delete this.devInfo.minEventsForDetection;
|
|
|
+ delete this.devInfo.minHumanEventsForDetection;
|
|
|
+ this.$http
|
|
|
+ .post("wap/device/updateDevice", this.devInfo, {
|
|
|
+ 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,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 保存坐摔设置
|
|
|
+ saveFallSetting() {
|
|
|
+ this.devInfo.preFallSettingEnabled = this.preFallSettingEnabled;
|
|
|
+ this.devInfo.fallSettingEnabled = this.fallSettingEnabled;
|
|
|
+ this.devInfo.lowZMax = this.lowZMax;
|
|
|
+ this.devInfo.humanPredThreshold = this.humanPredThreshold;
|
|
|
+ this.devInfo.minEventsForDetection = this.minEventsForDetection;
|
|
|
+ this.devInfo.minHumanEventsForDetection =
|
|
|
+ this.minHumanEventsForDetection;
|
|
|
+
|
|
|
+ this.$http
|
|
|
+ .post("wap/device/updateDevice", this.devInfo, {
|
|
|
+ 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,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ this.showFallSettingModle = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ },
|
|
|
+ onLoad(options) {
|
|
|
+ if (JSON.stringify(options) != "{}") {
|
|
|
+ this.devInfo = JSON.parse(options.devInfo);
|
|
|
+ }
|
|
|
+ this.setFallSetting(this.devInfo);
|
|
|
+ // console.log("devInfo11111111", this.devInfo);
|
|
|
+ },
|
|
|
+
|
|
|
+ onUnload(options) {},
|
|
|
+ onShow() {},
|
|
|
+};
|
|
|
+</script>
|
|
|
+<style lang="less" scoped>
|
|
|
+.home-warp {
|
|
|
+ position: relative;
|
|
|
+ height: 100vh;
|
|
|
+ background: linear-gradient(180deg, #faede2 0%, #f4f4f4 100%);
|
|
|
+ .clientInfo {
|
|
|
+ width: 700rpx;
|
|
|
+ height: 180px;
|
|
|
+ margin: 0 auto;
|
|
|
+ background: #ffffff;
|
|
|
+ border-radius: 38rpx;
|
|
|
+ box-sizing: border-box;
|
|
|
+ padding: 30rpx 30rpx;
|
|
|
+ .wifItem {
|
|
|
+ width: 640rpx;
|
|
|
+ display: flex;
|
|
|
+ align-content: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ border-bottom: 2rpx solid #ebeff5;
|
|
|
+ padding-top: 30rpx;
|
|
|
+ padding-bottom: 20rpx;
|
|
|
+ image {
|
|
|
+ width: 40rpx;
|
|
|
+ height: 40rpx;
|
|
|
+ }
|
|
|
+ input {
|
|
|
+ margin-left: auto;
|
|
|
+ text-align: right;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .modal-mask {
|
|
|
+ position: fixed;
|
|
|
+ top: 0;
|
|
|
+ left: 0;
|
|
|
+ right: 0;
|
|
|
+ bottom: 0;
|
|
|
+ background: rgba(0, 0, 0, 0.5);
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ z-index: 333;
|
|
|
+
|
|
|
+ .modal-container {
|
|
|
+ width: 80%;
|
|
|
+ background: #fff;
|
|
|
+ border-radius: 16rpx;
|
|
|
+ // overflow: hidden;
|
|
|
+ animation: fadeIn 0.3s;
|
|
|
+
|
|
|
+ .modal-header {
|
|
|
+ padding: 30rpx;
|
|
|
+ text-align: center;
|
|
|
+ border-bottom: 1rpx solid #f5f5f5;
|
|
|
+
|
|
|
+ .title {
|
|
|
+ font-size: 36rpx;
|
|
|
+ display: block;
|
|
|
+ margin-bottom: 10rpx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .modal-body {
|
|
|
+ margin: 0 auto 0 auto;
|
|
|
+ box-sizing: border-box;
|
|
|
+ padding: 0 30rpx 20rpx 30rpx;
|
|
|
+ .wifItem {
|
|
|
+ width: 530rpx;
|
|
|
+ display: flex;
|
|
|
+ align-content: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ border-bottom: 2rpx solid #ebeff5;
|
|
|
+ padding-top: 30rpx;
|
|
|
+ padding-bottom: 20rpx;
|
|
|
+ image {
|
|
|
+ width: 40rpx;
|
|
|
+ height: 40rpx;
|
|
|
+ }
|
|
|
+ input {
|
|
|
+ margin-left: auto;
|
|
|
+ text-align: right;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .modal-buttons {
|
|
|
+ display: flex;
|
|
|
+ padding: 20rpx;
|
|
|
+
|
|
|
+ .btn {
|
|
|
+ flex: 1;
|
|
|
+ height: 90rpx;
|
|
|
+ margin: 15rpx 0;
|
|
|
+ border-radius: 45rpx;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ font-size: 32rpx;
|
|
|
+ border: none;
|
|
|
+ background: none;
|
|
|
+ position: relative;
|
|
|
+ }
|
|
|
+ .cancle-btn {
|
|
|
+ width: 40rpx;
|
|
|
+ background: linear-gradient(
|
|
|
+ 105.95deg,
|
|
|
+ #ba978a 0%,
|
|
|
+ #a27867 100%
|
|
|
+ );
|
|
|
+ color: white;
|
|
|
+ }
|
|
|
+
|
|
|
+ .phone-btn {
|
|
|
+ margin-left: 10rpx;
|
|
|
+ background: linear-gradient(
|
|
|
+ 105.95deg,
|
|
|
+ #ba978a 0%,
|
|
|
+ #a27867 100%
|
|
|
+ );
|
|
|
+ color: white;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|