|
@@ -5,31 +5,41 @@
|
|
</template>
|
|
</template>
|
|
<script>
|
|
<script>
|
|
import {getWxworkUser_ehrpm,getDrpUser} from "@/api/business/ehr/wxworklogin";
|
|
import {getWxworkUser_ehrpm,getDrpUser} from "@/api/business/ehr/wxworklogin";
|
|
- import {setToken} from '@/utils/auth'
|
|
|
|
|
|
+ import {setToken,getToken} from '@/utils/auth'
|
|
export default {
|
|
export default {
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
|
|
+ //遮罩
|
|
|
|
+ loading: false
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
},
|
|
},
|
|
async created() {
|
|
async created() {
|
|
- let query = this.$route.query;
|
|
|
|
- console.log("query",query);
|
|
|
|
- let res = await getWxworkUser_ehrpm(query.code);
|
|
|
|
- console.log("res",res);
|
|
|
|
- if(res.code == '200'){
|
|
|
|
- let staffCode = res.data.userid;
|
|
|
|
- let dres = await getDrpUser(staffCode);
|
|
|
|
- if (dres.code === 200) {
|
|
|
|
- let token = dres.token
|
|
|
|
- setToken(token)
|
|
|
|
- this.$store.commit('SET_TOKEN', token)
|
|
|
|
- this.$store.dispatch("GetInfo").then(() => {})
|
|
|
|
- this.$store.dispatch("GenerateRoutes").then(
|
|
|
|
- this.$router.push({ path: '/business/ehr/pm/myPm' }).catch(()=>{})
|
|
|
|
- )
|
|
|
|
|
|
+ if(!getToken){
|
|
|
|
+ this.loading = true;
|
|
|
|
+ let query = this.$route.query;
|
|
|
|
+ console.log("query",query);
|
|
|
|
+ let res = await getWxworkUser_ehrpm(query.code);
|
|
|
|
+ console.log("res",res);
|
|
|
|
+ if(res.code == '200'){
|
|
|
|
+ let staffCode = res.data.userid;
|
|
|
|
+ let dres = await getDrpUser(staffCode);
|
|
|
|
+ if (dres.code === 200) {
|
|
|
|
+ let token = dres.token
|
|
|
|
+ setToken(token)
|
|
|
|
+ this.$store.commit('SET_TOKEN', token)
|
|
|
|
+ this.$store.dispatch("GetInfo").then(() => {})
|
|
|
|
+ this.$store.dispatch("GenerateRoutes").then(
|
|
|
|
+ this.$router.push({ path: '/business/ehr/pm/myPm' }).catch(()=>{})
|
|
|
|
+ )
|
|
|
|
+ this.loading = false;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ }else{
|
|
|
|
+ this.$store.dispatch("GenerateRoutes").then(
|
|
|
|
+ this.$router.push({ path: '/business/ehr/pm/myPm' }).catch(()=>{})
|
|
|
|
+ )
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|