fix:新增两个管理员中心页面

This commit is contained in:
hzj 2025-09-05 11:28:36 +08:00
parent 9ecdc8e4ac
commit 4e6943a8d8
11 changed files with 804 additions and 102 deletions

View File

@ -18,6 +18,7 @@
"lint": "eslint . --fix"
},
"dependencies": {
"airwallex-payment-elements": "^1.131.0",
"vue": "^3.5.18",
"vue-router": "^4.5.1"
},

View File

@ -0,0 +1,25 @@
import { get, post } from "../utils/http.js";
export const getAdminCenterList = async (params) => {
try {
const response = await get(
`/sys/manager/props?propsType=${params.propsType}&currencyType=${params.currencyType}`
);
return response;
} catch (error) {
console.error("Failed to fetch admin center list:", error);
console.error("error:" + error.response.errorMsg);
throw error;
}
};
export const giveProps = async (data) => {
try {
const response = await post("/sys/manager/send", data);
return response;
} catch (error) {
console.error("Failed to fetch give props:", error);
onsole.error("error:" + error.response.errorMsg);
throw error;
}
};

26
src/api/userInfo.js Normal file
View File

@ -0,0 +1,26 @@
import { get, post } from "../utils/http.js";
export const searchUser = async (userId) => {
try {
const response = await get(`/user/user-profile/search?account=${userId}`);
return response;
} catch (error) {
console.error("Failed to fetch search user:", error);
console.error("error:" + error.response.errorMsg);
throw error;
}
};
// 用户支付充值用户搜索
export const searchPayRechargeUser = async (params) => {
try {
const response = await get(
`/order/web/pay/user-profile?sysOrigin=${params.sysOrigin}&account=${params.account}&type=GOLD`
);
return response;
} catch (error) {
console.error("Failed to fetch search pay recharge user:", error);
console.error("error:" + error.response.errorMsg);
throw error;
}
};

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 891 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 727 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

View File

@ -1,162 +1,192 @@
import { createRouter, createWebHistory } from 'vue-router'
import { installRouteGuard } from '../utils/routeGuard.js'
import { createRouter, createWebHistory } from "vue-router";
import { installRouteGuard } from "../utils/routeGuard.js";
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
routes: [
{
path: '/',
redirect: '/loading' // 默认跳转到加载页面
path: "/",
redirect: "/loading", // 默认跳转到加载页面
},
{
path: '/loading',
name: 'loading',
component: () => import('../views/LoadingView.vue'),
meta: { requiresAuth: false, isPublic: true }
path: "/loading",
name: "loading",
component: () => import("../views/LoadingView.vue"),
meta: { requiresAuth: false, isPublic: true },
},
{
path: '/host-center',
name: 'host-center',
component: () => import('../views/HostCenterView.vue'),
meta: { requiresAuth: true }
path: "/host-center",
name: "host-center",
component: () => import("../views/HostCenterView.vue"),
meta: { requiresAuth: true },
},
{
path: '/agency-center',
name: 'agency-center',
component: () => import('../views/AgencyCenterView.vue'),
meta: { requiresAuth: true }
path: "/agency-center",
name: "agency-center",
component: () => import("../views/AgencyCenterView.vue"),
meta: { requiresAuth: true },
},
{
path: '/bd-center',
name: 'bd-center',
component: () => import('../views/BDCenterView.vue'),
meta: { requiresAuth: true }
path: "/bd-center",
name: "bd-center",
component: () => import("../views/BDCenterView.vue"),
meta: { requiresAuth: true },
},
{
path: '/coin-seller',
name: 'coin-seller',
component: () => import('../views/CoinSellerView.vue'),
meta: { requiresAuth: true }
path: "/coin-seller",
name: "coin-seller",
component: () => import("../views/CoinSellerView.vue"),
meta: { requiresAuth: true },
},
{
path: '/apply',
name: 'apply',
component: () => import('../views/ApplyView.vue'),
meta: { requiresAuth: false }
path: "/apply",
name: "apply",
component: () => import("../views/ApplyView.vue"),
meta: { requiresAuth: false },
},
{
path: '/message',
name: 'message',
component: () => import('../views/MessageView.vue'),
meta: { requiresAuth: true }
path: "/message",
name: "message",
component: () => import("../views/MessageView.vue"),
meta: { requiresAuth: true },
},
{
path: '/transfer',
name: 'transfer',
component: () => import('../views/TransferView.vue'),
meta: { requiresAuth: true }
path: "/transfer",
name: "transfer",
component: () => import("../views/TransferView.vue"),
meta: { requiresAuth: true },
},
{
path: '/exchange-gold-coins',
name: 'exchange-gold-coins',
component: () => import('../views/ExchangeGoldCoinsView.vue'),
meta: { requiresAuth: true }
path: "/exchange-gold-coins",
name: "exchange-gold-coins",
component: () => import("../views/ExchangeGoldCoinsView.vue"),
meta: { requiresAuth: true },
},
// 辅助页面
{
path: '/about',
name: 'about',
component: () => import('../views/AboutView.vue'),
path: "/about",
name: "about",
component: () => import("../views/AboutView.vue"),
},
{
path: '/host-setting',
name: 'host-setting',
component: () => import('../views/HostSettingView.vue'),
meta: { requiresAuth: true }
path: "/host-setting",
name: "host-setting",
component: () => import("../views/HostSettingView.vue"),
meta: { requiresAuth: true },
},
{
path: '/search-payee',
name: 'search-payee',
component: () => import('../views/SearchPayeeView.vue'),
meta: { requiresAuth: true }
path: "/search-payee",
name: "search-payee",
component: () => import("../views/SearchPayeeView.vue"),
meta: { requiresAuth: true },
},
{
path: '/information-details',
name: 'information-details',
component: () => import('../views/InformationDetailsView.vue'),
meta: { requiresAuth: true }
path: "/information-details",
name: "information-details",
component: () => import("../views/InformationDetailsView.vue"),
meta: { requiresAuth: true },
},
{
path: '/invite-members',
name: 'invite-members',
component: () => import('../views/InviteMembersView.vue'),
meta: { requiresAuth: true }
path: "/invite-members",
name: "invite-members",
component: () => import("../views/InviteMembersView.vue"),
meta: { requiresAuth: true },
},
{
path: '/team-bill',
name: 'team-bill',
component: () => import('../views/TeamBillView.vue'),
meta: { requiresAuth: true }
path: "/team-bill",
name: "team-bill",
component: () => import("../views/TeamBillView.vue"),
meta: { requiresAuth: true },
},
{
path: '/team-member',
name: 'team-member',
component: () => import('../views/TeamMemberView.vue'),
meta: { requiresAuth: true }
path: "/team-member",
name: "team-member",
component: () => import("../views/TeamMemberView.vue"),
meta: { requiresAuth: true },
},
{
path: '/platform-policy',
name: 'platform-policy',
component: () => import('../views/PlatformPolicyView.vue'),
meta: { requiresAuth: true }
path: "/platform-policy",
name: "platform-policy",
component: () => import("../views/PlatformPolicyView.vue"),
meta: { requiresAuth: true },
},
{
path: '/coin-seller-search',
name: 'coin-seller-search',
component: () => import('../views/CoinSellerSearchView.vue'),
meta: { requiresAuth: true }
path: "/coin-seller-search",
name: "coin-seller-search",
component: () => import("../views/CoinSellerSearchView.vue"),
meta: { requiresAuth: true },
},
{
path: '/seller-records',
name: 'seller-records',
component: () => import('../views/SellerRecordsView.vue'),
meta: { requiresAuth: true }
path: "/seller-records",
name: "seller-records",
component: () => import("../views/SellerRecordsView.vue"),
meta: { requiresAuth: true },
},
{
path: '/bd-setting',
name: 'bd-setting',
component: () => import('../views/BDSettingView.vue'),
meta: { requiresAuth: true }
path: "/bd-setting",
name: "bd-setting",
component: () => import("../views/BDSettingView.vue"),
meta: { requiresAuth: true },
},
// 公共页面
{
path: '/not_app',
name: 'not-app',
component: () => import('../views/NotAppView.vue'),
meta: { requiresAuth: false }
path: "/not_app",
name: "not-app",
component: () => import("../views/NotAppView.vue"),
meta: { requiresAuth: false },
},
// 404 页面
{
path: '/:pathMatch(.*)*',
name: 'not-found',
redirect: '/apply'
path: "/:pathMatch(.*)*",
name: "not-found",
redirect: "/apply",
},
{
path: '/history-salary',
name: 'history-salary',
component: () => import('../views/HistorySalaryView.vue'),
meta: { requiresAuth: true }
path: "/history-salary",
name: "history-salary",
component: () => import("../views/HistorySalaryView.vue"),
meta: { requiresAuth: true },
},
{
path: '/platform-salary',
name: 'platform-salary',
component: () => import('../views/PlatformPolicyView.vue'),
meta: { requiresAuth: true }
}
path: "/platform-salary",
name: "platform-salary",
component: () => import("../views/PlatformPolicyView.vue"),
meta: { requiresAuth: true },
},
{
path: "/admin-center",
name: "admin-center",
component: () => import("../views/AdminCenter.vue"),
meta: { requiresAuth: true },
},
{
path: "/item-distribution",
name: "item-distribution",
component: () => import("../views/ItemDistribution.vue"),
meta: { requiresAuth: true },
},
{
path: "/recharge",
name: "recharge",
component: () => import("../views/Recharge.vue"),
meta: { requiresAuth: true },
},
{
path: "/recharge-standard",
name: "recharge-standard",
component: () => import("../views/RechargeStandard.vue"),
meta: { requiresAuth: true },
},
{
path: "/recharge-freight-agent",
name: "recharge-freight-agent",
component: () => import("../views/RechargeFreightAgent.vue"),
meta: { requiresAuth: true },
},
],
})
});
// 安装路由守卫
installRouteGuard(router)
installRouteGuard(router);
export default router
export default router;

310
src/views/AdminCenter.vue Normal file
View File

@ -0,0 +1,310 @@
<template>
<div class="fullPage">
<MobileHeader title="Admin Center" />
<!-- 标签 -->
<div
style="
display: flex;
justify-content: space-around;
border-bottom: 1px solid #cccccc;
background-color: transparent;
position: relative;
"
>
<div
v-for="(item, index) in tabList"
:key="index"
style="
font-weight: 400;
font-size: 18px;
color: #00000066;
padding: 10px 0;
flex: 1;
text-align: center;
"
class="tab-item"
:class="{ active: activeIndex == index }"
ref="tabItems"
@click="setActiveTab(index)"
>
{{ item.name }}
</div>
<!-- 下划线元素 -->
<div
style="width: 15px; height: 3px; background-color: #bb92ff"
:style="underlineStyle"
></div>
</div>
<!-- 商品列表 -->
<div
style="
width: 100%;
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 12px;
padding: 15px;
"
>
<div v-for="(product, index) in productList" :key="index" @click="showSendDialog(product)">
<div
style="
background-color: white;
border-radius: 10px;
box-shadow: 0px 0px 3px 1px rgba(0, 0, 0, 0.2);
display: flex;
flex-direction: column;
align-items: center;
"
>
<img :src="product.cover" alt="虚拟商品" style="width: 60%; margin: 10px 0" />
<button
style="
background-color: #bb92ff;
color: white;
margin-bottom: 10px;
border: 0;
border-radius: 20px;
padding: 5px 10px;
"
>
Send
</button>
</div>
</div>
</div>
<!-- 弹窗 -->
<!-- 遮罩层 -->
<div
style="
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
z-index: 9999;
background-color: #00000080;
display: flex;
justify-content: center;
align-items: center;
"
v-show="dialogshow"
@click="closedPopup"
>
<div
style="
padding: 20px;
background-color: white;
display: flex;
flex-direction: column;
align-items: center;
border-radius: 20px;
"
@click.stop
>
<img :src="selectedGoods.cover" alt="" style="width: 60%; margin: 5px 0" />
<div style="font-weight: 600; font-size: 16px; margin: 10px 0">
<span style="color: #00000080; margin-right: 10px">Validity:</span>
<span style="font-weight: 700">7day</span>
</div>
<div>
<input
type="text"
placeholder="Enter user ID"
style="
height: 36px;
width: 171px;
border-radius: 8px;
border: 0;
background-color: #f1f1f1b2;
padding: 8px;
margin-right: 4px;
font-size: 14px;
font-weight: 590;
"
v-model="targetUserId"
/>
<button
style="
height: 36px;
width: 72px;
border-radius: 8px;
border: 0;
padding: 8px;
background-color: #bb92ff;
color: white;
font-size: 14px;
font-weight: 590;
"
@click="sendGoods"
>
Confirm
</button>
</div>
</div>
</div>
</div>
</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";
const tabList = ref([
{
id: 1,
name: "Frames",
},
{
id: 2,
name: "Vehicles",
},
{
id: 3,
name: "Chat Box",
},
{
id: 4,
name: "Theme",
},
]);
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;
loadProps();
}
};
// 线
const underlineStyle = computed(() => {
console.log("计算属性");
if (tabItems.value.length === 0) return {}; //
const activeTab = tabItems.value[activeIndex.value];
console.log("选中元素的左边距", activeTab.offsetLeft);
return {
position: "absolute",
left: `${activeTab.offsetLeft + activeTab.offsetWidth / 2 - 15 / 2}px`,
bottom: "0",
transition: "transform 0.3s ease, width 0.3s ease", //
};
});
const targetUserId = ref("");
const sendGoods = async () => {
console.log("赠送用户id", targetUserId.value);
console.log("赠送商品:", selectedGoods.value);
try {
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);
if (res.errorCode == 0 && res.status) {
closedPopup();
}
}
} catch (error) {
console.log("error:", error);
// id
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];
};
//
const loadProps = async () => {
try {
const params = {
propsType: getPropsType(),
currencyType: "GOLD",
};
const response = await getAdminCenterList(params);
console.log("response:", response);
productList.value = response.body;
} catch (error) {
throw error;
}
};
onMounted(() => {
console.log("onMounted");
if (tabItems.value.length > 0) {
underlineStyle.value; //
}
loadProps();
});
//
const productList = ref([]);
//
const selectedGoods = ref({});
//
const getImageUrl = (imgUrl) => {
return new URL(imgUrl, import.meta.url).href;
};
const dialogshow = ref(false);
//
const showSendDialog = (product) => {
console.log("product:", product);
selectedGoods.value = product;
dialogshow.value = true;
};
//
const closedPopup = () => {
selectedGoods.value = {};
targetUserId.value = "";
dialogshow.value = false;
};
</script>
<style scoped>
/* 添加页面样式 */
.fullPage {
width: 100vw;
height: 100vh;
background-image: url(../assets/images/secondBg.png);
background-size: 100% 100%;
background-repeat: no-repeat;
}
.tab-item .active {
color: #3498db; /* 激活态文字颜色 */
}
</style>

View File

@ -0,0 +1,310 @@
<template>
<div class="fullPage">
<MobileHeader title="Admin Center" />
<!-- 标签 -->
<div
style="
display: flex;
justify-content: space-around;
border-bottom: 1px solid #cccccc;
background-color: transparent;
position: relative;
"
>
<div
v-for="(item, index) in tabList"
:key="index"
style="
font-weight: 400;
font-size: 18px;
color: #00000066;
padding: 10px 0;
flex: 1;
text-align: center;
"
class="tab-item"
:class="{ active: activeIndex == index }"
ref="tabItems"
@click="setActiveTab(index)"
>
{{ item.name }}
</div>
<!-- 下划线元素 -->
<div
style="width: 15px; height: 3px; background-color: #bb92ff"
:style="underlineStyle"
></div>
</div>
<!-- 商品列表 -->
<div
style="
width: 100%;
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 12px;
padding: 15px;
"
>
<div v-for="(product, index) in productList" :key="index" @click="showSendDialog(product)">
<div
style="
background-color: white;
border-radius: 10px;
box-shadow: 0px 0px 3px 1px rgba(0, 0, 0, 0.2);
display: flex;
flex-direction: column;
align-items: center;
"
>
<img :src="product.cover" alt="虚拟商品" style="width: 60%; margin: 10px 0" />
<button
style="
background-color: #bb92ff;
color: white;
margin-bottom: 10px;
border: 0;
border-radius: 20px;
padding: 5px 10px;
"
>
Send
</button>
</div>
</div>
</div>
<!-- 弹窗 -->
<!-- 遮罩层 -->
<div
style="
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
z-index: 9999;
background-color: #00000080;
display: flex;
justify-content: center;
align-items: center;
"
v-show="dialogshow"
@click="closedPopup"
>
<div
style="
padding: 20px;
background-color: white;
display: flex;
flex-direction: column;
align-items: center;
border-radius: 20px;
"
@click.stop
>
<img :src="selectedGoods.cover" alt="" style="width: 60%; margin: 5px 0" />
<div style="font-weight: 600; font-size: 16px; margin: 10px 0">
<span style="color: #00000080; margin-right: 10px">Validity:</span>
<span style="font-weight: 700">7day</span>
</div>
<div>
<input
type="text"
placeholder="Enter user ID"
style="
height: 36px;
width: 171px;
border-radius: 8px;
border: 0;
background-color: #f1f1f1b2;
padding: 8px;
margin-right: 4px;
font-size: 14px;
font-weight: 590;
"
v-model="targetUserId"
/>
<button
style="
height: 36px;
width: 72px;
border-radius: 8px;
border: 0;
padding: 8px;
background-color: #bb92ff;
color: white;
font-size: 14px;
font-weight: 590;
"
@click="sendGoods"
>
Confirm
</button>
</div>
</div>
</div>
</div>
</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";
const tabList = ref([
{
id: 1,
name: "Frames",
},
{
id: 2,
name: "Vehicles",
},
{
id: 3,
name: "Chat Box",
},
{
id: 4,
name: "Theme",
},
]);
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;
loadProps();
}
};
// 线
const underlineStyle = computed(() => {
console.log("计算属性");
if (tabItems.value.length === 0) return {}; //
const activeTab = tabItems.value[activeIndex.value];
console.log("选中元素的左边距", activeTab.offsetLeft);
return {
position: "absolute",
left: `${activeTab.offsetLeft + activeTab.offsetWidth / 2 - 15 / 2}px`,
bottom: "0",
transition: "transform 0.3s ease, width 0.3s ease", //
};
});
const targetUserId = ref("");
const sendGoods = async () => {
console.log("赠送用户id", targetUserId.value);
console.log("赠送商品:", selectedGoods.value);
try {
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);
if (res.errorCode == 0 && res.status) {
closedPopup();
}
}
} catch (error) {
console.log("error:", error);
// id
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];
};
//
const loadProps = async () => {
try {
const params = {
propsType: getPropsType(),
currencyType: "GOLD",
};
const response = await getAdminCenterList(params);
console.log("response:", response);
productList.value = response.body;
} catch (error) {
throw error;
}
};
onMounted(() => {
console.log("onMounted");
if (tabItems.value.length > 0) {
underlineStyle.value; //
}
loadProps();
});
//
const productList = ref([]);
//
const selectedGoods = ref({});
//
const getImageUrl = (imgUrl) => {
return new URL(imgUrl, import.meta.url).href;
};
const dialogshow = ref(false);
//
const showSendDialog = (product) => {
console.log("product:", product);
selectedGoods.value = product;
dialogshow.value = true;
};
//
const closedPopup = () => {
selectedGoods.value = {};
targetUserId.value = "";
dialogshow.value = false;
};
</script>
<style scoped>
/* 添加页面样式 */
.fullPage {
width: 100vw;
height: 100vh;
background-image: url(../assets/images/secondBg.png);
background-size: 100% 100%;
background-repeat: no-repeat;
}
.tab-item .active {
color: #3498db; /* 激活态文字颜色 */
}
</style>