This commit is contained in:
Putoo
2026-06-16 18:30:53 +08:00
parent 5d4b5c989a
commit 5cd6151b96
14 changed files with 413 additions and 57 deletions

View File

@@ -0,0 +1,8 @@
namespace Application.Domain.Entity;
public class UserEquSuit
{
public string suitCode { get; set; }
public string suitName { get; set; }
public List<EquSuitAttr> SuitAttr { get; set; }
}

View File

@@ -21,5 +21,11 @@ public static class EquEnum
Ornaments = 3, //佩戴 Ornaments = 3, //佩戴
Fashion = 1, //时装 Fashion = 1, //时装
Wing = 1, //羽翼 Wing = 1, //羽翼
Decorate = 5, //装饰
}
public enum SuitAttrNeedType
{
ON_EQU
} }
} }

View File

@@ -13,6 +13,7 @@ public interface IGameEquService
RefAsync<int> Total, bool isRemOn = false); RefAsync<int> Total, bool isRemOn = false);
Task<List<unit_user_equ>> GetUserEquData(string userId, int equId); Task<List<unit_user_equ>> GetUserEquData(string userId, int equId);
Task<List<unit_user_equ>> GetUserEquData(string userId, string code, List<string> noUeId);
Task<unit_user_equ> GetUserEquInfo(string ueId); Task<unit_user_equ> GetUserEquInfo(string ueId);
Task<int> GetUserEquByEquIdCount(string userId, int equId); Task<int> GetUserEquByEquIdCount(string userId, int equId);
Task<List<unit_user_equ>> GetUserEquByEquId(string userId, int equId); Task<List<unit_user_equ>> GetUserEquByEquId(string userId, int equId);
@@ -28,6 +29,7 @@ public interface IGameEquService
Task<List<unit_user_equ>> GetUserOnEqu(string userId); Task<List<unit_user_equ>> GetUserOnEqu(string userId);
Task<bool> EquOnOrDown(unit_user_equ data, int state); Task<bool> EquOnOrDown(unit_user_equ data, int state);
Task<List<UserEquSuit>> GetUserEquSuit(string userId);
#endregion #endregion
#region #region

View File

@@ -56,11 +56,18 @@ public class GameEquService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
public async Task<List<unit_user_equ>> GetUserEquData(string userId, int equId) public async Task<List<unit_user_equ>> GetUserEquData(string userId, int equId)
{ {
long onTime = TimeExtend.GetTimeStampSeconds;
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_equ>(); var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_equ>();
return await db.Queryable<unit_user_equ>().Where(it => it.userId == userId && it.equId == equId).ToListAsync(); return await db.Queryable<unit_user_equ>().Where(it => it.userId == userId && it.equId == equId).ToListAsync();
} }
public async Task<List<unit_user_equ>> GetUserEquData(string userId, string code, List<string> noUeId)
{
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_equ>();
return await db.Queryable<unit_user_equ>().Where(it => it.userId == userId && it.code == code)
.WhereIF(noUeId.Count > 0, it => !noUeId.Contains(it.ueId))
.ToListAsync();
}
public async Task<unit_user_equ> GetUserEquInfo(string ueId) public async Task<unit_user_equ> GetUserEquInfo(string ueId)
{ {
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_equ>(); var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_equ>();
@@ -325,6 +332,15 @@ public class GameEquService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
} }
} }
private async Task ClearUserOnEqu(string userId)
{
var key = string.Format(UserCache.BaseCacheKeys, "EquData", "UserOnEqu");
await redis.DelHashAsync(key, userId);
//清理套装缓存
key = string.Format(UserCache.BaseCacheKeys, "EquData:UserEquSuit", userId);
await redis.DelAsync(key);
}
public async Task<bool> EquOnOrDown(unit_user_equ data, int state) public async Task<bool> EquOnOrDown(unit_user_equ data, int state)
{ {
data.isOn = state; data.isOn = state;
@@ -337,18 +353,81 @@ public class GameEquService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
data.useEndTime = TimeExtend.GetTimeStampBySeconds(DateTime.Now.AddDays((int)equInfo.useTime)); data.useEndTime = TimeExtend.GetTimeStampBySeconds(DateTime.Now.AddDays((int)equInfo.useTime));
} }
} }
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_equ>(); var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_equ>();
bool result = await db.Updateable(data).ExecuteCommandAsync() > 0; bool result = await db.Updateable(data).ExecuteCommandAsync() > 0;
if (result) if (result)
{ {
await ClearUserOnEqu(data.userId);
} }
return result; return result;
} }
/// <summary>
/// 获取个人套装
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
public async Task<List<UserEquSuit>> GetUserEquSuit(string userId)
{
List<UserEquSuit> result = new List<UserEquSuit>();
long time = TimeExtend.GetTimeStampSeconds;
var key = string.Format(UserCache.BaseCacheKeys, "EquData:UserEquSuit", userId);
if (await redis.ExistsAsync(key))
{
result = await redis.GetAsync<List<UserEquSuit>>(key);
}
else
{
List<string> opSuit = new List<string>();
var onEquData = await GetUserOnEqu(userId);
string[] onEqu = onEquData.Select(it => it.equId.ToString()).ToArray();
onEquData = onEquData.FindAll(it => it.useEndTime > time && it.durability > 0);
foreach (var item in onEquData)
{
if (item.suitCode != "0" && !string.IsNullOrEmpty(item.suitCode))
{
if (!opSuit.Contains(item.suitCode))
{
opSuit.Add(item.suitCode);
}
}
}
foreach (var suit in opSuit)
{
UserEquSuit temp = new UserEquSuit();
var suitInfo = await GetEuqSuitInfo(suit);
if (suitInfo != null)
{
temp.suitCode = suitInfo.suitCode;
temp.suitName = suitInfo.suitName;
temp.SuitAttr = new List<EquSuitAttr>();
foreach (var item in suitInfo.attr)
{
if (item.NeedType == nameof(EquEnum.SuitAttrNeedType.ON_EQU))
{
bool same = item.NeedData.All(item => onEqu.Contains(item));
if (same)
{
temp.SuitAttr.Add(item);
}
}
}
if (temp.SuitAttr.Count > 0) //存在满足条件得属性
{
result.Add(temp);
}
}
}
await redis.SetAsync(key, result, 300);
}
return result;
}
#endregion #endregion

View File

@@ -138,7 +138,8 @@ public class EquController : ControllerBase
{ {
string userId = StateHelper.userId; string userId = StateHelper.userId;
var data = await _equService.GetUserOnEqu(userId); var data = await _equService.GetUserOnEqu(userId);
return PoAction.Ok(data); var suit = await _equService.GetUserEquSuit(userId);
return PoAction.Ok(new { data, suit });
} }
/// <summary> /// <summary>
@@ -200,6 +201,7 @@ public class EquController : ControllerBase
return PoAction.Message($"该装备最多穿戴{equInfo.canEqualUp}件!"); return PoAction.Message($"该装备最多穿戴{equInfo.canEqualUp}件!");
} }
} }
bool isOk = true; bool isOk = true;
if (string.IsNullOrEmpty(de)) if (string.IsNullOrEmpty(de))
{ {
@@ -222,6 +224,7 @@ public class EquController : ControllerBase
{ {
return PoAction.Message("装备未穿戴!"); return PoAction.Message("装备未穿戴!");
} }
if (DownOnEqu.code != equInfo.code) if (DownOnEqu.code != equInfo.code)
{ {
return PoAction.Message("装备部位不一致!"); return PoAction.Message("装备部位不一致!");
@@ -261,5 +264,81 @@ public class EquController : ControllerBase
} }
} }
/// <summary>
/// 获取可穿戴装备
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
[HttpGet]
public async Task<IPoAction> GetCanOnEqu(int type)
{
string code = nameof(EquEnum.EquPlace.Hold);
switch (type)
{
case 1:
code = nameof(EquEnum.EquPlace.Hold);
break;
case 2:
code = nameof(EquEnum.EquPlace.Vice);
break;
case 3:
code = nameof(EquEnum.EquPlace.Head);
break;
case 4:
code = nameof(EquEnum.EquPlace.Wear);
break;
case 5:
code = nameof(EquEnum.EquPlace.Waist);
break;
case 6:
code = nameof(EquEnum.EquPlace.Foot);
break;
case 7:
code = nameof(EquEnum.EquPlace.Ornaments);
break;
case 8:
code = nameof(EquEnum.EquPlace.Fashion);
break;
case 9:
code = nameof(EquEnum.EquPlace.Wing);
break;
case 10:
code = nameof(EquEnum.EquPlace.Decorate);
break;
}
string userId = StateHelper.userId;
var userOnEqu = await _equService.GetUserOnEqu(userId);
var NoEqu = userOnEqu.FindAll(it => it.code == code).Select(it => it.ueId).ToList();
var CanEqu = await _equService.GetUserEquData(userId, code, NoEqu);
long onTime = TimeExtend.GetTimeStampSeconds;
CanEqu = CanEqu.FindAll(it => it.isAppr == 1 && it.useEndTime > onTime);
CanEqu = CanEqu.OrderByDescending(it => it.lev).ToList();
return PoAction.Ok(CanEqu);
}
/// <summary>
/// 获取激活套装属性
/// </summary>
/// <param name="suitCode"></param>
/// <returns></returns>
[HttpGet]
public async Task<IPoAction> GetUserOnSuitInfo(string suitCode)
{
var userId = StateHelper.userId;
var onSuit = await _equService.GetUserEquSuit(userId);
var suit = onSuit.Find(it => it.suitCode == suitCode);
if (suit == null)
{
return PoAction.Message("套装不存在!");
}
var data = await _equService.GetEuqSuitInfo(suitCode);
if (data == null)
{
return PoAction.Message("套装不存在!");
}
return PoAction.Ok(new { data, suit });
}
} }

View File

@@ -33,7 +33,6 @@ public class BagController : ControllerBase
public async Task<IPoAction> GetUserBagData() public async Task<IPoAction> GetUserBagData()
{ {
string userId = StateHelper.userId; string userId = StateHelper.userId;
var accInfo = await _accService.GetUserAccInfo(userId); var accInfo = await _accService.GetUserAccInfo(userId);
long gold = (long)accInfo.gold; long gold = (long)accInfo.gold;
long cowry = (long)accInfo.cowry; long cowry = (long)accInfo.cowry;
@@ -76,13 +75,13 @@ public class BagController : ControllerBase
} }
var data = await _equService.GetUserEquData(userId, _t, query, page, 10, total); var data = await _equService.GetUserEquData(userId, _t, query, page, 10, total);
return PoAction.Ok(new { data, total.Value }); return PoAction.Ok(new { data, total = total.Value});
} }
else if (type == 1) else if (type == 1)
{ {
List<string> code = new List<string>() { nameof(GoodsEnum.Code.Drug) }; List<string> code = new List<string>() { nameof(GoodsEnum.Code.Drug) };
var data = await _goodsService.GetUserGoodsData(userId, code, new List<string>(), query, page, 10, total); var data = await _goodsService.GetUserGoodsData(userId, code, new List<string>(), query, page, 10, total);
return PoAction.Ok(new { data, total.Value }); return PoAction.Ok(new { data, total = total.Value });
} }
else if (type == 2) else if (type == 2)
{ {
@@ -120,11 +119,11 @@ public class BagController : ControllerBase
} }
var data = await _goodsService.GetUserGoodsData(userId, code, noCode, query, page, 10, total); var data = await _goodsService.GetUserGoodsData(userId, code, noCode, query, page, 10, total);
return PoAction.Ok(new { data, total.Value }); return PoAction.Ok(new { data, total = total.Value });
} }
else else
{ {
return PoAction.Ok(new { data = new List<string>(), total.Value }); return PoAction.Ok(new { data = new List<string>(), total = total.Value });
} }
} }
} }

View File

@@ -0,0 +1,21 @@
<template>
<span v-if="showUrl == false">
{{ equData.equName }}({{ equData.lev }})
</span>
<router-link v-if="showUrl" :to='"/prop/equ?ue=" + equData.ueId'>
{{ equData.equName }}({{ equData.lev }})
</router-link>
</template>
<script setup lang="ts">
// 1. 定义接收父组件传来的参数 props
const props = defineProps({
showUrl: {
type: Boolean,
default: false
},
equData: {
type: Object,
default: () => ({})
}
})
</script>

View File

@@ -17,7 +17,10 @@
const props = defineProps({ const props = defineProps({
// 字段名、类型、默认值 // 字段名、类型、默认值
isShow: Boolean, isShow: {
type: Boolean,
default: false
},
title: String title: String
}) })
const visible = ref(props.isShow) const visible = ref(props.isShow)

View File

@@ -2,8 +2,8 @@
统一配置中心 统一配置中心
*/ */
export class BaseConfig { export class BaseConfig {
public static BaseUrl: string = 'https://192.168.0.142:7198' public static BaseUrl: string = 'https://localhost:7198'
public static BaseMediaUrl: string = 'https://192.168.0.142:7198' public static BaseMediaUrl: string = 'https://localhost:7198/'
// public static BaseUrl:string="http://kx.iyba.cn:5291"; // public static BaseUrl:string="http://kx.iyba.cn:5291";
// public static BaseMediaUrl:string="http://kx.iyba.cn:5291"; // public static BaseMediaUrl:string="http://kx.iyba.cn:5291";
} }

View File

@@ -55,7 +55,6 @@
</span> </span>
部位:{{ EquTool.GetEquPlaceName(equData.code) }}<br> 部位:{{ EquTool.GetEquPlaceName(equData.code) }}<br>
等级:{{ equData.lev }}<br> 等级:{{ equData.lev }}<br>
品阶:{{ EquTool.EquStartTips(equData.start) }}<br>
<span v-if="equData.quality > 0"> <span v-if="equData.quality > 0">
品质:<Abar href="">equData.qualityName</Abar><br> 品质:<Abar href="">equData.qualityName</Abar><br>
</span> </span>
@@ -119,14 +118,11 @@
<span> <span>
<Abutton @click="UpOrDownEqu">{{ equData.isOn == 1 ? "卸下装备" : "穿戴装备" }}</Abutton><br> <Abutton @click="UpOrDownEqu">{{ equData.isOn == 1 ? "卸下装备" : "穿戴装备" }}</Abutton><br>
</span> </span>
<span>
<Abutton>洗练</Abutton><br>
</span>
<span> <span>
<Abutton>觉醒</Abutton><br> <Abutton>觉醒</Abutton><br>
</span> </span>
<span> <span>
<Abutton>升星</Abutton><br> <Abutton>洗练</Abutton><br>
</span> </span>
<span> <span>
<Abutton @click="LockEqu">{{ equData.isLock == 0 ? "绑定" : "解绑" }}</Abutton><br> <Abutton @click="LockEqu">{{ equData.isLock == 0 ? "绑定" : "解绑" }}</Abutton><br>

View File

@@ -50,7 +50,7 @@
<div class="item" v-for="(item, index) in data" :key="index"> <div class="item" v-for="(item, index) in data" :key="index">
{{ PageExtend.GetPageIndex(currentPage, 10, index + 1) }}. {{ PageExtend.GetPageIndex(currentPage, 10, index + 1) }}.
<Abar :href='"/prop/equ?ue=" + item.ueId'>{{ item.equName }}({{ item.lev }})</Abar> <Abar :href='"/prop/equ?ue=" + item.ueId'>{{ item.equName }}({{ item.lev }})</Abar>
<span v-if="item.isOn == 1">(穿)</span> <span v-if="item.isOn == 1">()</span>
<span v-if="item.isAppr == 0">(未鉴定)</span> <span v-if="item.isAppr == 0">(未鉴定)</span>
<span v-if="item.useEndTime < onTime" style="color: red;">(过期)</span> <span v-if="item.useEndTime < onTime" style="color: red;">(过期)</span>
<span v-if="item.durability < 1" style="color: red;">(损坏)</span> <span v-if="item.durability < 1" style="color: red;">(损坏)</span>
@@ -144,6 +144,7 @@ const BindData = async (): Promise<void> => {
/**切换背包 */ /**切换背包 */
const ChangeBag = async (_type: string): Promise<void> => { const ChangeBag = async (_type: string): Promise<void> => {
currentPage.value = 1;
type.value = _type; type.value = _type;
type_ch.value = '0'; type_ch.value = '0';
serch.value=''; serch.value='';
@@ -151,6 +152,7 @@ const ChangeBag = async (_type: string): Promise<void> => {
} }
const ChangeChildBag = async (ch: string): Promise<void> => { const ChangeChildBag = async (ch: string): Promise<void> => {
currentPage.value = 1;
type_ch.value = ch; type_ch.value = ch;
await BindData(); await BindData();
} }

View File

@@ -1,72 +1,76 @@
<template> <template>
<div class="content"> <div class="content">
手持: <Abutton>[+]</Abutton> 手持: <Abutton @click="chooseEqu(1, Hold)">[+]</Abutton>
<div class="item" v-for="item in Hold"> <div class="item" v-for="item in Hold">
<Abar :href='"/prop/equ?ue=" + item.ueId'>{{ item.equName }}({{ item.lev }})</Abar>[<Abutton <GameEqu :equ-data="item" :show-url="true"></GameEqu>[<Abutton @click="DownAndOnEqu(item.ueId, '')">卸下</Abutton>]
@click="DownEqu(item.ueId)">卸下</Abutton>]
</div> </div>
</div> </div>
<div class="content"> <div class="content">
副手: <Abutton>[+]</Abutton> 副手: <Abutton @click="chooseEqu(2, Vice)">[+]</Abutton>
<div class="item" v-for="item in Vice"> <div class="item" v-for="item in Vice">
<Abar :href='"/prop/equ?ue=" + item.ueId'>{{ item.equName }}({{ item.lev }})</Abar>[<Abutton <GameEqu :equ-data="item" :show-url="true"></GameEqu>[<Abutton
@click="DownEqu(item.ueId)">卸下</Abutton>] @click="DownAndOnEqu(item.ueId, '')">卸下</Abutton>]
</div> </div>
</div> </div>
<div class="content"> <div class="content">
头戴: <Abutton>[+]</Abutton> 头戴: <Abutton @click="chooseEqu(3, Head)">[+]</Abutton>
<div class="item" v-for="item in Head"> <div class="item" v-for="item in Head">
<Abar :href='"/prop/equ?ue=" + item.ueId'>{{ item.equName }}({{ item.lev }})</Abar>[<Abutton <GameEqu :equ-data="item" :show-url="true"></GameEqu>[<Abutton
@click="DownEqu(item.ueId)">卸下</Abutton>] @click="DownAndOnEqu(item.ueId, '')">卸下</Abutton>]
</div> </div>
</div> </div>
<div class="content"> <div class="content">
身穿: <Abutton>[+]</Abutton> 身穿: <Abutton @click="chooseEqu(4, Wear)">[+]</Abutton>
<div class="item" v-for="item in Wear"> <div class="item" v-for="item in Wear">
<Abar :href='"/prop/equ?ue=" + item.ueId'>{{ item.equName }}({{ item.lev }})</Abar>[<Abutton <GameEqu :equ-data="item" :show-url="true"></GameEqu>[<Abutton
@click="DownEqu(item.ueId)">卸下</Abutton>] @click="DownAndOnEqu(item.ueId, '')">卸下</Abutton>]
</div> </div>
</div> </div>
<div class="content"> <div class="content">
腰带: <Abutton>[+]</Abutton> 腰带: <Abutton @click="chooseEqu(5, Waist)">[+]</Abutton>
<div class="item" v-for="item in Waist"> <div class="item" v-for="item in Waist">
<Abar :href='"/prop/equ?ue=" + item.ueId'>{{ item.equName }}({{ item.lev }})</Abar>[<Abutton <GameEqu :equ-data="item" :show-url="true"></GameEqu>[<Abutton
@click="DownEqu(item.ueId)">卸下</Abutton>] @click="DownAndOnEqu(item.ueId, '')">卸下</Abutton>]
</div> </div>
</div> </div>
<div class="content"> <div class="content">
脚穿: <Abutton>[+]</Abutton> 脚穿: <Abutton @click="chooseEqu(6, Foot)">[+]</Abutton>
<div class="item" v-for="item in Foot"> <div class="item" v-for="item in Foot">
<Abar :href='"/prop/equ?ue=" + item.ueId'>{{ item.equName }}({{ item.lev }})</Abar>[<Abutton <GameEqu :equ-data="item" :show-url="true"></GameEqu>[<Abutton
@click="DownEqu(item.ueId)">卸下</Abutton>] @click="DownAndOnEqu(item.ueId, '')">卸下</Abutton>]
</div> </div>
</div> </div>
<div class="content"> <div class="content">
佩戴: <Abutton>[+]</Abutton> 佩戴: <Abutton @click="chooseEqu(7, Ornaments)">[+]</Abutton>
<div class="item" v-for="item in Ornaments"> <div class="item" v-for="item in Ornaments">
<Abar :href='"/prop/equ?ue=" + item.ueId'>{{ item.equName }}({{ item.lev }})</Abar>[<Abutton <GameEqu :equ-data="item" :show-url="true"></GameEqu>[<Abutton
@click="DownEqu(item.ueId)">卸下</Abutton>] @click="DownAndOnEqu(item.ueId, '')">卸下</Abutton>]
</div> </div>
</div> </div>
<div class="content"> <div class="content">
时装: <Abutton>[+]</Abutton> 时装: <Abutton @click="chooseEqu(8, Fashion)">[+]</Abutton>
<div class="item" v-for="item in Fashion"> <div class="item" v-for="item in Fashion">
<Abar :href='"/prop/equ?ue=" + item.ueId'>{{ item.equName }}({{ item.lev }})</Abar>[<Abutton <GameEqu :equ-data="item" :show-url="true"></GameEqu>[<Abutton
@click="DownEqu(item.ueId)">卸下</Abutton>] @click="DownAndOnEqu(item.ueId, '')">卸下</Abutton>]
</div> </div>
</div> </div>
<div class="content"> <div class="content">
羽翼: <Abutton>[+]</Abutton> 羽翼: <Abutton @click="chooseEqu(9, Wing)">[+]</Abutton>
<div class="item" v-for="item in Wing"> <div class="item" v-for="item in Wing">
<Abar :href='"/prop/equ?ue=" + item.ueId'>{{ item.equName }}({{ item.lev }})</Abar>[<Abutton <GameEqu :equ-data="item" :show-url="true"></GameEqu>[<Abutton
@click="DownEqu(item.ueId)">卸下</Abutton>] @click="DownAndOnEqu(item.ueId, '')">卸下</Abutton>]
</div> </div>
</div> </div>
<div class="content"> <div class="content">
装饰: <Abutton>[+]</Abutton> 装饰: <Abutton @click="chooseEqu(10, Decorate)">[+]</Abutton>
<div class="item" v-for="item in Decorate"> <div class="item" v-for="item in Decorate">
<Abar :href='"/prop/equ?ue=" + item.ueId'>{{ item.equName }}({{ item.lev }})</Abar>[<Abutton <GameEqu :equ-data="item" :show-url="true"></GameEqu>[<Abutton
@click="DownEqu(item.ueId)">卸下</Abutton>] @click="DownAndOnEqu(item.ueId, '')">卸下</Abutton>]
</div>
</div>
<div class="content" v-if="suit.length > 0">
<div class="item" v-for="item in suit">
套装:<Abar :href='"/user/equ/suit?id=" + item.suitCode'>{{ item.suitName }}</Abar>
</div> </div>
</div> </div>
<div class="content"> <div class="content">
@@ -74,6 +78,37 @@
<Abar href="/">我的圣痕</Abar><br> <Abar href="/">我的圣痕</Abar><br>
<Abar href="/user/bag">装备物品</Abar> <Abar href="/user/bag">装备物品</Abar>
</div> </div>
<!-- 选择装备 -->
<GamePopup v-model:show="showChooseEqu" title="【选择装备】" style="min-width: 60%;">
<!-- 自定义内容 -->
<div class="content">
<div class="mapList" style="max-height: 300px;margin-top: 15px;">
<div v-for="(item, index) in equData" :key="index">
{{ index + 1 }}.
<Abutton @click="OnEqu(item.ueId)">
<GameEqu :equ-data="item" :show-url="false"></GameEqu>
</Abutton>
</div>
<span v-if="equData.length == 0">暂无装备.</span>
</div>
</div>
</GamePopup>
<GamePopup v-model:show="showChangeEqu" title="【替换装备】" style="min-width: 60%;">
<!-- 自定义内容 -->
<div class="content">
<div class="mapList" style="max-height: 300px;margin-top: 15px;">
<div v-for="(item, index) in changeData" :key="index">
{{ index + 1 }}.
<Abutton @click="ChangeEqu(item.ueId)">
<GameEqu :equ-data="item" :show-url="false"></GameEqu>
</Abutton>
</div>
<span v-if="changeData.length == 0">暂无装备.</span>
</div>
</div>
</GamePopup>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
definePageMeta({ definePageMeta({
@@ -81,6 +116,7 @@ definePageMeta({
middleware: middleware.loading middleware: middleware.loading
}) })
const data = ref<Array<any>>([]); const data = ref<Array<any>>([]);
const suit = ref<Array<any>>([]);
const Hold = ref<Array<any>>([]); const Hold = ref<Array<any>>([]);
const Vice = ref<Array<any>>([]); const Vice = ref<Array<any>>([]);
const Head = ref<Array<any>>([]); const Head = ref<Array<any>>([]);
@@ -91,12 +127,17 @@ const Ornaments = ref<Array<any>>([]);
const Fashion = ref<Array<any>>([]); const Fashion = ref<Array<any>>([]);
const Wing = ref<Array<any>>([]); const Wing = ref<Array<any>>([]);
const Decorate = ref<Array<any>>([]); const Decorate = ref<Array<any>>([]);
const showChooseEqu = ref(false);
const showChangeEqu = ref(false);
const equData = ref<Array<any>>([]);
const changeData = ref<Array<any>>([]);
const onUpEqu = ref('');
const BindData = async (): Promise<void> => { const BindData = async (): Promise<void> => {
let result = await EquService.GetUserOnEqu(); let result = await EquService.GetUserOnEqu();
if (result.code == 0) { if (result.code == 0) {
data.value = result.data; data.value = result.data.data;
suit.value = result.data.suit;
Hold.value = data.value.filter(it => it.code == 'Hold'); Hold.value = data.value.filter(it => it.code == 'Hold');
Vice.value = data.value.filter(it => it.code == 'Vice'); Vice.value = data.value.filter(it => it.code == 'Vice');
Head.value = data.value.filter(it => it.code == 'Head'); Head.value = data.value.filter(it => it.code == 'Head');
@@ -123,8 +164,44 @@ onMounted(async () => {
} }
}) })
const DownEqu = async (ueId: string) => { const DownAndOnEqu = async (ueId: string, de: string) => {
alert(ueId); MessageExtend.LoadingToast("操作中...");
let result = await EquService.DownOrUpEqu(ueId, de);
MessageExtend.LoadingClose();
if (result.code == 0) {
await BindData();
MessageExtend.Notify(result.msg, "success");
}
else if (result.code == 100) {
onUpEqu.value = ueId;
showChangeEqu.value = true;
}
else {
MessageExtend.ShowDialog("穿/卸装备", result.msg);
}
} }
const chooseEqu = async (type: number, data: Array<any>) => {
showChooseEqu.value = true;
changeData.value = data;
let result = await EquService.GetCanOnEqu(type);
if (result.code == 0) {
equData.value = result.data;
}
else {
MessageExtend.ShowDialog("装备提示", result.msg);
}
}
const OnEqu = async (ueId: string) => {
showChooseEqu.value = false;
await DownAndOnEqu(ueId, "");
}
const ChangeEqu = async (ueId: string) => {
showChangeEqu.value = false;
await DownAndOnEqu(onUpEqu.value, ueId);
}
</script> </script>

View File

@@ -0,0 +1,68 @@
<template>
<div class="content">
套装介绍
</div>
<div class="content">
套装名称{{ data.suitName }}<br>
套装介绍<span v-html="data.sign"></span><br>
</div>
<div class="content">
---套装部件---<br>
<div class="item" v-for="item in onEqu">
<Abar :href='"/prop/equ?id=" + item.equId'>{{ item.equName }}</Abar>
</div>
</div>
<div class="content">
---套装属性---<br>
<div v-for="item in suitAttr">
<div class="content" v-for="attr in item.attrItem">
<span>{{ item.type == 0 ? "✧" : "✡" }}</span>
<span>{{ attr.tip }}</span>
</div>
</div>
</div>
<div class="content">
---已激活属性---<br>
<div v-for="item in OnSuitAttr">
<div class="content" v-for="attr in item.attrItem">
<span>{{ item.type == 0 ? "✧" : "✡" }}</span>
<span>{{ attr.tip }}</span>
</div>
</div>
</div>
</template>
<script setup lang="ts">
definePageMeta({
layout: layout.default,
middleware: 'page-loading'
})
const data = ref<any>({});
const onEqu = ref<Array<any>>([]);
const suitAttr = ref<Array<any>>([]);
const OnSuitAttr = ref<Array<any>>([]);
onMounted(async () => {
try {
await BindData();
}
finally {
PageLoading.Close();
}
})
const BindData = async (): Promise<void> => {
let suitCode = PageExtend.QueryString("id");
let result = await EquService.GetUserOnSuitInfo(suitCode);
if (result.code == 0) {
data.value = result.data.data;
onEqu.value = data.value.onEqu;
suitAttr.value = data.value.attr;
OnSuitAttr.value = result.data.suit.suitAttr;
}
else {
MessageExtend.ShowDialog("提示", result.msg);
}
};
</script>

View File

@@ -38,4 +38,20 @@ export class EquService {
static async DownOrUpEqu(ueId: string, de: string) { static async DownOrUpEqu(ueId: string, de: string) {
return await ApiService.Request("get", "/Equ/DownOrUpEqu", { ueId, de }); return await ApiService.Request("get", "/Equ/DownOrUpEqu", { ueId, de });
} }
/**
* 获取可穿戴装备
* GET /Equ/GetCanOnEqu
*/
static async GetCanOnEqu(type: number) {
return await ApiService.Request("get", "/Equ/GetCanOnEqu", { type });
}
/**
* 获取激活套装属性
* GET /Equ/GetUserOnSuitInfo
*/
static async GetUserOnSuitInfo(suitCode: string) {
return await ApiService.Request("get", "/Equ/GetUserOnSuitInfo", { suitCode });
}
} }