This commit is contained in:
Putoo
2026-07-18 13:11:48 +08:00
parent 723a6861a0
commit 37eb063f33
9 changed files with 315 additions and 100 deletions

View File

@@ -10,10 +10,10 @@
<Abutton @click="FightAtk">攻击</Abutton>
<span>&nbsp;.&nbsp;</span>
<span v-if="otAttr.code == 'Monster'">
<Abar :href='"/prop/monster?m=" + otAttr.viceId'>查看</Abar>
<Abar :href='"/prop/monster?m=" + otAttr.no'>查看</Abar>
</span>
<span v-else>
<Abar :href='"/user/user?no=" + otAttr.viceId'>查看</Abar>
<Abar :href='"/user/user?no=" + otAttr.no'>查看</Abar>
</span>
<span>&nbsp;.&nbsp;</span>
<Abutton @click="ExitFight">撤退({{ exitCopper }}铜贝)</Abutton>
@@ -68,6 +68,7 @@ const myDrug = ref<Array<any>>([]);
const myLoad = ref<Array<any>>([]);
const exitCopper = ref(0);
const coolTime = ref(0);
const fightKey = ref('');
let coolLock = false;//冷却锁
const coolTimer = ref(0);//冷却定时器
@@ -89,8 +90,8 @@ onUnmounted(() => {
})
/**加载方法 */
const BindData = async (data: string): Promise<void> => {
let result = await FightService.Fight(fightId, data);
const BindData = async (fig:string): Promise<void> => {
let result = await FightService.Fight(fightId, fig);
if (result.code == 0) {
myAttr.value = result.data.myAttr as IUserAttr;
otAttr.value = result.data.otAttr as IUserAttr;
@@ -100,7 +101,8 @@ const BindData = async (data: string): Promise<void> => {
coolTime.value = result.data.cool;
dataLock = false;
myHarm.value = result.data.myHarm;
otHarm.value = result.data.otHarm;
otHarm.value = result.data.otHarm;
fightKey.value = result.data.key;
}
else if (result.code == 100) {
PageExtend.RedirectTo("/fight/result?f=" + fightId);
@@ -150,10 +152,8 @@ const UseFightDrug = async (drugId: string) => {
/**攻击 */
const FightAtk = async () => {
if (coolLock == false && dataLock == false) {
StartCool();
let result = FightTool.FightHandle(myAttr.value, otAttr.value);
let data = JSON.stringify(result);
await BindData(data);
StartCool();
await BindData(fightKey.value);
}
}

View File

@@ -22,10 +22,10 @@ export class FightService {
* 战斗接口
* POST /Fight/Fight
* @param fightId body
* @param data body
* @param key body
*/
static async Fight(fightId: string, data: string) {
return await ApiService.Request("post", "/Fight/Fight", { fightId, data });
static async Fight(fightId: string, key: string) {
return await ApiService.Request("post", "/Fight/Fight", { fightId, key });
}
/**