From f853349d1e0299d84d345e9fd2e7d4feccd32d52 Mon Sep 17 00:00:00 2001 From: fengerli <528575642@qq.com> Date: Fri, 19 Sep 2025 09:33:56 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9mqtt=E6=A0=B9=E6=8D=AE?= =?UTF-8?q?=E7=AB=AF=E5=8F=A3=E5=9C=B0=E5=9D=80=EF=BC=8C=E8=B5=B0ws?= =?UTF-8?q?=E6=88=96=E8=80=85wss=E5=8D=8F=E8=AE=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 4 +- src/layout/components/Navbar.vue | 2 +- src/utils/mqtt.ts | 100 +++++++------- src/views/system/user/index.vue | 223 +++++++++++-------------------- 4 files changed, 131 insertions(+), 198 deletions(-) diff --git a/.env.development b/.env.development index c6f3ed1..24e61f8 100644 --- a/.env.development +++ b/.env.development @@ -5,8 +5,8 @@ VITE_APP_TITLE = 云平台管理系统 VITE_APP_ENV = 'development' # 开发环境 - VITE_APP_BASE_API = 'http://47.120.79.150/backend' - #VITE_APP_BASE_API = 'http://192.168.2.23:8000' + #VITE_APP_BASE_API = 'https://fuyuanshen.com/backend' + VITE_APP_BASE_API = 'http://192.168.2.34:8000' #代永飞接口 #VITE_APP_BASE_API = 'http://457102h2d6.qicp.vip:24689' diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue index ebc30d0..c50d020 100644 --- a/src/layout/components/Navbar.vue +++ b/src/layout/components/Navbar.vue @@ -20,7 +20,7 @@
-
{{ useUserStore().nickname }}
+
{{ useUserStore().nickname }}
@@ -294,11 +239,9 @@ import { UserForm, UserQuery, UserVO } from '@/api/system/user/types'; import { DeptTreeVO, DeptVO } from '@/api/system/dept/types'; import { RoleVO } from '@/api/system/role/types'; import { PostQuery, PostVO } from '@/api/system/post/types'; -import { treeselect } from '@/api/system/dept'; import { globalHeaders } from '@/utils/request'; import { to } from 'await-to-js'; import { optionselect } from '@/api/system/post'; -import { hasPermi } from '@/directive/permission'; import { checkPermi } from '@/utils/permission'; const router = useRouter(); @@ -362,10 +305,7 @@ const initFormData: UserForm = { nickName: undefined, password: '', phonenumber: undefined, - email: undefined, - sex: undefined, status: '0', - remark: '', postIds: [], roleIds: [] }; @@ -402,13 +342,6 @@ const initData: PageData = { }, { pattern: /^[^<>"'|\\]+$/, message: '不能包含非法字符:< > " \' \\ |', trigger: 'blur' } ], - email: [ - { - type: 'email', - message: '请输入正确的邮箱地址', - trigger: ['blur', 'change'] - } - ], phonenumber: [ { pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, From bf1eb3ecbb0c491ec5aeba1545d2c0b915158e96 Mon Sep 17 00:00:00 2001 From: fengerli <528575642@qq.com> Date: Fri, 19 Sep 2025 10:56:49 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E5=88=97=E8=A1=A8=EF=BC=8C=E7=BC=96=E8=BE=91=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E4=B8=8D=E4=BF=AE=E6=94=B9=E5=9B=BE=E7=89=87=E4=B8=8D=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E4=BC=A0file=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/mqtt.ts | 11 ++++++++++- src/views/equipmentManagement/devices/index.vue | 9 +++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/utils/mqtt.ts b/src/utils/mqtt.ts index 6d0d528..cfac351 100644 --- a/src/utils/mqtt.ts +++ b/src/utils/mqtt.ts @@ -18,6 +18,8 @@ export interface SubscribeOptions { const getMqttConfig = () => { // 检测当前页面协议(http: 或 https:) const isHttps = window.location.protocol === 'https:'; + console.log(isHttps,'检测环境'); + return { // 自动切换协议:https页面用wss,http页面用ws protocol: isHttps ? 'wss' : 'ws', @@ -57,8 +59,15 @@ export function useMqtt() { error.value = null; try { + // 打印当前使用的配置(方便调试) + console.log('当前MQTT连接配置:', { + protocol: MQTT_CONFIG.protocol, + host: MQTT_CONFIG.host, + port: MQTT_CONFIG.port, + clientId: MQTT_CONFIG.clientId + }); client = new Paho.Client( - MQTT_CONFIG.host, + MQTT_CONFIG.host, MQTT_CONFIG.port, MQTT_CONFIG.clientId ); diff --git a/src/views/equipmentManagement/devices/index.vue b/src/views/equipmentManagement/devices/index.vue index 859fa42..3077778 100644 --- a/src/views/equipmentManagement/devices/index.vue +++ b/src/views/equipmentManagement/devices/index.vue @@ -737,11 +737,12 @@ const submitForm = async () => { // 处理图片字段 if (form.value.image instanceof File) { formData.append('file', form.value.image); - } else if (form.value.image && typeof form.value.image === 'string') { - // 如果是URL且需要转换为二进制 - const blob = await urlToBlob(form.value.image); - formData.append('file', blob, 'image.jpg'); // 添加文件名 } + // else if (form.value.image && typeof form.value.image === 'string') { + // // 如果是URL且需要转换为二进制 + // const blob = await urlToBlob(form.value.image); + // formData.append('file', blob, 'image.jpg'); // 添加文件名 + // } // 添加其他必要字段 const fields = ['id', 'deviceName', 'deviceType', 'remark']; fields.forEach((key) => {