Home.vue
11.2 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
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
<template>
<div class="home">
<div class="infomation">
<div class="top">
<div>
<img class="head" :src="headImgUrl ? headImgUrl : defaultHead" alt="" />
<div class="right">
<!-- <p class="name">{{nicknameUser}}</p> -->
<div class="name">
<span>{{ nicknameUser }}</span>
<div class="school" v-show="schoolNamesChoose" @click="changeSchool">
{{ schoolNamesChoose.schoolName }}<img src="@/assets/Travel/change.png" />
</div>
</div>
<p class="phone">{{ phoneDesensitization(userInfo.phone, '*') }}</p>
</div>
</div>
<HomeScan v-if="!isWechat"></HomeScan>
</div>
</div>
<HomeOrder></HomeOrder>
<div class="function">
<!-- <div class="item" @click="handleYanxue">
<div class="left">
<van-icon class="icon" name="discount" />
<span>研学</span>
</div>
<van-icon name="arrow" />
</div>
<div class="item" @click="handleStars">
<div class="left">
<van-icon class="icon" name="star-o" />
<span>五星少年</span>
</div>
<van-icon name="arrow" />
</div> -->
<!-- <div class="item" @click="handleClearCache">
<div class="left">
<van-icon class="icon" name="user-circle-o" />
<span>清除缓存</span>
</div>
<van-icon name="arrow" />
</div> -->
<div class="item" @click="handelElder">
<div class="left">
<van-icon class="icon" name="friends-o" />
<span>长辈版</span>
</div>
<p>
{{ isElder ? '已开启' : '未开启' }}
<van-icon name="arrow" />
</p>
</div>
</div>
<HomeChildList v-if="showChildList"></HomeChildList>
<!-- <div class="cardPic" v-show='isShow'>
<div class="boxPic" @click="isShow = false">
<img style="width:100%;height:100%" src="../assets/coupon.png" />
</div>
</div> -->
<tabbar4 active="center"></tabbar4>
</div>
</template>
<script>
import HomeChildList from '@/views/Home/component/HomeChildList'
import HomeOrder from '@/views/Home/component/HomeOrder'
import HomeScan from '@/views/Home/component/HomeScan'
import Tabbar4 from '@/component/Tabbar4'
export default {
data() {
return {
centerNo: '',
userInfo: {
openId: '',
headImg: '',
nickName: '',
phone: '',
roleType: '',
time: '',
year: '',
studentName: '',
school: '',
},
nicknameUser: '',
headImgUrl: '',
defaultHead: require('@/assets/head.png'),
isShow: false,
isElder: false,
showChildList: false,
showSchool: false,
schoolNamesChoose: '',
isWechat: false,
}
},
mounted() {
this.$zwlogPvGlobal({ loadTime: new Date() })
this.$nextTick(() => {
this.$zwlogPvGlobal({ responseTime: new Date() })
})
const isElder = localStorage.getItem('isElder')
if (isElder) {
this.isElder = true
}
let schoolNamesChoose = localStorage.getItem('schoolNamesChoose')
if (schoolNamesChoose) {
this.schoolNamesChoose = JSON.parse(schoolNamesChoose)
}
let isWechat = localStorage.getItem('isWechat')
if (isWechat == 1) {
this.isWechat = true
}
this.centerNo = localStorage.getItem('centerNo')
this.getUserInfo()
this.againRZ()
},
computed: {
schoolNames() {
return this.$store.state.schoolName
},
},
methods: {
handleYanxue() {
this.$router.push({ name: 'YanxuePage' })
},
// 我的订单
handleOrder() {
this.$router.push({ name: 'ServiceOrderXST' })
},
// 集团认证
handleGroup() {
this.$toast('暂未开放,敬请期待!')
},
// 个人信息
handleMyInfo() {
this.$router.push({ name: 'HomeUserInfo' })
},
// 合伙人中心
handlePartner() {
this.$toast('暂未开放,敬请期待!')
// this.$router.push({ name: 'Partner' })
},
// 点击长辈版
handelElder() {
if (this.isElder) {
this.$dialog
.confirm({
title: '长辈版',
message: '超大字号,看的更清楚,长辈版,专为长辈设计',
confirmButtonColor: '#ee0a24',
confirmButtonText: '关闭长辈版模式',
})
.then(() => {
// on confirm
this.isElder = false
localStorage.removeItem('isElder')
this.$emit('setElder', false)
})
.catch(() => {
// on cancel
})
} else {
this.$dialog
.confirm({
title: '长辈版',
message: '超大字号,看的更清楚,长辈版,专为长辈设计',
confirmButtonColor: '#3385FF',
confirmButtonText: '开启长辈版模式',
})
.then(() => {
// on confirm
this.isElder = true
localStorage.setItem('isElder', 1)
this.$emit('setElder', true)
})
.catch(() => {
// on cancel
})
}
},
//五星少年
handleStars() {
this.$router.push({ name: 'stars' })
},
// 清除缓存
handleClearCache() {
this.$toast.loading({
message: '清除成功,正在重新登录',
duration: 1000,
forbidClick: true,
})
localStorage.removeItem('schoolNamesChoose')
localStorage.removeItem('schoolNames')
localStorage.removeItem('centerNo')
setTimeout(() => {
const sUserAgent = window.navigator.userAgent.toLowerCase()
const dtdreamweb = sUserAgent.indexOf('dtdreamweb') > -1
const miniprogram = sUserAgent.indexOf('miniprogram') > -1 && sUserAgent.indexOf('alipay') > -1
if (miniprogram) {
// alert('支付宝')
window.location.href = `https://puser.zjzwfw.gov.cn/sso/alipay.do?action=ssoLogin&servicecode=82a7a71edb794fc285895f9e33290ddc`
} else {
// alert('浙里办')
window.location.href = `https://puser.zjzwfw.gov.cn/sso/mobile.do?action=oauth&scope=1&servicecode=82a7a71edb794fc285895f9e33290ddc`
}
}, 1000)
},
// 获取用户信息
getUserInfo() {
// alert('getUserInfo:' + this.centerNo)
this.yxAxios.get(`${this.proxyUrl}/user/info/getPortalUserByNum?userNum=${this.centerNo}`).then((res) => {
console.log('getUserInfo', res)
if (res.data.code == 200) {
let userInfo = res.data.data.userInfo
this.userInfo = userInfo
localStorage.setItem('userInfo', JSON.stringify(userInfo))
if (userInfo.schoolNames || userInfo.schoolNames == [] || userInfo.schoolNames == 'null') {
userInfo.schoolNames = userInfo.schoolNames.filter((n) => n)
localStorage.setItem('schoolNames', JSON.stringify(userInfo.schoolNames))
this.$store.commit('changeSchool', userInfo.schoolNames)
if (!localStorage.getItem('schoolNamesChoose') || localStorage.getItem('schoolNamesChoose') == 'null') {
localStorage.setItem('schoolNamesChoose', JSON.stringify(userInfo.schoolNames[0]))
this.schoolNamesChoose = userInfo.schoolNames[0]
}
} else {
localStorage.setItem('schoolNames', [])
this.$store.commit('changeSchool', [])
}
}
this.showChildList = true
})
},
formatterTime(time) {
if (time) {
return time.split(' ')[0]
} else {
return ''
}
},
complete() {
this.getUserInfo()
},
//切换学校
changeSchool() {
this.$router.push({ name: 'schoolFollow' })
},
//集团回调关闭页面
closeJT() {
this.showSchool = false
this.getUserInfo()
},
//查看是否有集团认证
getRZ() {
// this.showSchool = true
this.$router.push({ name: 'schoolAttestation' })
},
//回跳重新认证
againRZ() {
let backRZ = localStorage.getItem('backRZ')
if (backRZ == 'true') {
this.showSchool = true
localStorage.setItem('backRZ', false)
}
},
/**手机号码脱敏处理
* @method phoneDesensitization
* @param {String} phone 需要处理的手机号码
* @param {String} char 脱敏替换的字符
* @return {String} 脱敏处理后的手机号码
*/
phoneDesensitization(phone, char) {
return phone.replace(/(\d{3})\d*(\d{4})/, `$1${new Array(5).join(char)}$2`)
},
},
components: {
Tabbar4,
HomeChildList,
HomeOrder,
HomeScan,
},
}
</script>
<style lang="scss" scoped>
.home {
width: 100%;
min-height: 100%;
background: #f8f8f8;
padding-bottom: 196px;
.infomation {
width: 100%;
height: 320px;
background: url('~@/assets/home/bg_kq.png');
background-size: 100%;
background-position: center;
.top {
display: flex;
align-items: center;
justify-content: space-between;
padding: 40px 28px;
> div {
display: flex;
}
.head {
width: 96px;
height: 96px;
border-radius: 50%;
overflow: hidden;
}
.right {
height: 96px;
margin-left: 24px;
color: #fff;
.name {
font-size: 33px;
font-weight: bold;
width: 100%;
margin-bottom: 15px;
display: flex;
.school {
max-width: 400px;
border-radius: 30px;
font-size: 26px;
font-weight: normal;
margin-left: 20px;
padding: 0 20px;
box-sizing: border-box;
background-color: #d82b2b;
display: flex;
align-items: center;
img {
width: 30px;
height: 30px;
margin-left: 5px;
}
}
}
.phone {
font-size: 26px;
}
}
}
}
.function {
background: #ffffff;
border-radius: 12px;
margin: 24px;
.item {
margin: 0 32px;
height: 96px;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 34px;
&:not(:first-of-type) {
border-top: 1px solid #e2e2e2;
}
.left {
display: flex;
align-items: center;
.icon {
font-size: 40px;
margin-right: 20px;
}
span {
font-size: 30px;
}
}
.pic {
display: flex;
align-items: center;
margin-right: 5px;
span {
font-size: 27px;
color: #333333;
}
img {
width: 30px;
height: 30px;
margin-right: 5px;
}
}
}
}
}
.boxPic {
width: 85vw;
height: 115vw;
margin: 10vh 7.5vw;
position: absolute;
top: 0;
z-index: 99;
}
.cardPic {
position: absolute;
top: 0;
width: 100vw;
height: 100vh;
background: #0000008a;
z-index: 99;
}
</style>
<style lang="scss">
.elder {
.home {
.infomation .top .right {
.name {
font-size: 44px;
}
.phone {
font-size: 44px;
}
}
.function .item .left span {
font-size: 40px;
}
}
}
</style>