Browse Source

修复发送文字异常问题

yanqiliang 4 months ago
parent
commit
ebb14b8e58
2 changed files with 22 additions and 1 deletions
  1. 5 0
      dev-h5.out.log
  2. 17 1
      src/pages/myConsultRoom/page/treatment/treatment.vue

+ 5 - 0
dev-h5.out.log

@@ -69,3 +69,8 @@ uni-app 有新版本发布,请执行 `npx @dcloudio/uvm@latest` 更新,更
 18:03:15 [vite] hmr update /src/pages/myConsultRoom/page/treatment/treatment.vue?vue&type=style&index=0&scoped=e12e6417&lang.css
 18:03:23 [vite] hmr update /src/pages/myConsultRoom/page/treatment/treatment.vue?vue&type=style&index=0&scoped=e12e6417&lang.css
 18:05:51 [vite] hmr update /src/pages/myConsultRoom/page/treatment/treatment.vue
+18:10:34 [vite] hmr update /src/pages/tabBar/personalcenter/locList/locList.vue, /src/pages/tabBar/personalcenter/locList/locList.vue?vue&type=style&index=0&scoped=5bfe674c&lang.css
+18:10:54 [vite] hmr update /src/pages/tabBar/personalcenter/locList/locList.vue?vue&type=style&index=0&scoped=5bfe674c&lang.css
+18:13:52 [vite] hmr update /src/pages/tabBar/personalcenter/locList/locList.vue
+18:14:02 [vite] hmr update /src/pages/tabBar/personalcenter/locList/locList.vue?vue&type=style&index=0&scoped=5bfe674c&lang.css
+18:14:16 [vite] hmr update /src/pages/tabBar/personalcenter/locList/locList.vue

+ 17 - 1
src/pages/myConsultRoom/page/treatment/treatment.vue

@@ -531,6 +531,22 @@ export default {
             if (!this.ifOnLine()) {
                 return;
             }
+            const rawMessageValue = this.messageValue;
+            if (typeof rawMessageValue !== 'string' && typeof rawMessageValue !== 'number') {
+                uni.showToast({
+                    title: '发送内容异常',
+                    icon: 'none'
+                });
+                return;
+            }
+            const messageValue = String(rawMessageValue).trim();
+            if (!messageValue) {
+                uni.showToast({
+                    title: '发送内容不能为空',
+                    icon: 'none'
+                });
+                return;
+            }
             try {
                 this.setData(
                     {
@@ -540,7 +556,7 @@ export default {
                     () => {
                         const patientData = Cache.get('patientData');
                         const userData = Cache.get('userData');
-                        let { messageValueFun: messageValue, admType, help } = this;
+                        let { admType, help } = this;
                         let admID = patientData.admID;
                         let toUser = 'patient' + patientData.patID;
                         if (help) {