Переглянути джерело

修复有时候返回是404的bug

JXDS18FUJT 2 роки тому
батько
коміт
27955def08

+ 3 - 3
src/api/modules/login.ts

@@ -2,16 +2,16 @@ import { AxiosPromise } from "axios";
 import request from "../request";
 const login = {
     //公众号登陆
-    logingzhcode(data: {
+    loginGzhcode(params: {
         authorizationCode: string
-    }): AxiosPromise<login.logingzhcode> {
+    }): AxiosPromise<login.loginGzhcode> {
         return request({
             url: 'login/gzhcode',
             headers: {
                 isToken: "0",
             },
             method: 'post',
-            params: data
+            params: params
         })
 
     }

+ 1 - 1
src/api/types/login.d.ts

@@ -3,7 +3,7 @@ declare namespace login {
         code: number,
         msg: string
     }
-    interface logingzhcode extends response {
+    interface loginGzhcode extends response {
         data: {
             thirdResult: {
                 city: string

+ 2 - 1
src/router/index.ts

@@ -1,5 +1,6 @@
 import { RouteRecordRaw, createRouter, createWebHashHistory,createWebHistory } from 'vue-router';
 import guard  from './guard';
+
 // 导入views文件夹下的所有组件
 const modules = import.meta.glob("../views/**/index.vue");
 console.log(modules)
@@ -54,7 +55,7 @@ for (const path in modules) {
 const routes: RouteRecordRaw[] = [
   {
     path:'/',
-    redirect:'/home'
+    component:()=>import('./../views/home/index.vue')
   },
   {
     path: '/about',

+ 2 - 2
src/views/home/index.vue

@@ -98,7 +98,7 @@ export default defineComponent({
         onMounted(async () => {
             if (route.query.state === 'LOGIN') {
 
-                await api.login.logingzhcode({
+                await api.login.loginGzhcode({
                     authorizationCode: route.query.code as string
                 }).then(res => {
                     Toast.success({
@@ -106,7 +106,7 @@ export default defineComponent({
                         forbidClick: true
                     })
                     window.localStorage.setItem("token", res.data.data.token)
-                    router.push('./')
+                    router.replace('./')
                    
 
                 }).catch(err => {