This commit is contained in:
Putoo
2026-06-29 18:17:54 +08:00
parent e47a5a19a6
commit 93d21ba9fd
35 changed files with 1073 additions and 293 deletions

View File

@@ -7,6 +7,10 @@ export class PageExtend {
navigateTo(route, { replace: true })
}
public static GetPath(): string {
const route = useRoute()
return route.fullPath;
}
public static QueryString(params: string): string {
const route = useRoute()
const value = route.query[params]

View File

@@ -23,6 +23,12 @@
<div class="common" v-if="useState == 1">
<Abutton @click="showUseNumView = true">使用物品</Abutton>
</div>
<div class="common" v-if="useState == 2">
<Abutton @click="showUse">使用物品</Abutton>
</div>
<div class="common" v-if="useState == 3">
<Abutton @click="btnChoice">使用物品</Abutton>
</div>
</div>
@@ -41,7 +47,7 @@
</GamePopup>
<GamePopup v-model:show="showUseNumView" title="使用物品">
<!-- 自定义内容 -->
<div class="common">
<div class="common" style="margin-top: 10px;">
物品名称{{ data.goodsName }}<br>
物品数量{{ count }}<br>
</div>
@@ -50,6 +56,28 @@
<button class="ipt-btn" name="serch" @click="UseGoods" style="margin-top: 15px;">确认</button>
</div>
</GamePopup>
<GamePopup v-model:show="showUseView" title="使用物品">
<!-- 自定义内容 -->
<div class="common" style="margin-top: 10px;">
物品名称{{ data.goodsName }}<br>
物品数量{{ count }}<br>
</div>
<div class="common" style="text-align: center;">
<button class="ipt-btn" name="serch" @click="UseGoods" style="margin-top: 15px;">确认</button>
</div>
</GamePopup>
<GamePopup v-model:show="showChoiceView" title="选择物品" style="min-width: 60%;">
<!-- 自定义内容 -->
<div class="common" style="margin-top: 15px;">
<div class="item border-btm" v-for="item in choiceData">
<div>
{{ item.id }}.{{ item.name }}
<Abutton @click="btnChoiceOk(item.id)">选择</Abutton>
</div>
<div v-html="GameTool.GetPropHtml(item.award, 1, 2)"></div>
</div>
</div>
</GamePopup>
</template>
<script setup lang="ts">
@@ -78,8 +106,7 @@ const BindData = async (): Promise<void> => {
if (result.code == 0) {
data.value = result.data.goods;
count.value = result.data.count;
useState.value = result.data.use;
console.log(result);
useState.value = result.data.use;
}
else {
MessageExtend.ShowDialog("提示", result.msg);
@@ -110,17 +137,46 @@ const AddDrugBar = async () => {
MessageExtend.ShowDialog("提示", result.msg);
}
}
const showUseView = ref(false);
const showUse = () => {
useCount.value = 1;
showUseView.value = true;
}
const showUseNumView = ref(false);
const UseGoods = async () => {
MessageExtend.LoadingToast("使用中...");
let result = await GoodsService.UseGoods(Number(goodsId),useCount.value);
let result = await GoodsService.UseGoods(Number(goodsId), useCount.value);
MessageExtend.LoadingClose();
if (result.code == 0) {
showUseNumView.value = false;
if (result.code == 0) {
showUseNumView.value = false;
showUseView.value = false;
await BindData();
MessageExtend.Notify(result.msg, "success",5000);
MessageExtend.Notify(result.msg, "success", 5000);
}
else {
MessageExtend.ShowDialog("提示", result.msg);
}
}
const showChoiceView = ref(false);
const choiceData = ref<Array<any>>([]);
const btnChoice = () => {
choiceData.value = JSON.parse(data.value.content);
console.log(choiceData.value);
showChoiceView.value = true;
}
const btnChoiceOk = async (id: number) => {
MessageExtend.LoadingToast("使用中...");
let result = await GoodsService.UseChoiceGoods(Number(goodsId), id);
MessageExtend.LoadingClose();
if (result.code == 0) {
showChoiceView.value = false;
await BindData();
MessageExtend.Notify(result.msg, "success", 5000);
}
else {
MessageExtend.ShowDialog("提示", result.msg);

View File

@@ -0,0 +1,79 @@
<template>
<div class="content">
我的书签
</div>
<div class="content">
当前书签地址<Abutton @click="handleCopy">复制</Abutton>
<div>
{{ url }}
</div>
</div>
<div class="content" style="font-size: 14px;;">
说明保存书签的方式有两种:<br>
1.保存本页面为书签<br>
2.复制上方地址,进行保存<br>
</div>
</template>
<script setup lang="ts">
definePageMeta({
layout: layout.default,
middleware: 'page-loading'
})
const url = ref('');
onMounted(async () => {
try {
url.value = window.location.href;
await BindData();
}
finally {
PageLoading.Close();
}
})
const BindData = async () => {
let refToken = PageExtend.QueryString("sid");
let result = await LoginService.RefreshTokenByBook(refToken, "");
if (result.code == 0) {
StateHelper.SetToken(result.data.userId, result.data.token, result.data.refToken);
}
else {
MessageExtend.ShowDialogEvent("提示", result.msg, () => {
PageExtend.RedirectTo("/");
});
}
}
// 复制方法
const handleCopy = async () => {
try {
await copy(url.value)
MessageExtend.ShowToast("复制成功!", "success");
} catch (e) {
MessageExtend.ShowToast("复制失败!", "fail")
}
}
// 兼容全浏览器复制方法
const copy = async (text: string) => {
// 1. 优先现代剪贴板API
if (navigator.clipboard && window.isSecureContext) {
try {
await navigator.clipboard.writeText(text)
return true
} catch (err) {
console.log('clipboard复制失败启用降级方案', err)
}
}
// 2. 降级创建隐藏输入框复制
const input = document.createElement('input')
input.value = text
// 移出可视区域
input.style.cssText = 'position:absolute;left:-9999px;top:-9999px;'
document.body.appendChild(input)
input.select()
document.execCommand('copy')
document.body.removeChild(input)
return true
}
</script>

View File

@@ -25,6 +25,14 @@
活力:{{ vitality }}<br>
罪恶值:0<br>
帮派:<br>
<div v-if="buff.length > 0">
---BUFF状态---<br>
<div v-for="item in buff">
{{item.name}}:{{item.tips}}(剩余{{ item.endTime - TimeExtend.GetSecondStamp() }})
</div>
</div>
<!-- ---药品状态---<br>
体力宝+24370<br>
耐久包+0<br> -->
@@ -58,6 +66,7 @@ const vitality = ref(0);
const expData = ref<any>({});
const attrData = ref<any>({});
const accData = ref<any>({});
const buff = ref<any>([]);
onMounted(async () => {
try {
@@ -78,6 +87,7 @@ const BindData = async (): Promise<void> => {
expData.value = result.data.exp;
attrData.value = result.data.attr;
accData.value = result.data.acc;
buff.value = result.data.buff;
console.log(result);
}
else {

View File

@@ -21,6 +21,9 @@
<div class="item border-btm ">
<Abutton @click="RefreshSetting(1)">刷新图标</Abutton><span style="font-size: 14px;;">(*更新图标数据)</span>
</div>
<div class="item border-btm ">
<Abar :href='"/user/book?sid="+StateHelper.refToken'>我的书签</Abar>
</div>
</div>
</template>

View File

@@ -1,10 +1,10 @@
<template>
<div class="content">我的船队</div>
<div class="content">现负重/总负重({{weight.onWeight}}/{{weight.maxWeight}}):</div>
<div class="content">现负重/总负重({{weight}}/{{maxShip}}):</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>
<Abutton @click="saleShip(item)">卖出</Abutton>
</div>
<span v-if="data.length==0">暂无船只,请通过Npc购买!</span>
</div>
@@ -14,14 +14,15 @@
<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>
名称:{{onShow.name}}<br>
介绍:{{onShow.remark}}<br>
载重:{{onShow.weight}}<br>
卖出价格:{{GameTool.FormatCopper(onShow.sale) }}<br>
时速:{{onShow.speed}}<br>
消耗:{{onShow.copper}}铜贝//百海里<br>
</div>
</GamePopup>
</template>
<script setup lang="ts">
definePageMeta({
@@ -30,10 +31,10 @@
})
const data = ref<Array<any>>([]);
const weight = ref<any>({});
const weight = ref(0);
const showInfo = ref(false);
const onShow = ref<any>({});
const shipInfo = ref<any>({});
const maxShip = ref(0);
onMounted(async () => {
try {
@@ -45,36 +46,26 @@
})
const BindData = async () => {
let result = await ShipService.GetShipData();
let result = await ShipService.GetUserShip();
if (result.code == 0) {
data.value = result.data.data;
weight.value = result.data.weightInfo;
weight.value = result.data.onShip;
maxShip.value = result.data.maxShip;
console.log(weight.value);
}
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;
const showView = (data : any) => {
showInfo.value = true;
onShow.value = data;
}
const buyShip = async (data : any) => {
const saleShip = async (data : any) => {
MessageExtend.ShowConfirmDialogAsyc("船只操作", `您确定要出售船只吗?`, async () => {
let result = await ShipService.BuyShip(data.usId);
let result = await ShipService.SaleShip(data.usId);
if (result.code == 0) {
MessageExtend.Notify("出售成功,获得" + data.copper + "铜贝", "success");
await BindData();

View File

@@ -28,28 +28,78 @@
<div class="content">
{{ attrData.lev }}{{ userData.sex }}({{ onMap }})
</div>
<div class="content">
手持: <br>
副手:<br>
头戴:<br>
身穿: <br>
腰带: <br>
脚穿: <br>
佩戴: <br>
时装:<br>
羽翼: <br>
装饰: <br>
套装: <br>
帮会: <br>
<div v-if="team.state == 1">
队伍:<Abar :href='"/user/team/info?id=" + team.team.teamId'>{{ team.team.name }}</Abar>
<div>
<div class="content">
手持:
<span class="item" v-for="item in Hold">
<GameEqu :equ-data="item" :show-url="true" :show-lev="1"></GameEqu>
</span>
</div>
<div class="content">
副手:
<span class="item" v-for="item in Vice">
<GameEqu :equ-data="item" :show-url="true" :show-lev="1"></GameEqu>
</span>
</div>
<div class="content">
头戴:
<span class="item" v-for="item in Head">
<GameEqu :equ-data="item" :show-url="true" :show-lev="1"></GameEqu>
</span>
</div>
<div class="content">
身穿:
<span class="item" v-for="item in Wear">
<GameEqu :equ-data="item" :show-url="true" :show-lev="1"></GameEqu>
</span>
</div>
<div class="content">
腰带:
<span class="item" v-for="item in Waist">
<GameEqu :equ-data="item" :show-url="true" :show-lev="1"></GameEqu>
</span>
</div>
<div class="content">
脚穿:
<span class="item" v-for="item in Foot">
<GameEqu :equ-data="item" :show-url="true" :show-lev="1"></GameEqu>
</span>
</div>
<div class="content">
佩戴:
<span class="item" v-for="item in Ornaments">
<GameEqu :equ-data="item" :show-url="true" :show-lev="1"></GameEqu>
</span>
</div>
<div class="content">
时装:
<span class="item" v-for="item in Fashion">
<GameEqu :equ-data="item" :show-url="true" :show-lev="1"></GameEqu>
</span>
</div>
<div class="content">
羽翼:
<span class="item" v-for="item in Wing">
<GameEqu :equ-data="item" :show-url="true" :show-lev="1"></GameEqu>
</span>
</div>
<div class="content">
装饰:
<span class="item" v-for="item in Decorate">
<GameEqu :equ-data="item" :show-url="true" :show-lev="1"></GameEqu>
</span>
</div>
<div class="content" v-if="suit.length > 0">
<div class="item" v-for="item in suit">
套装:<Abar :href='"/prop/suit?no=" + item.suitCode'>{{ item.suitName }}</Abar>
</div>
</div>
</div>
<div class="content"></div>
<div class="content" v-if="team.state == 1">
队伍:<Abar :href='"/user/team/info?id=" + team.team.teamId'>{{ team.team.name }}</Abar>
</div>
</template>
<script setup lang="ts">
import Team from './team/team.vue';
definePageMeta({
layout: layout.default,
@@ -63,6 +113,20 @@ const onMap = ref('');
const isFriend = ref(false);
const isEnemy = ref(false);
const team = ref<any>({});
/**装备定义 */
const equ = ref<Array<any>>([]);
const suit = ref<Array<any>>([]);
const Hold = ref<Array<any>>([]);
const Vice = ref<Array<any>>([]);
const Head = ref<Array<any>>([]);
const Wear = ref<Array<any>>([]);
const Waist = ref<Array<any>>([]);
const Foot = ref<Array<any>>([]);
const Ornaments = ref<Array<any>>([]);
const Fashion = ref<Array<any>>([]);
const Wing = ref<Array<any>>([]);
const Decorate = ref<Array<any>>([]);
onMounted(async () => {
try {
await BindData();
@@ -86,7 +150,20 @@ const BindData = async (): Promise<void> => {
isFriend.value = result.data.isFriend;
isEnemy.value = result.data.isEnemy;
team.value = result.data.team;
console.log(result);
equ.value = result.data.equ;
suit.value = result.data.suit;
Hold.value = equ.value.filter(it => it.code == 'Hold');
Vice.value = equ.value.filter(it => it.code == 'Vice');
Head.value = equ.value.filter(it => it.code == 'Head');
Wear.value = equ.value.filter(it => it.code == 'Wear');
Waist.value = equ.value.filter(it => it.code == 'Waist');
Foot.value = equ.value.filter(it => it.code == 'Foot');
Ornaments.value = equ.value.filter(it => it.code == 'Ornaments');
Fashion.value = equ.value.filter(it => it.code == 'Fashion');
Wing.value = equ.value.filter(it => it.code == 'Wing');
Decorate.value = equ.value.filter(it => it.code == 'Decorate');
}
else if (result.code == 101) {
return PageExtend.RedirectTo("/user");

View File

@@ -15,4 +15,12 @@ export class GoodsService {
static async UseGoods(goodsId: number, count: number) {
return await ApiService.Request("get", "/Goods/UseGoods", { goodsId, count });
}
/**
* 使用选择物品礼包
* GET /Goods/UseChoiceGoods
*/
static async UseChoiceGoods(goodsId: number, num: number) {
return await ApiService.Request("get", "/Goods/UseChoiceGoods", { goodsId, num });
}
}

View File

@@ -1,26 +1,18 @@
export class ShipService {
/**
* 获取船队列表
* GET /Ship/GetUserShip
*/
static async GetShipData() {
return await ApiService.Request("get", "/Ship/GetUserShip");
}
/**
* 获取用户船只
* GET /Ship/GetUserShip
*/
static async GetUserShip() {
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 });
}
/**
* 出售船只
* POST /Ship/SaleShip
* @param usId body
*/
static async SaleShip(usId: string) {
return await ApiService.Request("post", "/Ship/SaleShip", { usId });
}
}

View File

@@ -53,6 +53,16 @@ export class LoginService {
return await ApiService.Request("post", "/Login/RefreshToken", { refToken, token });
}
/**
* RefreshTokenByBook
* POST /Login/RefreshTokenByBook
* @param refToken body
* @param token body
*/
static async RefreshTokenByBook(refToken: string, token: string) {
return await ApiService.Request("post", "/Login/RefreshTokenByBook", { refToken, token });
}
/**
* 注册角色信息
* POST /Login/RegisterInfo

View File

@@ -87,7 +87,10 @@ export class GameTool {
data.forEach(element => {
let num = Number(element.count) * count;
if (type == 0) {
result += `${element.name}+${num}`
result += `${element.name}+${num},`
}
else if (type == 2) {
result += `${this.GetPropUrl(element.code, element.name, element.parameter)}+${num},`
}
else {
result += `<div class='n-item'>▸${this.GetPropUrl(element.code, element.name, element.parameter)}+${num}</div>`;