完成资源页面
This commit is contained in:
@@ -1,16 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>绿坝娘资源小站 (仮) | {{ title }}</title>
|
||||
<link rel="icon" type="image/png" sizes="128x128" href="/static/src/img/logo.png">
|
||||
</head>
|
||||
<body>
|
||||
<a href="/">返回主页</a>
|
||||
<br>
|
||||
<h1>Index of /</h1>
|
||||
<hr>
|
||||
<pre>
|
||||
|
||||
</pre>
|
||||
<hr>
|
||||
</body>
|
||||
</html>
|
||||
30
var/templates/resources/home.html
Normal file
30
var/templates/resources/home.html
Normal file
@@ -0,0 +1,30 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>绿坝娘资源小站 (仮) | {{ title }}</title>
|
||||
<link rel="icon" type="image/png" sizes="128x128" href="/static/src/img/logo.png">
|
||||
</head>
|
||||
<body>
|
||||
<a href="/">返回主页</a>
|
||||
<br>
|
||||
<h1>Index of /</h1>
|
||||
<hr>
|
||||
<div id="content">
|
||||
</div>
|
||||
<hr>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<script>
|
||||
fetch("https://greendam.ww3.tw/api/files/list/")
|
||||
.then(res => res.json())
|
||||
.then (data => {
|
||||
data.forEach(item => {
|
||||
console.log('ID', item.id);
|
||||
console.log('Name', item.filename);
|
||||
console.log('URL', item.url_path);
|
||||
|
||||
let contentDocment = `<a href="https://greendam.ww3.tw/resources/${item.filename}">${item.filename}</a><br>`
|
||||
document.getElementById("content").innerHTML += contentDocment
|
||||
})
|
||||
})
|
||||
</script>
|
||||
29
var/templates/resources/test.html
Normal file
29
var/templates/resources/test.html
Normal file
@@ -0,0 +1,29 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>绿坝娘资源小站 (仮) | {{ name }}</title>
|
||||
</head>
|
||||
<body>
|
||||
<a href="/resources">返回上级</a>
|
||||
<br>
|
||||
<h1>Index of /{{ name }}</h1>
|
||||
<hr>
|
||||
<div id="content">
|
||||
</div>
|
||||
<hr>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<script>
|
||||
fetch("https://greendam.ww3.tw/api/files/list/{{ name }}/")
|
||||
.then(res => res.json())
|
||||
.then (data => {
|
||||
data.forEach(item => {
|
||||
console.log('ID', item.id);
|
||||
console.log('Name', item.filename);
|
||||
console.log('URL', item.url_path);
|
||||
|
||||
let contentDocment = `<a href="${item.url_path}">${item.filename}</a><br>`
|
||||
document.getElementById("content").innerHTML += contentDocment
|
||||
})
|
||||
})
|
||||
</script>
|
||||
Reference in New Issue
Block a user