From 677e853cb88fa43336b7aa7d2014ff8758d3b4bb Mon Sep 17 00:00:00 2001 From: JChehe <574805242@qq.com> Date: Fri, 17 Feb 2017 15:53:38 +0800 Subject: [PATCH] Limit the format of the imported file --- app/package.json | 2 +- .../FirstScreenPageView/ExcelDisplay.vue | 21 ++++++-- app/src/components/common/FileList.vue | 50 +++++++++++-------- app/src/components/common/Footer.vue | 17 +++++-- app/src/utils/ExcelSet.js | 10 ++++ package.json | 2 +- 6 files changed, 69 insertions(+), 33 deletions(-) diff --git a/app/package.json b/app/package.json index 79171b3..f55d3c7 100644 --- a/app/package.json +++ b/app/package.json @@ -1,7 +1,7 @@ { "name": "xcel", "product": "XCel", - "version": "1.3.0", + "version": "1.3.1", "description": "An ultimate excel data filter", "author": "AOTULabs ", "main": "electron.js", diff --git a/app/src/components/FirstScreenPageView/ExcelDisplay.vue b/app/src/components/FirstScreenPageView/ExcelDisplay.vue index a45f186..7c7fe1e 100644 --- a/app/src/components/FirstScreenPageView/ExcelDisplay.vue +++ b/app/src/components/FirstScreenPageView/ExcelDisplay.vue @@ -41,6 +41,7 @@ import fs from 'fs-extra' import pathModule from 'path' import { ipcRenderer } from 'electron' + import { isExcelFile } from '../../utils/ExcelSet' import { getSheetNameList, getActiveSheet, getSideBarStatus, getFilterTagList, getFilterWay } from '../../vuex/getters' import { setActiveSheet, setExcelData, setUploadFiles } from '../../vuex/actions' import SheetOfExcel from './SheetOfExcel' @@ -101,11 +102,20 @@ }, dropHandler(e){ let files = e.dataTransfer.files - this.setExcelData({ - path: files[0].path, - type: 'node' - }) - this.setUploadFiles(path) + let path = files[0].path + + if(!isExcelFile(path)) { + this.dragleaveHandler(e) + ipcRenderer.send('sync-alert-dialog', { + content: '不支持该文件格式' + }) + } else { + this.setExcelData({ + path: path, + type: 'node' + }) + this.setUploadFiles(path) + } } } } @@ -176,6 +186,7 @@ line-height: 17px; background-color: rgba(0,0,0, .15); text-align: center; + pointer-events: none; svg { vertical-align: text-top; margin-right: 10px; diff --git a/app/src/components/common/FileList.vue b/app/src/components/common/FileList.vue index 6439474..6159efb 100644 --- a/app/src/components/common/FileList.vue +++ b/app/src/components/common/FileList.vue @@ -19,6 +19,7 @@