This commit is contained in:
2025-02-26 15:12:36 +08:00
parent e9e7353760
commit 2314f863e1
3 changed files with 101 additions and 64 deletions

View File

@@ -769,31 +769,42 @@
8: '心理学VIP'
};
const vipTypes = userVips.map(vip => vip.type);
const isMedicalVip = [4, 5, 6].every(type => vipTypes.includes(type));
const isPsychologyVip = [7,8].every(type => vipTypes.includes(type));
// 特殊情况:医学 + 心理学
if (isMedicalVip && isPsychologyVip) {
return `<el-tag size="mini" type="warning" style="font-weight: bold; background-image: linear-gradient(90deg, #ff1f00 0%, #fa9f93 100%); color: #fff; padding: 2px; border-radius: 2px; font-size: 11px;" effect="dark">医学SVIP</el-tag><br/>
<el-tag size="mini" type="warning" style="font-weight: bold; background-image: linear-gradient(90deg, #67c23a 0%, #e1f3d8 100%); color: #fff; padding: 2px; border-radius: 2px; font-size: 11px;" effect="dark">国学与心理学SVIP</el-tag>`;
}
// 只有医学VIP
if (isMedicalVip) {
return `<el-tag size="mini" type="warning" style="font-weight: bold; background-image: linear-gradient(90deg, #ff1f00 0%, #fa9f93 100%); color: #fff; padding: 2px; border-radius: 2px; font-size: 11px;" effect="dark">医学超级VIP</el-tag>`;
// 将 userVips 转为数组形式,以便处理(如果是数字则转为数字数组)
let vipTypes = [];
if (typeof userVips === 'number') {
vipTypes = String(userVips).split('').map(Number); // 数字转为数组
} else {
vipTypes = userVips.map(vip => vip.type); // 如果是对象数组,获取每个对象的 type
}
// 只有心理学VIP
if (isPsychologyVip) {
return `<el-tag size="mini" type="warning" style="font-weight: bold; background-image: linear-gradient(90deg, #67c23a 0%, #e1f3d8 100%); color: #fff; padding: 2px; border-radius: 2px; font-size: 11px;" effect="dark">国学与心理学超级VIP</el-tag>`;
// 判断是否同时包含 4、5、6医学SVIP
const hasMedicalSVip = [4, 5, 6].every(type => vipTypes.includes(type));
// 判断是否同时包含 7、8心理学SVIP
const hasPsychologySVip = [7, 8].every(type => vipTypes.includes(type));
const tags = [];
// 1. 医学SVIP只显示一次
if (hasMedicalSVip) {
tags.push(`<el-tag size="mini" type="warning" style="font-weight: bold; background-image: linear-gradient(90deg, #ff1f00 0%, #fa9f93 100%); color: #fff; padding: 2px; border-radius: 2px; font-size: 10px;" effect="dark">医学SVIP</el-tag>`);
}
// **普通情况**:单独展示所有 `type` 对应的内容
return vipTypes
.filter(type => vipMap[type]) // 过滤出有对应名称的类型
.map(type => `<el-tag size="mini" type="info" style="font-weight: bold; color: #fff; padding: 2px; border-radius: 2px; font-size: 11px; background: #409EFF;" effect="dark">${vipMap[type]}</el-tag>`)
.join(' ');
// 2. 心理学SVIP只显示一次
if (hasPsychologySVip) {
tags.push(`<el-tag size="mini" type="warning" style="font-weight: bold; background-image: linear-gradient(90deg, #67c23a 0%, #e1f3d8 100%); color: #fff; padding: 2px; border-radius: 2px; font-size: 10px;" effect="dark">心理学SVIP</el-tag>`);
}
// 3. 普通VIP标签确保不重复显示SVIP相关的类型
vipTypes
.filter(type => vipMap[type] && !(
(hasMedicalSVip && [4, 5, 6].includes(type)) || // 医学SVIP已显示排除 4、5、6
(hasPsychologySVip && [7, 8].includes(type)) // 心理学SVIP已显示排除 7、8
))
.forEach(type => {
tags.push(`<el-tag size="mini" type="info" style="font-weight: bold; color: #fff; padding: 2px; border-radius: 2px; font-size: 10px; background: #409EFF;" effect="dark">${vipMap[type]}</el-tag>`);
});
return tags.join(' ');
},

View File

@@ -456,32 +456,47 @@ export default {
8: '心理学VIP'
};
const vipTypes = userVips.map(vip => vip.type);
const isMedicalVip = [4, 5, 6].every(type => vipTypes.includes(type));
const isPsychologyVip = [7,8].every(type => vipTypes.includes(type));
// 特殊情况:医学 + 心理学
if (isMedicalVip && isPsychologyVip) {
return `<el-tag size="mini" type="warning" style="font-weight: bold; background-image: linear-gradient(90deg, #ff1f00 0%, #fa9f93 100%); color: #fff; padding: 2px; border-radius: 2px; font-size: 10px;" effect="dark">医学SVIP</el-tag><br/>
<el-tag size="mini" type="warning" style="font-weight: bold; background-image: linear-gradient(90deg, #67c23a 0%, #e1f3d8 100%); color: #fff; padding: 2px; border-radius: 2px; font-size: 10px;" effect="dark">国学与心理学SVIP</el-tag>`;
}
// 只有医学VIP
if (isMedicalVip) {
return `<el-tag size="mini" type="warning" style="font-weight: bold; background-image: linear-gradient(90deg, #ff1f00 0%, #fa9f93 100%); color: #fff; padding: 2px; border-radius: 2px; font-size: 10px;" effect="dark">医学超级VIP</el-tag>`;
// 将 userVips 转为数组形式,以便处理(如果是数字则转为数字数组)
let vipTypes = [];
if (typeof userVips === 'number') {
vipTypes = String(userVips).split('').map(Number); // 数字转为数组
} else {
vipTypes = userVips.map(vip => vip.type); // 如果是对象数组,获取每个对象的 type
}
// 只有心理学VIP
if (isPsychologyVip) {
return `<el-tag size="mini" type="warning" style="font-weight: bold; background-image: linear-gradient(90deg, #67c23a 0%, #e1f3d8 100%); color: #fff; padding: 2px; border-radius: 2px; font-size: 10px;" effect="dark">国学与心理学超级VIP</el-tag>`;
// 判断是否同时包含 4、5、6医学SVIP
const hasMedicalSVip = [4, 5, 6].every(type => vipTypes.includes(type));
// 判断是否同时包含 7、8心理学SVIP
const hasPsychologySVip = [7, 8].every(type => vipTypes.includes(type));
const tags = [];
// 1. 医学SVIP只显示一次
if (hasMedicalSVip) {
tags.push(`<el-tag size="mini" type="warning" style="font-weight: bold; background-image: linear-gradient(90deg, #ff1f00 0%, #fa9f93 100%); color: #fff; padding: 2px; border-radius: 2px; font-size: 10px;" effect="dark">医学SVIP</el-tag>`);
}
// **普通情况**:单独展示所有 `type` 对应的内容
return vipTypes
.filter(type => vipMap[type]) // 过滤出有对应名称的类型
.map(type => `<el-tag size="mini" type="info" style="font-weight: bold; color: #fff; padding: 2px; border-radius: 2px; font-size: 10px; background: #409EFF;" effect="dark">${vipMap[type]}</el-tag>`)
.join(' ');
},
// 2. 心理学SVIP只显示一次
if (hasPsychologySVip) {
tags.push(`<el-tag size="mini" type="warning" style="font-weight: bold; background-image: linear-gradient(90deg, #67c23a 0%, #e1f3d8 100%); color: #fff; padding: 2px; border-radius: 2px; font-size: 10px;" effect="dark">心理学SVIP</el-tag>`);
}
// 3. 普通VIP标签确保不重复显示SVIP相关的类型
vipTypes
.filter(type => vipMap[type] && !(
(hasMedicalSVip && [4, 5, 6].includes(type)) || // 医学SVIP已显示排除 4、5、6
(hasPsychologySVip && [7, 8].includes(type)) // 心理学SVIP已显示排除 7、8
))
.forEach(type => {
tags.push(`<el-tag size="mini" type="info" style="font-weight: bold; color: #fff; padding: 2px; border-radius: 2px; font-size: 10px; background: #409EFF;" effect="dark">${vipMap[type]}</el-tag>`);
});
return tags.join(' ');
}
,
getVipMoney(data) {
console.log("data at line 420:", data.id);

View File

@@ -200,31 +200,42 @@ export default {
8: '心理学VIP'
};
const vipTypes = userVips.map(vip => vip.type);
const isMedicalVip = [4, 5, 6].every(type => vipTypes.includes(type));
const isPsychologyVip = [7,8].every(type => vipTypes.includes(type));
// 特殊情况:医学 + 心理学
if (isMedicalVip && isPsychologyVip) {
return `<el-tag size="mini" type="warning" style="font-weight: bold; background-image: linear-gradient(90deg, #ff1f00 0%, #fa9f93 100%); color: #fff; padding: 2px; border-radius: 2px; font-size: 11px;" effect="dark">医学SVIP</el-tag><br/>
<el-tag size="mini" type="warning" style="font-weight: bold; background-image: linear-gradient(90deg, #67c23a 0%, #e1f3d8 100%); color: #fff; padding: 2px; border-radius: 2px; font-size: 11px;" effect="dark">国学与心理学SVIP</el-tag>`;
}
// 只有医学VIP
if (isMedicalVip) {
return `<el-tag size="mini" type="warning" style="font-weight: bold; background-image: linear-gradient(90deg, #ff1f00 0%, #fa9f93 100%); color: #fff; padding: 2px; border-radius: 2px; font-size: 11px;" effect="dark">医学超级VIP</el-tag>`;
// 将 userVips 转为数组形式,以便处理(如果是数字则转为数字数组)
let vipTypes = [];
if (typeof userVips === 'number') {
vipTypes = String(userVips).split('').map(Number); // 数字转为数组
} else {
vipTypes = userVips.map(vip => vip.type); // 如果是对象数组,获取每个对象的 type
}
// 只有心理学VIP
if (isPsychologyVip) {
return `<el-tag size="mini" type="warning" style="font-weight: bold; background-image: linear-gradient(90deg, #67c23a 0%, #e1f3d8 100%); color: #fff; padding: 2px; border-radius: 2px; font-size: 11px;" effect="dark">国学与心理学超级VIP</el-tag>`;
// 判断是否同时包含 4、5、6医学SVIP
const hasMedicalSVip = [4, 5, 6].every(type => vipTypes.includes(type));
// 判断是否同时包含 7、8心理学SVIP
const hasPsychologySVip = [7, 8].every(type => vipTypes.includes(type));
const tags = [];
// 1. 医学SVIP只显示一次
if (hasMedicalSVip) {
tags.push(`<el-tag size="mini" type="warning" style="font-weight: bold; background-image: linear-gradient(90deg, #ff1f00 0%, #fa9f93 100%); color: #fff; padding: 2px; border-radius: 2px; font-size: 10px;" effect="dark">医学SVIP</el-tag>`);
}
// **普通情况**:单独展示所有 `type` 对应的内容
return vipTypes
.filter(type => vipMap[type]) // 过滤出有对应名称的类型
.map(type => `<el-tag size="mini" type="info" style="font-weight: bold; color: #fff; padding: 2px; border-radius: 2px; font-size: 11px; background: #409EFF;" effect="dark">${vipMap[type]}</el-tag>`)
.join(' ');
// 2. 心理学SVIP只显示一次
if (hasPsychologySVip) {
tags.push(`<el-tag size="mini" type="warning" style="font-weight: bold; background-image: linear-gradient(90deg, #67c23a 0%, #e1f3d8 100%); color: #fff; padding: 2px; border-radius: 2px; font-size: 10px;" effect="dark">心理学SVIP</el-tag>`);
}
// 3. 普通VIP标签确保不重复显示SVIP相关的类型
vipTypes
.filter(type => vipMap[type] && !(
(hasMedicalSVip && [4, 5, 6].includes(type)) || // 医学SVIP已显示排除 4、5、6
(hasPsychologySVip && [7, 8].includes(type)) // 心理学SVIP已显示排除 7、8
))
.forEach(type => {
tags.push(`<el-tag size="mini" type="info" style="font-weight: bold; color: #fff; padding: 2px; border-radius: 2px; font-size: 10px; background: #409EFF;" effect="dark">${vipMap[type]}</el-tag>`);
});
return tags.join(' ');
},
// 获取列表数据
getDataList () {