浏览代码

feat:"部分功能增加MQTT协议,修复邮箱注册失败问题"

soobin 2 周之前
父节点
当前提交
5da38f3b86

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "shenze-vue3-app",
-  "version": "1.5.723",
+  "version": "1.5.807",
   "private": true,
   "scripts": {
     "start": "vue-cli-service serve",

+ 2 - 2
public/version.json

@@ -1,5 +1,5 @@
 {
-  "version": "1.5.723",
-  "timestamp": "2025-07-23T09:29:41.838",
+  "version": "1.5.807",
+  "timestamp": "2025-08-07T15:34:19.125",
   "commitHash": "dev-build"
 }

+ 19 - 23
src/service/device/index.js

@@ -44,10 +44,7 @@ export function eliminate(params) {
 
 // 重启炉头/开启关闭炉头
 export function setFurnace(params) {
-  return axios.post(
-    `/SZWL-SERVER/tEquipment/onOff?${stringToUrl(params)}`,
-    params
-  );
+  return axios.post(`/SZWL-SERVER/tEquipment/powerOnOff`, params);
 }
 
 // 雪糕机机器复位
@@ -60,10 +57,7 @@ export function machineReset(params) {
 
 // 睡眠
 export function sleepEquipment(params) {
-  return axios.post(
-    `/SZWL-SERVER/tEquipment/sleep?${stringToUrl(params)}`,
-    params
-  );
+  return axios.post(`/SZWL-SERVER/tEquipment/switchSleep`, params);
 }
 
 // 远程开门
@@ -76,7 +70,7 @@ export function openDoor(params) {
 
 // 新版远程开门,包含内门外门
 export function Api_openDoor(params) {
-  return axios.get(`/SZWL-SERVER/tEquipment/openDoors`, { params });
+  return axios.post(`/SZWL-SERVER/tEquipment/newOpenDoor`, params);
 }
 
 // 纸币器禁能
@@ -94,10 +88,7 @@ export function deviceTuoji(params) {
 
 // 音量调解
 export function updateVolume(params) {
-  return axios.post(
-    `/SZWL-SERVER/tEquipment/updateVolume?${stringToUrl(params)}`,
-    params
-  );
+  return axios.post(`/SZWL-SERVER/tEquipment/changeVolume`, params);
 }
 
 // 获取商品下拉列表
@@ -107,16 +98,16 @@ export function selectProducts(params) {
   );
 }
 
-// 远程做糖
-export function doSugar(params) {
-  return axios.post(`/SZWL-SERVER/tSugarDo/doSugar`, params);
-}
-
 // 远程制作
 export function remoteProduction(params) {
   return axios.post(`/SZWL-SERVER/tSugarDo/remoteProduction`, params);
 }
 
+// 制作商品
+export function produceGoods(params) {
+  return axios.post(`/SZWL-SERVER/tEquipment/produceGoods`, params);
+}
+
 // 查询做糖状态
 export function selectSugarStatus(params) {
   return axios.get(
@@ -215,9 +206,9 @@ export function humidityParameters(params) {
 }
 
 // 启用物料监控
-export function enableMaterial(params) {
-  return axios.post(`/SZWL-SERVER/tParameters/enableMaterial`, params);
-}
+// export function enableMaterial(params) {
+//   return axios.post(`/SZWL-SERVER/tParameters/enableMaterial`, params);
+// }
 
 // 新物料监控开关
 export function changeMaterial(params) {
@@ -251,7 +242,7 @@ export function Api_getTApkInfo_updateApk(params) {
 
 // MQTT远程推送更新
 export function pushAppUpdate(params) {
-  return axios.post(`/SZWL-SERVER/tEquipment/pushAppUpdate`,  params);
+  return axios.post(`/SZWL-SERVER/tEquipment/pushAppUpdate`, params);
 }
 
 // 修改优惠码开关状态
@@ -280,6 +271,11 @@ export function newUpdateProductsShow(params) {
 }
 
 // 远程修改机器密码
+export function changePassword(params) {
+  return axios.post(`/SZWL-SERVER/tEquipment/changePassword`, params);
+}
+
+// 远程修改机器密码
 export function updateDevicePassword(params) {
   return axios.post(`/SZWL-SERVER/tEquipment/updatePassword`, params);
 }
@@ -352,7 +348,7 @@ export function updateLockStatus(params) {
 
 // 重启触摸屏
 export function restartScreen(params) {
-  return axios.get(`/SZWL-SERVER/tEquipment/openScreen`, { params });
+  return axios.get(`/SZWL-SERVER/tEquipment/restartScreen`, { params });
 }
 
 // 远程切换雪糕机工作模式

+ 21 - 62
src/views/device/deviceOper.vue

@@ -658,11 +658,7 @@
         </div>
       </div>
       <!-- 商品管理 -->
-      <div
-        v-if="user.type == 0"
-        class="operation-item"
-        @click="goodsManClk()"
-      >
+      <div v-if="user.type == 0" class="operation-item" @click="goodsManClk()">
         <div class="icon-wrapper">
           <img
             class="operation-icon"
@@ -693,10 +689,9 @@ import {
   setFurnace,
   sleepEquipment,
   // openDoor,
-  Api_openDoor,
+  // Api_openDoor,
   deviceTuoji,
   delOneDevice,
-  enableMaterial,
   updateLockStatus,
   restartScreen,
   machineReset,
@@ -912,24 +907,14 @@ export default {
       operCheckShow.value = true;
     };
     // 远程开门
-    /*    const openDoorFun = () => {
-          operType.value = 4;
-          operCheckShow.value = true;
-        }; */
     const openDoorFun = () => {
-      if (device.value.machineType === "2") {
-        operType.value = 4;
-        operCheckShow.value = true;
-      } else {
-        // router.push({ path: "openDoor", query: { deviceId: device.value.id } });
-        router.push({
-          path: "openDoor",
-          query: {
-            deviceId: device.value.id,
-            machineType: device.value.machineType,
-          },
-        });
-      }
+      router.push({
+        path: "openDoor",
+        query: {
+          deviceId: device.value.id,
+          machineType: device.value.machineType,
+        },
+      });
     };
     // 日志功能
     const viewLogs = () => {
@@ -995,7 +980,11 @@ export default {
     const changePasswordClk = () => {
       router.push({
         path: "devicePassword",
-        query: { deviceId: device.value.id, name: device.value.name },
+        query: {
+          deviceId: device.value.id,
+          name: device.value.name,
+          equimentType: device.value.equimentType,
+        },
       });
     };
     // 删除设备
@@ -1044,7 +1033,7 @@ export default {
           }
         } else {
           const { data } = await setFurnace({
-            equipmentId: device.value.id,
+            id: device.value.id,
             eqeStatus: 1,
           });
           if (data.code) {
@@ -1058,12 +1047,14 @@ export default {
       // 睡眠
       if (operType.value === 2) {
         const { data } = await sleepEquipment({
-          equipmentId: device.value.id,
-          eqeStatus: device.value.isSleep ? "0" : "1",
+          id: device.value.id,
+          isSleep: device.value.isSleep ? "0" : "1",
         });
         if (data.code) {
           showSuccessToast(t("device.sleepSuccessfully"));
-          operCheckShow.value = false;
+          setTimeout(() => {
+            operCheckShow.value = false;
+          }, 1500);
         } else {
           showFailToast(data.message);
         }
@@ -1072,7 +1063,7 @@ export default {
       if (operType.value === 3) {
         device.value.eqeStatus = clkOpenOrClose.value;
         const { data } = await setFurnace({
-          equipmentId: device.value.id,
+          id: device.value.id,
           eqeStatus: device.value.eqeStatus,
         });
         if (data.code) {
@@ -1089,20 +1080,6 @@ export default {
           showFailToast(data.message);
         }
       }
-      // 远程开门
-      if (operType.value === 4) {
-        const { data } = await Api_openDoor({
-          equipmentId: device.value.id,
-          type: 0,
-          status: 1,
-        });
-        if (data.code) {
-          showSuccessToast(t("device.remoteDoorOpeningSucceeded"));
-          operCheckShow.value = false;
-        } else {
-          showFailToast(data.message);
-        }
-      }
       // 系统脱机
       if (operType.value === 5) {
         const { data } = await deviceTuoji({
@@ -1130,24 +1107,6 @@ export default {
           showFailToast(t("device.deleteDeviceFailed"));
         }
       }
-      // 启用物料监控
-      if (operType.value === 7) {
-        let materialMonitorStatus = 0; // 0默认是未开启
-        // isMaterialUse是1时,物料监控已启用,按钮是关闭功能
-        if (device.value.isMaterialUse === "1") {
-          materialMonitorStatus = 1; // 1代表已开启
-        }
-        const { data } = await enableMaterial({
-          equipmentId: device.value.id,
-          materialMonitorStatus,
-        });
-        if (data.code === "00000") {
-          showSuccessToast(t("device.enableMaterialSucceed"));
-          operCheckShow.value = false;
-        } else {
-          showFailToast(t("device.enableMaterialFailed"));
-        }
-      }
       // 远程锁机
       if (operType.value === 8) {
         const { data } = await updateLockStatus({

+ 33 - 18
src/views/device/devicePassword/index.vue

@@ -118,12 +118,12 @@
 
 <script>
 // 导入接口
-import { updateDevicePassword } from "@/service/device/index";
+import { updateDevicePassword, changePassword } from "@/service/device/index";
 import sHeader from "@/components/SimpleHeader";
 import { ref, reactive } from "@vue/reactivity";
 import { onMounted } from "@vue/runtime-core";
 import { useRoute, useRouter } from "vue-router";
-import { showNotify, showDialog, showConfirmDialog, showFailToast } from "vant";
+import { showNotify, showConfirmDialog, showFailToast, showSuccessToast } from "vant";
 import { useI18n } from "vue-i18n";
 export default {
   components: {
@@ -142,6 +142,7 @@ export default {
     const checkAmdinPwd = ref();
     const guestPwd = ref();
     const checkGuestPwd = ref();
+    const equimentType = ref(route.query.equimentType || "");
 
     const validator = (val) => /\w{6,}/.test(val);
     const themeVars = {
@@ -200,23 +201,37 @@ export default {
         // title: "提示",
         message: t("device.editCheck"),
       }).then(() => {
-        console.log(passwordForm);
-        updateDevicePassword({
-          equipmentId: passwordForm.equipmentId,
-          adminPwd: passwordForm.adminPwd,
-          guestPwd: passwordForm.guestPwd,
-        }).then((res) => {
-          if (res.data.code == "A0001") {
-            showFailToast(t("device.unknownError"));
-            return;
-          }
-          showDialog({
-            message: t("device.modificationSucceeded"),
-          }).then(() => {
-            //返回上一页
-            router.go(-1);
+        if (equimentType.value == "SBM10") {
+          changePassword({
+            id: passwordForm.equipmentId,
+            adminPwd: passwordForm.adminPwd,
+            guestPwd: passwordForm.guestPwd,
+          }).then((res) => {
+            if (res.data.code == "00000") {
+              showSuccessToast(t("device.modificationSucceeded"));
+              setTimeout(() => {
+                router.go(-1);
+              }, 1500);
+            } else {
+              showFailToast(res.data.message);
+            }
           });
-        });
+        } else {   
+          updateDevicePassword({
+            equipmentId: passwordForm.equipmentId,
+            adminPwd: passwordForm.adminPwd,
+            guestPwd: passwordForm.guestPwd,
+          }).then((res) => {
+            if (res.data.code == "00000") {
+              showSuccessToast(t("device.modificationSucceeded"));
+              setTimeout(() => {
+                router.go(-1);
+              }, 1500);
+            } else {
+              showFailToast(res.data.message);
+            }
+          });
+        }
       });
     };
 

+ 1 - 1
src/views/device/deviceSearch.vue

@@ -56,7 +56,7 @@
               <van-col span="12"> 
                 <van-field
                   label-width="66"
-                  v-model="vText"
+                  v-model="isAbroadText"
                   is-link
                   readonly
                   :label="$t('device.isAbroad')"

+ 36 - 16
src/views/device/doSugar.vue

@@ -162,6 +162,7 @@ import {
   getDeviceDetal,
   selectProducts,
   remoteProduction,
+  produceGoods,
   selectSugarStatus,
 } from "@/service/device";
 import {
@@ -296,6 +297,10 @@ export default {
       }
     };
     const submitDoSugar = async () => {
+      if (fieldValue.value === "") {
+        showToast(t("device.pleaseSelectAPattern"));
+        return;
+      }
       const makeCodes = ref([1, 0, 0]);
       doSugartData.value = null;
       doSugartType.value = true;
@@ -335,28 +340,43 @@ export default {
           fieldValue.value = iceName.value + "(" + fieldValue.value + ")";
         }
       }
-      if (fieldValue.value === "") {
-        showFailToast(t("device.pleaseSelectAPattern"));
-        return;
-      }
       showConfirmDialog({
         title: t("user.tips"),
         message: t("device.confirmMake") + fieldValue.value + "?",
       })
         .then(async () => {
-          const { data } = await remoteProduction({
-            equipmentId: deviceId,
-            productName: fieldValue.value,
-            makeCodes: makeCodes.value.join(","),
-            productNo: productNo.value,
-          });
-          if (data.code == "00000") {
-            doSugartData.value = data.data;
-            setTimeout(() => {
-              doSugartType.value = false;
-            }, 5000);
+          if (deviceDetal.value.equimentType == "SBM10") {
+            await produceGoods({
+              equipmentId: deviceId,
+              productName: fieldValue.value,
+              makeCodes: makeCodes.value.join(","),
+              productNo: productNo.value,
+            }).then((data) => {
+              if (data.data.code == "00000") {
+                doSugartData.value = data.data.data;
+                setTimeout(() => {
+                  doSugartType.value = false;
+                }, 5000);
+              } else {
+                showFailToast(data.data.message);
+              }
+            });
           } else {
-            showFailToast(data.message);
+            await remoteProduction({
+              equipmentId: deviceId,
+              productName: fieldValue.value,
+              makeCodes: makeCodes.value.join(","),
+              productNo: productNo.value,
+            }).then((data) => {
+              if (data.data.code == "00000") {
+                doSugartData.value = data.data.data;
+                setTimeout(() => {
+                  doSugartType.value = false;
+                }, 5000);
+              } else {
+                showFailToast(data.data.message);
+              }
+            });
           }
         })
         .catch((error) => {

+ 9 - 11
src/views/device/index.vue

@@ -1012,14 +1012,14 @@ export default {
       })
         .then(async () => {
           const { data } = await sleepEquipment({
-            equipmentId: item.id,
-            eqeStatus: item.isSleep ? "0" : "1",
+            id: item.id,
+            isSleep: item.isSleep ? "0" : "1",
           });
           if (data.code) {
             showSuccessToast(t("device.changeSleepSuccess"));
             setTimeout(() => {
               init();
-            }, 1000);
+            }, 1500);
           } else {
             showFailToast(data.message);
           }
@@ -1037,14 +1037,14 @@ export default {
       })
         .then(async () => {
           const { data } = await setFurnace({
-            equipmentId: id,
+            id: id,
             eqeStatus: 1,
           });
           if (data.code) {
             showSuccessToast(t("device.restartSucceeded"));
             setTimeout(() => {
-              router.go(0);
-            }, 1000);
+              init();
+            }, 1500);
           } else {
             showFailToast(data.message);
           }
@@ -1055,8 +1055,6 @@ export default {
     };
     // 开启/关闭炉头
     const openCloseHead = (id, status) => {
-      // console.log("id", id);
-      // console.log("status", status);
       showConfirmDialog({
         title: t("user.tips"),
         message:
@@ -1066,7 +1064,7 @@ export default {
       })
         .then(async () => {
           const { data } = await setFurnace({
-            equipmentId: id,
+            id: id,
             eqeStatus: status,
           });
           if (data.code) {
@@ -1075,8 +1073,8 @@ export default {
                 t("device.success")
             );
             setTimeout(() => {
-              router.go(0);
-            }, 1000);
+              init();
+            }, 1500);
           } else {
             showFailToast(data.message);
           }

+ 1 - 1
src/views/device/jam/index.vue

@@ -23,7 +23,7 @@
             fit="cover"
             class="jam-image"
           />
-          <h3 class="jam-title">{{ jam.name }}</h3>
+          <h3 class="jam-title">{{ jam.productName }}</h3>
         </div>
         <!-- 操作按钮组 -->
         <div class="jam-actions">

+ 19 - 16
src/views/device/modulation.vue

@@ -46,7 +46,7 @@ import { onMounted, ref } from "vue";
 import sHeader from "@/components/SimpleHeader";
 import { useRoute, useRouter } from "vue-router";
 import { getDeviceDetal, updateVolume } from "@/service/device";
-import { showFailToast, showDialog } from "vant";
+import { showFailToast, showConfirmDialog, showSuccessToast } from "vant";
 import { useI18n } from "vue-i18n";
 // import { styleUrl } from "../../common/js/utils";
 
@@ -78,22 +78,25 @@ export default {
       }
     };
     // 音量调节保存
-    const volumeChange = async () => {
-      const { data } = await updateVolume({
-        id: deviceId,
-        volume: volume.value.toString(),
-      });
-      if (data.code) {
-        showDialog({
-          confirmButtonColor: "#2c87c8",
-          message: t("device.sentSuccessfully"),
-        }).then(() => {
-          //返回上一页
-          router.go(-1);
+    const volumeChange =  () => {
+      showConfirmDialog({
+        title: t("device.openRemind"),
+        message: t("device.editCheck"),
+      }).then(async () => {
+        const { data } = await updateVolume({
+          id: deviceId,
+          volume: volume.value.toString(),
         });
-      } else {
-        showFailToast(data.message);
-      }
+        console.log(data);
+        if (data.code === "00000") {
+          showSuccessToast(t("device.sentSuccessfully"));
+          setTimeout(() => {
+            router.go(-1);
+          }, 1500);
+        } else {
+          showFailToast(data.message);
+        }
+      });
     };
     return {
       deviceDetal,

+ 49 - 25
src/views/device/openDoor.vue

@@ -88,10 +88,16 @@
             <p class="door-status">
               {{ $t("device.status") }}:
               <span
-                :class="deviceDetal.isMaterialUse == '1' ? 'status-open' : 'status-closed'"
+                :class="
+                  deviceDetal.isMaterialUse == '1'
+                    ? 'status-open'
+                    : 'status-closed'
+                "
               >
                 {{
-                  deviceDetal.isMaterialUse == '1' ? $t("device.open") : $t("device.closed")
+                  deviceDetal.isMaterialUse == "1"
+                    ? $t("device.open")
+                    : $t("device.closed")
                 }}
               </span>
             </p>
@@ -107,7 +113,13 @@
       </div>
 
       <!-- 纸币器禁能开关 -->
-      <div class="door-item" v-if="(machineType == '0' || deviceDetal.equimentType	 == 'P30') && (user.ifForegin == '1' || user.type == '0')">
+      <div
+        class="door-item"
+        v-if="
+          (machineType == '0' || deviceDetal.equimentType == 'P30') &&
+          (user.ifForegin == '1' || user.type == '0')
+        "
+      >
         <div class="door-info">
           <div class="door-detail">
             <h3 class="door-title">{{ $t("device.banPaper") }}</h3>
@@ -138,8 +150,13 @@
 <script>
 import { onMounted, ref } from "vue";
 import sHeader from "@/components/SimpleHeader";
-import { useRoute } from "vue-router";
-import { getDeviceDetal, Api_openDoor, banMoney, enableMaterial, changeMaterial } from "@/service/device";
+import { useRoute, useRouter } from "vue-router";
+import {
+  getDeviceDetal,
+  Api_openDoor,
+  banMoney,
+  changeMaterial,
+} from "@/service/device";
 import { showFailToast, showToast, showConfirmDialog } from "vant";
 import { useI18n } from "vue-i18n";
 import { getLoginUser } from "../../common/js/utils";
@@ -148,6 +165,7 @@ export default {
   setup() {
     const user = getLoginUser();
     const route = useRoute();
+    const router = useRouter();
     const deviceId = route.query.deviceId;
     const machineType = route.query.machineType;
     const deviceDetal = ref({});
@@ -187,16 +205,18 @@ export default {
         message: t("device.openRemindOut"),
       }).then(() => {
         Api_openDoor({
-          equipmentId: deviceDetal.value.id,
-          type: 0,
+          id: deviceDetal.value.id,
+          type: "0",
           status: outDoor,
         }).then((res) => {
           if (res.data.code == "00000") {
             showToast(t("device.sentSuccessfully"));
+            setTimeout(() => {
+              router.go(-1);
+            }, 1500);
+          } else {
+            showFailToast(res.data.message);
           }
-          setTimeout(() => {
-            getDeviceDetalFun();
-          }, 1500);
         });
       });
     };
@@ -208,16 +228,18 @@ export default {
         message: t("device.openRemindIn"),
       }).then(() => {
         Api_openDoor({
-          equipmentId: deviceDetal.value.id,
-          type: 1,
+          id: deviceDetal.value.id,
+          type: "1",
           status: inDoor,
         }).then((res) => {
           if (res.data.code == "00000") {
             showToast(t("device.sentSuccessfully"));
+            setTimeout(() => {
+              router.go(-1);
+            }, 1500);
+          } else {
+            showFailToast(res.data.message);
           }
-          setTimeout(() => {
-            getDeviceDetalFun();
-          }, 1500);
         });
       });
     };
@@ -241,23 +263,25 @@ export default {
       });
     };
 
-    const materialChg = (isMaterialUse) => { 
+    const materialChg = (isMaterialUse) => {
+      console.log(deviceDetal.value.equimentType);
       showConfirmDialog({
         title: t("device.openRemind"),
         message: t("device.openRemindMaterial"),
-      }).then(() => {
-        deviceDetal.value.equimentType == 'SBM10' ? changeMaterial : enableMaterial({
+      }).then(async () => {
+        const { data } = await changeMaterial({
           equipmentId: deviceDetal.value.id,
           isMaterialUse: isMaterialUse ? "1" : "0",
-        }).then((res) => {
-          if (res.data.code == "00000") {
-            showToast(t("device.sentSuccessfully"));
-          }
+        });
+        if (data.code === "00000") {
+          showToast(t("device.sentSuccessfully"));
           setTimeout(() => {
-            getDeviceDetalFun();
+            router.go(-1);
           }, 1500);
-        });
-      })
+        } else {
+          showFailToast(data.message);
+        }
+      });
     };
 
     return {

+ 0 - 4
src/views/orderCenter/index.vue

@@ -779,10 +779,6 @@ export default {
     const reason = ref(""); // 投诉原因
     // 发送退款提醒短信
     const sentRefundMessage = async (row) => {
-      if (reason.value === "" || reason.value === null) {
-        showToast("请填写投诉原因");
-        return;
-      }
       const params = {
         id: row.id,
         customerPhone: customerPhone.value,

+ 3 - 11
src/views/register.vue

@@ -262,7 +262,8 @@
                 { required: true, message: $t('register.emailRequired') },
                 {
                   pattern:
-                    /^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/,
+                    // /^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/,
+                    /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/,
                   message: $t('register.emailInvalid'),
                 },
               ]"
@@ -313,8 +314,7 @@
               :rules="[
                 { required: true, message: $t('register.emailRequired') },
                 {
-                  pattern:
-                    /^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/,
+                  pattern: /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/,
                   message: $t('register.emailInvalid'),
                 },
               ]"
@@ -385,14 +385,6 @@
         >
           {{ $t("register.registerButton") }}
         </van-button>
-
-        <!-- 登录链接 -->
-        <!-- <div class="login-link">
-          <span>{{ $t("register.haveAccount") }}</span>
-          <span @click="goToLogin" class="link-text">{{
-            $t("register.loginNow")
-          }}</span>
-        </div> -->
       </van-form>
     </div>
   </div>