fix: issues
This commit is contained in:
@@ -1,6 +0,0 @@
|
||||
let str = "[{\"photo\": \"6274031756223036782.jpg\", \"msg_id\": 26781, \"asset_id\": 6274031756223036782}, {\"photo\": \"6274031756223036783.jpg\", \"msg_id\": 26782, \"asset_id\": 6274031756223036783}, {\"photo\": \"6274031756223036784.jpg\", \"msg_id\": 26783, \"asset_id\": 6274031756223036784}, {\"photo\": \"6274031756223036785.jpg\", \"msg_id\": 26784, \"asset_id\": 6274031756223036785}, {\"photo\": \"6274031756223036786.jpg\", \"msg_id\": 26785, \"asset_id\": 6274031756223036786}, {\"photo\": \"6274031756223036787.jpg\", \"msg_id\": 26786, \"asset_id\": 6274031756223036787}, {\"photo\": \"6274031756223036788.jpg\", \"msg_id\": 26787, \"asset_id\": 6274031756223036788}, {\"photo\": \"6274031756223036789.jpg\", \"msg_id\": 26788, \"asset_id\": 6274031756223036789}, {\"photo\": \"6274031756223036790.jpg\", \"msg_id\": 26789, \"asset_id\": 6274031756223036790}, {\"photo\": \"6274031756223036791.jpg\", \"msg_id\": 26790, \"asset_id\": 6274031756223036791}]"
|
||||
str = str.replace(/"asset_id":\s(\d+)/g, (match, p1, p2, p3, offset, string) => {
|
||||
return `"asset_id": "${p1}"`
|
||||
})
|
||||
|
||||
console.log(str)
|
||||
@@ -1,37 +0,0 @@
|
||||
[
|
||||
{
|
||||
"photo": "6330272214070443931.jpg",
|
||||
"msg_id": 26701,
|
||||
"asset_id": 6330272214070443931
|
||||
},
|
||||
{
|
||||
"photo": "6330272214070443932.jpg",
|
||||
"msg_id": 26702,
|
||||
"asset_id": 6330272214070443932
|
||||
},
|
||||
{
|
||||
"photo": "6330272214070443933.jpg",
|
||||
"msg_id": 26703,
|
||||
"asset_id": 6330272214070443933
|
||||
},
|
||||
{
|
||||
"photo": "6330272214070443934.jpg",
|
||||
"msg_id": 26704,
|
||||
"asset_id": 6330272214070443934
|
||||
},
|
||||
{
|
||||
"msg_id": 26705,
|
||||
"asset_id": 6330272213614202883,
|
||||
"document": {
|
||||
"Ext": ".mp4",
|
||||
"Size": 2235348,
|
||||
"Video": {
|
||||
"Width": 576,
|
||||
"Height": 1280,
|
||||
"Duration": 25.147
|
||||
},
|
||||
"Filename": "",
|
||||
"MimeType": "video/mp4"
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -4,7 +4,7 @@
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Vite + Vue + TS</title>
|
||||
<title>TGShow</title>
|
||||
</head>
|
||||
<body class="bg-slate-300">
|
||||
<div id="app"></div>
|
||||
|
||||
3
frontend/src/.gitignore
vendored
Normal file
3
frontend/src/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
|
||||
*.js
|
||||
*.vue.js
|
||||
@@ -27,14 +27,14 @@ export default defineComponent({
|
||||
name: "ListItem",
|
||||
props: {
|
||||
item: {
|
||||
type: Object as PropType<PostItem>,
|
||||
type: Object ,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
setup(props) {
|
||||
const processedContent = computed(() => {
|
||||
let content = props.item.Content.trim();
|
||||
return nl2br(content);
|
||||
return nl2br(content,false);
|
||||
});
|
||||
|
||||
return {
|
||||
|
||||
@@ -1,8 +1,25 @@
|
||||
import { createApp } from 'vue'
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
import './style.css'
|
||||
|
||||
import { createRouter, createWebHistory } from 'vue-router'
|
||||
|
||||
import ChannelMessages from './views/ChannelMessages.vue'
|
||||
import FavoritesMessages from './views/FavoritesMessages.vue'
|
||||
import Home from './views/Home.vue'
|
||||
|
||||
const routes = [
|
||||
{ path: '/', component: Home, name: 'home' },
|
||||
{ path: '/favorites', component: FavoritesMessages, name: 'favorites' },
|
||||
// { path: '/channels', component: Channel, name: 'channels' },
|
||||
{ path: '/channels/:channel/messages', component: ChannelMessages, name: 'channel-messages' },
|
||||
]
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes,
|
||||
})
|
||||
|
||||
createApp(App)
|
||||
.use(router)
|
||||
.mount('#app')
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
import axios from 'axios';
|
||||
|
||||
axios.defaults.baseURL = '/api';
|
||||
axios.defaults.headers.post['Content-Type'] = 'application/json';
|
||||
axios.defaults.headers.put['Content-Type'] = 'application/json';
|
||||
|
||||
export interface Pagination {
|
||||
page: number;
|
||||
limit: number;
|
||||
}
|
||||
|
||||
export function channels() {
|
||||
return axios.get('/channels')
|
||||
}
|
||||
|
||||
export function channelInfo(id) {
|
||||
return axios.get(`/channels/${id}`);
|
||||
}
|
||||
|
||||
export function channelMessages(channelId, pagination: Pagination) {
|
||||
return axios.get(`/channels/${channelId}/messages`, {
|
||||
params: pagination,
|
||||
});
|
||||
}
|
||||
|
||||
export function favoriteMessages(pagination: Pagination) {
|
||||
return axios.get('/favorites', {
|
||||
params: pagination,
|
||||
});
|
||||
}
|
||||
|
||||
export function toggleFavoriteMessage(messageId) {
|
||||
return axios.patch(`/channels/${messageId}/messages`);
|
||||
}
|
||||
|
||||
export function deleteMessage(messageID) {
|
||||
return axios.delete(`/messages/${messageID}`);
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
import { createRouter, createWebHistory } from 'vue-router'
|
||||
|
||||
import ChannelMessages from './views/ChannelMessages.vue'
|
||||
import FavoritesMessages from './views/FavoritesMessages.vue'
|
||||
import Home from './views/Home.vue'
|
||||
|
||||
const routes = [
|
||||
{ path: '/', component: Home, name: 'home' },
|
||||
{ path: '/favorites', component: FavoritesMessages, name: 'favorites' },
|
||||
// { path: '/channels', component: Channel, name: 'channels' },
|
||||
{ path: '/channels/:channel/messages', component: ChannelMessages, name: 'channel-messages' },
|
||||
]
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes,
|
||||
})
|
||||
|
||||
export default router
|
||||
@@ -6,8 +6,8 @@
|
||||
<script setup>
|
||||
import { useRoute } from "vue-router";
|
||||
import { onMounted, ref } from "vue";
|
||||
import { channelMessages, channelInfo } from "../request";
|
||||
import ListItem from "../components/ListItem.vue";
|
||||
import axios from "axios";
|
||||
|
||||
const route = useRoute();
|
||||
|
||||
@@ -15,11 +15,11 @@ const channel = ref({});
|
||||
const items = ref([]);
|
||||
|
||||
onMounted(() => {
|
||||
channelInfo(route.params.channel).then((resp) => {
|
||||
axios.get(`/channels/${route.params.channel}`).then((resp) => {
|
||||
channel.value = resp.data;
|
||||
});
|
||||
|
||||
channelMessages(route.params.channel).then((resp) => {
|
||||
axios.get(`/channels/${route.params.channel}/messages`).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) => {
|
||||
|
||||
@@ -8,15 +8,15 @@
|
||||
<script setup>
|
||||
import { useRoute } from 'vue-router';
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { favoriteMessages } from '../request';
|
||||
import ListItem from '../components/ListItem.vue';
|
||||
import axios from 'axios';
|
||||
|
||||
const route = useRoute();
|
||||
|
||||
const items = ref([])
|
||||
|
||||
onMounted(() => {
|
||||
favoriteMessages().then(resp => {
|
||||
axios.get('/favorites').then(resp => {
|
||||
let data = resp.data
|
||||
data.map(item => {
|
||||
item.Media = JSON.parse(item.Media).filter(item => {
|
||||
|
||||
@@ -13,14 +13,14 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { channels } from "../request";
|
||||
import { Channel } from "@/types";
|
||||
import { onMounted, ref } from "vue";
|
||||
import axios from "axios";
|
||||
|
||||
const items = ref<Channel[]>([]);
|
||||
|
||||
onMounted(() => {
|
||||
channels().then((resp) => {
|
||||
axios.get('/channels').then((resp) => {
|
||||
items.value = resp.data;
|
||||
});
|
||||
});
|
||||
|
||||
2
frontend/src/vite-env.d.ts
vendored
2
frontend/src/vite-env.d.ts
vendored
@@ -10,4 +10,4 @@ declare module '*.vue' {
|
||||
|
||||
}
|
||||
|
||||
declare module './types.ts';
|
||||
// Remove the relative module declaration
|
||||
1
frontend/tsconfig.tsbuildinfo
Normal file
1
frontend/tsconfig.tsbuildinfo
Normal file
@@ -0,0 +1 @@
|
||||
{"root":["./src/data.ts","./src/main.ts","./src/types.ts","./src/vite-env.d.ts","./src/App.vue","./src/components/ListItem.vue","./src/components/MediaDocument.vue","./src/components/MediaGrid.vue","./src/components/MediaItem.vue","./src/components/MediaPhoto.vue","./src/components/Navigation.vue","./src/views/ChannelMessages.vue","./src/views/FavoritesMessages.vue","./src/views/Home.vue","./src/views/Tag.vue","./src/views/Tags.vue"],"version":"5.6.2"}
|
||||
@@ -3,8 +3,17 @@ import { defineConfig } from 'vite'
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
optimizeDeps: {
|
||||
include: ['linked-dep'],
|
||||
},
|
||||
build: {
|
||||
commonjsOptions: {
|
||||
include: [],
|
||||
},
|
||||
},
|
||||
plugins: [vue()],
|
||||
server: {
|
||||
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: "http://127.0.0.1:3000/", //目标域名
|
||||
|
||||
Reference in New Issue
Block a user