feat(金币代理搜索): UI更新

This commit is contained in:
hzj 2025-10-09 14:50:48 +08:00
parent 4e2dcd9a45
commit 8b586412b7
2 changed files with 99 additions and 80 deletions

BIN
src/assets/icon/add.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -4,32 +4,45 @@
<div class="content"> <div class="content">
<!-- 搜索框 --> <!-- 搜索框 -->
<div class="search-section"> <div style="display: flex; align-items: center; gap: 8px; margin-bottom: 8px">
<div class="search-box"> <div
<span class="search-icon">🔍</span> style="
flex: 1;
border-radius: 32px;
border: 1px solid #fff;
box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.25);
padding: 0 8px;
display: flex;
align-items: center;
height: max-content;
"
>
<img src="../assets/icon/search.png" alt="" width="24px" style="opacity: 0.6" />
<input <input
v-model="searchQuery" v-model="searchQuery"
type="text" type="text"
placeholder="Please enter the host ID" name=""
class="search-input" id=""
@keyup.enter="handleEnterPress" placeholder="Please enter the host lD"
@keyup.enter="handleEnterPress"
@input="handleInputChange" @input="handleInputChange"
style="
width: 100%;
color: rgba(0, 0, 0, 0.4);
font-weight: 600;
font-size: 14px;
outline: none;
border: none;
background-color: transparent;
padding: 10px 8px;
"
/> />
<button <button v-if="searchQuery" @click="clearSearch" class="clear-btn">×</button>
v-if="searchQuery" </div>
@click="clearSearch" <div style="font-weight: 600" @click="handleActionButton" :disabled="isSearching">
class="clear-btn" {{ getActionButtonText() }}
>
×
</button>
<button
class="action-btn"
:class="{ 'confirm': hasValidSelection }"
@click="handleActionButton"
:disabled="isSearching"
>
{{ getActionButtonText() }}
</button>
</div> </div>
</div> </div>
@ -39,7 +52,7 @@
v-for="user in searchResults" v-for="user in searchResults"
:key="user.id" :key="user.id"
class="user-item" class="user-item"
:class="{ 'selected': selectedUser?.id === user.id }" :class="{ selected: selectedUser?.id === user.id }"
@click="toggleUserSelection(user)" @click="toggleUserSelection(user)"
> >
<div class="user-info"> <div class="user-info">
@ -49,17 +62,21 @@
:src="user.userAvatar" :src="user.userAvatar"
:alt="user.name" :alt="user.name"
class="avatar-image" class="avatar-image"
@error="(e) => e.target.style.display = 'none'" @error="(e) => (e.target.style.display = 'none')"
/> />
<span v-if="!user.userAvatar" class="avatar-text">{{ user.name.charAt(0) }}</span> <span v-if="!user.userAvatar" class="avatar-text">{{ user.name.charAt(0) }}</span>
</div> </div>
<div class="user-details"> <div class="user-details">
<h4>{{ user.name }}</h4> <div style="margin-bottom: 4px; font-size: 16px; font-weight: 700">
<p>ID: {{ user.id }}</p> {{ user.name }}
</div>
<div style="font-size: 14px; color: rgba(0, 0, 0, 0.4); font-weight: 500">
ID: {{ user.account }}
</div>
</div> </div>
</div> </div>
<div class="add-icon"> <div style="display: flex; justify-content: center; align-items: center">
<span></span> <img src="../assets/icon/add.png" alt="" width="32px" />
</div> </div>
</div> </div>
</div> </div>
@ -69,20 +86,6 @@
<div class="loading-spinner"></div> <div class="loading-spinner"></div>
<p>Searching...</p> <p>Searching...</p>
</div> </div>
<!-- 空状态 -->
<div v-else-if="searchQuery && !isSearching && searchResults.length === 0" class="empty-state">
<div class="empty-icon">🔍</div>
<p>No users found</p>
<span>Try searching with a different ID</span>
</div>
<!-- 搜索提示 -->
<div v-else-if="!searchQuery" class="search-hint">
<div class="hint-icon">👤</div>
<p>Search for users</p>
<span>Enter host ID to find users</span>
</div>
</div> </div>
</div> </div>
</template> </template>
@ -155,13 +158,15 @@ const performSearch = async () => {
if (response && response.status && response.body && response.body.userProfile) { if (response && response.status && response.body && response.body.userProfile) {
const profile = response.body.userProfile const profile = response.body.userProfile
searchResults.value = [{ searchResults.value = [
id: profile.id, {
name: profile.userNickname || 'User', id: profile.id,
userNickname: profile.userNickname, name: profile.userNickname || 'User',
account: profile.account, userNickname: profile.userNickname,
userAvatar: profile.userAvatar account: profile.account,
}] userAvatar: profile.userAvatar,
},
]
} else { } else {
searchResults.value = [] searchResults.value = []
} }
@ -207,7 +212,7 @@ const confirmSelection = () => {
name: selectedUser.value.name, name: selectedUser.value.name,
userNickname: selectedUser.value.userNickname, userNickname: selectedUser.value.userNickname,
account: selectedUser.value.account, account: selectedUser.value.account,
userAvatar: selectedUser.value.userAvatar userAvatar: selectedUser.value.userAvatar,
}) })
// Go back to previous page // Go back to previous page
@ -217,6 +222,16 @@ const confirmSelection = () => {
</script> </script>
<style scoped> <style scoped>
* {
color: rgba(0, 0, 0, 0.8);
font-family: 'SF Pro Text';
}
input::placeholder {
font-weight: bold;
color: rgba(0, 0, 0, 0.4);
}
.coin-seller-search { .coin-seller-search {
font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-family: -apple-system, BlinkMacSystemFont, sans-serif;
} }
@ -239,7 +254,7 @@ const confirmSelection = () => {
border: 1px solid #e5e7eb; border: 1px solid #e5e7eb;
border-radius: 8px; border-radius: 8px;
padding: 8px 12px; padding: 8px 12px;
box-shadow: 0 1px 3px rgba(0,0,0,0.1); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
} }
.search-icon { .search-icon {
@ -272,7 +287,7 @@ const confirmSelection = () => {
.action-btn { .action-btn {
background: none; background: none;
border: none; border: none;
color: #8B5CF6; color: #8b5cf6;
font-size: 14px; font-size: 14px;
font-weight: 500; font-weight: 500;
cursor: pointer; cursor: pointer;
@ -281,11 +296,11 @@ const confirmSelection = () => {
} }
.action-btn:active { .action-btn:active {
color: #7C3AED; color: #7c3aed;
} }
.action-btn.confirm { .action-btn.confirm {
background-color: #8B5CF6; background-color: #8b5cf6;
color: white; color: white;
border-radius: 6px; border-radius: 6px;
padding: 6px 12px; padding: 6px 12px;
@ -307,7 +322,7 @@ const confirmSelection = () => {
background-color: white; background-color: white;
padding: 16px; padding: 16px;
border-radius: 12px; border-radius: 12px;
box-shadow: 0 2px 8px rgba(0,0,0,0.1); box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.25);
cursor: pointer; cursor: pointer;
transition: all 0.2s; transition: all 0.2s;
display: flex; display: flex;
@ -320,12 +335,12 @@ const confirmSelection = () => {
} }
.user-item.selected { .user-item.selected {
border: 2px solid #8B5CF6; border: 2px solid #8b5cf6;
background-color: #F3F4F6; background-color: #f3f4f6;
} }
.user-item.selected .add-icon { .user-item.selected {
color: #8B5CF6; color: #8b5cf6;
font-weight: bold; font-weight: bold;
} }
@ -339,7 +354,7 @@ const confirmSelection = () => {
width: 50px; width: 50px;
height: 50px; height: 50px;
border-radius: 25px; border-radius: 25px;
background-color: #F59E0B; background-color: #f59e0b;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
@ -364,24 +379,6 @@ const confirmSelection = () => {
font-weight: 600; font-weight: 600;
} }
.user-details h4 {
margin: 0 0 4px 0;
font-size: 16px;
font-weight: 600;
color: #333;
}
.user-details p {
margin: 0;
font-size: 14px;
color: #666;
}
.add-icon {
color: #10B981;
font-size: 20px;
}
/* 加载状态 */ /* 加载状态 */
.loading-state { .loading-state {
display: flex; display: flex;
@ -396,15 +393,19 @@ const confirmSelection = () => {
width: 32px; width: 32px;
height: 32px; height: 32px;
border: 3px solid #f3f3f3; border: 3px solid #f3f3f3;
border-top: 3px solid #F59E0B; border-top: 3px solid #f59e0b;
border-radius: 50%; border-radius: 50%;
animation: spin 1s linear infinite; animation: spin 1s linear infinite;
margin-bottom: 16px; margin-bottom: 16px;
} }
@keyframes spin { @keyframes spin {
0% { transform: rotate(0deg); } 0% {
100% { transform: rotate(360deg); } transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
} }
.loading-state p { .loading-state p {
@ -465,4 +466,22 @@ const confirmSelection = () => {
font-size: 14px; font-size: 14px;
color: #9ca3af; color: #9ca3af;
} }
@media screen and (max-width: 360px) {
* {
font-size: 10px;
}
}
@media screen and (min-width: 360px) {
* {
font-size: 12px;
}
}
@media screen and (min-width: 768px) {
* {
font-size: 24px;
}
}
</style> </style>