no message

This commit is contained in:
kuaifan 2021-07-08 20:05:01 +08:00
parent 0cda0a7427
commit 6ee6440f04
7 changed files with 128 additions and 84 deletions

1
electron/.gitignore vendored
View File

@ -1,2 +1,3 @@
node_modules
public
package-lock.json

View File

@ -10,19 +10,13 @@
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<title>Dootask</title>
<link rel="stylesheet" type="text/css" href="./public/css/app.css">
<link rel="stylesheet" type="text/css" href="./public/css/iview.css">
<script src="./public/js/jquery.min.js"></script>
<script src="./public/js/bootstrap.min.js"></script>
<script src="./public/js/language.all.js"></script>
<script src="./public/js/scroll-into-view.min.js"></script>
<script>
window.systemInformation = {
version: "0.2.63",
origin: window.location.origin + "/",
apiUrl: null
};
</script>
<link rel="stylesheet" type="text/css" href="./css/app.css">
<link rel="stylesheet" type="text/css" href="./css/iview.css">
<script src="./js/jquery.min.js"></script>
<script src="./js/bootstrap.min.js"></script>
<script src="./js/language.all.js"></script>
<script src="./js/scroll-into-view.min.js"></script>
<script src="./config.js"></script>
</head>
<body>
@ -43,7 +37,7 @@
</div>
<script type="text/javascript">
document.writeln("<script src=\'./public/js/app.js?v=" + window.systemInformation.version + "\'><\/script>");
document.writeln("<script src=\'./js/app.js?v=" + window.systemInformation.version + "\'><\/script>");
</script>
</body>

2
electron/main.js vendored
View File

@ -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 => {
})

111
native.js vendored Normal file
View File

@ -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');

62
nativefier.js vendored
View File

@ -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)
});
});

View File

@ -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",

View File

@ -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) : [
{