fix(管理员): 修复页面标题,标签减少两个

This commit is contained in:
hzj 2025-09-09 19:12:07 +08:00
parent cf84422b35
commit 1ee5c29b94

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="fullPage"> <div class="fullPage">
<MobileHeader title="Admin Center" /> <MobileHeader title="Item Distribution" />
<!-- 标签 --> <!-- 标签 -->
<div <div
style=" style="
@ -148,151 +148,151 @@
</template> </template>
<script setup> <script setup>
import MobileHeader from "../components/MobileHeader.vue"; import MobileHeader from '../components/MobileHeader.vue'
import { onMounted, ref, computed } from "vue"; import { onMounted, ref, computed } from 'vue'
import { getAdminCenterList, giveProps } from "@/api/itemDistribution"; import { getAdminCenterList, giveProps } from '@/api/itemDistribution'
import { searchUser } from "@/api/userInfo"; import { searchUser } from '@/api/userInfo'
import { showError, showWarning, showInfo, showSuccess } from "@/utils/toast.js"; import { showError, showWarning, showInfo, showSuccess } from '@/utils/toast.js'
const tabList = ref([ const tabList = ref([
{ {
id: 1, id: 1,
name: "Frames", name: 'Frames',
}, },
{ {
id: 2, id: 2,
name: "Vehicles", name: 'Vehicles',
}, },
{ // {
id: 3, // id: 3,
name: "Chat Box", // name: 'Chat Box',
}, // },
{ // {
id: 4, // id: 4,
name: "Theme", // name: 'Theme',
}, // },
]); ])
const activeIndex = ref(0); const activeIndex = ref(0)
const currentTab = ref("Frames"); // const currentTab = ref('Frames') //
const tabItems = ref([]); // DOM const tabItems = ref([]) // DOM
// //
const setActiveTab = (index) => { const setActiveTab = (index) => {
if (activeIndex.value != index) { if (activeIndex.value != index) {
console.log("切换标签"); console.log('切换标签')
productList.value = []; // productList.value = [] //
activeIndex.value = index; activeIndex.value = index
currentTab.value = tabList.value[index].name; currentTab.value = tabList.value[index].name
loadProps(); loadProps()
} }
}; }
// 线 // 线
const underlineStyle = computed(() => { const underlineStyle = computed(() => {
console.log("计算属性"); console.log('计算属性')
if (tabItems.value.length === 0) return {}; // if (tabItems.value.length === 0) return {} //
const activeTab = tabItems.value[activeIndex.value]; const activeTab = tabItems.value[activeIndex.value]
console.log("选中元素的左边距", activeTab.offsetLeft); console.log('选中元素的左边距', activeTab.offsetLeft)
return { return {
position: "absolute", position: 'absolute',
left: `${activeTab.offsetLeft + activeTab.offsetWidth / 2 - 15 / 2}px`, left: `${activeTab.offsetLeft + activeTab.offsetWidth / 2 - 15 / 2}px`,
bottom: "0", bottom: '0',
transition: "left 0.3s ease", // transition: 'left 0.3s ease', //
}; }
}); })
const targetUserId = ref(""); const targetUserId = ref('')
const sendGoods = async () => { const sendGoods = async () => {
console.log("赠送用户id", targetUserId.value); console.log('赠送用户id', targetUserId.value)
console.log("赠送商品:", selectedGoods.value); console.log('赠送商品:', selectedGoods.value)
try { try {
const targetUserInfo = await searchUser(targetUserId.value); const targetUserInfo = await searchUser(targetUserId.value)
console.log("targetUserInfo:", targetUserInfo); console.log('targetUserInfo:', targetUserInfo)
if (targetUserInfo.status && targetUserInfo.body) { if (targetUserInfo.status && targetUserInfo.body) {
const data = { const data = {
propsId: selectedGoods.value.id, propsId: selectedGoods.value.id,
acceptUserId: targetUserInfo.body.id, acceptUserId: targetUserInfo.body.id,
}; }
const res = await giveProps(data); const res = await giveProps(data)
if (res.errorCode == 0 && res.status) { if (res.errorCode == 0 && res.status) {
closedPopup(); closedPopup()
showSuccess("Gift delivery successful"); showSuccess('Gift delivery successful')
} }
} }
} catch (error) { } catch (error) {
console.log("error:", error); console.log('error:', error)
// id // id
showWarning("User info not found"); showWarning('User info not found')
throw error; throw error
} }
}; }
// //
const getPropsType = () => { const getPropsType = () => {
const typeMap = { const typeMap = {
Frames: "AVATAR_FRAME", Frames: 'AVATAR_FRAME',
Vehicles: "RIDE", Vehicles: 'RIDE',
"Chat Box": "CHAT_BUBBLE", 'Chat Box': 'CHAT_BUBBLE',
Theme: "THEME", Theme: 'THEME',
}; }
return typeMap[currentTab.value]; return typeMap[currentTab.value]
}; }
// //
const loadProps = async () => { const loadProps = async () => {
try { try {
const params = { const params = {
propsType: getPropsType(), propsType: getPropsType(),
currencyType: "GOLD", currencyType: 'GOLD',
}; }
const response = await getAdminCenterList(params); const response = await getAdminCenterList(params)
console.log("response:", response); console.log('response:', response)
productList.value = response.body; productList.value = response.body
} catch (error) { } catch (error) {
throw error; throw error
} }
}; }
onMounted(() => { onMounted(() => {
console.log("onMounted"); console.log('onMounted')
if (tabItems.value.length > 0) { if (tabItems.value.length > 0) {
underlineStyle.value; // underlineStyle.value //
} }
loadProps(); loadProps()
}); })
// //
const productList = ref([]); const productList = ref([])
// //
const selectedGoods = ref({}); const selectedGoods = ref({})
// //
const getImageUrl = (imgUrl) => { const getImageUrl = (imgUrl) => {
return new URL(imgUrl, import.meta.url).href; return new URL(imgUrl, import.meta.url).href
}; }
const dialogshow = ref(false); const dialogshow = ref(false)
// //
const showSendDialog = (product) => { const showSendDialog = (product) => {
console.log("product:", product); console.log('product:', product)
selectedGoods.value = product; selectedGoods.value = product
dialogshow.value = true; dialogshow.value = true
}; }
// //
const closedPopup = () => { const closedPopup = () => {
selectedGoods.value = {}; selectedGoods.value = {}
targetUserId.value = ""; targetUserId.value = ''
dialogshow.value = false; dialogshow.value = false
}; }
</script> </script>
<style scoped> <style scoped>