概览页面添加Q&A与帮助的链接

This commit is contained in:
jinchao 2025-05-08 09:25:40 +08:00
parent 9f393ce709
commit e03da9a405
4 changed files with 151 additions and 1 deletions

Binary file not shown.

View File

@ -102,6 +102,52 @@ class OverviewPage extends HTMLElement {
}
});
}
// 添加Q&A和帮助链接的事件监听
const qaLink = this.shadowRoot.querySelector('#qa-link');
const helpLink = this.shadowRoot.querySelector('#help-link');
if (qaLink) {
qaLink.addEventListener('click', (e) => {
e.preventDefault();
// 获取子工具栏
const subToolbar = document.querySelector('sub-toolbar');
if (subToolbar) {
// 触发与常见问题按钮相同的事件
const event = new CustomEvent('sub-item-selected', {
detail: {
parent: 'home',
text: 'Q&A',
icon: 'question'
},
bubbles: true,
composed: true
});
subToolbar.dispatchEvent(event);
}
});
}
if (helpLink) {
helpLink.addEventListener('click', (e) => {
e.preventDefault();
// 获取子工具栏
const subToolbar = document.querySelector('sub-toolbar');
if (subToolbar) {
// 触发与帮助文档按钮相同的事件
const event = new CustomEvent('sub-item-selected', {
detail: {
parent: 'home',
text: '帮助',
icon: 'help'
},
bubbles: true,
composed: true
});
subToolbar.dispatchEvent(event);
}
});
}
}
render() {
@ -215,6 +261,105 @@ class OverviewPage extends HTMLElement {
border-radius: 12px;
padding: 20px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
display: flex;
flex-direction: column;
}
.about-section .section-title {
margin-bottom: 15px;
}
.about-section p {
margin-bottom: 15px;
}
.about-section .version-list {
margin-bottom: auto;
}
.help-links {
margin-top: auto;
display: flex;
gap: 16px;
justify-content: center;
padding-top: 20px;
border-top: 1px solid #eee;
}
.help-link {
position: relative;
color: #667eea;
text-decoration: none;
display: flex;
align-items: center;
gap: 6px;
font-size: 15px;
padding: 4px 2px;
transition: all 0.3s ease;
}
.help-link:hover {
color: #764ba2;
}
.help-link::before {
content: '';
display: inline-block;
width: 16px;
height: 16px;
background-size: 16px;
background-repeat: no-repeat;
background-position: center;
transition: all 0.3s ease;
/* 将黑色图标转换为蓝色 (#667eea) */
filter: brightness(0) saturate(100%) invert(53%) sepia(95%) saturate(1731%) hue-rotate(213deg) brightness(99%) contrast(94%) !important;
}
#qa-link::before {
background-image: url('assets/icons/png/question_b.png');
}
#help-link::before {
background-image: url('assets/icons/png/help_b.png');
}
.help-link:hover::before {
/* 将黑色图标转换为紫色 (#764ba2) */
filter: brightness(0) saturate(100%) invert(36%) sepia(24%) saturate(1674%) hue-rotate(233deg) brightness(94%) contrast(92%) !important;
}
.help-link::after {
content: '';
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 1px;
background: currentColor;
transform: scaleX(0);
transform-origin: right;
transition: transform 0.3s ease;
}
.help-link:hover::after {
transform: scaleX(1);
transform-origin: left;
}
.help-link::before {
content: '';
display: inline-block;
width: 18px;
height: 18px;
background-size: 18px;
background-repeat: no-repeat;
background-position: center;
filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.1));
transition: all 0.3s ease;
}
.help-link:hover::before {
transform: scale(1.1);
}
.calendar-widget {
@ -419,6 +564,10 @@ class OverviewPage extends HTMLElement {
<li>技术支持</li>
<li>官方网站</li>
</ul>
<div class="help-links">
<a href="#" class="help-link" id="qa-link">常见问题</a>
<a href="#" class="help-link" id="help-link">帮助文档</a>
</div>
</div>
<div class="calendar-widget">

View File

@ -31,7 +31,6 @@ class QAComponent extends HTMLElement {
async loadQuestions() {
try {
console.log('Loading page:', this.currentPage);
const response = await fetch(`/api/qa/questions?sort=desc`);
const data = await response.json();
if (data.success) {

View File

@ -336,6 +336,7 @@
if (title === '帮助') {
const id = 'help';
tabsContainer.createTab(id, title, icon, parentText, parentTool);
contentArea.loadContent(id);
return;
}
@ -343,6 +344,7 @@
if (title === 'Q&A') {
const id = 'qa';
tabsContainer.createTab(id, title, icon, parentText, parentTool);
contentArea.loadContent(id);
return;
}