From 6ab6b35fe3ac1ce90711e3555b19dde8ce1e21dc Mon Sep 17 00:00:00 2001 From: ZhangXianQiang <1135831638@qq.com> Date: 星期三, 26 六月 2024 17:43:12 +0800 Subject: [PATCH] feat:对接考试 --- src/views/home/components/user-panel/index.vue | 33 ++++++++++++++++++++------------- 1 files changed, 20 insertions(+), 13 deletions(-) diff --git a/src/views/home/components/user-panel/index.vue b/src/views/home/components/user-panel/index.vue index 443a832..228192f 100644 --- a/src/views/home/components/user-panel/index.vue +++ b/src/views/home/components/user-panel/index.vue @@ -20,7 +20,7 @@ </div> <div class="tool-container grid grid-cols-3 gap-10"> - <div class="tool-item text-center cursor-pointer" v-for="item in toolList"> + <div class="tool-item text-center cursor-pointer" v-for="item in toolList" @click="toolClick(item)"> <div class="tool-icon mb-1"> <img :src="item.iconPath" class="width-img" alt=""> </div> @@ -38,34 +38,41 @@ <script setup> import { ref, computed } from 'vue'; import randomColor from '@/utils/randomColor.js'; +import { useRouter } from 'vue-router'; + +const router = useRouter(); const toolList = ref([ { id: 1, - title: '璧勬簮鍏变韩', - iconPath: new URL('@/assets/icons/icon1.png', import.meta.url).href + title: '鍦ㄧ嚎鍩硅', + iconPath: new URL('@/assets/icons/icon1.png', import.meta.url).href, + path: '/train' }, { id: 2, - title: '鎴戠殑璇剧▼', - iconPath: new URL('@/assets/icons/icon2.png', import.meta.url).href + title: '鎴戠殑鑰冭瘯', + iconPath: new URL('@/assets/icons/icon2.png', import.meta.url).href, + path: '/exam-list' }, { id: 3, - title: '鎴戠殑璇剧▼', - iconPath: new URL('@/assets/icons/icon2.png', import.meta.url).href - }, - { - id: 4, - title: '鎴戠殑璇剧▼', - iconPath: new URL('@/assets/icons/icon2.png', import.meta.url).href + title: '鎴戠殑鎴愮哗', + iconPath: new URL('@/assets/icons/icon2.png', import.meta.url).href, + path: '/grade-list' }, ]); const getColor = computed(() => { return randomColor(); -}) +}); + +const toolClick = (item) => { + if (item.path) { + router.push(item.path); + } +} </script> -- Gitblit v1.8.0