mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-05-10 04:37:29 +08:00
fix: 活动页增加loading/个人等级增加loading
This commit is contained in:
@@ -45,9 +45,10 @@ export default {
|
|||||||
gap: 10px;
|
gap: 10px;
|
||||||
min-width: 200px;
|
min-width: 200px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.activity-popup-icon {
|
.activity-popup-icon {
|
||||||
width: 80px;
|
width: 100px;
|
||||||
height: 80px;
|
height: 100px;
|
||||||
object-fit: contain;
|
object-fit: contain;
|
||||||
}
|
}
|
||||||
.activity-popup-actions {
|
.activity-popup-actions {
|
||||||
|
|||||||
@@ -41,8 +41,8 @@ export default {
|
|||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
backdrop-filter: blur(3px);
|
backdrop-filter: blur(2px);
|
||||||
-webkit-backdrop-filter: blur(3px);
|
-webkit-backdrop-filter: blur(2px);
|
||||||
}
|
}
|
||||||
.popup-content {
|
.popup-content {
|
||||||
position: relative;
|
position: relative;
|
||||||
@@ -51,5 +51,8 @@ export default {
|
|||||||
padding: 20px;
|
padding: 20px;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
|
||||||
|
max-width: 80%;
|
||||||
|
max-height: 80%;
|
||||||
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -17,9 +17,16 @@
|
|||||||
<ProgressBar :value="info.level1Count" :max="50" />
|
<ProgressBar :value="info.level1Count" :max="50" />
|
||||||
<div class="status-text">当前 {{ info.level1Count }} / 50</div>
|
<div class="status-text">当前 {{ info.level1Count }} / 50</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="user" class="user-level">
|
<div v-if="isLoadingUser" class="loading-user">
|
||||||
|
<l-hatch size="28" stroke="4" speed="3.5" color="var(--primary-color)"></l-hatch>
|
||||||
|
<div class="user-level-text">加载当前等级中...</div>
|
||||||
|
</div>
|
||||||
|
<div v-else-if="user" class="user-level">
|
||||||
<LevelProgress :exp="user.experience" :current-level="user.currentLevel" :next-exp="user.nextLevelExp" />
|
<LevelProgress :exp="user.experience" :current-level="user.currentLevel" :next-exp="user.nextLevelExp" />
|
||||||
</div>
|
</div>
|
||||||
|
<div v-else class="user-level">
|
||||||
|
<div class="user-level-text"><i class="fas fa-user-circle"></i> 请登录查看自身等级</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="user && user.currentLevel >= 1 && !info.ended" class="redeem-button" @click="openDialog">兑换</div>
|
<div v-if="user && user.currentLevel >= 1 && !info.ended" class="redeem-button" @click="openDialog">兑换</div>
|
||||||
<div v-else class="redeem-button disabled">兑换</div>
|
<div v-else class="redeem-button disabled">兑换</div>
|
||||||
@@ -42,6 +49,8 @@ import BaseInput from './BaseInput.vue'
|
|||||||
import BasePopup from './BasePopup.vue'
|
import BasePopup from './BasePopup.vue'
|
||||||
import { API_BASE_URL, toast } from '../main'
|
import { API_BASE_URL, toast } from '../main'
|
||||||
import { getToken, fetchCurrentUser } from '../utils/auth'
|
import { getToken, fetchCurrentUser } from '../utils/auth'
|
||||||
|
import { hatch } from 'ldrs'
|
||||||
|
hatch.register()
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'MilkTeaActivityComponent',
|
name: 'MilkTeaActivityComponent',
|
||||||
@@ -52,12 +61,15 @@ export default {
|
|||||||
user: null,
|
user: null,
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
contact: '',
|
contact: '',
|
||||||
loading: false
|
loading: false,
|
||||||
|
isLoadingUser: true,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async mounted () {
|
async mounted () {
|
||||||
await this.loadInfo()
|
await this.loadInfo()
|
||||||
|
this.isLoadingUser = true
|
||||||
this.user = await fetchCurrentUser()
|
this.user = await fetchCurrentUser()
|
||||||
|
this.isLoadingUser = false
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async loadInfo () {
|
async loadInfo () {
|
||||||
@@ -167,9 +179,6 @@ export default {
|
|||||||
position: relative;
|
position: relative;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
background-color: var(--background-color);
|
background-color: var(--background-color);
|
||||||
padding: 20px;
|
|
||||||
border-radius: 8px;
|
|
||||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
@@ -210,6 +219,11 @@ export default {
|
|||||||
.redeem-cancel-button:hover {
|
.redeem-cancel-button:hover {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
.user-level-text {
|
||||||
|
opacity: 0.8;
|
||||||
|
font-size: 12px;
|
||||||
|
color: var(--primary-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@media screen and (max-width: 768px) {
|
@media screen and (max-width: 768px) {
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="activity-list-page">
|
<div class="activity-list-page">
|
||||||
|
<div v-if="isLoadingActivities" class="loading-activities">
|
||||||
|
<l-hatch size="28" stroke="4" speed="3.5" color="var(--primary-color)"></l-hatch>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="activity-list-page-card" v-for="a in activities" :key="a.id">
|
<div class="activity-list-page-card" v-for="a in activities" :key="a.id">
|
||||||
<div class="activity-list-page-card-normal">
|
<div class="activity-list-page-card-normal">
|
||||||
<div v-if="a.icon" class="activity-card-normal-left">
|
<div v-if="a.icon" class="activity-card-normal-left">
|
||||||
@@ -29,23 +33,43 @@
|
|||||||
import { API_BASE_URL } from '../main'
|
import { API_BASE_URL } from '../main'
|
||||||
import TimeManager from '../utils/time'
|
import TimeManager from '../utils/time'
|
||||||
import MilkTeaActivityComponent from '../components/MilkTeaActivityComponent.vue'
|
import MilkTeaActivityComponent from '../components/MilkTeaActivityComponent.vue'
|
||||||
|
import { hatch } from 'ldrs'
|
||||||
|
hatch.register()
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ActivityListPageView',
|
name: 'ActivityListPageView',
|
||||||
components: { MilkTeaActivityComponent },
|
components: { MilkTeaActivityComponent },
|
||||||
data() {
|
data() {
|
||||||
return { activities: [], TimeManager }
|
return {
|
||||||
|
activities: [],
|
||||||
|
TimeManager,
|
||||||
|
isLoadingActivities: false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
async mounted() {
|
async mounted() {
|
||||||
const res = await fetch(`${API_BASE_URL}/api/activities`)
|
this.isLoadingActivities = true
|
||||||
if (res.ok) {
|
try {
|
||||||
this.activities = await res.json()
|
const res = await fetch(`${API_BASE_URL}/api/activities`)
|
||||||
|
if (res.ok) {
|
||||||
|
this.activities = await res.json()
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e)
|
||||||
|
} finally {
|
||||||
|
this.isLoadingActivities = false
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.loading-activities {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
height: 300px;
|
||||||
|
}
|
||||||
|
|
||||||
.activity-list-page {
|
.activity-list-page {
|
||||||
background-color: var(--background-color);
|
background-color: var(--background-color);
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
|
|||||||
@@ -439,7 +439,7 @@ export default {
|
|||||||
.topic-container {
|
.topic-container {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: 0;
|
top: 0;
|
||||||
z-index: 100;
|
z-index: 10;
|
||||||
background-color: var(--background-color);
|
background-color: var(--background-color);
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
|
|||||||
Reference in New Issue
Block a user