chooseSchoolOne.vue
3.8 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
<template>
<div class="cardBox">
<!-- <van-tabs v-model="tabsName" @change="tabsChange">
<van-tab title="小学"></van-tab>
<van-tab title="初中"></van-tab>
<van-tab title="高中"></van-tab>
</van-tabs> -->
<div class="card">
<div
:class="
[
'card_item',
tabsName == v.value ? 'item_check' : 'item_nocheck',
].join(' ')
"
v-for="(v, i) in typelist"
:key="i"
@click="tabsChange(v)"
>
{{ v.label }}
</div>
</div>
<div class="line"></div>
<div :class="[schoolList.length != 0 ? 'schoolCss' : '']">
<div
class="school-one"
v-for="(v, i) in schoolList"
:key="i"
@click="toActive(v)"
>
{{ v.name }}
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
tabsName: 1,
schoolList: [],
typelist: [
{ label: "幼儿园", value: 4 },
{ label: "小学", value: 1 },
{ label: "初中", value: 2 },
{ label: "高中", value: 3 },
],
};
},
watch: {
tabsName(val) {
this.schoolList = [];
this.getList();
},
},
methods: {
toActive(v) {
this.$router.push({
name: "achievementsOne",
query: { schoolId: v.num },
});
},
//切换
tabsChange(v) {
this.tabsName = v.value;
},
getList() {
this.yxAxios
.get(
`${this.kqUrl}/schoolConsult/schoolList?schoolType=` +
this.tabsName
)
.then((res) => {
if (res.data.code == 200) {
this.schoolList = res.data.data;
console.log(this.schoolList);
} else {
this.$toast.fail(res.data.message);
}
});
},
},
mounted() {
this.getList();
},
};
</script>
<style lang="scss" scoped>
.cardBox {
padding: 2vw 0;
box-sizing: border-box;
background: url("~@/assets/Travel/cardBox.png");
min-height: 100vh;
.card {
display: flex;
justify-content: space-between;
padding: 10px 5vw 20px;
box-sizing: border-box;
.card_item {
font-size: 4.3vw;
}
.item_check {
font-size: 4.4vw;
color: #fff;
}
.item_nocheck {
opacity: 0.5;
color: #fff;
}
}
.line {
width: 90vw;
border-bottom: 1px dashed #fff;
margin: 20px 5vw;
}
.schoolCss {
font-size: 4.5vw;
margin: 5vw;
padding: 0.5vw 4vw;
box-sizing: border-box;
border-radius: 20px;
background-color: #fff;
.school-one {
width: 100%;
margin: 6vw 0;
padding: 22px 0 22px 60px;
box-sizing: border-box;
letter-spacing: 0.3vw;
color: #666;
font-size: 4.3vw;
background: url("~@/assets/Travel/schoolBox.png");
-moz-background-size: 100% 100%;
background-size: 100% 100%;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1; //限制行数
overflow: hidden; //超出部分隐藏
text-overflow: ellipsis; //用一个省略号代替超出的内容
}
}
}
</style>