修改:文章加入封面设置
This commit is contained in:
parent
41156d7974
commit
59286b69d7
@ -60,18 +60,16 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
if(/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)) {
|
window.pc = !/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent);
|
||||||
window.pc = false
|
|
||||||
} else {
|
|
||||||
window.pc = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if(getToken()){
|
if(getToken()){
|
||||||
this.isShow = window.pc;
|
this.isShow = window.pc;
|
||||||
//与服务器建立websocket连接
|
//与服务器建立websocket连接
|
||||||
if(!ws.isConnected){
|
if(!ws.isConnected){
|
||||||
toConnection(this.$store.state.user.name,this.$store.state.user.token);
|
toConnection(this.$store.state.user.name,this.$store.state.user.token);
|
||||||
}
|
}
|
||||||
|
if(this.$route.path.startsWith('/articles')){
|
||||||
|
this.isShow = false
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
this.isShow = false
|
this.isShow = false
|
||||||
}
|
}
|
||||||
|
|||||||
@ -203,10 +203,20 @@ export const constantRoutes = [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'articles',
|
||||||
|
component: Layout,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: `${document.location.protocol}//${window.location.host}/articles`,
|
||||||
|
meta: { title: '关联博客', icon: 'link' }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '/articles',
|
path: '/articles',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
|
hidden: true,
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: '',
|
path: '',
|
||||||
|
|||||||
@ -108,7 +108,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 1080px;
|
max-width: 1080px;
|
||||||
min-height: 1000px;
|
//min-height: 1000px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|||||||
@ -10,6 +10,7 @@
|
|||||||
<el-input v-if="!editStatus" class="articles-storage" placeholder="存储位置" v-model="storageLocation" :readonly="true" @click="selectDir">
|
<el-input v-if="!editStatus" class="articles-storage" placeholder="存储位置" v-model="storageLocation" :readonly="true" @click="selectDir">
|
||||||
<el-button slot="prepend" @click="selectDir">选择位置</el-button>
|
<el-button slot="prepend" @click="selectDir">选择位置</el-button>
|
||||||
</el-input>
|
</el-input>
|
||||||
|
<el-button type="primary" @click="moreSetting = true">更多设置</el-button>
|
||||||
<el-button v-if="!editStatus" class="release-button" type="primary" @click="add" :loading="adding">发布文章</el-button>
|
<el-button v-if="!editStatus" class="release-button" type="primary" @click="add" :loading="adding">发布文章</el-button>
|
||||||
<el-button v-if="editStatus" class="release-button" type="primary" @click="update" :loading="updating">更新文章</el-button>
|
<el-button v-if="editStatus" class="release-button" type="primary" @click="update" :loading="updating">更新文章</el-button>
|
||||||
</div>
|
</div>
|
||||||
@ -28,6 +29,16 @@
|
|||||||
@fullScreen="fullScreen"
|
@fullScreen="fullScreen"
|
||||||
/>
|
/>
|
||||||
</el-main>
|
</el-main>
|
||||||
|
|
||||||
|
<el-drawer
|
||||||
|
:visible.sync="moreSetting"
|
||||||
|
:with-header="false">
|
||||||
|
<div class="more-setting">
|
||||||
|
<h2>更多设置</h2>
|
||||||
|
<p class="mark-setting-label">文章标题:</p>
|
||||||
|
<el-input class="articles-title" type="textarea" placeholder="输入图片URL" v-model="markdownCover"/>
|
||||||
|
</div>
|
||||||
|
</el-drawer>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -52,6 +63,8 @@
|
|||||||
isFullScreen: false,
|
isFullScreen: false,
|
||||||
storageLocation: '/',
|
storageLocation: '/',
|
||||||
selectLocationVisible: false,
|
selectLocationVisible: false,
|
||||||
|
moreSetting: false,
|
||||||
|
markdownCover: null,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
@ -137,6 +150,7 @@
|
|||||||
userId: this.$store.state.user.userId,
|
userId: this.$store.state.user.userId,
|
||||||
username: this.$store.state.user.name,
|
username: this.$store.state.user.name,
|
||||||
filename: filename,
|
filename: filename,
|
||||||
|
cover: this.markdownCover,
|
||||||
currentDirectory: this.storageLocation,
|
currentDirectory: this.storageLocation,
|
||||||
contentText: this.content
|
contentText: this.content
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
@ -160,6 +174,7 @@
|
|||||||
userId: this.$store.state.user.userId,
|
userId: this.$store.state.user.userId,
|
||||||
username: this.$store.state.user.name,
|
username: this.$store.state.user.name,
|
||||||
filename: filename,
|
filename: filename,
|
||||||
|
cover: this.markdownCover,
|
||||||
currentDirectory: this.storageLocation,
|
currentDirectory: this.storageLocation,
|
||||||
contentText: this.content
|
contentText: this.content
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
@ -208,4 +223,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.more-setting {
|
||||||
|
padding: 15px;
|
||||||
|
.mark-setting-label {
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
.mark-description {
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 100;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -55,11 +55,12 @@
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<section class="article typo">
|
<section class="article typo">
|
||||||
<div class="article-entry" itemprop="articleBody">
|
<a :href="$route.path+'/article?mark='+article.id">
|
||||||
<!--<p><img src="https://cdn.jsdelivr.net/gh/xaoxuu/cdn-assets/2019/88ff47f8-e8f5-3691-cff2-ab0e042dd752.jpg.png" data-original="https://cdn.jsdelivr.net/gh/xaoxuu/cdn-assets/2019/88ff47f8-e8f5-3691-cff2-ab0e042dd752.jpg.png" alt=""></p>-->
|
<div class="article-entry" itemprop="articleBody">
|
||||||
<p></p>
|
<p><img class="blog-background" :src="article.cover" onerror="this.src='https://images.unsplash.com/photo-1582230587856-7fec01506148?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=800&q=60'"/></p>
|
||||||
<div class="button readmore"><a :href="$route.path+'/article?mark='+article.id">阅读全文 <i class="fas fa-chevron-right"></i></a></div>
|
<!--<div class="button readmore"><a :href="$route.path+'/article?mark='+article.id">阅读全文 <i class="fas fa-chevron-right"></i></a></div>-->
|
||||||
</div>
|
</div>
|
||||||
|
</a>
|
||||||
</section>
|
</section>
|
||||||
</article>
|
</article>
|
||||||
</div>
|
</div>
|
||||||
@ -291,4 +292,11 @@
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
background: #f5f5f5;
|
background: #f5f5f5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.blog-background {
|
||||||
|
object-fit: cover;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
max-height: 15em;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user