12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <template>
- <div>认证中,请稍等</div>
- </template>
- <script>
- import Vue from "vue";
- import { getAuthen } from "../assets/util";
- export default Vue.extend({
- head() {
- return {
- title: "认证",
- };
- },
- data() {
- return {
- redirect: "",
- };
- },
- mounted() {
- this.redirect = this.$route.query.state;
- if (!this.$route.query.code) {
- getAuthen();
- } else {
- this.$axios
- .$get("/getGzhAuthorizeInfo", {
- params: {
- code: this.$route.query.code,
- stationId: this.stationId,
- },
- })
- .then((res) => {
- if (res.retCode === 0) {
- this.$store.dispatch("authen/setBaseData", {
- openId: res.data.openid,
- accessToken: res.data.access_token,
- unionId: res.data.unionid,
- });
- this.handleGoto();
- }
- })
- .catch((res) => {
- alert("网络出错,正在尝试重新加载");
- getAuthen();
- });
- }
- },
- methods: {
- handleGoto() {
- this.$router.replace({
- path: this.redirect,
- });
- },
- },
- });
- </script>
- <style lang="less">
- </style>
|