67 lines
1.3 KiB
HTML
67 lines
1.3 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Document</title>
|
|
<style>
|
|
body,
|
|
li {
|
|
margin: 0;
|
|
padding: 0;
|
|
list-style: none;
|
|
}
|
|
img {
|
|
width: 100%;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<div class="info">
|
|
|
|
</div>
|
|
</body>
|
|
<script src="./http.js"></script>
|
|
<script>
|
|
|
|
|
|
let getInfo = async () => {
|
|
let res = await http.get({
|
|
url: 'http://127.0.0.1:3000/api/json/info',
|
|
data: {
|
|
id: query("id"),
|
|
quantity: query("total")
|
|
}
|
|
});
|
|
renderPage(res)
|
|
}
|
|
|
|
let renderPage = (res) => {
|
|
console.log(res);
|
|
res.forEach(v => {
|
|
$(".info").innerHTML += `
|
|
<img src="${v}" alt="">
|
|
`
|
|
});
|
|
}
|
|
|
|
|
|
getInfo()
|
|
|
|
function query(name) {
|
|
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
|
|
var r = window.location.search.substr(1).match(reg);
|
|
if (r != null)
|
|
return unescape(r[2]);
|
|
return null;
|
|
}
|
|
|
|
function $(className) {
|
|
return document.querySelector(className);
|
|
}
|
|
</script>
|
|
|
|
</html> |