diff --git a/.babelrc b/.babelrc
index d5876c1..f72838d 100644
--- a/.babelrc
+++ b/.babelrc
@@ -1,4 +1,13 @@
{
- "presets": ["es2015", "stage-0"],
- "plugins": ["transform-runtime"]
+ "presets": [
+ "es2015",
+ "stage-2"
+ ],
+ "plugins": ["transform-runtime"],
+ "comments": false,
+ "env": {
+ "test": {
+ "plugins": ["istanbul"]
+ }
+ }
}
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..82da0b1
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,15 @@
+# http://editorconfig.org
+
+root = true
+
+[*]
+charset = utf-8
+indent_style = space
+indent_size = 2
+end_of_line = lf
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+[*.md]
+insert_final_newline = false
+trim_trailing_whitespace = false
\ No newline at end of file
diff --git a/.eslintrc b/.eslintrc
new file mode 100644
index 0000000..8ce8de6
--- /dev/null
+++ b/.eslintrc
@@ -0,0 +1,6 @@
+{
+ "extends": "eslint-config-o2team",
+ "rules": {
+ "no-multiple-empty-lines": [ 1,{ "max": 1 } ]
+ }
+}
diff --git a/app/crashTempate.js b/app/crashTempate.js
index 36a9b74..0be66d6 100644
--- a/app/crashTempate.js
+++ b/app/crashTempate.js
@@ -1,12 +1,11 @@
const electron = require('electron')
const crashReporter = electron.crashReporter
-
exports.start = function () {
- crashReporter.start({
- productName: 'xcel',
- companyName: 'o2team',
- submitURL: 'http://localhost:4000/crash/',
- autoSubmit: true
- })
-}
\ No newline at end of file
+ crashReporter.start({
+ productName: 'xcel',
+ companyName: 'o2team',
+ submitURL: 'http://localhost:4000/crash/',
+ autoSubmit: true
+ })
+}
diff --git a/app/electron.js b/app/electron.js
index 275c8f3..5c1a5be 100644
--- a/app/electron.js
+++ b/app/electron.js
@@ -11,97 +11,90 @@ const Menu = electron.Menu
let mainWindow // 主窗口
let backgroundWindow // 执行耗时运算的 背后窗口
-let updateWindow // 更新的下载窗口
-var windowBounds = {} // 主窗口的尺寸信息
let config = {}
if (process.env.NODE_ENV === 'development') {
- config = require('../config')
- config.mainUrl = `http://localhost:${config.port}`
+ config = require('../config')
+ config.mainUrl = `http://localhost:${config.port}`
} else {
- config.devtron = false
- config.mainUrl = `file://${__dirname}/dist/index.html`
+ config.devtron = false
+ config.mainUrl = `file://${__dirname}/dist/index.html`
}
config.backUrl = `file://${__dirname}/dist/background/index.html`
config.isDev = process.env.NODE_ENV === 'development'
-
-function createMainWindow() {
- var win = new BrowserWindow({
- height: 850,
- width: 1280,
- minWidth: 1120,
- minHeight: 768,
- backgroundColor: "#f5f5f5",
- fullscreenable: false,
- frame: false,
- show: false
- })
- windowBounds = win.getBounds()
- win.loadURL(config.mainUrl)
-
- if (config.isDev) {
- BrowserWindow.addDevToolsExtension(path.join(__dirname, '../node_modules/devtron'))
-
- let installExtension = require('electron-devtools-installer')
-
- installExtension.default(installExtension.VUEJS_DEVTOOLS)
- .then((name) => win.webContents.openDevTools())
- .catch((err) => console.log('An error occurred: ', err))
- }
-
- win.on('closed', () => {
- console.log("触发 closed")
- mainWindow = null
- backgroundWindow = null
+function createMainWindow () {
+ const win = new BrowserWindow({
+ height: 850,
+ width: 1280,
+ minWidth: 1120,
+ minHeight: 768,
+ backgroundColor: '#f5f5f5',
+ fullscreenable: false,
+ frame: false,
+ show: false
+ })
+ win.loadURL(config.mainUrl)
+
+ if (config.isDev) {
+ BrowserWindow.addDevToolsExtension(path.join(__dirname, '../node_modules/devtron'))
+
+ const installExtension = require('electron-devtools-installer')
+
+ installExtension.default(installExtension.VUEJS_DEVTOOLS)
+ .then(name => win.webContents.openDevTools())
+ .catch(err => console.log('An error occurred: ', err))
+ }
+
+ win.on('closed', () => {
+ console.log('触发 closed')
+ mainWindow = null
+ backgroundWindow = null
// 在Mac中完全退出程序,而不会留在dock中
- app.quit()
- })
-
- win.on('ready-to-show', () => {
- win.show()
- win.focus()
- })
- console.log('mainWindow opened')
- return win
+ app.quit()
+ })
+
+ win.on('ready-to-show', () => {
+ win.show()
+ win.focus()
+ })
+ console.log('mainWindow opened')
+ return win
}
-function createBackgroundWindow() {
- var win = new BrowserWindow({
- show: config.isDev
- })
- win.loadURL(config.backUrl)
- console.log("backgroundWindow opened")
- return win
+function createBackgroundWindow () {
+ const win = new BrowserWindow({
+ show: config.isDev
+ })
+ win.loadURL(config.backUrl)
+ console.log('backgroundWindow opened')
+ return win
}
-
app.on('ready', () => {
- console.log("ready")
- mainWindow = createMainWindow()
- backgroundWindow = createBackgroundWindow()
- ipcMainSets(mainWindow, backgroundWindow)
- const menu = Menu.buildFromTemplate(menuTemplate)
- Menu.setApplicationMenu(menu)
+ console.log('ready')
+ mainWindow = createMainWindow()
+ backgroundWindow = createBackgroundWindow()
+ ipcMainSets(mainWindow, backgroundWindow)
+ const menu = Menu.buildFromTemplate(menuTemplate)
+ Menu.setApplicationMenu(menu)
})
-
-
app.on('window-all-closed', () => {
- if (process.platform !== 'darwin') {
- app.quit()
- }
+ if (process.platform !== 'darwin') {
+ app.quit()
+ }
})
// 当应用被激活时触发,常用于点击应用的 dock 图标的时候。
// 现在取消保留在Dock中,完全退出
app.on('activate', () => {
- if (mainWindow.isDestroyed()) {
- mainWindow = createMainWindow()
- backgroundWindow = createBackgroundWindow()
- }
+ if (mainWindow.isDestroyed()) {
+ mainWindow = createMainWindow()
+ backgroundWindow = createBackgroundWindow()
+ }
})
crashTempate.start()
-console.log("主进程pid:", process.pid)
+console.log('主进程pid:', process.pid)
diff --git a/app/ipcMainSets.js b/app/ipcMainSets.js
index ed6f9c0..63aae18 100644
--- a/app/ipcMainSets.js
+++ b/app/ipcMainSets.js
@@ -2,252 +2,250 @@ const shortid = require('shortid')
const xlsx = require('xlsx')
const path = require('path')
const electron = require('electron')
-const os = require('os')
const app = electron.app
const BrowserWindow = electron.BrowserWindow
const dialog = electron.dialog
const ipcMain = electron.ipcMain
const shell = electron.shell
-let savePath = '',
- downloadsPath = app.getPath('downloads'),
- platform = os.platform() + '_' + os.arch(),
- version = app.getVersion(),
- updateWindow,
- updateItem,
- downloadsFullPath
+let savePath = ''
+const downloadsPath = app.getPath('downloads')
+let updateWindow
+let updateItem
+let downloadsFullPath
shortid.characters('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$@')
module.exports = function (mainWindow, backgroundWindow) {
-
- ipcMain.on('will-download-handler', (ipcEvent, arg) => {
- if (!updateWindow || updateWindow.isDestroyed()) {
- updateWindow = createUpdateWindow()
- }
- if (!updateWindow.isDestroyed()) {
- updateWindow.webContents.session.removeAllListeners()
- updateWindow.webContents.session.on('will-download', (event, item, webContents) => {
- updateItem = item
- downloadsFullPath = downloadsPath + item.getFilename()
- item.setSavePath(downloadsFullPath)
- console.log(downloadsFullPath)
- console.log('getTotalBytes', item.getTotalBytes())
- item.on('updated', (event, state) => {
- if (state === 'interrupted') {
- console.log('Download is interrupted but can be resumed')
- } else if (state === 'progressing') {
- if (item.isPaused()) {
- console.log('Download is paused')
- } else {
- console.log(`Received bytes: ${item.getReceivedBytes()}`)
- }
- }
- if (!updateWindow.isDestroyed()) {
- updateWindow.webContents.send('will-download-response', {
- curReceivedBytes: item.getReceivedBytes(),
- totalBytes: item.getTotalBytes(),
- downloadStatus: state
- })
- }
- })
-
- item.once('done', (event, state) => {
- if (state === 'completed') {
- console.log('Download successfully')
- if (!shell.openItem(downloadsFullPath)) {
- shell.showItemInFolder(downloadsPath)
- }
- if (!updateWindow.isDestroyed()) {
- updateWindow.close()
- }
- } else {
- console.log(`Download failed: ${state}`)
- }
- item.removeAllListeners()
- updateItem = null
- item = null
- })
- })
- console.log('uodate.url', arg.url)
- if (process.env.NODE_ENV === 'development') {
- updateWindow.webContents.downloadURL(arg.url)
- } else {
- updateWindow.webContents.downloadURL(arg.url)
- }
- }
- })
- function createUpdateWindow() {
- var win = new BrowserWindow({
- height: 160,
- width: 550,
- minWidth: 550,
- minHeight: 160,
- title: '下载最新版的XCel',
- backgroundColor: "#f5f5f5"
- })
- win.loadURL(`file://${__dirname}/dist/update/index.html`)
- win.once('closed', closeUpdateWindow)
- return win
- }
- function closeUpdateWindow(event) {
- console.log(updateItem)
- if (updateItem) {
- updateItem.removeAllListeners()
- updateItem.cancel() // cancel 后,DownloadItem 就是 null 了
- updateItem = null
- }
+ ipcMain.on('will-download-handler', (ipcEvent, arg) => {
+ if (!updateWindow || updateWindow.isDestroyed()) {
+ updateWindow = createUpdateWindow()
}
- ipcMain.on('update-switch', (event, arg) => {
- if (updateItem) {
- let status = ''
- if (updateItem.isPaused()) {
- if (updateItem.canResume()) {
- updateItem.resume()
- status = '暂停'
- }
+ if (!updateWindow.isDestroyed()) {
+ updateWindow.webContents.session.removeAllListeners()
+ updateWindow.webContents.session.on('will-download', (event, item, webContents) => {
+ updateItem = item
+ downloadsFullPath = downloadsPath + item.getFilename()
+ item.setSavePath(downloadsFullPath)
+ console.log(downloadsFullPath)
+ console.log('getTotalBytes', item.getTotalBytes())
+ item.on('updated', (event, state) => {
+ if (state === 'interrupted') {
+ console.log('Download is interrupted but can be resumed')
+ } else if (state === 'progressing') {
+ if (item.isPaused()) {
+ console.log('Download is paused')
} else {
- updateItem.pause()
- status = '继续'
+ console.log(`Received bytes: ${item.getReceivedBytes()}`)
}
- event.sender.send('update-switch-response', {
- text: status
+ }
+ if (!updateWindow.isDestroyed()) {
+ updateWindow.webContents.send('will-download-response', {
+ curReceivedBytes: item.getReceivedBytes(),
+ totalBytes: item.getTotalBytes(),
+ downloadStatus: state
})
- }
- })
-
- ipcMain.on('update-cancel', (event, arg) => {
- if (updateItem) {
- updateItem.removeAllListeners()
- updateItem.cancel()
- updateWindow.close()
- updateItem = null
- }
- })
-
- ipcMain.on('update-checkout', (event, arg) => {
- if (updateItem) {
- updateItem.cancel()
- shell.openExternal('https://xcel.aotu.io/')
- updateWindow.close()
- updateItem = null
- }
- })
-
- ipcMain.on("readFile-response", (event, arg) => {
- console.log("触发readFile-response")
- mainWindow.webContents.send("readFile-response", arg)
- })
- ipcMain.on("readFile-start", (event, arg) => {
- console.log("读取文件emit")
- savePath = getSavePath(arg.data.path)
- console.log(savePath)
- backgroundWindow.webContents.send("readFile-start", arg)
- })
-
- ipcMain.on("generate-htmlstring-response", (event, arg) => {
- mainWindow.webContents.send("generate-htmlstring-response", arg)
- })
-
- ipcMain.on("filter-response", (event, arg) => {
- mainWindow.webContents.send("filter-response", arg)
- })
- ipcMain.on("filter-start", (event, arg) => {
- backgroundWindow.webContents.send("filter-start", arg)
- })
-
- ipcMain.on("changeTab-start", (event, arg) => {
- backgroundWindow.webContents.send("changeTab-start", arg)
- })
-
- ipcMain.on("exportFile-response", (event, arg) => {
- mainWindow.webContents.send("exportFile-response", arg)
- })
- ipcMain.on("exportFile-start", (event, arg) => {
- backgroundWindow.webContents.send("exportFile-start", arg)
- })
-
- ipcMain.on("delAllFilterTag-start", (event, arg) => {
- backgroundWindow.webContents.send("delAllFilterTag-start", arg)
- })
-
- ipcMain.on("sync-openFile-dialog", (event, arg) => {
- dialog.showOpenDialog({
- title: "请选择Excel文件",
- filters: [{ name: 'Excel File', extensions: ['xls', "xlsx"] }],
- properties: ["openFile"]
- }, function (arr) {
- if (arr !== undefined) {
- // arr 是一个文件路径 数组
- // console.log("event", event)
- // 正常触发
- if (event) {
- event.sender.send("open-file-response", arr[0])
- }
- // 通过 emit 触发(如快捷键)
- else {
- var mainWindow = BrowserWindow.fromId(1)
- if (mainWindow) {
- mainWindow.webContents.send("open-file-response", arr[0])
- }
- }
- }
+ }
})
- })
- ipcMain.on("sync-saveFile-dialog", (event, arg) => {
- console.log("sync-saveFile-dialog")
- dialog.showSaveDialog({
- title: "请选择保存路径",
- defaultPath: savePath,
- filters: [{
- name: "Excel",
- extensions: ["xlsx"]
- }]
- }, function (p) {
- if (p !== undefined) {
- xlsx.writeFile(arg.data, p)
+ item.once('done', (event, state) => {
+ if (state === 'completed') {
+ console.log('Download successfully')
+ if (!shell.openItem(downloadsFullPath)) {
+ shell.showItemInFolder(downloadsPath)
}
- // p 是用户输入的路径名
- console.log("p", p);
- })
- })
-
-
- ipcMain.on("sync-alert-dialog", (event, arg) => {
- dialog.showMessageBox({
- type: "warning",
- buttons: ["确定"],
- defaultId: 0, // dialog 打开是默认选中哪个按钮
- title: arg.title || "xcel",
- message: arg.content || "",
- detail: arg.detail || ""
+ if (!updateWindow.isDestroyed()) {
+ updateWindow.close()
+ }
+ } else {
+ console.log(`Download failed: ${state}`)
+ }
+ item.removeAllListeners()
+ updateItem = null
+ item = null
})
- })
-
- // 接受窗口的最小化、最大化、关闭 事件
- ipcMain.on("sync-close", (event, arg) => {
- mainWindow.close()
- })
- ipcMain.on("sync-maximize", (event, arg) => {
- if (mainWindow.isMaximized()) {
- mainWindow.setBounds(windowBounds)
- } else {
- windowBounds = mainWindow.getBounds()
- mainWindow.maximize()
+ })
+ console.log('uodate.url', arg.url)
+ if (process.env.NODE_ENV === 'development') {
+ updateWindow.webContents.downloadURL(arg.url)
+ } else {
+ updateWindow.webContents.downloadURL(arg.url)
+ }
+ }
+ })
+ function createUpdateWindow () {
+ const win = new BrowserWindow({
+ height: 160,
+ width: 550,
+ minWidth: 550,
+ minHeight: 160,
+ title: '下载最新版的XCel',
+ backgroundColor: '#f5f5f5'
+ })
+ win.loadURL(`file://${__dirname}/dist/update/index.html`)
+ win.once('closed', closeUpdateWindow)
+ return win
+ }
+ function closeUpdateWindow (event) {
+ console.log(updateItem)
+ if (updateItem) {
+ updateItem.removeAllListeners()
+ updateItem.cancel() // cancel 后,DownloadItem 就是 null 了
+ updateItem = null
+ }
+ }
+ ipcMain.on('update-switch', (event, arg) => {
+ if (updateItem) {
+ let status = ''
+ if (updateItem.isPaused()) {
+ if (updateItem.canResume()) {
+ updateItem.resume()
+ status = '暂停'
}
- event.sender.send("send-isMax", mainWindow.isMaximized())
- })
- ipcMain.on("sync-minimize", (event, arg) => {
- if (!mainWindow.isMinimized()) {
- mainWindow.minimize()
- console.log("可以最小化")
+ } else {
+ updateItem.pause()
+ status = '继续'
+ }
+ event.sender.send('update-switch-response', {
+ text: status
+ })
+ }
+ })
+
+ ipcMain.on('update-cancel', (event, arg) => {
+ if (updateItem) {
+ updateItem.removeAllListeners()
+ updateItem.cancel()
+ updateWindow.close()
+ updateItem = null
+ }
+ })
+
+ ipcMain.on('update-checkout', (event, arg) => {
+ if (updateItem) {
+ updateItem.cancel()
+ shell.openExternal('https://xcel.aotu.io/')
+ updateWindow.close()
+ updateItem = null
+ }
+ })
+
+ ipcMain.on('readFile-response', (event, arg) => {
+ console.log('触发readFile-response')
+ mainWindow.webContents.send('readFile-response', arg)
+ })
+ ipcMain.on('readFile-start', (event, arg) => {
+ console.log('读取文件emit')
+ savePath = getSavePath(arg.data.path)
+ console.log(savePath)
+ backgroundWindow.webContents.send('readFile-start', arg)
+ })
+
+ ipcMain.on('generate-htmlstring-response', (event, arg) => {
+ mainWindow.webContents.send('generate-htmlstring-response', arg)
+ })
+
+ ipcMain.on('filter-response', (event, arg) => {
+ mainWindow.webContents.send('filter-response', arg)
+ })
+ ipcMain.on('filter-start', (event, arg) => {
+ backgroundWindow.webContents.send('filter-start', arg)
+ })
+
+ ipcMain.on('changeTab-start', (event, arg) => {
+ backgroundWindow.webContents.send('changeTab-start', arg)
+ })
+
+ ipcMain.on('exportFile-response', (event, arg) => {
+ mainWindow.webContents.send('exportFile-response', arg)
+ })
+ ipcMain.on('exportFile-start', (event, arg) => {
+ backgroundWindow.webContents.send('exportFile-start', arg)
+ })
+
+ ipcMain.on('delAllFilterTag-start', (event, arg) => {
+ backgroundWindow.webContents.send('delAllFilterTag-start', arg)
+ })
+
+ ipcMain.on('sync-openFile-dialog', (event, arg) => {
+ dialog.showOpenDialog({
+ title: '请选择Excel文件',
+ filters: [{ name: 'Excel File', extensions: ['xls', 'xlsx'] }],
+ properties: ['openFile']
+ }, function (arr) {
+ if (typeof arr !== 'undefined') {
+ // arr 是一个文件路径 数组
+ // console.log("event", event)
+ // 正常触发
+ if (event) {
+ event.sender.send('open-file-response', arr[0])
} else {
- console.log("不可最小化,因为已经最小化了")
+ // 通过 emit 触发(如快捷键)
+ const mainWindow = BrowserWindow.fromId(1)
+ if (mainWindow) {
+ mainWindow.webContents.send('open-file-response', arr[0])
+ }
}
- })
+ }
+ })
+ })
+
+ ipcMain.on('sync-saveFile-dialog', (event, arg) => {
+ console.log('sync-saveFile-dialog')
+ dialog.showSaveDialog({
+ title: '请选择保存路径',
+ defaultPath: savePath,
+ filters: [{
+ name: 'Excel',
+ extensions: ['xlsx']
+ }]
+ }, function (p) {
+ if (typeof p !== 'undefined') {
+ xlsx.writeFile(arg.data, p)
+ }
+ // p 是用户输入的路径名
+ console.log('p', p)
+ })
+ })
+
+ ipcMain.on('sync-alert-dialog', (event, arg) => {
+ dialog.showMessageBox({
+ type: 'warning',
+ buttons: ['确定'],
+ defaultId: 0, // dialog 打开是默认选中哪个按钮
+ title: arg.title || 'xcel',
+ message: arg.content || '',
+ detail: arg.detail || ''
+ })
+ })
+
+ // 接受窗口的最小化、最大化、关闭 事件
+ ipcMain.on('sync-close', (event, arg) => {
+ mainWindow.close()
+ })
+ ipcMain.on('sync-maximize', (event, arg) => {
+ let windowBounds = {
+ width: 1280,
+ height: 850
+ }
+ if (mainWindow.isMaximized()) {
+ mainWindow.setBounds(windowBounds)
+ } else {
+ windowBounds = mainWindow.getBounds()
+ mainWindow.maximize()
+ }
+ event.sender.send('send-isMax', mainWindow.isMaximized())
+ })
+ ipcMain.on('sync-minimize', (event, arg) => {
+ if (!mainWindow.isMinimized()) {
+ mainWindow.minimize()
+ console.log('可以最小化')
+ } else {
+ console.log('不可最小化,因为已经最小化了')
+ }
+ })
}
-function getSavePath(uPath) {
- var file = path.parse(uPath)
- return path.join(file.dir, file.name + '-' + shortid.generate() + file.ext)
-}
\ No newline at end of file
+function getSavePath (uPath) {
+ const file = path.parse(uPath)
+ return path.join(file.dir, `${file.name}-${shortid.generate()}${file.ext}`)
+}
diff --git a/app/menuTemplate.js b/app/menuTemplate.js
index 87a9438..decbc13 100644
--- a/app/menuTemplate.js
+++ b/app/menuTemplate.js
@@ -2,163 +2,159 @@ const electron = require('electron')
const BrowserWindow = electron.BrowserWindow
const ipcMain = electron.ipcMain
-var template = [
- {
- label: 'File',
- submenu: [
- {
- label: 'Open File',
- accelerator: 'CmdOrCtrl+O',
- click: function (item, focusedWindow) {
- ipcMain.emit('sync-openFile-dialog')
- }
- }
- ]
- },
- {
- label: 'View',
- submenu: [
- {
- label: 'Reload',
- accelerator: 'CmdOrCtrl+R',
- click: function (item, focusedWindow) {
- // console.log("BrowserWindow.getAllWindows()", BrowserWindow.getAllWindows());
- Array.prototype.forEach.call(BrowserWindow.getAllWindows(), (win, i) => {
- win.reload()
- })
- // if (focusedWindow) focusedWindow.reload()
- }
- },
- {
- label: 'Toggle Developer Tools',
- accelerator: (function () {
- if (process.platform === 'darwin') {
- return 'Alt+Command+I'
- } else {
- return 'Ctrl+Shift+I'
- }
- })(),
- click: function (item, focusedWindow) {
- if (focusedWindow) focusedWindow.toggleDevTools()
- }
- },
- {
- label: 'Toggle Background Renderer',
- accelerator: (function () {
- if (process.platform === 'darwin') {
- return 'Alt+Command+B'
- } else {
- return 'Ctrl+Shift+B'
- }
- })(),
- click: function (item, focusedWindow) {
- var backWin = BrowserWindow.fromId(2)
- if (backWin.isVisible()) {
- backWin.hide()
- } else {
- backWin.show()
- backWin.focus()
- }
- }
- }
- ]
- },
- {
- label: 'Help',
- role: 'help'/*,
+const template = [
+ {
+ label: 'File',
+ submenu: [
+ {
+ label: 'Open File',
+ accelerator: 'CmdOrCtrl+O',
+ click (item, focusedWindow) {
+ ipcMain.emit('sync-openFile-dialog')
+ }
+ }
+ ]
+ },
+ {
+ label: 'View',
+ submenu: [
+ {
+ label: 'Reload',
+ accelerator: 'CmdOrCtrl+R',
+ click (item, focusedWindow) {
+ Array.prototype.forEach.call(BrowserWindow.getAllWindows(), (win, i) => {
+ win.reload()
+ })
+ }
+ },
+ {
+ label: 'Toggle Developer Tools',
+ accelerator: (function () {
+ if (process.platform === 'darwin') {
+ return 'Alt+Command+I'
+ }
+ return 'Ctrl+Shift+I'
+ })(),
+ click (item, focusedWindow) {
+ if (focusedWindow) focusedWindow.toggleDevTools()
+ }
+ },
+ {
+ label: 'Toggle Background Renderer',
+ accelerator: (function () {
+ if (process.platform === 'darwin') {
+ return 'Alt+Command+B'
+ }
+ return 'Ctrl+Shift+B'
+ })(),
+ click (item, focusedWindow) {
+ const backWin = BrowserWindow.fromId(2)
+ if (backWin.isVisible()) {
+ backWin.hide()
+ } else {
+ backWin.show()
+ backWin.focus()
+ }
+ }
+ }
+ ]
+ },
+ {
+ label: 'Help',
+ role: 'help'/*,
submenu: [
{
label: 'Learn More',
click: function () { require('electron').shell.openExternal('http://electron.atom.io') }
}
- ]*/
- }
+ ] */
+ }
]
if (process.platform === 'darwin') {
- var name = electron.app.getName()
- console.log("appname", name)
- template.unshift({
- label: 'Edit',
- submenu: [
- {
- label: 'Undo',
- accelerator: 'CmdOrCtrl+Z',
- role: 'undo'
- },
- {
- label: 'Redo',
- accelerator: 'Shift+CmdOrCtrl+Z',
- role: 'redo'
- },
- {
- type: 'separator'
- },
- {
- label: 'Cut',
- accelerator: 'CmdOrCtrl+X',
- role: 'cut'
- },
- {
- label: 'Copy',
- accelerator: 'CmdOrCtrl+C',
- role: 'copy'
- },
- {
- label: 'Paste',
- accelerator: 'CmdOrCtrl+V',
- role: 'paste'
- },
- {
- label: 'Select All',
- accelerator: 'CmdOrCtrl+A',
- role: 'selectall'
- }
- ]
- })
- template.unshift({
- label: name,
- submenu: [
- {
- label: 'About ' + name,
- role: 'about'
- },
- {
- type: 'separator'
- },
- {
- label: 'Services',
- role: 'services',
- submenu: []
- },
- {
- type: 'separator'
- },
- {
- label: 'Hide ' + name,
- accelerator: 'Command+H',
- role: 'hide'
- },
- {
- label: 'Hide Others',
- accelerator: 'Command+Alt+H',
- role: 'hideothers'
- },
- {
- label: 'Show All',
- role: 'unhide'
- },
- {
- type: 'separator'
- },
- {
- label: 'Quit',
- accelerator: 'Command+Q',
- click: function () { electron.app.quit() }
- }
- ]
- })
- template.unshift()
+ const name = electron.app.getName()
+ console.log('appname', name)
+ template.unshift({
+ label: 'Edit',
+ submenu: [
+ {
+ label: 'Undo',
+ accelerator: 'CmdOrCtrl+Z',
+ role: 'undo'
+ },
+ {
+ label: 'Redo',
+ accelerator: 'Shift+CmdOrCtrl+Z',
+ role: 'redo'
+ },
+ {
+ type: 'separator'
+ },
+ {
+ label: 'Cut',
+ accelerator: 'CmdOrCtrl+X',
+ role: 'cut'
+ },
+ {
+ label: 'Copy',
+ accelerator: 'CmdOrCtrl+C',
+ role: 'copy'
+ },
+ {
+ label: 'Paste',
+ accelerator: 'CmdOrCtrl+V',
+ role: 'paste'
+ },
+ {
+ label: 'Select All',
+ accelerator: 'CmdOrCtrl+A',
+ role: 'selectall'
+ }
+ ]
+ })
+ template.unshift({
+ label: name,
+ submenu: [
+ {
+ label: `About ${name}`,
+ role: 'about'
+ },
+ {
+ type: 'separator'
+ },
+ {
+ label: 'Services',
+ role: 'services',
+ submenu: []
+ },
+ {
+ type: 'separator'
+ },
+ {
+ label: `Hide ${name}`,
+ accelerator: 'Command+H',
+ role: 'hide'
+ },
+ {
+ label: 'Hide Others',
+ accelerator: 'Command+Alt+H',
+ role: 'hideothers'
+ },
+ {
+ label: 'Show All',
+ role: 'unhide'
+ },
+ {
+ type: 'separator'
+ },
+ {
+ label: 'Quit',
+ accelerator: 'Command+Q',
+ click () { electron.app.quit() }
+ }
+ ]
+ })
+ template.unshift()
}
-module.exports = template
\ No newline at end of file
+module.exports = template
diff --git a/app/src/App.vue b/app/src/App.vue
index 1c80f15..58d1c9c 100644
--- a/app/src/App.vue
+++ b/app/src/App.vue
@@ -1,68 +1,66 @@
-
{{ selectedGroupStr }}
-请先上传Excel文件或该文件未含有列
{{ getLogicOperatorWords(logicOperator) }}
- +{{operatorCol.length === 0 ? "请选择列" : formatColGroup}}