Skip to content

Commit

Permalink
merged
Browse files Browse the repository at this point in the history
  • Loading branch information
hsyhhssyy committed May 30, 2024
2 parents 2f79fc1 + 9389c88 commit 5cf1de2
Show file tree
Hide file tree
Showing 12 changed files with 270 additions and 219 deletions.
51 changes: 25 additions & 26 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,43 @@
</template>

<script setup lang="ts">
import { ref, computed, watch, onMounted, onUnmounted } from 'vue';
import { useRoute,useRouter } from 'vue-router';
import DesktopApp from "@/desktop/DesktopApp.vue"
import MobileApp from "@/mobile/MobileApp.vue"
import { computed, onMounted, onUnmounted, ref, watch } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import DesktopApp from '@/desktop/DesktopApp.vue'
import MobileApp from '@/mobile/MobileApp.vue'
const route = useRoute();
const router = useRouter();
const key = ref(0);
const isMobile = ref(window.innerWidth < 768);
const route = useRoute()
const router = useRouter()
const key = ref(0)
const isMobile = ref(window.innerWidth < 768)
const layoutComponent = computed(() => {
if (route.path.startsWith('/m/')) {
return MobileApp;
} else {
return DesktopApp;
}
if (route.path.startsWith('/m/')) {
return MobileApp
} else {
return DesktopApp
}
})
const handleResize = () => {
isMobile.value = window.innerWidth < 768;
if (isMobile.value && !route.path.startsWith('/m/')) {
router.replace(`/m${route.fullPath}`);
}
};
isMobile.value = window.innerWidth < 768
if (isMobile.value && !route.path.startsWith('/m/')) {
router.replace(`/m${route.fullPath}`)
}
}
onMounted(() => {
window.addEventListener('resize', handleResize);
handleResize(); // 初始化检查
});
window.addEventListener('resize', handleResize)
handleResize() // 初始化检查
})
onUnmounted(() => {
window.removeEventListener('resize', handleResize);
});
window.removeEventListener('resize', handleResize)
})
watch(route, () => {
key.value++;
});
key.value++
})
</script>

<style scoped lang="scss">
Expand Down
5 changes: 3 additions & 2 deletions src/api/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { setData } from '@/utils'
interface UserToken {
email: string
token: string
message: string
}

export interface UserInfo {
Expand Down Expand Up @@ -40,7 +41,7 @@ export async function verifyTokenApi(token: string) {
setData('user-role', userRole)
}
const email = user.email ? user.email : ''
if(user.id) {
if (user.id) {
setData('email', email)
}
const userId = user.id
Expand Down Expand Up @@ -72,4 +73,4 @@ export async function registerApi(email: string, password: string, nickname: str
nickname: nickname
}
})
}
}
2 changes: 1 addition & 1 deletion src/api/game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ export async function statisticsApi(playerId: string): Promise<any> {
return await serverRequest.get({
url: '/api/gameHub/player/' + playerId + '/statistics'
})
}
}
2 changes: 1 addition & 1 deletion src/api/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { RequestConfig, HttpOptions } from '@/libs/http'
import type { HttpOptions, RequestConfig } from '@/libs/http'
import HttpRequest from '@/libs/http'
import { getData } from '@/utils'

Expand Down
70 changes: 40 additions & 30 deletions src/assets/bg.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 18 additions & 7 deletions src/desktop/views/LoginForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@
</template>
<template v-else>
<n-form-item label="邮箱">
<n-input v-model:value="email" type="text" placeholder="请输入邮箱" @keydown.enter="action" autocomplete="username">
<n-input
v-model:value="email"
type="text"
placeholder="请输入邮箱"
@keydown.enter="action"
autocomplete="username"
>
<template #prefix>
<icon :icon="Mail" />
</template>
Expand All @@ -25,7 +31,12 @@
</n-input>
</n-form-item>
<n-form-item label="重复密码" v-if="props.type === 'register'">
<n-input v-model:value="repeatPassword" type="password" placeholder="请输入密码" @keydown.enter="action">
<n-input
v-model:value="repeatPassword"
type="password"
placeholder="请输入密码"
@keydown.enter="action"
>
<template #prefix>
<icon :icon="KeyOne" />
</template>
Expand All @@ -51,7 +62,7 @@
import { Back, DoneAll, Game, KeyOne, Login as LoginIcon, Mail, User as UserIcon } from '@icon-park/vue-next'
import { ref } from 'vue'
import { useRouter } from 'vue-router'
import { verifyTokenApi, quickRegisterApi, loginApi, registerApi } from '@/api/account'
import { loginApi, quickRegisterApi, registerApi, verifyTokenApi } from '@/api/account'
import IconButton from '@/universal/components/IconButton.vue'
import Icon from '@/universal/components/Icon.vue'
import { toast } from '@/utils'
Expand Down Expand Up @@ -80,7 +91,7 @@ async function action() {
}
async function login() {
const res = await loginApi(email.value,password.value)
const res = await loginApi(email.value, password.value)
if (res && res.token) {
if (await verifyTokenApi(res.token)) {
await router.push('/')
Expand All @@ -93,11 +104,11 @@ async function register() {
await toast('两次密码不一致')
return
}
if(email.value === '') {
if (email.value === '') {
await toast('邮箱不能为空')
return
}
if(password.value === '') {
if (password.value === '') {
await toast('密码不能为空')
return
}
Expand All @@ -109,7 +120,7 @@ async function register() {
}
async function quickRegister() {
if(nickname.value === '') {
if (nickname.value === '') {
await toast('昵称不能为空')
return
}
Expand Down
2 changes: 1 addition & 1 deletion src/desktop/views/game/SchulteGrid.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

<script lang="ts" setup>
import type { CSSProperties } from 'vue'
import { onUnmounted, ref, computed, onMounted, watch } from 'vue'
import { computed, onMounted, onUnmounted, ref } from 'vue'
import { useRoute } from 'vue-router'
import { useGameHubStore } from '@/stores/gamehub'
import type { SignalrResponse } from '@/api/signalr'
Expand Down
48 changes: 28 additions & 20 deletions src/mobile/views/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
<div class="title">兔兔小游戏中心</div>
<n-tabs type="line" animated v-model:value="tab">
<n-tab-pane name="options" tab="options">
<n-space justify="center" style="align-content: flex-start;">
<n-space justify="center" style="align-content: flex-start">
<n-card class="option-item" hoverable embedded size="small" @click="tab = 'user'">
<div class="item user">我是注册用户</div>
</n-card>
</n-card>
<n-card class="option-item" hoverable embedded size="small" @click="tab = 'visitor'">
<div class="item visitor">我是游客</div>
</n-card>
Expand Down Expand Up @@ -41,24 +41,34 @@
<icon-button :icon="Back" @click="goBack">返回</icon-button>
</n-space>
</div>
<div class="bot-qrcode-container">
</div>
<div class="bot-qrcode-container"></div>
</div>
</n-tab-pane>
</n-tabs>
</div>
<div class="footer">
<div>本网站不是鹰角网络官方网站,而是由爱好者自行开发的工具网站。</div>
<div>
<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" alt="GitHub Logo"
width="12" height="12" />
<a class="friendly-link" href="https://github.com/hsyhhssyy/amiyabot-minigame-center-website"
target="_blank">
<img
src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png"
alt="GitHub Logo"
width="12"
height="12"
/>
<a
class="friendly-link"
href="https://github.com/hsyhhssyy/amiyabot-minigame-center-website"
target="_blank"
>
GitHub Repository
</a>
<n-divider vertical />
<img src="https://img.alicdn.com/tfs/TB1..50QpXXXXX7XpXXXXXXXXXX-40-40.png" alt="Beian Logo" width="12"
height="12" />
<img
src="https://img.alicdn.com/tfs/TB1..50QpXXXXX7XpXXXXXXXXXX-40-40.png"
alt="Beian Logo"
width="12"
height="12"
/>
<a class="friendly-link" href="https://beian.miit.gov.cn/" target="_blank"> 京ICP备2022033983号 </a>
</div>
</div>
Expand All @@ -68,8 +78,8 @@
<script setup lang="ts">
import { ref } from 'vue'
import { Back, MessageEmoji } from '@icon-park/vue-next'
import IconButton from '@/universal/components/IconButton.vue';
import LoginForm from '@/mobile/views/LoginForm.vue';
import IconButton from '@/universal/components/IconButton.vue'
import LoginForm from '@/mobile/views/LoginForm.vue'
const tab = ref('options')
Expand Down Expand Up @@ -134,7 +144,6 @@ async function addBotToGroup() {
}
}
.commercial {
display: flex;
flex-direction: column;
Expand All @@ -146,12 +155,12 @@ async function addBotToGroup() {
flex-grow: 1;
flex-shrink: 1;
display: flex;
align-items: center;
align-items: center;
justify-content: center;
background-image: url(../../assets/amiyabot-qqgroup.png);
background-size: contain;
background-repeat: no-repeat;
background-position: center;
background-position: center;
width: 100%;
}
}
Expand All @@ -163,11 +172,11 @@ async function addBotToGroup() {
color: gray;
padding-bottom: 10px;
&>div:first-child {
& > div:first-child {
margin-bottom: 5px;
}
&>div:last-child {
& > div:last-child {
display: flex;
justify-content: center;
height: 16px;
Expand All @@ -183,7 +192,6 @@ async function addBotToGroup() {
font-size: 12px;
}
}
}
</style>
<style lang="scss">
Expand All @@ -193,12 +201,12 @@ async function addBotToGroup() {
display: none;
}
.n-tabs{
.n-tabs {
flex-grow: 1;
flex-shrink: 1;
}
.n-tabs .n-tabs-pane-wrapper{
.n-tabs .n-tabs-pane-wrapper {
flex-grow: 1;
flex-shrink: 1;
overflow-y: visible;
Expand Down
Loading

0 comments on commit 5cf1de2

Please sign in to comment.