HomeChildList.vue
6.61 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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
<template>
<div class="home_child_list home_child_list_yx">
<div class="stu_info" v-for="(item, index) in childList" :key="index" @click="handleStudentDetail(index)">
<div class="title">
<p>学生信息</p>
<button v-if="item.whiteFlag != 1 || item.isBing != 1" @click.stop="Certification(index)">激活认证</button>
</div>
<img v-if="item.whiteFlag == 1 && item.isBing == 1" class="img_auth" src="@/assets/home/auth.png" alt="" />
<img
class="code"
:class="item.whiteFlag == 1 && item.isBing == 1 ? 'code_auth' : ''"
@click.stop="handleCode(index)"
src="@/assets/code.png"
alt=""
/>
<div class="item">
<van-icon name="manager" /><span>{{ item.travelerName }}</span>
</div>
<div class="item">
<van-icon name="medal" /><span>{{ item.enrollYear }}</span>
</div>
<div class="item">
<van-icon name="wap-home" /><span>{{ item.schoolName }}</span>
</div>
</div>
<div class="add_btn" @click="addStudent">
<van-icon name="add" />
添加学生信息
</div>
<van-popup style="background: transparent" get-container="body" v-model="showAddChildPopupGroup">
<AddChildPopupGroup @complete="complete" :step="step" :travelerNum="travelerNum"></AddChildPopupGroup>
</van-popup>
</div>
</template>
<script>
import AddChildPopupGroup from '@/views/Home/component/AddChildPopupGroup'
export default {
props: {
parent: {
type: String,
default: '',
},
},
data() {
return {
showAddChildPopupGroup: false, //新增孩子弹出框
childList: [], //孩子列表
step: 1,
travelerNum: '',
}
},
mounted() {
this.getChildList()
},
methods: {
// 激活认证
Certification(index) {
this.step = 2
this.travelerNum = this.childList[index].travelerNum
this.showAddChildPopupGroup = true
},
// 点击浙学码
handleCode(index) {
if (this.childList[index].whiteFlag != 1 || this.childList[index].isBing != 1) {
this.$toast('请先激活认证')
return
}
localStorage.setItem('StudentDetialInfo', JSON.stringify(this.childList[index]))
this.$router.push({ name: 'ZXCode' })
},
// 进入学生详情页
handleStudentDetail(index) {
localStorage.setItem('StudentDetialInfo', JSON.stringify(this.childList[index]))
this.$router.push({ name: 'GrowUpRecord' })
},
// 获取孩子列表
getChildList() {
this.$toast.loading({
message: '加载中...',
duration: 0,
forbidClick: true,
})
let userInfo = localStorage.getItem('userInfo')
userInfo = JSON.parse(userInfo)
this.yxAxios.get(`${this.baseUrl}/prod/user/info/getPortalUserByNum?userNum=${userInfo?.centerNo}`).then((res) => {
this.$toast.clear()
if (res.data.code == 200) {
const userInfo = res.data.data.userInfo
this.childList = userInfo.subUsers
if (userInfo.schoolNames || userInfo.schoolNames == [] || userInfo.schoolNames == 'null') {
localStorage.setItem('schoolNames', JSON.stringify(userInfo.schoolNames))
this.$store.commit('changeSchool', userInfo.schoolNames)
// console.log('555',userInfo.schoolNames)
if (!localStorage.getItem('schoolNamesChoose')) {
localStorage.setItem('schoolNamesChoose', JSON.stringify(userInfo.schoolNames[0]))
}
} else {
localStorage.setItem('schoolNames', [])
this.$store.commit('changeSchool', [])
}
}
})
},
addStudent() {
this.step = 1
this.showAddChildPopupGroup = true
},
complete() {
this.showAddChildPopupGroup = false
this.getChildList()
},
},
components: {
AddChildPopupGroup,
},
}
</script>
<style lang="scss">
p {
margin: 0;
}
.home_child_list {
width: 100%;
padding: 16px 24px;
box-sizing: border-box;
.stu_info {
position: relative;
width: 100%;
height: 252px;
box-sizing: border-box;
padding: 24px 28px;
margin-bottom: 16px;
border-radius: 12px;
&:nth-of-type(2n) {
background: linear-gradient(47deg, #ff7371 0%, #fdd17c 100%);
box-shadow: 0px 4px 8px 0px rgba(254, 151, 117, 0.11);
}
&:nth-of-type(2n-1) {
background: linear-gradient(41deg, #316ff0 0%, #2afffb 100%);
box-shadow: 0px 4px 8px 0px rgba(37, 171, 255, 0.34);
}
.title {
// margin-top: 30px;
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 42px;
p {
font-size: 32px;
font-weight: bold;
color: #fff;
}
button {
color: #ffffff;
font-size: 20px;
height: 40px;
border-radius: 30px;
border: 0;
background: linear-gradient(137deg, #83b2ff 0%, #3c80ef 100%);
box-shadow: 0px 4px 8px 0px rgba(106, 154, 232, 0.5);
}
}
.img_auth {
position: absolute;
bottom: 0;
right: 0;
width: 196px;
}
.code {
position: absolute;
bottom: 50px;
right: 45px;
width: 72px;
}
.code_auth {
right: 240px;
}
.item {
display: inline-block;
margin-bottom: 24px;
color: #fff;
font-size: 28px;
span {
margin-left: 16px;
}
&:nth-of-type(2) {
margin-right: 60px;
}
&:last-of-type {
display: block;
}
}
}
.add_btn {
width: 100%;
box-sizing: border-box;
line-height: 96px;
border-radius: 16px;
border: 4px dashed #3074ff;
text-align: center;
font-size: 30px;
color: #3074ff;
}
}
// 柯桥个人中心红色主题
.home_child_list_kq {
.stu_info {
&:nth-of-type(2n) {
background: linear-gradient(47deg, #ff7371 0%, #fdd17c 100%);
box-shadow: 0px 4px 8px 0px rgba(254, 151, 117, 0.11);
}
&:nth-of-type(2n-1) {
background: linear-gradient(41deg, #f03131 0%, #ff90a8 100%);
box-shadow: 0px 4px 8px 0px rgba(37, 171, 255, 0.34);
}
}
.add_btn {
border-color: #f63837;
color: #f63837;
}
}
// 绍兴研学个人中心绿主题
.home_child_list_yx {
.stu_info {
&:nth-of-type(2n) {
background: linear-gradient(47deg, #ff7371 0%, #fdd17c 100%);
box-shadow: 0px 4px 8px 0px rgba(254, 151, 117, 0.11);
}
&:nth-of-type(2n-1) {
background: linear-gradient(41deg, rgb(56, 223, 162) 0%, rgb(132, 236, 205) 100%);
box-shadow: 0px 4px 8px 0px rgba(37, 255, 128, 0.34);
}
}
.add_btn {
border-color: rgb(56, 223, 162);
color: rgb(56, 223, 162);
}
}
</style>