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 | 12 | {{ schoolNamesChoose.schoolName }}<img src="@/assets/Travel/change.png" /> |
| 13 | 13 | </div> |
| 14 | 14 | </div> |
| 15 | - <p class="phone">{{ userInfo.phone }}</p> | |
| 15 | + <p class="phone">{{ phoneDesensitization(userInfo.phone,'*') }}</p> | |
| 16 | 16 | </div> |
| 17 | 17 | </div> |
| 18 | 18 | <HomeScan></HomeScan> |
| ... | ... | @@ -107,7 +107,6 @@ export default { |
| 107 | 107 | }, |
| 108 | 108 | }, |
| 109 | 109 | methods: { |
| 110 | - | |
| 111 | 110 | handleYanxue() { |
| 112 | 111 | this.$router.push({ name: 'YanxuePage' }) |
| 113 | 112 | }, |
| ... | ... | @@ -205,10 +204,10 @@ export default { |
| 205 | 204 | this.userInfo = userInfo |
| 206 | 205 | localStorage.setItem('userInfo', JSON.stringify(userInfo)) |
| 207 | 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 | 208 | localStorage.setItem('schoolNames', JSON.stringify(userInfo.schoolNames)) |
| 210 | 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 | 211 | localStorage.setItem('schoolNamesChoose', JSON.stringify(userInfo.schoolNames[0])) |
| 213 | 212 | this.schoolNamesChoose = userInfo.schoolNames[0] |
| 214 | 213 | } |
| ... | ... | @@ -256,6 +255,15 @@ export default { |
| 256 | 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 | 268 | components: { |
| 261 | 269 | Tabbar4, | ... | ... |
src/views/Service/ServiceBaseKQ.vue
src/views/Service/ServiceKQ.vue
| ... | ... | @@ -27,17 +27,17 @@ export default { |
| 27 | 27 | let ticketId = this.common.getUrlParam('ticketId') //浙里办微信小程序访问 |
| 28 | 28 | // alert(location.href) |
| 29 | 29 | // alert(ticketId) |
| 30 | - if (ticket) { | |
| 30 | + if (ticket) { | |
| 31 | 31 | this.getCenterByTicket(ticket) |
| 32 | 32 | } else if (ticketId) { |
| 33 | 33 | // alert('getCenterByTicketId') |
| 34 | 34 | this.getCenterByTicketId(ticketId) |
| 35 | - }else if (centerNo) { | |
| 35 | + } else if (centerNo) { | |
| 36 | 36 | // alert('有中台编号:' + centerNo) |
| 37 | 37 | this.centerNo = centerNo |
| 38 | 38 | localStorage.setItem('centerNo', centerNo) |
| 39 | 39 | this.getUserInfo() |
| 40 | - } else { | |
| 40 | + } else { | |
| 41 | 41 | const sUserAgent = window.navigator.userAgent.toLowerCase() |
| 42 | 42 | const dtdreamweb = sUserAgent.indexOf('dtdreamweb') > -1 |
| 43 | 43 | const miniprogram = sUserAgent.indexOf('miniprogram') > -1 && sUserAgent.indexOf('alipay') > -1 |
| ... | ... | @@ -83,7 +83,7 @@ export default { |
| 83 | 83 | }, |
| 84 | 84 | onFail: (err) => { |
| 85 | 85 | // alert('通过ticket获取centerNo失败:' + JSON.stringify(err)) |
| 86 | - console.log('通过ticket获取centerNo成功失败:', JSON.stringify(err)) | |
| 86 | + console.log('通过ticket获取centerNo失败:', JSON.stringify(err)) | |
| 87 | 87 | this.reLoad() |
| 88 | 88 | }, |
| 89 | 89 | }) |
| ... | ... | @@ -104,32 +104,20 @@ export default { |
| 104 | 104 | ticket: ticketId, |
| 105 | 105 | }, |
| 106 | 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 | 108 | if (res.data.code == 200) { |
| 110 | - this.centerNo = res.data.message | |
| 109 | + // this.centerNo = res.data.message | |
| 111 | 110 | localStorage.setItem('centerNo', res.data.message) |
| 112 | 111 | this.getUserInfo() |
| 112 | + } else { | |
| 113 | + this.getUserInfo() | |
| 113 | 114 | } |
| 114 | 115 | }, |
| 115 | 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 | 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 | 122 | reLoad() { |
| 135 | 123 | console.log('reload') |
| ... | ... | @@ -152,6 +140,8 @@ export default { |
| 152 | 140 | }, |
| 153 | 141 | // 获取用户信息 |
| 154 | 142 | getUserInfo: function() { |
| 143 | + this.centerNo = localStorage.getItem('centerNo') | |
| 144 | + // alert('getUserInfo:' + this.centerNo) | |
| 155 | 145 | this.mgop({ |
| 156 | 146 | api: 'mgop.sz.hswsy.getPortalUserByNum', // 必须 |
| 157 | 147 | // host: 'https://mapi.zjzwfw.gov.cn/', |
| ... | ... | @@ -162,16 +152,16 @@ export default { |
| 162 | 152 | // 'isTestUrl': '1' |
| 163 | 153 | }, |
| 164 | 154 | data: { |
| 165 | - userNum: this.centerNo, | |
| 155 | + userNum: localStorage.getItem('centerNo'), | |
| 166 | 156 | }, |
| 167 | 157 | onSuccess: (res) => { |
| 168 | - console.log('getUserInfo', res) | |
| 158 | + // alert('getUserInfo success:' + JSON.stringify(res)) | |
| 169 | 159 | if (res.data.code == 200) { |
| 170 | 160 | localStorage.setItem('userInfo', JSON.stringify(res.data.data.userInfo)) |
| 171 | 161 | } |
| 172 | 162 | }, |
| 173 | 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 | 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 | 7 | </template> |
| 4 | 8 | <script> |
| 5 | 9 | export default { |
| 6 | 10 | methods: { |
| 7 | - call () { | |
| 11 | + call() { | |
| 8 | 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 | 24 | </script> |
| 19 | 25 | <style lang="scss"> |
| ... | ... | @@ -22,7 +28,7 @@ export default { |
| 22 | 28 | text-align: center; |
| 23 | 29 | padding: 40px; |
| 24 | 30 | |
| 25 | - span{ | |
| 31 | + a,span { | |
| 26 | 32 | color: rgb(41, 122, 189); |
| 27 | 33 | } |
| 28 | 34 | } |
| ... | ... | @@ -33,4 +39,4 @@ export default { |
| 33 | 39 | font-size: 32px; |
| 34 | 40 | } |
| 35 | 41 | } |
| 36 | -</style> | |
| 37 | 42 | \ No newline at end of file |
| 43 | +</style> | ... | ... |