新增成員管理系統首頁
This commit is contained in:
parent
b97814cf7b
commit
06c06bbd5b
21
member/index.html
Normal file
21
member/index.html
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh-TW" xmlns="http://www.w3.org/1999/html" xmlns="http://www.w3.org/1999/html">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<!-- Required meta tags -->
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
|
||||||
|
<title>公主連結戰隊戰填表系統 - 成員管理</title>
|
||||||
|
<link rel="stylesheet" href="../css/style.css">
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body id="body">
|
||||||
|
<h1>成員管理</h1>
|
||||||
|
<hr>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/axios@1.1.2/dist/axios.min.js"></script>
|
||||||
|
<script src="./js/index.js"></script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
75
member/js/index.js
Normal file
75
member/js/index.js
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
var selectedDate = document.getElementById("queryDate");
|
||||||
|
|
||||||
|
let table = document.createElement("table");
|
||||||
|
let thead = document.createElement("thead");
|
||||||
|
let tbody = document.createElement("tbody");
|
||||||
|
|
||||||
|
table.appendChild(thead);
|
||||||
|
table.appendChild(tbody);
|
||||||
|
|
||||||
|
// Adding the entire table to the body tag
|
||||||
|
document.getElementById("body").appendChild(table);
|
||||||
|
|
||||||
|
// Creating and adding data to first row of the table
|
||||||
|
let row_1 = document.createElement("tr");
|
||||||
|
let heading_1 = document.createElement("th");
|
||||||
|
heading_1.innerHTML = "成員名稱";
|
||||||
|
let heading_2 = document.createElement("th");
|
||||||
|
heading_2.innerHTML = "角色暱稱";
|
||||||
|
let heading_3 = document.createElement("th");
|
||||||
|
heading_3.innerHTML = "角色UID";
|
||||||
|
let heading_4 = document.createElement("th");
|
||||||
|
heading_4.innerHTML = "DC ID";
|
||||||
|
let heading_5= document.createElement("th");
|
||||||
|
heading_5.innerHTML = "已離開";
|
||||||
|
|
||||||
|
row_1.appendChild(heading_1);
|
||||||
|
row_1.appendChild(heading_2);
|
||||||
|
row_1.appendChild(heading_3);
|
||||||
|
row_1.appendChild(heading_4);
|
||||||
|
row_1.appendChild(heading_5);
|
||||||
|
thead.appendChild(row_1);
|
||||||
|
// 取得刀表
|
||||||
|
axios.get("http://127.0.0.1:10001/api/member", {
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'Accept': 'application/json'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
const data = response.data;
|
||||||
|
console.log(data);
|
||||||
|
for (let i = 0; i < data.length; i++) {
|
||||||
|
// Creating and adding data to second row of the table
|
||||||
|
let row_2 = document.createElement("tr");
|
||||||
|
let row_2_data_1 = document.createElement("td");
|
||||||
|
let row_2_data_2 = document.createElement("td");
|
||||||
|
let row_2_data_3 = document.createElement("td");
|
||||||
|
let row_2_data_4 = document.createElement("td");
|
||||||
|
let row_2_data_5 = document.createElement("td");
|
||||||
|
|
||||||
|
const item = data[i];
|
||||||
|
|
||||||
|
row_2_data_1.innerHTML = "<a href=\"edit.html?id=" + item._id + "\">" + item.nickName + "</a>";
|
||||||
|
row_2_data_2.innerHTML = item.playerName;
|
||||||
|
row_2_data_3.innerHTML = item.uid;
|
||||||
|
row_2_data_4.innerHTML = item.discordID;
|
||||||
|
if (item.leave) {
|
||||||
|
row_2_data_5.innerHTML = "O";
|
||||||
|
} else {
|
||||||
|
row_2_data_5.innerHTML = "X";
|
||||||
|
}
|
||||||
|
|
||||||
|
row_2.appendChild(row_2_data_1);
|
||||||
|
row_2.appendChild(row_2_data_2);
|
||||||
|
row_2.appendChild(row_2_data_3);
|
||||||
|
row_2.appendChild(row_2_data_4);
|
||||||
|
row_2.appendChild(row_2_data_5);
|
||||||
|
tbody.appendChild(row_2);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
//const message = error.response.data.message;
|
||||||
|
//alert("資料取得失敗");
|
||||||
|
console.error('資料取得失敗:', error);
|
||||||
|
});
|
||||||
Loading…
Reference in New Issue
Block a user