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

View File

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