+
{{ article.articleTitle }}
+
+
+
{{ article.username }}
+
·
+
+
{{ article.createTime }}
+
·
+
+
{{ article.viewCount }}
+
·
+
+
{{ article.commentCount }}
+
·
+
+
{{ article.likeCount }}
+
-
{{ article.articleTitle }}
-
-
-
{{ article.username }}
-
·
-
+
+
+
-
-
-
-
-
-
-
-
-
-
- 文章最后更新于 {{ article.updateTime }}
-
-
-
- {{ article.sort.sortName +" ▶ "+ article.label.labelName}}
-
-
-
-
- 作者:{{article.username}}
+
+
+
+
+ 文章最后更新于 {{ article.updateTime }}
-
- 版权声明:转载请注明文章出处
+
+
+ {{ article.sort.sortName +" ▶ "+ article.label.labelName}}
+
+
+
+
+ 作者:{{article.username}}
+
+
+ 版权声明:转载请注明文章出处
+
+
+
+
+
-
-
-
-
-
-
-
+
+
-
-
+
+
+
-
-
+
@@ -192,6 +219,7 @@
const comment = () => import( "./comment/comment");
const process = () => import( "./common/process");
const commentBox = () => import( "./comment/commentBox");
+ const proButton = () => import( "./common/proButton");
import MarkdownIt from 'markdown-it';
export default {
@@ -199,26 +227,91 @@
myFooter,
comment,
commentBox,
+ proButton,
process
},
data() {
return {
id: this.$route.query.id,
+ subscribe: false,
article: {},
articleContentHtml: "",
treeHoleList: [],
weiYanDialogVisible: false,
- newsTime: ""
+ newsTime: "",
+ showPasswordDialog: false,
+ password: "",
+ tips: ""
};
},
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() {
// window.addEventListener("scroll", this.onScrollPage);
},
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) {
if (this.$common.isEmpty(this.$store.state.currentUser)) {
this.$message({
@@ -334,8 +427,8 @@
let headings = $(".entry-content").find("h1, h2, h3, h4, h5, h6");
headings.attr('id', (i, id) => id || 'toc-' + i);
},
- getArticle() {
- this.$http.get(this.$constant.baseURL + "/article/getArticleById", {id: this.id, flag: true})
+ getArticle(password) {
+ this.$http.get(this.$constant.baseURL + "/article/getArticleById", {id: this.id, password: password})
.then((res) => {
if (!this.$common.isEmpty(res.data)) {
this.article = res.data;
@@ -348,13 +441,31 @@
// todo 只有程序相关文章才显示toc
// 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) => {
- this.$message({
- message: error.message,
- type: "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({
+ message: error.message,
+ type: "error"
+ });
+ }
});
},
highlight() {
@@ -583,6 +694,12 @@
border-bottom: unset;
}
+ .password-content {
+ font-size: 13px;
+ color: var(--maxGreyFont);
+ line-height: 1.5;
+ }
+
@media screen and (max-width: 700px) {
.article-info-container {
left: 20px;
diff --git a/src/components/comment/graffiti.vue b/src/components/comment/graffiti.vue
index e000efa..7318f6f 100644
--- a/src/components/comment/graffiti.vue
+++ b/src/components/comment/graffiti.vue
@@ -266,11 +266,41 @@
}
let obj = new Blob([u8arr], {type: mine});
let key = "graffiti" + "/" + this.$store.state.currentUser.username.replace(/[^a-zA-Z]/g, '') + this.$store.state.currentUser.id + new Date().getTime() + Math.floor(Math.random() * 1000) + ".png";
+
+ let storeType = localStorage.getItem("defaultStoreType");
+
let fd = new FormData();
fd.append("file", obj);
fd.append("key", key);
+ fd.append("relativePath", key);
+ fd.append("type", "graffiti");
+ fd.append("storeType", storeType);
- this.$http.get(this.$constant.baseURL + "/qiniu/getUpToken", {key: key})
+ if (storeType === "local") {
+ this.saveLocal(fd);
+ } else if (storeType === "qiniu") {
+ this.saveQiniu(fd);
+ }
+ },
+ saveLocal(fd) {
+ this.$http.upload(this.$constant.baseURL + "/resource/upload", fd)
+ .then((res) => {
+ if (!this.$common.isEmpty(res.data)) {
+ this.clearContext();
+ let url = res.data;
+ let img = "<你画我猜," + url + ">";
+ this.$emit("addGraffitiComment", img);
+ }
+ })
+ .catch((error) => {
+ this.$message({
+ message: error.message,
+ type: "error"
+ });
+ });
+ },
+ saveQiniu(fd) {
+ this.$http.get(this.$constant.baseURL + "/qiniu/getUpToken", {key: fd.get("key")})
.then((res) => {
if (!this.$common.isEmpty(res.data)) {
fd.append("token", res.data);
@@ -280,7 +310,8 @@
if (!this.$common.isEmpty(res.key)) {
this.clearContext();
let url = this.$constant.qiniuDownload + res.key;
- this.$common.saveResource(this, "graffiti", url, obj.size, obj.type);
+ let file = fd.get("file");
+ this.$common.saveResource(this, "graffiti", url, file.size, file.type, "qiniu");
let img = "<你画我猜," + url + ">";
this.$emit("addGraffitiComment", img);
}
diff --git a/src/components/common/uploadPicture.vue b/src/components/common/uploadPicture.vue
index e5d1747..b469efb 100644
--- a/src/components/common/uploadPicture.vue
+++ b/src/components/common/uploadPicture.vue
@@ -65,6 +65,10 @@
type: String,
default: "picture"
},
+ storeType: {
+ type: String,
+ default: localStorage.getItem("defaultStoreType")
+ },
accept: {
type: String,
default: "image/*"
@@ -107,37 +111,53 @@
let key = this.prefix + "/" + (!this.$common.isEmpty(this.$store.state.currentUser.username) ? (this.$store.state.currentUser.username.replace(/[^a-zA-Z]/g, '') + this.$store.state.currentUser.id) : (this.$store.state.currentAdmin.username.replace(/[^a-zA-Z]/g, '') + this.$store.state.currentAdmin.id)) + new Date().getTime() + Math.floor(Math.random() * 1000) + suffix;
- const xhr = new XMLHttpRequest();
- xhr.open('get', this.$constant.baseURL + "/qiniu/getUpToken?key=" + key, false);
- if (this.isAdmin) {
- xhr.setRequestHeader("Authorization", localStorage.getItem("adminToken"));
- } else {
- xhr.setRequestHeader("Authorization", localStorage.getItem("userToken"));
- }
-
- try {
- xhr.send();
- const res = JSON.parse(xhr.responseText);
- if (res !== null && res.hasOwnProperty("code") && res.code === 200) {
- options.data = {
- token: res.data,
- key: key
- };
- return upload(options);
- } else if (res !== null && res.hasOwnProperty("code") && res.code !== 200) {
- return Promise.reject(res.message);
+ if (this.storeType === "local") {
+ let fd = new FormData();
+ fd.append("file", options.file);
+ fd.append("key", key);
+ fd.append("relativePath", key);
+ fd.append("type", this.prefix);
+ fd.append("storeType", this.storeType);
+
+ return this.$http.upload(this.$constant.baseURL + "/resource/upload", fd, this.isAdmin);
+ } else if (this.storeType === "qiniu") {
+ const xhr = new XMLHttpRequest();
+ xhr.open('get', this.$constant.baseURL + "/qiniu/getUpToken?key=" + key, false);
+ if (this.isAdmin) {
+ xhr.setRequestHeader("Authorization", localStorage.getItem("adminToken"));
} else {
- return Promise.reject("服务异常!");
+ xhr.setRequestHeader("Authorization", localStorage.getItem("userToken"));
+ }
+
+ try {
+ xhr.send();
+ const res = JSON.parse(xhr.responseText);
+ if (res !== null && res.hasOwnProperty("code") && res.code === 200) {
+ options.data = {
+ token: res.data,
+ key: key
+ };
+ return upload(options);
+ } else if (res !== null && res.hasOwnProperty("code") && res.code !== 200) {
+ return Promise.reject(res.message);
+ } else {
+ return Promise.reject("服务异常!");
+ }
+ } catch (e) {
+ return Promise.reject(e.message);
}
- } catch (e) {
- return Promise.reject(e.message);
}
},
// 文件上传成功时的钩子
handleSuccess(response, file, fileList) {
- let url = this.$constant.qiniuDownload + response.key;
- this.$common.saveResource(this, this.prefix, url, file.size, file.raw.type, this.isAdmin);
+ let url;
+ if (this.storeType === "local") {
+ url = response.data;
+ } else if (this.storeType === "qiniu") {
+ url = this.$constant.qiniuDownload + response.key;
+ this.$common.saveResource(this, this.prefix, url, file.size, file.raw.type, "qiniu", this.isAdmin);
+ }
this.$emit("addPicture", url);
},
handleError(err, file, fileList) {
diff --git a/src/components/friend.vue b/src/components/friend.vue
index 94a3e49..e275b97 100644
--- a/src/components/friend.vue
+++ b/src/components/friend.vue
@@ -67,10 +67,34 @@
+
🌸本站信息
+
+
+ 网站名称: $$$$POETIZE
+ 网址: $$$$https://poetize.cn
+ 头像: $$$$https://s1.ax1x.com/2022/11/10/z9E7X4.jpg
+ 描述: $$$$这是一个 Vue2 Vue3 与 SpringBoot 结合的产物~
+ 网站封面: $$$$https://s1.ax1x.com/2022/11/10/z9VlHs.png
+
+
+
🌸申请方式
+
+
+ 点击上方信封✨✨✨
+ 不会添加带有广告营销和没有实质性内容的友链🚫🚫🚫
+ 申请之前请将本网站添加为您的友链哦🎟️🎟️🎟️
+
+
+
+
+
+
♥️青出于蓝
+
+
-
🥇友情链接
-
+
🥇友情链接
+
@@ -93,13 +117,7 @@
data() {
return {
- pagination: {
- current: 1,
- size: 9999,
- desc: false,
- resourceType: "friendUrl"
- },
- friendList: [],
+ friendList: {},
friend: {
title: "",
introduction: "",
@@ -189,10 +207,10 @@
window.open(path);
},
getFriends() {
- this.$http.post(this.$constant.baseURL + "/webInfo/listResourcePath", this.pagination)
+ this.$http.get(this.$constant.baseURL + "/webInfo/listFriend")
.then((res) => {
if (!this.$common.isEmpty(res.data)) {
- this.friendList = res.data.records;
+ this.friendList = res.data;
}
})
.catch((error) => {
@@ -342,6 +360,16 @@
padding: 20px 0;
}
+ blockquote {
+ line-height: 2;
+ border-left: 0.2rem solid #ed6ea0;
+ padding: 10px 1rem;
+ background-color: #ffe6fa;
+ border-radius: 4px;
+ margin: 20px auto;
+ color: var(--maxGreyFont);
+ }
+
@media screen and (max-width: 700px) {
.form-wrap {
width: auto;
diff --git a/src/components/home.vue b/src/components/home.vue
index 721c68f..4062202 100644
--- a/src/components/home.vue
+++ b/src/components/home.vue
@@ -371,7 +371,7 @@
});
} else {
let userToken = this.$common.encrypt(localStorage.getItem("userToken"));
- window.open(this.$constant.imBaseURL + "?userToken=" + userToken);
+ window.open(this.$constant.imBaseURL + "?userToken=" + userToken + "&defaultStoreType=" + localStorage.getItem("defaultStoreType"));
}
},
logout() {
@@ -393,6 +393,7 @@
.then((res) => {
if (!this.$common.isEmpty(res.data)) {
this.$store.commit("loadWebInfo", res.data);
+ localStorage.setItem("defaultStoreType", res.data.defaultStoreType);
}
})
.catch((error) => {
diff --git a/src/components/myAside.vue b/src/components/myAside.vue
index a5320b1..81c36e2 100644
--- a/src/components/myAside.vue
+++ b/src/components/myAside.vue
@@ -24,7 +24,7 @@