Pārlūkot izejas kodu

模拟考试改为不收费的

zhangyujun 3 gadi atpakaļ
vecāks
revīzija
3efbadf671
1 mainītis faili ar 15 papildinājumiem un 4 dzēšanām
  1. 15 4
      src/views/home/children/test/components/sujectOne.vue

+ 15 - 4
src/views/home/children/test/components/sujectOne.vue

@@ -9,7 +9,7 @@
 					</div>
 				</div>
 				<div class="max">
-					<div class="icon-box" v-for="(item, index) in testObj.center" :key="index" @click="vipClick(item, index)">
+					<div class="icon-box" v-for="(item, index) in testObj.center" :key="index" @click="centerClick(item, index)">
 						<m-icon :type="item.icon" isSvg />
 						<span>{{ item.name }}</span>
 					</div>
@@ -29,13 +29,24 @@
 <script lang="ts" setup>
 import { RouterBus } from "@/hooks";
 import { Dialog } from "vant";
-import store from "@/store"
+import store from "@/store";
 const props = defineProps(["query"]);
 const {
 	router: { push },
 } = new RouterBus();
+const centerClick = (item: any, index: number) => {
+	switch (index) {
+		case 0:
+			vipClick(item, index);
+			break;
+		case 1:
+			push(item.route);
+			break;
+	}
+};
+
 const vipClick = (item: any, index: number) => {
-	if (index==0&&!store.getters.getIsVip) {
+	if (index == 0 && !store.getters.getIsVip) {
 		Dialog.confirm({
 			title: "温馨提示",
 			message: "请购买会员后使用",
@@ -43,7 +54,7 @@ const vipClick = (item: any, index: number) => {
 		}).then(() => {
 			push("/buyVip");
 		});
-		return
+		return;
 	}
 	push(item.route);
 };