mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-04-20 19:07:42 +08:00
feat: 活动页面基础ui
This commit is contained in:
@@ -14,7 +14,7 @@
|
|||||||
--menu-text-color: black;
|
--menu-text-color: black;
|
||||||
--scroller-background-color: rgba(130, 175, 180, 0.5);
|
--scroller-background-color: rgba(130, 175, 180, 0.5);
|
||||||
--normal-background-color: rgb(241, 241, 241);
|
--normal-background-color: rgb(241, 241, 241);
|
||||||
--login-background-color: rgb(241, 241, 241);
|
--login-background-color: rgb(248, 248, 248);
|
||||||
--login-background-color-hover: #e0e0e0;
|
--login-background-color-hover: #e0e0e0;
|
||||||
--text-color: black;
|
--text-color: black;
|
||||||
--blockquote-text-color: #6a737d;
|
--blockquote-text-color: #6a737d;
|
||||||
@@ -22,6 +22,7 @@
|
|||||||
--page-max-width: 1200px;
|
--page-max-width: 1200px;
|
||||||
--page-max-width-mobile: 900px;
|
--page-max-width-mobile: 900px;
|
||||||
--article-info-background-color: #f0f0f0;
|
--article-info-background-color: #f0f0f0;
|
||||||
|
--activity-card-background-color: #f0f0f0;
|
||||||
}
|
}
|
||||||
|
|
||||||
[data-theme='dark'] {
|
[data-theme='dark'] {
|
||||||
@@ -42,6 +43,7 @@
|
|||||||
--text-color: #eee;
|
--text-color: #eee;
|
||||||
--blockquote-text-color: #999;
|
--blockquote-text-color: #999;
|
||||||
--article-info-background-color: #747373;
|
--article-info-background-color: #747373;
|
||||||
|
--activity-card-background-color: #585858;
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
|
|||||||
@@ -1,19 +1,37 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="activity-list-page">
|
<div class="activity-list-page">
|
||||||
<h1>活动列表</h1>
|
<div class="activity-list-page-card" v-for="a in activities" :key="a.id">
|
||||||
<ul>
|
<div class="activity-list-page-card-normal">
|
||||||
<li v-for="a in activities" :key="a.id">{{ a.title }}</li>
|
<div v-if="a.icon" class="activity-card-normal-left">
|
||||||
</ul>
|
<img :src="a.icon" alt="avatar" class="activity-card-left-avatar-img" />
|
||||||
|
</div>
|
||||||
|
<div class="activity-card-normal-right">
|
||||||
|
<div class="activity-card-normal-right-header">
|
||||||
|
<div class="activity-list-page-card-title">{{ a.title }}</div>
|
||||||
|
<div v-if="a.ended" class="activity-list-page-card-state-end">已结束</div>
|
||||||
|
<div v-else class="activity-list-page-card-state-ongoing">进行中</div>
|
||||||
|
</div>
|
||||||
|
<div class="activity-list-page-card-content">{{ a.content }}</div>
|
||||||
|
<div class="activity-list-page-card-footer">
|
||||||
|
<div class="activity-list-page-card-footer-start-time">
|
||||||
|
<i class="fas fa-clock"></i>
|
||||||
|
<span>开始于 {{ TimeManager.format(a.startTime) }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { API_BASE_URL } from '../main'
|
import { API_BASE_URL } from '../main'
|
||||||
|
import TimeManager from '../utils/time'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ActivityListPageView',
|
name: 'ActivityListPageView',
|
||||||
data() {
|
data() {
|
||||||
return { activities: [] }
|
return { activities: [], TimeManager }
|
||||||
},
|
},
|
||||||
async mounted() {
|
async mounted() {
|
||||||
const res = await fetch(`${API_BASE_URL}/api/activities`)
|
const res = await fetch(`${API_BASE_URL}/api/activities`)
|
||||||
@@ -26,6 +44,77 @@ export default {
|
|||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.activity-list-page {
|
.activity-list-page {
|
||||||
padding: 10px;
|
background-color: var(--background-color);
|
||||||
|
padding: 20px;
|
||||||
|
height: calc(100vh - var(--header-height) - 40px);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.activity-list-page-card {
|
||||||
|
padding: 10px;
|
||||||
|
width: calc(100% - 20px);
|
||||||
|
gap: 10px;
|
||||||
|
background-color: var(--activity-card-background-color);
|
||||||
|
border-radius: 20px;
|
||||||
|
box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.activity-card-left-avatar-img {
|
||||||
|
width: 150px;
|
||||||
|
height: 150px;
|
||||||
|
border-radius: 10%;
|
||||||
|
object-fit: cover;
|
||||||
|
background-color: var(--background-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.activity-card-normal-right-header {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.activity-list-page-card-normal {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.activity-list-page-card-title {
|
||||||
|
font-size: 1.2rem;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.activity-list-page-card-content {
|
||||||
|
font-size: 1.0rem;
|
||||||
|
margin-top: 10px;
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.activity-list-page-card-footer {
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.activity-list-page-card-state-end,
|
||||||
|
.activity-list-page-card-state-ongoing {
|
||||||
|
font-size: 0.8rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.activity-list-page-card-state-end {
|
||||||
|
color: var(--text-color);
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.activity-list-page-card-state-ongoing {
|
||||||
|
color: var(--primary-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.activity-list-page-card-footer-start-time {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
gap: 5px;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -16,8 +16,10 @@ public class ActivityInitializer implements CommandLineRunner {
|
|||||||
public void run(String... args) {
|
public void run(String... args) {
|
||||||
if (activityRepository.findByType(ActivityType.MILK_TEA) == null) {
|
if (activityRepository.findByType(ActivityType.MILK_TEA) == null) {
|
||||||
Activity a = new Activity();
|
Activity a = new Activity();
|
||||||
a.setTitle("建站送奶茶活动");
|
a.setTitle("🎡建站送奶茶活动");
|
||||||
a.setType(ActivityType.MILK_TEA);
|
a.setType(ActivityType.MILK_TEA);
|
||||||
|
a.setIcon("https://icons.veryicon.com/png/o/food--drinks/delicious-food-1/coffee-36.png");
|
||||||
|
a.setContent("为了有利于建站推广以及激励发布内容,我们推出了建站送奶茶的活动,前50名达到level 1的用户,可以联系站长获取奶茶/咖啡一杯");
|
||||||
activityRepository.save(a);
|
activityRepository.save(a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ public class Activity {
|
|||||||
|
|
||||||
private String icon;
|
private String icon;
|
||||||
|
|
||||||
|
private String content;
|
||||||
|
|
||||||
@Column(name = "start_time", nullable = false)
|
@Column(name = "start_time", nullable = false)
|
||||||
@CreationTimestamp
|
@CreationTimestamp
|
||||||
private LocalDateTime startTime;
|
private LocalDateTime startTime;
|
||||||
|
|||||||
Reference in New Issue
Block a user