feat: 第一次提交,带登录
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
<template>
|
||||
<div class="equipments-page">
|
||||
<h1>查看装备</h1>
|
||||
<p>这是装备页面的内容。</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.equipments-page {
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,24 @@
|
||||
<!--
|
||||
* @Descripttion:
|
||||
* @version: 1.0.0
|
||||
* @Author: LyMy
|
||||
* @Date: 2025-04-11 16:33:21
|
||||
* @LastEditors: LyMy
|
||||
* @LastEditTime: 2025-04-11 16:36:40
|
||||
* @FilePath: \fish_game\src\pages\fishbaskets\Fishbaskets.vue
|
||||
-->
|
||||
<template>
|
||||
<div class="equipments-page">
|
||||
<h1>鱼篓</h1>
|
||||
<p>这是鱼篓内容。</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.equipments-page {
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,24 @@
|
||||
<!--
|
||||
* @Descripttion:
|
||||
* @version: 1.0.0
|
||||
* @Author: LyMy
|
||||
* @Date: 2025-04-11 16:33:21
|
||||
* @LastEditors: LyMy
|
||||
* @LastEditTime: 2025-04-11 16:36:53
|
||||
* @FilePath: \fish_game\src\pages\fishing\Fishing.vue
|
||||
-->
|
||||
<template>
|
||||
<div class="equipments-page">
|
||||
<h1>钓鱼</h1>
|
||||
<p>这是钓鱼内容。</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.equipments-page {
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,62 @@
|
||||
<!--
|
||||
* @Descripttion:
|
||||
* @version: 1.0.0
|
||||
* @Author: LyMy
|
||||
* @Date: 2025-04-11 15:46:41
|
||||
* @LastEditors: LyMy
|
||||
* @LastEditTime: 2025-04-11 16:23:46
|
||||
* @FilePath: \fish_game\src\pages\login\Login.vue
|
||||
-->
|
||||
<template>
|
||||
<div class="login-page">
|
||||
<h1>登录</h1>
|
||||
<form @submit.prevent="handleLogin">
|
||||
<input v-model="Name" placeholder="用户名" />
|
||||
<input v-model="Password" type="password" placeholder="密码" />
|
||||
<button type="submit">登录</button>
|
||||
</form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { login } from '@/api/login/login'
|
||||
import { useRouter } from 'vue-router'
|
||||
|
||||
const router = useRouter()
|
||||
const Name = ref('')
|
||||
const Password = ref('')
|
||||
|
||||
async function handleLogin () {
|
||||
try {
|
||||
const res = await login({ Name: Name.value, Password: Password.value })
|
||||
if (res && res.token) {
|
||||
localStorage.setItem('token', res.token)
|
||||
router.push('/')
|
||||
} else {
|
||||
alert('登录失败,未返回token')
|
||||
}
|
||||
} catch (err) {
|
||||
alert('登录失败,请检查网络或重试')
|
||||
console.error('登录错误:', err)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style scoped>
|
||||
.login-page {
|
||||
max-width: 400px;
|
||||
margin: 100px auto;
|
||||
text-align: center;
|
||||
}
|
||||
input {
|
||||
display: block;
|
||||
margin: 10px auto;
|
||||
padding: 8px;
|
||||
width: 80%;
|
||||
}
|
||||
button {
|
||||
padding: 10px 20px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,50 @@
|
||||
<template>
|
||||
<div class="home-page">
|
||||
<h1>欢迎来到钓鱼游戏</h1>
|
||||
|
||||
<!-- 菜单栏 -->
|
||||
<div class="menu">
|
||||
<ul>
|
||||
<li @click="navigateTo('equipments')">查看装备</li>
|
||||
<li @click="navigateTo('fishing')">拉竿</li>
|
||||
<li @click="navigateTo('fishbaskets')">查看鱼篓</li>
|
||||
<li @click="navigateTo('shop')">商店</li>
|
||||
<li @click="navigateTo('market')">市场</li>
|
||||
<li @click="navigateTo('ranking')">排名系统</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { useRouter } from 'vue-router'
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
// 跳转函数
|
||||
const navigateTo = (page) => {
|
||||
router.push({ name: page }) // 根据页面名称跳转
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.home-page {
|
||||
text-align: center;
|
||||
}
|
||||
.menu {
|
||||
margin-top: 20px;
|
||||
}
|
||||
.menu ul {
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
}
|
||||
.menu li {
|
||||
margin: 10px 0;
|
||||
cursor: pointer;
|
||||
font-size: 18px;
|
||||
color: #007bff;
|
||||
}
|
||||
.menu li:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,24 @@
|
||||
<!--
|
||||
* @Descripttion:
|
||||
* @version: 1.0.0
|
||||
* @Author: LyMy
|
||||
* @Date: 2025-04-11 16:33:21
|
||||
* @LastEditors: LyMy
|
||||
* @LastEditTime: 2025-04-11 16:36:40
|
||||
* @FilePath: \fish_game\src\pages\fishbaskets\Fishbaskets.vue
|
||||
-->
|
||||
<template>
|
||||
<div class="equipments-page">
|
||||
<h1>市场</h1>
|
||||
<p>这是市场</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.equipments-page {
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,24 @@
|
||||
<!--
|
||||
* @Descripttion:
|
||||
* @version: 1.0.0
|
||||
* @Author: LyMy
|
||||
* @Date: 2025-04-11 16:33:21
|
||||
* @LastEditors: LyMy
|
||||
* @LastEditTime: 2025-04-11 16:36:40
|
||||
* @FilePath: \fish_game\src\pages\fishbaskets\Fishbaskets.vue
|
||||
-->
|
||||
<template>
|
||||
<div class="equipments-page">
|
||||
<h1>排名</h1>
|
||||
<p>这是排名内容。</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.equipments-page {
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,24 @@
|
||||
<!--
|
||||
* @Descripttion:
|
||||
* @version: 1.0.0
|
||||
* @Author: LyMy
|
||||
* @Date: 2025-04-11 16:33:21
|
||||
* @LastEditors: LyMy
|
||||
* @LastEditTime: 2025-04-11 16:36:40
|
||||
* @FilePath: \fish_game\src\pages\fishbaskets\Fishbaskets.vue
|
||||
-->
|
||||
<template>
|
||||
<div class="equipments-page">
|
||||
<h1>商店</h1>
|
||||
<p>这是商店内容。</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.equipments-page {
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user