Explorar o código

Added paththrow current meeting for pro and activating it.

Kain_Stropov %!s(int64=5) %!d(string=hai) anos
pai
achega
6b266ccadb

+ 2 - 2
app/Http/Controllers/ClientController.php

@@ -44,9 +44,9 @@ class ClientController extends Controller
         // else {
         //     return view('client/index');
         // }
-        $session = AppSession::where("session_key",$sessionKey);
+        $session = AppSession::where("session_key",$sessionKey)->first();
         $meeting = null;
-        if ($session->meetingPaticipant && $session->meetingParticipant->meeting->lobby_id === $lobby->id) {
+        if ($session->meetingParticipant && $session->meetingParticipant->meeting->lobby_id === $lobby->id) {
             $meeting = new MeetingModel($session->meetingParticipant->meeting);
         }
         return view('client/index',compact('lobbyModel','meeting'));

+ 6 - 1
app/Http/Controllers/MeetingCenterController.php

@@ -8,6 +8,7 @@ use Illuminate\Http\Request;
 use App\Models\Pro;
 use App\Models\AppSession;
 use App\HttpModels\ProModel;
+use App\HttpModels\MeetingWithLobbyModel;
 
 class MeetingCenterController extends Controller
 {
@@ -22,8 +23,12 @@ class MeetingCenterController extends Controller
 
         $appSession = AppSession::where("session_key",$sessionKey)->first();
         $user = new ProModel($appSession->pro);
+        $meeting = null;
+        if ($appSession->meetingParticipant) {
+            $meeting = new MeetingWithLobbyModel($appSession->meetingParticipant->meeting);
+        }
 
-        return view('mc', compact('page','user'));
+        return view('mc', compact('page','user','meeting'));
     }
 
 }

+ 1 - 1
app/HttpModels/MeetingWithLobbyModel.php

@@ -11,6 +11,6 @@ class MeetingWithLobbyModel extends MeetingModel {
     {
         parent::__construct($meeting);
 
-        $lobby = new ClientLobbyModel($meeting->lobby);
+        $this->lobby = new ClientLobbyModel($meeting->lobby);
     }
 }

+ 18 - 11
resources/js/components/pages/MeetingsAppRoot.vue

@@ -50,6 +50,9 @@ export default {
         userProp: {
             type: Object,
             required: true
+        },
+        meetingProp: {
+            type: Object
         }
     },
     data() {
@@ -99,26 +102,30 @@ export default {
         let lobbies = this.userProp.lobbies;
         delete this.userProp.lobbies;
 
-        this.$socket.emit("userData", { user: this.userProp })
+        this.$socket.emit("userData", { user: this.userProp });
 
         lobbies.map(lobby => {
-            lobby.selected_meeting = null
+            lobby.selected_meeting = null;
             lobby.meetings.map(meeting => {
-                meeting.active_members = []
-                meeting.pros_online = []
-            })
-        })
+                meeting.active_members = [];
+                meeting.pros_online = [];
+            });
+        });
 
-        this.$store.commit("setInitialUser", this.userProp)
-        this.$store.commit("setLobbies", lobbies)
+        if (this.meetingProp) {
+            this.$store.commit("setMeeting", this.meetingProp);
+        }
+
+        this.$store.commit("setInitialUser", this.userProp);
+        this.$store.commit("setLobbies", lobbies);
 
-        this.$socket.emit("lobbyDataRequest", lobbies)
+        this.$socket.emit("lobbyDataRequest", lobbies);
 
         this.sockets.subscribe("lobby-data", data => {
             for (let meeting of data.meetings) {
-                this.$store.commit("setLobbyActivity", meeting)
+                this.$store.commit("setLobbyActivity", meeting);
             }
-        })
+        });
     }
 };
 </script>

+ 1 - 0
resources/js/components/partials/LobbyList.vue

@@ -112,6 +112,7 @@ export default {
                     if (this.meeting.uid === lobby.selected_meeting.uid) {
                         this.$eventBus.$emit("meetingRejoin");
                     } else {
+                        lobby.selected_meeting.lobby = lobby;
                         this.$store.commit("setMeeting", lobby.selected_meeting);
                     }
                 },

+ 25 - 21
resources/js/components/partials/MeetingRoom.vue

@@ -143,27 +143,27 @@ export default {
             this.rowHeight = (windowHeight - this.gridPadding * (this.maxRows + 1)) / this.maxRows;
 
             //let cols = Math.ceil(Math.sqrt(this.videos.length));
-            let cols = 1
-            let rows = Math.ceil(this.videos.length / cols)
+            let cols = 1;
+            let rows = Math.ceil(this.videos.length / cols);
 
-            let elementsLastRow = this.videos.length % cols
-            let lastNormalIndex = this.videos.length - elementsLastRow
+            let elementsLastRow = this.videos.length % cols;
+            let lastNormalIndex = this.videos.length - elementsLastRow;
 
             if (elementsLastRow) {
-                this.maxCols = cols * elementsLastRow
+                this.maxCols = cols * elementsLastRow;
             } else {
-                this.maxCols = cols
+                this.maxCols = cols;
             }
 
             //let colsPerElement = this.maxCols / cols;
-            let rowsPerElement = this.maxRows / rows
+            let rowsPerElement = this.maxRows / rows;
 
-            let colsPerElement = 1
+            let colsPerElement = 1;
 
-            let colsLastRow = Math.ceil(this.maxCols / elementsLastRow)
+            let colsLastRow = Math.ceil(this.maxCols / elementsLastRow);
 
-            let cntX = 0
-            let cntY = 0
+            let cntX = 0;
+            let cntY = 0;
 
             for (let [index, video] of this.videos.entries()) {
                 video.i = index;
@@ -499,19 +499,23 @@ export default {
         });
 
         this.$eventBus.$on("leaveMeeting", () => {
-            $.ajax({
-                url: "/associate/meeting/leave",
-                method: "POST",
-                headers: {
-                    "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content")
-                },
-                error: jXhr => {
-                    console.error(getSingleError(jXhr));
-                }
-            });
+            // $.ajax({
+            //     url: "/associate/meeting/leave",
+            //     method: "POST",
+            //     headers: {
+            //         "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content")
+            //     },
+            //     error: jXhr => {
+            //         console.error(getSingleError(jXhr));
+            //     }
+            // });
             this.$store.dispatch("leaveMeeting");
             this.disconnect();
         });
+
+        if (this.meeting.uid) {
+            this.getToken();
+        }
     }
 };
 </script>

+ 4 - 1
resources/views/mc.blade.php

@@ -19,7 +19,10 @@
             <iframe src="{{ $page }}" frameborder="0" class="h-100 w-100"></iframe>
         </div>
         <div id="meetingsApp" class="pro col-3 border-left app-right-panel">
-            <meetings-app-root :user-prop="{!! str_replace('"','\'',str_replace('\'','\\\'',json_encode($user))) !!}"></meetings-app-root>
+            <meetings-app-root 
+                :user-prop="{!! str_replace('"','\'',str_replace('\'','\\\'',json_encode($user))) !!}"
+                :meeting-prop="{!! str_replace('"','\'',str_replace('\'','\\\'',json_encode($meeting))) !!}"
+                ></meetings-app-root>
         </div>
     </div>
     <script src="/AdminLTE-3.0.5/plugins/jquery/jquery.min.js"></script>