Commit 35e7593f by yanju

new blog api

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