Преглед на файлове

提交分享账户,跌倒事件

wangming преди 1 месец
родител
ревизия
3de1b26617

+ 5 - 5
src/components/component/alarModel.vue

@@ -463,14 +463,14 @@ export default {
             let selectedService = uni.getStorageSync("sercviceChoice");
             if (!selectedService || selectedService == "aloneServe") {
                 if (__wxConfig.envVersion == "develop") {
-                    // client = mqtt.connect(
-                    //     "wxs://api.radar-power.asia:8084/mqtt",
-                    //     params
-                    // );
                     client = mqtt.connect(
-                        "wxs://radar-power.cn:8084/mqtt",
+                        "wxs://api.radar-power.asia:8084/mqtt",
                         params
                     );
+                    // client = mqtt.connect(
+                    //     "wxs://radar-power.cn:8084/mqtt",
+                    //     params
+                    // );
                 }
                 if (__wxConfig.envVersion == "trial") {
                     client = mqtt.connect(

+ 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")

+ 27 - 0
src/pages.json

@@ -159,6 +159,33 @@
                         "navigationBarBackgroundColor": "#faede2",
                         "navigationBarTextStyle": "black"
                     }
+                },
+                {
+                    "path": "failDetail/failDetail",
+                    "style": {
+                        "enablePullDownRefresh": true,
+                        "navigationBarTitleText": "跌倒事件",
+                        "navigationBarBackgroundColor": "#faede2",
+                        "navigationBarTextStyle": "black"
+                    }
+                },
+                {
+                    "path": "shareCountList/shareCountList",
+                    "style": {
+                        "enablePullDownRefresh": true,
+                        "navigationBarTitleText": "分享账户",
+                        "navigationBarBackgroundColor": "#faede2",
+                        "navigationBarTextStyle": "black"
+                    }
+                },
+                {
+                    "path": "shareDetail/shareDetail",
+                    "style": {
+                        "enablePullDownRefresh": true,
+                        "navigationBarTitleText": "分享详情",
+                        "navigationBarBackgroundColor": "#faede2",
+                        "navigationBarTextStyle": "black"
+                    }
                 }
             ]
         }

+ 30 - 3
src/pagesA/deviceSetting/deviceSetting.vue

@@ -19,9 +19,12 @@
             </view>
         </view>
         <view class="clientInfo" style="margin-top: 40rpx">
-            <view class="wifItem">
+            <view class="wifItem" @click="goShareCount">
                 <text>分享账户</text>
-                <text>{{}}</text>
+                <image
+                    src="../../static/rightArrow.png"
+                    style="width: 40rpx; height: 40rpx"
+                ></image>
             </view>
             <view class="wifItem">
                 <text>紧急联系人</text>
@@ -29,7 +32,17 @@
             </view>
             <view class="wifItem">
                 <text>撤销分享</text>
-                <text>{{}}</text>
+                <image
+                    src="../../static/rightArrow.png"
+                    style="width: 40rpx; height: 40rpx"
+                ></image>
+            </view>
+            <view class="wifItem" @click="goFailDetail">
+                <text>跌倒事件</text>
+                <image
+                    src="../../static/rightArrow.png"
+                    style="width: 30rpx; height: 30rpx"
+                ></image>
             </view>
         </view>
         <view class="box">
@@ -107,6 +120,20 @@ export default {
                     JSON.stringify(this.devInfo),
             });
         },
+        goFailDetail() {
+            uni.navigateTo({
+                url:
+                    "/pagesA/failDetail/failDetail?devInfo=" +
+                    JSON.stringify(this.devInfo),
+            });
+        },
+        goShareCount() {
+            uni.navigateTo({
+                url:
+                    "/pagesA/shareCountList/shareCountList?devInfo=" +
+                    JSON.stringify(this.devInfo),
+            });
+        },
     },
     onLoad(options) {
         this.devInfo = JSON.parse(options.devInfo);

+ 204 - 0
src/pagesA/failDetail/failDetail.vue

@@ -0,0 +1,204 @@
+<template>
+    <view class="box">
+        <template v-if="failDetaiList.length > 0">
+            <view
+                class="meauList"
+                v-for="item in failDetaiList"
+                :key="item.devId"
+            >
+                <view class="menu-item">
+                    <view class="meanLeft">
+                        <text>设备名称</text>
+                    </view>
+                    <view class="meanRight">
+                        <text>{{ devInfo.devName }}</text></view
+                    >
+                </view>
+                <view class="menu-item">
+                    <view class="meanLeft">
+                        <text>设备序列号</text>
+                    </view>
+                    <view class="meanRight">
+                        <text>{{ devInfo.clientId }}</text></view
+                    >
+                </view>
+                <view class="menu-item">
+                    <view class="meanLeft">
+                        <text>设备ID</text>
+                    </view>
+                    <view class="meanRight">
+                        <text>{{ item.devId }}</text></view
+                    >
+                </view>
+                <view class="menu-item">
+                    <view class="meanLeft">
+                        <text>事件类型</text>
+                    </view>
+                    <view class="meanRight">
+                        <text>{{ item.eventType }}</text></view
+                    >
+                </view>
+
+                <view class="menu-item">
+                    <view class="meanLeft">
+                        <text>跌倒时间</text>
+                    </view>
+                    <view class="meanRight">
+                        <text>{{ item.createTime }}</text></view
+                    >
+                </view>
+            </view>
+        </template>
+    </view>
+</template>
+
+<script>
+export default {
+    data() {
+        return {
+            status: null,
+            devInfo: "",
+            failDetaiList: [],
+            pageNo: 1,
+        };
+    },
+    methods: {
+        getFailDetaiList() {
+            this.$http
+                .post(
+                    "web/stats/fallQuery",
+                    {
+                        pageNo: 1,
+                        pageSize: 10,
+                        devId: this.devInfo.devId,
+                    },
+                    {
+                        header: {
+                            "Content-Type": "application/json;charset=UTF-8",
+                            token: uni.getStorageSync("tokenValue") || "",
+                        },
+                    }
+                )
+                .then((res) => {
+                    console.log(res, 9999);
+                    // if (res.data.data) {
+                    //     this.failDetaiList = res.data.data;
+                    //     if (this.failDetaiList) {
+                    //         const hasStatusZero = this.failDetaiList.some(
+                    //             (item) => item.state === 0
+                    //         );
+                    //         console.log(hasStatusZero);
+                    //         if (!hasStatusZero) {
+                    //             this.state = null;
+                    //             this.getFailDetaiList();
+                    //         }
+                    //     }
+                    // } else {
+                    //     this.state = null;
+                    //     this.getFailDetaiList();
+                    // }
+                });
+        },
+        searchFailDetail() {
+            this.pageNo = 1;
+            this.failDetaiList = [];
+            this.getFailDetaiList();
+        },
+    },
+    onShow() {},
+    onLoad(options) {
+        this.devInfo = JSON.parse(options.devInfo);
+        this.searchFailDetail();
+    },
+    onPullDownRefresh() {
+        this.getFailDetaiList();
+        setTimeout(() => {
+            uni.stopPullDownRefresh();
+        }, 1000);
+    },
+};
+</script>
+
+<style lang="less" scoped>
+// Main Styles
+.box {
+    padding: 10rpx 18rpx;
+    width: 100vw;
+    height: 100vh;
+    background: linear-gradient(180deg, #faede2 0%, #f4f4f4 100%);
+    box-sizing: border-box;
+    .meauList {
+        width: 710rpx;
+        margin: 18rpx auto;
+        background: #fff;
+        border-radius: 16rpx;
+        box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.08);
+        overflow: hidden;
+        transition: all 0.3s ease;
+
+        .menu-item {
+            display: flex;
+            align-items: center;
+            justify-content: space-between;
+            margin: 0 32rpx;
+            padding: 32rpx 0;
+            border-bottom: 1rpx solid #f0f0f0;
+
+            &:last-of-type {
+                border-bottom: none;
+            }
+
+            .meanLeft {
+                flex: 1;
+                color: #666;
+                font-size: 28rpx;
+                font-weight: 400;
+            }
+
+            .meanRight {
+                flex: 1;
+                text-align: right;
+                color: #333;
+                font-size: 28rpx;
+                font-weight: 500;
+                padding-left: 20rpx;
+            }
+        }
+
+        .menu-bottom {
+            display: flex;
+            padding: 24rpx 32rpx;
+            border-top: 1rpx solid #f0f0f0;
+
+            .meanLeft,
+            .meanRight {
+                flex: 1;
+                height: 80rpx;
+                display: flex;
+                align-items: center;
+                justify-content: center;
+                border-radius: 8rpx;
+                font-size: 30rpx;
+                font-weight: 500;
+                transition: all 0.2s;
+
+                &:active {
+                    opacity: 0.8;
+                }
+            }
+
+            .meanLeft {
+                background: #7b5245;
+                color: white;
+                margin-right: 16rpx;
+            }
+
+            .meanRight {
+                background: fade(#ff4d4f, 10%);
+                color: #ff4d4f;
+                border: 1rpx solid fade(#ff4d4f, 30%);
+            }
+        }
+    }
+}
+</style>

+ 206 - 0
src/pagesA/shareCountList/shareCountList.vue

@@ -0,0 +1,206 @@
+<template>
+    <view class="box">
+        <template v-if="shareList.length > 0">
+            <view class="meauList" v-for="item in shareList" :key="item.devId">
+                <view class="menu-item">
+                    <view class="meanLeft">
+                        <text>设备名称</text>
+                    </view>
+                    <view class="meanRight">
+                        <text>{{ item.devName }}</text></view
+                    >
+                </view>
+                <view class="menu-item">
+                    <view class="meanLeft">
+                        <text>设备序列号</text>
+                    </view>
+                    <view class="meanRight">
+                        <text>{{ devInfo.clientId }}</text></view
+                    >
+                </view>
+                <view class="menu-item">
+                    <view class="meanLeft">
+                        <text>分享人手机号</text>
+                    </view>
+                    <view class="meanRight">
+                        <text>{{ item.sharerPhone }}</text></view
+                    >
+                </view>
+                <view class="menu-item">
+                    <view class="meanLeft">
+                        <text>被分享人手机号</text>
+                    </view>
+                    <view class="meanRight">
+                        <text>{{ item.sharedPhone }}</text></view
+                    >
+                </view>
+                <view class="menu-item">
+                    <view class="meanLeft">
+                        <text>分享时间</text>
+                    </view>
+                    <view class="meanRight">
+                        <text>{{ item.shareTime }}</text></view
+                    >
+                </view>
+                <view class="menu-item">
+                    <view class="meanLeft">
+                        <text>分享状态</text>
+                    </view>
+                    <view class="meanRight">
+                        <text v-show="item.state == 0"> 待确认 </text>
+                        <text v-show="item.state == 1"> 已确认 </text>
+                        <text v-show="item.state == 2"> 已拒绝 </text>
+                    </view>
+                </view>
+
+                <view class="menu-item" @click="goShareDetail(item)">
+                    <view class="meanLeft">
+                        <text>查看详情</text>
+                    </view>
+                    <view class="meanRight">
+                        <image
+                            src="../../static/rightArrow.png"
+                            style="width: 30rpx; height: 30rpx"
+                        ></image>
+                    </view>
+                </view>
+            </view>
+        </template>
+    </view>
+</template>
+
+<script>
+export default {
+    data() {
+        return {
+            status: null,
+            devInfo: "",
+            shareList: [],
+        };
+    },
+    methods: {
+        getShareList() {
+            this.$http
+                .get(
+                    "wap/share/queryByDevId",
+                    {
+                        userId: uni.getStorageSync("userId"),
+                        devId: this.devInfo.devId,
+                    },
+                    {
+                        header: {
+                            "Content-Type": "application/json;charset=UTF-8",
+                            token: uni.getStorageSync("tokenValue") || "",
+                        },
+                    }
+                )
+                .then((res) => {
+                    console.log(res, 9999);
+                    if (res.data.data) {
+                        this.shareList = res.data.data;
+                    }
+                });
+        },
+        goShareDetail(item) {
+            uni.navigateTo({
+                url:
+                    "/pagesA/shareDetail/shareDetail?shareDetail=" +
+                    JSON.stringify(item),
+            });
+        },
+        searchShareList() {
+            this.shareList = [];
+            this.getShareList();
+        },
+    },
+    onShow() {},
+    onLoad(options) {
+        this.devInfo = JSON.parse(options.devInfo);
+        this.searchShareList();
+    },
+};
+</script>
+
+<style lang="less" scoped>
+// Main Styles
+.box {
+    padding: 10rpx 18rpx;
+    width: 100vw;
+    height: 100vh;
+    background: linear-gradient(180deg, #faede2 0%, #f4f4f4 100%);
+    box-sizing: border-box;
+    .meauList {
+        width: 710rpx;
+        margin: 18rpx auto;
+        background: #fff;
+        border-radius: 16rpx;
+        box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.08);
+        overflow: hidden;
+        transition: all 0.3s ease;
+
+        .menu-item {
+            display: flex;
+            align-items: center;
+            justify-content: space-between;
+            margin: 0 32rpx;
+            padding: 32rpx 0;
+            border-bottom: 1rpx solid #f0f0f0;
+
+            &:last-of-type {
+                border-bottom: none;
+            }
+
+            .meanLeft {
+                flex: 1;
+                color: #666;
+                font-size: 28rpx;
+                font-weight: 400;
+            }
+
+            .meanRight {
+                flex: 1;
+                text-align: right;
+                color: #333;
+                font-size: 28rpx;
+                font-weight: 500;
+                padding-left: 20rpx;
+            }
+        }
+
+        .menu-bottom {
+            display: flex;
+            padding: 24rpx 32rpx;
+            border-top: 1rpx solid #f0f0f0;
+
+            .meanLeft,
+            .meanRight {
+                flex: 1;
+                height: 80rpx;
+                display: flex;
+                align-items: center;
+                justify-content: center;
+                border-radius: 8rpx;
+                font-size: 30rpx;
+                font-weight: 500;
+                transition: all 0.2s;
+
+                &:active {
+                    opacity: 0.8;
+                }
+            }
+
+            .meanLeft {
+                background: #7b5245;
+                color: white;
+                margin-right: 16rpx;
+            }
+
+            .meanRight {
+                background: fade(#ff4d4f, 10%);
+                color: #ff4d4f;
+                border: 1rpx solid fade(#ff4d4f, 30%);
+            }
+        }
+    }
+}
+</style>

+ 224 - 0
src/pagesA/shareDetail/shareDetail.vue

@@ -0,0 +1,224 @@
+<template>
+    <view class="box">
+        <template>
+            <view class="meauList">
+                <view class="menu-item">
+                    <view class="meanLeft">
+                        <text>设备名称</text>
+                    </view>
+                    <view class="meanRight">
+                        <text>{{ shareDetail.devName }}</text></view
+                    >
+                </view>
+                <view class="menu-item">
+                    <view class="meanLeft">
+                        <text>设备序列号</text>
+                    </view>
+                    <view class="meanRight">
+                        <text>{{ shareDetail.clientId }}</text></view
+                    >
+                </view>
+                <view class="menu-item">
+                    <view class="meanLeft">
+                        <text>分享人手机号</text>
+                    </view>
+                    <view class="meanRight">
+                        <text>{{ shareDetail.sharerPhone }}</text></view
+                    >
+                </view>
+                <view class="menu-item">
+                    <view class="meanLeft">
+                        <text>被分享人手机号</text>
+                    </view>
+                    <view class="meanRight">
+                        <text>{{ shareDetail.sharedPhone }}</text></view
+                    >
+                </view>
+                <view class="menu-item">
+                    <view class="meanLeft">
+                        <text>分享时间</text>
+                    </view>
+                    <view class="meanRight">
+                        <text>{{ shareDetail.shareTime }}</text></view
+                    >
+                </view>
+                <view class="menu-item">
+                    <view class="meanLeft">
+                        <text>分享状态</text>
+                    </view>
+                    <view class="meanRight">
+                        <text v-show="shareDetail.state == 0"> 待确认 </text>
+                        <text v-show="shareDetail.state == 1"> 已确认 </text>
+                        <text v-show="shareDetail.state == 2"> 已拒绝 </text>
+                    </view>
+                </view>
+
+                <view class="menu-item" @click="cancleShare()">
+                    <view class="meanLeft">
+                        <text>撤销分享</text>
+                    </view>
+                    <view class="meanRight">
+                        <image
+                            src="../../static/rightArrow.png"
+                            style="width: 30rpx; height: 30rpx"
+                        ></image>
+                    </view>
+                </view>
+            </view>
+        </template>
+    </view>
+</template>
+
+<script>
+export default {
+    data() {
+        return {
+            status: null,
+            shareDetail: "",
+            shareList: [],
+        };
+    },
+    methods: {
+        goShareDetail(item) {
+            uni.navigateTo({
+                url:
+                    "/pagesA/shareDetail/shareDetail?shareDetail=" +
+                    JSON.stringify(item),
+            });
+        },
+        cancleShare(item) {
+            console.log(item, 99999);
+
+            uni.showModal({
+                title: "提示",
+                content: "确定要撤销该条分享记录?",
+                success: (res) => {
+                    if (res.confirm) {
+                        this.$http
+                            .post(
+                                "wap/share/cancelShare",
+                                {
+                                    shareId: this.shareDetail.shareId,
+                                },
+                                {
+                                    header: {
+                                        "Content-Type":
+                                            "application/x-www-form-urlencoded",
+                                    },
+                                }
+                            )
+                            .then((res) => {
+                                if (res.data.code == 200) {
+                                    uni.showToast({
+                                        title: "撤销分享设备成功",
+                                        icon: "success",
+                                        duration: 1500,
+                                    });
+                                    setTimeout(() => {
+                                        uni.navigateBack({
+                                            delta: 1,
+                                        });
+                                    }, 1000);
+                                } else {
+                                    uni.showToast({
+                                        title: "撤销分享设备失败",
+                                        icon: "none",
+                                        duration: 1500,
+                                    });
+                                }
+                            });
+                    }
+                },
+            });
+        },
+    },
+    onShow() {},
+    onLoad(options) {
+        this.shareDetail = JSON.parse(options.shareDetail);
+    },
+};
+</script>
+
+<style lang="less" scoped>
+// Main Styles
+.box {
+    padding: 10rpx 18rpx;
+    width: 100vw;
+    height: 100vh;
+    background: linear-gradient(180deg, #faede2 0%, #f4f4f4 100%);
+    box-sizing: border-box;
+    .meauList {
+        width: 710rpx;
+        margin: 18rpx auto;
+        background: #fff;
+        border-radius: 16rpx;
+        box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.08);
+        overflow: hidden;
+        transition: all 0.3s ease;
+
+        .menu-item {
+            display: flex;
+            align-items: center;
+            justify-content: space-between;
+            margin: 0 32rpx;
+            padding: 32rpx 0;
+            border-bottom: 1rpx solid #f0f0f0;
+
+            &:last-of-type {
+                border-bottom: none;
+            }
+
+            .meanLeft {
+                flex: 1;
+                color: #666;
+                font-size: 28rpx;
+                font-weight: 400;
+            }
+
+            .meanRight {
+                flex: 1;
+                text-align: right;
+                color: #333;
+                font-size: 28rpx;
+                font-weight: 500;
+                padding-left: 20rpx;
+            }
+        }
+
+        .menu-bottom {
+            display: flex;
+            padding: 24rpx 32rpx;
+            border-top: 1rpx solid #f0f0f0;
+
+            .meanLeft,
+            .meanRight {
+                flex: 1;
+                height: 80rpx;
+                display: flex;
+                align-items: center;
+                justify-content: center;
+                border-radius: 8rpx;
+                font-size: 30rpx;
+                font-weight: 500;
+                transition: all 0.2s;
+
+                &:active {
+                    opacity: 0.8;
+                }
+            }
+
+            .meanLeft {
+                background: #7b5245;
+                color: white;
+                margin-right: 16rpx;
+            }
+
+            .meanRight {
+                background: fade(#ff4d4f, 10%);
+                color: #ff4d4f;
+                border: 1rpx solid fade(#ff4d4f, 30%);
+            }
+        }
+    }
+}
+</style>

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

@@ -60,7 +60,6 @@
                 </view>
             </view>
         </template>
-        <!-- <alarModel ref="alarModel" /> -->
     </view>
 </template>
 

+ 27 - 0
src/utils/common.js

@@ -0,0 +1,27 @@
+function 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];
+}
+export default {
+    timestampToTime: timestampToTime,
+}