|
@@ -1,9 +1,9 @@
|
|
<template>
|
|
<template>
|
|
<div class="container">
|
|
<div class="container">
|
|
- <img src="../assets/images/entrybg.jpg" alt="" width="100%" style="margin-top:4rem;">
|
|
|
|
|
|
+ <img src="../assets/images/entrybg.jpg" alt="" width="100%" style="margin-top:4rem;">
|
|
<div class="content">
|
|
<div class="content">
|
|
- <div class="csbtn" @click="goPage('doclogin')" style="margin-top:0px;">医生端</div>
|
|
|
|
- <div class="jbbtn" @click="goPage('patregister')">个人端</div>
|
|
|
|
|
|
+ <div class="csbtn" @click="goPage('/doclogin')" style="margin-top:0px;">医生端</div>
|
|
|
|
+ <div class="jbbtn" @click="goPage('/patregister')">个人端</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<img v-if='show' style="position: absolute;left: 0;top: 0;z-index: 999;" width="100%" src="../assets/images/bg.jpg" alt="">
|
|
<img v-if='show' style="position: absolute;left: 0;top: 0;z-index: 999;" width="100%" src="../assets/images/bg.jpg" alt="">
|
|
@@ -24,10 +24,12 @@
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
goPage(path) {
|
|
goPage(path) {
|
|
|
|
+ if(localStorage.getItem('openid') && localStorage.getItem('tag')){
|
|
|
|
+ this.$router.push(path)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
var id=this.id
|
|
var id=this.id
|
|
-
|
|
|
|
- var url=encodeURIComponent(`http://bax.nalgin.com?path=${path}`)
|
|
|
|
- // var url=encodeURIComponent(`http://xjctest.baianxi.com/?path=${path}&tag=${tag}`)
|
|
|
|
|
|
+ var url=encodeURIComponent(`http://bax.nalgin.com`)
|
|
window.location.href=`https://open.weixin.qq.com/connect/oauth2/authorize?appid=${id}&redirect_uri=${url}&response_type=code&scope=snsapi_userinfo#wechat_redirect`
|
|
window.location.href=`https://open.weixin.qq.com/connect/oauth2/authorize?appid=${id}&redirect_uri=${url}&response_type=code&scope=snsapi_userinfo#wechat_redirect`
|
|
|
|
|
|
// this.$router.push(path)
|
|
// this.$router.push(path)
|
|
@@ -37,15 +39,12 @@
|
|
window.localStorage.removeItem('authinfo')
|
|
window.localStorage.removeItem('authinfo')
|
|
window.location.reload()
|
|
window.location.reload()
|
|
},
|
|
},
|
|
-
|
|
|
|
- getTag(openid,role){
|
|
|
|
|
|
+
|
|
|
|
+ getTag(openid){
|
|
this.$api.getInfo({openid:openid,role:role}).then(res=>{
|
|
this.$api.getInfo({openid:openid,role:role}).then(res=>{
|
|
if(res.data.data.tag){
|
|
if(res.data.data.tag){
|
|
- if(role=="1"){
|
|
|
|
- this.$router.push("/doclogin")
|
|
|
|
- }else{
|
|
|
|
- this.$router.push("/patregister")
|
|
|
|
- }
|
|
|
|
|
|
+ this.show=0
|
|
|
|
+ localStorage.setItem('tag',res.data.data.tag)
|
|
}else{
|
|
}else{
|
|
this.show=1
|
|
this.show=1
|
|
}
|
|
}
|
|
@@ -53,29 +52,25 @@
|
|
}
|
|
}
|
|
},
|
|
},
|
|
created(){
|
|
created(){
|
|
- var code=this.$route.query.code,tag=this.$route.query.tag,
|
|
|
|
- path=this.$route.query.path
|
|
|
|
- localStorage.setItem('tag',tag)
|
|
|
|
-
|
|
|
|
- localStorage.setItem('role',path=='doclogin'?1:2)
|
|
|
|
|
|
+ //1.有openid 判断是否有返回tag
|
|
if(localStorage.getItem('openid')){
|
|
if(localStorage.getItem('openid')){
|
|
- var role=localStorage.getItem('role')
|
|
|
|
- this.getTag(localStorage.getItem('openid'),role)
|
|
|
|
|
|
+ this.getTag(localStorage.getItem('openid'))
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ //2.没有openid 没有tag直接显示图片
|
|
|
|
+ if(!localStorage.getItem('tag')){
|
|
|
|
+ this.show=1
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+ //3.授权回来获取openid
|
|
|
|
+ var code=this.$route.query.code
|
|
if(code){
|
|
if(code){
|
|
- var id=this.id
|
|
|
|
- var secret=this.secret
|
|
|
|
- var that=this
|
|
|
|
- axios.get(`https://api.weixin.qq.com/sns/oauth2/access_token?appid=${id}&secret=${secret}&code=${code}&grant_type=authorization_code`).then(res => {
|
|
|
|
- if(res.data.openid){
|
|
|
|
- localStorage.setItem('openid',res.data.openid)
|
|
|
|
- var role= path=='doclogin'?1:2
|
|
|
|
- this.getTag(res.data.openid,role)
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
|
|
+ this.$api.getOpenid({code:code}).then(res=>{
|
|
|
|
+ if(res.data.data.data.openid){
|
|
|
|
+ localStorage.setItem('openid',res.data.data.data.openid)
|
|
|
|
+ this.getTag(res.data.data.data.openid)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
}
|
|
}
|
|
|
|
|
|
},
|
|
},
|