浏览代码

[测试]mock接口

soleil 7 年之前
父节点
当前提交
53f7b92aba
共有 4 个文件被更改,包括 23 次插入2 次删除
  1. 8 0
      src/layouts/TeacherMainLayout.vue
  2. 8 1
      src/router/index.js
  3. 1 0
      src/router/name.js
  4. 6 1
      src/views/login/Login.vue

+ 8 - 0
src/layouts/TeacherMainLayout.vue

@@ -0,0 +1,8 @@
+<template>
+  <div>
+    <div></div>
+    <router-view></router-view>
+  </div>
+</template>
+
+<style lang="scss"></style>

+ 8 - 1
src/router/index.js

@@ -3,8 +3,9 @@ import Router from "vue-router";
 import {
   LOGIN_ROUTER,
   // REGISTER_ROUTER,
-  HOME_ROUTER
+  HOME_ROUTER,
   // MIXER_ROUTER
+  QUESTION_ROUTER
 } from "@/router/name";
 
 Vue.use(Router);
@@ -37,6 +38,12 @@ const router = new Router({
       path: "/",
       component: () => import("@/views/Home"),
       meta: { requiresAuth: true }
+    },
+    {
+      name: QUESTION_ROUTER,
+      path: "/question",
+      component: () => import("@/layouts/TeacherMainLayout.vue"),
+      meta: { requiresAuth: true }
     }
     // {
     //   name: MIXER_ROUTER,

+ 1 - 0
src/router/name.js

@@ -2,3 +2,4 @@ export const LOGIN_ROUTER = "login";
 export const REGISTER_ROUTER = "register";
 export const HOME_ROUTER = "home";
 export const MIXER_ROUTER = "mixer";
+export const QUESTION_ROUTER = "question";

+ 6 - 1
src/views/login/Login.vue

@@ -42,6 +42,7 @@
 
 <script>
 import { required } from "vuelidate/lib/validators";
+import { getTeacherQuestionType } from "../../api/question";
 
 export default {
   data() {
@@ -62,7 +63,11 @@ export default {
   computed: {},
   methods: {
     loginAction() {
-      this.$router.push("");
+      //this.$router.push("");
+      //请求mock数据
+      getTeacherQuestionType().then(res => {
+        console.log(res);
+      });
     }
   }