调整引导与帮助等
This commit is contained in:
+38
-1
@@ -1,4 +1,6 @@
|
||||
import { app, BrowserWindow, Menu } from 'electron'
|
||||
import { app, BrowserWindow, Menu, ipcMain, shell } from 'electron'
|
||||
import path from 'path'
|
||||
import fs from 'fs'
|
||||
import '../renderer/store'
|
||||
|
||||
/**
|
||||
@@ -14,6 +16,18 @@ const winURL = process.env.NODE_ENV === 'development'
|
||||
? `http://localhost:9080`
|
||||
: `file://${__dirname}/index.html`
|
||||
|
||||
// 获取应用根目录
|
||||
// 开发环境:项目根目录(__dirname 指向 dist/electron)
|
||||
// 生产环境:可执行文件所在目录
|
||||
const root = process.env.NODE_ENV === "development"
|
||||
? path.resolve(__dirname, '../../')
|
||||
: path.dirname(app.getPath("exe"))
|
||||
|
||||
// 日志函数
|
||||
function writeLog(message) {
|
||||
console.log(`[${new Date().toISOString()}] ${message}`)
|
||||
}
|
||||
|
||||
function createWindow () {
|
||||
/**
|
||||
* Initial window options
|
||||
@@ -75,3 +89,26 @@ app.on('ready', () => {
|
||||
if (process.env.NODE_ENV === 'production') autoUpdater.checkForUpdates()
|
||||
})
|
||||
*/
|
||||
|
||||
// IPC 处理:打开帮助文件
|
||||
ipcMain.on('open-help-file', async event => {
|
||||
const helpFilePath = path.join(root, "CardsoonServer", "User Manual.pdf");
|
||||
|
||||
if (!fs.existsSync(helpFilePath)) {
|
||||
const errorMsg = `帮助文件不存在: ${helpFilePath}`;
|
||||
writeLog(errorMsg);
|
||||
if (event.reply) {
|
||||
event.reply('open-help-file-error', errorMsg);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
await shell.openPath(helpFilePath);
|
||||
} catch (error) {
|
||||
writeLog("打开帮助文件错误: " + error.message);
|
||||
if (event.reply) {
|
||||
event.reply('open-help-file-error', error.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -228,4 +228,54 @@ export default {
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
// 引导样式
|
||||
.guide_body {
|
||||
position: relative;
|
||||
z-index: 200;
|
||||
background-color: #fff;
|
||||
padding: 0 10px;
|
||||
border-radius: 4px;
|
||||
border: 1px dashed #2e9bfb;
|
||||
height: 100%;
|
||||
}
|
||||
.guide_box {
|
||||
border: 1px dashed #2e9bfb;
|
||||
padding: 12px;
|
||||
.guide_title {
|
||||
font-weight: bold;
|
||||
font-size: 16px;
|
||||
color: #000000;
|
||||
line-height: 30px;
|
||||
span {
|
||||
font-size: 13px;
|
||||
color: #999;
|
||||
font-weight: 400;
|
||||
}
|
||||
}
|
||||
.guide_desc {
|
||||
font-size: 13px;
|
||||
color: #000000;
|
||||
line-height: 24px;
|
||||
a {
|
||||
color: #2e9bfb;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
.guide_btns {
|
||||
padding: 10px 0 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: end;
|
||||
.guide_btn1 {
|
||||
color: #999;
|
||||
}
|
||||
.guide_btn2 {
|
||||
background-color: #2e9bfb;
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
.el-popover {
|
||||
padding: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -4,12 +4,30 @@
|
||||
:close-on-click-modal="false" :show-close="false">
|
||||
<div class="work_body" v-loading="submitLoading" element-loading-text="正在准备任务,您也可以直接右上角关闭作业窗口"
|
||||
element-loading-spinner="el-icon-loading" element-loading-background="rgba(0, 0, 0, 0.8)">
|
||||
<div
|
||||
v-if="currentStep && parseInt(currentStep) >= 8"
|
||||
class="bg_box"
|
||||
style="position: absolute; top: 0; left: 0; z-index: 10; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5)"></div>
|
||||
<div @click="close" class="close_box">
|
||||
<img src="@/assets/images/Close_icon.png" />
|
||||
</div>
|
||||
<div class="work_box">
|
||||
<div class="flex_box flex_row_between work_top">
|
||||
<div class="flex_box">
|
||||
<el-popover v-if="guideStep" :placement="guideStep[8].placement" width="250" trigger="manual"
|
||||
v-model="guideStep[8].show">
|
||||
<div class="guide_box">
|
||||
<div class="guide_title">新手引导<span>({{ parseInt(currentStep) + 1 }}/{{ guideStep.length }})</span>
|
||||
</div>
|
||||
<div class="guide_desc">{{ guideStep[8].step }}</div>
|
||||
<div class="guide_btns">
|
||||
<el-button @click="exitGuide" class="guide_btn1" size="mini" type="text">跳过引导</el-button>
|
||||
<el-button v-if="parseInt(currentStep) > 0" @click="prevStep" class="guide_btn1" size="mini">上一步</el-button>
|
||||
<el-button @click="nextStep" class="guide_btn2" size="mini" type="primary">{{ currentStep ==
|
||||
guideStep.length
|
||||
- 1 ? '完成引导' : '下一步' }}</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex_box" slot="reference" :class="{ 'guide_body': currentStep == 8}">
|
||||
<div class="flex_box work_top_item">
|
||||
<div class="work_top_label">光盘类型:</div>
|
||||
<div class="work_top_val">
|
||||
@@ -29,6 +47,8 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-popover>
|
||||
<template v-if="!currentStep || currentStep < 8">
|
||||
<el-popover v-model="setShow" placement="bottom-end" trigger="click" @show="initSet">
|
||||
<div class="set_box">
|
||||
<div class="set_list">
|
||||
@@ -115,9 +135,48 @@
|
||||
<div>高级作业设置</div>
|
||||
</div>
|
||||
</el-popover>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-popover v-if="guideStep" :placement="guideStep[11].placement" width="250" trigger="manual"
|
||||
v-model="guideStep[11].show">
|
||||
<div class="guide_box">
|
||||
<div class="guide_title">新手引导<span>({{ parseInt(currentStep) + 1 }}/{{ guideStep.length }})</span>
|
||||
</div>
|
||||
<div class="guide_desc">{{ guideStep[11].step }}</div>
|
||||
<div class="guide_btns">
|
||||
<el-button @click="exitGuide" class="guide_btn1" size="mini" type="text">跳过引导</el-button>
|
||||
<el-button v-if="parseInt(currentStep) > 0" @click="prevStep" class="guide_btn1" size="mini">上一步</el-button>
|
||||
<el-button @click="nextStep" class="guide_btn2" size="mini" type="primary">{{ currentStep ==
|
||||
guideStep.length
|
||||
- 1 ? '完成引导' : '下一步' }}</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div slot="reference" :class="{ 'guide_body': currentStep == 11}">
|
||||
<div class="flex_box work_top_set">
|
||||
<img src="@/assets/images/Setting_icon.png" />
|
||||
<div>高级作业设置</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-popover>
|
||||
</template>
|
||||
</div>
|
||||
<div class="flex_box flex_col_top work_main">
|
||||
<div class="work_left">
|
||||
<el-popover v-if="guideStep" :placement="guideStep[9].placement" width="250" trigger="manual"
|
||||
v-model="guideStep[9].show">
|
||||
<div class="guide_box">
|
||||
<div class="guide_title">新手引导<span>({{ parseInt(currentStep) + 1 }}/{{ guideStep.length }})</span>
|
||||
</div>
|
||||
<div class="guide_desc">{{ guideStep[9].step }}</div>
|
||||
<div class="guide_btns">
|
||||
<el-button @click="exitGuide" class="guide_btn1" size="mini" type="text">跳过引导</el-button>
|
||||
<el-button v-if="parseInt(currentStep) > 0" @click="prevStep" class="guide_btn1" size="mini">上一步</el-button>
|
||||
<el-button @click="nextStep" class="guide_btn2" size="mini" type="primary">{{ currentStep ==
|
||||
guideStep.length
|
||||
- 1 ? '完成引导' : '下一步' }}</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div slot="reference" :class="{ 'guide_body': currentStep == 9}">
|
||||
<div v-if="form.copy_type == 3 || form.copy_type == 4" class="flex_box flex_row_center work_no">
|
||||
<img src="@/assets/images/ElBanCircle.png" />
|
||||
</div>
|
||||
@@ -150,7 +209,24 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-popover>
|
||||
</div>
|
||||
<div class="work_right">
|
||||
<el-popover v-if="guideStep" :placement="guideStep[10].placement" width="250" trigger="manual"
|
||||
v-model="guideStep[10].show">
|
||||
<div class="guide_box">
|
||||
<div class="guide_title">新手引导<span>({{ parseInt(currentStep) + 1 }}/{{ guideStep.length }})</span>
|
||||
</div>
|
||||
<div class="guide_desc">{{ guideStep[10].step }}</div>
|
||||
<div class="guide_btns">
|
||||
<el-button @click="exitGuide" class="guide_btn1" size="mini" type="text">跳过引导</el-button>
|
||||
<el-button v-if="parseInt(currentStep) > 0" @click="prevStep" class="guide_btn1" size="mini">上一步</el-button>
|
||||
<el-button @click="nextStep" class="guide_btn2" size="mini" type="primary">{{ currentStep ==
|
||||
guideStep.length
|
||||
- 1 ? '完成引导' : '下一步' }}</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div slot="reference" :class="{ 'guide_body': currentStep == 10}">
|
||||
<!-- <div v-if="form.copy_type == 3" class="flex_box flex_row_center work_no">
|
||||
<img src="@/assets/images/ElBanCircle.png" />
|
||||
</div> -->
|
||||
@@ -193,6 +269,8 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-popover>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div slot="footer" class="flex_box flex_row_between footer_box">
|
||||
@@ -209,10 +287,25 @@
|
||||
</el-input>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex_box footer_btns">
|
||||
<el-popover v-if="guideStep" :placement="guideStep[12].placement" width="250" trigger="manual"
|
||||
v-model="guideStep[12].show">
|
||||
<div class="guide_box">
|
||||
<div class="guide_title">新手引导<span>({{ parseInt(currentStep) + 1 }}/{{ guideStep.length }})</span>
|
||||
</div>
|
||||
<div class="guide_desc">{{ guideStep[12].step }}</div>
|
||||
<div class="guide_btns">
|
||||
<el-button @click="exitGuide" class="guide_btn1" size="mini" type="text">跳过引导</el-button>
|
||||
<el-button v-if="parseInt(currentStep) > 0" @click="prevStep" class="guide_btn1" size="mini">上一步</el-button>
|
||||
<el-button @click="nextStep" class="guide_btn2" size="mini" type="primary">{{ currentStep ==
|
||||
guideStep.length
|
||||
- 1 ? '完成引导' : '下一步' }}</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex_box footer_btns" slot="reference" :class="{ 'guide_body': currentStep == 12}">
|
||||
<el-button type="primary" class="footer_save" @click="workSave" :loading="saveFlag">保存</el-button>
|
||||
<el-button type="primary" class="footer_submit" @click="workSubmit" :loading="submitFlag">提交</el-button>
|
||||
</div>
|
||||
</el-popover>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 上传文件区域 -->
|
||||
@@ -425,6 +518,9 @@ export default {
|
||||
}
|
||||
],
|
||||
cdList: [],
|
||||
// 新手引导
|
||||
guideStep: null,
|
||||
currentStep: 0,
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@@ -547,7 +643,15 @@ export default {
|
||||
if (setForm) {
|
||||
this.$store.dispatch('setDatas', { name: 'setForm', data: JSON.parse(setForm) })
|
||||
}
|
||||
|
||||
// 新手引导
|
||||
this.guideStep = JSON.parse(localStorage.getItem('guideStep'))
|
||||
this.currentStep = localStorage.getItem('currentStep')
|
||||
if (this.guideStep[this.currentStep]) {
|
||||
this.guideStep[this.currentStep].show = false
|
||||
setTimeout(() => {
|
||||
this.guideStep[this.currentStep].show = true
|
||||
}, 200)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 右键事件
|
||||
@@ -1043,7 +1147,44 @@ export default {
|
||||
initSet() {
|
||||
this.setForm = { ...this.$store.state.user.setForm }
|
||||
console.log(this.$store.state.user.setForm)
|
||||
},
|
||||
// 退出新手引导
|
||||
exitGuide() {
|
||||
for (let key in this.guideStep) {
|
||||
this.guideStep[key].show = false
|
||||
}
|
||||
this.currentStep = -1
|
||||
localStorage.setItem('currentStep', this.currentStep)
|
||||
localStorage.setItem('guideStep', JSON.stringify(this.guideStep))
|
||||
this.close()
|
||||
},
|
||||
// 上一步
|
||||
prevStep(e) {
|
||||
this.guideStep[this.currentStep].show = false
|
||||
this.currentStep = parseInt(this.currentStep) - 1
|
||||
if (this.guideStep[this.currentStep]) {
|
||||
this.guideStep[this.currentStep].show = true
|
||||
localStorage.setItem('guideStep', JSON.stringify(this.guideStep))
|
||||
localStorage.setItem('currentStep', this.currentStep)
|
||||
if (this.currentStep == 7) {
|
||||
this.close()
|
||||
}
|
||||
} else {
|
||||
this.exitGuide()
|
||||
}
|
||||
},
|
||||
// 下一步
|
||||
nextStep(e) {
|
||||
this.guideStep[this.currentStep].show = false
|
||||
this.currentStep = parseInt(this.currentStep) + 1
|
||||
if (this.guideStep[this.currentStep]) {
|
||||
this.guideStep[this.currentStep].show = true
|
||||
localStorage.setItem('guideStep', JSON.stringify(this.guideStep))
|
||||
localStorage.setItem('currentStep', this.currentStep)
|
||||
} else {
|
||||
this.exitGuide()
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -213,6 +213,7 @@ const defaultData = {
|
||||
lack_ink: 0, // 缺墨警告
|
||||
cover_flag: false, //是否盖盖
|
||||
printer_name: '', //设备名称
|
||||
printer_path: '', //设备路径
|
||||
printer_status: 'I', //设备状态 数字转成字符为I
|
||||
printer_tray: 'I', //设备托盘状态 数字转成字符为I
|
||||
red_last: 0, //红色墨盒遗留
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user