From 271ca6cb0ee2ff0a789bf74d1821e7891a7043bb Mon Sep 17 00:00:00 2001
From: inleft <inleft@qq.com>
Date: Tue, 30 Aug 2022 21:57:42 +0800
Subject: [PATCH] 自定义表情组件

---
 src/components/group/platformGroup.vue |   35 +++++++++++++++++++++++------------
 1 files changed, 23 insertions(+), 12 deletions(-)

diff --git a/src/components/group/platformGroup.vue b/src/components/group/platformGroup.vue
index 7b2393e..2830b59 100644
--- a/src/components/group/platformGroup.vue
+++ b/src/components/group/platformGroup.vue
@@ -1,13 +1,14 @@
 <template>
-
-	<a-tabs :defaultActiveKey="activeKey" :tabBarStyle="{'display': 'flex','justify-content': 'center'}">
-		<a-tab-pane key="1" tab="片刻">
+	
+	<a-tabs :defaultActiveKey="activeKey" @change="changeKey"
+		:tabBarStyle="{'display': 'flex','justify-content': 'center'}">
+		<a-tab-pane :key="keyType.type_1" tab="片刻">
 			<videoList v-on="$listeners" :activeKey="activeKey"></videoList>
 		</a-tab-pane>
-		<a-tab-pane key="2" tab="流影">
-			<photoShow :activeKey="activeKey"></photoShow>
+		<a-tab-pane :key="keyType.type_2" tab="流影">
+			<videoList v-on="$listeners" :activeKey="activeKey"></videoList>
 		</a-tab-pane>
-		<a-tab-pane key="3" tab="谱库">
+		<a-tab-pane :key="keyType.type_3" tab="谱库">
 			<photoShow :activeKey="activeKey"></photoShow>
 		</a-tab-pane>
 	</a-tabs>
@@ -17,11 +18,12 @@
 <script>
 	import videoList from "../mini/box14-video.vue"
 	import photoShow from "../mini/box18-photoShow.vue"
+	import myConstant from "../../config/myConstant.js"
 
 	export default {
 		components: {
 			videoList,
-			photoShow
+			photoShow,
 		},
 		created() {
 			this.getActiveKey()
@@ -35,17 +37,26 @@
 		},
 		methods: {
 			getActiveKey() {
-				if (this.$route.query.activeKey == "" || this.$route.query.activeKey == undefined) {
-					this.activeKey = this.defaultActiveKey;
-				} else {
+				if (this.$route.query.activeKey != "" && this.$route.query.activeKey != undefined) {
 					this.activeKey = this.$route.query.activeKey;
+				} else {
+					//随机三选一
+					var random = Math.floor(Math.random() * 10);
+					this.activeKey = random >= 8 ?
+						this.keyType.type_3 : (random <= 3 ? this.keyType.type_2 : this.keyType.type_1)
+						
+					this.$router.replace({query:{activeKey:this.activeKey}})
 				}
 			},
+			changeKey(key) {
+				this.activeKey = key
+				this.$router.replace({query:{activeKey:this.activeKey}})
+			}
 		},
 		data() {
 			return {
-				activeKey: "1",
-				defaultActiveKey: "1",
+				activeKey: "moment",
+				keyType: myConstant.activeKeyType
 			}
 		},
 

--
Gitblit v1.9.1