Commit c47d445549522e49091d32971fe765fcf8ba6124
1 parent
8676f3af
小票码 输入车牌页面 授权
Showing
2 changed files
with
15 additions
and
1 deletions
src/components/plateNumber.vue
@@ -294,8 +294,22 @@ export default { | @@ -294,8 +294,22 @@ export default { | ||
294 | } | 294 | } |
295 | }, | 295 | }, |
296 | mounted () { | 296 | mounted () { |
297 | + var appID = this.$utils.myVxAppId; | ||
298 | + var code = this.getUrlParam('code'); | ||
299 | + var local = window.location.href; | ||
300 | + if (code == null || code === '') { | ||
301 | + window.location.href = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid='+appID+'&redirect_uri='+encodeURIComponent(local)+'&response_type=code&scope=snsapi_userinfo&state=1,0#wechat_redirect' | ||
302 | + } else { | ||
303 | + return code; | ||
304 | + } | ||
297 | }, | 305 | }, |
298 | methods: { | 306 | methods: { |
307 | + getUrlParam(name) { | ||
308 | + var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)'); | ||
309 | + var r = window.location.search.substr(1).match(reg) | ||
310 | + if (r != null) return unescape(r[2]) | ||
311 | + return null | ||
312 | + }, | ||
299 | chooseColor (index){ // 颜色选择 | 313 | chooseColor (index){ // 颜色选择 |
300 | this.currentColor = index | 314 | this.currentColor = index |
301 | switch (this.currentColor) { | 315 | switch (this.currentColor) { |