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
+
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="UTF-8">
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 7 |
+
<title>布拉迪找人</title>
|
| 8 |
+
<style>
|
| 9 |
+
body {
|
| 10 |
+
font-family: Arial, sans-serif;
|
| 11 |
+
line-height: 1.6;
|
| 12 |
+
margin: 0;
|
| 13 |
+
padding: 0;
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
header {
|
| 17 |
+
background-color: #1f84d4;
|
| 18 |
+
color: #fff;
|
| 19 |
+
padding: 10px;
|
| 20 |
+
text-align: center;
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
.container {
|
| 24 |
+
max-width: 600px;
|
| 25 |
+
margin: 0 auto;
|
| 26 |
+
padding: 20px;
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
.input-group {
|
| 30 |
+
display: flex;
|
| 31 |
+
align-items: center;
|
| 32 |
+
justify-content: space-between;
|
| 33 |
+
margin-bottom: 10px;
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
input[type="text"] {
|
| 37 |
+
flex: 1;
|
| 38 |
+
padding: 10px;
|
| 39 |
+
border: 1px solid #ccc;
|
| 40 |
+
border-radius: 4px;
|
| 41 |
+
outline: none;
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
#search {
|
| 45 |
+
background-color: #1f84d4;
|
| 46 |
+
color: #fff;
|
| 47 |
+
border: none;
|
| 48 |
+
padding: 10px 20px;
|
| 49 |
+
border-radius: 4px;
|
| 50 |
+
cursor: pointer;
|
| 51 |
+
margin-left: 10px;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
.result-item {
|
| 55 |
+
margin-top: 20px;
|
| 56 |
+
text-align: center;
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
.result-item img {
|
| 60 |
+
display: block;
|
| 61 |
+
max-width: 100%;
|
| 62 |
+
margin: 0 auto 10px;
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
.result-item button {
|
| 66 |
+
background-color: #1f84d4;
|
| 67 |
+
color: #fff;
|
| 68 |
+
border: none;
|
| 69 |
+
padding: 10px 20px;
|
| 70 |
+
border-radius: 4px;
|
| 71 |
+
cursor: pointer;
|
| 72 |
+
margin-bottom: 10px;
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
.result-item p {
|
| 76 |
+
margin: 5px 0;
|
| 77 |
+
}
|
| 78 |
+
</style>
|
| 79 |
+
</head>
|
| 80 |
+
|
| 81 |
+
<body>
|
| 82 |
+
<header>
|
| 83 |
+
<h1>布拉迪昵称找人</h1>
|
| 84 |
+
</header>
|
| 85 |
+
<div class="container">
|
| 86 |
+
<div class="input-group">
|
| 87 |
+
<input type="text" id="name" placeholder="输入昵称">
|
| 88 |
+
<input type="button" value="查询" onclick="search()" id="search">
|
| 89 |
+
</div>
|
| 90 |
+
<div id="result-container"></div>
|
| 91 |
+
</div>
|
| 92 |
+
|
| 93 |
+
<script>
|
| 94 |
+
function search() {
|
| 95 |
+
var name = document.getElementById("name").value;
|
| 96 |
+
if (name === "") {
|
| 97 |
+
alert("请先输入昵称哦~");
|
| 98 |
+
} else {
|
| 99 |
+
const url = `/blued?name=${encodeURIComponent(name)}`;
|
| 100 |
+
fetch(url)
|
| 101 |
+
.then(response => {
|
| 102 |
+
if (!response.ok) {
|
| 103 |
+
throw new Error('Network response was not ok');
|
| 104 |
+
}
|
| 105 |
+
return response.json();
|
| 106 |
+
})
|
| 107 |
+
.then(data => {
|
| 108 |
+
var code = data.code;
|
| 109 |
+
if (code === 200) {
|
| 110 |
+
var list = data.data.list;
|
| 111 |
+
var resultContainer = document.getElementById("result-container");
|
| 112 |
+
// 清空之前的结果
|
| 113 |
+
resultContainer.innerHTML = '';
|
| 114 |
+
|
| 115 |
+
list.forEach(item => {
|
| 116 |
+
var itemDiv = document.createElement('div');
|
| 117 |
+
itemDiv.classList.add('result-item');
|
| 118 |
+
|
| 119 |
+
var img = document.createElement('img');
|
| 120 |
+
img.src = item.avatar;
|
| 121 |
+
itemDiv.appendChild(img);
|
| 122 |
+
|
| 123 |
+
var uidP = document.createElement('p');
|
| 124 |
+
uidP.textContent = `UID: ${item.uid}`;
|
| 125 |
+
itemDiv.appendChild(uidP);
|
| 126 |
+
|
| 127 |
+
var unionUidP = document.createElement('p');
|
| 128 |
+
unionUidP.textContent = `UnionUID: ${item.unionUid}`;
|
| 129 |
+
itemDiv.appendChild(unionUidP);
|
| 130 |
+
|
| 131 |
+
var button = document.createElement('button');
|
| 132 |
+
button.textContent = "打开此人主页";
|
| 133 |
+
button.addEventListener('click', function () {
|
| 134 |
+
var url = "https://app.blued.cn/user?id=" + item.uid;
|
| 135 |
+
window.open(url);
|
| 136 |
+
});
|
| 137 |
+
itemDiv.appendChild(button);
|
| 138 |
+
|
| 139 |
+
resultContainer.appendChild(itemDiv);
|
| 140 |
+
});
|
| 141 |
+
} else {
|
| 142 |
+
alert("查无此人");
|
| 143 |
+
}
|
| 144 |
+
})
|
| 145 |
+
.catch(error => {
|
| 146 |
+
console.error('Fetch Error:', error);
|
| 147 |
+
});
|
| 148 |
+
}
|
| 149 |
+
}
|
| 150 |
+
</script>
|
| 151 |
+
</body>
|
| 152 |
+
|
| 153 |
+
</html>
|