Parcourir la source

提交我的客服代码

wangming il y a 1 mois
Parent
commit
f6e366a20a

+ 13 - 13
src/App.vue

@@ -21,7 +21,7 @@ wmpfVoip.setVoipEndPagePath({
 });
 
 export default {
-    onLaunch: function () {
+    onLaunch() {
         // 初始化云开发
         if (wx.cloud) {
             wx.cloud.init({});
@@ -71,18 +71,18 @@ export default {
             },
         });
     },
-    onHide() {
-        if (this.$mqttClient) {
-            this.$mqttClient.end(true);
-            this.$mqttClient = null;
-            console.log("MQTT 已关闭(onHide)");
-        }
-        if (this.$mqttClientData) {
-            this.$mqttClientData.end(true);
-            this.$mqttClientData = null;
-            console.log("MQTT Data 已关闭(onHide)");
-        }
-    },
+    // onHide() {
+    //     if (this.$mqttClient) {
+    //         this.$mqttClient.end(true);
+    //         this.$mqttClient = null;
+    //         console.log("MQTT 已关闭(onHide)");
+    //     }
+    //     if (this.$mqttClientData) {
+    //         this.$mqttClientData.end(true);
+    //         this.$mqttClientData = null;
+    //         console.log("MQTT Data 已关闭(onHide)");
+    //     }
+    // },
     onUnload() {
         // 小程序卸载时也关闭
         if (this.$mqttClient) {

+ 0 - 9
src/pages.json

@@ -197,15 +197,6 @@
                     }
                 },
                 {
-                    "path": "survey/survey",
-                    "style": {
-                        "enablePullDownRefresh": true,
-                        "navigationBarTitleText": "问卷调查",
-                        "navigationBarBackgroundColor": "#faede2",
-                        "navigationBarTextStyle": "black"
-                    }
-                },
-                {
                     "path": "playSetting/playSetting",
                     "style": {
                         "enablePullDownRefresh": true,

+ 142 - 26
src/pages/home/home.vue

@@ -73,12 +73,29 @@
             </view>
         </view>
 
-        <view class="bottom" @click="gotoSurvey('/pagesA/survey/survey')">
+        <!-- <view class="bottom">
             <image src="../../static/linkService.png" mode="" />
-            <!-- <button>联系客服</button> -->
             <button open-type="contact">联系客服</button>
-        </view>
-        <view class="bot_version"> v3.0.10 </view>
+        </view> -->
+
+        <movable-area class="movable-area" direction="all">
+            <movable-view
+                class="movable-button"
+                :x="pos.x"
+                :y="pos.y"
+                direction="all"
+                @change="onChange"
+                @touchend="onTouchEnd"
+                v-if="showService"
+            >
+                <image src="../../static/linkService.png" class="icon" />
+                <span class="pulse"></span>
+                <span class="pulse"></span>
+                <button open-type="contact" class="contact-btn"></button>
+            </movable-view>
+        </movable-area>
+
+        <view class="bot_version"> v3.0.12 </view>
         <view
             class="shareInfo"
             @click="goDeviceShare()"
@@ -159,6 +176,18 @@ export default {
             warmTypeList: [],
             isIniTenMinutes: false,
             showModle: false,
+            // 修改我的客服点位
+            pos: { x: 0, y: 0 },
+            selectX: 0,
+            selectY: 0,
+            screenWidth: 0,
+            screenHeight: 0,
+            btnWidth: 0,
+            btnHeight: 0,
+            margin: 0, // 边距
+            windowWidth: 0,
+            dragTimer: null,
+            showService: false,
         };
     },
     computed: {},
@@ -296,13 +325,39 @@ export default {
                     ?.eventDesc || "未知"
             );
         },
-        gotoSurvey(path) {
-            uni.navigateTo({
-                url: path,
+        onChange(e) {
+            this.selectX = e.detail.x;
+            this.selectY = e.detail.y;
+        },
+        onTouchEnd() {
+            uni.getSystemInfo({
+                success: (res) => {
+                    this.windowWidth = Number(res.windowWidth / 2);
+                },
             });
+            // console.log(this.selectX, this.selectY, "777777");
+            // if (this.selectX >= this.windowWidth) {
+            //     this.selectX = 0;
+            // } else {
+            //     this.selectX = 0;
+            // }
+            this.selectX = 0;
+            this.pos.x = this.selectX;
+            this.pos.y = this.selectY;
+            uni.setStorageSync("posLocationX", this.pos.x);
+            uni.setStorageSync("posLocationY", this.pos.y);
         },
     },
-    onLoad() {},
+    onLoad() {
+        if (
+            !uni.getStorageSync("posLocationX") ||
+            !uni.getStorageSync("posLocationY")
+        ) {
+            this.pos = { x: 0, y: 0 };
+        }
+        this.pos.x = uni.getStorageSync("posLocationX");
+        this.pos.y = uni.getStorageSync("posLocationY");
+    },
     onShow() {
         if (uni.getStorageSync("userId")) {
             this.getperSonInfo();
@@ -311,6 +366,7 @@ export default {
             this.getWarnList();
             this.showModle = true;
             this.isIniTenMinutes = true;
+            this.showService = true;
         }
         // 配置服务器
         let selectedService = uni.getStorageSync("sercviceChoice");
@@ -386,7 +442,7 @@ export default {
 }
 
 .right {
-    z-index: 99;
+    z-index: 2;
     padding-right: 100rpx;
 }
 
@@ -484,23 +540,6 @@ export default {
     height: 28rpx;
 }
 
-.bottom button {
-    all: unset;
-    margin: 0;
-    padding: 0;
-    border: none;
-    background: none;
-    font: inherit;
-    text-align: inherit;
-    line-height: normal;
-    outline: none;
-    box-shadow: none;
-    -webkit-appearance: none;
-    margin-left: 6rpx;
-    color: #a1aab4;
-    font-size: 28rpx;
-}
-
 .bot_version {
     opacity: 0.4;
     position: absolute;
@@ -615,7 +654,84 @@ export default {
     line-height: 40rpx;
     white-space: nowrap;
 }
+.movable-area {
+    position: fixed;
+    width: 100%;
+    height: 80%;
+}
 
+.movable-button {
+    display: flex;
+    justify-content: center;
+    z-index: 999;
+    align-items: center;
+    width: 80rpx;
+    height: 80rpx;
+}
+
+.movable-button .icon {
+    pointer-events: none;
+    width: 80rpx;
+    height: 80rpx;
+}
+
+.movable-button .contact-btn {
+    position: absolute;
+    width: 80rpx;
+    height: 80rpx;
+    background: none;
+    border: none;
+    padding: 0;
+    top: 0;
+    left: 0;
+    z-index: 10;
+}
+
+/* 去掉伪元素 after 样式 */
+.movable-button .contact-btn::after,
+.movable-button .contact-btn::before,
+wx-button::after,
+wx-button::before {
+    content: none !important;
+    border: none !important;
+    background: transparent !important;
+    box-shadow: none !important;
+}
+
+.pulse {
+    position: absolute;
+    pointer-events: none;
+    top: 50%;
+    left: 50%;
+    width: 80rpx;
+    height: 80rpx;
+    border: 2px solid #ffd700; /* 黄色边框 */
+    border-radius: 50%;
+    transform: translate(-50%, -50%) scale(1);
+    opacity: 0.6;
+    animation: pulseAnim 2s ease-out infinite;
+    z-index: 4;
+}
+
+/* 第二个 pulse 动画延迟,产生连续效果 */
+.pulse:nth-child(2) {
+    animation-delay: 0.75s;
+}
+
+@keyframes pulseAnim {
+    0% {
+        transform: translate(-50%, -50%) scale(1);
+        opacity: 0.6;
+    }
+    70% {
+        transform: translate(-50%, -50%) scale(2);
+        opacity: 0;
+    }
+    100% {
+        transform: translate(-50%, -50%) scale(2);
+        opacity: 0;
+    }
+}
 /* 无限无缝滚动 */
 @keyframes scrollUp {
     0% {

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

@@ -113,7 +113,7 @@
                 class="title"
                 v-if="
                     devInfo.installPosition == 'Bedroom' ||
-                    (breathRate === 0 && breathRate !== '')
+                    (breathRate !== 0 && breathRate !== '')
                 "
             >
                 <view

+ 19 - 20
src/pagesA/playSetting/playSetting.vue

@@ -187,15 +187,24 @@
                 ></view>
             </view>
 
-            <view style="display: flex; margin: 20rpx auto"
-                ><input
-                    type="number"
-                    placeholder="请输入区域长"
-                    v-model="areaModLength" /><input
-                    type="number"
-                    placeholder="请输入区域宽"
-                    v-model="areaModleWidth"
-            /></view>
+            <view style="display: flex; margin: 20rpx auto">
+                <view style="display: flex">
+                    <text>长:</text>
+                    <input
+                        type="number"
+                        placeholder="请输入区域长"
+                        v-model="areaModLength"
+                    />
+                </view>
+                <view style="display: flex">
+                    <text>宽:</text>
+                    <input
+                        type="number"
+                        placeholder="请输入区域宽"
+                        v-model="areaModleWidth"
+                    />
+                </view>
+            </view>
             <view
                 style="
                     margin: 20rpx auto;
@@ -489,17 +498,6 @@ export default {
             this.areaModLeY = Math.round(
                 (this.devInfo?.yyEnd || 0) - event.currentTarget.offsetTop * 2
             );
-            console.log(
-                "拖动中:",
-                "left:",
-                this.areaModLeLeft,
-                "top:",
-                this.areaModLeTop,
-                "X:",
-                this.areaModLeX,
-                "Y:",
-                this.areaModLeY
-            );
         },
         onTouchStart(event) {
             this.startX = event.touches[0].clientX;
@@ -680,6 +678,7 @@ export default {
     border-radius: 12px;
 }
 .airCantInfo {
+    background-image: url("http://jkld.radar-power.com//uploadFiles/framework/file/20250620/toilet_bg.png");
     margin: 0 auto 0 auto;
     border: 18rpx solid #1f1f1f;
     position: relative;

+ 0 - 28
src/pagesA/survey/survey.vue

@@ -1,28 +0,0 @@
-<template>
-    <view class="container">
-        <!-- 使用绝对路径引用本地文件 -->
-        <web-view
-            src="https://radar-power.cn/device/detail?devId=1945297099374182401&clientId=806599CDE77C"
-        />
-    </view>
-</template>
-
-<script>
-export default {
-    data() {
-        return {
-            // 使用绝对路径引用 static 文件夹中的文件
-            surveyUrl: "",
-        };
-    },
-    onShow() {
-        console.log("surveyUrl:", this.surveyUrl); // 确保路径正确
-    },
-};
-</script>
-
-<style>
-.container {
-    height: 100%;
-}
-</style>

BIN
src/static/linkService.png


+ 2 - 2
src/utils/globalMqtt.js

@@ -83,7 +83,7 @@ export function createMqttData() {
     if (mqttDataConnected) return mqttClientData;
 
     const params = {
-        // keepalive: 60,
+        keepalive: 15,
         // clean: false,
         // connectTimeout: 1500,
         clientId: "xcx_mqtt_data1_" + uni.getStorageSync("userId") + "_" + Date.now(),
@@ -104,7 +104,7 @@ export function createMqttData() {
     mqttClientData = mqtt.connect("wxs://data.radar-power.cn/mqtt/", params);
 
     mqttClientData.on("connect", () => {
-        console.log("DATA MQTT 连接成功");
+        console.log("DATA MQTT 连接成功Global页面打印");
         mqttDataConnected = true;
         // uni.$emit("mqttData-ready", mqttClientData)
     });