category.vue
4.12 KB
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<template>
<div>
<div class="card" v-if="cateList.length != 0">
<!-- <div class="card_title">
<div>星期一</div>
<span>2021年3月12</span>
</div> -->
<div class="card_con" v-for="(v, i) in cateList" :key="i">
<div class="card_L"></div>
<div class="card_R">
<div class="card_R_text">
<div class="text_title">
{{ v.categoryName }}-
<span v-if="v.type == 1">青铜级</span>
<span v-if="v.type == 2">黄金级</span>
<span v-if="v.type == 3">铂金级</span>
</div>
<!-- <div class="text_grey">用时:20:21</div>
<div class="text_grey">错误:3题</div> -->
</div>
<div class="card_R_btn">
<div class="btn" @click="toAns(v)">答题</div>
</div>
</div>
</div>
</div>
<van-empty v-else description="暂无数据" />
</div>
</template>
<script>
export default {
data() {
return {
cateList: [],
};
},
methods: {
//获取类型
getType() {
this.yxAxios
.get(
`${this.kqUrl}/item/getItemCategory?travelerNum=` +
localStorage.getItem("travelerNum") +
"&type=" +
this.$route.query.type
)
.then((res) => {
if (res.data.code == 200) {
this.cateList = res.data.data;
} else {
this.$toast.fail(res.data.message);
}
});
},
//开始答题
toAns(val) {
this.$router.push({
name: "ans_question",
query: {
categoryId: val.itemCategoryId,
index: this.$route.query.index,
},
});
},
},
mounted() {
this.getType();
},
};
</script>
<style lang="scss" scoped>
.card {
padding: 3vw 5vw;
box-sizing: border-box;
.card_title {
display: flex;
align-items: center;
color: #333333;
font-size: 35px;
font-weight: 700;
margin: 20px 0;
span {
color: #999999;
font-size: 30px;
margin-left: 30px;
}
}
.card_con {
display: flex;
.card_L {
width: 5px;
margin-left: 5vw;
background-color: #f5f6fa;
}
.card_R {
width: 80%;
height: 210px;
margin: 50px 0 50px 10vw;
background-color: #f6f9fd;
padding: 30px;
box-sizing: border-box;
display: flex;
justify-content: space-between;
.card_R_text {
width: 80%;
display: flex;
align-content: space-between;
flex-wrap: wrap;
margin-left: 10px;
.text_title {
width: 100%;
font-size: 30px;
color: #333333;
}
.text_grey {
width: 100%;
font-size: 28px;
color: #999999;
}
}
.card_R_btn {
width: 25%;
display: flex;
align-items: center;
.btn {
width: 150px;
height: 60px;
background-color: #6673ff;
color: #fff;
font-size: 28px;
border-radius: 28px;
display: flex;
align-items: center;
justify-content: center;
letter-spacing: 2px;
}
}
}
}
}
</style>