作者 xiaoqiu

更新最新内容

不能预览此文件类型
# 页面标题
VITE_APP_TITLE = 消防维保助手
# 开发环境配置
VITE_APP_ENV = 'development'
# 若依管理系统/开发环境
VITE_APP_BASE_API = '/dev-api'
VITE_APP_TAB_URL_PREFIX = 'https://xfwbzshd.crgx.net'
# VITE_APP_TAB_URL_PREFIX = 'http://bxhd.crgx.net'
\ No newline at end of file
# 页面标题
VITE_APP_TITLE = 广西车险投保登记平台
# 生产环境配置
VITE_APP_ENV = 'production'
# 若依管理系统/生产环境
VITE_APP_BASE_API = 'https://xfwbzshd.crgx.net'
# 是否在打包时开启压缩,支持 gzip 和 brotli
VITE_BUILD_COMPRESS = gzip
# 开打新的tab的url前缀
VITE_APP_TAB_URL_PREFIX = 'https://xfwbzshd.crgx.net'
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
<true/>
</dict>
</plist>
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
... ... @@ -37,6 +37,11 @@ function createWindow(width, height) {
}
});
// 退出应用
ipcMain.on('exit-app', () => {
app.quit();
});
// 在主进程中
mainWindow.webContents.on('before-input-event', (event, input) => {
if (input.key === 'Escape' && mainWindow.isFullScreen()) {
... ...
... ... @@ -42,6 +42,9 @@
<button type="button" class="slick-next slick-arrow slick-next-button" @click="NextPage">
Next
</button>
<!-- 退出按钮 -->
<button type="button" class="exit-button" @click="showExitDialog">退出</button>
</template>
<script setup>
... ... @@ -55,7 +58,7 @@ let musicList = import.meta.glob('../assets/music/*.*', { eager: true })
let musicArr = Object.values(musicList).map((item) => item.default)
let spanBoxList = ref([]) // 图片列表
let aEls = ref([]) // 图片元素
let radius = ref(760)
let radius = ref(880)
let bgImgUrl = ref('')
let dragBoxDom = ref(null) // 相册容器
let startX = ref(0)
... ... @@ -63,24 +66,25 @@ let startY = ref(0)
let endX = ref(0)
let endY = ref(0)
let tX = ref(0)
let tY = ref(30)
let tY = ref(42)
let desX = ref(0)
let desY = ref(0)
const closeImg = ref(false) // 是否显示中间图片
const queryParams = ref({
pageNum: 1,
pageSize: 60
pageSize: 30
})
const server_base = localStorage.getItem('crgx_server')
const fixedImg = ref('')
const fixedOpacity = ref(0)
let pollingInterval = null
// 随机分布加载图片列表。仅测试使用,后端图片不够情况使用
function randomGroupWithRepeats(arr, groupCount, groupSize) {
// 参数校验
if (!Array.isArray(arr) || arr.length === 0) {
throw new Error('输入必须是非空数组')
}
// if (!Array.isArray(arr) || arr.length === 0) {
// throw new Error('输入必须是非空数组')
// }
if (typeof groupCount !== 'number' || groupCount <= 0) {
throw new Error('分组数必须是正整数')
}
... ... @@ -102,7 +106,7 @@ function randomGroupWithRepeats(arr, groupCount, groupSize) {
return result
}
spanBoxList.value = randomGroupWithRepeats(imgArr, 3, 20)
spanBoxList.value = randomGroupWithRepeats(imgArr, 3, 10)
// 设置样式
function setStyle(delayTime, dom, i, len) {
... ... @@ -156,10 +160,24 @@ const handleOther = () => {
// 获取图片列表
const getImgList = async () => {
const signRes = await getSignatureList(queryParams.value)
const imgList = signRes.rows?.map((item) => {
const imgList =
signRes.rows?.map((item) => {
return `${server_base}${item.path}`
})
spanBoxList.value = randomGroupWithRepeats(imgList, 3, 20)
}) || []
// 如果数据小于等于30条,则使用 randomGroupWithRepeats 方法
// 如果数据大于30条,则直接使用 imgList
if (imgList.length <= 30) {
spanBoxList.value = randomGroupWithRepeats(imgList, 3, 10)
} else {
// 将 imgList 分成3组,每组10个
const groups = []
for (let i = 0; i < 3; i++) {
const group = imgList.slice(i * 10, (i + 1) * 10)
groups.push(group)
}
spanBoxList.value = groups
}
}
// 上一页
function PreviousPage() {
... ... @@ -200,6 +218,31 @@ const openServer = () => {
.catch(() => {})
}
// 显示退出对话框
const showExitDialog = () => {
ElMessageBox.prompt('请输入密码以退出程序', '退出确认', {
confirmButtonText: '确认',
cancelButtonText: '取消',
inputType: 'password',
inputErrorMessage: '密码错误'
})
.then(({ value }) => {
// 这里可以设置密码,例如 'admin'
if (value === 'admin') {
// 发送退出事件到主进程
if (window.electron && window.electron.ipcRenderer) {
window.electron.ipcRenderer.send('exit-app')
}
} else {
ElMessage({
type: 'error',
message: '密码错误,请重试'
})
}
})
.catch(() => {})
}
onMounted(async () => {
// 判断是否需要填写服务器地址,本地没有则弹出,手动填写按下字母J
if (!localStorage.getItem('crgx_server')) {
... ... @@ -210,9 +253,58 @@ onMounted(async () => {
openServer()
}
})
getImgList()
// 保存当前图片列表的哈希值,用于检测变化
let currentImgListHash = ''
// 获取图片列表并计算哈希值
async function fetchAndUpdateImgList() {
const signRes = await getSignatureList(queryParams.value)
console.log('获取到的数据', signRes)
const imgList =
signRes.rows?.map((item) => {
return `${server_base}${item.path}`
}) || []
console.log('图片列表', imgList)
// 计算图片列表的哈希值
const newImgListHash = JSON.stringify(imgList)
// 如果哈希值不同,说明图片列表有变化
if (newImgListHash !== currentImgListHash) {
currentImgListHash = newImgListHash
// 如果数据小于等于30条,则使用 randomGroupWithRepeats 方法
// 如果数据大于30条,则直接使用 imgList
if (imgList.length <= 30) {
spanBoxList.value = randomGroupWithRepeats(imgList, 3, 10)
} else {
// 将 imgList 分成3组,每组10个
const groups = []
for (let i = 0; i < 3; i++) {
const group = imgList.slice(i * 10, (i + 1) * 10)
groups.push(group)
}
spanBoxList.value = groups
}
// 重新获取图片元素并初始化动画
aEls.value = []
getSpinBoxDom()
init()
}
}
// 首次获取图片列表
await fetchAndUpdateImgList()
// 设置短轮询,每隔5秒获取一次图片列表
pollingInterval = setInterval(fetchAndUpdateImgList, 5000)
const bgRes = await getUseBg() // 获取背景图片
bgImgUrl.value = server_base + bgRes.data.path
if (bgRes.data) {
bgImgUrl.value = server_base + bgRes.data?.path
}
let spinDom1 = document.getElementById('spinBox1')
getSpinBoxDom()
// 开始旋转动画
... ... @@ -239,8 +331,8 @@ onMounted(async () => {
}
audio.src = musicArr[currentIndex]
const resMusic = await getUseBgMusic()
if (resMusic.code == 200) {
audio.src = server_base + resMusic.data.path
if (resMusic.data) {
audio.src = server_base + resMusic.data?.path
}
audio.play().catch((err) => {
console.error('播放失败:', err)
... ... @@ -275,7 +367,7 @@ onMounted(async () => {
startY.value = endY.value
}
//鼠标离开时 开始自动旋转
this.onpointerup = function (e) {
this.onpointerup = function () {
//惯性旋转
dragBoxDom.value.timer = setInterval(function () {
desX.value *= 0.95
... ... @@ -303,6 +395,10 @@ onUnmounted(() => {
openServer()
}
})
// 清理轮询定时器
if (pollingInterval) {
clearInterval(pollingInterval)
}
})
</script>
... ... @@ -465,4 +561,28 @@ onUnmounted(() => {
.slick-arrow:hover::before {
opacity: 1;
}
// 退出按钮样式
.exit-button {
position: fixed;
bottom: 2rem;
right: 2rem;
z-index: 20;
height: 3rem;
width: 6rem;
cursor: pointer;
border-radius: 4px;
border-style: none;
background-color: rgb(0 0 23 / 0.3);
padding: 0px;
font-size: 1rem;
color: #fff;
outline: 2px solid transparent;
outline-offset: 2px;
transition: all 0.3s ease;
&:hover {
background-color: rgb(0 0 23 / 0.5);
}
}
</style>
... ...