-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathAboutCard.vue
More file actions
475 lines (440 loc) · 16.1 KB
/
AboutCard.vue
File metadata and controls
475 lines (440 loc) · 16.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
<template>
<v-card border hover rounded="xl">
<v-card-item>
<template #prepend>
<v-icon class="mr-2" icon="mdi-information" size="large"/>
</template>
<v-card-title class="text-h6">关于</v-card-title>
</v-card-item>
<v-card-text>
<v-row>
<v-col class="mx-auto" cols="12" md="8">
<!-- 捐赠卡片 -->
<v-card
border
class="donation-card gradient-donation clickable mb-6"
color="pink-lighten-4"
elevation="8"
hover
rounded="xl"
variant="tonal"
@click="openDonationLink"
>
<v-card-item>
<div class="card-content">
<div>
<div class="text-h6 font-weight-bold">请支持我们 Classworks</div>
</div>
</div>
</v-card-item>
<v-card-text>
<p class="text-body-2 mb-3">
我是Classworks的开发者孙悟元,是一名高二的中国在校学生。Classworks 是一个完全开源免费的项目。如果可以,欢迎打赏。
</p>
<div class="mt-4">
<v-btn
append-icon="mdi-heart"
aria-label="Support Classworks on Aifadian"
class="text-none"
color="pink"
rounded="xl"
variant="elevated"
@click="openDonationLink"
>
爱发电
</v-btn>
</div>
</v-card-text>
</v-card>
<div class="d-flex flex-column align-start">
<v-avatar class="mb-4" size="120">
<v-img
alt="Classworks"
src="../../assets/cslogo.png"
/>
</v-avatar>
<h2 class="text-h5 mb-2">Classworks</h2>
<p class="text-body-1 mb-4">适用于班级大屏的作业板小工具</p>
<div class="d-flex gap-2 flex-wrap mb-6">
<v-btn
color="red"
prepend-icon="mdi-bug"
variant="tonal"
@click="openReportDialog"
>
报告问题
</v-btn>
<v-btn
color="primary"
href="https://qm.qq.com/q/qNBX4ZZVeg"
prepend-icon="mdi-qqchat"
target="_blank"
variant="tonal"
>
QQ 群
</v-btn>
<v-btn
href="https://github.com/ClassworksDev/Classworks"
prepend-icon="mdi-github"
target="_blank"
variant="text"
>
前端
</v-btn>
<v-btn
href="https://github.com/ClassworksDev/ClassworksServer"
prepend-icon="mdi-github"
target="_blank"
variant="text"
>
后端
</v-btn>
</div>
<v-divider class="mb-4 w-100"></v-divider>
<h3 class="text-h6 mb-2">备注与致谢</h3>
<v-list class="mb-4 bg-transparent">
<v-list-item
append-icon="mdi-link"
href="https://github.com/EnderWolf006/HomeworkBoard"
target="_blank"
>
<v-list-item-title>
本项目受到 HomeworkBoard 的启发而开发
</v-list-item-title>
<v-list-item-subtitle>
感谢 EnderWolf006 (@EnderWolf) fhzit(@Hellofhz) KeyFac
等人的贡献
</v-list-item-subtitle>
</v-list-item>
<v-list-item
append-icon="mdi-link"
href="https://hlyun.org"
target="_blank"
>
<v-list-item-title>
Classworks 由<strong>厚浪云</strong>提供
</v-list-item-title>
<v-list-item-subtitle>
长江后浪推前浪 浮事新人换旧人
</v-list-item-subtitle>
</v-list-item>
<v-list-item
append-icon="mdi-link"
href="https://zerocat.houlangs.com"
target="_blank"
>
<v-list-item-title>
感谢 ZeroCat 社区的开发者们
</v-list-item-title>
<v-list-item-subtitle>
新一代,开源,编程社区
</v-list-item-subtitle>
</v-list-item>
<v-divider class="ma-1"></v-divider>
<v-list-item
append-icon="mdi-link"
href="https://github.com/HUSX100/IslandCaller"
target="_blank"
>
<v-list-item-title>
本项目与 IslandCaller 没有从属关系
</v-list-item-title>
<v-list-item-subtitle>
IslandCaller 是由 HUSX100 开发的基于 ClassIsland
提醒服务的轻量级点名器
</v-list-item-subtitle>
</v-list-item>
<v-list-item
append-icon="mdi-link"
href="https://classisland.tech"
target="_blank"
>
<v-list-item-title>
本项目与 ClassIsland 没有从属关系
</v-list-item-title>
<v-list-item-subtitle>
ClassIsland 是由 HelloWRC
开发的适用于班级大屏的课表信息显示工具
</v-list-item-subtitle>
</v-list-item>
</v-list>
<v-btn
class="mb-4"
prepend-icon="mdi-package-variant"
variant="text"
@click="showDeps = true"
>
查看使用的第三方库
</v-btn>
<v-dialog
v-model="showDeps"
fullscreen
transition="dialog-bottom-transition"
>
<v-card
>
<v-toolbar>
<v-btn icon="mdi-close" @click="showDeps = false"></v-btn>
<v-toolbar-title>使用的第三方库</v-toolbar-title>
<v-spacer></v-spacer>
</v-toolbar>
<v-card-text>
<v-list>
<v-list-item
v-for="dep in Dependencies"
:key="dep.name"
:href="'https://www.npmjs.com/package/' + dep.name"
append-icon="mdi-link"
target="_blank"
>
<v-list-item-title>
{{ dep.name }}
</v-list-item-title>
<v-list-item-subtitle>
v{{ dep.version }}
</v-list-item-subtitle>
</v-list-item>
</v-list>
</v-card-text>
</v-card>
</v-dialog>
<!-- 报告问题对话框 -->
<v-dialog v-model="showReportDialog" max-width="640">
<v-card>
<v-toolbar density="compact">
<v-btn icon="mdi-close" @click="showReportDialog = false"></v-btn>
<v-toolbar-title>报告问题</v-toolbar-title>
<v-spacer></v-spacer>
</v-toolbar>
<v-card-text>
<p class="mb-4">
调试ID与下方的浏览器环境信息将帮助我们快速定位问题,请在反馈中一并附上。
</p>
<v-sheet class="mb-3 pa-3 bg-grey-lighten-4 rounded" style="max-height: 260px; overflow: auto;">
<pre class="text-body-2" style="white-space: pre-wrap; margin: 0;">{{ envBoxText }}</pre>
</v-sheet>
<div class="d-flex gap-2 flex-wrap mb-4">
<v-btn size="small" variant="text" prepend-icon="mdi-refresh" @click="reloadVisitorId" :loading="visitorLoading">刷新</v-btn>
<v-btn size="small" variant="text" prepend-icon="mdi-content-copy" @click="copyEnvInfo">复制信息</v-btn>
<v-btn size="small" variant="text" prepend-icon="mdi-open-in-new" @click="goToDebug">查看 /debug 页面</v-btn>
</div>
<v-alert v-if="copyOk" type="success" density="compact" class="mb-4">已复制到剪贴板</v-alert>
<div class="d-flex gap-2 mb-4">
<v-btn
size="small"
color="primary"
variant="elevated"
prepend-icon="mdi-message-alert"
@click="openFeedback"
block
>
发送错误反馈到 Sentry
</v-btn>
</div>
<h4 class="text-subtitle-1 mb-2">反馈渠道</h4>
<v-list lines="one" class="bg-transparent">
<v-list-item :href="qqGroupLink" target="_blank" prepend-icon="mdi-qqchat">
<v-list-item-title>QQ群 ({{ qqGroupNumber }})</v-list-item-title>
<v-list-item-subtitle>964979747</v-list-item-subtitle>
</v-list-item>
<v-list-item :href="githubIssueUrl" target="_blank" prepend-icon="mdi-github">
<v-list-item-title>GitHub Issue</v-list-item-title>
<v-list-item-subtitle>ZeroCatDev/Classworks</v-list-item-subtitle>
</v-list-item>
<v-list-item :href="mailtoLink" target="_blank" prepend-icon="mdi-email">
<v-list-item-title>邮件</v-list-item-title>
<v-list-item-subtitle>sun@wuyuan.dev</v-list-item-subtitle>
</v-list-item>
</v-list>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn variant="text" @click="showReportDialog = false">关闭</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<p class="text-caption text-medium-emphasis">
Copyright © {{ new Date().getFullYear() }} Sunwuyuan
</p>
</div>
</v-col>
</v-row>
</v-card-text>
</v-card>
</template>
<script>
import {ref, onMounted, computed} from "vue";
import { useRouter } from 'vue-router'
import { getVisitorId } from '@/utils/visitorId'
import packageJson from "../../../package.json";
export default {
name: "AboutCard",
setup() {
const Dependencies = ref([]);
const showDeps = ref(false);
const showReportDialog = ref(false);
const debugIdInput = ref('');
const visitorLoading = ref(false);
const copyOk = ref(false);
const qqGroupNumber = '964979747';
const qqGroupLink = 'https://qm.qq.com/q/T6qImKJjGi';
const router = useRouter();
const loadDependencies = () => {
try {
// 合并 dependencies 和 devDependencies
const allDependencies = {
...(packageJson.dependencies || {}),
...(packageJson.devDependencies || {}),
};
// 转换为数组并过滤掉不需要显示的依赖
const deps = Object.entries(allDependencies).map(([name, version]) => ({
name,
version: version.replace(/[\^~]/g, ""),
description: getDependencyDescription(name),
}));
Dependencies.value = deps;
} catch (error) {
console.error("加载依赖信息失败:", error);
Dependencies.value = [];
}
};
const getDependencyDescription = (name) => {
const descriptions = {
vue: "渐进式 JavaScript 框架",
vuetify: "材料设计组件框架",
axios: "Promise 基础的 HTTP 客户端",
pinia: "Vue 状态管理库",
"vue-router": "Vue.js 官方路由管理器",
"@vitejs/plugin-vue": "Vite 的 Vue 插件",
};
return descriptions[name] || "";
};
const goToDebug = () => {
router.push('/debug');
};
const loadVisitorId = async () => {
visitorLoading.value = true;
try {
const id = await getVisitorId();
debugIdInput.value = id || '';
} catch (e) {
console.error('获取访客ID失败', e);
} finally {
visitorLoading.value = false;
}
};
const reloadVisitorId = () => loadVisitorId();
const openReportDialog = async () => {
showReportDialog.value = true;
if (!debugIdInput.value) await loadVisitorId();
};
const copyEnvInfo = async () => {
try {
await navigator.clipboard.writeText(envBoxText.value);
copyOk.value = true;
setTimeout(() => (copyOk.value = false), 1800);
} catch (e) {
console.error('复制失败', e);
}
};
const envInfo = computed(() => {
const nav = navigator || {};
const intl = (typeof Intl !== 'undefined' && Intl.DateTimeFormat) ? Intl.DateTimeFormat().resolvedOptions() : {};
const tz = intl && intl.timeZone ? intl.timeZone : '';
const routePath = router.currentRoute?.value?.fullPath || location.pathname;
const lines = [
`App 版本: v${packageJson?.version || 'unknown'}`,
`URL: ${location.href}`,
`路由: ${routePath}`,
`UserAgent: ${nav.userAgent || ''}`,
`语言: ${nav.language || ''}`,
`时区: ${tz}`,
`平台: ${nav.platform || ''}`,
`在线: ${String(nav.onLine)}`,
`屏幕: ${screen?.width || '-'}x${screen?.height || '-'}`,
`视口: ${window.innerWidth || '-'}x${window.innerHeight || '-'}`,
];
return lines.join('\n');
});
const envBoxText = computed(() => {
return `调试ID: ${debugIdInput.value || '获取失败'}\n\n浏览器/环境信息:\n${envInfo.value}`;
});
const reportBody = computed(() => {
return [
`问题描述:`,
`1. 期望行为:`,
`2. 实际行为:`,
`3. 复现步骤:`,
'',
envBoxText.value,
].join('\n');
});
const githubIssueUrl = computed(() => {
const base = 'https://github.com/ZeroCatDev/Classworks/issues/new';
const title = encodeURIComponent('问题报告');
const body = encodeURIComponent(reportBody.value);
return `${base}?title=${title}&body=${body}`;
});
const mailtoLink = computed(() => {
const subject = encodeURIComponent('Classworks 问题报告');
const body = encodeURIComponent(reportBody.value);
return `mailto:sun@wuyuan.dev?subject=${subject}&body=${body}`;
});
const openFeedback = () => {
// 打开反馈对话框
if (typeof window.openSentryFeedback === 'function') {
window.openSentryFeedback();
} else {
console.warn('Sentry Feedback 功能不可用');
}
};
const openDonationLink = () => {
window.open('https://afdian.com/a/wydev', '_blank');
};
onMounted(() => {
loadDependencies();
});
return {
Dependencies,
showDeps,
showReportDialog,
debugIdInput,
visitorLoading,
copyOk,
qqGroupNumber,
qqGroupLink,
goToDebug,
reloadVisitorId,
openReportDialog,
copyEnvInfo,
openFeedback,
openDonationLink,
envBoxText,
envInfo,
reportBody,
githubIssueUrl,
mailtoLink,
};
},
};
</script>
<style scoped>
.gradient-donation {
background: linear-gradient(135deg, rgba(236, 64, 122, 0.15), rgba(233, 30, 99, 0.08) 60%);
border: 2px solid rgba(236, 64, 122, 0.25);
transition: all 0.3s ease;
cursor: pointer;
}
.gradient-donation:hover {
transform: translateY(-4px);
box-shadow: 0 8px 24px rgba(236, 64, 122, 0.3) !important;
}
.gradient-donation:active {
transform: translateY(-2px);
}
.card-content {
display: flex;
align-items: center;
justify-content: space-between;
}
</style>