Files
gitea-jira-task-bot/public/error.html

74 lines
3.3 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>
<script src="https://cdn.tailwindcss.com"></script>
<style>
body {
font-family: 'Inter', system-ui, sans-serif;
}
</style>
</head>
<body class="bg-gray-50 flex items-center justify-center h-screen">
<div class="text-center p-8 bg-white rounded-lg shadow-lg max-w-md w-full border border-gray-100">
<div class="mb-6 inline-flex items-center justify-center w-16 h-16 rounded-full bg-red-100 text-red-500">
<svg class="w-8 h-8" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z">
</path>
</svg>
</div>
<h1 class="text-2xl font-bold text-gray-900 mb-2">访问被拒绝</h1>
<p class="text-gray-500 mb-6">您没有权限访问此页面 (系统设置)。请联系管理员获取权限。</p>
<button id="requestBtn" onclick="requestPermission()"
class="px-5 py-2 bg-indigo-600 text-white rounded-md hover:bg-indigo-700 transition-colors font-medium flex items-center justify-center mx-auto">
<span>点击发送权限请求</span>
</button>
<p id="msg" class="text-sm mt-4 h-5"></p>
</div>
<script>
async function requestPermission() {
const btn = document.getElementById('requestBtn');
const msg = document.getElementById('msg');
btn.disabled = true;
btn.classList.add('opacity-50', 'cursor-not-allowed');
btn.innerHTML = '<svg class="animate-spin -ml-1 mr-2 h-4 w-4 text-white" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path></svg>发送中...';
msg.textContent = '';
msg.className = 'text-sm mt-4 h-5 text-gray-500';
try {
const res = await fetch('/api/request-permission', { method: 'POST' });
const data = await res.json();
if (data.success) {
msg.textContent = data.message;
msg.className = 'text-sm mt-4 h-5 text-emerald-600 font-medium';
btn.innerHTML = '已发送请求';
} else {
msg.textContent = data.error;
msg.className = 'text-sm mt-4 h-5 text-rose-500';
resetBtn(btn);
}
} catch (e) {
msg.textContent = e.message;
msg.className = 'text-sm mt-4 h-5 text-rose-500';
resetBtn(btn);
}
}
function resetBtn(btn) {
btn.disabled = false;
btn.classList.remove('opacity-50', 'cursor-not-allowed');
setTimeout(() => {
btn.innerHTML = '点击发送权限请求';
}, 2000);
}
</script>
</html>