Ver Fonte

新增健康闹钟

wangming há 1 mês atrás
pai
commit
cfebfe52bd

+ 9 - 0
src/pages.json

@@ -186,6 +186,15 @@
                         "navigationBarBackgroundColor": "#faede2",
                         "navigationBarTextStyle": "black"
                     }
+                },
+                {
+                    "path": "healthAlarm/healthAlarm",
+                    "style": {
+                        "enablePullDownRefresh": true,
+                        "navigationBarTitleText": "健康闹钟",
+                        "navigationBarBackgroundColor": "#faede2",
+                        "navigationBarTextStyle": "black"
+                    }
                 }
             ]
         }

+ 22 - 49
src/pages/home/home.vue

@@ -15,7 +15,7 @@
                 />
             </view>
             <view class="right">
-                <view class="rightItem">
+                <!-- <view class="rightItem">
                     <view class="rightTitle">今日天气</view>
                     <view class="rightPng">
                         <view
@@ -24,7 +24,7 @@
                             >{{ weatherText }}</view
                         >
                     </view>
-                </view>
+                </view> -->
 
                 <view
                     class="rightItem"
@@ -255,24 +255,24 @@ export default {
                 });
         },
         // 获取天气接口
-        getWeather() {
-            uni.request({
-                url: "https://kp36x7gr79.re.qweatherapi.com/v7/weather/now", // 使用官方域名
-                data: {
-                    location: "101220101", // 城市ID
-                    key: "72afe228cd7f436ebea7caa1345956f2", // 你的API Key
-                },
-                method: "GET",
-                success: (res) => {
-                    if (res.statusCode === 200) {
-                        this.weatherText = res.data.now.text;
-                    }
-                },
-                fail: (err) => {
-                    console.error("网络错误:", err);
-                },
-            });
-        },
+        // getWeather() {
+        //     uni.request({
+        //         url: "https://kp36x7gr79.re.qweatherapi.com/v7/weather/now", // 使用官方域名
+        //         data: {
+        //             location: "101220101", // 城市ID
+        //             key: "72afe228cd7f436ebea7caa1345956f2", // 你的API Key
+        //         },
+        //         method: "GET",
+        //         success: (res) => {
+        //             if (res.statusCode === 200) {
+        //                 this.weatherText = res.data.now.text;
+        //             }
+        //         },
+        //         fail: (err) => {
+        //             console.error("网络错误:", err);
+        //         },
+        //     });
+        // },
         // 需要跟车对接一下,换一个接口
         getWarmList() {
             this.$http
@@ -310,7 +310,7 @@ export default {
             this.getperSonInfo();
             this.getShareNum();
             this.getWarmList();
-            this.getWeather();
+            // this.getWeather();
             this.isInitAlarm = true;
             this.isIniTenMinutes = true;
         }
@@ -319,33 +319,6 @@ export default {
         if (!selectedService) {
             uni.setStorageSync("sercviceChoice", "aloneServe");
         }
-        // uni.getLocation({
-        //     type: "wgs84",
-        //     success: (res) => {
-        //         console.log(res, 999999);
-        //         if (res) {
-        //             uni.request({
-        //                 url: `https://apis.map.qq.com/ws/geocoder/v1/?location=${res.latitude},${res.longitude}&key=${key}&get_poi=0`,
-        //                 data: {
-        //                     // location: "101220101", // 城市ID
-        //                     // key: "72afe228cd7f436ebea7caa1345956f2", // 你的API Key
-        //                 },
-        //                 method: "GET",
-        //                 success: (res) => {
-        //                     console.log(res, 8870);
-        //                     if (res.statusCode === 200) {
-        //                         this.weatherText = res.data.now.text;
-        //                     }
-        //                 },
-        //                 fail: (err) => {
-        //                     console.error("网络错误:", err);
-        //                 },
-        //             });
-        //             console.log(res, 99999);
-        //         }
-        //         this.getWeather();
-        //     },
-        // });
     },
     onHide() {
         this.isInitAlarm = false;
@@ -421,7 +394,7 @@ export default {
 }
 
 .right .rightItem {
-    margin-bottom: 60rpx;
+    margin-bottom: 80rpx;
     color: #666666;
 }
 

+ 4 - 52
src/pagesA/deviceDetail/deviceDetail.vue

@@ -671,57 +671,12 @@ export default {
         },
         // 健康闹钟方法
         healthAlarm() {
-            uni.showToast({
-                title: "该功能正在开发中,敬请期待",
-                icon: "none",
-                duration: 1500,
+            uni.navigateTo({
+                url:
+                    "/pagesA/healthAlarm/healthAlarm?devInfo=" +
+                    JSON.stringify(this.devInfo),
             });
         },
-        // 循环播放进出
-        // timestampToTime(value, type = 0) {
-        //     var time = new Date(value);
-        //     var year = time.getFullYear();
-        //     var month = time.getMonth() + 1;
-        //     var date = time.getDate();
-        //     var hour = time.getHours();
-        //     var minute = time.getMinutes();
-        //     var second = time.getSeconds();
-        //     month = month < 10 ? "0" + month : month;
-        //     date = date < 10 ? "0" + date : date;
-        //     hour = hour < 10 ? "0" + hour : hour;
-        //     minute = minute < 10 ? "0" + minute : minute;
-        //     second = second < 10 ? "0" + second : second;
-        //     var arr = [
-        //         year + "-" + month + "-" + date,
-        //         year +
-        //             "-" +
-        //             month +
-        //             "-" +
-        //             date +
-        //             " " +
-        //             hour +
-        //             ":" +
-        //             minute +
-        //             ":" +
-        //             second,
-        //         year + "年" + month + "月" + date + "日",
-        //         year +
-        //             "年" +
-        //             month +
-        //             "月" +
-        //             date +
-        //             " " +
-        //             hour +
-        //             ":" +
-        //             minute +
-        //             ":" +
-        //             second,
-        //         hour + ":" + minute + ":" + second,
-        //         year + "-" + month + "-" + date + " " + hour + ":" + minute,
-        //         month + "月" + date + "日" + hour + ":" + minute,
-        //     ];
-        //     return arr[type];
-        // },
         onSwiperChange(event) {
             const current = event.detail.current;
             const totalItems = this.endArr.length;
@@ -910,9 +865,6 @@ export default {
         this.clientIdProp = uni.getStorageSync("clientIDetail");
         this.isInitAlarm = true;
         this.getToday();
-        // setInterval(() => {
-        //     this.setEcharts(Math.floor(Math.random() * 30));
-        // }, 100);
     },
     onLoad(options) {
         const devItem = this.parseDeviceItem(options.devItem);

+ 265 - 0
src/pagesA/healthAlarm/healthAlarm.vue

@@ -0,0 +1,265 @@
+<template>
+    <view class="container">
+        <view class="nomalNotice">
+            <view class="nomalTitle">异常提醒</view>
+            <view class="nomal_contain">
+                <view class="nomalItem">
+                    <view class="switchBox">
+                        <view class="switchBox">
+                            <text class="name">起夜频次</text>
+                            <switch
+                                :value="statusLight"
+                                @change="handleLightChange"
+                                :active-value="1"
+                                :inactive-value="0"
+                                size="24px"
+                                active-color="#07c160"
+                                inactive-color="#eeeff1"
+                                style="transform: scale(0.8)"
+                            />
+                        </view>
+                        <view class="nomalLeft">
+                            <text>23:00-06:30</text>
+                            <image src="../../static/arrThree.png" mode="" />
+                        </view>
+                    </view>
+                </view>
+                <view class="nomalItem">
+                    <view class="switchBox">
+                        <view class="switchBox">
+                            <text class="name">如厕频次</text>
+                            <switch
+                                :value="statusLight"
+                                @change="handleLightChange"
+                                :active-value="1"
+                                :inactive-value="0"
+                                size="24px"
+                                active-color="#07c160"
+                                inactive-color="#eeeff1"
+                                style="transform: scale(0.8)"
+                            />
+                        </view>
+                        <view class="nomalLeft">
+                            <text>23:00-06:30</text>
+                            <image src="../../static/arrThree.png" mode="" />
+                        </view>
+                    </view>
+                </view>
+                <view class="nomalItem">
+                    <view class="switchBox">
+                        <view class="switchBox">
+                            <text class="name">卫生间频次</text>
+                            <switch
+                                :value="statusLight"
+                                @change="handleLightChange"
+                                :active-value="1"
+                                :inactive-value="0"
+                                size="24px"
+                                active-color="#07c160"
+                                inactive-color="#eeeff1"
+                                style="transform: scale(0.8)"
+                            />
+                        </view>
+                        <view class="nomalLeft">
+                            <text>23:00-06:30</text>
+                            <image src="../../static/arrThree.png" mode="" />
+                        </view>
+                    </view>
+                </view>
+                <view class="nomalItem">
+                    <view class="switchBox">
+                        <view class="switchBox">
+                            <text class="name">夜间如厕频次</text>
+                            <switch
+                                :value="statusLight"
+                                @change="handleLightChange"
+                                :active-value="1"
+                                :inactive-value="0"
+                                size="24px"
+                                active-color="#07c160"
+                                inactive-color="#eeeff1"
+                                style="transform: scale(0.8)"
+                            />
+                        </view>
+                        <view class="nomalLeft">
+                            <text>23:00-06:30</text>
+                            <image src="../../static/arrThree.png" mode="" />
+                        </view>
+                    </view>
+                </view>
+                <view class="nomalItem">
+                    <view class="switchBox">
+                        <view class="switchBox">
+                            <text class="name">如厕频次异常</text>
+                            <switch
+                                :value="statusLight"
+                                @change="handleLightChange"
+                                :active-value="1"
+                                :inactive-value="0"
+                                size="24px"
+                                active-color="#07c160"
+                                inactive-color="#eeeff1"
+                                style="transform: scale(0.8)"
+                            />
+                        </view>
+                        <view class="nomalLeft">
+                            <text>23:00-06:30</text>
+                            <image src="../../static/arrThree.png" mode="" />
+                        </view>
+                    </view>
+                </view>
+            </view>
+        </view>
+
+        <view class="box">
+            <view class="handle-btn">
+                <view class="btn2" @click="healthAlarm"> 保存设置 </view>
+            </view>
+        </view>
+    </view>
+</template>
+<script>
+export default {
+    name: "my",
+    data() {
+        return {
+            status_light: 1,
+            devInfo: "",
+            statusLight: 1,
+        };
+    },
+    computed: {},
+    methods: {},
+    onLoad(option) {
+        this.devInfo = JSON.parse(option.devInfo);
+        console.log(this.devInfo, 999999);
+    },
+    onShow() {},
+    onHide() {},
+    onUnload() {},
+};
+</script>
+<style lang="less" scoped>
+.container {
+    height: 100vh;
+    background: linear-gradient(180deg, #faede2 0%, #f4f4f4 100%);
+    box-sizing: border-box;
+    padding-top: 20rpx;
+
+    .nomalNotice {
+        width: 712rpx;
+        margin: 0 auto;
+        box-sizing: border-box;
+
+        &.moreNotice {
+            margin-top: 56rpx;
+        }
+
+        .nomalTitle {
+            padding-left: 38rpx;
+            font-family: MiSans;
+            color: #9d8179;
+            font-size: 28rpx;
+        }
+
+        .nomal_contain {
+            padding: 10rpx 37rpx;
+            margin-top: 18rpx;
+            background: #ffffff;
+            border-radius: 37rpx;
+
+            .nomalItem {
+                display: flex;
+                justify-content: space-between;
+
+                .switchBox {
+                    width: 600rpx;
+                    height: 94rpx;
+                    display: flex;
+                    align-items: center;
+                    padding-top: 20rpx;
+                    padding-bottom: 20rpx;
+                    border-bottom: 2rpx solid #eef2f6;
+                    background: #ffffff;
+
+                    &.switchLast {
+                        border-bottom: none;
+                    }
+
+                    .name {
+                        margin-left: 18rpx;
+                        color: #111111;
+                        font-size: 32rpx;
+                        margin-bottom: 10rpx;
+
+                        &.otherClass {
+                            color: #999999;
+                        }
+                    }
+
+                    .nomalLeft {
+                        width: 250rpx;
+                        display: flex;
+                        justify-content: space-between;
+                        align-items: center;
+                        margin-left: auto;
+                        color: #a0acbe;
+                        font-size: 28rpx;
+                        text-align: right;
+                        margin-bottom: 10rpx;
+
+                        .otherClass {
+                            color: #999999;
+                        }
+
+                        image {
+                            width: 12rpx;
+                            height: 21rpx;
+                            margin-left: 10rpx;
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    .box {
+        position: fixed;
+        bottom: 0;
+        left: 0;
+        width: 100vw;
+        height: 168rpx;
+        padding: 0 37rpx;
+        background: #ffffff;
+        box-sizing: border-box;
+
+        .handle-btn {
+            margin-top: 40rpx;
+            display: flex;
+            align-items: center;
+            justify-content: space-between;
+
+            .btn2 {
+                display: flex;
+                align-items: center;
+                justify-content: center;
+                width: 700rpx;
+                height: 94rpx;
+                background: linear-gradient(
+                    105.95deg,
+                    #a27867 0%,
+                    #74483d 100%
+                );
+                border-radius: 28rpx;
+                box-shadow: 0rpx 4.69rpx 18.75rpx rgba(72, 41, 29, 0.15),
+                    0rpx 9.38rpx 9.38rpx rgba(154, 132, 89, 0.2),
+                    0rpx -4.69rpx 28.13rpx 4.69rpx #a16647 inset;
+                font-family: MiSans;
+                font-weight: 500;
+                color: #ffffff;
+                font-size: 32rpx;
+            }
+        }
+    }
+}
+</style>