动态渲染公会tab

This commit is contained in:
dragon
2024-09-11 13:56:29 +08:00
parent f7cf35f8bd
commit fdf018a180

View File

@@ -43,7 +43,7 @@ var tabPersonalArr = [];
var tabAgentArr = [];
var transfer_dollars_Arr;
var transfer_dollars_ArrType;
var typeTabType = 'personal';
var typeTabType = '';
var ratio;
var usGold;
$(function () {
@@ -134,13 +134,19 @@ function getTab() {
usGold = res.data.guildUsdNum
$('.my_salary p b').text(`${usGold}ÜS`);
// 处理tab对应列表
res.data.typeTab.forEach(res => {
var tabStr = ''
$('.tab .item').remove();
if (res.data.typeTab.length <= 1) { $('.tab').css('background', 'none') }
res.data.typeTab.forEach((res, i) => {
if (res.tabKey == 'personal') {
tabPersonalArr.push(res.channelList);
} else {
tabAgentArr.push(res.channelList);
}
tabStr += `<div tabKey=${res.tabKey} class="item ${i == 0 ? 'act' : ''}">${res.tabKey == 'personal' ? langReplace(localLang.salary.text4) : langReplace(localLang.salary.text5)}</div>`
})
$('.tab').append(tabStr);
typeTabType = res.data.typeTab[0].tabKey
typeTabFun(typeTabType);
} else {
toastMsg(res.message)
@@ -324,10 +330,12 @@ $('.agent_pop .sure').click(function () {
bodyScroolFun(false);
})
// 切换tab
$('.tab .item').click(function () {
var i = $(this).index() + 1;
$('.tab').on('click', '.item', function () {
// var i = $(this).index() + 1;
var tabKey = $(this).attr('tabKey');
$(this).addClass('act').siblings().removeClass('act');
typeTabType = i == 1 ? 'personal' : 'agent';
// typeTabType = i == 1 ? 'personal' : 'agent';
typeTabType = tabKey;
typeTabFun(typeTabType)
})
// 切换方式
@@ -353,7 +361,7 @@ $('.transfer_dollars').on('click', 'li', function () {
var type = $('.custom_pop .sure').attr('type');
if (type == 3) {
$('.custom_pop .custom_pop_in h2').hide()
}else{
} else {
$('.custom_pop .custom_pop_in h2').show()
}
bodyScroolFun(true);