Merge pull request 'lyc-dev' (#37) from lyc-dev into main

This commit is contained in:
lyc 2024-07-18 11:11:26 +08:00
commit 722f51f3a2
4 changed files with 74 additions and 23 deletions

View File

@ -59,10 +59,72 @@ $ npm run build:linux
├── .prettierrc.yaml //prettier代码格式化配置文件 ├── .prettierrc.yaml //prettier代码格式化配置文件
├── dev-app-update.yml ├── dev-app-update.yml
├── electron-builder.yml //打包配置文件 ├── electron-builder.yml //打包配置文件
├──electron.vite.config.mjs //electron-vite配置文件 ├── electron.vite.config.mjs //electron-vite配置文件
├── package-lock.json ├── package-lock.json
├── package.json ├── package.json
└──README.md //项目说明 └── README.md //项目说明
``` ```
### electron-builder.yml配置说明
```json
appId: com.electron.test //appid 包名
productName: 测试程序 //安装程序的名字
directories:
buildResources: build
files:
- '!**/.vscode/*'
- '!src/*'
- '!electron.vite.config.{js,ts,mjs,cjs}'
- '!{.eslintignore,.eslintrc.cjs,.prettierignore,.prettierrc.yaml,dev-app-update.yml,CHANGELOG.md,README.md}'
- '!{.env,.env.*,.npmrc,pnpm-lock.yaml}'
- '!{tsconfig.json,tsconfig.node.json,tsconfig.web.json}'
asarUnpack:
- resources
win:
executableName: 测试程序
icon: build/icon/favicon.ico //程序图标
nsis:
oneClick: false //是否一键安装
allowElevation: true //允许请求提升。若为false则用户必须使用提升的权限重新启动安装程序。
allowToChangeInstallationDirectory: true //是否允许修改安装目录
createDesktopShortcut: true //卸载时图标
createStartMenuShortcut: true // 是否创建开始菜单图标
runAfterFinish: false //是否安装完成后运行
include: ../build/script/installer.nsh //我这里放的是将应用程序默认安装在哪个路径
artifactName: ${name}-${version}-setup.${ext}
uninstallDisplayName: ${productName}
installerIcon: ./build/icon.ico // 安装时图标
uninstallerIcon: ./build/icon.ico
mac:
entitlementsInherit: build/entitlements.mac.plist
extendInfo:
- NSCameraUsageDescription: Application requests access to the device's camera.
- NSMicrophoneUsageDescription: Application requests access to the device's microphone.
- NSDocumentsFolderUsageDescription: Application requests access to the user's Documents folder.
- NSDownloadsFolderUsageDescription: Application requests access to the user's Downloads folder.
notarize: false
dmg:
artifactName: ${name}-${version}.${ext}
linux:
target:
- AppImage
- snap
- deb
maintainer: electronjs.org
category: Utility
appImage:
artifactName: ${name}-${version}.${ext}
npmRebuild: false
publish:
provider: generic
url: https://example.com/auto-updates //程序升级的验证地址
electronDownload:
mirror: https://npmmirror.com/mirrors/electron/
```

View File

@ -1,13 +0,0 @@
<script setup>
import { reactive } from 'vue'
const versions = reactive({ ...window.electron.process.versions })
</script>
<template>
<ul class="versions">
<li class="electron-version">Electron v{{ versions.electron }}</li>
<li class="chrome-version">Chromium v{{ versions.chrome }}</li>
<li class="node-version">Node v{{ versions.node }}</li>
</ul>
</template>

View File

@ -18,7 +18,7 @@
<span title="最小化" @click="minimizeWindow"><i class="iconfont">&#xe650;</i></span> <span title="最小化" @click="minimizeWindow"><i class="iconfont">&#xe650;</i></span>
<span :title="isMaxSize ? '向下还原' : '最大化'" @click="maximizeWindow"><i class="iconfont">{{ isMaxSize ? '&#xe600' : <span :title="isMaxSize ? '向下还原' : '最大化'" @click="maximizeWindow"><i class="iconfont">{{ isMaxSize ? '&#xe600' :
'&#xe695' }}</i></span> '&#xe695' }}</i></span>
<span title="关闭" @click="closeWindow"><i class="iconfont">&#xe608;</i></span> <span class="close" title="关闭" @click="closeWindow"><i class="iconfont">&#xe608;</i></span>
</div> </div>
<div class="user flex"> <div class="user flex">
<div class="avatar-container"> <div class="avatar-container">
@ -209,19 +209,21 @@ function setLayout() {
flex-direction: column; flex-direction: column;
.header-tool { .header-tool {
padding-top: 5px;
-webkit-app-region: no-drag; -webkit-app-region: no-drag;
span { span {
border-radius: 3px; border-radius: 3px;
cursor: pointer; cursor: pointer;
padding: 2px 10px;
&:hover { &:hover {
background-color: #c4c4c4; background-color: #c4c4c4;
} }
}
.iconfont { .close{
margin: 0 10px; &:hover{
background-color: #fb4a3e;
.iconfont{
color: #fff;
}
} }
} }
} }

View File

@ -55,7 +55,7 @@ service.interceptors.request.use(config => {
const s_url = sessionObj.url; // 请求地址 const s_url = sessionObj.url; // 请求地址
const s_data = sessionObj.data; // 请求数据 const s_data = sessionObj.data; // 请求数据
const s_time = sessionObj.time; // 请求时间 const s_time = sessionObj.time; // 请求时间
const interval = 1000; // 间隔时间(ms),小于此时间视为重复提交 const interval = 2000; // 间隔时间(ms),小于此时间视为重复提交
if (s_data === requestObj.data && requestObj.time - s_time < interval && s_url === requestObj.url) { if (s_data === requestObj.data && requestObj.time - s_time < interval && s_url === requestObj.url) {
const message = '数据正在处理,请勿重复提交'; const message = '数据正在处理,请勿重复提交';
console.warn(`[${s_url}]: ` + message) console.warn(`[${s_url}]: ` + message)