feat: update admin

This commit is contained in:
yanghao05
2025-04-29 15:45:30 +08:00
parent 844cd9d558
commit c9a254b02e
2 changed files with 28 additions and 27 deletions

View File

@@ -1,6 +1,6 @@
import router from '@/router';
import { useAuthStore } from '@/stores/auth'; import { useAuthStore } from '@/stores/auth';
import axios from 'axios'; import axios from 'axios';
import { useRouter } from 'vue-router';
// Create axios instance with default config // Create axios instance with default config
const httpClient = axios.create({ const httpClient = axios.create({
@@ -37,6 +37,8 @@ httpClient.interceptors.response.use(
if (error.response.status === 401) { if (error.response.status === 401) {
const authStore = useAuthStore(); const authStore = useAuthStore();
authStore.logout(); authStore.logout();
const router = useRouter();
// Redirect to login page
router.push('/login'); router.push('/login');
} }
console.error('API Error:', error.response.status, error.response.data); console.error('API Error:', error.response.status, error.response.data);

View File

@@ -88,6 +88,7 @@ const fetchArticle = async () => {
const { id } = route.params const { id } = route.params
const { data } = await postApi.show(id) const { data } = await postApi.show(id)
article.value = data article.value = data
document.title = article.value.title
// 定义“分享给朋友”及“分享到QQ”按钮的分享内容 // 定义“分享给朋友”及“分享到QQ”按钮的分享内容
const shareContent = { const shareContent = {
@@ -98,7 +99,6 @@ const fetchArticle = async () => {
} }
// 调用微信 JS SDK 分享接口 // 调用微信 JS SDK 分享接口
if (window.wx) { if (window.wx) {
wx.ready(function () {
wx.updateTimelineShareData({ wx.updateTimelineShareData({
title: shareContent.title, title: shareContent.title,
link: shareContent.link, link: shareContent.link,
@@ -123,7 +123,6 @@ const fetchArticle = async () => {
console.log('分享取消') console.log('分享取消')
} }
}) })
})
} }
} catch (error) { } catch (error) {
console.error('Failed to fetch article:', error) console.error('Failed to fetch article:', error)
@@ -162,8 +161,8 @@ onUnmounted(() => {
<div class="flex-1"> <div class="flex-1">
<div v-if="article"> <div v-if="article">
<video ref="videoElement" :poster="article.head_images[0]" <video webkit-playsinline playsinline ref="videoElement" :poster="article.head_images[0]"
class="w-full aspect-video object-cover plyr-video" playsinline preload="none"> class="w-full aspect-video object-cover plyr-video" preload="none">
<source type="video/mp4" /> <source type="video/mp4" />
Your browser does not support the video tag. Your browser does not support the video tag.
</video> </video>