authen.vue 751 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <template>
  2. <div>认证中,请稍等</div>
  3. </template>
  4. <script>
  5. import Vue from "vue";
  6. import { getAuthen } from "../assets/util";
  7. export default Vue.extend({
  8. head() {
  9. return {
  10. title: "认证",
  11. };
  12. },
  13. data() {
  14. return {
  15. redirect: "",
  16. };
  17. },
  18. mounted() {
  19. this.redirect = this.$route.query.state;
  20. if (!this.$route.query.code) {
  21. getAuthen();
  22. } else {
  23. this.$store.dispatch("authen/login",this.$route.query.code).then((res)=>{
  24. this.handleGoto();
  25. }).catch((res)=>{
  26. alert(res);
  27. getAuthen();
  28. });
  29. }
  30. },
  31. methods: {
  32. handleGoto() {
  33. this.$router.replace({
  34. path: this.redirect,
  35. });
  36. },
  37. },
  38. });
  39. </script>
  40. <style lang="less">
  41. </style>