mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2026-03-16 04:03:17 +08:00
🚸 添加用户反馈显示控制入口
This commit is contained in:
39
src/App.vue
39
src/App.vue
@@ -17,6 +17,7 @@ import showDialog from "@comp/func/dialog.js";
|
||||
import showLoading from "@comp/func/loading.js";
|
||||
import showSnackbar from "@comp/func/snackbar.js";
|
||||
import OtherApi from "@req/otherReq.js";
|
||||
import type { FeedbackInternalOptions, Integration } from "@sentry/core";
|
||||
import * as Sentry from "@sentry/vue";
|
||||
import { commands } from "@skipperndt/plugin-machine-uid";
|
||||
import TGSqlite from "@Sql/index.js";
|
||||
@@ -38,7 +39,7 @@ import { computed, nextTick, onMounted, onUnmounted, ref } from "vue";
|
||||
import { useRouter } from "vue-router";
|
||||
|
||||
const router = useRouter();
|
||||
const { theme, needResize, deviceInfo, isLogin, userDir, buildTime, closeToTray } =
|
||||
const { theme, needResize, deviceInfo, isLogin, userDir, buildTime, closeToTray, showFeedback } =
|
||||
storeToRefs(useAppStore());
|
||||
const { uid, briefInfo, account, cookie } = storeToRefs(useUserStore());
|
||||
|
||||
@@ -76,6 +77,9 @@ onMounted(async () => {
|
||||
await win.center();
|
||||
await win.show();
|
||||
}
|
||||
if (showFeedback.value) {
|
||||
Sentry.addIntegration(getSentryFeedback());
|
||||
}
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
@@ -105,6 +109,39 @@ onUnmounted(() => {
|
||||
}
|
||||
});
|
||||
|
||||
function getSentryFeedback(): Integration {
|
||||
return Sentry.feedbackAsyncIntegration(<FeedbackInternalOptions>{
|
||||
// 🌗 主题与注入行为
|
||||
colorScheme: "system",
|
||||
autoInject: true,
|
||||
triggerLabel: "",
|
||||
|
||||
// 📝 表单标题与按钮文案
|
||||
formTitle: "问题反馈",
|
||||
cancelButtonLabel: "取消",
|
||||
submitButtonLabel: "提交反馈",
|
||||
successMessageText: "感谢您的反馈,我们将尽快处理。",
|
||||
|
||||
// 🧑 用户信息字段
|
||||
nameLabel: "反馈人",
|
||||
namePlaceholder: "请输入您的姓名或昵称",
|
||||
emailLabel: "电子邮箱",
|
||||
emailPlaceholder: "请输入您的邮箱地址,以便我们与您联系",
|
||||
|
||||
// 🐛 问题描述字段
|
||||
messageLabel: "问题描述",
|
||||
messagePlaceholder: "请详细描述您遇到的问题及复现步骤",
|
||||
isRequiredLabel: "(必填)",
|
||||
|
||||
// 📸 截图工具相关
|
||||
addScreenshotButtonLabel: "添加当前页面截图",
|
||||
removeScreenshotButtonLabel: "移除截图",
|
||||
highlightToolText: "标记重点区域",
|
||||
removeHighlightText: "移除标记",
|
||||
hideToolText: "遮挡敏感信息",
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义URL协议监听处理
|
||||
* @param {Event<string>} event - 事件
|
||||
|
||||
31
src/main.ts
31
src/main.ts
@@ -3,7 +3,6 @@
|
||||
* @since Beta v0.9.2
|
||||
*/
|
||||
|
||||
import type { FeedbackInternalOptions } from "@sentry/core";
|
||||
import * as Sentry from "@sentry/vue";
|
||||
import { createApp, defineCustomElement } from "vue";
|
||||
import { createVuetify } from "vuetify";
|
||||
@@ -27,36 +26,6 @@ Sentry.init({
|
||||
enableLogs: true,
|
||||
environment: process.env.NODE_ENV,
|
||||
integrations: [
|
||||
Sentry.feedbackAsyncIntegration(<FeedbackInternalOptions>{
|
||||
// 🌗 主题与注入行为
|
||||
colorScheme: "system",
|
||||
autoInject: true,
|
||||
triggerLabel: "",
|
||||
|
||||
// 📝 表单标题与按钮文案
|
||||
formTitle: "问题反馈",
|
||||
cancelButtonLabel: "取消",
|
||||
submitButtonLabel: "提交反馈",
|
||||
successMessageText: "感谢您的反馈,我们将尽快处理。",
|
||||
|
||||
// 🧑 用户信息字段
|
||||
nameLabel: "反馈人",
|
||||
namePlaceholder: "请输入您的姓名或昵称",
|
||||
emailLabel: "电子邮箱",
|
||||
emailPlaceholder: "请输入您的邮箱地址,以便我们与您联系",
|
||||
|
||||
// 🐛 问题描述字段
|
||||
messageLabel: "问题描述",
|
||||
messagePlaceholder: "请详细描述您遇到的问题及复现步骤",
|
||||
isRequiredLabel: "(必填)",
|
||||
|
||||
// 📸 截图工具相关
|
||||
addScreenshotButtonLabel: "添加当前页面截图",
|
||||
removeScreenshotButtonLabel: "移除截图",
|
||||
highlightToolText: "标记重点区域",
|
||||
removeHighlightText: "移除标记",
|
||||
hideToolText: "遮挡敏感信息",
|
||||
}),
|
||||
Sentry.consoleLoggingIntegration({ levels: ["error"] }),
|
||||
Sentry.browserTracingIntegration({ router }),
|
||||
],
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
</div>
|
||||
</template>
|
||||
</v-list-item>
|
||||
<v-list-item @click="confirmUpdateDevice()" title="刷新设备信息">
|
||||
<v-list-item title="刷新设备信息" @click="confirmUpdateDevice()">
|
||||
<template #prepend>
|
||||
<div class="config-icon">
|
||||
<v-icon>mdi-refresh</v-icon>
|
||||
@@ -133,6 +133,22 @@
|
||||
/>
|
||||
</template>
|
||||
</v-list-item>
|
||||
<v-list-item subtitle="右下反馈按钮显隐,页面刷新后生效" title="用户反馈">
|
||||
<template #prepend>
|
||||
<div class="config-icon">
|
||||
<v-icon>mdi-lightbulb-on-outline</v-icon>
|
||||
</div>
|
||||
</template>
|
||||
<template #append>
|
||||
<v-switch
|
||||
v-model="appStore.showFeedback"
|
||||
:inset="true"
|
||||
:label="appStore.showFeedback ? '开启' : '关闭'"
|
||||
class="config-switch"
|
||||
color="#FAC51E"
|
||||
/>
|
||||
</template>
|
||||
</v-list-item>
|
||||
<v-list-item v-if="platform() === 'windows'" title="分享设置">
|
||||
<template #subtitle>默认保存到剪贴板,超过{{ shareDefaultFile }}MB时保存到文件</template>
|
||||
<template #prepend>
|
||||
|
||||
@@ -65,6 +65,8 @@ const useAppStore = defineStore(
|
||||
const cancelLike = ref<boolean>(true);
|
||||
/** 关闭窗口时最小化到托盘 */
|
||||
const closeToTray = ref<boolean>(false);
|
||||
/** 展示反馈按钮 */
|
||||
const showFeedback = ref<boolean>(true);
|
||||
|
||||
/**
|
||||
* 初始化应用状态
|
||||
@@ -88,6 +90,7 @@ const useAppStore = defineStore(
|
||||
postViewWide.value = true;
|
||||
cancelLike.value = true;
|
||||
closeToTray.value = false;
|
||||
showFeedback.value = true;
|
||||
initDevice();
|
||||
}
|
||||
|
||||
@@ -145,6 +148,7 @@ const useAppStore = defineStore(
|
||||
postViewWide,
|
||||
cancelLike,
|
||||
closeToTray,
|
||||
showFeedback,
|
||||
init,
|
||||
changeTheme,
|
||||
getImageUrl,
|
||||
@@ -173,6 +177,7 @@ const useAppStore = defineStore(
|
||||
"postViewWide",
|
||||
"cancelLike",
|
||||
"closeToTray",
|
||||
"showFeedback",
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user