|
|
@ -1,4 +1,5 @@
|
|
|
|
<template>
|
|
|
|
<template>
|
|
|
|
|
|
|
|
<div>
|
|
|
|
<div v-if="!$common.isEmpty(article)">
|
|
|
|
<div v-if="!$common.isEmpty(article)">
|
|
|
|
<!-- 封面 -->
|
|
|
|
<!-- 封面 -->
|
|
|
|
<div class="article-head my-animation-slide-top">
|
|
|
|
<div class="article-head my-animation-slide-top">
|
|
|
@ -145,9 +146,9 @@
|
|
|
|
版权声明:转载请注明文章出处
|
|
|
|
版权声明:转载请注明文章出处
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</blockquote>
|
|
|
|
</blockquote>
|
|
|
|
<!-- 点赞 -->
|
|
|
|
<!-- 订阅 -->
|
|
|
|
<div class="myCenter" id="article-like">
|
|
|
|
<div class="myCenter" id="article-like" @click="subscribeLabel()">
|
|
|
|
<i class="el-icon-thumb article-like-icon" :class="{'article-like': article.likeCount}"></i>
|
|
|
|
<i class="el-icon-thumb article-like-icon" :class="{'article-like': subscribe}"></i>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 评论 -->
|
|
|
|
<!-- 评论 -->
|
|
|
@ -185,6 +186,32 @@
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</el-dialog>
|
|
|
|
</el-dialog>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 微信 -->
|
|
|
|
|
|
|
|
<el-dialog title="密码"
|
|
|
|
|
|
|
|
:modal="false"
|
|
|
|
|
|
|
|
:visible.sync="showPasswordDialog"
|
|
|
|
|
|
|
|
width="25%"
|
|
|
|
|
|
|
|
:append-to-body="true"
|
|
|
|
|
|
|
|
destroy-on-close
|
|
|
|
|
|
|
|
center>
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
|
|
|
<div class="password-content">{{tips}}</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div style="margin: 20px auto">
|
|
|
|
|
|
|
|
<el-input maxlength="30" v-model="password"></el-input>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div style="display: flex;justify-content: center">
|
|
|
|
|
|
|
|
<proButton :info="'提交'"
|
|
|
|
|
|
|
|
@click.native="submitPassword()"
|
|
|
|
|
|
|
|
:before="$constant.before_color_2"
|
|
|
|
|
|
|
|
:after="$constant.after_color_2">
|
|
|
|
|
|
|
|
</proButton>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
<script>
|
|
|
@ -192,6 +219,7 @@
|
|
|
|
const comment = () => import( "./comment/comment");
|
|
|
|
const comment = () => import( "./comment/comment");
|
|
|
|
const process = () => import( "./common/process");
|
|
|
|
const process = () => import( "./common/process");
|
|
|
|
const commentBox = () => import( "./comment/commentBox");
|
|
|
|
const commentBox = () => import( "./comment/commentBox");
|
|
|
|
|
|
|
|
const proButton = () => import( "./common/proButton");
|
|
|
|
import MarkdownIt from 'markdown-it';
|
|
|
|
import MarkdownIt from 'markdown-it';
|
|
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
export default {
|
|
|
@ -199,26 +227,91 @@
|
|
|
|
myFooter,
|
|
|
|
myFooter,
|
|
|
|
comment,
|
|
|
|
comment,
|
|
|
|
commentBox,
|
|
|
|
commentBox,
|
|
|
|
|
|
|
|
proButton,
|
|
|
|
process
|
|
|
|
process
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
data() {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
id: this.$route.query.id,
|
|
|
|
id: this.$route.query.id,
|
|
|
|
|
|
|
|
subscribe: false,
|
|
|
|
article: {},
|
|
|
|
article: {},
|
|
|
|
articleContentHtml: "",
|
|
|
|
articleContentHtml: "",
|
|
|
|
treeHoleList: [],
|
|
|
|
treeHoleList: [],
|
|
|
|
weiYanDialogVisible: false,
|
|
|
|
weiYanDialogVisible: false,
|
|
|
|
newsTime: ""
|
|
|
|
newsTime: "",
|
|
|
|
|
|
|
|
showPasswordDialog: false,
|
|
|
|
|
|
|
|
password: "",
|
|
|
|
|
|
|
|
tips: ""
|
|
|
|
};
|
|
|
|
};
|
|
|
|
},
|
|
|
|
},
|
|
|
|
created() {
|
|
|
|
created() {
|
|
|
|
this.getArticle();
|
|
|
|
if (!this.$common.isEmpty(this.id)) {
|
|
|
|
|
|
|
|
this.getArticle(localStorage.getItem("article_password_" + this.id));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ("0" !== localStorage.getItem("showSubscribe")) {
|
|
|
|
|
|
|
|
this.$notify({
|
|
|
|
|
|
|
|
title: '文章订阅',
|
|
|
|
|
|
|
|
type: 'success',
|
|
|
|
|
|
|
|
message: '点击文章下方小手 - 订阅/取消订阅专栏(标签)',
|
|
|
|
|
|
|
|
duration: 0,
|
|
|
|
|
|
|
|
onClose: () => localStorage.setItem("showSubscribe", "0")
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
mounted() {
|
|
|
|
// window.addEventListener("scroll", this.onScrollPage);
|
|
|
|
// window.addEventListener("scroll", this.onScrollPage);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
methods: {
|
|
|
|
|
|
|
|
subscribeLabel() {
|
|
|
|
|
|
|
|
if (this.$common.isEmpty(this.$store.state.currentUser)) {
|
|
|
|
|
|
|
|
this.$message({
|
|
|
|
|
|
|
|
message: "请先登录!",
|
|
|
|
|
|
|
|
type: "error"
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.$confirm('确认' + (this.subscribe ? '取消订阅' : '订阅') + '专栏【' + this.article.label.labelName + '】?' + (this.subscribe ? "" : "订阅专栏后,该专栏发布新文章将通过邮件通知订阅用户。"), this.subscribe ? "取消订阅" : "文章订阅", {
|
|
|
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
|
|
|
|
center: true
|
|
|
|
|
|
|
|
}).then(() => {
|
|
|
|
|
|
|
|
this.$http.get(this.$constant.baseURL + "/user/subscribe", {
|
|
|
|
|
|
|
|
labelId: this.article.labelId,
|
|
|
|
|
|
|
|
flag: !this.subscribe
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.then((res) => {
|
|
|
|
|
|
|
|
if (!this.$common.isEmpty(res.data)) {
|
|
|
|
|
|
|
|
this.$store.commit("loadCurrentUser", res.data);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
this.subscribe = !this.subscribe;
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.catch((error) => {
|
|
|
|
|
|
|
|
this.$message({
|
|
|
|
|
|
|
|
message: error.message,
|
|
|
|
|
|
|
|
type: "error"
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
|
|
|
this.$message({
|
|
|
|
|
|
|
|
type: 'success',
|
|
|
|
|
|
|
|
message: '已取消!'
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
submitPassword() {
|
|
|
|
|
|
|
|
if (this.$common.isEmpty(this.password)) {
|
|
|
|
|
|
|
|
this.$message({
|
|
|
|
|
|
|
|
message: "请先输入密码!",
|
|
|
|
|
|
|
|
type: "error"
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.getArticle(this.password);
|
|
|
|
|
|
|
|
},
|
|
|
|
deleteTreeHole(id) {
|
|
|
|
deleteTreeHole(id) {
|
|
|
|
if (this.$common.isEmpty(this.$store.state.currentUser)) {
|
|
|
|
if (this.$common.isEmpty(this.$store.state.currentUser)) {
|
|
|
|
this.$message({
|
|
|
|
this.$message({
|
|
|
@ -334,8 +427,8 @@
|
|
|
|
let headings = $(".entry-content").find("h1, h2, h3, h4, h5, h6");
|
|
|
|
let headings = $(".entry-content").find("h1, h2, h3, h4, h5, h6");
|
|
|
|
headings.attr('id', (i, id) => id || 'toc-' + i);
|
|
|
|
headings.attr('id', (i, id) => id || 'toc-' + i);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
getArticle() {
|
|
|
|
getArticle(password) {
|
|
|
|
this.$http.get(this.$constant.baseURL + "/article/getArticleById", {id: this.id, flag: true})
|
|
|
|
this.$http.get(this.$constant.baseURL + "/article/getArticleById", {id: this.id, password: password})
|
|
|
|
.then((res) => {
|
|
|
|
.then((res) => {
|
|
|
|
if (!this.$common.isEmpty(res.data)) {
|
|
|
|
if (!this.$common.isEmpty(res.data)) {
|
|
|
|
this.article = res.data;
|
|
|
|
this.article = res.data;
|
|
|
@ -348,13 +441,31 @@
|
|
|
|
// todo 只有程序相关文章才显示toc
|
|
|
|
// todo 只有程序相关文章才显示toc
|
|
|
|
// this.getTocbot();
|
|
|
|
// this.getTocbot();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
if (!this.$common.isEmpty(password)) {
|
|
|
|
|
|
|
|
localStorage.setItem("article_password_" + this.id, password);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
this.showPasswordDialog = false;
|
|
|
|
|
|
|
|
if (!this.$common.isEmpty(this.$store.state.currentUser) && !this.$common.isEmpty(this.$store.state.currentUser.subscribe)) {
|
|
|
|
|
|
|
|
this.subscribe = JSON.parse(this.$store.state.currentUser.subscribe).includes(this.article.labelId);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.catch((error) => {
|
|
|
|
.catch((error) => {
|
|
|
|
|
|
|
|
if ("密码错误" === error.message.substr(0, 4)) {
|
|
|
|
|
|
|
|
if (!this.$common.isEmpty(password)) {
|
|
|
|
|
|
|
|
this.$message({
|
|
|
|
|
|
|
|
message: "密码错误,请重新输入!",
|
|
|
|
|
|
|
|
type: "error"
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
this.tips = error.message.substr(4);
|
|
|
|
|
|
|
|
this.showPasswordDialog = true;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
this.$message({
|
|
|
|
this.$message({
|
|
|
|
message: error.message,
|
|
|
|
message: error.message,
|
|
|
|
type: "error"
|
|
|
|
type: "error"
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
highlight() {
|
|
|
|
highlight() {
|
|
|
@ -583,6 +694,12 @@
|
|
|
|
border-bottom: unset;
|
|
|
|
border-bottom: unset;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.password-content {
|
|
|
|
|
|
|
|
font-size: 13px;
|
|
|
|
|
|
|
|
color: var(--maxGreyFont);
|
|
|
|
|
|
|
|
line-height: 1.5;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@media screen and (max-width: 700px) {
|
|
|
|
@media screen and (max-width: 700px) {
|
|
|
|
.article-info-container {
|
|
|
|
.article-info-container {
|
|
|
|
left: 20px;
|
|
|
|
left: 20px;
|
|
|
|