62 lines
2.4 KiB
HTML
62 lines
2.4 KiB
HTML
new file mode 100644
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Token Generator</title>
|
|
</head>
|
|
<body>
|
|
<h1>Admin Token Generator</h1>
|
|
<button onclick="getToken()">Generate Admin Token</button>
|
|
<div id="token" style="margin-top: 20px; padding: 10px; background: #f0f0f0;"></div>
|
|
|
|
<script>
|
|
async function getToken() {
|
|
try {
|
|
const protocol = window.location.protocol;
|
|
const host = window.location.hostname;
|
|
const port = '8001';
|
|
const apiUrl = `${protocol}//${host}:${port}/api/v1/user/login`;
|
|
const response = await fetch(apiUrl, {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
body: JSON.stringify({
|
|
phone: '13800138888',
|
|
password: 'admin123'
|
|
})
|
|
});
|
|
|
|
const data = await response.json();
|
|
|
|
if (data.access_token) {
|
|
// 保存到localStorage
|
|
localStorage.setItem('access_token', data.access_token);
|
|
localStorage.setItem('refresh_token', data.refresh_token);
|
|
|
|
document.getElementById('token').innerHTML =
|
|
'<h3>Token Generated!</h3>' +
|
|
'<p><strong>Access Token:</strong> ' + data.access_token.substring(0, 50) + '...</p>' +
|
|
'<p><strong>User:</strong> ' + JSON.stringify(data.user) + '</p>' +
|
|
'<p><a href="/">Go to App</a></p>';
|
|
|
|
console.log('Tokens saved to localStorage');
|
|
alert('Token saved! You can now open the app.');
|
|
} else {
|
|
document.getElementById('token').innerHTML =
|
|
'<p style="color:red;">Error: ' + JSON.stringify(data) + '</p>';
|
|
}
|
|
} catch (error) {
|
|
document.getElementById('token').innerHTML =
|
|
'<p style="color:red;">Error: ' + error.message + '</p>';
|
|
}
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|
|
Index: frontend/node_modules/echarts/lib/util/styleCompat.js
|
|
IDEA additional info:
|
|
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
|
<+>UTF-8
|
|
===================================================================
|