增加船只接口
This commit is contained in:
@@ -75,6 +75,8 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { StateHelper } from '../composables/StateHelper';
|
||||
|
||||
|
||||
definePageMeta({
|
||||
layout: layout.empty,
|
||||
|
||||
@@ -1,78 +1,78 @@
|
||||
<template>
|
||||
<div class="content">
|
||||
<img src="/images/logo.png" class="logo" />
|
||||
</div>
|
||||
<div class="content">
|
||||
<div class="common">
|
||||
<div class="input">
|
||||
昵称:<input name="nick" placeholder="输入昵称(1-12个长度字符)" maxlength="12" class="ipt" type="text"
|
||||
v-model="nick" />
|
||||
</div>
|
||||
<div class="input">
|
||||
性别:<select name="sex" class="ipt" v-model="sex">
|
||||
<option value="0">女</option>
|
||||
<option value="1">男</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input" v-if="isNeedCode">
|
||||
激活码:<input name="nick" placeholder="联系客服获取激活码" maxlength="50" class="ipt" type="text" v-model="code" />
|
||||
</div>
|
||||
<div class="input">
|
||||
<input type="button"" class=" btn btn-danger" value="注册角色" @click="SubRegInfo" />.
|
||||
<Abar href="/">返回首页</Abar>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="content">
|
||||
<img src="/images/logo.png" class="logo" />
|
||||
</div>
|
||||
<div class="content">
|
||||
<div class="common">
|
||||
<div class="input">
|
||||
昵称:<input name="nick" placeholder="输入昵称(1-12个长度字符)" maxlength="12" class="ipt" type="text"
|
||||
v-model="nick" />
|
||||
</div>
|
||||
<div class="input">
|
||||
性别:<select name="sex" class="ipt" v-model="sex">
|
||||
<option value="0">女</option>
|
||||
<option value="1">男</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input" v-if="isNeedCode">
|
||||
激活码:<input name="nick" placeholder="联系客服获取激活码" maxlength="50" class="ipt" type="text" v-model="code" />
|
||||
</div>
|
||||
<div class="input">
|
||||
<input type="button"" class=" btn btn-danger" value="注册角色" @click="SubRegInfo" />.
|
||||
<Abar href="/">返回首页</Abar>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
definePageMeta({
|
||||
layout: layout.empty,
|
||||
middleware: middleware.loading
|
||||
})
|
||||
definePageMeta({
|
||||
layout: layout.empty,
|
||||
middleware: middleware.loading
|
||||
})
|
||||
|
||||
const nick = ref('');
|
||||
const sex = ref(0);
|
||||
const code = ref('');
|
||||
const isNeedCode = ref(false);
|
||||
const data = ref<any>({});
|
||||
const nick = ref('');
|
||||
const sex = ref(0);
|
||||
const code = ref('');
|
||||
const isNeedCode = ref(false);
|
||||
const data = ref<any>({});
|
||||
|
||||
const SubRegInfo = async (): Promise<void> => {
|
||||
if (nick.value == null || nick.value == '') {
|
||||
MessageExtend.ShowToast("昵称不能为空!", "default");
|
||||
return;
|
||||
}
|
||||
MessageExtend.LoadingToast("注册中...");
|
||||
let result = await LoginService.RegisterInfo(nick.value, sex.value, code.value);
|
||||
MessageExtend.LoadingClose();
|
||||
if (result.code == 0) {
|
||||
PageExtend.Redirect("/map");
|
||||
}
|
||||
else {
|
||||
MessageExtend.ShowDialog("注册角色", result.msg);
|
||||
}
|
||||
}
|
||||
const SubRegInfo = async () : Promise<void> => {
|
||||
if (nick.value == null || nick.value == '') {
|
||||
MessageExtend.ShowToast("昵称不能为空!", "default");
|
||||
return;
|
||||
}
|
||||
MessageExtend.LoadingToast("注册中...");
|
||||
let result = await LoginService.RegisterInfo(nick.value, sex.value, code.value);
|
||||
MessageExtend.LoadingClose();
|
||||
if (result.code == 0) {
|
||||
PageExtend.Redirect("/map");
|
||||
}
|
||||
else {
|
||||
MessageExtend.ShowDialog("注册角色", result.msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
await BindData();
|
||||
}
|
||||
finally {
|
||||
PageLoading.Close();
|
||||
}
|
||||
})
|
||||
onMounted(async () => {
|
||||
try {
|
||||
|
||||
}
|
||||
finally {
|
||||
PageLoading.Close();
|
||||
}
|
||||
})
|
||||
|
||||
const BindData = async () => {
|
||||
let result = await PubService.GetOnAreaInfo();
|
||||
if (result.code == 0) {
|
||||
data.value = result.data;
|
||||
isNeedCode.value = result.data.isNeedCode == 1;
|
||||
}
|
||||
else {
|
||||
MessageExtend.ShowDialogEvent("提示", result.msg, () => {
|
||||
PageExtend.RedirectTo('/');
|
||||
});
|
||||
}
|
||||
const BindData = async () => {
|
||||
let result = await PubService.GetOnAreaInfo();
|
||||
if (result.code == 0) {
|
||||
data.value = result.data;
|
||||
isNeedCode.value = result.data.isNeedCode == 1;
|
||||
}
|
||||
else {
|
||||
MessageExtend.ShowDialogEvent("提示", result.msg, () => {
|
||||
PageExtend.RedirectTo('/');
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1 +1,58 @@
|
||||
<template></template>
|
||||
<template>
|
||||
<div class="content">【特殊属性】</div>
|
||||
<div class="content">
|
||||
<span>幸运:0%</span> <span>爆率:0%</span><br>
|
||||
<span>升空:0米</span> <span>下潜:0米</span>
|
||||
</div>
|
||||
<div class="content">【经验铜贝】</div>
|
||||
<div class="content">
|
||||
<span>普通经验:0%</span> <span>副本经验:0%</span><br>
|
||||
<span>铜贝增益:0%</span>
|
||||
</div>
|
||||
<div class="content">【基础属性】</div>
|
||||
<div class="content">
|
||||
<span>吸血:{{data.inBlood * 100}}%</span> <span>制裁:{{data.punish * 100}}%</span><br>
|
||||
<span>暴击:{{data.crit * 100}}%</span> <span>闪避:{{data.dodge * 100}}%</span><br>
|
||||
<span>免伤:{{data.noHarm * 100}}%</span> <span>额外伤害:{{data.harm_Add}}</span><br>
|
||||
<span>反弹:{{data.rebound * 100}}%</span> <span>抗反弹:{{data.reboundLess * 100}}%</span><br>
|
||||
<span>迟缓:{{data.slow * 100}}%</span> <span>抗迟缓:{{data.slowLess * 100}}%</span><br>
|
||||
<span>中毒:{{data.poison * 100}}%</span> <span>抗中毒:{{data.poisonLess * 100}}%</span><br>
|
||||
<span>诅咒:{{data.curse * 100}}%</span> <span>抗诅咒:{{data.curseLess * 100}}%</span><br>
|
||||
<span>弱化:{{data.weaken * 100}}%</span> <span>抗弱化:{{data.weakenLess * 100}}%</span><br>
|
||||
<span>致命:{{data.deadly * 100}}%</span> <span>抗致命:{{data.deadlyLess * 100}}%</span><br>
|
||||
<span>沮丧:{{data.depressed * 100}}%</span> <span>抗沮丧:{{data.depressedLess * 100}}%</span><br>
|
||||
<span>突破:{{data.breach * 100}}%</span> <span>抗突破:{{data.breachLess * 100}}%</span><br>
|
||||
<span>麻痹:{{data.palsyAtk * 100}}%</span> <span>抗麻痹:{{data.palsyAtkLess * 100}}%</span><br>
|
||||
<span>卸时装:{{data.del_Fashion * 100}}%</span> <span>连击:{{data.atk_Next * 100}}%</span><br>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { UserService } from '../../services/user/UserService';
|
||||
|
||||
definePageMeta({
|
||||
layout: layout.default,
|
||||
middleware: middleware.loading
|
||||
})
|
||||
|
||||
const data = ref<any>([]);
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
await BindData();
|
||||
}
|
||||
finally {
|
||||
PageLoading.Close();
|
||||
}
|
||||
})
|
||||
|
||||
const BindData = async () => {
|
||||
let result = await UserService.GetUserBaseAttrInfo();
|
||||
if (result.code == 0) {
|
||||
data.value = result.data;
|
||||
console.log(data)
|
||||
}
|
||||
else {
|
||||
MessageExtend.ShowDialog("特性", result.msg);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1 +1,88 @@
|
||||
<template></template>
|
||||
<template>
|
||||
<div class="content">【我的船队】</div>
|
||||
<div class="content">现负重/总负重({{weight.onWeight}}/{{weight.maxWeight}}):</div>
|
||||
<div class="content">
|
||||
<div class="item" v-for="(item,index) in data" :key="index">
|
||||
{{index+1}}.<Abutton @click="showView(item)">{{item.name}}</Abutton>
|
||||
<Abutton @click="buyShip(item)">【卖出】</Abutton>
|
||||
</div>
|
||||
<span v-if="data.length==0">暂无船只,请通过Npc购买!</span>
|
||||
</div>
|
||||
<div class="content" v-if="data.length > 0">
|
||||
<span>每人最多拥有5只船只哦!</span>
|
||||
</div>
|
||||
<GamePopup v-model:show="showInfo" title="【船只说明】" style="width: 50%;">
|
||||
<!-- 自定义内容 -->
|
||||
<div class="content">
|
||||
名称:{{shipInfo.shipName}}<br>
|
||||
介绍:{{shipInfo.remark}}<br>
|
||||
载重:{{shipInfo.weight}}<br>
|
||||
卖出价格:{{shipInfo.salePrice}}{{ GameTool.GetCurrencyName(shipInfo.payType) }}<br>
|
||||
时速:{{shipInfo.speed}}节<br>
|
||||
消耗:{{shipInfo.neeGold}}铜贝//百海里<br>
|
||||
</div>
|
||||
</GamePopup>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
definePageMeta({
|
||||
layout: layout.default,
|
||||
middleware: middleware.loading
|
||||
})
|
||||
|
||||
const data = ref<Array<any>>([]);
|
||||
const weight = ref<any>({});
|
||||
const showInfo = ref(false);
|
||||
const onShow = ref<any>({});
|
||||
const shipInfo = ref<any>({});
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
await BindData();
|
||||
}
|
||||
finally {
|
||||
PageLoading.Close();
|
||||
}
|
||||
})
|
||||
|
||||
const BindData = async () => {
|
||||
let result = await ShipService.GetShipData();
|
||||
if (result.code == 0) {
|
||||
data.value = result.data.data;
|
||||
weight.value = result.data.weightInfo;
|
||||
}
|
||||
else {
|
||||
MessageExtend.ShowDialog("船队", result.msg);
|
||||
}
|
||||
}
|
||||
|
||||
const GetShipInfo = async (shipId : string) => {
|
||||
let result = await ShipService.GetShipInfo(shipId);
|
||||
if (result.code == 0) {
|
||||
shipInfo.value = result.data.data;
|
||||
console.log(shipInfo.value)
|
||||
}
|
||||
else {
|
||||
MessageExtend.ShowDialog("船只详情", result.msg);
|
||||
}
|
||||
}
|
||||
|
||||
const showView = (data : any) => {
|
||||
GetShipInfo(data.goodsId)
|
||||
showInfo.value = true;
|
||||
onShow.value = data;
|
||||
}
|
||||
|
||||
const buyShip = async (data : any) => {
|
||||
MessageExtend.ShowConfirmDialogAsyc("船只操作", `您确定要出售船只吗?`, async () => {
|
||||
let result = await ShipService.BuyShip(data.usId);
|
||||
if (result.code == 0) {
|
||||
MessageExtend.Notify("出售成功,获得" + data.copper + "铜贝", "success");
|
||||
await BindData();
|
||||
}
|
||||
else {
|
||||
MessageExtend.ShowDialog("船只详情", result.msg);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
26
Web/src/services/Index/ShipService.ts
Normal file
26
Web/src/services/Index/ShipService.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
export class ShipService {
|
||||
/**
|
||||
* 获取船队列表
|
||||
* GET /Ship/GetUserShip
|
||||
*/
|
||||
static async GetShipData() {
|
||||
return await ApiService.Request("get", "/Ship/GetUserShip");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取船只详情
|
||||
* GET /Ship/GetShipInfo
|
||||
*/
|
||||
static async GetShipInfo(shipId : string) {
|
||||
return await ApiService.Request("get", "/Ship/GetShipInfo", { shipId });
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 出售船只
|
||||
* GET /Ship/BuyShip
|
||||
*/
|
||||
static async BuyShip(usId : string) {
|
||||
return await ApiService.Request("post", "/Ship/BuyShip", { usId });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user