This commit is contained in:
Ls
2026-06-15 17:31:34 +08:00
parent 404af92f96
commit 5d4b5c989a
8 changed files with 428 additions and 292 deletions

129
Web/package-lock.json generated
View File

@@ -1856,9 +1856,6 @@
"arm64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -1876,9 +1873,6 @@
"arm64"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@@ -1896,9 +1890,6 @@
"ppc64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -1916,9 +1907,6 @@
"riscv64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -1936,9 +1924,6 @@
"riscv64"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@@ -1956,9 +1941,6 @@
"s390x"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -1976,9 +1958,6 @@
"x64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -1996,9 +1975,6 @@
"x64"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2220,9 +2196,6 @@
"arm64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2240,9 +2213,6 @@
"arm64"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2260,9 +2230,6 @@
"ppc64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2280,9 +2247,6 @@
"riscv64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2300,9 +2264,6 @@
"riscv64"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2320,9 +2281,6 @@
"s390x"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2340,9 +2298,6 @@
"x64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2360,9 +2315,6 @@
"x64"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2594,9 +2546,6 @@
"arm64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2614,9 +2563,6 @@
"arm64"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2634,9 +2580,6 @@
"ppc64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2654,9 +2597,6 @@
"riscv64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2674,9 +2614,6 @@
"riscv64"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2694,9 +2631,6 @@
"s390x"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2714,9 +2648,6 @@
"x64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2734,9 +2665,6 @@
"x64"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2959,9 +2887,6 @@
"arm"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2983,9 +2908,6 @@
"arm"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@@ -3007,9 +2929,6 @@
"arm64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -3031,9 +2950,6 @@
"arm64"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@@ -3055,9 +2971,6 @@
"x64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -3079,9 +2992,6 @@
"x64"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@@ -3572,9 +3482,6 @@
"arm"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -3589,9 +3496,6 @@
"arm"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@@ -3606,9 +3510,6 @@
"arm64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -3623,9 +3524,6 @@
"arm64"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@@ -3640,9 +3538,6 @@
"loong64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -3657,9 +3552,6 @@
"loong64"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@@ -3674,9 +3566,6 @@
"ppc64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -3691,9 +3580,6 @@
"ppc64"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@@ -3708,9 +3594,6 @@
"riscv64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -3725,9 +3608,6 @@
"riscv64"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@@ -3742,9 +3622,6 @@
"s390x"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -3759,9 +3636,6 @@
"x64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -3776,9 +3650,6 @@
"x64"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [

View File

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

View File

@@ -8,7 +8,7 @@ export class TimeExtend {
public static Format(date: Date | string | number, format = 'yyyy-MM-dd HH:mm:ss'): string {
let targetDate: Date
if (typeof date === 'number') {
date = date - 28800;
date = date - 28800
targetDate = date.toString().length === 10 ? new Date(date * 1000) : new Date(date)
} else {
targetDate = new Date(date)
@@ -78,15 +78,15 @@ export class TimeExtend {
* @param format 目标格式
*/
public static StrToFormat(timeStr: string, format = 'yyyy-MM-dd HH:mm:ss'): string {
return this.Format(timeStr, format);
return this.Format(timeStr, format)
}
/**
* 时间字符串 转 日期对象
* @param timeStr 时间字符串
*/
public static StrToDate(timeStr: string): Date | null {
const date = new Date(timeStr);
return isNaN(date.getTime()) ? null : date;
const date = new Date(timeStr)
return isNaN(date.getTime()) ? null : date
}
/**
@@ -94,7 +94,22 @@ export class TimeExtend {
* @param timeStr 时间字符串
*/
public static StrToSecondStamp(timeStr: string): number | null {
const date = this.StrToDate(timeStr);
return date ? Math.floor(date.getTime() / 1000) : null;
const date = this.StrToDate(timeStr)
return date ? Math.floor(date.getTime() / 1000) : null
}
/**
* 计算目标时间与当前时间的剩余分钟数
* @param timeStr 时间字符串
*/
public static GetRemainingMinutes(timeStr: string): number {
const target = new Date(timeStr.replace(/-/g, '/'))
const now = new Date()
const diffMs = target.getTime() - now.getTime()
if (Math.floor(diffMs / 1000 / 60) <= 0) {
return 0
} else {
return Math.floor(diffMs / 1000 / 60)
}
}
}

View File

@@ -31,7 +31,8 @@
</div>
<div class="content">
<div class="item" v-for="(item, index) in userData" :key="index">
<Abutton @click="loginGame(item.userId)" >{{ item.areaId }}{{ item.nick }}({{ (item.sex == null || item.sex == '') ?
<Abutton @click="loginGame(item.userId)">{{ item.areaId }}{{ item.nick }}({{ (item.sex == null || item.sex
== '') ?
"未知" : item.sex }})</Abutton>
</div>
</div>

View File

@@ -0,0 +1,164 @@
<template>
<div class="content">
<Acheak :on-value="type" on-cheak="0">练功房</Acheak>
</div>
<div>
<Abutton v-if="data.length == 0" @click="showView()">立即修炼</Abutton>
</div>
<div class="content" v-if="type == '0'">
<div class="item" v-for="(item, index) in data" :key="index">
<span v-if="TimeExtend.GetRemainingMinutes(item.endTime) > 0">
{{ item.name }}
剩余{{ TimeExtend.GetRemainingMinutes(item.endTime) }}分钟
</span>
<span v-else>
{{ item.name }}
<Abutton @click="finish(item)">完成修炼</Abutton>
</span>
</div>
<span v-if="data.length == 0">
暂无修炼
</span>
</div>
<GamePopup v-model:show="showInfo" title="修炼资源" style="width: 70%;">
<div>
<div class="item" v-for="(item, index) in resourceList" :key="index">
{{ item.goodsName }} x {{ item.count }}
<Abutton @click="useResource(item)">立即使用</Abutton>
</div>
<div style="text-align: center;" v-if="resourceList.length == 0">
暂无资源
</div>
</div>
</GamePopup>
<!-- <div class="content">
<Pagination :currentPage="currentPage" :limit="10" :total="total" @pageChange="handlePageChange" />
</div>
<div class="clear"></div> -->
</template>
<script setup lang="ts">
interface friendStorage {
type: string
page: number
}
definePageMeta({
layout: layout.default,
middleware: 'page-loading'
})
const currentPage = ref<number>(1);
const total = ref<number>(0);
const data = ref<Array<any>>([]);
const type = ref('0');
let limit = ref(10)
let resourceList = ref<Array<any>>([])
let showInfo = ref(false)
onMounted(async () => {
try {
await BindData();
}
finally {
PageLoading.Close();
}
})
const BindData = async (): Promise<void> => {
let result = await PractiseService.GetUserPractise(Number(currentPage.value));
if (result.code == 0) {
data.value = result.data.list;
total.value = result.data.total.value
console.log(total.value);
limit.value = result.data.limit
//存储请求参数
let addLocalData: friendStorage = { type: type.value, page: currentPage.value };
LocalStorageExtend.Set("FriendCache", addLocalData);
}
else {
MessageExtend.ShowDialog("提示", result.msg);
}
};
// 弹窗控制
const showView = () => {
showInfo.value = true;
getResource()
}
const getResource = async () => {
let result = await PractiseService.MakeGoodsList();
if (result.code == 0) {
resourceList.value = result.data.list
}
else {
MessageExtend.ShowDialog("提示", result.msg);
}
}
// 使用资源
const useResource = async (item: any) => {
MessageExtend.ShowConfirmDialogAsyc("使用道具", `您确定使用${item.goodsName}吗?`, async () => {
let result = await PractiseService.MakeGoods(item.ugId);
if (result.code == 0) {
MessageExtend.ShowDialog("提示", '使用成功!');
showInfo.value = false;
BindData()
}
else {
MessageExtend.ShowDialog("提示", result.msg);
}
return true;
});
}
// 完成修炼
const finish = async (item: any) => {
console.log(item);
let result = await PractiseService.OkPractise(item.practiseId);
if (result.code == 0) {
MessageExtend.ShowDialog("提示", '修炼已完成!');
BindData()
}
else {
MessageExtend.ShowDialog("提示", result.msg);
}
return true;
}
/**翻页 */
const handlePageChange = async (page: number): Promise<void> => {
currentPage.value = page;
await BindData();
};
</script>
<style scoped>
.item {
display: flex;
align-items: center;
justify-content: space-between;
}
</style>

View File

@@ -1 +1,53 @@
<template></template>
<template>
<div class="content">
我的山寨
</div>
<div>山寨建筑</div>
<div>
<div>
1.<Abar href="/user/home/study/Practise">练功房</Abar>
</div>
<div>
2.<Abar href="/map/user">农场</Abar>
</div>
</div>
</template>
<script setup lang="ts">
onMounted(async () => {
try {
}
finally {
PageLoading.Close();
}
})
</script>
<style scoped>
.item {
display: flex;
align-items: center;
justify-content: space-between;
}
</style>

View File

@@ -13,15 +13,15 @@
坐骑:<br>
成就:<Abar href="/user/honnor">展示成就</Abar><br>
等级:{{ attrData.lev }}<br>
综合战力:{{attrData.score}}<br>
综合战力:{{ attrData.score }}<br>
经验:{{ expData.exp }}/{{ expData.upExp }}<br>
体力:{{attrData.blood}}/{{attrData.upBlood}} {{attrData.bloodTips}}<br>
攻击:{{attrData.minAtk}}-{{attrData.maxAtk}} {{attrData.atkTips}}<br>
防御:{{attrData.defense}} {{attrData.defTips}}<br>
敏捷:{{attrData.agility}} {{attrData.agilityTips}}<br>
士气:{{attrData.morale}}/{{attrData.upMorale}} {{attrData.moraleTips}}<br>
师德:{{accData.teach}}<br>
声望:{{accData.renown}}<br>
体力:{{ attrData.blood }}/{{ attrData.upBlood }} {{ attrData.bloodTips }}<br>
攻击:{{ attrData.minAtk }}-{{ attrData.maxAtk }} {{ attrData.atkTips }}<br>
防御:{{ attrData.defense }} {{ attrData.defTips }}<br>
敏捷:{{ attrData.agility }} {{ attrData.agilityTips }}<br>
士气:{{ attrData.morale }}/{{ attrData.upMorale }} {{ attrData.moraleTips }}<br>
师德:{{ accData.teach }}<br>
声望:{{ accData.renown }}<br>
活力:{{ vitality }}<br>
罪恶值:0<br>
帮派:<br>
@@ -41,7 +41,7 @@
<Abar href="/user/ship">船队</Abar>
</div>
<div class="item">
<Abar href="/user/home/study">山寨</Abar>.
<Abar href="/user/home/study/Practise">山寨</Abar>.
<Abar href="/user/home">房产</Abar>.
<Abar href="/user/setting">设置</Abar>
</div>
@@ -57,7 +57,7 @@ const userData = ref<any>({});
const vitality = ref(0);
const expData = ref<any>({});
const attrData = ref<any>({});
const accData = ref<any>({});
const accData = ref<any>({});
onMounted(async () => {
try {

View File

@@ -0,0 +1,33 @@
export class PractiseService {
/**
* 获取山寨修炼列表信息
* GET /Practise/GetUserPractise
*/
static async GetUserPractise(page: number) {
return await ApiService.Request('get', '/Practise/GetUserPractise', { page })
}
/**
* 获取修炼道具
* GET /Practise/MakeGoodsList
*/
static async MakeGoodsList() {
return await ApiService.Request('get', '/Practise/MakeGoodsList', {})
}
/**
* 立即修炼
* GET /Practise/MakeGoods
*/
static async MakeGoods(par: string) {
return await ApiService.Request('post', '/Practise/MakeGoods', { par })
}
/**
* 完成修炼
* GET /Practise/OkPractise
*/
static async OkPractise(par: string) {
return await ApiService.Request('post', '/Practise/OkPractise', { par })
}
}