mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-09-06 16:07:17 +08:00
add build info on ui
This commit is contained in:
@@ -0,0 +1,9 @@
|
|||||||
|
import _buildInfo from '../../../common/build-info.json'
|
||||||
|
import { shallowRef } from 'vue'
|
||||||
|
|
||||||
|
export default function useBuildInfo() {
|
||||||
|
const buildInfo = shallowRef(JSON.parse(JSON.stringify(_buildInfo)))
|
||||||
|
return {
|
||||||
|
buildInfo
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +1,22 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="flex h100vh">
|
<div class="flex h100vh">
|
||||||
<div class="flex flex-col w160px pt50px pl30px aside-nav">
|
<div class="flex flex-col w160px pt30px pl30px aside-nav of-hidden">
|
||||||
<RouterLink to="./GeekAutoStartChatWithBoss">Boss炸弹</RouterLink>
|
<div class="nav-list flex-1 of-auto">
|
||||||
<RouterLink to="./StartChatRecord">开聊记录</RouterLink>
|
<RouterLink to="./GeekAutoStartChatWithBoss">Boss炸弹</RouterLink>
|
||||||
|
<RouterLink to="./StartChatRecord">开聊记录</RouterLink>
|
||||||
|
</div>
|
||||||
|
<div class="pt-16px pb-16px flex-0 font-size-12px">
|
||||||
|
<div>当前版本: {{ buildInfo.version }}({{ buildInfo.buildVersion }})</div>
|
||||||
|
<div class="feedback-area flex flex-items-center mt-8px">
|
||||||
|
<el-button type="text" size="small" @click="handleGotoProjectPageClick"
|
||||||
|
>项目首页</el-button
|
||||||
|
>
|
||||||
|
|
|
||||||
|
<el-button type="text" size="small" @click="handleFeedbackClick">反馈问题</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<RouterView #default="{ Component }" class="flex-1">
|
<RouterView v-slot="{ Component }" class="flex-1">
|
||||||
<KeepAlive>
|
<KeepAlive>
|
||||||
<component :is="Component" />
|
<component :is="Component" />
|
||||||
</KeepAlive>
|
</KeepAlive>
|
||||||
@@ -15,6 +27,7 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { onMounted, onUnmounted } from 'vue'
|
import { onMounted, onUnmounted } from 'vue'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
|
import useBuildInfo from '@renderer/hooks/useBuildInfo'
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const unmountedCbs: Array<InstanceType<typeof Function>> = []
|
const unmountedCbs: Array<InstanceType<typeof Function>> = []
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
@@ -48,29 +61,58 @@ onUnmounted(() => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
})()
|
})()
|
||||||
|
|
||||||
|
const { buildInfo } = useBuildInfo()
|
||||||
|
const getIssueUrlWithBody = (issueBody: string = '') => {
|
||||||
|
const baseUrl = `https://github.com/geekgeekrun/geekgeekrun/issues/new`
|
||||||
|
issueBody = issueBody || ''
|
||||||
|
if (!issueBody || !issueBody.trim()) {
|
||||||
|
return baseUrl
|
||||||
|
}
|
||||||
|
const urlObj = new URL(baseUrl)
|
||||||
|
urlObj.searchParams.append('body', issueBody)
|
||||||
|
|
||||||
|
return urlObj.toString()
|
||||||
|
}
|
||||||
|
const handleFeedbackClick = () => {
|
||||||
|
electron.ipcRenderer.send(
|
||||||
|
'open-external-link',
|
||||||
|
getIssueUrlWithBody(`\n\n\n-----
|
||||||
|
版本号:${buildInfo.value.version}(${buildInfo.value.buildVersion})
|
||||||
|
提交:${buildInfo.value.buildHash.substring(0, 6)}`)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
const handleGotoProjectPageClick = () => {
|
||||||
|
electron.ipcRenderer.send('open-external-link', 'https://github.com/geekgeekrun/geekgeekrun')
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.aside-nav {
|
.aside-nav {
|
||||||
background-image: linear-gradient(
|
background-image: linear-gradient(45deg, #eaf4f1, #dcf6f2);
|
||||||
45deg,
|
.nav-list {
|
||||||
#eaf4f1,
|
> a {
|
||||||
#dcf6f2,
|
display: flex;
|
||||||
);
|
align-items: center;
|
||||||
> a {
|
height: 2.5em;
|
||||||
display: flex;
|
box-sizing: border-box;
|
||||||
align-items: center;
|
padding-left: 2em;
|
||||||
height: 2.5em;
|
& + a {
|
||||||
box-sizing: border-box;
|
margin-top: 10px;
|
||||||
padding-left: 2em;
|
}
|
||||||
& + a {
|
&.router-link-active {
|
||||||
margin-top: 10px;
|
background-color: #fff;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #2faa9e;
|
||||||
|
border-radius: 9999px 0 0 9999px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
&.router-link-active {
|
}
|
||||||
background-color: #fff;
|
.feedback-area {
|
||||||
font-weight: 700;
|
:deep(.el-button) {
|
||||||
color: #2faa9e;
|
height: fit-content;
|
||||||
border-radius: 9999px 0 0 9999px;
|
padding: 0;
|
||||||
|
margin-left: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user