ServiceKQ.vue
3.56 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
<template>
<service-basekq :centerNo="centerNo" v-if="showData"></service-basekq>
</template>
<script>
// import ServiceBaseKQ from './ServiceBaseKQ.vue'
import ServiceBasekq from './ServiceBaseKQ.vue'
// import vConsole from 'vconsole'
export default {
name: 'ServiceKQ',
data () {
return {
centerNo: '',
showData: false,
publicName: 'KQ',
appId: 'wx1305e88d2bc74073',
}
},
mounted () {
console.log('xst mounted')
// sessionStorage.setItem('publicName', this.publicName);
// sessionStorage.setItem('prePageQuery', JSON.stringify({ showTab: this.$route.query.showTab }));
// sessionStorage.setItem('prePage', 'Service' + this.publicName);
// sessionStorage.setItem('unionId', 'oJPmPuLaAx2x2DaRGfCFeYuLWzLU');
const sUserAgent = window.navigator.userAgent.toLowerCase()
alert(sUserAgent)
console.log(sUserAgent)
const dtdreamweb = sUserAgent.indexOf("dtdreamweb") > -1
const miniprogram = sUserAgent.indexOf("miniprogram") > -1 && sUserAgent.indexOf("alipay") > -1
if (dtdreamweb) {
alert('浙里办')
// window.location.href = `https://puser.zjzwfw.gov.cn/sso/mobile.do?action=oauth&scope=1&servicecode=hswsy`;
}
if (miniprogram) {
alert('支付宝')
// window.location.href = `https://puser.zjzwfw.gov.cn/sso/alipay.do?action=ssoLogin&servicecode=passp&goto=`;
}
sessionStorage.setItem('unionId', 'oJPmPuLaAx2x2DaRGfCFeYuLWzLU');
this.$nextTick(() => {
this.getUserInfo()
})
},
activated () {
console.log('KQ activated')
sessionStorage.setItem('publicName', this.publicName);
sessionStorage.setItem('prePageQuery', JSON.stringify({ showTab: this.$route.query.showTab }));
sessionStorage.setItem('prePage', 'Service' + this.publicName);
const sUserAgent = window.navigator.userAgent.toLowerCase()
console.log(sUserAgent)
const dtdreamweb = sUserAgent.indexOf("dtdreamweb") > -1
const miniprogram = sUserAgent.indexOf("miniprogram") > -1 && sUserAgent.indexOf("alipay") > -1
if (dtdreamweb) {
alert('浙里办')
// window.location.href = `https://puser.zjzwfw.gov.cn/sso/mobile.do?action=oauth&scope=1&servicecode=passp&goto=`;
}
if (miniprogram) {
alert('支付宝')
// window.location.href = `https://puser.zjzwfw.gov.cn/sso/alipay.do?action=ssoLogin&servicecode=passp&goto=`;
}
sessionStorage.setItem('unionId', 'oJPmPuLaAx2x2DaRGfCFeYuLWzLU');
this.$nextTick(() => {
this.getUserInfo()
})
},
methods: {
// 获取用户信息
getUserInfo () {
let userInfo = sessionStorage.getItem('userInfo');
let unionId = sessionStorage.getItem('unionId');
if (userInfo) {
userInfo = JSON.parse(userInfo)
this.centerNo = userInfo.centerNo
this.showData = true;
} else {
this.$toast.loading({
message: '加载中...',
duration: 0,
forbidClick: true
})
this.yxAxios.get(`${this.proxyUrl}/prod/api/wx/${this.appId}/getUserInfo?unionId=${unionId}`).then((res) => {
this.$toast.clear()
if (res.data.code == 200) {
this.centerNo = res.data.data.centerNo
this.showData = true
sessionStorage.setItem('userInfo', JSON.stringify(res.data.data))
} else {
console.log('getUserInfo失败')
this.showData = true;
// this.$router.push({ name: 'LoginPublic', query: { publicName: this.publicName } })
}
})
}
},
},
components: {
ServiceBasekq,
// ServiceBaseKQ
}
}
</script>