834 lines
25 KiB
HTML
834 lines
25 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="zh-CN">
|
||
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<link rel="shortcut icon" href="images/favicon.png">
|
||
<title>计算机协会 - 加入我们</title>
|
||
<style>
|
||
/* 全局样式 - 默认暗黑模式 */
|
||
:root {
|
||
--primary-color: #0a192f;
|
||
--secondary-color: #64ffda;
|
||
--text-primary: #ccd6f6;
|
||
--text-secondary: #8892b0;
|
||
--white: #e6f1ff;
|
||
--bg-color: #0a192f;
|
||
--card-bg: rgba(10, 25, 47, 0.8);
|
||
--footer-bg: #020c1b;
|
||
--news-bg: rgba(100, 255, 218, 0.03);
|
||
--link-card-bg: rgba(100, 255, 218, 0.05);
|
||
--header-bg: rgba(10, 25, 47, 0.9);
|
||
}
|
||
|
||
/* 亮色模式 */
|
||
[data-theme="light"] {
|
||
--primary-color: #f8f9fa;
|
||
--secondary-color: #007bff;
|
||
--text-primary: #212529;
|
||
--text-secondary: #495057;
|
||
--white: #ffffff;
|
||
--bg-color: #f8f9fa;
|
||
--card-bg: rgba(255, 255, 255, 0.9);
|
||
--footer-bg: #e9ecef;
|
||
--news-bg: rgba(0, 123, 255, 0.03);
|
||
--link-card-bg: rgba(0, 123, 255, 0.05);
|
||
--header-bg: rgba(248, 249, 250, 0.9);
|
||
}
|
||
|
||
* {
|
||
margin: 0;
|
||
padding: 0;
|
||
box-sizing: border-box;
|
||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||
transition: background-color 0.3s ease, color 0.3s ease;
|
||
}
|
||
|
||
body {
|
||
background-color: var(--bg-color);
|
||
color: var(--text-primary);
|
||
line-height: 1.6;
|
||
}
|
||
|
||
a {
|
||
text-decoration: none;
|
||
color: var(--secondary-color);
|
||
transition: all 0.3s ease;
|
||
}
|
||
|
||
a:hover {
|
||
color: var(--white);
|
||
}
|
||
|
||
.container {
|
||
max-width: 1200px;
|
||
margin: 0 auto;
|
||
padding: 0 20px;
|
||
}
|
||
|
||
.btn {
|
||
display: inline-block;
|
||
padding: 12px 28px;
|
||
background: transparent;
|
||
color: var(--secondary-color);
|
||
border: 1px solid var(--secondary-color);
|
||
border-radius: 4px;
|
||
font-size: 16px;
|
||
font-weight: 500;
|
||
cursor: pointer;
|
||
transition: all 0.3s ease;
|
||
}
|
||
|
||
.btn:hover {
|
||
background: rgba(100, 255, 218, 0.1);
|
||
transform: translateY(-3px);
|
||
}
|
||
|
||
[data-theme="light"] .btn:hover {
|
||
background: rgba(0, 123, 255, 0.1);
|
||
}
|
||
|
||
/* 导航栏 */
|
||
header {
|
||
position: fixed;
|
||
top: 0;
|
||
left: 0;
|
||
right: 0;
|
||
background-color: var(--header-bg);
|
||
backdrop-filter: blur(10px);
|
||
z-index: 1000;
|
||
padding: 20px 0;
|
||
}
|
||
|
||
nav {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
}
|
||
|
||
.logo {
|
||
font-size: 24px;
|
||
font-weight: 700;
|
||
color: var(--secondary-color);
|
||
}
|
||
|
||
.nav-links {
|
||
display: flex;
|
||
list-style: none;
|
||
align-items: center;
|
||
}
|
||
|
||
.nav-links li {
|
||
margin-left: 30px;
|
||
}
|
||
|
||
.nav-links a {
|
||
color: var(--text-primary);
|
||
font-size: 16px;
|
||
font-weight: 500;
|
||
}
|
||
|
||
.nav-links a:hover {
|
||
color: var(--secondary-color);
|
||
}
|
||
|
||
.logo img {
|
||
width: auto;
|
||
height: 50px;
|
||
}
|
||
|
||
/* 汉堡菜单按钮 */
|
||
.hamburger {
|
||
display: none;
|
||
cursor: pointer;
|
||
width: 30px;
|
||
height: 21px;
|
||
position: relative;
|
||
z-index: 1001;
|
||
background: none;
|
||
border: none;
|
||
padding: 0;
|
||
}
|
||
|
||
.hamburger span {
|
||
display: block;
|
||
position: absolute;
|
||
height: 3px;
|
||
width: 100%;
|
||
background: var(--text-primary);
|
||
border-radius: 3px;
|
||
opacity: 1;
|
||
left: 0;
|
||
transform: rotate(0deg);
|
||
transition: .25s ease-in-out;
|
||
}
|
||
|
||
.hamburger span:nth-child(1) {
|
||
top: 0;
|
||
}
|
||
|
||
.hamburger span:nth-child(2),
|
||
.hamburger span:nth-child(3) {
|
||
top: 9px;
|
||
}
|
||
|
||
.hamburger span:nth-child(4) {
|
||
top: 18px;
|
||
}
|
||
|
||
.hamburger.open span:nth-child(1) {
|
||
top: 9px;
|
||
width: 0%;
|
||
left: 50%;
|
||
}
|
||
|
||
.hamburger.open span:nth-child(2) {
|
||
transform: rotate(45deg);
|
||
}
|
||
|
||
.hamburger.open span:nth-child(3) {
|
||
transform: rotate(-45deg);
|
||
}
|
||
|
||
.hamburger.open span:nth-child(4) {
|
||
top: 9px;
|
||
width: 0%;
|
||
left: 50%;
|
||
}
|
||
|
||
/* 主题切换开关 */
|
||
.theme-switch {
|
||
position: relative;
|
||
display: inline-block;
|
||
width: 60px;
|
||
height: 30px;
|
||
margin-left: 20px;
|
||
}
|
||
|
||
.theme-switch input {
|
||
opacity: 0;
|
||
width: 0;
|
||
height: 0;
|
||
}
|
||
|
||
.slider {
|
||
position: absolute;
|
||
cursor: pointer;
|
||
top: 0;
|
||
left: 0;
|
||
right: 0;
|
||
bottom: 0;
|
||
background-color: #ccc;
|
||
transition: .4s;
|
||
border-radius: 34px;
|
||
}
|
||
|
||
.slider:before {
|
||
position: absolute;
|
||
content: "";
|
||
height: 22px;
|
||
width: 22px;
|
||
left: 4px;
|
||
bottom: 4px;
|
||
background-color: white;
|
||
transition: .4s;
|
||
border-radius: 50%;
|
||
}
|
||
|
||
input:checked+.slider {
|
||
background-color: var(--secondary-color);
|
||
}
|
||
|
||
input:checked+.slider:before {
|
||
transform: translateX(30px);
|
||
}
|
||
|
||
.slider .icon {
|
||
position: absolute;
|
||
top: 50%;
|
||
transform: translateY(-50%);
|
||
font-size: 14px;
|
||
color: white;
|
||
}
|
||
|
||
.slider .moon {
|
||
left: 8px;
|
||
}
|
||
|
||
.slider .sun {
|
||
right: 8px;
|
||
}
|
||
|
||
/* 移动端导航菜单 */
|
||
.mobile-nav {
|
||
position: fixed;
|
||
top: 0;
|
||
right: -100%;
|
||
width: 80%;
|
||
max-width: 300px;
|
||
height: 100vh;
|
||
background: var(--header-bg);
|
||
backdrop-filter: blur(10px);
|
||
z-index: 1000;
|
||
padding: 80px 30px 30px;
|
||
transition: right 0.3s ease;
|
||
overflow-y: auto;
|
||
}
|
||
|
||
.mobile-nav.open {
|
||
right: 0;
|
||
}
|
||
|
||
.mobile-nav-links {
|
||
list-style: none;
|
||
}
|
||
|
||
.mobile-nav-links li {
|
||
margin-bottom: 20px;
|
||
}
|
||
|
||
.mobile-nav-links a {
|
||
color: var(--text-primary);
|
||
font-size: 18px;
|
||
display: block;
|
||
padding: 10px 0;
|
||
}
|
||
|
||
.mobile-nav-links a:hover {
|
||
color: var(--secondary-color);
|
||
}
|
||
|
||
.mobile-theme-toggle {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
margin-top: 30px;
|
||
padding-top: 20px;
|
||
border-top: 1px solid var(--text-secondary);
|
||
}
|
||
|
||
.mobile-theme-toggle span {
|
||
color: var(--text-primary);
|
||
font-size: 16px;
|
||
}
|
||
|
||
/* 英雄区域 */
|
||
.hero {
|
||
height: 100vh;
|
||
display: flex;
|
||
align-items: center;
|
||
padding-top: 80px;
|
||
background: linear-gradient(rgba(255, 255, 255, 0.9 rgba(255, 255, 255, 0.9).9)), url('images/join-bg.jpg') no-repeat center center;
|
||
background-size: cover;
|
||
}
|
||
|
||
.hero-content {
|
||
max-width: 800px;
|
||
text-align: center;
|
||
margin: 0 auto;
|
||
}
|
||
|
||
.hero-subtitle {
|
||
color: var(--secondary-color);
|
||
font-size: 18px;
|
||
margin-bottom: 20px;
|
||
}
|
||
|
||
.hero-title {
|
||
font-size: 60px;
|
||
font-weight: 700;
|
||
margin-bottom: 20px;
|
||
line-height: 1.1;
|
||
}
|
||
|
||
.hero-description {
|
||
color: var(--text-secondary);
|
||
font-size: 18px;
|
||
margin-bottom: 30px;
|
||
}
|
||
|
||
/* 加入我们表单部分 */
|
||
.join-section {
|
||
padding: 80px 0;
|
||
background-color: var(--bg-color);
|
||
}
|
||
|
||
.section-title {
|
||
text-align: center;
|
||
font-size: 36px;
|
||
margin-bottom: 60px;
|
||
position: relative;
|
||
}
|
||
|
||
.section-title::after {
|
||
content: '';
|
||
display: block;
|
||
width: 80px;
|
||
height: 3px;
|
||
background: var(--secondary-color);
|
||
margin: 15px auto 0;
|
||
}
|
||
|
||
.form-container {
|
||
background: var(--card-bg);
|
||
border-radius: 8px;
|
||
padding: 40px;
|
||
max-width: 800px;
|
||
margin: 0 auto;
|
||
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
|
||
}
|
||
|
||
/* 部门介绍 */
|
||
.departments {
|
||
padding: 80px 0;
|
||
background: var(--news-bg);
|
||
}
|
||
|
||
.departments-grid {
|
||
display: grid;
|
||
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
||
gap: 30px;
|
||
}
|
||
|
||
.department-card {
|
||
background: var(--card-bg);
|
||
border-radius: 8px;
|
||
padding: 30px;
|
||
transition: transform 0.3s ease;
|
||
}
|
||
|
||
.department-card:hover {
|
||
transform: translateY(-5px);
|
||
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
|
||
}
|
||
|
||
.department-icon {
|
||
font-size: 40px;
|
||
color: var(--secondary-color);
|
||
margin-bottom: 20px;
|
||
}
|
||
|
||
.department-title {
|
||
font-size: 24px;
|
||
margin-bottom: 15px;
|
||
color: var(--secondary-color);
|
||
}
|
||
|
||
.department-desc {
|
||
color: var(--text-secondary);
|
||
margin-bottom: 20px;
|
||
}
|
||
|
||
/* 页脚 */
|
||
footer {
|
||
background: var(--footer-bg);
|
||
padding: 50px 0 20px;
|
||
text-align: center;
|
||
}
|
||
|
||
.footer-links {
|
||
display: flex;
|
||
justify-content: center;
|
||
list-style: none;
|
||
margin-bottom: 30px;
|
||
}
|
||
|
||
.footer-links li {
|
||
margin: 0 15px;
|
||
}
|
||
|
||
.copyright {
|
||
color: var(--text-secondary);
|
||
font-size: 14px;
|
||
}
|
||
|
||
/* 响应式设计 */
|
||
@media (max-width: 992px) {
|
||
.hero-title {
|
||
font-size: 48px;
|
||
}
|
||
|
||
.nav-links {
|
||
display: none;
|
||
}
|
||
|
||
.hamburger {
|
||
display: block;
|
||
}
|
||
}
|
||
|
||
@media (max-width: 768px) {
|
||
.hero-title {
|
||
font-size: 36px;
|
||
}
|
||
|
||
.hero-description {
|
||
font-size: 16px;
|
||
}
|
||
|
||
.section-title {
|
||
font-size: 28px;
|
||
}
|
||
|
||
.form-container {
|
||
padding: 30px 20px;
|
||
}
|
||
|
||
.footer-links {
|
||
flex-wrap: wrap;
|
||
}
|
||
|
||
.footer-links li {
|
||
margin: 10px 15px;
|
||
}
|
||
}
|
||
|
||
@media (max-width: 480px) {
|
||
.hero-title {
|
||
font-size: 32px;
|
||
}
|
||
|
||
.hero-subtitle {
|
||
font-size: 16px;
|
||
}
|
||
|
||
.btn {
|
||
padding: 10px 20px;
|
||
font-size: 14px;
|
||
}
|
||
|
||
.theme-switch {
|
||
width: 50px;
|
||
height: 25px;
|
||
margin-left: 15px;
|
||
}
|
||
|
||
.slider:before {
|
||
height: 18px;
|
||
width: 18px;
|
||
bottom: 3.5px;
|
||
left: 3.5px;
|
||
}
|
||
|
||
input:checked+.slider:before {
|
||
transform: translateX(25px);
|
||
}
|
||
|
||
.slider .icon {
|
||
font-size: 12px;
|
||
}
|
||
}
|
||
|
||
.close-btn {
|
||
position: absolute;
|
||
top: 20px;
|
||
right: 20px;
|
||
background: none;
|
||
border: none;
|
||
color: var(--text-primary);
|
||
font-size: 24px;
|
||
cursor: pointer;
|
||
z-index: 1001;
|
||
}
|
||
|
||
.close-btn:hover {
|
||
color: var(--secondary-color);
|
||
}
|
||
</style>
|
||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
|
||
</head>
|
||
|
||
<body>
|
||
<!-- 导航栏 -->
|
||
<header>
|
||
<div class="container">
|
||
<nav>
|
||
<div class="logo">
|
||
<img id="logoImage" src="images/skx-w.png" alt="石科信计算机协会">
|
||
</div>
|
||
<button class="hamburger" id="hamburger">
|
||
<span></span>
|
||
<span></span>
|
||
<span></span>
|
||
<span></span>
|
||
</button>
|
||
<ul class="nav-links">
|
||
<li><a href="/">首页</a></li>
|
||
<li><a href="/about">协会介绍</a></li>
|
||
<li><a href="/platform">协会平台</a></li>
|
||
<li><a href="https://news.skxjx.holytreasure.space/">信息中心</a></li>
|
||
<li><a href="/join" class="active">加入我们</a></li>
|
||
<li>
|
||
<label class="theme-switch">
|
||
<input type="checkbox" id="themeToggle">
|
||
<span class="slider round">
|
||
<i class="fas fa-moon icon moon"></i>
|
||
<i class="fas fa-sun icon sun"></i>
|
||
</span>
|
||
</label>
|
||
</li>
|
||
</ul>
|
||
</nav>
|
||
</div>
|
||
</header>
|
||
|
||
<!-- 移动端导航菜单 -->
|
||
<div class="mobile-nav" id="mobileNav">
|
||
<button class="close-btn" id="closeBtn">
|
||
<i class="fas fa-times"></i>
|
||
</button>
|
||
<ul class="mobile-nav-links">
|
||
<li><a href="/">首页</a></li>
|
||
<li><a href="/about.html">协会介绍</a></li>
|
||
<li><a href="/platform">协会平台</a></li>
|
||
<li><a href="https://news.skxjx.holytreasure.space/">信息中心</a></li>
|
||
<li><a href="/join.html" class="active">加入我们</a></li>
|
||
</ul>
|
||
<div class="mobile-theme-toggle">
|
||
<span>暗黑模式</span>
|
||
<label class="theme-switch">
|
||
<input type="checkbox" id="mobileThemeToggle">
|
||
<span class="slider round">
|
||
<i class="fas fa-moon icon moon"></i>
|
||
<i class="fas fa-sun icon sun"></i>
|
||
</span>
|
||
</label>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- 英雄区域 -->
|
||
<section class="hero">
|
||
<div class="container">
|
||
<div class="hero-content">
|
||
<p class="hero-subtitle">加入我们的团队</p>
|
||
<h1 class="hero-title">成为计算机协会的一员</h1>
|
||
<p class="hero-description">
|
||
无论你是技术大牛还是初学者,只要对计算机技术充满热情,我们都欢迎你的加入。
|
||
在这里,你将有机会参与实际项目,提升技能,结识志同道合的伙伴。
|
||
</p>
|
||
<a href="#join-form" class="btn">立即申请</a>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
|
||
<!-- 部门介绍 -->
|
||
<section class="departments">
|
||
<div class="container">
|
||
<h2 class="section-title">我们的部门</h2>
|
||
<div class="departments-grid">
|
||
<div class="department-card">
|
||
<div class="department-icon"><i class="fas fa-code"></i></div>
|
||
<h3 class="department-title">软件部</h3>
|
||
<p class="department-desc">
|
||
负责协会各类软件项目的开发与维护,包括网站、小程序、APP等。
|
||
使用前沿技术栈。
|
||
</p>
|
||
<p><strong>技术方向:</strong>Web开发、移动开发、桌面应用</p>
|
||
</div>
|
||
<div class="department-card">
|
||
<div class="department-icon"><i class="fas fa-robot"></i></div>
|
||
<h3 class="department-title">硬件部</h3>
|
||
<p class="department-desc">
|
||
探索机器学习、硬件开发以及智能物联网设备的开发,
|
||
研究人机交互系统解决方案。
|
||
</p>
|
||
<p><strong>技术方向:</strong>机器学习、硬件开发、物联网</p>
|
||
</div>
|
||
<div class="department-card">
|
||
<div class="department-icon"><i class="fas fa-users"></i></div>
|
||
<h3 class="department-title">秘书处</h3>
|
||
<p class="department-desc">
|
||
负责协会日常运营管理,组织活动策划与执行,
|
||
协调各部门工作,维护协会形象。
|
||
</p>
|
||
<p><strong>工作内容:</strong>活动策划、宣传推广、外联沟通</p>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
|
||
<!-- 加入表单 -->
|
||
<section class="join-section" id="join-form">
|
||
<div class="container">
|
||
<h2 class="section-title">申请加入</h2>
|
||
<div class="form-container">
|
||
<!-- 问卷星表单嵌入 -->
|
||
<script type='text/javascript' src='https://www.wjx.top/handler/jqemed.ashx?activity=wdPvJTm&width=760&source=iframe'></script>
|
||
|
||
<div class="join-info">
|
||
<p style="text-align: center; margin-top: 30px; color: var(--text-secondary);">
|
||
提交申请后,我们将在3个工作日内通过邮件或电话与你联系。<br>
|
||
如有任何问题,请联系:<a href="mailto:holytreasure@163.com">holytreasure@163.com</a>
|
||
</p>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
|
||
<!-- 页脚 -->
|
||
<footer>
|
||
<div class="container">
|
||
<ul class="footer-links">
|
||
<li><a href="/about">关于我们</a></li>
|
||
<li><a href="/join.html">加入我们</a></li>
|
||
<li><a href="https://git.holytreasure.space/">Git仓库</a></li>
|
||
<li><a href="#">隐私政策</a></li>
|
||
</ul>
|
||
<p class="copyright">© 2023 计算机协会. 保留所有权利.</p>
|
||
</div>
|
||
</footer>
|
||
|
||
<script>
|
||
// 获取主题切换开关元素
|
||
const themeToggle = document.getElementById('themeToggle');
|
||
const mobileThemeToggle = document.getElementById('mobileThemeToggle');
|
||
|
||
// 获取 logo 图片元素
|
||
const logoImage = document.getElementById('logoImage');
|
||
|
||
// 根据主题模式更新 logo 图片
|
||
function updateLogoImage() {
|
||
const currentTheme = document.documentElement.getAttribute('data-theme');
|
||
if (currentTheme === 'light') {
|
||
logoImage.src = './images/skx-b.png'; // 亮色模式图片
|
||
} else {
|
||
logoImage.src = './images/skx-w.png'; // 暗色模式图片
|
||
}
|
||
}
|
||
|
||
// 初始化时设置 logo 图片
|
||
updateLogoImage();
|
||
|
||
// 平滑滚动
|
||
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
|
||
anchor.addEventListener('click', function (e) {
|
||
e.preventDefault();
|
||
|
||
document.querySelector(this.getAttribute('href')).scrollIntoView({
|
||
behavior: 'smooth'
|
||
});
|
||
});
|
||
});
|
||
|
||
// 导航栏滚动效果
|
||
window.addEventListener('scroll', function () {
|
||
const header = document.querySelector('header');
|
||
if (window.scrollY > 50) {
|
||
header.style.boxShadow = '0 5px 20px rgba(0, 0, 0, 0.1)';
|
||
} else {
|
||
header.style.boxShadow = 'none';
|
||
}
|
||
});
|
||
|
||
// 汉堡菜单功能
|
||
const hamburger = document.getElementById('hamburger');
|
||
const mobileNav = document.getElementById('mobileNav');
|
||
|
||
hamburger.addEventListener('click', function () {
|
||
this.classList.toggle('open');
|
||
mobileNav.classList.toggle('open');
|
||
|
||
// 切换body的overflow以防止页面滚动
|
||
if (mobileNav.classList.contains('open')) {
|
||
document.body.style.overflow = 'hidden';
|
||
} else {
|
||
document.body.style.overflow = '';
|
||
}
|
||
});
|
||
|
||
// 关闭移动菜单当点击菜单项
|
||
document.querySelectorAll('.mobile-nav-links a').forEach(link => {
|
||
link.addEventListener('click', function () {
|
||
hamburger.classList.remove('open');
|
||
mobileNav.classList.remove('open');
|
||
document.body.style.overflow = '';
|
||
});
|
||
});
|
||
|
||
const closeBtn = document.getElementById('closeBtn');
|
||
|
||
closeBtn.addEventListener('click', function () {
|
||
hamburger.classList.remove('open');
|
||
mobileNav.classList.remove('open');
|
||
document.body.style.overflow = '';
|
||
});
|
||
|
||
// 检查本地存储中的主题偏好
|
||
const currentTheme = localStorage.getItem('theme') || 'dark';
|
||
document.documentElement.setAttribute('data-theme', currentTheme);
|
||
updateThemeToggle(currentTheme);
|
||
updateLogoImage(); // 初始化时也更新logo图片
|
||
|
||
// 切换主题
|
||
function toggleTheme() {
|
||
const currentTheme = document.documentElement.getAttribute('data-theme');
|
||
const newTheme = currentTheme === 'dark' ? 'light' : 'dark';
|
||
|
||
document.documentElement.setAttribute('data-theme', newTheme);
|
||
localStorage.setItem('theme', newTheme);
|
||
updateThemeToggle(newTheme);
|
||
updateLogoImage(); // 主题切换时更新logo图片
|
||
}
|
||
|
||
// 更新主题切换状态
|
||
function updateThemeToggle(theme) {
|
||
const isLight = theme === 'light';
|
||
themeToggle.checked = isLight;
|
||
mobileThemeToggle.checked = isLight;
|
||
}
|
||
|
||
// 添加事件监听器
|
||
themeToggle.addEventListener('change', toggleTheme);
|
||
mobileThemeToggle.addEventListener('change', toggleTheme);
|
||
|
||
// 表单加载后调整样式
|
||
function adjustFormStyles() {
|
||
// 等待表单加载完成
|
||
setTimeout(() => {
|
||
const formIframe = document.querySelector('iframe');
|
||
if (formIframe) {
|
||
// 设置iframe宽度为100%
|
||
formIframe.style.width = '100%';
|
||
|
||
// 监听iframe内容加载
|
||
formIframe.onload = function() {
|
||
try {
|
||
// 尝试访问iframe内部文档
|
||
const iframeDoc = formIframe.contentDocument || formIframe.contentWindow.document;
|
||
|
||
// 修改iframe内部样式以适应暗黑模式
|
||
if (document.documentElement.getAttribute('data-theme') === 'dark') {
|
||
iframeDoc.body.style.backgroundColor = 'transparent';
|
||
iframeDoc.body.style.color = '#ccd6f6';
|
||
|
||
// 修改表单元素样式
|
||
const inputs = iframeDoc.querySelectorAll('input, textarea, select');
|
||
inputs.forEach(input => {
|
||
input.style.backgroundColor = 'rgba(10, 25, 47, 0.8)';
|
||
input.style.color = '#ccd6f6';
|
||
input.style.borderColor = '#64ffda';
|
||
});
|
||
|
||
// 修改按钮样式
|
||
const buttons = iframeDoc.querySelectorAll('button');
|
||
buttons.forEach(button => {
|
||
button.style.backgroundColor = 'transparent';
|
||
button.style.color = '#64ffda';
|
||
button.style.borderColor = '#64ffda';
|
||
});
|
||
}
|
||
} catch (e) {
|
||
console.log('无法访问iframe内容:', e);
|
||
}
|
||
};
|
||
}
|
||
}, 1000);
|
||
}
|
||
|
||
// 页面加载完成后调整表单样式
|
||
document.addEventListener('DOMContentLoaded', adjustFormStyles);
|
||
</script>
|
||
</body>
|
||
|
||
</html> |