fix: frontend

This commit is contained in:
Rogee
2024-09-20 01:04:28 +08:00
parent b8499ca97d
commit 146b0ed55a
42 changed files with 4276 additions and 44 deletions

View File

@@ -0,0 +1,37 @@
<template>
<h1 class="mb-4 font-semibold text-xl">{{ channel.Title }}</h1>
<ListItem v-for="item in items" :key="item.id" :item="item" />
</template>
<script setup>
import { useRoute } from "vue-router";
import { onMounted, ref } from "vue";
import { channelMessages, channelInfo } from "../request";
import ListItem from "../components/ListItem.vue";
const route = useRoute();
const channel = ref({});
const items = ref([]);
onMounted(() => {
channelInfo(route.params.channel).then((resp) => {
channel.value = resp.data;
});
channelMessages(route.params.channel).then((resp) => {
let data = resp.data;
data.map((item) => {
let media = item.Media.replace(/"asset_id":\s(\d+)/g, (match, p1, p2, p3, offset, string) => {
return `"asset_id": "${p1}"`
})
item.Media = JSON.parse(media).filter((item) => {
return Object.keys(item).length > 0;
});
console.log(item);
});
items.value = data;
});
});
</script>