SOURCE

console 命令行工具 X clear

                    
>
console
            res.style.display = 'block';
        });

        // 打卡进度
        document.querySelectorAll('.check-opt').forEach(item => {
            item.addEventListener('change', () => {
                const checked = document.querySelectorAll('.check-opt:checked').length;
                document.getElementById('progressFill').style.width = (checked/4)*100 + '%';
            });
        });

        // 投票
        let voted = false;
        document.querySelectorAll('.vote-row').forEach(row => {
            row.addEventListener('click', () => {
                if(voted) return;
                voted = true;
                let total =0;
                document.querySelectorAll('.vote-row').forEach(r => total += parseInt(r.dataset.count));
                total +=1;
                row.dataset.count = parseInt(row.dataset.count)+1;
                document.querySelectorAll('.vote-row').forEach(r => {
                    const pct = Math.round((parseInt(r.dataset.count)/total)*100);
                    r.querySelector('.vote-bar').style.width = pct+'%';
                    r.querySelector('.vote-pct').innerText = pct+'%';
                });
            });
        });

        // 生成宣言
        const declareTexts = [
            "每一笔钱都花在真正让我开心的事上,不被隐形消费偷走生活费。",
            "喝奶茶可以,但要知道自己每个月到底花了多少,不稀里糊涂月光。",
            "关掉没用的自动续费,把钱留给更值得的地方。",
            "不跟风凑满减,不需要的东西再便宜也不买。"
        ];
        document.getElementById('genBtn').addEventListener('click', () => {
            const card = document.getElementById('declareCard');
            document.getElementById('declareText').innerText = declareTexts[Math.floor(Math.random()*declareTexts.length)];
            card.style.display = 'block';
        });

        // 留言
        document.getElementById('submitBtn').addEventListener('click', () => {
            const input = document.getElementById('commentInput');
            const text = input.value.trim();
            if(!text) return;
            const item = document.createElement('div');
            item.className = 'comment-item';
            item.innerText = '同学:' + text;
            document.getElementById('commentList').prepend(item);
            input.value = '';
        });
    </script>
</body>
</html>