1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
| <template>
| <div class="menu-container container mx-auto py-5">
| <div class="categroy-item mb-5" v-for="menu in menuList">
| <el-row class="mb-2">
| <div class="menu-title text-lg font-bold">{{ menu.name }}</div>
| </el-row>
| <el-row :gutter="20" class="mb-2">
| <el-col :span="3" v-for="item in menu.categroy">
| <div class="menu-item cursor-pointer" @click="menuClick(item)">
| <el-card shadow="hover" class="menu-card">
| <div class="item-icon mx-auto">
| <img :src="item.iconPath" class="icon-img" alt="">
| </div>
| <div class="item-title text-center">
| {{ item.title }}
| </div>
| </el-card>
| </div>
| </el-col>
| </el-row>
| </div>
|
| </div>
| </template>
|
| <script setup>
| import { ref } from 'vue';
| import { useRouter } from 'vue-router';
|
| const router = useRouter();
|
| const menuList = ref([
| {
| name: '课程',
| categroy: [
| {
| title: '在线培训',
| iconPath: new URL('@/assets/icons/icon2.png', import.meta.url).href,
| path: '/train'
| },
| {
| title: '教学资源',
| iconPath: new URL('@/assets/icons/icon1.png', import.meta.url).href,
| path: '/folder'
| },
| ]
| },
| {
| name: '考试',
| categroy: [
| {
| title: '我的考试',
| iconPath: new URL('@/assets/icons/icon2.png', import.meta.url).href,
| path: '/exam-list'
| },
| {
| title: '我的成绩',
| iconPath: new URL('@/assets/icons/icon1.png', import.meta.url).href,
| path: '/grade-list'
| },
| {
| title: '我的错题',
| iconPath: new URL('@/assets/icons/icon3.png', import.meta.url).href,
| path: '/wrong-list'
| },
| ]
| },
| ]);
|
| const menuClick = (item) => {
| if (item.path) {
| router.push(item.path);
| }
| };
| </script>
|
| <style lang="scss" scoped>
| @media (min-width: 1836px) {
| .container {
| max-width: 1724px;
| }
| }
|
| .menu-card {
| border-radius: 10px;
|
| &:hover {
| border: 1px solid #1890ff;
| }
| }
|
| .item-icon {
| width: 65%;
| }
|
| .icon-img {
| width: 100%;
| object-fit: cover;
| }
| </style>
|
|