fix(管理员): 修复页面标题,标签减少两个
This commit is contained in:
parent
cf84422b35
commit
1ee5c29b94
@ -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>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user