| 
					
				 | 
			
			
				@@ -6,6 +6,7 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           :card="el" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           :index="i" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           :isCaptain="isCaptain" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          :winner="winner" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           @statusChange="onStatusChange"></Card> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </div> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -24,10 +25,24 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   data() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     return { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       list: [], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      winnerList: [], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       isCaptain: false, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       code: '', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       ws: null, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      height: '20vh' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      height: '20vh', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      winner: '' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  watch: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    winner(val) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      if (val) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (val === 'unknow') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          alert('game over!') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          alert(`${val} is winner!`) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.ws.send(JSON.stringify({ code: this.code, status: 'over' })) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   created() { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -65,6 +80,9 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     onStatusChange(cardIndex, status) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       this.list[cardIndex].status = status 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       this.ws.send(JSON.stringify({ code: this.code, status: 'update' })) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      setTimeout(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.isOverHandle() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }, 500) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     createWebsocket() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       const ws = new WebSocket(process.env.VUE_APP_WS_URL) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -87,6 +105,33 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       ws.onclose = () => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         console.log('connection closed') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    isOverHandle() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      if (this.isCaptain) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      let blue = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      let red = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      let black = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this.list.forEach(el => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const { status, group } = el 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (status !== 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          if (group === 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            blue += 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          } else if (group === 2) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            red += 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          } else if (group === 3) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            black = 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      if (blue === 9) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.winner = 'blue' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } else if (red === 8) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.winner = 'red' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } else if (black === 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.winner = 'unknow' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -99,13 +144,13 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   .prevserve { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     height: 100%; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     transform-style: preserve-3d; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    perspective: 1000px; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    perspective-origin: 30% 30%; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    /* display: grid; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    perspective: 2000px; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    perspective-origin: 30% 50%; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    display: grid; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     grid-template-columns: repeat(5, 20%); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    grid-template-rows: repeat(5, 20%); */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    display: flex; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    flex-wrap: wrap; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    grid-template-rows: repeat(5, 20%); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /* display: flex; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    flex-wrap: wrap; */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   .item { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     width: 20vw; 
			 |