feat: add desktop bug report collection
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
AppstoreOutlined,
|
||||
BugOutlined,
|
||||
DownloadOutlined,
|
||||
LinkOutlined,
|
||||
LogoutOutlined,
|
||||
@@ -8,6 +9,7 @@ import {
|
||||
SendOutlined,
|
||||
SettingOutlined,
|
||||
} from '@ant-design/icons-vue'
|
||||
import { message } from 'ant-design-vue'
|
||||
import { computed, onMounted, ref, watch } from 'vue'
|
||||
import { RouterLink, RouterView, useRoute } from 'vue-router'
|
||||
|
||||
@@ -35,6 +37,14 @@ const updateModalOpen = ref(false)
|
||||
const updateModalVersion = ref('')
|
||||
const updateModalForce = ref(false)
|
||||
const updateModalStarted = ref(false)
|
||||
const bugReportOpen = ref(false)
|
||||
const bugReportSubmitting = ref(false)
|
||||
type BugReportSeverity = 'low' | 'medium' | 'high' | 'critical'
|
||||
const bugReportForm = ref({
|
||||
title: '',
|
||||
description: '',
|
||||
severity: 'medium' as BugReportSeverity,
|
||||
})
|
||||
|
||||
const accountAwareRoutes = new Set(['/media-platforms', '/ai-platforms'])
|
||||
|
||||
@@ -136,7 +146,10 @@ const updateProgressBarPercent = computed(() => {
|
||||
if (updateProgress.value?.stage === 'checking') {
|
||||
return 8
|
||||
}
|
||||
if (updateProgress.value?.stage === 'downloaded' || updateProgress.value?.stage === 'installing') {
|
||||
if (
|
||||
updateProgress.value?.stage === 'downloaded' ||
|
||||
updateProgress.value?.stage === 'installing'
|
||||
) {
|
||||
return 100
|
||||
}
|
||||
return updateProgressPercent.value ?? 8
|
||||
@@ -173,6 +186,37 @@ function openSettingsWindow() {
|
||||
void window.desktopBridge.app.openSettingsWindow()
|
||||
}
|
||||
|
||||
function openBugReportDialog() {
|
||||
bugReportForm.value = {
|
||||
title: '',
|
||||
description: '',
|
||||
severity: 'medium' as BugReportSeverity,
|
||||
}
|
||||
bugReportOpen.value = true
|
||||
}
|
||||
|
||||
async function submitBugReport() {
|
||||
const title = bugReportForm.value.title.trim()
|
||||
const description = bugReportForm.value.description.trim()
|
||||
if (!title || !description) {
|
||||
return
|
||||
}
|
||||
bugReportSubmitting.value = true
|
||||
try {
|
||||
const result = await window.desktopBridge.app.submitBugReport({
|
||||
title,
|
||||
description,
|
||||
severity: bugReportForm.value.severity,
|
||||
})
|
||||
bugReportOpen.value = false
|
||||
message.success(`反馈已提交:${result.id}`)
|
||||
} catch (error) {
|
||||
message.error(error instanceof Error ? error.message : '反馈提交失败')
|
||||
} finally {
|
||||
bugReportSubmitting.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function startClientReleaseUpdate() {
|
||||
updateModalStarted.value = true
|
||||
const updated = await startClientUpdate()
|
||||
@@ -275,6 +319,11 @@ watch(
|
||||
</div>
|
||||
</a-tooltip>
|
||||
<div class="action-cluster">
|
||||
<a-tooltip title="反馈问题" placement="top">
|
||||
<button type="button" class="footer-icon-btn" @click="openBugReportDialog">
|
||||
<BugOutlined />
|
||||
</button>
|
||||
</a-tooltip>
|
||||
<a-tooltip title="设置" placement="top">
|
||||
<button type="button" class="footer-icon-btn" @click="openSettingsWindow">
|
||||
<SettingOutlined />
|
||||
@@ -388,6 +437,47 @@ watch(
|
||||
</div>
|
||||
</section>
|
||||
</a-modal>
|
||||
|
||||
<a-modal
|
||||
v-model:open="bugReportOpen"
|
||||
title="反馈客户端问题"
|
||||
:confirm-loading="bugReportSubmitting"
|
||||
ok-text="提交"
|
||||
cancel-text="取消"
|
||||
:ok-button-props="{
|
||||
disabled: !bugReportForm.title.trim() || !bugReportForm.description.trim(),
|
||||
}"
|
||||
@ok="submitBugReport"
|
||||
>
|
||||
<a-form layout="vertical" :model="bugReportForm">
|
||||
<a-form-item label="标题" required>
|
||||
<a-input
|
||||
v-model:value="bugReportForm.title"
|
||||
placeholder="例如:发布时客户端卡住"
|
||||
:maxlength="120"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="严重级别">
|
||||
<a-segmented
|
||||
v-model:value="bugReportForm.severity"
|
||||
:options="[
|
||||
{ label: '低', value: 'low' },
|
||||
{ label: '中', value: 'medium' },
|
||||
{ label: '高', value: 'high' },
|
||||
{ label: '致命', value: 'critical' },
|
||||
]"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="现象描述" required>
|
||||
<a-textarea
|
||||
v-model:value="bugReportForm.description"
|
||||
placeholder="请描述刚才做了什么、看到了什么异常"
|
||||
:maxlength="2000"
|
||||
:rows="5"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user