增加了对私人文章的支持
This commit is contained in:
parent
f02e87a9e2
commit
88870153c8
File diff suppressed because one or more lines are too long
2
dist/index.html
vendored
2
dist/index.html
vendored
@ -1 +1 @@
|
|||||||
<!doctype html><html lang="zh-CN"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><title>NEU小站</title><script defer="defer" src="/js/chunk-vendors.f7fe2dc8.js"></script><script defer="defer" src="/js/app.d5931a49.js"></script><link href="/css/app.8f37ce57.css" rel="stylesheet"></head><body><noscript><strong>抱歉,NEU小站无法在没有 JavaScript 的情况下正常工作。请启用 JavaScript 以继续。</strong></noscript><div id="app"></div></body></html>
|
<!doctype html><html lang="zh-CN"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><title>NEU小站</title><script defer="defer" src="/js/chunk-vendors.f7fe2dc8.js"></script><script defer="defer" src="/js/app.7ad87d19.js"></script><link href="/css/app.8f37ce57.css" rel="stylesheet"></head><body><noscript><strong>抱歉,NEU小站无法在没有 JavaScript 的情况下正常工作。请启用 JavaScript 以继续。</strong></noscript><div id="app"></div></body></html>
|
File diff suppressed because one or more lines are too long
2
dist/js/336.cd6f69f2.js
vendored
Normal file
2
dist/js/336.cd6f69f2.js
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
dist/js/972.7afc5423.js
vendored
2
dist/js/972.7afc5423.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -2,7 +2,7 @@
|
|||||||
<div class="article-view">
|
<div class="article-view">
|
||||||
<Navbar />
|
<Navbar />
|
||||||
<div class="container" v-if="article">
|
<div class="container" v-if="article">
|
||||||
<h1 class="article-title">{{ article.title || '草稿预览' }}</h1>
|
<h1 class="article-title">{{ isPreviewMode ? '草稿预览' : (article.title || '未知文章') }}</h1>
|
||||||
<div class="article-tags" style="margin-left: 3rem" v-if="!isPreviewMode">
|
<div class="article-tags" style="margin-left: 3rem" v-if="!isPreviewMode">
|
||||||
<span v-if="article.official" class="article-official">官方</span>
|
<span v-if="article.official" class="article-official">官方</span>
|
||||||
<span v-if="article.highlight" class="article-highlight">优质</span>
|
<span v-if="article.highlight" class="article-highlight">优质</span>
|
||||||
@ -73,9 +73,15 @@ export default {
|
|||||||
try {
|
try {
|
||||||
// 从路由参数获取文章ID
|
// 从路由参数获取文章ID
|
||||||
const articleId = this.$route.params.id;
|
const articleId = this.$route.params.id;
|
||||||
|
const token = Cookies.get('token');
|
||||||
|
const fetchArticleHeaders = token ? {
|
||||||
|
'Authorization': token
|
||||||
|
} : {};
|
||||||
|
|
||||||
// 使用fetch API代替axios
|
// 使用fetch API代替axios
|
||||||
const response = await fetch(`https://newfront.xn--xhq44jb2fzpc.com/article?id=${articleId}`);
|
const response = await fetch(`https://newfront.xn--xhq44jb2fzpc.com/article?id=${articleId}`, {
|
||||||
|
headers: fetchArticleHeaders
|
||||||
|
});
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
const errorData = await response.json().catch(() => ({}));
|
const errorData = await response.json().catch(() => ({}));
|
||||||
throw new Error(errorData.error || `HTTP错误: ${response.status}`);
|
throw new Error(errorData.error || `HTTP错误: ${response.status}`);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user