-
请先在顶部选择社区
-
暂无活动,点击右上角创建第一个活动
+
暂无活动,点击右上角创建第一个活动
+
+
+
+
+
@@ -112,11 +121,11 @@ import { ElMessage } from 'element-plus'
import { Flag, Plus, Calendar, Location } from '@element-plus/icons-vue'
import { listEvents, createEvent } from '../api/event'
import type { EventListItem } from '../api/event'
-import { useCommunityStore } from '../stores/community'
+import { useAuthStore } from '../stores/auth'
const router = useRouter()
-const communityStore = useCommunityStore()
-const hasCommunity = computed(() => !!communityStore.currentCommunityId)
+const authStore = useAuthStore()
+const communities = computed(() => authStore.communities)
const loading = ref(false)
const creating = ref(false)
@@ -131,6 +140,7 @@ const showCreateDialog = ref(false)
const createForm = ref({
title: '',
event_type: 'offline',
+ community_id: null as number | null,
planned_at: null as string | null,
location: '',
description: '',
@@ -170,11 +180,6 @@ function formatDate(dt: string | null): string {
}
async function loadEvents() {
- if (!hasCommunity.value) {
- events.value = []
- total.value = 0
- return
- }
loading.value = true
try {
const data = await listEvents({
@@ -193,7 +198,7 @@ async function loadEvents() {
}
function openCreateDialog() {
- createForm.value = { title: '', event_type: 'offline', planned_at: null, location: '', description: '' }
+ createForm.value = { title: '', event_type: 'offline', community_id: null, planned_at: null, location: '', description: '' }
showCreateDialog.value = true
}
@@ -207,6 +212,7 @@ async function handleCreate() {
const event = await createEvent({
title: createForm.value.title,
event_type: createForm.value.event_type,
+ community_id: createForm.value.community_id || null,
planned_at: createForm.value.planned_at || null,
location: createForm.value.location || null,
description: createForm.value.description || null,