172 lines
		
	
	
		
			5.4 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			172 lines
		
	
	
		
			5.4 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
<!DOCTYPE html>
 | 
						||
<html lang="zh-CN">
 | 
						||
<head>
 | 
						||
    <meta charset="UTF-8">
 | 
						||
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
 | 
						||
    <title>智眼-软件功能测试</title>
 | 
						||
    <style>
 | 
						||
        * {
 | 
						||
            margin: 0;
 | 
						||
            padding: 0;
 | 
						||
            box-sizing: border-box;
 | 
						||
        }
 | 
						||
        body {
 | 
						||
            display: flex;
 | 
						||
            flex-direction: column;
 | 
						||
            justify-content: center;
 | 
						||
            align-items: center;
 | 
						||
            height: 100vh;
 | 
						||
            background-color: #f5f5f5;
 | 
						||
            font-family: Arial, sans-serif;
 | 
						||
        }
 | 
						||
        .container {
 | 
						||
            background-color: white;
 | 
						||
            padding: 20px;
 | 
						||
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
 | 
						||
            border-radius: 10px;
 | 
						||
            width: 400px;
 | 
						||
            margin-bottom: 20px;
 | 
						||
        }
 | 
						||
        h2 {
 | 
						||
            text-align: center;
 | 
						||
            margin-bottom: 20px;
 | 
						||
        }
 | 
						||
        .function-item {
 | 
						||
            display: flex;
 | 
						||
            justify-content: space-between;
 | 
						||
            align-items: center;
 | 
						||
            margin: 10px 0;
 | 
						||
            padding: 10px;
 | 
						||
            background-color: #f0f0f0;
 | 
						||
            border-radius: 5px;
 | 
						||
        }
 | 
						||
        .function-item span {
 | 
						||
            font-size: 18px;
 | 
						||
            color: #333;
 | 
						||
        }
 | 
						||
        .toggle-btn {
 | 
						||
            width: 60px;
 | 
						||
            height: 30px;
 | 
						||
            background-color: #ccc;
 | 
						||
            border-radius: 15px;
 | 
						||
            position: relative;
 | 
						||
            cursor: pointer;
 | 
						||
            transition: background-color 0.3s;
 | 
						||
        }
 | 
						||
        .toggle-btn::before {
 | 
						||
            content: "";
 | 
						||
            position: absolute;
 | 
						||
            width: 28px;
 | 
						||
            height: 28px;
 | 
						||
            background-color: white;
 | 
						||
            border-radius: 50%;
 | 
						||
            top: 1px;
 | 
						||
            left: 1px;
 | 
						||
            transition: transform 0.3s;
 | 
						||
        }
 | 
						||
        .toggle-btn.active {
 | 
						||
            background-color: #4caf50;
 | 
						||
        }
 | 
						||
        .toggle-btn.active::before {
 | 
						||
            transform: translateX(30px);
 | 
						||
        }
 | 
						||
 | 
						||
        /* 导航栏样式 */
 | 
						||
        .navbar {
 | 
						||
            position: fixed;
 | 
						||
            bottom: 0;
 | 
						||
            left: 0;
 | 
						||
            width: 100%;
 | 
						||
            display: flex;
 | 
						||
            justify-content: space-around;
 | 
						||
            background-color: #333;
 | 
						||
            padding: 10px 0;
 | 
						||
        }
 | 
						||
        .navbar a {
 | 
						||
            color: white;
 | 
						||
            text-decoration: none;
 | 
						||
            font-size: 16px;
 | 
						||
        }
 | 
						||
        .navbar a:hover {
 | 
						||
            text-decoration: underline;
 | 
						||
        }
 | 
						||
    </style>
 | 
						||
</head>
 | 
						||
<body>
 | 
						||
    <div class="container">
 | 
						||
        <h2>功能测试页面</h2>
 | 
						||
 | 
						||
        <div class="function-item">
 | 
						||
            <span>摄像头</span>
 | 
						||
            <div class="toggle-btn" id="camera-btn"></div>
 | 
						||
        </div>
 | 
						||
 | 
						||
        <div class="function-item">
 | 
						||
            <span>人脸距离过近</span>
 | 
						||
            <div class="toggle-btn" id="face-btn"></div>
 | 
						||
        </div>
 | 
						||
 | 
						||
        <div class="function-item">
 | 
						||
            <span>屏幕锁定密码解锁</span>
 | 
						||
            <div class="toggle-btn" id="unlock-btn"></div>
 | 
						||
        </div>
 | 
						||
 | 
						||
        <div class="function-item">
 | 
						||
            <span>测量大小校准</span>
 | 
						||
            <div class="toggle-btn" id="calibrateBtn"></div>
 | 
						||
        </div>
 | 
						||
    </div>
 | 
						||
 | 
						||
    <!-- JavaScript -->
 | 
						||
    <script>
 | 
						||
        // 获取所有开关按钮
 | 
						||
        const cameraBtn = document.getElementById('camera-btn');
 | 
						||
        const faceBtn = document.getElementById('face-btn');
 | 
						||
        const unlockBtn = document.getElementById('unlock-btn');
 | 
						||
        const calibrateBtn = document.getElementById('calibrateBtn');
 | 
						||
 | 
						||
        // 存储当前打开的测试按钮
 | 
						||
        let activeButton = null;
 | 
						||
 | 
						||
        // 切换开关按钮状态并控制逻辑
 | 
						||
        function toggleButton(btn, testName) {
 | 
						||
            if (btn === activeButton) {
 | 
						||
                // 如果点击的是已经激活的按钮,则关闭它
 | 
						||
                btn.classList.remove('active');
 | 
						||
                activeButton = null;
 | 
						||
                alert(`${testName} 停止`);
 | 
						||
            } else {
 | 
						||
                // 关闭当前已激活的按钮(如果有)
 | 
						||
                if (activeButton) {
 | 
						||
                    activeButton.classList.remove('active');
 | 
						||
                    alert(`上一个测试已停止`);
 | 
						||
                }
 | 
						||
                // 激活新按钮
 | 
						||
                btn.classList.add('active');
 | 
						||
                activeButton = btn;
 | 
						||
                alert(`${testName} 启动`);
 | 
						||
            }
 | 
						||
        }
 | 
						||
 | 
						||
        // 绑定点击事件
 | 
						||
        cameraBtn.addEventListener('click', () => toggleButton(cameraBtn, '摄像头'));
 | 
						||
        faceBtn.addEventListener('click', () => toggleButton(faceBtn, '人脸距离过近'));
 | 
						||
        unlockBtn.addEventListener('click', () => toggleButton(unlockBtn, '屏幕锁定密码解锁'));
 | 
						||
        unlockBtn.addEventListener('click', () => {
 | 
						||
            toggleButton(calibrateBtn, '测量大小校准');
 | 
						||
            alert('请保持脸在距离摄像头30cm处,进行校准');
 | 
						||
        });
 | 
						||
 | 
						||
        
 | 
						||
    </script>
 | 
						||
 | 
						||
    <!-- 导航栏 -->
 | 
						||
    <div class="navbar">
 | 
						||
        <a href="index.html"><button id="home">启动首页</button></a>
 | 
						||
        <a href="psw.html"><button id="unlock">解锁密码设置</button></a>
 | 
						||
        <a href="gncs.html"><button id="test">功能测试</button></a>
 | 
						||
        <a href="setting.html"><button id="settings">软件设置</button></a>
 | 
						||
    </div>
 | 
						||
</body>
 | 
						||
</html>
 |