lrf402788946 5 năm trước cách đây
mục cha
commit
aec1378763
3 tập tin đã thay đổi với 37 bổ sung11 xóa
  1. 1 1
      public/static/liveIndex.html
  2. 34 7
      src/views/hall/hallDetail.vue
  3. 2 3
      src/views/login.vue

+ 1 - 1
public/static/liveIndex.html

@@ -51,7 +51,7 @@
 <script language="javascript">
  function btnDirect() {
      var query = window.location.search.substring(1);
-     window.open('/platlive/direct?'+query)
+     window.open('../direct?'+query)
   }
 </script>
 </html>

+ 34 - 7
src/views/hall/hallDetail.vue

@@ -117,7 +117,6 @@ export default {
     info: {},
     buyerList: [],
     sellerList: [],
-    sending: true,
     text: '',
   }),
   created() {
@@ -145,9 +144,9 @@ export default {
         this.$message.error('游客不能发言,请先注册');
         return;
       }
-      this.$set(this, `sending`, false);
+      if (!this.checkUser()) return;
       if (this.content != '') {
-        let object = { number: this.id, sender_name: this.user.name, content: this.content };
+        let object = { number: this.id, sender_name: this.user.name, content: this.content, role: this.user.role };
         if (this.user.uid) object.sender_id = this.user.uid;
         let res = await this.create(object);
         this.$refs.editor.setContent();
@@ -155,7 +154,6 @@ export default {
         this.$forceUpdate();
         this.$checkRes(res, null, res.errmsg || '发言失败');
       } else this.$message.error('请输入信息后发送');
-      this.$set(this, `sending`, true);
     },
     channel() {
       this.$stomp({
@@ -167,15 +165,44 @@ export default {
       let body = _.get(message, 'body');
       if (body) {
         body = JSON.parse(body);
-        let is_seller = this.sellerList.find(f => f.user_id == body.sender_id);
-        if (is_seller) this.mainTalk.push({ id: body._id, sender_name: body.sender_name, send_time: body.send_time, content: body.content });
-        else this.otherTalk.push({ id: body._id, sender_name: body.sender_name, send_time: body.send_time, content: body.content });
+        if (body.role == '5' || body.role == '1')
+          this.mainTalk.push({ id: body._id, sender_name: body.sender_name, send_time: body.send_time, content: body.content });
+        else {
+          let is_seller = this.sellerList.find(f => f.user_id == body.sender_id);
+          if (is_seller) this.mainTalk.push({ id: body._id, sender_name: body.sender_name, send_time: body.send_time, content: body.content });
+          else this.otherTalk.push({ id: body._id, sender_name: body.sender_name, send_time: body.send_time, content: body.content });
+        }
         this.$nextTick(() => {
           document.getElementById('chatBuy').scrollTop = document.getElementById('chatBuy').scrollHeight + 150;
           document.getElementById('chatSell').scrollTop = document.getElementById('chatSell').scrollHeight + 150;
         });
       }
     },
+    checkUser() {
+      let result = true;
+      if (this.user.role == '5' || this.user.role == '1') return result;
+      else {
+        let res = this.buyerList.find(f => f.user_id == this.user.uid);
+        if (!res) {
+          res = this.sellerList.find(f => f.user_id == this.user.uid);
+          if (!res) {
+            this.$message.error('您没有参与这场对接会,无法发言');
+            result = false;
+          } else {
+            if (res.status != '1') {
+              this.$message.error('您没有通过审核,无法发言');
+              result = false;
+            }
+          }
+        } else {
+          if (res.status != '1') {
+            this.$message.error('您没有通过审核,无法发言');
+            result = false;
+          }
+        }
+      }
+      return result;
+    },
   },
   computed: {
     ...mapState(['user']),

+ 2 - 3
src/views/login.vue

@@ -27,11 +27,10 @@ export default {
     ...login({ toLogin: 'login' }),
     async submitLogin(form) {
       let res = await this.toLogin({ user: form });
-      console.log(res);
       if (res.uid) {
-        if (res.role == 2 || res.role == 3) this.$router.push('/');
+        if (res.role == '2' || res.role == '3') this.$router.push('/market/index');
+        else if (res.role == '5') this.$router.push('/hallList/index');
         else this.$router.push('/enterprise/enterprisejb');
-        // else window.location.href = 'http://free.liaoningdoupo.com/platlive/home.html';
       }
     },
     async submitRegister(forms) {