This commit is contained in:
2025-06-15 20:47:27 +08:00
parent a5643868aa
commit 3fc63deb31
6 changed files with 61 additions and 36 deletions
+17
View File
@@ -47,6 +47,23 @@ async def get_skills_list(redis: RedisDep, skillName: Annotated[str, Param(...,
return response(data=data) return response(data=data)
@router.get('/{jobId}/{jobGrowId}/skills/', operation_id='skillsByJob')
async def get_cn_skills_by_job(redis: RedisDep, jobId: Annotated[str, Path(..., description='职业')], jobGrowId: Annotated[str, Path(..., description='转职')]) -> SkillsListResponse:
"""
获取职业技能列表
"""
key = f'openapi:{jobId}:{jobGrowId}:skills'
def get_skills_by_job():
# This function should retrieve the skills by job and jobGrow
# For now, we return a placeholder list
with open(f'./openapi/data/{jobId}/{jobGrowId}/cn/skill_tree.json', encoding='utf-8') as f:
skills_data = json.load(f)
return skills_data
skills_list = get_redis_info(redis, key, get_skills_by_job)
return response(data=skills_list)
@router.get('/{jobId}/{jobGrowId}/{skillId}/', operation_id='skillDetail') @router.get('/{jobId}/{jobGrowId}/{skillId}/', operation_id='skillDetail')
async def get_cn_skill_info(redis: RedisDep, jobId: Annotated[str, Path(..., description='职业')], jobGrowId: Annotated[str, Path(..., description='转职')], skillId: Annotated[str, Path(..., description='技能')], level: Annotated[int, Param(..., description='技能等级')] = None) -> SkillDetailResponse: async def get_cn_skill_info(redis: RedisDep, jobId: Annotated[str, Path(..., description='职业')], jobGrowId: Annotated[str, Path(..., description='转职')], skillId: Annotated[str, Path(..., description='技能')], level: Annotated[int, Param(..., description='技能等级')] = None) -> SkillDetailResponse:
""" """
@@ -20,11 +20,11 @@ const value = defineModel<string>()
const rarities = [ const rarities = [
{ {
value: '稀有', value: '稀有',
background: '#d06eff', background: '#9879da',
}, },
{ {
value: '神器', value: '神器',
background: '#fe11ff', background: '#ef28c1',
}, },
{ {
value: '传说', value: '传说',
@@ -32,11 +32,11 @@ const rarities = [
}, },
{ {
value: '史诗', value: '史诗',
background: '#feca11', background: '#fcb600',
}, },
{ {
value: '太初', value: '太初',
background: 'linear-gradient(180deg, #70faa7 0%, #7bfefe 100%)', background: 'linear-gradient(to bottom, #58fa84 20%, #58decc 40%, #58c6ff 60%)',
}, },
] ]
+1 -1
View File
@@ -14,7 +14,7 @@
> >
<RouterView></RouterView> <RouterView></RouterView>
</div> </div>
<div class="m-1 ml-auto h-auto overflow-x-auto z-2 box-border"> <div class="m-1 ml-auto h-auto z-2 box-border">
<Result></Result> <Result></Result>
</div> </div>
</div> </div>
@@ -60,10 +60,11 @@ export default defineComponent({
const desc = computed(() => skillInfo.value?.descDetail.split('\n')) const desc = computed(() => skillInfo.value?.descDetail.split('\n'))
const detail = computed(() => { const detail = computed(() => {
const items = skillInfo.value?.attribute.optionDesc?.split('\n').filter((item) => !!item) ?? [] const items =
skillInfo.value?.attribute.optionDesc?.split('\n').filter((item) => !!item) ?? []
const details = items?.map((a) => { const details = items?.map((a) => {
const beforeReplace = a.match(/^(.+?\s*:\s*[^\{]+)(\{value\d+\}.*)$/) const beforeReplace = a.match(/^(.+?\s*:\s*[^\{]+)(\{value\d+\}.*)$/)
if(beforeReplace) { if (beforeReplace) {
a = `${beforeReplace[1]}<span class="skill_info_value">${beforeReplace[2]}</span>` a = `${beforeReplace[1]}<span class="skill_info_value">${beforeReplace[2]}</span>`
} }
const matches = a.match(/{([^}]+)}/g) const matches = a.match(/{([^}]+)}/g)
@@ -74,10 +75,7 @@ export default defineComponent({
if (/^value.+/.test(key)) { if (/^value.+/.test(key)) {
const value = skillInfo.value?.attribute.optionValue[key as `value${string}`] ?? '-' const value = skillInfo.value?.attribute.optionValue[key as `value${string}`] ?? '-'
if (value) { if (value) {
a = a.replace( a = a.replace(match, `<span style="padding:0px 2px;color:#4AA256">${value}</span>`)
match,
`<span style="padding:0px 2px;color:#4AA256">${value}</span>`,
)
} }
} }
}) })
@@ -104,19 +102,29 @@ export default defineComponent({
<div class="skill_title">技能描述</div> <div class="skill_title">技能描述</div>
<div class="h-auto max-h-250px"> <div class="h-auto max-h-250px">
<div class="h-full overflow-y-auto bg-#161816 p-2px"> <div class="h-full overflow-y-auto bg-#161816 p-2px">
{desc.value?.map((item) => item.startsWith("[") ? (<div class="min-h-10px">{item}</div>) :( {desc.value?.map((item) =>
<div class="min-h-10px" style="text-indent:20px;">{item}</div> item.startsWith('[') ? (
))} <div class="min-h-10px">{item}</div>
</div> ) : (
</div> <div class="min-h-10px" style="text-indent:20px;">
<div class="skill_title">技能属性</div> {item}
<div class="flex-1 overflow-y-auto"> </div>
<div class=" flex flex-col gap-2px"> ),
{detail.value?.map((item) => ( )}
<div class="flex justify-between item items-center" v-html={item}></div>
))}
</div> </div>
</div> </div>
{(detail.value.length > 0 ) && (
<>
<div class="skill_title">技能属性</div>
<div class="flex-1 overflow-y-auto">
<div class=" flex flex-col gap-2px">
{detail.value.map((item) => (
<div class="flex justify-between item items-center" v-html={item}></div>
))}
</div>
</div>
</>
)}
</> </>
) )
@@ -126,15 +134,15 @@ export default defineComponent({
<div class="h-full flex flex-col gap-5px"> <div class="h-full flex flex-col gap-5px">
{skillInfo.value?.evolution?.map((item) => ( {skillInfo.value?.evolution?.map((item) => (
<> <>
<div class="flex flex-col gap-2px"> <div class="flex flex-col gap-2px">
<div class="skill_vp_title">{item.name}</div> <div class="skill_vp_title">{item.name}</div>
<div class="skill_title">技能描述</div> <div class="skill_title">技能描述</div>
<div class="h-auto max-h-200px"> <div class="h-auto max-h-200px">
<div class="h-full bg-#161816 p-2px" style="white-space: pre-wrap;"> <div class="h-full bg-#161816 p-2px" style="white-space: pre-wrap;">
{item.descDetail} {item.descDetail}
</div>
</div> </div>
</div> </div>
</div>
</> </>
))} ))}
</div> </div>
@@ -144,7 +152,7 @@ export default defineComponent({
onMounted(() => { onMounted(() => {
watchEffect(() => { watchEffect(() => {
(skillInfo.value?.evolution?.length ?? 0) == 0 && (curTab.value = 0) ;(skillInfo.value?.evolution?.length ?? 0) == 0 && (curTab.value = 0)
}) })
}) })
+1 -1
View File
@@ -50,7 +50,7 @@
</div> </div>
<div <div
class="absolute right--60px" class="absolute right--65px"
v-if="curCurrentSkill.skillId && curCurrentSkill.level > 0 && !showSkillDetail" v-if="curCurrentSkill.skillId && curCurrentSkill.level > 0 && !showSkillDetail"
> >
<div class="text-#AE8D5A p-1px box-border flex pl-2 w-auto"> <div class="text-#AE8D5A p-1px box-border flex pl-2 w-auto">
+5 -5
View File
@@ -282,16 +282,16 @@ body,
color: #68d5ed; color: #68d5ed;
} }
.rare { .rare {
color: #b36bff; color: #9879da;
} }
.artifact { .artifact {
color: #ff00ff; color: #ef28c1;
} }
.legend { .legend {
color: #e96e00; color: #ff7700;
} }
.epic { .epic {
color: #ffb400; color: #fcb600;
} }
.chronicle { .chronicle {
color: #ff6666; color: #ff6666;
@@ -314,7 +314,7 @@ body,
} }
.primeval { .primeval {
background-image: -webkit-linear-gradient(top, #28d931, #33acea); background-image: linear-gradient(to bottom, #5aff62, #58c6ff);
color: transparent; color: transparent;
background-clip: text; background-clip: text;
text-shadow: none; text-shadow: none;