lrf402788946 hace 5 años
padre
commit
be0e10a71a

+ 6 - 5
src/components/parts/chat.vue

@@ -52,19 +52,20 @@ export default {
       if (this.$checkRes(res)) this.$set(this, `list`, _.reverse(res.data));
     },
     async send() {
-      if (!this.user.uid) {
-        this.$message.error('游客不能发言,请先注册');
-        return;
-      }
+      // if (!this.user.uid) {
+      //   this.$message.error('游客不能发言,请先注册');
+      //   return;
+      // }
       if (this.text != '') {
         let object = { sender_name: this.user.name, content: this.text };
-        if (this.user.id) object.sender_id = this.user.id;
+        if (this.user.uid) object.sender_id = this.user.uid;
         //TODO接口
         let res = await this.create(object);
         this.$checkRes(res, null, res.errmsg || '发言失败');
       } else this.$message.error('请输入信息后发送');
     },
     channel() {
+      console.log('in function:');
       this.$stomp({
         [`/exchange/public_chat`]: this.onMessage,
       });

+ 5 - 5
src/plugins/setting.js

@@ -2,16 +2,16 @@ import Vue from 'vue';
 
 Vue.config.weixin = {
   // baseUrl: process.env.BASE_URL + 'weixin',
-  baseUrl: `http://${location.host}/weixin`,
+  baseUrl: 'http://10.16.8.209:9005',
 };
 
 Vue.config.stomp = {
-  // brokerURL: 'ws://192.168.1.190:15674/ws',
+  // brokerURL: 'ws://http://free.liaoningdoupo.com/ws',
   brokerURL: '/ws', // ws://${location.host}/ws
   connectHeaders: {
-    host: 'smart',
-    login: 'web',
-    passcode: 'web123',
+    host: 'visit',
+    login: 'visit', //visit
+    passcode: 'visit', //visit123
   },
   // debug: true,
   reconnectDelay: 5000,

+ 4 - 4
src/views/hall/hallDetail.vue

@@ -142,10 +142,10 @@ export default {
     },
     async sendMessage() {
       this.$set(this, `sending`, false);
-      if (!this.user.uid) {
-        this.$message.error('游客不能发言,请先注册');
-        return;
-      }
+      // if (!this.user.uid) {
+      //   this.$message.error('游客不能发言,请先注册');
+      //   return;
+      // }
       if (this.content != '') {
         let object = { number: this.id, sender_name: this.user.name, content: this.content };
         if (this.user.uid) object.sender_id = this.user.uid;

+ 6 - 5
src/views/hall/parts/chat.vue

@@ -52,13 +52,14 @@ export default {
       if (this.$checkRes(res)) this.$set(this, `list`, _.reverse(res.data));
     },
     async send() {
-      if (!this.user.uid) {
-        this.$message.error('游客不能发言,请先注册');
-        return;
-      }
+      console.log('in function:');
+      // if (!this.user.uid) {
+      //   this.$message.error('游客不能发言,请先注册');
+      //   return;
+      // }
       if (this.text != '') {
         let object = { sender_name: this.user.name, content: this.text };
-        if (this.user.id) object.sender_id = this.user.id;
+        if (this.user.uid) object.sender_id = this.user.uid;
         //TODO接口
         let res = await this.create(object);
         this.$checkRes(res, null, res.errmsg || '发言失败');