mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-13 12:56:43 +08:00
文章和问答的评论
This commit is contained in:
168
src/components/Portal/artauthor.vue
Normal file
168
src/components/Portal/artauthor.vue
Normal file
@@ -0,0 +1,168 @@
|
||||
<template>
|
||||
<div class="item-author">
|
||||
<div style="width:40px;height:40px;" @click="toHome()">
|
||||
<!-- <el-avatar shape="square" size="small" :src="userAvatar" v-if="userAvatar"></el-avatar> -->
|
||||
<!-- <div v-else class="uavatar"><span class="uavatar-text">{{avatarText}}</span></div> -->
|
||||
<el-avatar :size="40" shape="circle" :src="userAvatar" v-if="userAvatar"></el-avatar>
|
||||
<div v-else class="uavatar">
|
||||
<div v-if="sex == null" style="border-radius: 50%;width: 40px;height: 40px;"></div>
|
||||
<div v-else>
|
||||
<div class="mravat" v-if="sex === 1 "><img style="width:40px;height:40px;vertical-align: bottom;" src="../../../public/images/Avatarman.png" alt=""></div>
|
||||
<div class="mravat" v-else><img style="width:40px;height:40px;vertical-align: bottom;" src="../../../public/images/Avatarwoman.png" alt=""></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="author-right" v-if="!onlyAvatar" style="padding-left: 14px;font-size: 14px;">
|
||||
<div>
|
||||
<span style="color: #333333;font-weight: 400;font-size: 16px;">{{userName}}</span>
|
||||
<span class="author-text" v-if="userInfo && userInfo!=''">({{userInfo}})</span>
|
||||
</div>
|
||||
<span class="autname">{{ usersign }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
|
||||
export default {
|
||||
props:{
|
||||
avatar:{
|
||||
type:String,
|
||||
default:''
|
||||
},
|
||||
width:{
|
||||
type:String,
|
||||
default:'200px'
|
||||
},
|
||||
sex:{
|
||||
type:Number,
|
||||
},
|
||||
name:{
|
||||
type:String,
|
||||
default:''
|
||||
},
|
||||
sign:{
|
||||
type:String,
|
||||
default:''
|
||||
},
|
||||
|
||||
aid:{
|
||||
type:String,
|
||||
default:''
|
||||
},
|
||||
info:{
|
||||
type:String,
|
||||
default:''
|
||||
},
|
||||
onlyAvatar:{
|
||||
type:Boolean,
|
||||
default:false
|
||||
}
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
baseUrl:process.env.VUE_APP_FILE_BASE_URL,
|
||||
userAvatar:'',
|
||||
userName:'',
|
||||
userInfo:'',
|
||||
usersex:null,
|
||||
usersign:'',
|
||||
}
|
||||
},
|
||||
created() {
|
||||
// this.userAvatar=require("@/assets/images/user/default.png");
|
||||
},
|
||||
mounted() {
|
||||
this.userName=this.name;
|
||||
if(this.avatar && this.avatar!=''){
|
||||
this.userAvatar=this.avatar;
|
||||
}
|
||||
this.userInfo=this.info;
|
||||
this.usersex = this.sex;
|
||||
this.usersign = this.sign;
|
||||
},
|
||||
methods:{
|
||||
toHome() {
|
||||
// ,query:{id:item.objId || item.id}
|
||||
if(this.aid){
|
||||
this.$router.push({path:this.$xpage.getHomePath(this.aid)})
|
||||
}else{
|
||||
this.$message.error("参数错误");
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
watch:{
|
||||
name(newVal,oldVal){
|
||||
this.userName=newVal;
|
||||
},
|
||||
sign(newVal,oldVal){
|
||||
this.usersign=newVal;
|
||||
},
|
||||
avatar(newVal,oldVal){
|
||||
if(newVal){
|
||||
this.userAvatar=this.baseUrl+newVal;
|
||||
}
|
||||
},
|
||||
aid(newVal,oldVal){
|
||||
if(newVal){
|
||||
this.aid=newVal;
|
||||
}
|
||||
},
|
||||
sex(newVal,oldVal){
|
||||
this.usersex=newVal;
|
||||
},
|
||||
info(newVal,oldVal){
|
||||
this.userInfo=newVal;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
.mravat{
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
img{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
.autname{
|
||||
color: #666666;
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
line-height: 25px;
|
||||
}
|
||||
|
||||
.item-author{
|
||||
// font-size: 0.9em;
|
||||
line-height: 18px;
|
||||
display: flex;
|
||||
.author-text{
|
||||
font-size: 12px;
|
||||
color: #999999;
|
||||
font-weight: 300;
|
||||
margin-left: 10px;
|
||||
}
|
||||
.uavatar{
|
||||
// border: 1px solid #73adfe;
|
||||
// width: 28px;
|
||||
// height: 28px;
|
||||
// background: #d9e9ff;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
.uavatar-text{
|
||||
transform: scale(0.8);
|
||||
font-size: 12px;
|
||||
color: #73adfe;
|
||||
}
|
||||
img{
|
||||
border-radius: 50%;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -72,7 +72,8 @@
|
||||
<div class="comment" v-for="(com,comIdx) in list" :key="com.id">
|
||||
<div class="comment-top">
|
||||
<div class="comment-author">
|
||||
<authorInfo :aid="com.sysCreateAid" :avatar="com.avatar" :name="com.sysCreateBy" :sex="com.sex" :info="com.orgInfo"></authorInfo>
|
||||
<authorInfo :aid="com.sysCreateAid" :avatar="com.avatar" :name="com.sysCreateBy" :sex="com.sex" :info="com.orgInfo" :sign="com.sign"></authorInfo>
|
||||
<!-- <span class="signtext">{{ com.sign }}</span> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="comment-body" >
|
||||
@@ -114,7 +115,7 @@
|
||||
<div class="comment" v-for="(reply,replyIdx) in com.replyList" :key="reply.id" :class="replyIdx===com.replyList.length-1 ? 'comment-last' : ''">
|
||||
<div class="comment-top">
|
||||
<div class="comment-author">
|
||||
<authorInfo :aid="reply.sysCreateAid" :avatar="reply.avatar" :name="reply.sysCreateBy" :sex="reply.sex" :info="reply.orgInfo"></authorInfo>
|
||||
<authorInfo :aid="reply.sysCreateAid" :avatar="reply.avatar" :name="reply.sysCreateBy" :sex="reply.sex" :info="reply.orgInfo" :sign="reply.sign"></authorInfo>
|
||||
<span style="margin-left: 10px;color: #8590A6;font-size:14px; ">
|
||||
<svg-icon style="font-size: 10px;margin-right: 0;" icon-class="triangle"></svg-icon>
|
||||
</span>
|
||||
@@ -238,7 +239,7 @@
|
||||
import interactBar from "@/components/Portal/interactBar.vue";
|
||||
import apiComment from '@/api/modules/comments.js'
|
||||
import apiUser from '@/api/system/user.js'
|
||||
import authorInfo from '@/components/Portal/authorInfo.vue';
|
||||
import authorInfo from '@/components/Portal/artauthor.vue';
|
||||
// import author from '@/components/Portal/author.vue';
|
||||
import { mapGetters } from 'vuex';
|
||||
export default {
|
||||
@@ -405,6 +406,8 @@
|
||||
item.avatar=author.avatar;
|
||||
item.orgInfo=author.orgInfo;
|
||||
item.sex=author.sex;
|
||||
item.sign=author.sign
|
||||
console.log(list,'评论信息')
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
@@ -447,6 +450,7 @@
|
||||
res.result.list.forEach(item=>{
|
||||
item.avatar='';
|
||||
item.orgInfo='';
|
||||
item.sign='';
|
||||
item.isAll=false;
|
||||
//item.sex=null;
|
||||
allList.push(item);
|
||||
@@ -456,6 +460,7 @@
|
||||
reply.avatar='';
|
||||
reply.orgInfo='';
|
||||
reply.sex=null;
|
||||
reply.sign='';
|
||||
reply.isAll=false;
|
||||
allList.push(reply);
|
||||
ids.push(reply.sysCreateAid);
|
||||
@@ -793,6 +798,9 @@
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.signtext{
|
||||
|
||||
}
|
||||
|
||||
.publish-button{
|
||||
// line-height: 30px;
|
||||
|
||||
@@ -64,8 +64,7 @@
|
||||
<div class="answer" v-for="(item, index) of answerList" :key="item.id" :style="index === answerList.length - 1 ? 'border-bottom:none;' : ''">
|
||||
<div class="answer-top">
|
||||
<div>
|
||||
<author :aid="item.sysCreateAid" :avatar="item.avatar" :name="item.sysCreateBy" :info="item.orgInfo" :sex="item.sex"></author>
|
||||
<div class="sign">{{item.sign}}</div>
|
||||
<author :aid="item.sysCreateAid" :avatar="item.avatar" :name="item.sysCreateBy" :info="item.orgInfo" :sex="item.sex" :sign="item.sign"></author>
|
||||
</div>
|
||||
<div>
|
||||
<span v-if="detailData.isResolve && item.isBest" style="color: #ffb30f">最佳答案</span>
|
||||
@@ -123,7 +122,7 @@
|
||||
:class="i === item.answers.length - 1 ? 'comment-last' : ''">
|
||||
<div class="comment-top">
|
||||
<div class="comment-author">
|
||||
<author :aid="con.sysCreateAid" :avatar="con.avatar" :name="con.sysCreateBy" :sex="con.sex"></author>
|
||||
<author :aid="con.sysCreateAid" :avatar="con.avatar" :name="con.sysCreateBy" :sex="con.sex" :sign="con.sign"></author>
|
||||
<span class="comment-author-text">回复</span>
|
||||
<span style="margin-left: 10px; font-size:14px">{{ con.replayName }}</span>
|
||||
</div>
|
||||
@@ -290,7 +289,7 @@ import portalFooter from "@/components/PortalFooter.vue";
|
||||
import interactBar from "@/components/Portal/interactBar.vue";
|
||||
import editQuestion from "@/components/Qa/editQuestion.vue";
|
||||
import timeShow from "@/components/Portal/datetimeShow.vue";
|
||||
import author from "@/components/Portal/authorInfo.vue";
|
||||
import author from "@/components/Portal/artauthor.vue";
|
||||
import portalFloatTools from "@/components/PortalFloatTools.vue";
|
||||
import apiQa from "@/api/modules/qa.js";
|
||||
import apiUser from "@/api/system/user.js";
|
||||
@@ -468,6 +467,7 @@ export default {
|
||||
res.result.avatar = "";
|
||||
res.result.name = "";
|
||||
res.result.orgInfo = "";
|
||||
res.result.sign= "";
|
||||
res.result.sex = null;
|
||||
this.detailData = res.result;
|
||||
if (JSON.stringify(this.detailData) != "{}") {
|
||||
@@ -596,8 +596,8 @@ export default {
|
||||
if (author.aid == item.sysCreateAid) {
|
||||
item.avatar = author.avatar;
|
||||
item.orgInfo = author.orgInfo;
|
||||
item.sign = author.sign
|
||||
item.sex = author.sex;
|
||||
item.sign=author.sign;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user