提交 f9ae78f4 authored 作者: 蔡芬's avatar 蔡芬

1

上级
> 1%
last 2 versions
not dead
# 所有环境默认
# 页面 title 前缀
VUE_APP_TITLE=菜单
# 打包后安装程序名字
VUE_APP_PRODUCTNAME=菜单
# 网络请求公用地址
# 测试
VUE_APP_API=1
VUE_APP_APPID=com.menu.test
# 请求api版本号
VUE_APP_API_VERSION=V1
VUE_APP_IS_WEB=true
IS_WEB=true
\ No newline at end of file
module.exports = {
root: true,
env: {
node: true,
},
extends: ["plugin:vue/essential", "eslint:recommended", "@vue/prettier"],
parserOptions: {
parser: "babel-eslint",
},
rules: {
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
"prettier/prettier": "off",
'indent': [2, 2, {
'SwitchCase': 1
}],
},
overrides: [
{
files: [
"**/__tests__/*.{j,t}s?(x)",
"**/tests/unit/**/*.spec.{j,t}s?(x)",
],
env: {
mocha: true,
},
},
],
};
.DS_Store
node_modules
/tests/e2e/videos/
/tests/e2e/screenshots/
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
#Electron-builder output
/dist_electron
\ No newline at end of file
# course_creation
## Project setup
```
yarn install
```
如果出现报错,卡在. electron-chromedriver时,
修改方法:
1. 找到路径:C:\Users\用户名\windows
2. 然后打开路径下面的.yarnrc文件 和 .npmrc文件 ,修改如下:
` registry=https://registry.npm.taobao.org/
ELECTRON_MIRROR=http://npm.taobao.org/mirrors/electron/
`
`
npm config set ELECTRON_MIRROR=https://npm.taobao.org/mirrors/electron/
`
`
npm config set registry=https://registry.npm.taobao.org/
`
3. 然后再去执行,
`yarn add -D electron-chromedriver`
4. 成功之后,重新执行
`vue add electron-builder`
就可以了
### mac打包时报错:electron-v13.6.9-darwin-x64.zip
1. 复制报错链接,下载它,并放到 macOS: ~/Library/Caches/electron/
### 缓存
1. 或者,您可以覆盖本地缓存。
electron-download 会将下载的二进制文件缓存在本地目录中,不会增加网络负担。
您可以使用该缓存文件夹来提供 Electron 的定制版本,或者避免进行网络连接。
`
Linux: $XDG_CACHE_HOME or ~/.cache/electron/
macOS: ~/Library/Caches/electron/
Windows: $LOCALAPPDATA/electron/Cache or ~/AppData/Local/electron/Cache/
`
### [ckeditor5 仓库](http://120.79.101.85:8181/caifen/ck5)
1. 更改src/ckeditor.js,然后在这个仓库内执行命令:yarn build
2. 执行成功后,直接复制build文件夹内容替换 当前项目下 /public/ckeditor的文件夹内容
### Compiles and hot-reloads for development
```
yarn serve
```
```
yarn electron:serve
```
### Compiles and minifies for production
```
yarn build
```
```
yarn electron:build
```
### Run your unit tests
```
yarn test:unit
```
### Run your end-to-end tests
```
yarn test:e2e
```
### Lints and fixes files
```
yarn lint
```
### 修改logo,替换public/logo.png,然后执行
```
yarn electron:generate-icons
# 或者
npm run electron:generate-icons
```
### 打包桌面端配置
1. vue.config.js
2. package.json
`
修改版本号:package.json里=》"version": "1.0.0"
feidao_latest.exe -》 表示当前最新
feidao_v1.0.0.exe =》 表示第几版本
上传到oss: /resources/application/windows/feidao_latest.exe
`
3. 打包window版时,有签名配置的情况下,如果报错:Error: spawn EPERM,
查看是否开启了杀毒软件,关闭杀毒软件,重新打包
4. 打包linux版时,可以在macOS系统上打包
#### package.json
`
"homepage": "https://feidao-tools.oss-cn-shenzhen.aliyuncs.com/resources/application/linux",
"author": "Guangzhou Zaofu Technology Co., Ltd. <service@fei-dao.com> (https://www.fei-dao.com/)",
`
#### vue.config.js
`
"linux": {
"icon": './build/icons',
"category":"Education",
desktop:{
icon: 'feidao'
},
"target": [
"AppImage",
// "flatpak",
"zip",
"deb"
]
}
`
5. 打渠道包
更改./channel/channelMRD.js 里 渠道列表channelAll
然后执行打包命令 `dist:all`
获取渠道:
`
const channelConfig = require('../../channel/channelConfig');
this.$message.info( "安装包来源:"+ this.channelConfig.channel_name );
`
#### Customize configuration
1. See [Configuration Reference](https://cli.vuejs.org/config/).
2. See [vue-cli-plugin-electron-builder](https://nklayman.github.io/vue-cli-plugin-electron-builder/).
3. See [electron-builder](https://www.electron.build/).
4. See [electron-updater文档](https://www.electronjs.org/).
5. See [electron](https://www.electron.build/auto-update.html).
module.exports = {
presets: ["@vue/cli-plugin-babel/preset"],
"plugins": [
[
"component",
{
"libraryName": "element-ui",
"styleLibraryName": "theme-chalk"
}
]
]
};
const channel_name = 'oppo';
const channel_type = '3';
exports = module.exports = {
channel_type,
channel_name
};
\ No newline at end of file
const execSync = require('child_process').execSync;
// 渠道包类型
const channelAll = [
{
channel:"360",
channel_type:"1"
},
{
channel:"应用宝",
channel_type:"2"
},
{
channel:"oppo",
channel_type:"3"
},
];
// 打包不同渠道包
for(let i in channelAll) {
let { channel, channel_type } = channelAll[i]
execSync(
`node ./channel/channelProcess.js ${channel} ${channel_type}`
);
execSync('yarn electron:build', {stdio: 'inherit'});
}
const fs = require('fs');
const argv = process.argv;
const channel = argv[2];
const channel_type = argv[3];
const readWriteFile = path => {
fs.readFile(path, function (err, data) {
if (err) {
console.log(`read [${path}] error`);
} else {
const jsonData = JSON.parse(data.toString()); // 读取的package.json内容
const stringData = JSON.stringify(changeData(jsonData)); // 修改后的package.json内容
writeFile(path, stringData); // 写入package.json
}
});
};
const changeData = data => {
data.name = data.name + `-c${channel}`;
data.description = data.description + `-c${channel}`;
data.build.productName = process.env.VUE_APP_PRODUCTNAME + `-c${channel}`;
data.build.directories = {
output: `dist/c${channel}-${channel_type}`
}
return data;
};
const writeFile = (path, data) => {
try {
fs.writeFile(
path,
data,
{
encoding: 'utf8',
},
err => {
if (err) throw err;
console.log(`-- write [${path}] set success`);
}
);
} catch (error) {
console.log(`write [${path}] error: `, error);
}
};
// readWriteFile('./package.json');
// 更改配置文件./channel/channelConfig.js
const configText = `const channel_name = '${channel}';
const channel_type = '${channel_type}';
exports = module.exports = {
channel_type,
channel_name
};`;
writeFile('./channel/channelConfig.js', configText);
{
"pluginsFile": "tests/e2e/plugins/index.js"
}
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"name": "feidao",
"version": "1.0.0",
"private": true,
"description": "菜单平台",
"homepage": "/",
"author": "Guangzhou Menu Technology Co., Ltd. <service@sei-tpo.com> (https://www.zei-dao.com/)",
"scripts": {
"serve": "vue-cli-service serve --mode web",
"build": "vue-cli-service build",
"build:web": "vue-cli-service build --mode web",
"test:unit": "vue-cli-service test:unit",
"test:e2e": "vue-cli-service test:e2e",
"lint": "vue-cli-service lint",
"dist:all": "node ./channel/channelMRD.js",
"electron:build": "vue-cli-service electron:build",
"electron:buildwin": "vue-cli-service electron:build --win",
"electron:build32": "vue-cli-service electron:build --win --ia32",
"electron:mac": "vue-cli-service electron:build --mac",
"electron:linux": "vue-cli-service electron:build --linux",
"electron:serve": "vue-cli-service electron:serve",
"postinstall": "electron-builder install-app-deps",
"postuninstall": "electron-builder install-app-deps",
"electron:generate-icons": "electron-icon-builder --input=./public/logo_512.png --output=build --flatten"
},
"main": "background.js",
"resolutions": {
"vue-cli-plugin-electron-builder/electron-builder": "^23.0.3"
},
"dependencies": {
"axios": "^0.24.0",
"bluebird": "^3.7.2",
"body-parser": "^1.20.1",
"core-js": "^3.6.5",
"cropperjs": "^1.5.12",
"electron-icon-builder": "^2.0.1",
"element-ui": "^2.15.6",
"js-cookie": "^3.0.1",
"node-machine-id": "^1.1.12",
"pbkdf2": "3.1.1",
"unsplash-js": "^7.0.15",
"vue": "^2.6.11",
"vue-clipboard2": "^0.3.3",
"vue-i18n": "^8.26.7",
"vue-infinite-scroll": "^2.0.2",
"vue-router": "^3.2.0",
"vue-router-tab": "^1.2.8",
"vue-waterfall-easy": "^2.4.4",
"vuedraggable": "^2.24.3",
"vuex": "^3.4.0",
"vuex-persistedstate": "^4.1.0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-e2e-cypress": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-plugin-router": "~4.5.0",
"@vue/cli-plugin-unit-mocha": "~4.5.0",
"@vue/cli-plugin-vuex": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"@vue/eslint-config-prettier": "^6.0.0",
"@vue/test-utils": "^1.0.3",
"ace-builds": "^1.8.1",
"babel-eslint": "^10.1.0",
"babel-plugin-component": "^1.1.1",
"chai": "^4.1.2",
"chai-as-promised": "^7.1.1",
"electron": "^13.6.9",
"electron-chromedriver": "^20.0.0",
"electron-devtools-installer": "^3.1.0",
"eslint": "^6.7.2",
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-vue": "^6.2.2",
"less": "^3.0.4",
"less-loader": "^5.0.0",
"lodash-es": "^4.17.21",
"prettier": "^2.2.1",
"spectron": "15.0.0",
"terser-webpack-plugin": "4",
"vue-cli-plugin-electron-builder": "~2.1.1",
"vue-template-compiler": "^2.6.11"
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
No preview for this file type
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论