Sky
提交者 GitHub

合并伞22/dev#19拉取请求

合并修改
...@@ -9,7 +9,7 @@ module.exports = { ...@@ -9,7 +9,7 @@ module.exports = {
9 chineseLog: false, 9 chineseLog: false,
10 port: 9080 10 port: 9080
11 }, 11 },
12 - UseStartupChart: true, 12 + UseStartupChart: false,
13 IsUseSysTitle: true, 13 IsUseSysTitle: true,
14 DllFolder: '', 14 DllFolder: '',
15 BuiltInServerPort: 25565 15 BuiltInServerPort: 25565
......
此文件的差异太大,无法显示。
...@@ -78,37 +78,34 @@ ...@@ -78,37 +78,34 @@
78 "express": "^4.17.1", 78 "express": "^4.17.1",
79 "fs-extra": "^9.0.1", 79 "fs-extra": "^9.0.1",
80 "js-cookie": "^2.2.1", 80 "js-cookie": "^2.2.1",
81 - "nedb": "^1.8.0",
82 "nprogress": "^0.2.0", 81 "nprogress": "^0.2.0",
83 "vue": "^2.6.11", 82 "vue": "^2.6.11",
84 - "vue-electron": "^1.0.6",
85 "vue-router": "^3.3.2", 83 "vue-router": "^3.3.2",
86 - "vuex": "^3.4.0", 84 + "vuex": "^3.4.0"
87 - "vuex-electron": "^1.0.3"
88 }, 85 },
89 "devDependencies": { 86 "devDependencies": {
90 - "@babel/core": "^7.10.2", 87 + "@babel/core": "^7.10.3",
91 "@babel/plugin-proposal-class-properties": "^7.10.1", 88 "@babel/plugin-proposal-class-properties": "^7.10.1",
92 - "@babel/plugin-proposal-decorators": "^7.10.1", 89 + "@babel/plugin-proposal-decorators": "^7.10.3",
93 "@babel/plugin-proposal-do-expressions": "^7.10.1", 90 "@babel/plugin-proposal-do-expressions": "^7.10.1",
94 "@babel/plugin-proposal-export-default-from": "^7.10.1", 91 "@babel/plugin-proposal-export-default-from": "^7.10.1",
95 "@babel/plugin-proposal-export-namespace-from": "^7.10.1", 92 "@babel/plugin-proposal-export-namespace-from": "^7.10.1",
96 "@babel/plugin-proposal-function-bind": "^7.10.1", 93 "@babel/plugin-proposal-function-bind": "^7.10.1",
97 "@babel/plugin-proposal-function-sent": "^7.10.1", 94 "@babel/plugin-proposal-function-sent": "^7.10.1",
98 "@babel/plugin-proposal-json-strings": "^7.10.1", 95 "@babel/plugin-proposal-json-strings": "^7.10.1",
99 - "@babel/plugin-proposal-logical-assignment-operators": "^7.10.1", 96 + "@babel/plugin-proposal-logical-assignment-operators": "^7.10.3",
100 "@babel/plugin-proposal-nullish-coalescing-operator": "^7.10.1", 97 "@babel/plugin-proposal-nullish-coalescing-operator": "^7.10.1",
101 "@babel/plugin-proposal-numeric-separator": "^7.10.1", 98 "@babel/plugin-proposal-numeric-separator": "^7.10.1",
102 - "@babel/plugin-proposal-optional-chaining": "^7.10.1", 99 + "@babel/plugin-proposal-optional-chaining": "^7.10.3",
103 "@babel/plugin-proposal-pipeline-operator": "^7.10.1", 100 "@babel/plugin-proposal-pipeline-operator": "^7.10.1",
104 "@babel/plugin-proposal-throw-expressions": "^7.10.1", 101 "@babel/plugin-proposal-throw-expressions": "^7.10.1",
105 "@babel/plugin-syntax-dynamic-import": "^7.8.3", 102 "@babel/plugin-syntax-dynamic-import": "^7.8.3",
106 "@babel/plugin-syntax-import-meta": "^7.10.1", 103 "@babel/plugin-syntax-import-meta": "^7.10.1",
107 - "@babel/plugin-transform-runtime": "^7.10.1", 104 + "@babel/plugin-transform-runtime": "^7.10.3",
108 "@babel/polyfill": "^7.10.1", 105 "@babel/polyfill": "^7.10.1",
109 - "@babel/preset-env": "^7.10.2", 106 + "@babel/preset-env": "^7.10.3",
110 - "@babel/register": "^7.10.1", 107 + "@babel/register": "^7.10.3",
111 - "@babel/runtime": "^7.10.2", 108 + "@babel/runtime": "^7.10.3",
112 "ajv": "^6.12.2", 109 "ajv": "^6.12.2",
113 "babel-eslint": "^9.0.0", 110 "babel-eslint": "^9.0.0",
114 "babel-loader": "^8.1.0", 111 "babel-loader": "^8.1.0",
...@@ -120,7 +117,7 @@ ...@@ -120,7 +117,7 @@
120 "cross-env": "^7.0.2", 117 "cross-env": "^7.0.2",
121 "css-loader": "^3.5.3", 118 "css-loader": "^3.5.3",
122 "del": "^5.1.0", 119 "del": "^5.1.0",
123 - "electron": "^8.3.0", 120 + "electron": "^8.3.3",
124 "electron-builder": "^22.6.1", 121 "electron-builder": "^22.6.1",
125 "electron-devtools-installer": "^3.0.0", 122 "electron-devtools-installer": "^3.0.0",
126 "eslint": "^6.8.0", 123 "eslint": "^6.8.0",
...@@ -138,13 +135,13 @@ ...@@ -138,13 +135,13 @@
138 "mini-css-extract-plugin": "0.9.0", 135 "mini-css-extract-plugin": "0.9.0",
139 "multispinner": "^0.2.1", 136 "multispinner": "^0.2.1",
140 "node-loader": "^0.6.0", 137 "node-loader": "^0.6.0",
141 - "node-sass": "^4.14.1",
142 "portfinder": "^1.0.26", 138 "portfinder": "^1.0.26",
139 + "sass": "^1.26.8",
143 "sass-loader": "^8.0.2", 140 "sass-loader": "^8.0.2",
144 "split2": "^3.1.1", 141 "split2": "^3.1.1",
145 "style-loader": "^1.2.1", 142 "style-loader": "^1.2.1",
146 "svg-sprite-loader": "^4.3.0", 143 "svg-sprite-loader": "^4.3.0",
147 - "terser-webpack-plugin": "^3.0.3", 144 + "terser-webpack-plugin": "^3.0.6",
148 "through2-filter": "^3.0.0", 145 "through2-filter": "^3.0.0",
149 "url-loader": "^4.1.0", 146 "url-loader": "^4.1.0",
150 "vue-html-loader": "^1.2.4", 147 "vue-html-loader": "^1.2.4",
...@@ -152,7 +149,7 @@ ...@@ -152,7 +149,7 @@
152 "vue-style-loader": "^4.1.2", 149 "vue-style-loader": "^4.1.2",
153 "vue-template-compiler": "^2.6.11", 150 "vue-template-compiler": "^2.6.11",
154 "webpack": "^4.43.0", 151 "webpack": "^4.43.0",
155 - "webpack-cli": "^3.3.11", 152 + "webpack-cli": "^3.3.12",
156 "webpack-dev-server": "^3.11.0", 153 "webpack-dev-server": "^3.11.0",
157 "webpack-hot-middleware": "^2.25.0", 154 "webpack-hot-middleware": "^2.25.0",
158 "webpack-merge": "^4.2.2" 155 "webpack-merge": "^4.2.2"
......
...@@ -54,13 +54,13 @@ export default { ...@@ -54,13 +54,13 @@ export default {
54 Message(mainWindow, 4) 54 Message(mainWindow, 4)
55 }) 55 })
56 // 执行自动更新检查 56 // 执行自动更新检查
57 - ipcMain.on('check-update', () => { 57 + ipcMain.handle('check-update', () => {
58 autoUpdater.checkForUpdates().catch(err => { 58 autoUpdater.checkForUpdates().catch(err => {
59 console.log('网络连接问题', err) 59 console.log('网络连接问题', err)
60 }) 60 })
61 }) 61 })
62 // 渲染进程执行更新操作 62 // 渲染进程执行更新操作
63 - ipcMain.on('confirm-update', () => { 63 + ipcMain.handle('confirm-update', () => {
64 autoUpdater.quitAndInstall() 64 autoUpdater.quitAndInstall()
65 }) 65 })
66 } 66 }
......
...@@ -21,9 +21,8 @@ if (os.platform().includes('win32')) { ...@@ -21,9 +21,8 @@ if (os.platform().includes('win32')) {
21 } 21 }
22 export default { 22 export default {
23 download (mainWindow) { 23 download (mainWindow) {
24 - ipcMain.on('start-download', (event, msg) => { 24 + ipcMain.handle('start-download', (event, msg) => {
25 mainWindow.webContents.downloadURL(msg.downloadUrL || defaultDownloadUrL) 25 mainWindow.webContents.downloadURL(msg.downloadUrL || defaultDownloadUrL)
26 - event.reply('confirm-download', true)
27 mainWindow.webContents.session.on('will-download', (event, item, webContents) => { 26 mainWindow.webContents.session.on('will-download', (event, item, webContents) => {
28 // 将文件保存在系统的下载目录 27 // 将文件保存在系统的下载目录
29 const filePath = path.join(app.getPath('downloads'), item.getFilename()) 28 const filePath = path.join(app.getPath('downloads'), item.getFilename())
......
...@@ -4,63 +4,64 @@ import { winURL } from '../config/StaticPath' ...@@ -4,63 +4,64 @@ import { winURL } from '../config/StaticPath'
4 4
5 export default { 5 export default {
6 Mainfunc (mainWindow, IsUseSysTitle) { 6 Mainfunc (mainWindow, IsUseSysTitle) {
7 - ipcMain.on('IsUseSysTitle', (event) => { 7 + ipcMain.handle('IsUseSysTitle', async () => {
8 - const data = IsUseSysTitle 8 + return IsUseSysTitle
9 - event.reply('CisUseSysTitle', data)
10 }) 9 })
11 - ipcMain.on('windows-mini', () => { 10 + ipcMain.handle('windows-mini', () => {
12 mainWindow.minimize() 11 mainWindow.minimize()
13 }) 12 })
14 - ipcMain.on('window-max', (event) => { 13 + ipcMain.handle('window-max', async () => {
15 if (mainWindow.isMaximized()) { 14 if (mainWindow.isMaximized()) {
16 - event.reply('window-confirm', false)
17 mainWindow.restore() 15 mainWindow.restore()
16 + return { status: false }
18 } else { 17 } else {
19 - event.reply('window-confirm', true)
20 mainWindow.maximize() 18 mainWindow.maximize()
19 + return { status: true }
21 } 20 }
22 }) 21 })
23 - ipcMain.on('window-close', () => { 22 + ipcMain.handle('window-close', () => {
24 mainWindow.close() 23 mainWindow.close()
25 }) 24 })
26 - ipcMain.on('open-messagebox', (event, arg) => { 25 + ipcMain.handle('open-messagebox', async (event, arg) => {
27 - dialog.showMessageBox(mainWindow, { 26 + const res = await dialog.showMessageBox(mainWindow, {
28 type: arg.type || 'info', 27 type: arg.type || 'info',
29 title: arg.title || '', 28 title: arg.title || '',
30 buttons: arg.buttons || [], 29 buttons: arg.buttons || [],
31 message: arg.message || '', 30 message: arg.message || '',
32 noLink: arg.noLink || true 31 noLink: arg.noLink || true
33 - }).then(res => {
34 - event.reply('confirm-message', res)
35 }) 32 })
33 + return res
36 }) 34 })
37 - ipcMain.on('open-errorbox', (event, arg) => { 35 + ipcMain.handle('open-errorbox', (event, arg) => {
38 dialog.showErrorBox( 36 dialog.showErrorBox(
39 arg.title, 37 arg.title,
40 arg.message 38 arg.message
41 ) 39 )
42 }) 40 })
43 - ipcMain.on('statr-server', (event, arg) => { 41 + ipcMain.handle('statr-server', async () => {
44 - Server.StatrServer().then(res => { 42 + try {
45 - event.reply('confirm-start', res) 43 + const serveStatus = await Server.StatrServer()
46 - }).catch(err => { 44 + console.log(serveStatus)
45 + return serveStatus
46 + } catch (error) {
47 dialog.showErrorBox( 47 dialog.showErrorBox(
48 '错误', 48 '错误',
49 - err 49 + error
50 ) 50 )
51 + }
51 }) 52 })
52 - }) 53 + ipcMain.handle('stop-server', async (event, arg) => {
53 - ipcMain.on('stop-server', (event, arg) => { 54 + try {
54 - Server.StopServer().then(res => { 55 + const serveStatus = await Server.StopServer()
55 - event.reply('confirm-stop', res) 56 + return serveStatus
56 - }).catch(err => { 57 + } catch (error) {
57 dialog.showErrorBox( 58 dialog.showErrorBox(
58 '错误', 59 '错误',
59 - err 60 + error
60 ) 61 )
62 + }
61 }) 63 })
62 - }) 64 + ipcMain.handle('open-win', (event, arg) => {
63 - ipcMain.on('open-win', (event, arg) => {
64 const ChildWin = new BrowserWindow({ 65 const ChildWin = new BrowserWindow({
65 height: 595, 66 height: 595,
66 useContentSize: true, 67 useContentSize: true,
......
...@@ -58,14 +58,14 @@ function createMainWindow () { ...@@ -58,14 +58,14 @@ function createMainWindow () {
58 electronDevtoolsInstaller(VUEJS_DEVTOOLS) 58 electronDevtoolsInstaller(VUEJS_DEVTOOLS)
59 .then((name) => console.log(`installed: ${name}`)) 59 .then((name) => console.log(`installed: ${name}`))
60 .catch(err => console.log('Unable to install `vue-devtools`: \n', err)) 60 .catch(err => console.log('Unable to install `vue-devtools`: \n', err))
61 - loadWindow.destroy()
62 }) 61 })
62 + if (config.UseStartupChart) loadWindow.destroy()
63 +
63 mainWindow.webContents.openDevTools(true) 64 mainWindow.webContents.openDevTools(true)
64 } else { 65 } else {
65 mainWindow.webContents.once('dom-ready', () => { 66 mainWindow.webContents.once('dom-ready', () => {
66 mainWindow.show() 67 mainWindow.show()
67 - loadWindow.destroy() 68 + if (config.UseStartupChart) loadWindow.destroy()
68 - // mainWindow.webContents.openDevTools(true)
69 }) 69 })
70 } 70 }
71 71
......
1 -import request from '@/utils/request' 1 +// 仅示例
2 +// import request from '@/utils/request'
2 3
3 -export function login (data) { 4 +// export function login (data) {
4 - return request({ 5 +// return request({
5 - url: '/user/login', 6 +// url: '/user/login',
6 - method: 'post', 7 +// method: 'post',
7 - data 8 +// data
8 - }) 9 +// })
9 -} 10 +// }
10 11
11 -export function getInfo (token) { 12 +// export function getInfo (token) {
12 - return request({ 13 +// return request({
13 - url: '/user/info', 14 +// url: '/user/info',
14 - method: 'get', 15 +// method: 'get',
15 - params: { token } 16 +// params: { token }
16 - }) 17 +// })
17 -} 18 +// }
18 -
19 -export function logout () {
20 - return request({
21 - url: '/user/logout',
22 - method: 'post'
23 - })
24 -}
25 -
26 -export function message () {
27 - return request({
28 - url: '/message',
29 - method: 'get'
30 - })
31 -}
......
1 -import db from '@/utils/db'
2 -
3 -export default {
4 - adddata (data) {
5 - return new Promise((resolve, reject) => {
6 - db.insert(data, (err, newdoc) => {
7 - if (err) {
8 - reject(err)
9 - return false
10 - }
11 - resolve(newdoc)
12 - })
13 - })
14 - },
15 - finddata (query) {
16 - return new Promise((resolve, reject) => {
17 - db.find(query, (err, res) => {
18 - if (err) {
19 - reject(err)
20 - return false
21 - }
22 - resolve(res)
23 - })
24 - })
25 - },
26 - findone (query) {
27 - return new Promise((resolve, reject) => {
28 - db.findOne(query, (err, res) => {
29 - if (err) {
30 - reject(err)
31 - return false
32 - }
33 - resolve(res)
34 - })
35 - })
36 - },
37 - deleone (query) {
38 - return new Promise((resolve, reject) => {
39 - db.remove(query, (err, number) => {
40 - if (err) {
41 - reject(err)
42 - return false
43 - }
44 - resolve(number)
45 - })
46 - })
47 - },
48 - deleall (query) {
49 - return new Promise((resolve, reject) => {
50 - db.remove(query, {
51 - multi: true
52 - }, (err, number) => {
53 - if (err) {
54 - reject(err)
55 - return false
56 - }
57 - resolve(number)
58 - })
59 - })
60 - }
61 -}
...@@ -19,9 +19,6 @@ ...@@ -19,9 +19,6 @@
19 <div class="doc"> 19 <div class="doc">
20 <div class="title alt">您可以点击的按钮测试功能</div> 20 <div class="title alt">您可以点击的按钮测试功能</div>
21 <el-button type="primary" round @click="open()">控制台打印</el-button> 21 <el-button type="primary" round @click="open()">控制台打印</el-button>
22 - <el-button type="primary" round @click="setdata">写入数据</el-button>
23 - <el-button type="primary" round @click="getdata">读取数据</el-button>
24 - <el-button type="primary" round @click="deledata">清除所有数据</el-button>
25 <el-button type="primary" round @click="CheckUpdate('one')">检查更新</el-button> 22 <el-button type="primary" round @click="CheckUpdate('one')">检查更新</el-button>
26 </div> 23 </div>
27 <div class="doc"> 24 <div class="doc">
...@@ -99,8 +96,7 @@ export default { ...@@ -99,8 +96,7 @@ export default {
99 }); 96 });
100 }, 97 },
101 StopServer() { 98 StopServer() {
102 - this.$ipcApi.send("stop-server"); 99 + this.$ipcApi.send("stop-server").then(res => {
103 - this.$ipcApi.on("confirm-stop", (event, arg) => {
104 this.$message({ 100 this.$message({
105 type: "success", 101 type: "success",
106 message: "已关闭" 102 message: "已关闭"
...@@ -108,83 +104,28 @@ export default { ...@@ -108,83 +104,28 @@ export default {
108 }); 104 });
109 }, 105 },
110 StartServer() { 106 StartServer() {
111 - this.$ipcApi.send("statr-server"); 107 + this.$ipcApi.send("statr-server").then(res => {
112 - this.$ipcApi.on("confirm-start", (event, arg) => { 108 + if (res) {
113 - console.log(arg);
114 this.$message({ 109 this.$message({
115 type: "success", 110 type: "success",
116 - message: arg 111 + message: res
117 - });
118 - });
119 - },
120 - // 获取electron方法
121 - open() {
122 - console.log(this.$electron);
123 - },
124 - // 设置数据库的数据
125 - setdata() {
126 - this.$db
127 - .adddata(this.newdata)
128 - .then(res => this.getdata())
129 - .catch(err => console.log(err));
130 - },
131 - // 获取数据库的数据
132 - getdata() {
133 - this.$db
134 - .finddata()
135 - .then(res => {
136 - console.log(res);
137 - this.textarray = res;
138 - console.log(this.textarray);
139 - })
140 - .catch(err => console.log(err));
141 - },
142 - // 清空数据库的数据
143 - deledata() {
144 - // data则是显示需要的参数
145 - const data = {
146 - title: "清除数据",
147 - buttons: ["确定了!", "才不要,我手滑了"],
148 - noLink: true,
149 - message: "此操作会清空本地数据库中的所有数据,是否继续?"
150 - };
151 - this.$ipcApi.send("open-messagebox", data);
152 - this.$ipcApi.on("confirm-message", (event, arg) => {
153 - console.log(arg);
154 - if (arg.response === 0) {
155 - this.$db.deleall({ name: "yyy" }).then(res => {
156 - console.log(res);
157 - if (res !== 0) {
158 - this.getdata();
159 - this.$message({
160 - message: "成功删除" + res + "条",
161 - type: "success"
162 - });
163 - } else {
164 - let errormsg = {
165 - title: "错误",
166 - message: "已经没有数据可以被删除!"
167 - };
168 - this.$ipcApi.send("open-errorbox", errormsg);
169 - }
170 }); 112 });
171 } 113 }
172 }); 114 });
173 }, 115 },
116 + // 获取electron方法
117 + open() {},
174 CheckUpdate(data) { 118 CheckUpdate(data) {
175 switch (data) { 119 switch (data) {
176 case "one": 120 case "one":
177 - const dialog = this.$electron.remote.dialog; 121 + this.$ipcApi.send("check-update").then(res => {
178 - this.$ipcApi.send("check-update"); 122 + switch (res.state) {
179 - console.log("启动检查");
180 - this.$ipcApi.on("UpdateMsg", (event, data) => {
181 - console.log(data);
182 - switch (data.state) {
183 case -1: 123 case -1:
184 const msgdata = { 124 const msgdata = {
185 - title: data.msg 125 + title: "发生错误",
126 + message: res.msg
186 }; 127 };
187 - api.MessageBox(dialog, msgdata); 128 + this.$ipcApi.send("open-errorbox");
188 break; 129 break;
189 case 0: 130 case 0:
190 this.$message("正在检查更新"); 131 this.$message("正在检查更新");
...@@ -200,7 +141,7 @@ export default { ...@@ -200,7 +141,7 @@ export default {
200 this.$message({ type: "success", message: "无新版本" }); 141 this.$message({ type: "success", message: "无新版本" });
201 break; 142 break;
202 case 3: 143 case 3:
203 - this.percentage = data.msg.percent.toFixed(1); 144 + this.percentage = res.msg.percent.toFixed(1);
204 break; 145 break;
205 case 4: 146 case 4:
206 this.progressStaus = "success"; 147 this.progressStaus = "success";
...@@ -216,14 +157,13 @@ export default { ...@@ -216,14 +157,13 @@ export default {
216 break; 157 break;
217 } 158 }
218 }); 159 });
160 + console.log("启动检查");
161 + console.log(data);
162 +
219 break; 163 break;
220 case "two": 164 case "two":
221 - console.log(111); 165 + this.$ipcApi.send("start-download").then(() => {
222 - this.$ipcApi.send("start-download");
223 - this.$ipcApi.on("confirm-download", (event, arg) => {
224 - if (arg) {
225 this.dialogVisible = true; 166 this.dialogVisible = true;
226 - }
227 }); 167 });
228 this.$ipcApi.on("download-progress", (event, arg) => { 168 this.$ipcApi.on("download-progress", (event, arg) => {
229 this.percentage = Number(arg); 169 this.percentage = Number(arg);
...@@ -252,7 +192,7 @@ export default { ...@@ -252,7 +192,7 @@ export default {
252 this.$alert("更新下载完成!", "提示", { 192 this.$alert("更新下载完成!", "提示", {
253 confirmButtonText: "确定", 193 confirmButtonText: "确定",
254 callback: action => { 194 callback: action => {
255 - this.$electron.shell.openItem(this.filePath); 195 + this.$electron.shell.openPath(this.filePath);
256 } 196 }
257 }); 197 });
258 }); 198 });
...@@ -267,7 +207,7 @@ export default { ...@@ -267,7 +207,7 @@ export default {
267 } 207 }
268 }, 208 },
269 destroyed() { 209 destroyed() {
270 - console.log("销毁了哦") 210 + console.log("销毁了哦");
271 this.$ipcApi.remove("confirm-message"); 211 this.$ipcApi.remove("confirm-message");
272 this.$ipcApi.remove("download-done"); 212 this.$ipcApi.remove("download-done");
273 this.$ipcApi.remove("download-paused"); 213 this.$ipcApi.remove("download-paused");
......
...@@ -102,7 +102,7 @@ export default { ...@@ -102,7 +102,7 @@ export default {
102 <style lang="scss" scoped> 102 <style lang="scss" scoped>
103 .editor-slide-upload { 103 .editor-slide-upload {
104 margin-bottom: 20px; 104 margin-bottom: 20px;
105 - /deep/ .el-upload--picture-card { 105 + ::v-deep .el-upload--picture-card {
106 width: 100%; 106 width: 100%;
107 } 107 }
108 } 108 }
......
...@@ -35,11 +35,9 @@ export default { ...@@ -35,11 +35,9 @@ export default {
35 35
36 components: {}, 36 components: {},
37 created() { 37 created() {
38 - this.$ipcApi.send("IsUseSysTitle"); 38 + this.$ipcApi.send("IsUseSysTitle").then(res => {
39 - this.$ipcApi.on( 39 + this.IsUseSysTitle = res;
40 - "CisUseSysTitle", 40 + });
41 - (event, arg) => (this.IsUseSysTitle = arg)
42 - );
43 }, 41 },
44 42
45 mounted() {}, 43 mounted() {},
...@@ -49,8 +47,9 @@ export default { ...@@ -49,8 +47,9 @@ export default {
49 this.$ipcApi.send("windows-mini"); 47 this.$ipcApi.send("windows-mini");
50 }, 48 },
51 MixOrReduction() { 49 MixOrReduction() {
52 - this.$ipcApi.send("window-max"); 50 + this.$ipcApi.send("window-max").then(res=>{
53 - this.$ipcApi.on("window-confirm", (event, arg) => (this.mix = arg)); 51 + this.mix = res.status
52 + })
54 }, 53 },
55 Close() { 54 Close() {
56 this.$ipcApi.send("window-close"); 55 this.$ipcApi.send("window-close");
......
...@@ -128,7 +128,7 @@ export default { ...@@ -128,7 +128,7 @@ export default {
128 width: 30px; 128 width: 30px;
129 height: 30px; 129 height: 30px;
130 margin-right: 10px; 130 margin-right: 10px;
131 - /deep/ img { 131 + ::v-deep img {
132 width: 100%; 132 width: 100%;
133 height: 100%; 133 height: 100%;
134 border-radius: 50%; 134 border-radius: 50%;
...@@ -144,7 +144,7 @@ export default { ...@@ -144,7 +144,7 @@ export default {
144 padding-right: 20px; 144 padding-right: 20px;
145 border-right: 1px solid #cccccc; 145 border-right: 1px solid #cccccc;
146 } 146 }
147 - .select-right /deep/ .el-dropdown > span { 147 + .select-right ::v-deep .el-dropdown > span {
148 font-size: 6px; 148 font-size: 6px;
149 } 149 }
150 .select-right { 150 .select-right {
...@@ -152,7 +152,7 @@ export default { ...@@ -152,7 +152,7 @@ export default {
152 color: #333333; 152 color: #333333;
153 font-weight: 400; 153 font-weight: 400;
154 } 154 }
155 - /deep/ .el-dropdown-selfdefine { 155 + ::v-deep .el-dropdown-selfdefine {
156 display: flex; 156 display: flex;
157 align-items: center; 157 align-items: center;
158 } 158 }
......
...@@ -129,12 +129,12 @@ export default { ...@@ -129,12 +129,12 @@ export default {
129 </script> 129 </script>
130 <style lang="scss" scoped> 130 <style lang="scss" scoped>
131 .menu-wrapper { 131 .menu-wrapper {
132 - /deep/ .el-menu-item, 132 + ::v-deep .el-menu-item,
133 .el-submenu__title { 133 .el-submenu__title {
134 height: 46px; 134 height: 46px;
135 line-height: 46px; 135 line-height: 46px;
136 } 136 }
137 - /deep/ .el-menu-item { 137 + ::v-deep .el-menu-item {
138 padding: 0 20px 0 12px; 138 padding: 0 20px 0 12px;
139 } 139 }
140 } 140 }
......
...@@ -13,12 +13,10 @@ import './icons' ...@@ -13,12 +13,10 @@ import './icons'
13 import '@/styles/index.scss' 13 import '@/styles/index.scss'
14 14
15 if (!process.env.IS_WEB) { 15 if (!process.env.IS_WEB) {
16 - Vue.use(require('vue-electron'))
17 if (!require('../../config').IsUseSysTitle) { 16 if (!require('../../config').IsUseSysTitle) {
18 require('@/styles/custom-title.scss') 17 require('@/styles/custom-title.scss')
19 } 18 }
20 // 当处于electron状态下才引用db 19 // 当处于electron状态下才引用db
21 - Vue.prototype.$db = require('./api/operationalData').default
22 Vue.prototype.$ipcApi = require('./utils/ipcRenderer').default 20 Vue.prototype.$ipcApi = require('./utils/ipcRenderer').default
23 } 21 }
24 22
......
1 -import DataStore from 'nedb'
2 -import path from 'path'
3 -import { remote } from 'electron'
4 -
5 -export default new DataStore({
6 - autoload: true,
7 - filename: path.join(remote.app.getPath('userData'), '/data.db')
8 -})
1 -import $electron from 'electron' 1 +import { ipcRenderer } from 'electron'
2 -
3 export default { 2 export default {
4 - send (data, arg, cb) { 3 + send (name, data = {}) {
5 - $electron.ipcRenderer.send(data, arg, (event, arg) => cb(event, arg)) 4 + return new Promise((resolve, reject) => {
5 + ipcRenderer.invoke(name, data).then(res => {
6 + resolve(res)
7 + })
8 + })
6 }, 9 },
7 - on (data, arg, cb) { 10 + on (name) {
8 - $electron.ipcRenderer.on(data, arg, (event, arg) => cb(event, arg)) 11 + return new Promise((resolve, reject) => {
9 - }, 12 + ipcRenderer.on(name, (event, args) => {
10 - remove (data) { 13 + resolve(args)
11 - $electron.ipcRenderer.removeAllListeners(data) 14 + })
15 + })
12 } 16 }
13 } 17 }
......
...@@ -133,7 +133,7 @@ $light_gray: #eee; ...@@ -133,7 +133,7 @@ $light_gray: #eee;
133 left: 0; 133 left: 0;
134 background-image: url("https://i.loli.net/2019/10/18/buDT4YS6zUMfHst.jpg"); 134 background-image: url("https://i.loli.net/2019/10/18/buDT4YS6zUMfHst.jpg");
135 background-position: center; 135 background-position: center;
136 - /deep/ .el-input { 136 + ::v-deep .el-input {
137 display: inline-block; 137 display: inline-block;
138 height: 47px; 138 height: 47px;
139 width: 85%; 139 width: 85%;
...@@ -151,7 +151,7 @@ $light_gray: #eee; ...@@ -151,7 +151,7 @@ $light_gray: #eee;
151 } 151 }
152 } 152 }
153 } 153 }
154 - /deep/ .el-form-item { 154 + ::v-deep .el-form-item {
155 border: 1px solid rgba(255, 255, 255, 0.1); 155 border: 1px solid rgba(255, 255, 255, 0.1);
156 background: rgba(0, 0, 0, 0.1); 156 background: rgba(0, 0, 0, 0.1);
157 border-radius: 5px; 157 border-radius: 5px;
......
此文件的差异太大,无法显示。