he wei
2024-12-23 6a4a27022809f9647c781d8135ac8afc3fb7c393
src/views/selectFile.vue
@@ -5,7 +5,9 @@
        将文件拖到此处,或点击此处选择文件
      </div>
    </div>
    <div class="upload__tip" slot="tip">只能解析.fbx .fbxc .mcp .mch .bres .alm文件</div>
    <div class="upload__tip" slot="tip">
      只能解析.fbx .fbxc .mcp .mch .bres .alm .bcp .chr 文件
    </div>
  </div>
</template>
@@ -38,7 +40,7 @@
      let arr = url.split(".");
      let type = arr.length > 1 ? arr[arr.length - 1].toLowerCase() : "";
      // 支持的类型
      let allowList = ["fbx", "fbxc", "mcp", "mch", "bres", "alm"];
      let allowList = ["fbx", "fbxc", "mcp", "mch", "bres", "alm", "bcp", "chr"];
      if (!allowList.some((v) => v == type)) {
        this.$layer.msg("文件类型错误");
@@ -59,6 +61,14 @@
          break;
        case "alm":
          suffixes = "alm";
          break;
        // 放电
        case "bcp":
          suffixes = "bcp";
          break;
        // 充电
        case "chr":
          suffixes = "chr";
          break;
      }
      let loading = this.$layer.loading(1);
@@ -107,16 +117,20 @@
      }
    },
    initEvents() {
      console.log('initEvents')
      window.api.receive("selected-file", (path, data) => {
        console.log(path, data, "selected-file");
        if (data && data == "selectFile") {
          let url = path.filePaths[0];
          if (url) {
            this.loadFile(path.filePaths[0]);
      console.log("initEvents");
      window.api.receive(
        "selected-file",
        (path, data) => {
          console.log(path, data, "selected-file");
          if (data && data == "selectFile") {
            let url = path.filePaths[0];
            if (url) {
              this.loadFile(path.filePaths[0]);
            }
          }
        }
      }, true);
        },
        true
      );
    },
    selectFile() {
      // console.log("openfile");
@@ -173,4 +187,4 @@
// >>> .el-upload__tip {
//   color: #fff;
// }
</style>
</style>