Merge branch 'zyl' of http://xny.yj-3d.com:3000/zhouyulong/electron-4 into zyl
This commit is contained in:
60
electron.vite.config.1762331677567.mjs
Normal file
60
electron.vite.config.1762331677567.mjs
Normal file
@ -0,0 +1,60 @@
|
||||
// electron.vite.config.ts
|
||||
import { resolve } from "path";
|
||||
import { defineConfig, externalizeDepsPlugin } from "electron-vite";
|
||||
import vue from "@vitejs/plugin-vue";
|
||||
import AutoImport from "unplugin-auto-import/vite";
|
||||
import Components from "unplugin-vue-components/vite";
|
||||
import { ElementPlusResolver } from "unplugin-vue-components/resolvers";
|
||||
import { createSvgIconsPlugin } from "vite-plugin-svg-icons";
|
||||
import path from "path";
|
||||
var electron_vite_config_default = defineConfig({
|
||||
main: {
|
||||
plugins: [externalizeDepsPlugin()]
|
||||
},
|
||||
preload: {
|
||||
plugins: [externalizeDepsPlugin()]
|
||||
},
|
||||
renderer: {
|
||||
resolve: {
|
||||
alias: {
|
||||
"@renderer": resolve("src/renderer/src"),
|
||||
"@": resolve("src/renderer/src")
|
||||
}
|
||||
},
|
||||
plugins: [
|
||||
vue(),
|
||||
AutoImport({
|
||||
imports: ["vue"],
|
||||
dts: "src/auto-imports.d.ts",
|
||||
// 自动生成类型声明文件
|
||||
resolvers: [ElementPlusResolver()]
|
||||
}),
|
||||
Components({
|
||||
resolvers: [ElementPlusResolver()]
|
||||
}),
|
||||
// SVG图标插件配置
|
||||
// 配置SVG图标插件
|
||||
createSvgIconsPlugin({
|
||||
iconDirs: [path.resolve(process.cwd(), "src/renderer/src/icons/svg")],
|
||||
symbolId: "icon-[name]",
|
||||
// 自动清除 SVG 中的 fill 和 stroke 属性
|
||||
svgoOptions: {
|
||||
plugins: [{ name: "removeAttrs", params: { attrs: ["fill", "stroke", "stroke-width"] } }]
|
||||
}
|
||||
})
|
||||
]
|
||||
/*server: {
|
||||
port: 8848,
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: localStorage.getItem('ip') || 'http://127.0.0.1:8848',
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api/, '')
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
});
|
||||
export {
|
||||
electron_vite_config_default as default
|
||||
};
|
||||
@ -1 +1 @@
|
||||
41b/ujShRZRf9Aa433FD3uyIZuxWSSqXWXlc2dyQfJ75ED0HNbadcdsPF5CaMuJ624E+iLBfS14muki3Kp1qv3N0KPVdc0TjJDyrO+AVfwE2pkhuoGoZ8sNGSUSrom2NhRIwJNl4SNhqGkxKvDJhRhWfxw6LHS3T/4NDVmw/KlXwLryTr1ScTPGegLiv1C+r0BN58Qcbdy/IN4J0/xuadZTA9+UoajQ1PHwDUdI7SfpTyz/mXYghVpbQcW8OYTHqLypkZtybW+yeNEhnp/jeYw==
|
||||
41b/ujShRZRf9Aa433FD3uyIZuxWSSqXWXlc2dyQfJ75ED0HNbadcdsPF5CaMuJ624E+iLBfS14muki3Kp1qv3N0KPVdc0TjJDyrO+AVfwFghRHbXEWYEGb3GpmVU0MwclqNNggKfnTvj0gDIpFBNl/nxMZKwYXbYk8nqd3yUDfwLryTr1ScTPGegLiv1C+r1SDxtenx4d2fxqS6FkGbV5TA9+UoajQ1PHwDUdI7SfpxjvK4tQscOcu0R0wLgUa3LypkZtybW+yeNEhnp/jeYw==
|
||||
@ -53,4 +53,17 @@ export const TsApi = {
|
||||
data
|
||||
})
|
||||
},
|
||||
// /tsEvent/update
|
||||
updateTsEvent: async (data: any) => {
|
||||
return await request.post({
|
||||
url: '/tsEvent/update',
|
||||
data
|
||||
})
|
||||
},
|
||||
delEvent: async (data: any) => {
|
||||
return await request.post({
|
||||
url: '/tsEvent/delete',
|
||||
data
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,6 +36,7 @@
|
||||
--color-base1: 0, 255, 255;
|
||||
--color-base2: 0, 255, 255;
|
||||
--color-border1: rgb(0, 200, 255);
|
||||
--color-border2: rgb(204, 204,204);
|
||||
--color-text2: 173, 241, 255;
|
||||
--color-text-shadow: rgba(20, 118, 255, 1);
|
||||
--color-box-shadow: rgba(37, 196, 196, 1);
|
||||
|
||||
BIN
src/renderer/src/assets/video/author_video.mp4
Normal file
BIN
src/renderer/src/assets/video/author_video.mp4
Normal file
Binary file not shown.
BIN
src/renderer/src/assets/video/工程20251023 154137.zip
Normal file
BIN
src/renderer/src/assets/video/工程20251023 154137.zip
Normal file
Binary file not shown.
@ -9,9 +9,9 @@
|
||||
:on-error="handleError"
|
||||
class="simple-upload"
|
||||
>
|
||||
<el-button color="#005c5c" :loading="isUploading">
|
||||
<el-button class="clickBut" color="#005c5c" :loading="isUploading">
|
||||
<UploadFilled class="mr-2" />
|
||||
{{ t("auths.upload") }}
|
||||
{{ t('auths.upload') }}
|
||||
</el-button>
|
||||
</el-upload>
|
||||
</template>
|
||||
@ -87,4 +87,7 @@ const handleError = (error: Error) => {
|
||||
.simple-upload {
|
||||
display: inline-block;
|
||||
}
|
||||
::v-deep .clickBut:hover {
|
||||
color: rgba(0, 255, 255, 1) !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -1,15 +1,25 @@
|
||||
import {createRouter, createWebHashHistory} from 'vue-router'
|
||||
import { createRouter, createWebHashHistory } from 'vue-router'
|
||||
import homeIndex from '@/views/home/index.vue'
|
||||
|
||||
const routes = [
|
||||
// {
|
||||
// path: '/',
|
||||
// component: () => import('@/views/login/index.vue'),
|
||||
// hidden: true
|
||||
// },
|
||||
{
|
||||
path: '/',
|
||||
component: () => import('@/views/author/index.vue'),
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: '/login',
|
||||
component: () => import('@/views/login/index.vue'),
|
||||
hidden: true
|
||||
},
|
||||
{path: '/ts', component: () => import('@/views/TS/list.vue'), hidden: true},
|
||||
{path: '/tsEdit', name: 'tsEdit', component: () => import('@/views/TS/edit.vue'), hidden: true},
|
||||
{path: '/404', component: () => import('@/views/404.vue'), hidden: true},
|
||||
{ path: '/ts', component: () => import('@/views/TS/list.vue'), hidden: true },
|
||||
{ path: '/tsEdit', name: 'tsEdit', component: () => import('@/views/TS/edit.vue'), hidden: true },
|
||||
{ path: '/404', component: () => import('@/views/404.vue'), hidden: true },
|
||||
|
||||
{
|
||||
path: '/home',
|
||||
@ -18,7 +28,7 @@ const routes = [
|
||||
hidden: true
|
||||
},
|
||||
|
||||
{path: '/:pathMatch(.*)*', redirect: '/404', hidden: true}
|
||||
{ path: '/:pathMatch(.*)*', redirect: '/404', hidden: true }
|
||||
]
|
||||
|
||||
const router = createRouter({
|
||||
|
||||
@ -49,7 +49,7 @@ const initTreeCallBack = () => {
|
||||
console.log('queryTsSource', res)
|
||||
if (res.code == 200) {
|
||||
for (let i = res.data.length - 1; i >= 0; i--) {
|
||||
res.data[i].icon = await cusNodeIcon(res.data[i]);
|
||||
res.data[i].svg = await cusNodeIcon(res.data[i]);
|
||||
}
|
||||
zNodes.value = res.data
|
||||
console.log("data", zNodes.value)
|
||||
|
||||
@ -24,10 +24,14 @@ const selectedEventId = ref(null)
|
||||
const eventBus: any = inject('bus')
|
||||
const props = defineProps(['eventList', 'hr', 'originHrOffset', 'scrollLeft'])
|
||||
let clickEventBar = (event) => {
|
||||
console.log("点击事件块")
|
||||
console.log("点击事件块", selectedEventId.value, event.id)
|
||||
selectedEventId.value = (selectedEventId.value == null || selectedEventId.value != event.id) ? event.id : null
|
||||
eventBus.emit('click-event-show-plane', event)
|
||||
eventBus.emit('click-event-show-plane', selectedEventId.value ? event : null)
|
||||
}
|
||||
// 点击事件属性编辑面板的取消按钮,取消选中时间块
|
||||
eventBus.on("click-cancel-hide-plane", () => {
|
||||
selectedEventId.value = null
|
||||
})
|
||||
// 1. 定义响应式变量,用于强制更新
|
||||
const refreshKey = ref(0)
|
||||
|
||||
|
||||
@ -1,8 +1,26 @@
|
||||
<template>
|
||||
<div class="eventParams">
|
||||
<template v-if="eventObj">
|
||||
<div class="eventPanel">
|
||||
<span class="title">{{ eventObj.name }}</span>
|
||||
<div class="eventDetail">
|
||||
<template v-if="eventObj.callback&&eventObj.callback=='flicker'">
|
||||
<div>
|
||||
<span>{{ eventObj.name }}</span>
|
||||
闪烁间隔
|
||||
<el-input v-model="detail.times" style="width: 50%" placeholder="Please input"/>
|
||||
秒
|
||||
</div>
|
||||
<div>
|
||||
闪烁次数
|
||||
<el-input v-model="detail.numbers" style="width: 50%" placeholder="Please input"/>
|
||||
次
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
<div class="optBtn">
|
||||
<el-button @click="updateEvent">确定</el-button>
|
||||
<el-button @click="cancel">取消</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
@ -16,19 +34,67 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {inject, ref} from 'vue'
|
||||
import {TsApi} from "../../../api/ts";
|
||||
|
||||
const times = ref(0)
|
||||
const numbers = ref(0)
|
||||
|
||||
const detail = ref({})
|
||||
|
||||
const eventBus: any = inject('bus')
|
||||
let eventObj:any = ref(null)
|
||||
eventBus.on('click-event-show-plane', (params) => {
|
||||
console.log('兄弟 B 的方法被触发了!', params)
|
||||
eventObj.value = (eventObj.value == null ? params : null)
|
||||
eventObj.value = (params ? params : null)
|
||||
if (eventObj.value) {
|
||||
let details = JSON.parse(eventObj.value.detail)
|
||||
switch (params.callback) {
|
||||
case 'flicker':
|
||||
// times.value = detail.times
|
||||
// numbers.value = detail.numbers
|
||||
detail.value = details
|
||||
break
|
||||
}
|
||||
}
|
||||
})
|
||||
let isNoEvent = ref(true)
|
||||
const updateEvent = () => {
|
||||
// console.log(detail.value)
|
||||
let obj = eventObj.value
|
||||
obj.detail = JSON.stringify(detail.value)
|
||||
console.log(obj)
|
||||
delete obj.createdAt
|
||||
delete obj.updatedAt
|
||||
delete obj.duration_time
|
||||
TsApi.updateTsEvent(obj).then(res => {
|
||||
console.log(res)
|
||||
})
|
||||
}
|
||||
const cancel = () => {
|
||||
eventObj.value = null
|
||||
detail.value = {}
|
||||
eventBus.emit('click-cancel-hide-plane',)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.eventParams {
|
||||
width: 20%;
|
||||
padding: 0 10px;
|
||||
|
||||
.eventPanel {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
|
||||
.title {
|
||||
line-height: 30px;
|
||||
}
|
||||
|
||||
.eventDetail {
|
||||
overflow-y: auto;
|
||||
height: calc(100% - 62px);
|
||||
}
|
||||
}
|
||||
|
||||
.tourBox {
|
||||
width: 100%;
|
||||
@ -44,4 +110,11 @@ let isNoEvent = ref(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.el-input__wrapper), :deep(.el-input__inner ) {
|
||||
background: transparent;
|
||||
--el-input-placeholder-color: #fff;
|
||||
color: #fff;
|
||||
//border: 1px solid #0ff;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -1,10 +1,11 @@
|
||||
<template>
|
||||
<div class="grid">
|
||||
<div class="grid" @click="hideRightMenu">
|
||||
<div class="grid-header row">
|
||||
<div v-for="item in columns" :style="item.style">{{ item.name }}</div>
|
||||
</div>
|
||||
<div class="grid-body">
|
||||
<div class="row" :style="getStyle" v-for="(event) in eventList">
|
||||
<div :class="['row',(eventObj&&event.id==eventObj.id)?'selectedRow':'']" :style="getStyle"
|
||||
v-for="(event) in eventList" @click.right="(e)=>{rightClick(e,event)}">
|
||||
<span v-for="item in columns" :class="item.key" :style="item.style">{{
|
||||
format(item.key, event[item.key])
|
||||
}}</span>
|
||||
@ -14,15 +15,75 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="gridRightMenu" v-if="rightClickEvent">
|
||||
<template v-for="item in menus">
|
||||
<template v-if="item.name=='删除'">
|
||||
<el-popconfirm
|
||||
width="220"
|
||||
icon-color="#626AEF"
|
||||
title="确定要删除吗?"
|
||||
@cancel="onCancel"
|
||||
>
|
||||
<template #reference>
|
||||
<span @click="">删除</span>
|
||||
</template>
|
||||
<template #actions="{ confirm, cancel }">
|
||||
<el-button size="small" @click="cancel">取消</el-button>
|
||||
<el-button
|
||||
type="danger"
|
||||
size="small"
|
||||
@click="()=>{item.fun(); confirm()}"
|
||||
>
|
||||
确定
|
||||
</el-button>
|
||||
</template>
|
||||
</el-popconfirm>
|
||||
</template>
|
||||
<span v-else @click="item.fun()">
|
||||
{{ item.name }}
|
||||
</span>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
//@ts-nocheck
|
||||
import {computed, onMounted, ref} from "vue"
|
||||
import {computed, onMounted, ref, nextTick} from "vue"
|
||||
import {TsApi} from "../../../api/ts";
|
||||
import {ElMessage} from "element-plus";
|
||||
|
||||
const eventBus: any = inject('bus')
|
||||
const props = defineProps(['eventList',])
|
||||
const menus = ref([
|
||||
{
|
||||
name: "删除",
|
||||
fun: () => {
|
||||
let param = new FormData
|
||||
param.append("id", rightClickEvent.value.id)
|
||||
TsApi.delEvent(param).then(res => {
|
||||
if (res.code == 200) {
|
||||
eventBus.emit('delete-event', rightClickEvent.value.id)
|
||||
ElMessage({message: "操作成功", type: "success"})
|
||||
rightClickEvent.value = null
|
||||
}
|
||||
})
|
||||
}
|
||||
}, {
|
||||
name: '定位', fun: () => {
|
||||
let entity = window['earth_ts'].entityMap.get(rightClickEvent.value.sourceId)
|
||||
entity && entity.flyTo()
|
||||
}
|
||||
},])
|
||||
const clicked = ref(false)
|
||||
|
||||
function onCancel() {
|
||||
clicked.value = true
|
||||
}
|
||||
|
||||
|
||||
let eventObj = ref(null)
|
||||
let rightClickEvent = ref(null)
|
||||
let columns = ref([{name: '事件名称', key: "name", style: "flex:auto"},
|
||||
{name: '开始时间', key: "startTime", style: "width:120px"},
|
||||
{name: '持续时间', key: "duration_time", style: "width:70px"}])
|
||||
@ -37,7 +98,28 @@ let format = (key, val) => {
|
||||
return val
|
||||
}
|
||||
let getStyle = computed(() => {
|
||||
return "height:" + window['tsObj']._Store._scales.cellHeight + "px"
|
||||
let style = "height:" + window['tsObj']._Store._scales.cellHeight + "px"
|
||||
return style
|
||||
})
|
||||
const rightClick = (e, eventObj) => {
|
||||
console.log("右键点击", e)
|
||||
rightClickEvent.value = eventObj
|
||||
nextTick(() => {
|
||||
$(".gridRightMenu")[0].style.top = e.layerY + "px"
|
||||
$(".gridRightMenu")[0].style.left = e.layerX + "px"
|
||||
})
|
||||
|
||||
}
|
||||
const hideRightMenu = (e) => {
|
||||
console.log("hideRightMenu", e)
|
||||
if (e.target.innerHTML != "删除")
|
||||
rightClickEvent.value = null
|
||||
}
|
||||
eventBus.on('click-event-show-plane', (params) => {
|
||||
eventObj.value = (params ? params : null)
|
||||
})
|
||||
eventBus.on("click-cancel-hide-plane", () => {
|
||||
eventObj.value = null
|
||||
})
|
||||
onMounted(() => {
|
||||
/* let doms = document.getElementsByClassName("start_time")
|
||||
@ -89,6 +171,30 @@ onMounted(() => {
|
||||
position: relative;
|
||||
overflow-y: inherit;
|
||||
font-size: 14px;
|
||||
|
||||
.selectedRow {
|
||||
background-color: rgba(0, 255, 255, 0.2);
|
||||
}
|
||||
}
|
||||
|
||||
.gridRightMenu {
|
||||
position: absolute;
|
||||
z-index: 99;
|
||||
background: rgba(0, 0, 0, 0.8);
|
||||
transform: translateY(50%);
|
||||
width: 80px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border: 1.5px solid;
|
||||
border-image: linear-gradient(137.95deg, rgba(var(--color-base1), 1) 6.25%, var(--color-border1) 100%) 1.5;
|
||||
|
||||
span {
|
||||
padding: 5px 0;
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -29,7 +29,7 @@ let cabin = ref()
|
||||
let tsOBJ = ref({})
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
let params:any = {}
|
||||
let params: any = {}
|
||||
// 将由列表页面传递过来的参数,数字化
|
||||
for (const routeQueryKey in route.query) {
|
||||
params[routeQueryKey] = route.query[routeQueryKey]
|
||||
@ -39,10 +39,11 @@ for (const routeQueryKey in route.query) {
|
||||
}
|
||||
console.log("params", params)
|
||||
window.planId = params.id
|
||||
const eventBus: any = inject('bus')
|
||||
|
||||
// 通过planID获取方案包含的所有事件
|
||||
let getEventList = () => {
|
||||
let events:any = []
|
||||
let events: any = []
|
||||
for (let i = 0; i < 1; i++) {
|
||||
events.push({
|
||||
id: "task" + i,
|
||||
@ -65,6 +66,10 @@ let getEventList = () => {
|
||||
})
|
||||
newTS(params, events)
|
||||
}
|
||||
eventBus.on('delete-event', (id) => {
|
||||
console.log(id)
|
||||
tsOBJ.value._Store._tasks = tsOBJ.value._Store._tasks.filter(item => item.id != id)
|
||||
})
|
||||
// 新建态势推演对象
|
||||
let newTS = (params, events) => {
|
||||
|
||||
|
||||
@ -35,7 +35,6 @@
|
||||
v-model="form.datetime"
|
||||
type="datetime"
|
||||
placeholder="选择触发时间"
|
||||
value-format="x"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="持续时间">
|
||||
@ -98,6 +97,7 @@
|
||||
import {ref, reactive} from "vue";
|
||||
import type {RenderContentContext, TreeInstance} from 'element-plus'
|
||||
import {TsApi} from "../../api/ts";
|
||||
import {ElMessage} from "element-plus";
|
||||
|
||||
const treeRef = ref<TreeInstance>()
|
||||
// 存储当前需要高亮的节点 key(初始为空)
|
||||
@ -108,7 +108,7 @@ interface Tree {
|
||||
children?: Tree[]
|
||||
}
|
||||
|
||||
const form = reactive({
|
||||
let form = reactive({
|
||||
name: '闪烁-',
|
||||
// datetime: '',
|
||||
})
|
||||
@ -121,7 +121,7 @@ const numbers = ref(0)//闪烁次数
|
||||
const isContainModelPosition = ref(true)
|
||||
const eventBus: any = inject('bus')
|
||||
|
||||
form['datetime'] = new Date(2025, 10, 5, 18, 8, 43)
|
||||
form['datetime'] = new Date(window['tsObj']._Store._currentTimestamp)
|
||||
const isShowPup = ref(false)
|
||||
const eventTree: { children: ({ label: string } | { label: string })[]; id: string; label: string }[] = [
|
||||
{
|
||||
@ -172,10 +172,32 @@ const addEvent = () => {
|
||||
"detail": JSON.stringify(obj)
|
||||
}
|
||||
TsApi.addTsEvent(dbParams).then(res => {
|
||||
if (res.code == 200) {
|
||||
ElMessage({
|
||||
message: "操作成功",
|
||||
type: "success"
|
||||
})
|
||||
|
||||
}
|
||||
isShowPup.value = false
|
||||
|
||||
reset()
|
||||
})
|
||||
console.log(dbParams)
|
||||
}
|
||||
const reset = () => {
|
||||
hour.value = 0
|
||||
minute.value = 0
|
||||
second.value = 0
|
||||
numbers.value = 0
|
||||
times.value = 0
|
||||
form = {
|
||||
name: '闪烁-',
|
||||
// datetime: '',
|
||||
}
|
||||
currentKey.value = "flicker"
|
||||
|
||||
}
|
||||
eventBus.on('openAddEvent', (data, cb, type) => {
|
||||
console.log("openAddEvent", data)
|
||||
// selectCallback = cb
|
||||
|
||||
407
src/renderer/src/views/author/index.vue
Normal file
407
src/renderer/src/views/author/index.vue
Normal file
@ -0,0 +1,407 @@
|
||||
<template>
|
||||
<video
|
||||
key="second-video"
|
||||
autoplay
|
||||
loop
|
||||
muted
|
||||
src="../../assets/video/author_video.mp4"
|
||||
style="position: fixed; width: 100vw; height: 100vh; left: 0; top: 0; object-fit: cover"
|
||||
></video>
|
||||
<Dialog ref="baseDialog" class="graffiti" title="系统授权" :closeCallback="closeCallBack">
|
||||
<template #content>
|
||||
<div class="auth_info custom_scroll_bar content_h">
|
||||
<div class="auth_info_box">
|
||||
<div>
|
||||
<span class="fankuai"></span>
|
||||
{{ t('auths.authCode') }}
|
||||
</div>
|
||||
<div
|
||||
class="auth_info_text"
|
||||
@click="copy(authInfo.license_code)"
|
||||
style="cursor: pointer"
|
||||
title="点击可复制"
|
||||
>
|
||||
{{ authInfo.license_code || '' }}
|
||||
<svg-icon name="copy" :size="20" style="margin-left: 30px"></svg-icon>
|
||||
</div>
|
||||
</div>
|
||||
<div class="auth_info_box">
|
||||
<div>
|
||||
<span class="fankuai"></span>
|
||||
{{ t('auths.authTime') }}
|
||||
</div>
|
||||
<div class="auth_info_text" v-if="authInfo.status != null">
|
||||
<template v-if="authInfo.generateTime != ''">
|
||||
{{ authInfo.generateTime || '2023-01-01' }}-
|
||||
</template>
|
||||
{{ authInfo.expireTime || '2023-01-01' }}
|
||||
</div>
|
||||
<div v-else class="auth_info_text">暂无</div>
|
||||
</div>
|
||||
<div class="auth_info_box">
|
||||
<div>
|
||||
<span class="fankuai"></span>
|
||||
{{ t('auths.authType') }}
|
||||
</div>
|
||||
<div
|
||||
v-if="authInfo.status != null"
|
||||
class="auth_info_text"
|
||||
style="font-size: 16px"
|
||||
:style="{ color: authInfo.status ? 'rgba(27, 248, 195, 1)' : 'rgba(255, 161, 69, 1)' }"
|
||||
>
|
||||
{{ authInfo.status ? t('auths.authTempExpire') : t('auths.authexpire') }}
|
||||
</div>
|
||||
<!-- <div v-else class="auth_info_text">{{ authInfo.message || '无' }}</div> -->
|
||||
<div v-else class="auth_info_text" style="font-size: 16px; color: rgba(241, 108, 85, 1)">
|
||||
{{ t('auths.noAuthexpire') }}
|
||||
</div>
|
||||
</div>
|
||||
<!-- <uploadFiles accept=".lic" :maxSize="1"></uploadFiles> -->
|
||||
</div>
|
||||
</template>
|
||||
<template #footer>
|
||||
<uploadFiles accept=".lic" :maxSize="1"></uploadFiles>
|
||||
<button @click="close">退出系统</button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import Dialog from '@/components/dialog/baseDialog.vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { ref, reactive, toRefs, onBeforeMount, onMounted, watchEffect, computed } from 'vue'
|
||||
import { AuthApi } from '@/api/setting/auth'
|
||||
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import uploadFiles from '@/components/upload/uploadFiles.vue'
|
||||
import useClipboard from 'vue-clipboard3'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import {
|
||||
$sendElectronChanel,
|
||||
$recvElectronChanel,
|
||||
$changeComponentShow
|
||||
} from '@/utils/communication'
|
||||
|
||||
const { ipcRenderer } = require('electron')
|
||||
const router = useRouter()
|
||||
const getAuthInfo = async () => {
|
||||
try {
|
||||
const res = await AuthApi.showAuth()
|
||||
if (typeof res.data === 'object') {
|
||||
getStatus(res.data.expireTime)
|
||||
}
|
||||
} catch (error) {
|
||||
// 统一处理错误
|
||||
ElMessageBox.confirm('您没有进行系统授权哦,系统功能将无法使用?', '提示', {
|
||||
confirmButtonText: '去授权',
|
||||
cancelButtonText: '退出系统',
|
||||
type: 'warning',
|
||||
closeOnClickModal: false
|
||||
})
|
||||
.then(async () => {
|
||||
try {
|
||||
baseDialog.value?.open()
|
||||
} catch (error) {
|
||||
console.error('打开授权对话框失败:', error)
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
// 用户点击取消,不执行任何操作
|
||||
ipcRenderer.send('quit-app')
|
||||
})
|
||||
}
|
||||
}
|
||||
let showPop = ref(false)
|
||||
const baseDialog = ref(null)
|
||||
const getStatus = (date) => {
|
||||
const timestamp = new Date(date).getTime()
|
||||
|
||||
const currentTimestamp = Date.now()
|
||||
if (timestamp > currentTimestamp) {
|
||||
router.push({ path: '/login' })
|
||||
} else {
|
||||
ElMessageBox.confirm('您没有进行系统授权哦,系统功能将无法使用?', '提示', {
|
||||
confirmButtonText: '去授权',
|
||||
cancelButtonText: '退出系统',
|
||||
type: 'warning',
|
||||
closeOnClickModal: false
|
||||
})
|
||||
.then(async () => {
|
||||
try {
|
||||
baseDialog.value?.open()
|
||||
} catch (error) {
|
||||
console.error('打开授权对话框失败:', error)
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
// 用户点击取消,不执行任何操作
|
||||
ipcRenderer.send('quit-app')
|
||||
})
|
||||
}
|
||||
}
|
||||
getAuthInfo()
|
||||
|
||||
//授权页面
|
||||
|
||||
const closeCallBack = (e) => {
|
||||
baseDialog.value?.close()
|
||||
}
|
||||
const close = (e) => {
|
||||
ElMessageBox.confirm('确定要退出系统吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(async () => {
|
||||
ipcRenderer.send('quit-app')
|
||||
})
|
||||
.catch(() => {
|
||||
// 用户点击取消,不执行任何操作
|
||||
})
|
||||
}
|
||||
|
||||
const eventBus = inject('bus')
|
||||
const { t } = useI18n()
|
||||
const authInfo = ref({
|
||||
license_code: '',
|
||||
//授权信息
|
||||
generateTime: '', //开始时间
|
||||
expireTime: '', //结束时间
|
||||
authDays: null, //授权时间
|
||||
status: null
|
||||
})
|
||||
//上传授权文件成功
|
||||
eventBus.on('upload', (data) => {
|
||||
if (data) {
|
||||
getAuthInfo2()
|
||||
setTimeout(() => {
|
||||
ElMessage({
|
||||
message: '载入成功,将在2s后自动重启',
|
||||
type: 'success'
|
||||
})
|
||||
}, 1000)
|
||||
setTimeout(() => {
|
||||
$sendElectronChanel('restart')
|
||||
}, 3000)
|
||||
}
|
||||
})
|
||||
|
||||
const { toClipboard } = useClipboard()
|
||||
|
||||
const getAuthInfo2 = async () => {
|
||||
const res = await AuthApi.showAuth()
|
||||
if (typeof res.data === 'object') {
|
||||
authInfo.value.generateTime = res.data.generateTime
|
||||
authInfo.value.expireTime = res.data.expireTime
|
||||
getStatus2()
|
||||
}
|
||||
}
|
||||
|
||||
const getStatus2 = () => {
|
||||
const timestamp = new Date(authInfo.value.expireTime).getTime()
|
||||
|
||||
const currentTimestamp = Date.now()
|
||||
|
||||
if (timestamp > currentTimestamp) {
|
||||
authInfo.value.status = true
|
||||
} else {
|
||||
authInfo.value.status = false
|
||||
}
|
||||
window.checkAuthIsValid = authInfo.value.status
|
||||
}
|
||||
const getAuthCode = async () => {
|
||||
const res = await AuthApi.authInfo()
|
||||
authInfo.value.license_code = res.data
|
||||
}
|
||||
getAuthInfo2()
|
||||
getAuthCode()
|
||||
//复制
|
||||
|
||||
const copy = async (text) => {
|
||||
try {
|
||||
await toClipboard(text)
|
||||
ElMessage.success('复制成功')
|
||||
} catch (e) {
|
||||
ElMessage.error('复制失败')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
:root {
|
||||
--color-sdk-text-shadow: rgba(20, 118, 255, 1);
|
||||
}
|
||||
|
||||
.auth_info {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
overflow-y: auto;
|
||||
color: rgba(var(--color-text2), 0.8);
|
||||
|
||||
.auth_info_text {
|
||||
color: #fff;
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
margin: 7px 0 15px 15px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.auth_info_box {
|
||||
margin-bottom: 15px;
|
||||
border-bottom: 1px solid rgba(204, 204, 204, 0.2);
|
||||
}
|
||||
|
||||
.el-button--primary {
|
||||
color: #fff !important;
|
||||
font-size: 16px;
|
||||
background: rgba(var(--color-base1), 0.2) !important;
|
||||
font-weight: bolder;
|
||||
border-color: transparent;
|
||||
border-radius: 4px;
|
||||
}
|
||||
}
|
||||
.fankuai {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
// 旋转角度
|
||||
transform: rotate(45deg);
|
||||
border: 2px solid rgba(var(--color-base1), 1);
|
||||
display: inline-block;
|
||||
margin-right: 5px;
|
||||
margin-left: 5px;
|
||||
}
|
||||
.YJ-custom-base-dialog {
|
||||
position: absolute;
|
||||
color: #ffffff;
|
||||
font-size: 14px;
|
||||
z-index: 99;
|
||||
background: linear-gradient(0deg, #00ffff33 0%, #00ffff00 100%), rgba(0, 0, 0, 0.6);
|
||||
border: 1.5px solid;
|
||||
border-image: linear-gradient(to bottom, rgba(var(--color-base1), 1) 6.25%, rgb(0, 200, 255) 100%)
|
||||
1;
|
||||
text-align: left;
|
||||
font-family: 'sy-boldface';
|
||||
}
|
||||
|
||||
.YJ-custom-base-dialog * {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.YJ-custom-base-dialog:after {
|
||||
display: block;
|
||||
position: absolute;
|
||||
content: '';
|
||||
left: -1.5px;
|
||||
top: -6px;
|
||||
width: 70.5px;
|
||||
height: 6px;
|
||||
opacity: 1;
|
||||
background: rgba(var(--color-base1), 1);
|
||||
clip-path: polygon(0 0, calc(100% - 3px) 0, 100% 6px, 0 6px);
|
||||
}
|
||||
|
||||
.YJ-custom-base-dialog svg {
|
||||
fill: #ffffff;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.YJ-custom-base-dialog .custom-divider {
|
||||
width: 100%;
|
||||
display: block;
|
||||
border-top: 1px solid rgba(204, 204, 204, 0.2);
|
||||
}
|
||||
|
||||
.YJ-custom-base-dialog .text-number {
|
||||
font-family: 'D-Din-Bold';
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
::v-deep .title-box {
|
||||
line-height: 46px;
|
||||
padding: 5px 16px 5px 16px !important;
|
||||
position: relative;
|
||||
}
|
||||
::v-deep .title-box > .close-box {
|
||||
display: none;
|
||||
}
|
||||
|
||||
::v-deep .title-box > .title {
|
||||
font-family: 'Ali-mother-counts-bold';
|
||||
font-size: 18px;
|
||||
font-weight: 400;
|
||||
letter-spacing: 0px;
|
||||
line-height: 0px;
|
||||
color: rgba(255, 255, 255, 1);
|
||||
text-align: left;
|
||||
text-shadow: 0px 0px 9px rgba(20, 118, 255, 1);
|
||||
-webkit-pointer-events: none;
|
||||
-moz-pointer-events: none;
|
||||
-ms-pointer-events: none;
|
||||
-o-pointer-events: none;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
::v-deep .foot {
|
||||
position: relative;
|
||||
padding: 20px 24px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
::v-deep .foot > button {
|
||||
margin-left: 10px;
|
||||
border-radius: 4px;
|
||||
background: rgba(var(--color-base1), 0.2);
|
||||
border: 1px solid rgba(var(--color-base1), 0.5);
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
color: rgba(255, 255, 255, 1);
|
||||
padding: 5px 20px;
|
||||
cursor: pointer;
|
||||
}
|
||||
::v-deep .foot > button:hover {
|
||||
border: 1px solid rgba(var(--color-base1), 1);
|
||||
color: rgba(var(--color-base1), 1);
|
||||
}
|
||||
|
||||
::v-deep .foot > .show > .label {
|
||||
margin: 0px 10px;
|
||||
}
|
||||
::v-deep .el-message-box {
|
||||
--el-messagebox-title-color: #fff !important;
|
||||
--el-messagebox-content-color: #fff !important;
|
||||
background:
|
||||
linear-gradient(180deg, rgba(var(--color-base1), 0) 0%, rgba(var(--color-base1), 0.2) 100%),
|
||||
rgba(0, 0, 0, 0.6) !important;
|
||||
}
|
||||
</style>
|
||||
<style lang="scss">
|
||||
.el-message-box {
|
||||
--el-messagebox-title-color: #fff !important;
|
||||
--el-messagebox-content-color: #fff !important;
|
||||
background:
|
||||
linear-gradient(180deg, rgba(var(--color-base1), 0) 0%, rgba(var(--color-base1), 0.2) 100%),
|
||||
rgba(0, 0, 0, 0.6) !important;
|
||||
.el-message-box__btns {
|
||||
.el-button {
|
||||
--el-button-text-color: #fff;
|
||||
--el-button-bg-color: rgba(var(--color-base1), 0.2) !important;
|
||||
--el-button-hover-bg-color: rgba(var(--color-base1), 0.2) !important;
|
||||
--el-button-border-color: rgba(var(--color-base1), 0.5) !important;
|
||||
--el-button-hover-border-color: rgba(var(--color-base1), 1) !important;
|
||||
--el-button-hover-text-color: rgba(var(--color-base1), 1) !important;
|
||||
}
|
||||
.el-button--primary {
|
||||
--el-button-bg-color: rgba(var(--color-base1), 0.2) !important;
|
||||
--el-button-hover-bg-color: rgba(var(--color-base1), 0.2) !important;
|
||||
}
|
||||
.el-button:focus-visible {
|
||||
outline: none !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -208,6 +208,7 @@
|
||||
size="small"
|
||||
:placeholder="t('btn.selectPlaceholder')"
|
||||
:no-data-text="t('btn.selectNoText')"
|
||||
popper-class="custom-dropdown"
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) in poiOptions"
|
||||
@ -782,5 +783,9 @@ defineExpose({
|
||||
|
||||
.el-select-dropdown__wrap {
|
||||
max-height: 260px !important;
|
||||
width: 380px !important;
|
||||
}
|
||||
.custom-dropdown {
|
||||
margin-top: 75px;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user