Compare commits

..

No commits in common. 'ff74dd1e9b376ad555983d2893fd4eeaaf8f388f' and '4a4857fa8239db297faeeaf348f16654927c8bb7' have entirely different histories.

@ -1,274 +1,68 @@
<!--
* @Descripttion:
* @version: 1.0.0
* @Author: LyMy
* @Date: 2025-04-11 16:51:41
* @LastEditors: LyMy
* @LastEditTime: 2025-04-11 17:32:02
* @FilePath: \go_fish_web\src\pages\equipments\Equipments.vue
-->
<template> <template>
<div class="equipments-page"> <div class="equipments-page">
<div class="content"> <h1>查看装备</h1>
<div class="title-container"> <el-table :data="equipmentList" style="width: 100%">
<h1 class="title">我的装备库</h1> <el-table-column prop="id" label="ID" width="80" />
<p class="subtitle">管理你的钓鱼装备</p> <el-table-column prop="name" label="名称" />
</div> <el-table-column prop="type" label="类型" width="150" />
<el-table-column prop="description" label="描述" />
<div class="equipment-grid"> <el-table-column prop="quantity" label="数量" width="150" />
<div <el-table-column label="是否已装备" width="120">
v-for="item in equipmentList" <template #default="scope">
:key="item.id" <el-tag type="success" v-if="scope.row.isEquipped"></el-tag>
class="equipment-card" <el-tag type="info" v-else></el-tag>
> </template>
<div class="equipment-icon"> </el-table-column>
<span v-if="item.name.indexOf('竿') != -1" class="emoji-icon" <el-table-column label="操作" width="120">
>🎣</span <template #default="scope">
> <el-button type="primary" size="small" @click="handleEquip(scope.row.id)" :disabled="scope.row.isEquipped">
<span v-else-if="item.name === ''" class="emoji-icon">🪱</span> 装备
<span v-else-if="item.name === ''" class="emoji-icon">󠀻🏳</span> </el-button>
<span v-else-if="item.name === ''" class="emoji-icon" </template>
>🧰</span </el-table-column>
> </el-table>
<span v-else class="emoji-icon">📦</span>
</div>
<div class="equipment-info">
<h3 class="equipment-name">{{ item.name }}</h3>
<div class="equipment-type">{{ item.type }}</div>
<p class="equipment-description">{{ item.description }}</p>
<div class="equipment-stats">
<span class="quantity">数量: {{ item.quantity }}</span>
<el-tag
:type="item.isEquipped ? 'success' : 'info'"
class="status-tag"
effect="dark"
>
{{ item.isEquipped ? "已装备" : "未装备" }}
</el-tag>
</div>
<el-button
type="primary"
class="equip-button"
:class="{ 'is-equipped': item.isEquipped }"
@click="handleEquip(item.id, item.quantity)"
:disabled="item.isEquipped || item.quantity <= 0"
>
{{
item.isEquipped
? "已装备"
: item.quantity <= 0
? "数量不足"
: "装备"
}}
</el-button>
</div>
</div>
</div>
<div class="back-button">
<el-button
@click="$router.push({ name: 'Home' })"
size="small"
type="default"
icon="ArrowLeft"
>
返回首页
</el-button>
</div>
</div> </div>
</div>
</template> </template>
<script setup> <script setup>
import { ref, onMounted } from "vue"; import { ref, onMounted } from 'vue'
import { ElMessage } from "element-plus"; import { ElMessage } from 'element-plus'
import { getEquipments, equip } from "@/api/equipments/equipments"; import { getEquipments, equip } from '@/api/equipments/equipments'
// //
const equipmentList = ref([]); const equipmentList = ref([])
// //
onMounted(async () => { onMounted(async () => {
const res = await getEquipments(); const res = await getEquipments()
equipmentList.value = res || []; equipmentList.value = res || []
}); })
// //
const handleEquip = async (id, quantity) => { const handleEquip = async (id) => {
try { try {
if (quantity <= 0) { await equip(id)
ElMessage.warning("装备数量不足,无法装备!"); ElMessage.success('装备成功!🎯')
return; //
const res = await getEquipments()
equipmentList.value = res || []
} catch (err) {
ElMessage.error('装备失败!')
} }
await equip(id); }
ElMessage.success("装备成功!🎯");
//
const res = await getEquipments();
equipmentList.value = res || [];
} catch (err) {
ElMessage.error("装备失败!");
}
};
</script> </script>
<style scoped> <style scoped>
.equipments-page { .equipments-page {
min-height: 100vh; text-align: center;
background: var(--bg-gradient-primary);
padding: 20px;
}
.content {
max-width: 1200px;
margin: 0 auto;
padding: 20px;
}
.title-container {
text-align: center;
margin-bottom: 40px;
}
.title {
font-size: 2.5rem;
font-weight: bold;
color: var(--text-primary);
margin-bottom: 10px;
text-shadow: var(--glow-primary);
}
.subtitle {
font-size: 1.2rem;
color: var(--text-secondary);
margin: 0;
text-shadow: var(--glow-secondary);
}
.equipment-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
gap: 20px;
margin-bottom: 30px;
}
.equipment-card {
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(15px);
border-radius: 20px;
border: 1px solid rgba(255, 255, 255, 0.2);
padding: 20px;
transition: all 0.3s ease;
transform-style: preserve-3d;
cursor: pointer;
}
.equipment-card:hover {
transform: translateY(-5px);
background: rgba(255, 255, 255, 0.15);
border-color: var(--primary-color);
box-shadow: 0 8px 32px rgba(var(--primary-rgb), 0.2);
}
.equipment-icon {
width: 60px;
height: 60px;
margin: 0 auto 15px;
padding: 12px;
background: rgba(var(--primary-rgb), 0.1);
border-radius: 50%;
color: var(--primary-color);
transition: all 0.3s ease;
display: flex;
align-items: center;
justify-content: center;
}
.emoji-icon {
font-size: 32px;
line-height: 1;
}
.equipment-card:hover .equipment-icon {
transform: scale(1.1);
background: rgba(var(--primary-rgb), 0.2);
color: var(--primary-dark);
}
.equipment-info {
text-align: center;
}
.equipment-name {
font-size: 1.4rem;
font-weight: 600;
color: var(--text-primary);
margin: 0 0 8px;
}
.equipment-type {
font-size: 0.9rem;
color: var(--primary-color);
margin-bottom: 12px;
font-weight: 500;
}
.equipment-description {
font-size: 0.95rem;
color: var(--text-secondary);
margin: 0 0 15px;
line-height: 1.4;
}
.equipment-stats {
display: flex;
justify-content: center;
align-items: center;
gap: 15px;
margin-bottom: 15px;
}
.quantity {
font-size: 0.9rem;
color: var(--text-secondary);
}
.status-tag {
font-size: 0.8rem;
}
.equip-button {
width: 100%;
border-radius: 12px;
transition: all 0.3s ease;
}
.equip-button.is-equipped {
background-color: var(--success-color);
border-color: var(--success-color);
opacity: 0.8;
cursor: not-allowed;
}
.back-button {
text-align: center;
margin-top: 20px;
}
@media (max-width: 768px) {
.title {
font-size: 2rem;
}
.subtitle {
font-size: 1rem;
}
.equipment-grid {
grid-template-columns: 1fr;
gap: 15px;
}
.equipment-card {
padding: 15px;
}
.equipment-name {
font-size: 1.2rem;
}
.equipment-description {
font-size: 0.9rem;
}
} }
</style> </style>

@ -1,159 +1,91 @@
<template> <template>
<div class="fishbaskets-page"> <div class="equipments-page">
<div class="content"> <h1>🎣 我的鱼篓</h1>
<div class="title-container">
<h1 class="title">🎣 我的鱼篓</h1> <!-- 处理按钮 -->
<p class="subtitle">管理你的渔获</p> <div style="text-align: right; margin-bottom: 20px;">
</div> <el-button type="primary" @click="fetchFishList"></el-button>
<el-button type="primary" @click="handleProcessFish"></el-button>
<!-- 处理按钮 --> </div>
<div class="action-buttons">
<el-button type="primary" @click="fetchFishList" icon="Refresh" <el-tabs v-model="activeTab" type="card">
>刷新</el-button <el-tab-pane label="所有鱼" name="all" />
> <el-tab-pane label="普通鱼" name="ordinary" />
<el-button type="success" @click="handleProcessFish" icon="Check" <el-tab-pane label="稀有鱼" name="rare" />
>一键处理普通鱼</el-button </el-tabs>
>
</div> <el-table :data="filteredFish" style="width: 100%;" height="calc(100vh - 240px)" border>
<el-table-column prop="id" label="id" align="center" width="100" />
<el-tabs v-model="activeTab" type="card" class="custom-tabs"> <el-table-column prop="name" label="鱼名" align="center" width="200" />
<el-tab-pane label="所有鱼" name="all" /> <el-table-column prop="weight" label="重量" align="right" width="150" />
<el-tab-pane label="普通鱼" name="ordinary" /> <el-table-column prop="description" label="描述" />
<el-tab-pane label="稀有鱼" name="rare" /> <el-table-column label="稀有度" align="center" width="150">
</el-tabs> <template #default="{ row }">
<el-tag :type="row.isRare ? 'danger' : 'info'">
<el-table {{ row.isRare ? '稀有' : '普通' }}
:data="filteredFish" </el-tag>
class="custom-table" </template>
height="calc(100vh - 300px)" </el-table-column>
border <!-- 出售按钮 -->
v-loading="loading" <el-table-column label="操作" align="center" width="180">
element-loading-text="正在加载..." <template #default="{ row }">
element-loading-background="rgba(255, 255, 255, 0.1)" <el-button :loading="loading" type="primary" @click="handleFish(row.id)"></el-button>
> <el-button v-if="row.isRare" type="danger" @click="handleSell(row)"></el-button>
<el-table-column prop="id" label="ID" align="center" width="100" /> </template>
<el-table-column prop="name" label="鱼名" align="center" width="200"> </el-table-column>
<template #default="{ row }"> </el-table>
<span class="fish-name">{{ row.name }}</span>
</template>
</el-table-column>
<el-table-column prop="weight" label="重量" align="right" width="150">
<template #default="{ row }">
<span class="fish-weight">{{ row.weight }}</span>
</template>
</el-table-column>
<el-table-column prop="description" label="描述">
<template #default="{ row }">
<span class="fish-description">{{ row.description }}</span>
</template>
</el-table-column>
<el-table-column label="稀有度" align="center" width="150">
<template #default="{ row }">
<el-tag
:type="row.isRare ? 'danger' : 'info'"
effect="dark"
class="rarity-tag"
>
{{ row.isRare ? "稀有" : "普通" }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="180">
<template #default="{ row }">
<div class="action-buttons">
<el-button
:loading="loading"
type="primary"
@click="handleFish(row.id)"
size="small"
>处理</el-button
>
<el-button
v-if="row.isRare"
type="danger"
@click="handleSell(row)"
size="small"
>出售</el-button
>
</div>
</template>
</el-table-column>
</el-table>
<!-- 空状态 -->
<el-empty
v-if="!filteredFish.length"
description="暂无渔获"
class="empty-state"
>
<template #image>
<span class="empty-icon">🎣</span>
</template>
</el-empty>
</div> </div>
</div>
</template> </template>
<script setup> <script setup>
import { ref, onMounted, computed } from "vue"; import { ref, onMounted, computed } from 'vue'
import { useRouter } from "vue-router"; import { useRouter } from 'vue-router'
import { import { myFishBaskets, handleFishById, sellFish, autoHandleFish } from '@/api/fishbaskets/fishbaskets'
myFishBaskets, import { ElMessage, ElInput, ElMessageBox } from 'element-plus'
handleFishById,
sellFish,
autoHandleFish,
} from "@/api/fishbaskets/fishbaskets";
import { ElMessage, ElInput, ElMessageBox } from "element-plus";
const loading = ref(false); const loading = ref(false)
const activeTab = ref("all"); const activeTab = ref('all')
const fishList = ref([]); const fishList = ref([])
const router = useRouter(); const router = useRouter()
const fetchFishList = async () => { const fetchFishList = async () => {
try { try {
loading.value = true; const res = await myFishBaskets()
const res = await myFishBaskets(); if (res) {
if (res) { fishList.value = res;
fishList.value = res; }
} catch (err) {
ElMessage.warning('请检查网络或重试 🌐')
} }
} catch (err) { }
ElMessage.warning("请检查网络或重试 🌐");
} finally {
loading.value = false;
}
};
// //
const filteredFish = computed(() => { const filteredFish = computed(() => {
switch (activeTab.value) { switch (activeTab.value) {
case "all": case 'all':
return fishList.value; return fishList.value;
case "ordinary": case 'ordinary':
return fishList.value.filter((f) => !f.isRare); return fishList.value.filter(f => !f.isRare);
case "rare": case 'rare':
return fishList.value.filter((f) => f.isRare); return fishList.value.filter(f => f.isRare);
default: }
return []; })
}
});
// //
const handleProcessFish = async () => { const handleProcessFish = async () => {
try { try {
loading.value = true; const res = await autoHandleFish()
const res = await autoHandleFish(); if (res) {
if (res) { ElMessage.success(res + ' 🎉')
ElMessage.success(res + " 🎉"); fetchFishList()
await fetchFishList(); }
} catch (err) {
console.log('====================================');
console.log(err);
console.log('====================================');
ElMessage.warning('处理失败,请稍后再试 ⏳')
} }
} catch (err) { }
ElMessage.warning("处理失败,请稍后再试 ⏳");
} finally {
loading.value = false;
}
};
// //
const handleFish = async (fishId) => { const handleFish = async (fishId) => {
loading.value = true loading.value = true
@ -179,171 +111,41 @@ const handleFish = async (fishId) => {
// //
const handleSell = async (fish) => { const handleSell = async (fish) => {
try { const { value: price } = await ElMessageBox.prompt('请输入出售价格', `出售鱼 ${fish.name}`, {
const { value: price } = await ElMessageBox.prompt( confirmButtonText: '确认',
"请输入出售价格", cancelButtonText: '取消',
`出售鱼 (${fish.name})`,
{
confirmButtonText: "确认",
cancelButtonText: "取消",
inputPattern: /^\d+(\.\d{1,2})?$/, inputPattern: /^\d+(\.\d{1,2})?$/,
inputErrorMessage: "请输入合法的价格", inputErrorMessage: '请输入合法的价格'
} })
);
if (price) { if (price) {
const res = await sellFish({ FishBagId: fish.id, Points: price }); try {
if (res.success) { const res = await sellFish({ FishBagId: fish.id, Points: price })
ElMessage.success(res.message + " 🎉"); if (res.success) {
await fetchFishList(); ElMessage.success(res.message + ' 🎉')
} else { fetchFishList()
ElMessage.error("出售失败 " + res.message + " 😢"); } else {
} ElMessage.error('出售失败 ' + res.message + ' 😢');
} }
} catch (err) { } catch (err) {
if (err !== "cancel") { ElMessage.error('出售失败,请稍后再试 🛒')
ElMessage.error("出售失败,请稍后再试 🛒"); }
} }
} }
};
onMounted(() => { onMounted(() => {
fetchFishList(); fetchFishList()
}); })
</script> </script>
<style scoped> <style scoped>
.fishbaskets-page { .equipments-page {
min-height: 100vh; text-align: center;
background: var(--bg-gradient-primary); margin-top: 50px;
padding: 20px;
} }
.content { .result {
max-width: 1200px; margin-top: 20px;
margin: 0 auto; font-size: 16px;
padding: 15px;
}
.title-container {
text-align: center;
margin-bottom: 20px;
}
.title {
font-size: 2.5rem;
font-weight: bold;
color: var(--text-primary);
margin-bottom: 10px;
text-shadow: var(--glow-primary);
}
.subtitle {
font-size: 1.2rem;
color: var(--text-secondary);
margin: 0;
text-shadow: var(--glow-secondary);
}
.action-buttons {
display: flex;
justify-content: flex-end;
gap: 10px;
margin-bottom: 20px;
}
.custom-tabs {
margin-bottom: 20px;
:deep(.el-tabs__header) {
margin-bottom: 20px;
border-bottom: none;
}
:deep(.el-tabs__nav) {
border: none;
}
:deep(.el-tabs__item) {
color: var(--text-secondary);
&.is-active {
color: var(--primary-color);
}
}
}
.custom-table {
height: calc(100vh - 250px);
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(15px);
border-radius: 12px;
overflow: hidden;
transition: all 0.3s ease;
:deep(.el-table__header-wrapper) {
th {
background-color: rgba(var(--primary-rgb), 0.1);
color: var(--text-primary);
font-weight: 600;
}
}
:deep(.el-table__body-wrapper) {
td {
background-color: transparent;
color: var(--text-secondary);
}
}
:deep(.el-table__row) {
transition: all 0.3s ease;
&:hover {
background-color: rgba(255, 255, 255, 0.05);
}
}
}
.fish-name {
font-weight: 600;
color: var(--text-primary);
}
.fish-weight {
color: var(--primary-color);
font-family: monospace;
}
.fish-description {
color: var(--text-secondary);
font-size: 0.9rem;
}
.rarity-tag {
font-size: 0.8rem;
padding: 4px 8px;
}
.empty-state {
margin-top: 40px;
.empty-icon {
font-size: 48px;
}
}
@media (max-width: 768px) {
.title {
font-size: 2rem;
}
.subtitle {
font-size: 1rem;
}
.action-buttons {
flex-direction: column;
}
.custom-table {
:deep(.el-table__body-wrapper) {
overflow-x: auto;
}
}
} }
</style> </style>

@ -1,48 +1,25 @@
<template> <template>
<div class="fishing-page"> <div class="fishing-page">
<div class="fishing-container"> <div class="fishing-container">
<div class="fishing-area"> <div class="fishing-area">
<div <div class="fishing-animation" :class="{ 'fishing-active': isFishing }">
class="fishing-animation" <div class="fishing-scene" @click="handleFish"></div>
:class="{ <div class="ripple"></div>
'fishing-active': isFishing, </div>
reeling: isReeling, <div class="result" v-if="resultMessage || nextPullTime">
}" <el-alert v-if="resultMessage" :title="resultMessage" :type="currentCatch.length>0 ? 'success' : 'info'"
> :closable="false" show-icon />
<div class="fishing-scene" @click="handleFish"></div> <el-alert v-if="nextPullTime" :title="`下次可钓鱼时间:${nextPullTime}`" type="warning" :closable="false" show-icon />
<div class="ripple"></div> </div>
</div>
<div class="log-area">
<FishingLog :logs="fishingLogs" />
<div class="back-button">
<el-button @click="goHome" size="small" type="default" icon="ArrowLeft">返回</el-button>
</div>
</div>
</div> </div>
<div class="result" v-if="resultMessage || nextPullTime">
<el-alert
v-if="resultMessage"
:title="resultMessage"
:type="currentCatch.length > 0 ? 'success' : 'info'"
:closable="false"
show-icon
/>
<el-alert
v-if="nextPullTime"
:title="`下次可钓鱼时间:${nextPullTime}`"
type="warning"
:closable="false"
show-icon
/>
</div>
</div>
<div class="log-area">
<FishingLog :logs="fishingLogs" />
<div class="back-button">
<el-button
@click="goHome"
size="small"
type="default"
icon="ArrowLeft"
>返回</el-button
>
</div>
</div>
</div> </div>
</div>
</template> </template>
<script setup> <script setup>
@ -58,358 +35,199 @@ const nextPullTime = ref("");
const isFishing = ref(false); const isFishing = ref(false);
const currentCatch = ref([]); // const currentCatch = ref([]); //
const fishingLogs = ref([]); const fishingLogs = ref([]);
const isWaiting = ref(false);
const isReeling = ref(false);
const fishEscapeTimer = ref(null);
// localStorage // localStorage
const loadCachedLogs = () => { const loadCachedLogs = () => {
const cachedLogs = localStorage.getItem("fishingLogs"); const cachedLogs = localStorage.getItem("fishingLogs");
if (cachedLogs) { if (cachedLogs) {
fishingLogs.value = JSON.parse(cachedLogs); fishingLogs.value = JSON.parse(cachedLogs);
} }
}; };
// localStorage // localStorage
const saveLogs = () => { const saveLogs = () => {
localStorage.setItem("fishingLogs", JSON.stringify(fishingLogs.value)); localStorage.setItem("fishingLogs", JSON.stringify(fishingLogs.value));
};
// 1-3
const generateWaitTime = () => {
return Math.floor(Math.random() * 2000) + 1000;
};
// 10%
const willFishEscape = () => {
return Math.random() < 0.1;
}; };
// 竿20%
const willReelFail = () => {
return Math.random() < 0.2;
};
//
onMounted(() => { onMounted(() => {
loadCachedLogs(); loadCachedLogs();
}); });
//
onBeforeUnmount(() => { onBeforeUnmount(() => {
if (fishEscapeTimer.value) { localStorage.removeItem("fishingLogs");
clearTimeout(fishEscapeTimer.value);
}
}); });
const handleFish = async () => { const handleFish = async () => {
// if (isFishing.value) return;
if (nextPullTime.value) {
// nextPullTime Date
const nextTime = new Date(nextPullTime.value);
if (Date.now() < nextTime.getTime()) {
ElMessage.warning(
`还未到下杆时间,请在 ${nextTime.toLocaleTimeString()} 后尝试`
);
return;
}
}
//
if (isFishing.value && !isWaiting.value) return;
//
if (!isWaiting.value) {
isFishing.value = true; isFishing.value = true;
resultMessage.value = "放下鱼竿,等待不知好歹的🐟"; currentCatch.value = [];
resultMessage.value = "正在钓鱼中...";
//
setTimeout(() => { try {
if (willFishEscape()) { const res = await fishingClick();
resultMessage.value = "鱼儿警觉地游走了... 🐟"; if (res.success && res.data) {
isFishing.value = false; const items = res.data.items || [];
return; if (res.data.nextPullTime) {
} nextPullTime.value = new Date(res.data.nextPullTime).toLocaleString();
}
isWaiting.value = true;
resultMessage.value = "鱼儿上钩啦!速速收杆!速速速速速速"; if (items.length > 0) {
currentCatch.value = items;
isReeling.value = true;
//
// const messageList = items.map(fish =>
fishEscapeTimer.value = setTimeout(() => { `${fish.isRare ? "稀有的" : ""}${fish.fishName}」,重量 ${fish.weight}`
if (isWaiting.value && isFishing.value) { );
isWaiting.value = false; resultMessage.value = `你钓到了:\n${messageList.join("\n")}`;
isFishing.value = false; ElMessage.success("钓鱼成功!🎣");
resultMessage.value = "鱼儿挣脱逃走了!";
} //
}, 5000); // 5竿 const newLogs = items.map(fish => ({
}, generateWaitTime()); time: new Date(),
return; fishName: fish.fishName,
} weight: fish.weight,
isRare: fish.isRare,
// }));
if (fishEscapeTimer.value) { fishingLogs.value.unshift(...newLogs);
clearTimeout(fishEscapeTimer.value); saveLogs();
fishEscapeTimer.value = null; } else {
} resultMessage.value = "什么也没钓到,下次好运 🍀";
ElMessage.warning("什么也没钓到,下次好运 🍀");
// 竿 }
isWaiting.value = false;
isReeling.value = false;
if (willReelFail()) {
isFishing.value = false;
resultMessage.value = "提竿时机不对,鱼儿溜走了!";
return;
}
//
currentCatch.value = [];
resultMessage.value = "正在钓鱼中...";
try {
const res = await fishingClick();
if (res.success && res.data) {
const items = res.data.items || [];
if (res.data.nextPullTime) {
nextPullTime.value = new Date(res.data.nextPullTime).toLocaleString();
}
if (items.length > 0) {
currentCatch.value = items;
//
const messageList = items.map(
(fish) =>
`${fish.isRare ? "稀有的" : ""}${fish.fishName}」,重量 ${
fish.weight
}`
);
resultMessage.value = `你钓到了:\n${messageList.join("\n")}`;
//
if (items.length > 1) {
ElMessage({
message: `太棒了!一次钓到${items.length}条鱼!🎣✨`,
type: "success",
duration: 5000,
showClose: true,
customClass: "multi-catch-message",
});
//
document
.querySelector(".fishing-animation")
.classList.add("multi-catch");
setTimeout(() => {
document
.querySelector(".fishing-animation")
.classList.remove("multi-catch");
}, 3000);
} else { } else {
ElMessage.success("钓鱼成功!🎣"); resultMessage.value = res.message || "钓鱼失败";
if (res.data?.nextPullTime) {
nextPullTime.value = new Date(res.data.nextPullTime).toLocaleString();
}
ElMessage.error(res.message || "钓鱼失败 🎣");
} }
} catch (err) {
// resultMessage.value = "钓鱼出错,请稍后重试";
const newLogs = items.map((fish) => ({ ElMessage.error("钓鱼出错,请稍后重试 🌊");
time: new Date(), console.error(err);
fishName: fish.fishName, } finally {
weight: fish.weight, isFishing.value = false;
isRare: fish.isRare,
}));
fishingLogs.value.unshift(...newLogs);
saveLogs();
} else {
resultMessage.value = "什么也没钓到,下次好运 🍀";
ElMessage.warning("什么也没钓到,下次好运 🍀");
}
} else {
resultMessage.value = res.message || "钓鱼失败";
if (res.data?.nextPullTime) {
nextPullTime.value = new Date(res.data.nextPullTime).toLocaleString();
}
ElMessage.error(res.message || "钓鱼失败 🎣");
} }
} catch (err) {
resultMessage.value = "钓鱼出错,请稍后重试";
ElMessage.error("钓鱼出错,请稍后重试 🌊");
console.error(err);
} finally {
isFishing.value = false;
}
}; };
const goHome = () => { const goHome = () => {
router.push("/"); router.push("/");
}; };
</script> </script>
<style scoped> <style scoped>
.fishing-page { .fishing-page {
padding: 20px; padding: 20px;
} }
.fishing-container { .fishing-container {
display: grid; display: grid;
grid-template-columns: 1fr 400px; grid-template-columns: 1fr 400px;
gap: 20px; gap: 20px;
max-width: 1200px; max-width: 1200px;
margin: 0 auto; margin: 0 auto;
min-height: calc(100vh - 40px); min-height: calc(100vh - 40px);
} }
.back-button { .back-button {
margin-top: 20px; margin-top: 20px;
text-align: center; text-align: center;
} }
.back-button .el-button { .back-button .el-button {
padding: 12px 24px; padding: 12px 24px;
font-size: 16px; font-size: 16px;
border-radius: 24px; border-radius: 24px;
transition: all 0.3s ease; transition: all 0.3s ease;
background: #409eff; background: #409eff;
border: 1px solid #409eff; border: 1px solid #409eff;
color: white; color: white;
font-weight: bold; font-weight: bold;
} }
.back-button .el-button:hover { .back-button .el-button:hover {
transform: translateY(-2px); transform: translateY(-2px);
box-shadow: 0 4px 16px rgba(64, 158, 255, 0.3); box-shadow: 0 4px 16px rgba(64, 158, 255, 0.3);
background: #66b1ff; background: #66b1ff;
border-color: #66b1ff; border-color: #66b1ff;
} }
.fishing-area { .fishing-area {
text-align: center; text-align: center;
background: #fff; background: #fff;
padding: 20px; padding: 20px;
border-radius: 8px; border-radius: 8px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1); box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
position: relative; position: relative;
} }
.fishing-animation { .fishing-animation {
height: 500px; height: 500px;
position: relative; position: relative;
margin: 20px 0; margin: 20px 0;
overflow: hidden; overflow: hidden;
border-radius: 8px; border-radius: 8px;
background: #fff; background: #fff;
cursor: pointer; cursor: pointer;
} }
.fishing-scene { .fishing-scene {
width: 100%; width: 100%;
height: 100%; height: 100%;
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
background: url("@/assets/fishing-scene.svg") no-repeat center; background: url("@/assets/fishing-scene.svg") no-repeat center;
background-size: cover; background-size: cover;
transition: transform 0.2s ease;
cursor: pointer;
} }
.fishing-active .fishing-scene { .fishing-active .fishing-scene {
animation: scene-active 3s ease-in-out infinite; animation: scene-active 3s ease-in-out infinite;
}
.reeling .fishing-scene {
animation: reel 0.2s ease-in-out;
} }
.ripple { .ripple {
position: absolute; position: absolute;
width: 30px; width: 30px;
height: 30px; height: 30px;
background: rgba(255, 255, 255, 0.7); background: rgba(255, 255, 255, 0.7);
border-radius: 50%; border-radius: 50%;
left: 60%; left: 60%;
top: 70%; top: 70%;
transform: translate(-50%, -50%) scale(0);
opacity: 0;
}
.fishing-active .ripple {
animation: ripple 2s infinite;
}
.result {
margin-top: 20px;
}
@keyframes ripple {
0% {
transform: translate(-50%, -50%) scale(0); transform: translate(-50%, -50%) scale(0);
opacity: 1;
}
100% {
transform: translate(-50%, -50%) scale(4);
opacity: 0; opacity: 0;
}
} }
@keyframes scene-active { .fishing-active .ripple {
0%, animation: ripple 2s infinite;
100% {
transform: scale(1) rotate(0deg);
filter: brightness(1);
}
25% {
transform: scale(1.05) rotate(-2deg);
filter: brightness(1.2);
}
75% {
transform: scale(1.05) rotate(2deg);
filter: brightness(1.2);
}
}
@keyframes reel {
0% {
transform: rotate(0deg) scale(1);
}
50% {
transform: rotate(-8deg) scale(1.1);
}
100% {
transform: rotate(0deg) scale(1);
}
}
/* 多条鱼时的特殊动画效果 */
@keyframes multi-catch {
0%,
100% {
transform: scale(1) rotate(0deg);
filter: brightness(1) contrast(1);
}
25% {
transform: scale(1.15) rotate(-5deg);
filter: brightness(1.3) contrast(1.1);
}
75% {
transform: scale(1.15) rotate(5deg);
filter: brightness(1.3) contrast(1.1);
}
} }
.multi-catch { .fishing-controls {
animation: multi-catch 1s ease-in-out 3 !important; margin: 20px 0;
} }
.multi-catch-message { .result {
font-size: 16px !important; margin-top: 20px;
font-weight: bold !important;
background: linear-gradient(45deg, #4caf50, #2196f3) !important;
color: white !important;
} }
.fishing-scene:active { @keyframes ripple {
transform: scale(0.98); 0% {
transform: translate(-50%, -50%) scale(0);
opacity: 1;
}
100% {
transform: translate(-50%, -50%) scale(4);
opacity: 0;
}
} }
.fishing-animation:not(.fishing-active) .fishing-scene:hover { @keyframes scene-active {
transform: scale(1.02); 0%,
100% {
transform: scale(1);
}
50% {
transform: scale(1.02);
}
} }
</style> </style>

@ -1,289 +1,279 @@
<template> <template>
<div class="login-page"> <div class="login-page">
<el-card class="login-card"> <el-card class="login-card">
<h1 class="title">钓鱼大冒险</h1> <h1 class="title">钓鱼大冒险</h1>
<!-- 登录表单 --> <!-- 登录表单 -->
<el-form <el-form v-if="isLogin" :model="form" :rules="rules" ref="formRef" @submit.prevent="handleLogin" label-width="90px">
v-if="isLogin" <el-row :gutter="24">
:model="form" <el-col :span="24">
:rules="rules" <el-form-item prop="Name" label="用户名">
ref="formRef" <el-input v-model="form.Name" placeholder="请输入用户名"></el-input>
@submit.prevent="handleLogin" </el-form-item>
label-width="90px" </el-col>
> </el-row>
<el-row :gutter="24"> <el-row :gutter="24">
<el-col :span="24"> <el-col :span="24">
<el-form-item prop="Name" label="用户名"> <el-form-item prop="Password" label="密码">
<el-input <el-input v-model="form.Password" type="password" placeholder="请输入密码"></el-input>
v-model="form.Name" </el-form-item>
placeholder="请输入用户名" </el-col>
></el-input> </el-row>
</el-form-item> <el-row :gutter="24">
</el-col> <el-col :span="24">
</el-row> <el-form-item label="">
<el-row :gutter="24"> <el-button type="primary" block native-type="submit">登录</el-button>
<el-col :span="24"> </el-form-item>
<el-form-item prop="Password" label="密码"> </el-col>
<el-input </el-row>
v-model="form.Password" </el-form>
type="password"
placeholder="请输入密码"
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="24">
<el-form-item label="">
<el-button type="primary" block native-type="submit"
>登录</el-button
>
</el-form-item>
</el-col>
</el-row>
</el-form>
<!-- 注册表单 --> <!-- 注册表单 -->
<el-form <el-form v-if="!isLogin" :model="form" :rules="rules" ref="formRef" @submit.prevent="handleRegister" label-width="90px">
v-if="!isLogin" <el-row :gutter="24">
:model="form" <el-col :span="24">
:rules="rules" <el-form-item prop="Name" label="用户名">
ref="formRef" <el-input v-model="form.Name" placeholder="请输入用户名"></el-input>
@submit.prevent="handleRegister" </el-form-item>
label-width="90px" </el-col>
> </el-row>
<el-row :gutter="24"> <el-row :gutter="24">
<el-col :span="24"> <el-col :span="24">
<el-form-item prop="Name" label="用户名"> <el-form-item prop="Email" label="邮箱">
<el-input <el-input v-model="form.Email" placeholder="请输入邮箱"></el-input>
v-model="form.Name" </el-form-item>
placeholder="请输入用户名" </el-col>
></el-input> </el-row>
</el-form-item> <el-row :gutter="24">
</el-col> <el-col :span="24">
</el-row> <el-form-item prop="Password" label="密码">
<el-row :gutter="24"> <el-input v-model="form.Password" type="password" placeholder="请输入密码"></el-input>
<el-col :span="24"> </el-form-item>
<el-form-item prop="Email" label="邮箱"> </el-col>
<el-input </el-row>
v-model="form.Email" <el-row :gutter="24">
placeholder="请输入邮箱" <el-col :span="24">
></el-input> <el-form-item label="">
</el-form-item> <el-button type="primary" block native-type="submit">注册</el-button>
</el-col> </el-form-item>
</el-row> </el-col>
<el-row :gutter="24"> </el-row>
<el-col :span="24"> </el-form>
<el-form-item prop="Password" label="密码">
<el-input
v-model="form.Password"
type="password"
placeholder="请输入密码"
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="24">
<el-form-item label="">
<el-button type="primary" block native-type="submit"
>注册</el-button
>
</el-form-item>
</el-col>
</el-row>
</el-form>
<!-- 切换按钮 --> <!-- 切换按钮 -->
<div class="toggle-link"> <div class="toggle-link">
<span v-if="isLogin"></span> <span v-if="isLogin"></span>
<span v-if="!isLogin"></span> <span v-if="!isLogin"></span>
<el-button type="text" @click="toggleForm">{{ <el-button type="text" @click="toggleForm">{{ isLogin ? '' : '' }}</el-button>
isLogin ? "注册" : "登录" </div>
}}</el-button> </el-card>
</div> </div>
</el-card>
</div>
</template> </template>
<script setup> <script setup>
import { ref } from "vue"; import { ref } from 'vue'
import { login, register } from "@/api/login/login"; // import { login, register } from '@/api/login/login' //
import { useRouter } from "vue-router"; import { useRouter } from 'vue-router'
import { ElMessage } from "element-plus"; import { ElMessage } from 'element-plus'
const router = useRouter(); const router = useRouter()
const formRef = ref(null); const formRef = ref(null)
const form = ref({ const form = ref({
Name: "", Name: '',
Password: "", Password: ''
}); })
const isLogin = ref(true); // const isLogin = ref(true) //
const rules = { const rules = {
Password: [{ required: true, message: "请输入密码", trigger: "blur" }], Password: [
Name: [{ required: true, message: "请输入用户名", trigger: "blur" }], { required: true, message: '请输入密码', trigger: 'blur' }
}; ],
Name: [
{ required: true, message: '请输入用户名', trigger: 'blur' }
]
}
async function handleLogin() { async function handleLogin () {
await formRef.value.validate(async (valid) => { await formRef.value.validate(async (valid) => {
if (valid) { if (valid) {
try { try {
const res = await login({ const res = await login({
Name: form.value.Name, Name: form.value.Name,
Password: form.value.Password, Password: form.value.Password
}); })
if (res && res.token) { if (res && res.token) {
localStorage.setItem("token", res.token); localStorage.setItem('token', res.token)
router.push("/"); router.push('/')
} else {
ElMessage.error('登录失败未返回token 🔑')
}
} catch (err) {
//ElMessage.error('')
console.error('登录错误:', err)
}
} else { } else {
ElMessage.error("登录失败未返回token 🔑"); ElMessage.warning('请完整填写表单')
} }
} catch (err) { })
//ElMessage.error('')
console.error("登录错误:", err);
}
} else {
ElMessage.warning("请完整填写表单");
}
});
} }
async function handleRegister() { async function handleRegister () {
await formRef.value.validate(async (valid) => { await formRef.value.validate(async (valid) => {
if (valid) { if (valid) {
try { try {
const res = await register({ const res = await register({
Name: form.value.Name, Name: form.value.Name,
Email: form.value.Email, Email: form.value.Email,
Password: form.value.Password, Password: form.value.Password
}); })
if (res) { if (res) {
ElMessage.success("注册成功 😀😀"); ElMessage.success('注册成功 😀😀')
toggleForm(); // toggleForm() //
} else {
ElMessage.error('注册失败 😢😢')
}
} catch (err) {
ElMessage.error('注册失败,请检查网络或重试 📶')
console.error('注册失败:', err)
}
} else { } else {
ElMessage.error("注册失败 😢😢"); ElMessage.warning('请完整填写表单')
} }
} catch (err) { })
ElMessage.error("注册失败,请检查网络或重试 📶");
console.error("注册失败:", err);
}
} else {
ElMessage.warning("请完整填写表单");
}
});
} }
function toggleForm() { function toggleForm () {
isLogin.value = !isLogin.value; // isLogin.value = !isLogin.value //
form.value = { form.value = {
Name: "", Name: '',
Password: "", Password: ''
}; }
formRef.value?.resetFields(); // formRef.value?.resetFields() //
} }
</script> </script>
<style scoped> <style scoped>
.login-page { .login-page {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
min-height: 100vh; min-height: 100vh;
background: var(--bg-gradient-secondary); background: linear-gradient(135deg, #0d47a1 0%, #1565c0 100%);
margin: 0; padding: 20px;
padding: 20px;
box-sizing: border-box;
} }
.login-card { .login-card {
width: 100%; width: 100%;
max-width: 420px; max-width: 500px;
background: var(--bg-card); padding: 30px;
border: 1px solid var(--border-color); background-color: rgba(255, 255, 255, 0.92);
border-radius: 12px; border-radius: 20px;
box-shadow: var(--shadow-lg); box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25), 0 0 15px rgba(0, 0, 0, 0.1);
backdrop-filter: blur(10px); backdrop-filter: blur(20px);
transition: transform 0.3s ease, box-shadow 0.3s ease; transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
} }
.login-card:hover { .login-card:hover {
transform: translateY(-5px); transform: translateY(-8px);
/* box-shadow: var(--shadow-lg), var(--glow-secondary); */ box-shadow: 0 15px 50px rgba(0, 0, 0, 0.18), 0 0 15px rgba(0, 0, 0, 0.08);
} }
.title { .title {
text-align: center; text-align: center;
color: var(--text-primary); margin-bottom: 40px;
font-size: 2em; font-size: 2.8rem;
margin-bottom: 1.5em; background: linear-gradient(45deg, #0d47a1, #1976d2);
text-shadow: var(--glow-secondary); -webkit-background-clip: text;
background-clip: text;
-webkit-text-fill-color: transparent;
font-weight: 800;
letter-spacing: 3px;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.15);
}
.el-input {
width: 100%;
} }
:deep(.el-input__wrapper) { .el-input :deep(.el-input__wrapper) {
background: rgba(255, 255, 255, 0.1); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
border: 1px solid var(--border-color); border-radius: 12px;
transition: all 0.3s ease; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
padding: 8px 15px;
} }
:deep(.el-input__wrapper:hover) { .el-input :deep(.el-input__wrapper:hover) {
background: rgba(255, 255, 255, 0.25); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
border-color: var(--primary-color); transform: translateY(-2px);
box-shadow: 0 0 10px rgba(255, 255, 255, 0.2), var(--glow-secondary);
} }
:deep(.el-input__wrapper.is-focus) { .el-button {
background: rgba(255, 255, 255, 0.3); width: 100%;
border-color: var(--primary-color); height: 48px;
box-shadow: 0 0 15px rgba(255, 255, 255, 0.3), var(--glow-primary); border-radius: 12px;
font-size: 17px;
font-weight: 600;
letter-spacing: 1.2px;
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
} }
:deep(.el-input__inner) { .el-button:not(.el-button--text) {
color: var(--text-primary); background: linear-gradient(45deg, #0d47a1, #1976d2);
border: none;
box-shadow: 0 4px 15px rgba(13, 71, 161, 0.4);
} }
:deep(.el-input__inner::placeholder) { .el-button:not(.el-button--text):hover {
color: var(--text-muted); transform: translateY(-3px);
box-shadow: 0 8px 25px rgba(30, 136, 229, 0.5);
} }
:deep(.el-form-item__label) { .toggle-link {
color: var(--text-secondary); margin-top: 35px;
text-align: center;
padding: 20px 16px 0;
border-top: 1px solid rgba(235, 238, 245, 0.8);
transition: all 0.3s ease;
} }
:deep(.el-button--primary) { .toggle-link span {
background: var(--primary-dark); margin-right: 8px;
border-color: var(--primary-dark); color: #606266;
height: 40px; font-size: 15px;
font-size: 16px;
transition: all 0.3s ease;
color: var(--text-primary);
} }
:deep(.el-button--primary:hover) { .toggle-link .el-button {
background: var(--primary-dark); padding: 0;
border-color: var(--primary-dark); font-size: 16px;
transform: translateY(-2px); font-weight: 600;
box-shadow: var(--glow-primary); background: none;
color: var(--text-white); transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
margin-left: 4px;
height: auto;
} }
:deep(.el-button--text) { .toggle-link .el-button:hover {
color: var(--primary-color); color: #1e88e5;
transition: all 0.3s ease; transform: scale(1.08);
text-shadow: 0 0 10px rgba(30, 136, 229, 0.3);
} }
:deep(.el-button--text:hover) { .el-form-item {
color: var(--primary-light); margin-bottom: 28px;
text-shadow: var(--glow-secondary);
} }
.toggle-link { @media (max-width: 576px) {
text-align: center; .login-card {
margin-top: 1em; padding: 25px;
color: var(--text-secondary); }
.title {
font-size: 2.2rem;
margin-bottom: 35px;
}
} }
</style> </style>

@ -1,326 +1,131 @@
<template> <template>
<div class="home-page"> <div class="home-page">
<!-- 粒子背景 --> <!-- 粒子背景 -->
<Particles id="tsparticles" :options="particlesOptions" /> <Particles id="tsparticles" :options="particlesOptions" />
<!-- 页面内容 --> <!-- 页面内容 -->
<div class="content"> <div class="content">
<div class="title-container"> <h1 class="title">欢迎来到钓鱼大冒险</h1>
<h1 class="title">欢迎来到钓鱼大冒险</h1>
<p class="subtitle">开启你的海洋探索之旅</p> <el-card class="menu-card">
</div> <el-row :gutter="20" justify="center">
<el-col :span="8" v-for="item in menuItems" :key="item.name">
<div class="menu-grid"> <el-button type="primary" size="large" class="menu-btn" @click="navigateTo(item.route)" plain>
<div {{ item.label }}
v-for="item in menuItems" </el-button>
:key="item.name" </el-col>
class="menu-item" </el-row>
@click="navigateTo(item.route)" </el-card>
>
<div class="menu-card">
<div class="menu-icon" v-html="item.icon"></div>
<h3 class="menu-title">{{ item.label }}</h3>
<p class="menu-description">{{ item.description }}</p>
</div>
</div> </div>
</div>
</div> </div>
</div>
</template> </template>
<script setup> <script setup>
import { useRouter } from "vue-router"; import { useRouter } from 'vue-router'
const router = useRouter(); const router = useRouter()
const menuItems = [ const menuItems = [
{ { label: '🎒 查看装备', route: 'equipments' },
label: "查看装备", { label: '🎣 拉竿钓鱼', route: 'fishing' },
route: "equipments", { label: '🐟 查看鱼篓', route: 'fishbaskets' },
icon: `<svg viewBox="0 0 24 24" width="32" height="32"><path fill="currentColor" d="M20 7h-5V4c0-1.1-.9-2-2-2h-2C9.9 2 9 2.9 9 4v3H4c-1.1 0-2 .9-2 2v11c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V9c0-1.1-.9-2-2-2zM9 12c.83 0 1.5.67 1.5 1.5S9.83 15 9 15s-1.5-.67-1.5-1.5S8.17 12 9 12zm6 6H9v-.75c0-1 2-1.5 3-1.5s3 .5 3 1.5V18z"/></svg>`, { label: '🛒 道具商店', route: 'shop' },
description: "管理你的钓鱼装备和道具", { label: '💰 市场信息', route: 'market' },
}, { label: '🏆 游戏排名', route: 'ranking' }
{ ]
label: "拉竿钓鱼",
route: "fishing",
icon: `<svg viewBox="0 0 24 24" width="32" height="32"><path fill="currentColor" d="M12 12.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5zm0 4a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm1-7.5V5.7c3.4-.4 6-3.2 6-6.7h-2c0 2.8-2.2 5-5 5S7 1.8 7 -1H5c0 3.5 2.6 6.3 6 6.7V9H9v2h6V9h-2z"/></svg>`,
description: "开始一场精彩的钓鱼冒险",
},
{
label: "查看鱼篓",
route: "fishbaskets",
icon: `<svg viewBox="0 0 24 24" width="32" height="32"><path fill="currentColor" d="M18.5 11c.17 0 .34.01.5.03V7c0-1.1-.9-2-2-2h-1V3c0-.55-.45-1-1-1h-6c-.55 0-1 .45-1 1v2H7c-1.1 0-2 .9-2 2v4.03c.16-.02.33-.03.5-.03.83 0 1.58.34 2.12.88.54-.54 1.29-.88 2.12-.88.83 0 1.58.34 2.12.88.54-.54 1.29-.88 2.12-.88M9 4h6v1H9zm10 16H5c-.55 0-1-.45-1-1v-8.51c.42-.34.75-.77.93-1.27.18-.5.19-1.03.03-1.53-.22-.67-.74-1.19-1.41-1.41-.21-.07-.43-.11-.65-.13V7c0-.55.45-1 1-1h1v2c0 .55.45 1 1 1h8c.55 0 1-.45 1-1V6h1c.55 0 1 .45 1 1v.14c-.22.02-.44.06-.65.13-.67.22-1.19.74-1.41 1.41-.16.5-.15 1.03.03 1.53.18.5.51.93.93 1.27V19c0 .55-.45 1-1 1z"/></svg>`,
description: "查看你的渔获和战利品",
},
{
label: "道具商店",
route: "shop",
icon: `<svg viewBox="0 0 24 24" width="32" height="32"><path fill="currentColor" d="M7 18c-1.1 0-1.99.9-1.99 2S5.9 22 7 22s2-.9 2-2-.9-2-2-2zM1 2v2h2l3.6 7.59-1.35 2.45c-.16.28-.25.61-.25.96 0 1.1.9 2 2 2h12v-2H7.42c-.14 0-.25-.11-.25-.25l.03-.12.9-1.63h7.45c.75 0 1.41-.41 1.75-1.03l3.58-6.49c.08-.14.12-.31.12-.48 0-.55-.45-1-1-1H5.21l-.94-2H1zm16 16c-1.1 0-1.99.9-1.99 2s.89 2 1.99 2 2-.9 2-2-.9-2-2-2z"/></svg>`,
description: "购买钓鱼装备和特殊道具",
},
{
label: "市场信息",
route: "market",
icon: `<svg viewBox="0 0 24 24" width="32" height="32"><path fill="currentColor" d="M3.5 18.49l6-6.01 4 4L22 6.92l-1.41-1.41-7.09 7.97-4-4L2 16.99z"/></svg>`,
description: "了解最新的市场行情和价格",
},
{
label: "游戏排名",
route: "ranking",
icon: `<svg viewBox="0 0 24 24" width="32" height="32"><path fill="currentColor" d="M19 5h-2V3H7v2H5c-1.1 0-2 .9-2 2v1c0 2.55 1.92 4.63 4.39 4.94.63 1.5 1.98 2.63 3.61 2.96V19H7v2h10v-2h-4v-3.1c1.63-.33 2.98-1.46 3.61-2.96C19.08 12.63 21 10.55 21 8V7c0-1.1-.9-2-2-2zM7 10.82C5.84 10.4 5 9.3 5 8V7h2v3.82zM19 8c0 1.3-.84 2.4-2 2.82V7h2v1z"/></svg>`,
description: "查看玩家排行榜和成就",
},
];
const navigateTo = (page) => { const navigateTo = (page) => {
router.push({ name: page }); router.push({ name: page })
}; }
const particlesOptions = { const particlesOptions = {
background: { background: {
color: { value: "transparent" }, color: { value: "#001f3f" }
},
particles: {
number: { value: 50, density: { enable: true, area: 800 } },
color: {
value: [
"var(--primary-color)",
"var(--primary-dark)",
"var(--text-primary)",
],
},
shape: { type: ["circle", "star"] },
opacity: {
value: 0.6,
random: true,
anim: {
enable: true,
speed: 0.3,
opacity_min: 0.2,
sync: false,
},
},
size: {
value: 4,
random: true,
anim: {
enable: true,
speed: 1,
size_min: 0.2,
sync: false,
},
}, },
move: { particles: {
enable: true, number: { value: 40, density: { enable: true, area: 800 } },
speed: 1, color: { value: "#00d9ff" },
direction: "none", shape: { type: "circle" },
random: true, opacity: {
straight: false, value: 0.7,
outModes: { default: "bounce" }, random: true,
attract: { anim: {
enable: true, enable: true,
rotateX: 600, speed: 0.5,
rotateY: 1200, opacity_min: 0.3,
}, sync: false
}
},
size: {
value: 6,
random: true,
anim: {
enable: true,
speed: 2,
size_min: 0.3,
sync: false
}
},
move: {
enable: true,
speed: 1.5,
direction: "top",
outModes: { default: "out" }
}
}, },
links: { interactivity: {
enable: true, events: {
distance: 150, onHover: { enable: true, mode: "bubble" },
color: "var(--primary-color)", resize: true
opacity: 0.2, },
width: 1, modes: {
bubble: {
distance: 150,
size: 12,
duration: 2,
opacity: 1,
speed: 3
}
}
}, },
}, detectRetina: true
interactivity: { }
events: {
onHover: { enable: true, mode: ["grab", "bubble"] },
onClick: { enable: true, mode: "push" },
resize: true,
},
modes: {
grab: {
distance: 200,
links: { opacity: 0.8 },
},
bubble: {
distance: 200,
size: 6,
duration: 2,
opacity: 0.8,
speed: 3,
},
push: {
quantity: 4,
},
},
},
detectRetina: true,
};
</script> </script>
<style scoped> <style scoped>
.home-page { .home-page {
position: relative; position: relative;
min-height: 100vh; height: 100vh;
overflow: hidden; overflow: hidden;
background: var(--bg-gradient-primary);
display: flex;
align-items: center;
justify-content: center;
} }
#tsparticles { #tsparticles {
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
z-index: 0; z-index: 0;
} }
.content { .content {
position: relative; position: relative;
z-index: 1; z-index: 1;
width: 100%; max-width: 800px;
max-width: 1200px; margin: 60px auto;
margin: 20px auto; text-align: center;
padding: 10px;
} }
.title-container {
text-align: center;
margin-bottom: 60px;
}
.title { .title {
font-size: 3rem; font-size: 2.5rem;
font-weight: bold; font-weight: bold;
color: var(--text-primary); margin-bottom: 30px;
margin-bottom: 15px; color: #ffffff;
text-shadow: var(--glow-primary);
animation: glow 2s ease-in-out infinite alternate;
}
.subtitle {
font-size: 1.5rem;
color: var(--text-secondary);
margin-top: -10px;
text-shadow: var(--glow-secondary);
} }
.menu-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
gap: 12px;
padding: 8px;
max-width: 100%;
}
.menu-card { .menu-card {
background: rgba(255, 255, 255, 0.1); background-color: rgba(255, 255, 255, 0.85);
backdrop-filter: blur(15px); border-radius: 12px;
border-radius: 20px;
border: 1px solid rgba(255, 255, 255, 0.2);
padding: 20px 16px;
height: 100%;
min-height: 150px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
text-align: center;
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
transform-style: preserve-3d;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
cursor: pointer;
}
.menu-icon {
margin-bottom: 12px;
color: var(--primary-color);
transition: all 0.3s ease;
padding: 10px;
background: rgba(var(--primary-rgb), 0.1);
border-radius: 50%;
} }
.menu-btn {
.menu-title { width: 100%;
font-size: 1.2rem; margin-bottom: 15px;
font-weight: 700; font-size: 16px;
color: var(--text-primary);
margin-bottom: 8px;
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.menu-description {
font-size: 0.9rem;
color: var(--text-secondary);
margin: 0;
line-height: 1.4;
opacity: 0.9;
transition: opacity 0.3s ease;
}
.menu-card:hover {
transform: translateY(-8px);
background: rgba(255, 255, 255, 0.15);
border-color: var(--primary-color);
box-shadow: 0 12px 40px rgba(var(--primary-rgb), 0.2);
}
.menu-card:hover .menu-icon {
transform: scale(1.1);
color: var(--primary-dark);
background: rgba(var(--primary-rgb), 0.2);
}
.menu-title {
font-size: 1.4rem;
font-weight: 700;
color: var(--text-primary);
margin-bottom: 12px;
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.menu-description {
font-size: 1rem;
color: var(--text-secondary);
margin: 0;
line-height: 1.5;
opacity: 0.9;
transition: opacity 0.3s ease;
}
.menu-card:hover .menu-description {
opacity: 1;
}
@media (max-width: 768px) {
.title {
font-size: 2rem;
}
.subtitle {
font-size: 1rem;
}
.menu-grid {
grid-template-columns: 1fr;
padding: 6px;
gap: 10px;
}
.menu-card {
min-height: 140px;
padding: 16px 10px;
}
.menu-title {
font-size: 1.2rem;
}
.menu-description {
font-size: 0.85rem;
}
} }
</style> </style>

@ -1,356 +1,163 @@
<template> <template>
<div class="market-page"> <div class="market-page">
<div class="market-header"> <h1>🛒 京海鱼市交易中心</h1>
<h1 class="title">🛒 京海鱼市交易中心</h1>
<el-tabs v-model="activeTab" @tab-click="handleTabChange" type="border-card">
<el-tab-pane label="鱼市" name="all" />
<el-tab-pane label="我的市场" name="mine" />
<el-tab-pane label="交易记录" name="history" />
</el-tabs>
<!-- 鱼市表格 -->
<el-table v-if="activeTab === 'all'" :data="marketList" style="width: 100%" height="calc(100vh - 110px)" border>
<el-table-column prop="id" label="ID" width="80" />
<el-table-column prop="fishName" label="鱼名" />
<el-table-column prop="weight" label="重量" align="right" width="150" />
<el-table-column prop="sellerName" label="卖家" width="200" />
<el-table-column prop="points" label="价格(点数)" width="150" align="right" />
<el-table-column label="操作" width="150">
<template #default="{ row }">
<el-button type="success" @click="buyFish(row)"></el-button>
</template>
</el-table-column>
</el-table>
<!-- 我的市场表格 -->
<el-table v-if="activeTab === 'mine'" :data="myMarketList" style="width: 100%" height="calc(100vh - 110px)" border>
<el-table-column prop="id" label="ID" width="80" />
<el-table-column prop="fishName" label="鱼名" />
<el-table-column prop="points" label="挂售价格" align="right" />
<el-table-column label="操作">
<template #default="{ row }">
<el-button type="danger" @click="removeMyListing(row)"></el-button>
</template>
</el-table-column>
</el-table>
<!-- 历史记录 -->
<el-card v-if="activeTab === 'history'" class="history-box">
<div v-if="historyList.length">
<p v-for="(item, index) in historyList" :key="index">{{ item }}</p>
</div>
<div v-else>
<el-empty description="暂无交易记录" />
</div>
</el-card>
</div> </div>
<div class="market-controls">
<el-tabs
v-model="activeTab"
@tab-click="handleTabChange"
type="border-card"
>
<el-tab-pane label="鱼市" name="all" />
<el-tab-pane label="我的市场" name="mine" />
<el-tab-pane label="交易记录" name="history" />
</el-tabs>
<div v-if="activeTab !== 'history'" class="search-filters">
<div class="search-box">
<el-input
v-model="searchQuery"
placeholder="搜索鱼类..."
prefix-icon="Search"
clearable
/>
</div>
<div class="sort-control">
<el-select v-model="sortBy" placeholder="排序方式">
<el-option label="价格从低到高" value="priceAsc" />
<el-option label="价格从高到低" value="priceDesc" />
</el-select>
</div>
</div>
</div>
<!-- 鱼市展示 -->
<div v-if="activeTab === 'all'" class="market-grid">
<el-empty v-if="filteredMarketList.length === 0" description="暂无商品" />
<el-card
v-for="item in filteredMarketList"
:key="item.id"
class="fish-card"
>
<div class="fish-icon">🐟</div>
<h3 class="fish-name">{{ item.fishName }}</h3>
<div class="seller-info">
<span class="seller-label">卖家</span>
<span class="seller-name">{{ item.sellerName }}</span>
</div>
<div class="price-tag">
<span class="points-icon">💰</span>
<span class="points-value">{{ item.points }}</span>
</div>
<div class="card-action">
<el-button type="primary" @click="buyFish(item)"></el-button>
</div>
</el-card>
</div>
<!-- 我的市场 -->
<div v-if="activeTab === 'mine'" class="market-grid">
<el-empty
v-if="filteredMyMarketList.length === 0"
description="暂无挂售商品"
/>
<el-card
v-for="item in filteredMyMarketList"
:key="item.id"
class="fish-card my-listing"
>
<div class="fish-icon">🐟</div>
<h3 class="fish-name">{{ item.fishName }}</h3>
<div class="price-tag">
<span class="points-icon">💰</span>
<span class="points-value">{{ item.points }}</span>
</div>
<div class="card-action">
<el-button type="danger" @click="removeMyListing(item)"
>下架</el-button
>
</div>
</el-card>
</div>
<!-- 历史记录 -->
<el-card v-if="activeTab === 'history'" class="history-box">
<div v-if="historyList.length" class="history-list">
<div
v-for="(item, index) in historyList"
:key="index"
class="history-item"
>
{{ item }}
</div>
</div>
<el-empty v-else description="暂无交易记录" />
</el-card>
</div>
</template> </template>
<script setup> <script setup>
import { ref, computed, onMounted } from "vue"; import { ref, onMounted } from 'vue'
import { ElMessage, ElMessageBox } from "element-plus"; import { ElMessage, ElMessageBox } from 'element-plus'
import { import { getAllMarketplace, getMyMarketplace, getMarketplaceHistory, buyFromMarketplace, downMyFish } from '@/api/market/market'
getAllMarketplace,
getMyMarketplace,
getMarketplaceHistory,
buyFromMarketplace,
downMyFish,
} from "@/api/market/market";
const activeTab = ref("all"); const activeTab = ref('all')
const searchQuery = ref("");
const sortBy = ref("priceAsc");
const marketList = ref([]); const marketList = ref([])
const myMarketList = ref([]); const myMarketList = ref([])
const historyList = ref([]); const historyList = ref([])
//
const filteredMarketList = computed(() => {
let filtered = marketList.value.filter((item) =>
item.fishName.toLowerCase().includes(searchQuery.value.toLowerCase())
);
return filtered.sort((a, b) => {
if (sortBy.value === "priceAsc") {
return a.points - b.points;
} else {
return b.points - a.points;
}
});
});
//
const filteredMyMarketList = computed(() => {
return myMarketList.value.filter((item) =>
item.fishName.toLowerCase().includes(searchQuery.value.toLowerCase())
);
});
// //
const handleTabChange = () => { const handleTabChange = () => {
searchQuery.value = ""; if (activeTab.value === 'all') {
if (activeTab.value === "all") { fetchAllMarketplace()
fetchAllMarketplace(); } else if (activeTab.value === 'mine') {
} else if (activeTab.value === "mine") { fetchMyMarketplace()
fetchMyMarketplace(); } else if (activeTab.value === 'history') {
} else if (activeTab.value === "history") { fetchHistory()
fetchHistory(); }
} }
};
// //
const fetchAllMarketplace = async () => { const fetchAllMarketplace = async () => {
try { try {
const res = await getAllMarketplace(); const res = await getAllMarketplace()
marketList.value = res; marketList.value = res
} catch { } catch {
ElMessage.error("获取鱼市数据失败"); ElMessage.error('获取鱼市数据失败')
} }
}; }
// //
const fetchMyMarketplace = async () => { const fetchMyMarketplace = async () => {
try { try {
const res = await getMyMarketplace(); const res = await getMyMarketplace()
myMarketList.value = res; myMarketList.value = res
} catch { } catch {
ElMessage.error("获取我的市场数据失败"); ElMessage.error('获取我的市场数据失败')
} }
}; }
// //
const fetchHistory = async () => { const fetchHistory = async () => {
try { try {
const res = await getMarketplaceHistory(); const res = await getMarketplaceHistory()
historyList.value = res; historyList.value = res
} catch { } catch {
ElMessage.error("获取历史记录失败"); ElMessage.error('获取历史记录失败')
} }
}; }
// //
const buyFish = async (item) => { const buyFish = async (item) => {
try { try {
await ElMessageBox.confirm( await ElMessageBox.confirm(
`是否确认花费 ${item.points} 点数购买 ${item.fishName}`, `是否确认花费 ${item.points} 点数购买 ${item.fishName}`,
"确认购买", '确认购买',
{ {
confirmButtonText: "购买", confirmButtonText: '购买',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning", type: 'warning',
} }
); )
const res = await buyFromMarketplace(item.id); const res = await buyFromMarketplace(item.id)
if (res.success) { if (res.success) {
ElMessage.success("购买成功"); ElMessage.success('购买成功')
fetchAllMarketplace(); fetchAllMarketplace()
} else { } else {
ElMessage.error(res.message || "购买失败"); ElMessage.error(res.message || '购买失败')
} }
} catch (err) { } catch (err) {
if (err !== "cancel") { if (err !== 'cancel') {
ElMessage.error("购买过程中出错"); ElMessage.error('购买过程中出错')
}
} }
} }
};
// //
const removeMyListing = async (item) => { const removeMyListing = async (item) => {
try { try {
await ElMessageBox.confirm(`确定下架 ${item.fishName} 吗?`, "确认操作", { await ElMessageBox.confirm(`确定下架 ${item.fishName} 吗?`, '确认操作', {
confirmButtonText: "下架", confirmButtonText: '下架',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning", type: 'warning',
}); })
const res = await downMyFish(item.id); const res = await downMyFish(item.id)
if (res.success) { if (res.success) {
ElMessage.success("下架成功"); ElMessage.success('下架成功')
fetchMyMarketplace(); fetchMyMarketplace()
} else { } else {
ElMessage.error(res.message || "操作失败"); ElMessage.error(res.message || '操作失败')
} }
} catch (err) { } catch (err) {
if (err !== "cancel") { if (err !== 'cancel') {
ElMessage.error("操作失败"); ElMessage.error('操作失败')
}
} }
} }
};
onMounted(() => { onMounted(() => {
fetchAllMarketplace(); fetchAllMarketplace()
}); })
</script> </script>
<style scoped> <style scoped>
.market-page { .market-page {
padding: 20px; padding: 20px;
min-height: 100vh;
background: var(--bg-gradient-primary);
}
.market-header {
margin-bottom: 30px;
}
.title {
font-size: 2.5rem;
color: var(--text-primary);
margin: 0;
text-shadow: var(--glow-primary);
}
.market-controls {
margin-bottom: 30px;
}
.search-filters {
display: flex;
gap: 20px;
margin-top: 20px;
}
.search-box {
flex: 1;
}
.market-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
gap: 20px;
padding: 20px 0;
}
.fish-card {
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(10px);
border: none;
transition: all 0.3s ease;
&:hover {
transform: translateY(-5px);
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}
}
.fish-icon {
font-size: 2.5rem;
text-align: center;
margin-bottom: 15px;
}
.fish-name {
color: var(--text-primary);
margin: 0 0 10px 0;
font-size: 1.2rem;
text-align: center;
}
.seller-info {
text-align: center;
margin-bottom: 15px;
color: var(--text-secondary);
}
.price-tag {
display: flex;
justify-content: center;
align-items: center;
gap: 5px;
margin-bottom: 15px;
}
.points-value {
color: var(--primary-color);
font-size: 1.2rem;
font-weight: bold;
}
.card-action {
text-align: center;
} }
.history-box { .history-box {
background: rgba(255, 255, 255, 0.1); margin-top: 20px;
backdrop-filter: blur(10px); line-height: 1.8;
}
.history-list {
display: flex;
flex-direction: column;
gap: 10px;
}
.history-item {
padding: 10px;
border-radius: 8px;
background: rgba(255, 255, 255, 0.05);
color: var(--text-secondary);
}
@media (max-width: 768px) {
.title {
font-size: 2rem;
}
.search-filters {
flex-direction: column;
}
.market-grid {
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}
} }
</style> </style>

@ -1,301 +1,96 @@
<!--
* @Descripttion:
* @version: 1.0.0
* @Author: LyMy
* @Date: 2025-04-11 16:51:41
* @LastEditors: LyMy
* @LastEditTime: 2025-04-15 17:26:25
* @FilePath: \go_fish_web\src\pages\shop\Shop.vue
-->
<template> <template>
<div class="shop-page"> <div class="shop-page">
<div class="shop-header"> <h1>商店 - 您当前拥有 {{ points }} 积分</h1>
<h1 class="title">🏪 商店</h1>
<div class="points-display"> <el-table :data="items" style="width: 100%;" height="calc(100vh - 110px)" border>
<span class="points-icon">💰</span> <el-table-column label="ID" prop="id" width="100" align="center" />
<span class="points-value">{{ points }}</span> <el-table-column label="名称" prop="name" width="200" align="center" />
<span class="points-label">积分</span> <el-table-column label="描述" prop="description" />
</div> <el-table-column label="价格(积分)" prop="points" width="150" align="right" />
<el-table-column label="您已拥有" prop="myQuantity" width="150" align="right" />
<el-table-column label="操作" width="180" align="center">
<template #default="{ row }">
<el-button v-if="row.points <= points" type="primary" @click="buyItem(row)">
购买
</el-button>
<el-button v-else type="warning" disabled>
积分不足
</el-button>
</template>
</el-table-column>
</el-table>
</div> </div>
<div class="shop-controls">
<div class="search-box">
<el-input
v-model="searchQuery"
placeholder="搜索商品..."
prefix-icon="Search"
clearable
/>
</div>
<div class="category-tags">
<el-tag
:class="{ active: selectedCategory === 'all' }"
@click="selectedCategory = 'all'"
>全部</el-tag
>
<el-tag
v-for="category in categories"
:key="category"
:class="{ active: selectedCategory === category }"
@click="selectedCategory = category"
>{{ category }}</el-tag
>
</div>
</div>
<div class="items-grid">
<el-empty v-if="filteredItems.length === 0" description="暂无商品" />
<el-card
v-for="item in filteredItems"
:key="item.id"
class="item-card"
:class="{ 'insufficient-points': item.points > points }"
>
<div class="item-icon">
<span v-if="item.name.indexOf('竿') != -1" class="emoji-icon"
>🎣</span
>
<span v-else-if="item.name === ''" class="emoji-icon">🪱</span>
<span v-else-if="item.name === ''" class="emoji-icon">󠀻🏳</span>
<span v-else-if="item.name === ''" class="emoji-icon">🧰</span>
<span v-else class="emoji-icon">📦</span>
</div>
<h3 class="item-name">{{ item.name }}</h3>
<p class="item-description">{{ item.description }}</p>
<div class="item-details">
<div class="points-cost">
<span class="points-icon">💰</span>
{{ item.points }}
</div>
<div class="owned-quantity">已拥有: {{ item.myQuantity }}</div>
</div>
<div class="item-action">
<el-button
type="primary"
:disabled="item.points > points"
@click="buyItem(item)"
>
{{ item.points <= points ? "购买" : "积分不足" }}
</el-button>
</div>
</el-card>
</div>
</div>
</template> </template>
<script setup> <script setup>
import { ref, computed, onMounted } from "vue"; import { ref, onMounted } from 'vue'
import { whatCanIBuy, buy } from "@/api/shop/shop"; import { whatCanIBuy, buy } from '@/api/shop/shop'
import { import { ElButton, ElTable, ElTableColumn, ElMessage, ElInput, ElMessageBox } from 'element-plus'
ElButton,
ElCard,
ElTag,
ElInput,
ElMessage,
ElMessageBox,
ElEmpty,
} from "element-plus";
const points = ref(0); const points = ref(0) //
const items = ref([]); const items = ref([]) //
const searchQuery = ref("");
const selectedCategory = ref("all");
// //
const categories = ["装备", "道具", "特殊物品"];
//
const filteredItems = computed(() => {
return items.value.filter((item) => {
const matchesSearch =
item.name.toLowerCase().includes(searchQuery.value.toLowerCase()) ||
item.description.toLowerCase().includes(searchQuery.value.toLowerCase());
const matchesCategory =
selectedCategory.value === "all" ||
item.category === selectedCategory.value;
return matchesSearch && matchesCategory;
});
});
//
const fetchData = async () => { const fetchData = async () => {
try { try {
const pointsRes = await whatCanIBuy(); const pointsRes = await whatCanIBuy()
points.value = pointsRes.points; points.value = pointsRes.points
items.value = pointsRes.items.map((item) => ({ items.value = pointsRes.items
...item, } catch (err) {
category: categories[Math.floor(Math.random() * categories.length)], // ElMessage.error('加载数据失败,请重试 🛍️')
})); }
} catch (err) { }
ElMessage.error("加载数据失败,请重试 🛍️");
}
};
// //
const buyItem = async (good) => { const buyItem = async (good) => {
const { value: count } = await ElMessageBox.prompt( const { value: count } = await ElMessageBox.prompt('请输入购买数量', `物品名称 ${good.name}`, {
"请输入购买数量", confirmButtonText: '确认',
`购买 ${good.name}`, cancelButtonText: '取消',
{ inputPattern: /^(?:[1-9]\d{0,3}|10000)$/,
confirmButtonText: "确认", inputErrorMessage: '请输入 1 到 10000 之间的整数'
cancelButtonText: "取消", })
inputPattern: /^(?:[1-9]\d{0,3}|10000)$/,
inputErrorMessage: "请输入 1 到 10000 之间的整数", if (count) {
} try {
); const res = await await buy({ EquipmentId: good.id, Quantity: count })
if (res) {
if (count) { good.myQuantity += Number(count)
try { points.value -= good.points * count
const res = await buy({ EquipmentId: good.id, Quantity: count }); ElMessage.success("购买成功 😎")
if (res) { } else {
good.myQuantity += Number(count); ElMessage.error(res.message + ' 😞')
points.value -= good.points * count; }
ElMessage.success("购买成功 🎉"); } catch (err) {
} else { ElMessage.error('购买失败,请稍后再试 👿')
ElMessage.error(res.message + " 😞"); }
}
} catch (err) {
ElMessage.error("购买失败,请稍后再试 👿");
} }
} }
};
//
onMounted(() => { onMounted(() => {
fetchData(); fetchData()
}); })
</script> </script>
<style scoped> <style scoped>
.shop-page { .shop-page {
padding: 20px; margin: 20px;
min-height: 100vh;
background: var(--bg-gradient-primary);
}
.shop-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 30px;
} }
.title { .el-table {
font-size: 2.5rem; margin-top: 20px;
color: var(--text-primary);
margin: 0;
text-shadow: var(--glow-primary);
} }
.points-display { .el-button {
background: rgba(255, 255, 255, 0.1); margin-top: 10px;
padding: 10px 20px;
border-radius: 12px;
backdrop-filter: blur(10px);
display: flex;
align-items: center;
gap: 8px;
}
.points-value {
font-size: 1.5rem;
color: var(--primary-color);
font-weight: bold;
}
.points-label {
color: var(--text-secondary);
}
.shop-controls {
margin-bottom: 30px;
}
.search-box {
margin-bottom: 20px;
}
.category-tags {
display: flex;
gap: 10px;
flex-wrap: wrap;
}
.el-tag {
cursor: pointer;
transition: all 0.3s ease;
&.active {
background-color: var(--primary-color);
color: white;
}
}
.items-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
gap: 20px;
padding: 20px 0;
}
.item-card {
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(10px);
border: none;
transition: all 0.3s ease;
&:hover {
transform: translateY(-5px);
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}
&.insufficient-points {
opacity: 0.7;
}
}
.item-icon {
font-size: 2.5rem;
text-align: center;
margin-bottom: 15px;
}
.item-name {
color: var(--text-primary);
margin: 0 0 10px 0;
font-size: 1.2rem;
text-align: center;
}
.item-description {
color: var(--text-secondary);
font-size: 0.9rem;
margin-bottom: 15px;
min-height: 40px;
}
.item-details {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 15px;
color: var(--text-secondary);
}
.points-cost {
display: flex;
align-items: center;
gap: 5px;
color: var(--primary-color);
font-weight: bold;
}
.item-action {
text-align: center;
}
@media (max-width: 768px) {
.shop-header {
flex-direction: column;
gap: 20px;
text-align: center;
}
.title {
font-size: 2rem;
}
.items-grid {
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}
} }
</style> </style>

@ -24,9 +24,10 @@ a:hover {
body { body {
margin: 0; margin: 0;
display: flex;
place-items: center;
min-width: 320px; min-width: 320px;
height: 100vh; min-height: 100vh;
overflow: hidden;
} }
h1 { h1 {

@ -1,35 +0,0 @@
:root {
/* 主题色 */
--primary-color: #00d9ff;
--primary-light: #66b1ff;
--primary-dark: #0088cc;
/* 背景色 */
--bg-gradient-primary: linear-gradient(135deg, #001f3f 0%, #003366 100%);
--bg-gradient-secondary: linear-gradient(45deg, #0d47a1, #1976d2);
--bg-white: #ffffff;
--bg-light: #f5f7fa;
--bg-card: rgba(255, 255, 255, 0.1);
/* 文字颜色 */
--text-primary: #ffffff;
--text-secondary: rgba(255, 255, 255, 0.8);
--text-muted: rgba(255, 255, 255, 0.7);
--text-dark: #606266;
/* 边框和阴影 */
--border-color: rgba(255, 255, 255, 0.2);
--shadow-sm: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
--shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
--shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.25);
/* 状态颜色 */
--success-color: #67c23a;
--warning-color: #e6a23c;
--danger-color: #f56c6c;
--info-color: #909399;
/* 特效 */
--glow-primary: 0 0 10px rgba(0, 217, 255, 0.5);
--glow-secondary: 0 0 5px rgba(0, 217, 255, 0.3);
}
Loading…
Cancel
Save