diff --git a/src/components/blog.vue b/src/components/blog.vue index 501b57c..575e898 100644 --- a/src/components/blog.vue +++ b/src/components/blog.vue @@ -24,15 +24,11 @@
- - - -
- +
@@ -253,7 +249,7 @@ {{ article.articleContent }}
-
+
@@ -285,17 +281,17 @@ {{ article.labelName }} - + + +
+ +
+ 编辑 删除 - -
- - - @@ -373,7 +369,6 @@ export default { showUpdateBtn: false, showSaveBtn: true, articleSearch: "", - // showEditor: false, showPostEditor: false, blogContent: "", blogContentTitle:"", @@ -568,11 +563,11 @@ export default { }, submitForm(formName) { if (this.article.viewStatus === false && this.$common.isEmpty(this.article.password)) { - this.$message({ - message: "文章不可见时必须输入密码!", - type: "error" - }); - return; + // this.$message({ + // message: "文章不可见时必须输入密码!", + // type: "error" + // }); + // return; } this.$refs[formName].validate((valid) => { if (valid) { @@ -592,12 +587,14 @@ export default { }, submitForm2() { if (this.article.viewStatus === false && this.$common.isEmpty(this.article.password)) { - this.$message({ - message: "文章不可见时必须输入密码!", - type: "error" - }); - return; + // this.$message({ + // message: "文章不可见时必须输入密码!", + // type: "error" + // }); + // return; } + this.article.userId = this.$store.state.currentUser.id; + console.log(this.$store.state.currentUser.id) this.saveArticle(this.article, "/article/updateArticle") }, resetForm(formName) { @@ -828,131 +825,6 @@ export default { showTip() { this.$router.push({path: '/weiYan'}); }, - cancelEdit() { - // 取消编辑 - this.showEditor = false; - this.showUpdateBtn = false; - this.showPublishBtn = true; - this.blogContent = ""; - this.blogContentTitle = ""; - }, - saveBlog() { - let selectedIndex = this.selectedCategoryIndex+1; - console.log('选中的分类索引号为:' + selectedIndex); - const articleVO = { - userId:this.$store.state.currentUser.id, - articleContent: this.blogContent ,// 获取博客内容 - articleTitle:this.blogContentTitle, - // 其他博客相关数据... - sortId:1, - labelId:selectedIndex, - articleCover:this.articleUp.articleCover, - viewStatus: 0, - commentStatus: 0, - recommendStatus: 0 - }; - console.log(this.$store.state.currentUser) - console.log(this.articleUp.articleCover+"cover") - // console.log("index:"+document.getElementById('category').select) - this.$http.post('/article/saveArticle', articleVO) - .then(response => { - // 请求成功处理逻辑 - console.log('博客保存成功!'); - this.getUserArticles(); - this.showEditor = false; - this.blogContent = ""; - this.blogContentTitle = ""; - this.$message({ - message: '发布成功', - type: 'success' - }); - }) - .catch(error => { - // 请求失败处理逻辑 - console.error('博客保存失败:', error); - this.$message({ - message: '发布失败', - type: 'error' - }); - }); - - }, - deleteArticle(article){ - // 发送异步请求删除文章 - this.$http.get(`/article/deleteArticle?id=${article.id}`) - // .then(response => response.json()) - .then(response => { - // 请求成功处理逻辑 - console.log('博客删除成功!'); - console.log(response) - this.getUserArticles() - this.getUserArticleLabelTotalNum() - }) - .catch(error => { - // 请求失败处理逻辑 - console.error('删除博客失败:', error); - }); - - }, - updateArticle(article) { - this.showPostEditor = true; - this.blogContentTitle = article.articleTitle; - this.blogContent = article.articleContent; - this.selectedCategoryIndex = article.labelId - 1; // 设置下拉框选中的索引值 - this.articleUp.id = article.id; - // this.blogLabelName - // 判断是否找到了 #editorArea 元素 - const editorArea = document.getElementById('editorArea'); - if (editorArea) { - editorArea.scrollIntoView({ behavior: "smooth", block: "start" }); - } else { - console.log("#editorArea not found"); - } - - }, - - - // updateBlog(){ - // this.blogContentTitle = document.getElementById('areaTitle').value - // this.blogContent = document.getElementById('areaContent').value - // // document.getElementById('category'). - // this.articleUp.articleContent = document.getElementById('areaContent').value - // this.articleUp.articleTitle = document.getElementById('areaTitle').value - // this.articleUp.username = this.$store.state.currentUser.username - // this.articleUp.labelId = this.selectedCategoryIndex+1 - // - // //发送异步请求更新文章 - // this.$http.post('/article/updateArticle', this.articleUp) - // .then(response => { - // // 请求成功处理逻辑 - // console.log('博客更新成功!'); - // - // console.log(response) - // this.getUserArticles() - // this.getUserArticleLabelTotalNum() - // this.$message({ - // message: '更新成功', - // type: 'success' - // }); - // this.showEditor = false; - // this.showPublishBtn = true; - // this.showUpdateBtn = false; - // this.blogContent = ""; - // this.blogContentTitle = ""; - // }) - // .catch(error => { - // // 请求失败处理逻辑 - // console.error('更新博客失败:', error); - // this.$message({ - // message: '更新失败', - // type: 'error' - // }); - // this.showPublishBtn = true; - // this.showUpdateBtn = false; - // this.blogContent = ""; - // this.blogContentTitle = ""; - // }); - // }, getBlogLabels() { const url = "/webInfo/listLabel"; console.log("gettingLabels"); @@ -962,22 +834,13 @@ export default { console.log(response.data.data) const labels = response.data.data; this.blogLabels = Object.values(labels).map(label => label.labelName); - - // 将标签数据赋值给blogLabels数组 - // this.blogLabels = labels; }) .catch(error => { // 请求失败,处理错误 console.error(error); }); }, - handleFileChange() { - let file0 = this.$refs.fileInput.files[0]; - this.file = file0; - console.log('上传的文件:', file0); - // 这里可以进行进一步的处理,比如上传文件到服务器等操作 - } } } diff --git a/src/utils/constant.js b/src/utils/constant.js index 1dc85cd..7db007d 100644 --- a/src/utils/constant.js +++ b/src/utils/constant.js @@ -18,7 +18,7 @@ export default { //前后端定义的密钥,AES使用16位 cryptojs_key: "aoligeimeimaobin", qiniuUrl: "https://upload.qiniup.com", - qiniuDownload: "http://s6qc8qkjn.hd-bkt.clouddn.com/", + qiniuDownload: "http://s6xqq8hhg.hd-bkt.clouddn.com/", favoriteVideo: "http://s6q4ppvdk.hd-bkt.clouddn.com/new.mp4", favoriteVideo2: "http://s6q4ppvdk.hd-bkt.clouddn.com/images/340c8040d037c2f3217e8a1ade444fc8.mp4",