# paper-library-client 试卷电子化采集端系统 ## 项目操作 #### 项目安装 ``` yarn install ``` #### 开发模式 ``` yarn start ``` #### 项目打包 ``` yarn run electron:build ``` #### lint 项目文件,并修正格式 ``` yarn run lint ``` ### 自定义配置 - See [Configuration Reference](https://cli.vuejs.org/config/). - See [Vue CLI Plugin Electron Builder](https://nklayman.github.io/vue-cli-plugin-electron-builder/guide/guide.html). - See [electron-builder Common Configuration](https://www.electron.build/configuration/configuration). ## 系统开发目录说明 - 开发目录:`当前代码目录` - 开发运行环境目录:`${开发目录}/node_modules/electron/dist/` - 正式运行环境目录: - window: `C:~\AppData\Local\Programs\{系统名称}\` ## 关于使用第三方工具的处理办法 **所有第三方工具统一存放在根目录`extra`文件夹中** - 设置文件`vue.config.js` > [配置 api](https://www.electron.build/configuration/contents#extrafiles) ```js // config中新增如下配置 pluginOptions: { electronBuilder: { builderOptions: { extraFiles: ["extra/**"] } } }, ``` - 设置`plugins/env.js` ```js // 运行系统的根目录 const homePath = path.dirname(process.execPath); // 开放环境中,使用开发代码的根目录;正式包中,使用运行系统的根目录。 const extraPath = process.env.NODE_ENV === "production" ? path.join(homePath, "extra") : path.join(__static, "../extra"); ``` ## 配置打包参数(可选) ```json { "pluginOptions": { "electronBuilder": { "builderOptions": { "appId": "com.example.app", "productName": "aDemo", // 项目名,也是生成的安装文件名,即aDemo.exe "copyright": "Copyright © 2020", //版权信息 "directories": { "output": "./dist" //输出文件路径 }, "win": { // win相关配置 "icon": "./shanqis.ico", // 图标,当前图标在根目录下,注意这里有两个坑 "target": [ { "target": "nsis", // 利用nsis制作安装程序 "arch": [ "x64" // 64位 ] } ] }, "nsis": { "oneClick": false, // 是否一键安装 "allowElevation": true, // 允许请求提升。 如果为false,则用户必须使用提升的权限重新启动安装程序。 "allowToChangeInstallationDirectory": true, // 允许修改安装目录 "installerIcon": "./shanqis.ico", // 安装图标 "uninstallerIcon": "./shanqis.ico", //卸载图标 "installerHeaderIcon": "./shanqis.ico", // 安装时头部图标 "createDesktopShortcut": true, // 创建桌面图标 "createStartMenuShortcut": true, // 创建开始菜单图标 "shortcutName": "demo" // 图标名称 } } } } } ``` ## config.json 配置说明 - 根目录下会有一个`config.sample.json`文件,当需要设置配置参数时,可以复制一份,保存为`config.json`文件。 - 系统内部预设了一组 config 参数,当根目录`config.json`文件中的参数有缺失时,默认使用预设 config 参数。 - `input`默认为`/stores/in/` ## postinstall - 32/64 切换,`"postinstall": "electron-builder install-app-deps --arch=ia32"` - ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ yarn install