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