console
我懂啦!大概率是 iPad Safari 地址栏粘贴长链接不好用,咱们换一个超稳妥办法,用备忘录中转:
1. 打开 iPad【备忘录】,新建一条备忘录
2. 把下面这一整段代码,完整复制粘贴进备忘录:
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<title>全对记录本</title>
<style>
*{box-sizing:border-box;margin:0;padding:0;font-family:system-ui,sans-serif}
body{background:#f5f7fa;padding:16px;color:#222}
.card{background:#fff;border-radius:14px;padding:16px;margin-bottom:14px;box-shadow:0 2px 8px #00000012}
.title{font-size:20px;font-weight:bold;margin-bottom:16px;text-align:center;color:#2563eb}
input,select{width:100%;padding:12px;border:1px solid #ddd;border-radius:10px;margin:8px 0;font-size:16px}
.btn{width:100%;padding:13px;border:none;border-radius:10px;font-size:16px;margin-top:8px}
.btn-add{background:#2563eb;color:#fff}
.btn-filter{background:#10b981;color:#fff}
.btn-reset{background:#ef4444;color:#fff}
.item{padding:12px;border-bottom:1px solid #eee}
.item:last-child{border-bottom:none}
.tag-ok{color:#10b981;font-weight:bold}
.tag-wrong{color:#ef4444}
</style>
</head>
<body>
<div class="card">
<div class="title">📖 全对记录本</div>
<input type="date" id="date">
<select id="subject">
<option value="">选择科目</option>
<option>数学</option>
<option>语文</option>
<option>英语</option>
<option>其他</option>
</select>
<input type="text" id="name" placeholder="练习名称,如小数除法竖式">
<input type="number" id="err" placeholder="错题数量" min="0">
<select id="isAllRight">
<option value="1">✅ 全部做对</option>
<option value="0">❌ 有错题</option>
</select>
<button class="btn btn-add" onclick="saveItem()">添加记录</button>
</div>
<div class="card">
<button class="btn btn-filter" onclick="toggleFilter()">只看全对</button>
<button class="btn btn-reset" onclick="clearAll()">清空全部记录</button>
</div>
<div class="card" id="list"></div>
<script>
let showAllRightOnly = false;
function getList(){
return JSON.parse(localStorage.getItem('recordList') || '[]')
}
function saveList(arr){
localStorage.setItem('recordList',JSON.stringify(arr))
}
function saveItem(){
const d = document.getElementById('date').value
const sub = document.getElementById('subject').value
const n = document.getElementById('name').value.trim()
const err = Number(document.getElementById('err').value)
const ok = document.getElementById('isAllRight').value
if(!d||!sub||!n){alert('日期、科目、练习名不能为空');return}
const arr = getList()
arr.unshift({date:d,subject:sub,name:n,err:err,isAllRight:ok})
saveList(arr)
render()
document.getElementById('err').value=''
document.getElementById('name').value=''
}
function render(){
const arr = getList()
const wrap = document.getElementById('list')
let html=''
const data = showAllRightOnly ? arr.filter(x=>x.isAllRight==='1') : arr
if(data.length===0){wrap.innerHTML='<div style="padding:12px;color:#777">暂无记录</div>';return}
data.forEach(x=>{
html += `<div class="item">
<div>${x.date} · ${x.subject}</div>
<div>${x.name}</div>
<div>${x.isAllRight==='1'?'<span class="tag-ok">✅全对</span>':'<span class="tag-wrong">❌错题:'+x.err+'</span>'}</div>
</div>`
})
wrap.innerHTML = html
}
function toggleFilter(){
showAllRightOnly = !showAllRightOnly
render()
}
function clearAll(){
if(confirm('确定清空所有记录?无法恢复!')){
localStorage.removeItem('recordList')
render()
}
}
render()
</script>
</body>
</html>