测试 用electron + springboot 构建桌面应用
he wei
2022-03-18 020c6ebe0c43b0a0cedb1b91b3520d223b3415c3
1
2
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<template>
  <div class="main">
    <el-upload
      class="upload"
      action=""
      drag
      :auto-upload="false"
      :on-change="change"
      accept=".fbx"
    >
      <!-- <i class="icon el-icon-plus"></i> -->
      <div class="el-upload__text">将文件拖到此处,或点击此处选择文件</div>
      <div class="el-upload__tip" slot="tip">
        只能解析.fbx文件
      </div>
    </el-upload>
  </div>
</template>
 
<script>
import axios from "@/assets/js/axios";
 
export default {
  name: "",
 
  data() {
    return {
      URL: "",
    };
  },
  components: {},
  methods: {
    change(file) {
      // let $el = this.$refs.input;
      // console.log($el.files[0].path);
      if (!file || !file.raw || !file.raw.path) {
        return false;
      }
      console.log(file);
      if (!/\.fbx$/.test(file.raw.name.toLowerCase().trim())) {
        this.$layer.msg('类型错误');
        return false;
      }
      axios({
        url: "readFboFile",
        method: "POST",
        params: {
          filePath: file.raw.path,
        },
      }).then((res) => {
        res = res.data;
        console.log(res, res.code, "=========res");
        if (res.code) {
          let data = res.data;
          data.filePath = file.raw.path;
          // 解析成功 跳转到结果页面
          this.$router.push({
            path: "/result",
            query: {
              data,
            },
          });
        }
      });
    },
  },
 
  mounted() {},
};
</script>
 
<style scoped>
.main {
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}
.upload {
  /* flex: 1; */
  width: 80%;
  height: 80%;
  display: flex;
  flex-direction: column;
  text-align: center;
}
>>> .el-upload {
  width: 100%;
  height: 100%;
}
>>> .el-upload-dragger {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
>>> .el-upload-list {
  display: none;
}
</style>