Commit 52c5aa1e6629abe86cce14cf56410899383e885e
1 parent
67929349
Exists in
master
feat: 微信单点登录
Showing
4 changed files
with
44 additions
and
39 deletions
Show diff stats
src/views/Home/Home.vue
@@ -12,7 +12,7 @@ | @@ -12,7 +12,7 @@ | ||
12 | {{ schoolNamesChoose.schoolName }}<img src="@/assets/Travel/change.png" /> | 12 | {{ schoolNamesChoose.schoolName }}<img src="@/assets/Travel/change.png" /> |
13 | </div> | 13 | </div> |
14 | </div> | 14 | </div> |
15 | - <p class="phone">{{ userInfo.phone }}</p> | 15 | + <p class="phone">{{ phoneDesensitization(userInfo.phone,'*') }}</p> |
16 | </div> | 16 | </div> |
17 | </div> | 17 | </div> |
18 | <HomeScan></HomeScan> | 18 | <HomeScan></HomeScan> |
@@ -107,7 +107,6 @@ export default { | @@ -107,7 +107,6 @@ export default { | ||
107 | }, | 107 | }, |
108 | }, | 108 | }, |
109 | methods: { | 109 | methods: { |
110 | - | ||
111 | handleYanxue() { | 110 | handleYanxue() { |
112 | this.$router.push({ name: 'YanxuePage' }) | 111 | this.$router.push({ name: 'YanxuePage' }) |
113 | }, | 112 | }, |
@@ -205,10 +204,10 @@ export default { | @@ -205,10 +204,10 @@ export default { | ||
205 | this.userInfo = userInfo | 204 | this.userInfo = userInfo |
206 | localStorage.setItem('userInfo', JSON.stringify(userInfo)) | 205 | localStorage.setItem('userInfo', JSON.stringify(userInfo)) |
207 | if (userInfo.schoolNames || userInfo.schoolNames == [] || userInfo.schoolNames == 'null') { | 206 | if (userInfo.schoolNames || userInfo.schoolNames == [] || userInfo.schoolNames == 'null') { |
208 | - userInfo.schoolNames = userInfo.schoolNames.filter(n => n) | 207 | + userInfo.schoolNames = userInfo.schoolNames.filter((n) => n) |
209 | localStorage.setItem('schoolNames', JSON.stringify(userInfo.schoolNames)) | 208 | localStorage.setItem('schoolNames', JSON.stringify(userInfo.schoolNames)) |
210 | this.$store.commit('changeSchool', userInfo.schoolNames) | 209 | this.$store.commit('changeSchool', userInfo.schoolNames) |
211 | - if (!localStorage.getItem('schoolNamesChoose')||localStorage.getItem('schoolNamesChoose')=='null') { | 210 | + if (!localStorage.getItem('schoolNamesChoose') || localStorage.getItem('schoolNamesChoose') == 'null') { |
212 | localStorage.setItem('schoolNamesChoose', JSON.stringify(userInfo.schoolNames[0])) | 211 | localStorage.setItem('schoolNamesChoose', JSON.stringify(userInfo.schoolNames[0])) |
213 | this.schoolNamesChoose = userInfo.schoolNames[0] | 212 | this.schoolNamesChoose = userInfo.schoolNames[0] |
214 | } | 213 | } |
@@ -256,6 +255,15 @@ export default { | @@ -256,6 +255,15 @@ export default { | ||
256 | localStorage.setItem('backRZ', false) | 255 | localStorage.setItem('backRZ', false) |
257 | } | 256 | } |
258 | }, | 257 | }, |
258 | + /**手机号码脱敏处理 | ||
259 | + * @method phoneDesensitization | ||
260 | + * @param {String} phone 需要处理的手机号码 | ||
261 | + * @param {String} char 脱敏替换的字符 | ||
262 | + * @return {String} 脱敏处理后的手机号码 | ||
263 | + */ | ||
264 | + phoneDesensitization(phone, char) { | ||
265 | + return phone.replace(/(\d{3})\d*(\d{4})/, `$1${new Array(5).join(char)}$2`) | ||
266 | + }, | ||
259 | }, | 267 | }, |
260 | components: { | 268 | components: { |
261 | Tabbar4, | 269 | Tabbar4, |
src/views/Service/ServiceBaseKQ.vue
@@ -117,6 +117,7 @@ export default { | @@ -117,6 +117,7 @@ export default { | ||
117 | }, | 117 | }, |
118 | mounted () { | 118 | mounted () { |
119 | console.log('base mounted') | 119 | console.log('base mounted') |
120 | + // alert('servicebase show') | ||
120 | this.initService() | 121 | this.initService() |
121 | }, | 122 | }, |
122 | activated () { | 123 | activated () { |
src/views/Service/ServiceKQ.vue
@@ -27,17 +27,17 @@ export default { | @@ -27,17 +27,17 @@ export default { | ||
27 | let ticketId = this.common.getUrlParam('ticketId') //浙里办微信小程序访问 | 27 | let ticketId = this.common.getUrlParam('ticketId') //浙里办微信小程序访问 |
28 | // alert(location.href) | 28 | // alert(location.href) |
29 | // alert(ticketId) | 29 | // alert(ticketId) |
30 | - if (ticket) { | 30 | + if (ticket) { |
31 | this.getCenterByTicket(ticket) | 31 | this.getCenterByTicket(ticket) |
32 | } else if (ticketId) { | 32 | } else if (ticketId) { |
33 | // alert('getCenterByTicketId') | 33 | // alert('getCenterByTicketId') |
34 | this.getCenterByTicketId(ticketId) | 34 | this.getCenterByTicketId(ticketId) |
35 | - }else if (centerNo) { | 35 | + } else if (centerNo) { |
36 | // alert('有中台编号:' + centerNo) | 36 | // alert('有中台编号:' + centerNo) |
37 | this.centerNo = centerNo | 37 | this.centerNo = centerNo |
38 | localStorage.setItem('centerNo', centerNo) | 38 | localStorage.setItem('centerNo', centerNo) |
39 | this.getUserInfo() | 39 | this.getUserInfo() |
40 | - } else { | 40 | + } else { |
41 | const sUserAgent = window.navigator.userAgent.toLowerCase() | 41 | const sUserAgent = window.navigator.userAgent.toLowerCase() |
42 | const dtdreamweb = sUserAgent.indexOf('dtdreamweb') > -1 | 42 | const dtdreamweb = sUserAgent.indexOf('dtdreamweb') > -1 |
43 | const miniprogram = sUserAgent.indexOf('miniprogram') > -1 && sUserAgent.indexOf('alipay') > -1 | 43 | const miniprogram = sUserAgent.indexOf('miniprogram') > -1 && sUserAgent.indexOf('alipay') > -1 |
@@ -83,7 +83,7 @@ export default { | @@ -83,7 +83,7 @@ export default { | ||
83 | }, | 83 | }, |
84 | onFail: (err) => { | 84 | onFail: (err) => { |
85 | // alert('通过ticket获取centerNo失败:' + JSON.stringify(err)) | 85 | // alert('通过ticket获取centerNo失败:' + JSON.stringify(err)) |
86 | - console.log('通过ticket获取centerNo成功失败:', JSON.stringify(err)) | 86 | + console.log('通过ticket获取centerNo失败:', JSON.stringify(err)) |
87 | this.reLoad() | 87 | this.reLoad() |
88 | }, | 88 | }, |
89 | }) | 89 | }) |
@@ -104,32 +104,20 @@ export default { | @@ -104,32 +104,20 @@ export default { | ||
104 | ticket: ticketId, | 104 | ticket: ticketId, |
105 | }, | 105 | }, |
106 | onSuccess: (res) => { | 106 | onSuccess: (res) => { |
107 | - console.log('通过ticketId获取centerNo成功:', res) | ||
108 | - // alert('通过ticketId获取centerNo成功:' + res.data.message) | 107 | + // alert('通过ticketId获取centerNo Success:' + res.data.message) |
109 | if (res.data.code == 200) { | 108 | if (res.data.code == 200) { |
110 | - this.centerNo = res.data.message | 109 | + // this.centerNo = res.data.message |
111 | localStorage.setItem('centerNo', res.data.message) | 110 | localStorage.setItem('centerNo', res.data.message) |
112 | this.getUserInfo() | 111 | this.getUserInfo() |
112 | + } else { | ||
113 | + this.getUserInfo() | ||
113 | } | 114 | } |
114 | }, | 115 | }, |
115 | onFail: (err) => { | 116 | onFail: (err) => { |
116 | - // alert('通过ticket获取centerNo失败:' + JSON.stringify(err)) | ||
117 | - console.log('通过ticket获取centerNo成功失败:', JSON.stringify(err)) | 117 | + // alert('通过ticket获取centerNo Fail:' + JSON.stringify(err)) |
118 | // this.reLoad() | 118 | // this.reLoad() |
119 | }, | 119 | }, |
120 | }) | 120 | }) |
121 | - // this.yxAxios.get(`${this.proxyUrl}/api/zlb/auth/getCenterNoWx?ticket=${ticketId}`).then((res) => { | ||
122 | - // alert('res:', JSON.stringify(res)) | ||
123 | - // if (res.data.code == 200) { | ||
124 | - // this.centerNo = res.data.message | ||
125 | - // localStorage.setItem('centerNo', res.data.message) | ||
126 | - // this.getUserInfo() | ||
127 | - // } else { | ||
128 | - // alert('通过ticketId获取centerNo失败:' + JSON.stringify(res.data.message)) | ||
129 | - // console.log('通过ticket获取centerNo成功失败:', JSON.stringify(res.data.message)) | ||
130 | - // // this.reLoad() | ||
131 | - // } | ||
132 | - // }) | ||
133 | }, | 121 | }, |
134 | reLoad() { | 122 | reLoad() { |
135 | console.log('reload') | 123 | console.log('reload') |
@@ -152,6 +140,8 @@ export default { | @@ -152,6 +140,8 @@ export default { | ||
152 | }, | 140 | }, |
153 | // 获取用户信息 | 141 | // 获取用户信息 |
154 | getUserInfo: function() { | 142 | getUserInfo: function() { |
143 | + this.centerNo = localStorage.getItem('centerNo') | ||
144 | + // alert('getUserInfo:' + this.centerNo) | ||
155 | this.mgop({ | 145 | this.mgop({ |
156 | api: 'mgop.sz.hswsy.getPortalUserByNum', // 必须 | 146 | api: 'mgop.sz.hswsy.getPortalUserByNum', // 必须 |
157 | // host: 'https://mapi.zjzwfw.gov.cn/', | 147 | // host: 'https://mapi.zjzwfw.gov.cn/', |
@@ -162,16 +152,16 @@ export default { | @@ -162,16 +152,16 @@ export default { | ||
162 | // 'isTestUrl': '1' | 152 | // 'isTestUrl': '1' |
163 | }, | 153 | }, |
164 | data: { | 154 | data: { |
165 | - userNum: this.centerNo, | 155 | + userNum: localStorage.getItem('centerNo'), |
166 | }, | 156 | }, |
167 | onSuccess: (res) => { | 157 | onSuccess: (res) => { |
168 | - console.log('getUserInfo', res) | 158 | + // alert('getUserInfo success:' + JSON.stringify(res)) |
169 | if (res.data.code == 200) { | 159 | if (res.data.code == 200) { |
170 | localStorage.setItem('userInfo', JSON.stringify(res.data.data.userInfo)) | 160 | localStorage.setItem('userInfo', JSON.stringify(res.data.data.userInfo)) |
171 | } | 161 | } |
172 | }, | 162 | }, |
173 | onFail: (err) => { | 163 | onFail: (err) => { |
174 | - console.log('err', err) | 164 | + // alert('getUserInfo fail:' + JSON.stringify(err)) |
175 | }, | 165 | }, |
176 | }) | 166 | }) |
177 | }, | 167 | }, |
src/views/Service/component/aboutDes.vue
1 | <template> | 1 | <template> |
2 | - <p class="bottom_about_des">本服务由浙江政务服务网、柯桥区教育体育局提供<br>服务咨询热线:<span @click="call">400-826-2468</span></p> | 2 | + <p class="bottom_about_des"> |
3 | + 本服务由浙江政务服务网、柯桥区教育体育局提供<br />服务咨询热线: | ||
4 | + <a href="tel:400-826-2468">400-826-2468</a> | ||
5 | + <!-- <span @click="call">400-826-2468</span> --> | ||
6 | + </p> | ||
3 | </template> | 7 | </template> |
4 | <script> | 8 | <script> |
5 | export default { | 9 | export default { |
6 | methods: { | 10 | methods: { |
7 | - call () { | 11 | + call() { |
8 | ZWJSBridge.phoneCall({ | 12 | ZWJSBridge.phoneCall({ |
9 | - "corpId": "400-826-2468" | ||
10 | - }).then(res => { | ||
11 | - console.log(res) | ||
12 | - }).catch(err => { | ||
13 | - console.log(err) | 13 | + corpId: '400-826-2468', |
14 | }) | 14 | }) |
15 | - } | ||
16 | - } | 15 | + .then((res) => { |
16 | + console.log(res) | ||
17 | + }) | ||
18 | + .catch((err) => { | ||
19 | + console.log(err) | ||
20 | + }) | ||
21 | + }, | ||
22 | + }, | ||
17 | } | 23 | } |
18 | </script> | 24 | </script> |
19 | <style lang="scss"> | 25 | <style lang="scss"> |
@@ -22,7 +28,7 @@ export default { | @@ -22,7 +28,7 @@ export default { | ||
22 | text-align: center; | 28 | text-align: center; |
23 | padding: 40px; | 29 | padding: 40px; |
24 | 30 | ||
25 | - span{ | 31 | + a,span { |
26 | color: rgb(41, 122, 189); | 32 | color: rgb(41, 122, 189); |
27 | } | 33 | } |
28 | } | 34 | } |
@@ -33,4 +39,4 @@ export default { | @@ -33,4 +39,4 @@ export default { | ||
33 | font-size: 32px; | 39 | font-size: 32px; |
34 | } | 40 | } |
35 | } | 41 | } |
36 | -</style> | ||
37 | \ No newline at end of file | 42 | \ No newline at end of file |
43 | +</style> |