This repository has been archived by the owner on Apr 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
97 lines (95 loc) · 3.32 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<!DOCTYPE html>
<html lang="zh-CN">
<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>流浪地球2 | UEG名牌生成</title>
<link rel="stylesheet" type="text/css" href="index.css" />
</head>
<body style="background-color: rgb(3, 27, 44)">
<div style="display: flex; width: 100%">
<img
src="https://s1.ax1x.com/2023/01/28/pSU7nLq.png"
style="width: 79px; margin: 0 auto"
/>
</div>
<div class="flex-row">
<div class="col col-24 col-md-12">
<div
id="all"
>
<img
src="./background.png"
alt=""
style="
width: 360px;
height: 100%;
background-image: url('./background.png');
"
/>
<img id="profile-picture" src="./LiXuejian.png" />
<div class="owner-name">
<h1 id="family-name">ZHOU</h1>
<h2 id="first-name">ZHEZHI</h2>
</div>
<h3 id="position">PERMANENT REPRESENTATIVE</h3>
<div
style="
background-color: rgb(7, 52, 97);
padding-top: 0.5px;
padding-bottom: 0.5px;
padding-left: 8px;
padding-right: 8px;
"
>
<h5 style="text-align: center; color: white">
由 架空UEG网站 生成<br />访问 uegov.world/ueg-card
</h5>
</div>
</div>
</div>
<div class="col col-24 col-md-12">
<div class="input-boxes">
<h1>输入定制信息</h1>
<input type="file" id="upload" style="color: white" />
<input type="text" placeholder="姓" id="input-family-name" />
<input type="text" placeholder="名" id="input-first-name" />
<input type="text" placeholder="职位" id="input-position" />
<button onclick="start()">生成</button>
<a href="" download style="display: none" id="download"></a>
</div>
</div>
</div>
<script src="./html2canvas.min.js"></script>
<script>
async function start() {
document.getElementById("family-name").innerText =
document.getElementById("input-family-name").value;
document.getElementById("first-name").innerText =
document.getElementById("input-first-name").value;
document.getElementById("position").innerText =
document.getElementById("input-position").value;
await html2canvas(document.getElementById("all"), { scale: 2 }).then(
async function (canvas) {
canvas = canvas.toDataURL("image/jpeg", 2);
console.log(canvas);
document.getElementById("download").setAttribute("href", canvas);
document.getElementById("download").click();
}
);
}
document
.getElementById("upload")
.addEventListener("change", function (e) {
let reader = new FileReader();
reader.readAsDataURL(document.getElementById("upload").files[0]);
reader.onload = function (r) {
document
.getElementById("profile-picture")
.setAttribute("src", reader.result);
};
});
</script>
</body>
</html>