You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.3 KiB
59 lines
1.3 KiB
10 months ago
|
<!doctype html>
|
||
|
<html lang="en">
|
||
|
<head>
|
||
|
<meta charset="UTF-8"/>
|
||
|
<link href="/src/frontend/assets/logo.png" rel="icon" type="image/png"/>
|
||
|
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
|
||
|
<title>Vite + Vue + TS</title>
|
||
|
</head>
|
||
|
<body>
|
||
|
<div id="app">
|
||
|
<button id="btn">Show File Manager</button>
|
||
|
</div>
|
||
|
<script type="module">
|
||
|
const apiUrl = 'https://wfs.yaojiankang.top'
|
||
|
const artifact = 'genesis'
|
||
|
|
||
|
import {showFileManager} from 'https://wfs.yaojiankang.top/wfs.js?t=12334'
|
||
|
|
||
|
const show = (async () => {
|
||
|
const response = await fetch(apiUrl + "/login", {
|
||
|
method: "POST",
|
||
|
body: new URLSearchParams({
|
||
|
name: 'root',
|
||
|
password: 'root',
|
||
|
artifact
|
||
|
}),
|
||
|
})
|
||
|
const res = await response.json();
|
||
|
if (!res.ok) {
|
||
|
throw new Error(res.msg);
|
||
|
}
|
||
|
|
||
|
const accessToken = res.data.token
|
||
|
|
||
|
showFileManager({
|
||
|
artifact,
|
||
|
accessToken,
|
||
|
apiUrl,
|
||
|
select: 'single',
|
||
|
onOpen() {
|
||
|
console.log("open")
|
||
|
},
|
||
|
onError(error) {
|
||
|
console.log('error', error)
|
||
|
},
|
||
|
onDismiss() {
|
||
|
console.log('dismiss')
|
||
|
},
|
||
|
onConfirm(files) {
|
||
|
console.log('files', files)
|
||
|
}
|
||
|
})
|
||
|
})
|
||
|
|
||
|
document.querySelector('#btn').addEventListener('click', show)
|
||
|
</script>
|
||
|
</body>
|
||
|
</html>
|