Commit 35e7593f by yanju

new blog api

parent ce0b1187
...@@ -67,7 +67,6 @@ aria.Dialog.prototype.closeDialog = function() { ...@@ -67,7 +67,6 @@ aria.Dialog.prototype.closeDialog = function() {
this.removeListeners(); this.removeListeners();
if (this.focusAfterClosed) { if (this.focusAfterClosed) {
setTimeout(() => { setTimeout(() => {
this.focusAfterClosed.focus();
}); });
} }
}; };
......
...@@ -161,9 +161,7 @@ ...@@ -161,9 +161,7 @@
} }
this.opened = false; this.opened = false;
// this.doAfterClose(); // this.doAfterClose();
setTimeout(() => {
if (this.action) this.callback(this.action, this);
});
}, },
handleWrapperClick() { handleWrapperClick() {
...@@ -179,9 +177,12 @@ ...@@ -179,9 +177,12 @@
}, },
handleAction(action) { handleAction(action) {
if (this.$type === 'prompt' && action === 'confirm' && !this.validate()) { if (action === 'confirm') {
return; setTimeout(() => {
} if (action) this.callback(action, this);
});
this.doClose();
}else{
this.action = action; this.action = action;
if (typeof this.beforeClose === 'function') { if (typeof this.beforeClose === 'function') {
this.close = this.getSafeClose(); this.close = this.getSafeClose();
...@@ -189,6 +190,8 @@ ...@@ -189,6 +190,8 @@
} else { } else {
this.doClose(); this.doClose();
} }
}
}, },
validate() { validate() {
......
<template> <template>
<div class="answer-card__wrap" :style="{width: this.cardType === '1' ? '938px' : '816px'}"> <div class="answer-card__wrap" :style="{width: this.cardType === '1' ? '938px' : '816px'}">
<div class="answer-card"> <div class="answer-card" @click="$router.push('/answer/detail/'+questionId)">
<div class="answer-card__left" v-if="!solved"> <div class="answer-card__left" v-if="!solved">
<div> <div>
<p>{{replyNumber}}</p> <p>{{replyNumber}}</p>
......
...@@ -11,7 +11,8 @@ ...@@ -11,7 +11,8 @@
<h6>{{info.userNick}}</h6> <h6>{{info.userNick}}</h6>
<p>{{floor}}</p> <p>{{floor}}</p>
</div> </div>
<p class="comment-box">{{info.comment}}</p> <p class="comment-box" v-if="type!=='question'">{{info.comment}}</p>
<p class="comment-box" v-if="type==='question'">{{info.reply}}</p>
<div class="footer"> <div class="footer">
<h6>{{dateConvert2}}</h6> <h6>{{dateConvert2}}</h6>
<p> <p>
...@@ -110,9 +111,13 @@ ...@@ -110,9 +111,13 @@
if(this.type === 'project'){ if(this.type === 'project'){
url = config.api.post.ProjectComment.release+this.id.toString()+'/comment' url = config.api.post.ProjectComment.release+this.id.toString()+'/comment'
} }
if(this.type === 'question'){
url = config.api.post.QuestionReplyComment.release+this.id.toString()+'/comment'
}
this.$axios.$post(url,{ this.$axios.$post(url,{
comment:this.commentContent, comment:this.commentContent,
parentId: this.info.commentId parentId: this.info.commentId||this.info.replyId
}).then((response)=>{ }).then((response)=>{
if(response.code===0){ if(response.code===0){
this.commentContent=''; this.commentContent='';
...@@ -152,6 +157,10 @@ ...@@ -152,6 +157,10 @@
params.parentId = this.info.commentId; params.parentId = this.info.commentId;
} }
if(this.type === 'question'){
url = config.api.get.ProjectComment.list+this.id.toString()+'/comments';
params.replyId = this.info.replyId ;
}
this.$axios.$get(url,{ this.$axios.$get(url,{
params params
}).then((response)=>{ }).then((response)=>{
...@@ -165,7 +174,7 @@ ...@@ -165,7 +174,7 @@
if(!this.$store.state.auth.token){ if(!this.$store.state.auth.token){
this.$message({ this.$message({
type:'warning', type:'warning',
message:'请在登录后点赞!' message:'请在登录后操作!'
}); });
return false; return false;
} }
......
...@@ -10,7 +10,8 @@ ...@@ -10,7 +10,8 @@
<h6>{{info.userNick}}</h6> <h6>{{info.userNick}}</h6>
<p>{{floor}}</p> <p>{{floor}}</p>
</div> </div>
<p class="comment-box">{{info.comment}}</p> <p class="comment-box" v-if="type!=='question'">{{info.comment}}</p>
<p class="comment-box" v-if="type==='question'">{{info.reply}}</p>
<div class="footer"> <div class="footer">
<h6>{{dateConvert2}}</h6> <h6>{{dateConvert2}}</h6>
<p> <p>
...@@ -105,6 +106,9 @@ ...@@ -105,6 +106,9 @@
if(this.type === 'project'){ if(this.type === 'project'){
url = config.api.post.ProjectComment.release+this.id.toString()+'/comment' url = config.api.post.ProjectComment.release+this.id.toString()+'/comment'
} }
if(this.type === 'question'){
url = config.api.post.QuestionReplyComment.release+this.id.toString()+'/comment'
}
this.$axios.$post(url,{ this.$axios.$post(url,{
comment:this.commentContent, comment:this.commentContent,
parentId: this.info.commentId parentId: this.info.commentId
...@@ -147,6 +151,10 @@ ...@@ -147,6 +151,10 @@
params.parentId = this.info.commentId; params.parentId = this.info.commentId;
} }
if(this.type === 'question'){
url = config.api.get.ProjectComment.list+this.id.toString()+'/comments';
params.replyId = this.info.replyId ;
}
this.$axios.$get(url,{ this.$axios.$get(url,{
params params
}).then((response)=>{ }).then((response)=>{
...@@ -160,7 +168,7 @@ ...@@ -160,7 +168,7 @@
if(!this.$store.state.auth.token){ if(!this.$store.state.auth.token){
this.$message({ this.$message({
type:'warning', type:'warning',
message:'请在登录后点赞!' message:'请在登录后操作!'
}); });
return false; return false;
} }
......
...@@ -10,7 +10,8 @@ ...@@ -10,7 +10,8 @@
<h6>{{info.userNick}}</h6> <h6>{{info.userNick}}</h6>
<p>{{floor}}</p> <p>{{floor}}</p>
</div> </div>
<p class="comment-box">{{info.comment}}</p> <p class="comment-box" v-if="type!=='question'">{{info.comment}}</p>
<p class="comment-box" v-if="type==='question'">{{info.reply}}</p>
<div class="footer"> <div class="footer">
<h6>{{dateConvert2}}</h6> <h6>{{dateConvert2}}</h6>
<p> <p>
...@@ -71,7 +72,7 @@ ...@@ -71,7 +72,7 @@
if(!this.$store.state.auth.token){ if(!this.$store.state.auth.token){
this.$message({ this.$message({
type:'warning', type:'warning',
message:'请在登录后点赞!' message:'请在登录后操作!'
}); });
return false; return false;
} }
......
...@@ -3,11 +3,13 @@ ...@@ -3,11 +3,13 @@
<div class="article-comment"> <div class="article-comment">
<textarea v-model="commentContent" name="" id="" cols="30" rows="10" class="release-area"></textarea> <textarea v-model="commentContent" name="" id="" cols="30" rows="10" class="release-area"></textarea>
<div class="button-box"> <div class="button-box">
<p @click="dataPostComment">评论</p> <p @click="dataPostComment" v-if="type!=='question'">评论</p>
<p @click="dataPostComment" v-if="type=='question'">回答</p>
</div> </div>
<div class="comments-header"> <div class="comments-header">
<p class="left"> <p class="left">
<span>全部评论</span> <span v-if="type!=='question'">全部评论</span>
<span v-if="type=='question'">全部回答</span>
<span>9</span> <span>9</span>
</p> </p>
<div class="right"> <div class="right">
...@@ -17,7 +19,7 @@ ...@@ -17,7 +19,7 @@
</div> </div>
</div> </div>
</div> </div>
<card @listenCommentReget1="dataGetComment" :type="type" :id="id" v-for="(val,index) in commentList" :key="val.commentId" :info="val"></card> <card @listenCommentReget1="dataGetComment" :type="type" :id="id" v-for="(val,index) in commentList" :key="val.commentId||val.questionId" :info="val"></card>
</div> </div>
</template> </template>
...@@ -65,36 +67,43 @@ ...@@ -65,36 +67,43 @@
if(!this.commentContent){ if(!this.commentContent){
this.$message({ this.$message({
type:'warning', type:'warning',
message:'请输入评论内容!' message:'请输入内容!'
}); });
return false; return false;
} }
let url; let url;
let postData={
}
if(this.type === 'blog'){ if(this.type === 'blog'){
url = config.api.post.BlogComment.release+this.id.toString()+'/comment' url = config.api.post.BlogComment.release+this.id.toString()+'/comment'
postData.comment = this.commentContent;
} }
if(this.type === 'project'){ if(this.type === 'project'){
url = config.api.post.ProjectComment.release+this.id.toString()+'/comment' url = config.api.post.ProjectComment.release+this.id.toString()+'/comment';
postData.comment = this.commentContent;
} }
this.$axios.$post(url,{
comment:this.commentContent if(this.type === 'question'){
}).then((response)=>{ url = config.api.post.QuestionReply.release+this.id.toString()+'/reply';
postData.reply = this.commentContent;
}
this.$axios.$post(url,postData
).then((response)=>{
if(response.code===0){ if(response.code===0){
this.commentContent=''; this.commentContent='';
this.dataGetComment(); this.dataGetComment();
this.$message({ this.$message({
type:'success', type:'success',
message:'评论发表成功!' message:'发表成功!'
}) })
}else{ }else{
this.$message({ this.$message({
type:'warning', type:'warning',
message:'评论发表失败!' message:'发表失败!'
}) })
} }
}) })
}, },
...@@ -109,6 +118,10 @@ ...@@ -109,6 +118,10 @@
if(this.type === 'project'){ if(this.type === 'project'){
url = config.api.get.ProjectComment.list+this.id.toString()+'/comments' url = config.api.get.ProjectComment.list+this.id.toString()+'/comments'
} }
if(this.type === 'question'){
url = config.api.get.QuestionReply.list+this.id.toString()+'/replies'
}
this.$axios.$get(url,{ this.$axios.$get(url,{
params:{ params:{
page:1, page:1,
......
...@@ -101,6 +101,7 @@ ...@@ -101,6 +101,7 @@
<li> <li>
<nuxt-link tag="span" to="/personal-center/account">账号资料</nuxt-link> <nuxt-link tag="span" to="/personal-center/account">账号资料</nuxt-link>
</li> </li>
<li @click="consoleF()">打印token</li>
<li @click="handleLogout">安全退出</li> <li @click="handleLogout">安全退出</li>
</ul> </ul>
</transition> </transition>
...@@ -166,15 +167,24 @@ ...@@ -166,15 +167,24 @@
methods:{ methods:{
consoleF(){
console.log(this.$store.state.auth.token);
},
handleLogout() { handleLogout() {
this.$alert('确认注销登录?', '', {
confirmButtonText: '确定',
callback: action => {
// 删除cookie // 删除cookie
Cookie.remove(config.default_data.KEY_COOKIE_TOKEN) Cookie.remove(config.default_data.KEY_COOKIE_TOKEN)
// 移除登录信息 // 移除登录信息
this.$store.commit('auth/logout') this.$store.commit('auth/logout')
// 移除用户信息 // 移除用户信息
this.$store.commit('userProfile/removeUser') this.$store.commit('userProfile/removeUser')
this.routeToHome();
}
});
}, },
changeStateHideBox(...arg){ changeStateHideBox(...arg){
if(arg.indexOf(1)===0){ if(arg.indexOf(1)===0){
...@@ -220,7 +230,7 @@ ...@@ -220,7 +230,7 @@
}, },
routeToHome(){ routeToHome(){
this.$router.push('/home'); this.$router.push('/');
}, },
getUserInfo(){ getUserInfo(){
......
...@@ -60,9 +60,13 @@ ...@@ -60,9 +60,13 @@
<div class="deleteButton" @click="dataDeleteItem(cardId)"> <div class="deleteButton" @click="dataDeleteItem(cardId)">
<yun-icon name="close1" size="12px" pb="3px"></yun-icon> <yun-icon name="close1" size="12px" pb="3px"></yun-icon>
</div> </div>
<div class="editButton"> <nuxt-link v-if="cardType===2" :to="{path:'/blog/release',query:{id:cardId}}" tag="div" class="editButton">
<yun-icon name="project" size="12px"></yun-icon> <yun-icon name="project" size="12px"></yun-icon>
</div> </nuxt-link>
<nuxt-link v-if="cardType===1" :to="{path:'/project/release',query:{id:cardId}}" tag="div" class="editButton">
<yun-icon name="project" size="12px"></yun-icon>
</nuxt-link>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -10,13 +10,12 @@ ...@@ -10,13 +10,12 @@
<div class="answer-container__center"> <div class="answer-container__center">
<card-container <card-container
width="816px" width="816px"
height="1012px"
:title="labelTitle" :title="labelTitle"
> >
<answer-card card-type="2"></answer-card> <answer-card card-type="2" v-for="(val,index) in QuestionList" :info="val" :key="val.questionId"></answer-card>
</card-container> </card-container>
<div class="pagination"> <div class="pagination">
<pagination style="margin: 0 auto;" pages="13" v-on:listenPageChange="changePage"></pagination> <pagination style="margin: 0 auto;" pages="pages" v-on:listenPageChange="changePage"></pagination>
</div> </div>
</div> </div>
<div class="answer-container__right"> <div class="answer-container__right">
...@@ -67,6 +66,7 @@ import CardContainer from "../../components/pc/cardContainer"; ...@@ -67,6 +66,7 @@ import CardContainer from "../../components/pc/cardContainer";
import ProjectCard from "../../components/pc/projectCard"; import ProjectCard from "../../components/pc/projectCard";
import Pagination from "../../components/pc/pagination"; import Pagination from "../../components/pc/pagination";
import AnswerCard from "../../components/pc/answerCard"; import AnswerCard from "../../components/pc/answerCard";
import config from "../../action/config";
export default { export default {
components: {AnswerCard, Pagination, ProjectCard, CardContainer, NavWrap}, components: {AnswerCard, Pagination, ProjectCard, CardContainer, NavWrap},
data(){ data(){
...@@ -92,7 +92,9 @@ export default { ...@@ -92,7 +92,9 @@ export default {
address: '/answer', address: '/answer',
id: '职场经验' id: '职场经验'
} }
] ],
pages:1,
QuestionList:[],
} }
}, },
created() { created() {
...@@ -115,10 +117,26 @@ export default { ...@@ -115,10 +117,26 @@ export default {
search(){ search(){
this.$router.push('/search/answer'); this.$router.push('/search/answer');
}, },
dataGetQuestionList(currentPage){
this.$axios.$get(config.api.get.Question.list,{
params:{
page:currentPage,
size:10,
}
}).then((response)=>{
this.QuestionList=response.data.dataList;
this.pages = response.data.totalPage;
})
},
changePage(currentPage){ changePage(currentPage){
//返回页数 请求新的数据 //返回页数 请求新的数据
this.dataGetQuestionList(currentPage)
} }
} }
} }
</script> </script>
......
...@@ -107,6 +107,7 @@ ...@@ -107,6 +107,7 @@
questionTitle:'', questionTitle:'',
lastSaveTime: new Date(), lastSaveTime: new Date(),
classList: [{tagId:1,tag:"web"}, {tagId:2,tag:"java"},{tagId:3,tag:"javascript"}], classList: [{tagId:1,tag:"web"}, {tagId:2,tag:"java"},{tagId:3,tag:"javascript"}],
contentHtml:'',
} }
}, },
methods: { methods: {
...@@ -249,8 +250,8 @@ ...@@ -249,8 +250,8 @@
let now = new Date(); let now = new Date();
if (now - this.lastSaveTime >= 2 * 1000) { if (now - this.lastSaveTime >= 2 * 1000) {
this.lastSaveTime = now; this.lastSaveTime = now;
this.projectDetail = render; this.content = value;
console.log('zdsava'); this.contentHtml = render;
} }
}, },
readScreen(boolean, str){ // 预览 readScreen(boolean, str){ // 预览
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
</div> </div>
</div> </div>
<p class="article__introduce">{{articleDetail.blogAbstract}}</p> <p class="article__introduce">{{articleDetail.blogAbstract}}</p>
<div class="article__content" v-html="articleDetail.content"> <div class="article__content" v-html="articleDetail.contentHtml">
</div> </div>
<div class="article__like"> <div class="article__like">
...@@ -213,14 +213,32 @@ ...@@ -213,14 +213,32 @@
@extend %flex-row-spb; @extend %flex-row-spb;
.header-info{ .header-info{
width:100%; width:100%;
height:60*$length;
@extend %flex-column-spb; @extend %flex-column-spb;
align-items:flex-start; align-items:flex-start;
.title{ .title{
@include fontStyle(24,24,500,#222,left);
@extend %flex-row-spb;
justify-content: flex-start;
@include fontStyle(24,28,500,#222,left);
height:auto;
.solved{
@include fontStyle(14,19,500,#222,left);
height:auto;
margin-left:20*$length;
padding:3*$length 5*$length;
background-color:
#e7faf0;
border: 1px solid
#d0f5e0;
color:
#13ce66;
border-radius: 4*$length;
}
} }
.infos{ .infos{
margin-top: 13*$length;
@extend %flex-row-spb; @extend %flex-row-spb;
width:100%; width:100%;
.info-left{ .info-left{
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
</div> </div>
</div> </div>
<p class="article__introduce">{{articleDetail.projectDescription}}</p> <p class="article__introduce">{{articleDetail.projectDescription}}</p>
<div class="article__content" v-html="articleDetail.projectDetail"> <div class="article__content" v-html="articleDetail.contentHtml">
</div> </div>
<div class="article__like"> <div class="article__like">
...@@ -71,7 +71,6 @@ ...@@ -71,7 +71,6 @@
</div> </div>
</div> </div>
<comment-con :id="articleDetail.projectId" type="project"></comment-con> <comment-con :id="articleDetail.projectId" type="project"></comment-con>
</div> </div>
<div class="detail-container__right"> <div class="detail-container__right">
<user-card :userId="articleDetail.userId"></user-card> <user-card :userId="articleDetail.userId"></user-card>
...@@ -212,15 +211,33 @@ ...@@ -212,15 +211,33 @@
.article__header{ .article__header{
@extend %flex-row-spb; @extend %flex-row-spb;
.header-info{ .header-info{
width:814*$length; width:100%;
height:60*$length;
@extend %flex-column-spb; @extend %flex-column-spb;
align-items:flex-start; align-items:flex-start;
.title{ .title{
@include fontStyle(24,24,500,#222,left);
@extend %flex-row-spb;
justify-content: flex-start;
@include fontStyle(24,28,500,#222,left);
height:auto;
.solved{
@include fontStyle(14,19,500,#222,left);
height:auto;
margin-left:20*$length;
padding:3*$length 5*$length;
background-color:
#e7faf0;
border: 1px solid
#d0f5e0;
color:
#13ce66;
border-radius: 4*$length;
}
} }
.infos{ .infos{
margin-top: 13*$length;
@extend %flex-row-spb; @extend %flex-row-spb;
width:100%; width:100%;
.info-left{ .info-left{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment