Home.vue 3.5 KB
Newer Older
X
xiesi 已提交
1
<template>
X
xiesi 已提交
2
  <router-view />
X
xiesi 已提交
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
  <el-container style="height: 100%">
    <el-aside width="200px" style="overflow-x: hidden">
      <el-menu>
        <el-submenu index="1">
          <template #title
            ><i class="el-icon-message"> </i><span> 大分类A</span></template
          >
          <el-menu-item index="1-1">A.小分类a</el-menu-item>
          <el-menu-item index="1-2">A.小分类b</el-menu-item>
        </el-submenu>
      </el-menu>
    </el-aside>
    <el-aside
      style="
        width: 200px;
        height: 100%;
        border: 1px solid #eee;
        background-color: #ffe;
        text-align: center;
        vertical-align: middle;
      "
    >
      模型列表 图片+名称
    </el-aside>

    <el-container>
      <el-header style="text-align: center; font-size: 40px">
        <el-button
          @click="ondrawerbuttonclick"
          type="primary"
          style="margin-left: 16px"
        >
          可以添加属性,可以添加到项目,可以添加到打包集合
        </el-button>
      </el-header>

X
xiesi 已提交
39 40 41
      <el-main>
        <el-button @click="onclickaxios"> hello</el-button>
        <el-button @click="havelogin"> havelogin</el-button>
X
xiesi 已提交
42
        <el-button @click="logout"> logout</el-button>
X
xiesi 已提交
43 44
        <el-button @click="gotologin11"> gotologin</el-button>
        <router-link to="/Login">gotologin</router-link>
X
xiesi 已提交
45
      </el-main>
X
xiesi 已提交
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
    </el-container>
  </el-container>

  <el-drawer
    v-model="drawer"
    size="70%"
    destroy-on-close
    show-close="true"
    :with-header="false"
  >
    <LoadFBX ref="myfbx" :fbxfilepath="curefbxname"> </LoadFBX>
  </el-drawer>
</template>

<script>
import LoadFBX from "@/components/LoadFBX.vue";
X
xiesi 已提交
62
import qs from "qs";
X
xiesi 已提交
63
//import { useRouter } from "vue-router";
X
xiesi 已提交
64 65 66 67 68 69 70

export default {
  name: "Home",
  components: {
    LoadFBX,
  },
  methods: {
X
xiesi 已提交
71 72 73 74
    gotologin11() {
      console.log("goto login");
      this.$router.push("Login");
    },
X
xiesi 已提交
75 76 77 78 79 80 81 82
    ondrawerbuttonclick() {
      this.curefbxname =
        this.fbxnamelist[this.count++ % this.fbxnamelist.length]; //索引自加1  取余fbx列表数量
      console.log("click : " + this.curefbxname); // ! 打印信息  审查自己name是否正确
      this.drawer = true; // 打开`抽屉`控件
    },
    onclickaxios() {
      console.log("nihao");
X
xiesi 已提交
83 84 85 86 87
      var fdata = qs.stringify({
        name: "123",
        email: "2@qq.com",
        password: "123456789",
        remember: "on",
X
xiesi 已提交
88
      });
X
xiesi 已提交
89 90 91 92 93 94 95 96 97 98 99 100
      this.axios
        .post("http://localhost:8070/login", fdata, { withCredentials: true })
        .then((response) => {
          console.log(response.data);
        });
    },
    havelogin() {
      this.axios
        .get("http://localhost:8070/login", { withCredentials: true })
        .then((response) => {
          console.log(response.data);
        });
X
xiesi 已提交
101
    },
X
xiesi 已提交
102 103 104 105 106 107 108
    logout() {
      this.axios
        .post("http://localhost:8070/logout", {}, { withCredentials: true })
        .then((response) => {
          console.log(response.data);
        });
    },
X
xiesi 已提交
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
  },
  data() {
    return {
      drawer: false, // 设置为true的时候drawer打开
      fbxnamelist: ["a.fbx", "b.fbx", "Samba Dancing.fbx"], // ! fbx列表,用于测试,后续会删掉
      curefbxname: "a.fbx", // 当前的fbx名称,用于传参用
      count: 0, // ! 一个索引,所随着点击次数增加,使用的时候要取余,在正式代码中会删掉
    };
  },
};
</script>

<style lang="scss" scoped>
.el-main {
  padding: 0px;
}
</style>