12121
This commit is contained in:
@@ -10,10 +10,10 @@
|
||||
<Abutton @click="FightAtk">攻击</Abutton>
|
||||
<span> . </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> . </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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 });
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user