修正多个默认角色时绑定只绑定一个问题

This commit is contained in:
Ctrlcvs 2023-05-06 19:21:37 +08:00
parent e69ff80ae3
commit 589106c055
2 changed files with 5 additions and 7 deletions

View File

@ -124,12 +124,6 @@ export default class apiTool {
} }
if (this.server.startsWith('os')) { if (this.server.startsWith('os')) {
urlMap.genshin.bbs_sign_info.url = 'https://hk4e-api-os.hoyoverse.com/event/sol/info'
urlMap.genshin.bbs_sign_info.query = `act_id=e202102251931481&region=${this.server}&uid=${this.uid}`
urlMap.genshin.bbs_sign_home.url = 'https://hk4e-api-os.hoyoverse.com/event/sol/home'
urlMap.genshin.bbs_sign_home.query = `act_id=e202102251931481&region=${this.server}&uid=${this.uid}`
urlMap.genshin.bbs_sign.url = 'https://hk4e-api-os.hoyoverse.com/event/sol/sign'
urlMap.genshin.bbs_sign.body = { act_id: 'e202102251931481', region: this.server, uid: this.uid }
urlMap.genshin.detail.url = 'https://sg-public-api.hoyolab.com/event/calculateos/sync/avatar/detail'// 角色天赋详情 urlMap.genshin.detail.url = 'https://sg-public-api.hoyolab.com/event/calculateos/sync/avatar/detail'// 角色天赋详情
urlMap.genshin.detail.query = `lang=zh-cn&uid=${this.uid}&region=${this.server}&avatar_id=${data.avatar_id}` urlMap.genshin.detail.query = `lang=zh-cn&uid=${this.uid}&region=${this.server}&avatar_id=${data.avatar_id}`
urlMap.genshin.avatarSkill.url = 'https://sg-public-api.hoyolab.com/event/calculateos/avatar/skill_list'// 查询未持有的角色天赋 urlMap.genshin.avatarSkill.url = 'https://sg-public-api.hoyolab.com/event/calculateos/avatar/skill_list'// 查询未持有的角色天赋

View File

@ -152,11 +152,14 @@ export default class User extends base {
res.data.list = res.data.list.filter(v => ['hk4e_cn', 'hkrpg_cn', 'hk4e_global'].includes(v.game_biz)) res.data.list = res.data.list.filter(v => ['hk4e_cn', 'hkrpg_cn', 'hk4e_global'].includes(v.game_biz))
} }
//避免同时多个默认展示角色时候只绑定一个
let is_chosen =false
/** 米游社默认展示的角色 */ /** 米游社默认展示的角色 */
for (let val of res.data.list) { for (let val of res.data.list) {
if (val.is_chosen) { if (val.is_chosen&&!is_chosen) {
this.uid = val.game_uid this.uid = val.game_uid
this.region_name = val.region_name this.region_name = val.region_name
is_chosen=true
} else { } else {
this.allUid.push({ this.allUid.push({
uid: val.game_uid, uid: val.game_uid,
@ -165,6 +168,7 @@ export default class User extends base {
} }
} }
if (!this.uid && res.data?.list?.length > 0) { if (!this.uid && res.data?.list?.length > 0) {
this.uid = res.data.list[0].game_uid this.uid = res.data.list[0].game_uid
this.region_name = res.data.list[0].region_name this.region_name = res.data.list[0].region_name