diff --git a/electron/.gitignore b/electron/.gitignore
index d5f19d89..e1eca71d 100644
--- a/electron/.gitignore
+++ b/electron/.gitignore
@@ -1,2 +1,3 @@
node_modules
+public
package-lock.json
diff --git a/electron/index.html b/electron/index.html
index eb222f30..b7c39f23 100644
--- a/electron/index.html
+++ b/electron/index.html
@@ -10,19 +10,13 @@
Dootask
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -43,7 +37,7 @@
diff --git a/electron/main.js b/electron/main.js
index e7d43c8d..71c20833 100644
--- a/electron/main.js
+++ b/electron/main.js
@@ -15,7 +15,7 @@ function createWindow () {
})
// and load the index.html of the app.
- mainWindow.loadFile('./index.html').then(r => {
+ mainWindow.loadFile('./public/index.html').then(r => {
})
diff --git a/native.js b/native.js
new file mode 100644
index 00000000..35e30f45
--- /dev/null
+++ b/native.js
@@ -0,0 +1,111 @@
+const fs = require('fs');
+const path = require('path')
+const package = require('./package.json')
+
+// 删除
+function deleteFile(path) {
+ let files = [];
+ if( fs.existsSync(path) ) {
+ files = fs.readdirSync(path);
+ files.forEach(function(file,index){
+ let curPath = path + "/" + file;
+ if(fs.statSync(curPath).isDirectory()) {
+ deleteFile(curPath);
+ } else {
+ fs.unlinkSync(curPath);
+ }
+ });
+ fs.rmdirSync(path);
+ }
+}
+
+// 复制文件
+function copyFile(srcPath, tarPath, cb) {
+ let rs = fs.createReadStream(srcPath)
+ rs.on('error', function (err) {
+ if (err) {
+ console.log('read error', srcPath)
+ }
+ cb && cb(err)
+ })
+ let ws = fs.createWriteStream(tarPath)
+ ws.on('error', function (err) {
+ if (err) {
+ console.log('write error', tarPath)
+ }
+ cb && cb(err)
+ })
+ ws.on('close', function (ex) {
+ cb && cb(ex)
+ })
+ rs.pipe(ws)
+}
+
+// 复制文件夹所有
+function copyDir(srcDir, tarDir, cb) {
+ if (fs.existsSync(tarDir)) {
+ fs.readdir(srcDir, function (err, files) {
+ let count = 0
+ let checkEnd = function () {
+ ++count == files.length && cb && cb()
+ }
+ if (err) {
+ checkEnd()
+ return
+ }
+ files.forEach(function (file) {
+ let srcPath = path.join(srcDir, file)
+ let tarPath = path.join(tarDir, file)
+ fs.stat(srcPath, function (err, stats) {
+ if (stats.isDirectory()) {
+ fs.mkdir(tarPath, function (err) {
+ if (err) {
+ return
+ }
+ copyDir(srcPath, tarPath, checkEnd)
+ })
+ } else {
+ copyFile(srcPath, tarPath, checkEnd)
+ }
+ })
+ })
+ //为空时直接回调
+ files.length === 0 && cb && cb()
+ })
+ } else {
+ fs.mkdir(tarDir, function (err) {
+ if (err) {
+ return
+ }
+ copyDir(srcDir, tarDir, cb)
+ })
+ }
+}
+
+/** ***************************************************************************************************/
+/** ***************************************************************************************************/
+/** ***************************************************************************************************/
+
+const electronDir = path.resolve("electron/public");
+if (fs.existsSync(electronDir)) {
+ deleteFile(electronDir);
+}
+fs.mkdirSync(electronDir);
+
+[
+ 'audio',
+ 'css',
+ 'images',
+ 'js',
+].forEach(function (item) {
+ copyDir(path.resolve("public/" + item), electronDir + "/" + item)
+})
+
+copyFile(path.resolve("electron/index.html"), electronDir + "/index.html")
+
+fs.writeFileSync(electronDir + "/config.js", `window.systemInformation = {
+ version: "${package.version}",
+ origin: "./",
+ apiUrl: "http://127.0.0.1:2222/api/"
+}`, 'utf8');
+
diff --git a/nativefier.js b/nativefier.js
deleted file mode 100644
index c5d60df9..00000000
--- a/nativefier.js
+++ /dev/null
@@ -1,62 +0,0 @@
-const nativefier = require('nativefier').default;
-const inquirer = require('inquirer');
-const config = require('./package.json');
-
-const options = {
- name: config.name,
- appVersion: config.version,
- buildVersion: config.version,
- out: './build',
- icon: './resources/assets/statics/public/images/logo-app.png',
- bounce: false,
- counter: true,
- clearCache: false,
- disableDevTools: true,
- disableContextMenu: true,
- fileDownloadOptions: {
- saveAs: true,
- },
-};
-
-const questions = [
- {
- type: 'input',
- name: 'targetUrl',
- message: "请输入网站地址",
- validate: function (value) {
- return value !== ''
- }
- }, {
- type: 'list',
- name: 'platform',
- message: "选择操作系统平台",
- choices: [{
- name: "MacOS Intel",
- value: {
- platform: 'mac',
- arch: 'x64',
- }
- }, {
- name: "MacOS Arm64",
- value: {
- platform: 'mac',
- arch: 'arm64',
- }
- }, {
- name: "Window x86_64",
- value: {
- platform: 'windows',
- arch: 'x64',
- icon: './resources/assets/statics/public/images/logo-app.ico',
- }
- }]
- }
-];
-
-inquirer.prompt(questions).then(answers => {
- nativefier(Object.assign(options, answers.platform, {
- targetUrl: answers.targetUrl
- }), (error) => {
- error && console.error(error)
- });
-});
diff --git a/package.json b/package.json
index 0321c532..525316f2 100644
--- a/package.json
+++ b/package.json
@@ -11,7 +11,7 @@
"prod": "npm run production",
"production": "mix --production",
"version": "node ./version.js",
- "native": "node ./nativefier.js"
+ "native": "node ./native.js"
},
"devDependencies": {
"axios": "^0.21",
diff --git a/resources/assets/js/components/LuckySheet.vue b/resources/assets/js/components/LuckySheet.vue
index 6650be74..6a481a92 100644
--- a/resources/assets/js/components/LuckySheet.vue
+++ b/resources/assets/js/components/LuckySheet.vue
@@ -52,12 +52,12 @@ export default {
mounted() {
$A.loadScriptS([
'js/luckysheet/plugins/css/pluginsCss.css',
- 'js/js/luckysheet/plugins/plugins.css',
- 'js/js/luckysheet/css/luckysheet.css',
- 'js/js/luckysheet/assets/iconfont/iconfont.css',
+ 'js/luckysheet/plugins/plugins.css',
+ 'js/luckysheet/css/luckysheet.css',
+ 'js/luckysheet/assets/iconfont/iconfont.css',
//
- 'js/js/luckysheet/plugins/js/plugin.js',
- 'js/js/luckysheet/luckysheet.umd.js',
+ 'js/luckysheet/plugins/js/plugin.js',
+ 'js/luckysheet/luckysheet.umd.js',
], () => {
this.loadIng = false;
this.bakValue = JSON.stringify(this.value);
@@ -99,7 +99,7 @@ export default {
],
lang: lang,
loading: {
- image: 'image://.js/luckysheet/css/loading.gif'
+ image: 'image://' + $A.originUrl('js/luckysheet/css/loading.gif')
},
data: value ? $A.cloneJSON(value) : [
{