mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-21 00:36:44 +08:00
2022年5月29日从svn移到git
This commit is contained in:
125
src/components/Qa/addQuestion.vue
Normal file
125
src/components/Qa/addQuestion.vue
Normal file
@@ -0,0 +1,125 @@
|
||||
<!--
|
||||
* @Author: zhaohg
|
||||
* @Date: 2022-03-14 09:54:51
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<el-dialog :close-on-click-modal='false' title="发布问题" width="800px" :visible.sync="askQuestionDialog">
|
||||
<el-form ref="askForm" :model="askForm" :rules="askFormRules" label-position="right" label-width="60px">
|
||||
<el-form-item label="标题:" prop="title"><el-input type="text" v-model="askForm.title" show-word-limit placeholder="请输入问题标题,字符长度不能高于100" maxlength="100"></el-input></el-form-item>
|
||||
<el-form-item label="内容:" prop="content">
|
||||
<el-input type="textarea" v-model="askForm.content" placeholder="请输入问题内容" :rows="6"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="图片" class="imageUrls">
|
||||
<imageUpload dir="qa" :value="imageShowUrl" @success="handleUploadSuccess" @remove="handleRemoveSuccess"></imageUpload>
|
||||
<!-- <el-upload
|
||||
:action="uploadFileUrl"
|
||||
:show-file-list="false"
|
||||
:headers="headers"
|
||||
list-type="picture-card"
|
||||
:on-success="handleAvatarSuccess"
|
||||
:before-upload="beforeAvatarUpload"
|
||||
class="avatar-uploader"
|
||||
>
|
||||
<i class="el-icon-plus avatar-uploader-icon"></i>
|
||||
<span class="icon-text">上传图片</span>
|
||||
</el-upload> -->
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer" style="text-align: left;margin-left:60px">
|
||||
<el-button type="primary" @click="addQaData" :disabled="!askForm.checked">发布问题</el-button>
|
||||
<el-button @click="askQuestionDialog = false">取 消</el-button>
|
||||
<el-checkbox style="margin-left:10px" v-model="askForm.checked"> </el-checkbox><span style="font-size:14px;color:#787878;margin-left:10px">我已阅读并遵守</span><span style="font-size:14px;color:#588afc;margin-right:10px;cursor: pointer;" @click="askFormCheckedShow = true">平台内容发布要求</span>
|
||||
</div>
|
||||
<el-dialog class="checked-show" :visible.sync="askFormCheckedShow" width="800px" :show-close="false" :modal="false">
|
||||
<agreement></agreement>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<!-- <el-button @click="askFormCheckedShow = false">取 消</el-button> -->
|
||||
<el-button type="primary" @click="askFormCheckedShow = false">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import apiQa from '@/api/modules/qa.js';
|
||||
import imageUpload from '@/components/ImageUpload/index.vue';
|
||||
import agreement from '@/components/Portal/agreement.vue'
|
||||
export default{
|
||||
data(){
|
||||
return {
|
||||
askFormCheckedShow:false,
|
||||
askFormRules: {
|
||||
title: [{ required: true, message: '请输入问题标题', trigger: 'blur' }, { max: 100, message: '字符长度不能高于100', trigger: 'blur' }],
|
||||
content: [{ required: true, message: '请输入问题内容', trigger: 'blur' }]
|
||||
}, //表单验证
|
||||
askForm: {}, //发布问答绑定的数据
|
||||
imageShowUrl: '', //组件绑定的值,不知道用处
|
||||
askQuestionDialog: false, //控制提问题弹窗
|
||||
}
|
||||
},
|
||||
components:{imageUpload,agreement},
|
||||
methods:{
|
||||
handleClose(done) {
|
||||
this.$confirm('确认关闭?')
|
||||
.then(_ => {
|
||||
done();
|
||||
})
|
||||
.catch(_ => {});
|
||||
},
|
||||
handleUploadSuccess(file) {
|
||||
// console.log(file.result.httpPath,'是否会fig以后关于和',file.result.filePath)
|
||||
this.imageShowUrl=file.result.httpPath;
|
||||
this.askForm.images=file.result.filePath
|
||||
},
|
||||
handleRemoveSuccess(file) {
|
||||
this.imageShowUrl=''
|
||||
this.askForm.images=''
|
||||
// console.log(file);//移除页面的触发事件没有
|
||||
},
|
||||
//发布问答时点击发布时的增加接口
|
||||
addQaData() {
|
||||
this.$refs.askForm.validate(valid => {
|
||||
if (valid) {
|
||||
apiQa.save(this.askForm).then(res => {
|
||||
if (res.status == 200) {
|
||||
if(res.message=='服务处理成功'){
|
||||
this.$message.success("发布问题成功")
|
||||
}
|
||||
if(res.message.indexOf('审核')!=-1){
|
||||
this.$message.warning("发布失败,因包含敏感词,请等待人工审核")
|
||||
}
|
||||
this.askForm = {};
|
||||
this.imageShowUrl='',
|
||||
this.askQuestionDialog = false;
|
||||
this.$emit('sure',true,res.result)
|
||||
} else {
|
||||
this.$message({
|
||||
type:'error',
|
||||
message:res.message
|
||||
});
|
||||
}
|
||||
}).catch(err=>{
|
||||
// this.message({
|
||||
// message:'发布问答失败',
|
||||
// type:'error'
|
||||
// })
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
::v-deep .checked-show{
|
||||
.el-dialog__header{
|
||||
padding:0;
|
||||
}
|
||||
.el-dialog__footer{
|
||||
border-top: 1px solid #F5F5F6;
|
||||
background-color: #F5F5F6;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
161
src/components/Qa/draftList.vue
Normal file
161
src/components/Qa/draftList.vue
Normal file
@@ -0,0 +1,161 @@
|
||||
<template>
|
||||
<div style="">
|
||||
<div class="article-list" v-for="(item,idx) in items" :key="idx">
|
||||
<div class="article-info">
|
||||
<div class="article-info-title">
|
||||
<div class="article-info-date">
|
||||
<el-button @click="editItem(item)" type="text" icon="el-icon-edit" size="mini">编辑</el-button>
|
||||
<el-button @click="delItem(item,idx)" type="text" icon="el-icon-remove" size="mini">删除</el-button>
|
||||
</div>
|
||||
<div style="padding-left: 5px;line-height: 30px;">
|
||||
<span style=""><a :href="`${webBaseUrl}/qa/answer?id=1`" target="_blank">{{item.title}}</a></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="article-info-summary">
|
||||
关于什么什么的问题,具体的描述都在这里了
|
||||
</div>
|
||||
<div class="article-info-tools">
|
||||
<div class="article-info-tools-auth">
|
||||
<span style="font-size: 13px; color: #7b7b7b;"><i class="el-icon-time"></i> 15个小时前</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<el-dialog title="分享" :visible.sync="shareShow" :close-on-click-modal="false" width="500px" custom-class="g-dialog">
|
||||
<div style="height: 200px;padding-right: 30px;">
|
||||
|
||||
<el-form label-width="100px">
|
||||
<el-form-item label="工号或姓名">
|
||||
<el-input v-model="shareInfo.name" placeholder="您要分享的人的工号或姓名">
|
||||
<el-button slot="append" icon="el-icon-search">搜索</el-button>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div>
|
||||
关于如何查询要分享的人,使用工号是否可以
|
||||
</div>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="shareShow= false">取 消</el-button>
|
||||
<el-button type="primary" >提交分享</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'articleItems',
|
||||
props: {
|
||||
items: { //name,
|
||||
type: Array,
|
||||
default:()=>[]
|
||||
}
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
shareShow:false,
|
||||
shareInfo:{
|
||||
aid:'',
|
||||
name:'',
|
||||
article:null
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
||||
},
|
||||
methods:{
|
||||
toStudy(item){
|
||||
this.$router.push({path:'/uc/study/index',params:{id:item.id}});
|
||||
},
|
||||
shareItem(item){
|
||||
this.shareInfo.article=item;
|
||||
this.shareShow=true;
|
||||
},
|
||||
editItem(item){
|
||||
this.$message({message:'编辑'+item.title+'内容',offset:50})
|
||||
},
|
||||
delItem(item,idx){
|
||||
this.$confirm('您确定要删除所选文章吗?', '删除提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.items.splice(idx,1);
|
||||
this.$message({type: 'success',message: '删除成功!',offset:50});
|
||||
}).catch(() => {
|
||||
this.$message({type: 'info',message: '已取消删除',offset:50});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.text-status1{
|
||||
padding: 3px;
|
||||
border: 1px dotted #1EA0FA;
|
||||
color:#1EA0FA;
|
||||
}
|
||||
.text-status2{
|
||||
padding: 3px;
|
||||
border: 1px dotted #00aa00;
|
||||
color:#00aa00;
|
||||
}
|
||||
.text-status3{
|
||||
padding: 3px;
|
||||
border: 1px dotted #ff0000;
|
||||
color:#ff0000;
|
||||
}
|
||||
.article-list {
|
||||
margin: 5px 0;
|
||||
border: 1px solid #dddddd;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.article-info {
|
||||
.article-info-title {
|
||||
font-size: 16px;
|
||||
font-weight: 400;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
.article-info-date {
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
float: right;
|
||||
font-weight: 200;
|
||||
color: #999999;
|
||||
i {
|
||||
margin-right: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.article-info-summary {
|
||||
height: 65px;
|
||||
color: #999999;
|
||||
}
|
||||
.article-info-tools {
|
||||
height: 30px;
|
||||
.article-info-tools-auth {
|
||||
float: left;
|
||||
font-size: 13px;
|
||||
color: #999999;
|
||||
img {
|
||||
margin-right: 10px;
|
||||
width: 30px;
|
||||
border: 1px solid #eee;
|
||||
border-radius: 50%;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
.article-info-tools-btns {
|
||||
float: right;
|
||||
.article-info-tools-btn {
|
||||
margin: 0 0 0 15px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
88
src/components/Qa/editQuestion.vue
Normal file
88
src/components/Qa/editQuestion.vue
Normal file
@@ -0,0 +1,88 @@
|
||||
<template>
|
||||
<el-dialog :close-on-click-modal="false" title="编辑问答" width="600px" :visible.sync="updateDialog" custom-class="g-dialog">
|
||||
<el-form ref="form" :model="editData" label-position="top" label-width="80px">
|
||||
<el-form-item label="回答内容">
|
||||
<el-input
|
||||
type="textarea"
|
||||
v-model="editData.content"
|
||||
placeholder="请输入详细描述"
|
||||
rows="8"
|
||||
minlength="1"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="updateDialog = false">取 消</el-button>
|
||||
<el-button type="success" @click="enSure">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import apiQa from '@/api/modules/qa.js';
|
||||
export default{
|
||||
props:{
|
||||
editData:{
|
||||
default:function(){
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
type:Object
|
||||
}
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
updateDialog:false,
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
//确认修改回答
|
||||
enSure() {
|
||||
if (!this.editData.content) {
|
||||
return this.$message({
|
||||
message: '回复内容不能为空',
|
||||
type: 'warning'
|
||||
});
|
||||
}
|
||||
// if(this.editData.content.length<0||this.editData.content.length>255){
|
||||
// return this.$message({
|
||||
// message: '回复内容为0-800个字',
|
||||
// type: 'warning'
|
||||
// });
|
||||
// }
|
||||
// let {answercontent,}
|
||||
let {answerid,content,sysCreateAid,favorites,praises,shares}=this.editData;
|
||||
apiQa
|
||||
.updateAnswer({id:answerid,sysCreateAid,content})
|
||||
.then(res => {
|
||||
if (res.status == 200) {
|
||||
this.$message({
|
||||
message: '修改成功',
|
||||
type: 'success'
|
||||
});
|
||||
this.updateDialog = false;
|
||||
this.$emit('enSure',true)
|
||||
} else {
|
||||
this.$message({
|
||||
message: '修改失败',
|
||||
type: 'error'
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.$message({
|
||||
message: '修改失败',
|
||||
type: 'error'
|
||||
});
|
||||
});
|
||||
// this.$message("修改成功")
|
||||
// this.editData={}
|
||||
// this.updateDialog = false
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
184
src/components/Qa/favoritesQaList.vue
Normal file
184
src/components/Qa/favoritesQaList.vue
Normal file
@@ -0,0 +1,184 @@
|
||||
<template>
|
||||
<div style="cursor: pointer;">
|
||||
<div class="article-list" v-for="(item, idx) in items" :key="idx" @click="qadetail(item)">
|
||||
<div class="article-info">
|
||||
<!-- <div class="article-info-title"> -->
|
||||
<div class="article-info-title" style="line-height: 30px;">
|
||||
<span class="qa-basic" :class="item.question.isResolve ? 'qa-solve' : 'qa-unSolve'">{{ item.question.isResolve ? '【已解决】' : '【待解决】' }}</span>
|
||||
<span style="padding-left: 5px">{{ item.question.title }}</span>
|
||||
</div>
|
||||
<!-- </div> -->
|
||||
<div class="article-info-summary two-line-ellipsis">{{ item.question.content }}</div>
|
||||
<div v-if="item.question.isResolve" style=";color: #5a5a5a;display:flex;margin-bottom:10px">
|
||||
<div style="width:90px"><span>最佳回答:</span></div>
|
||||
|
||||
<div class="one-line-ellipsis" style="color: #5a5a5a;padding-top:1px">{{ item.question.bestAnswer }}</div>
|
||||
</div>
|
||||
<div class="article-info-tools">
|
||||
<authorInfo :avatar="item.avatar" :name="item.name" :info="item.orgInfo" :sex="item.sex"></authorInfo>
|
||||
<span>发布时间:{{ item.question.sysCreateTime | timeFilter }}</span>
|
||||
<span>收藏时间:{{ item.time | timeFilter }}</span>
|
||||
<el-button @click.stop="delCollectItem(item)" type="text" icon="el-icon-remove" style="color:#8590A6">取消收藏</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import interactBar from '@/components/Portal/interactBar.vue';
|
||||
import authorInfo from '@/components/Portal/authorInfo.vue';
|
||||
export default {
|
||||
name: 'articleItems',
|
||||
props: {
|
||||
items: {
|
||||
//name,
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
},
|
||||
mounted() {},
|
||||
components: {
|
||||
interactBar,
|
||||
authorInfo
|
||||
},
|
||||
filters: {
|
||||
timeFilter(item) {
|
||||
return item.split(' ')[0];
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
qadetail(item) {
|
||||
// let routeData = this.$router.resolve({ path: '/qa/answer?id=' + item.question.id });
|
||||
// window.open(routeData.href, '_blank');
|
||||
this.$router.push({path:'/qa/answer',query:{id:item.question.id}})
|
||||
|
||||
},
|
||||
|
||||
toStudy(item) {
|
||||
this.$router.push({ path: '/uc/study/index', params: { id: item.id } });
|
||||
},
|
||||
editItem(item) {
|
||||
this.$message({ message: '编辑' + item.title + '内容', offset: 50 });
|
||||
},
|
||||
delItem(item, idx) {
|
||||
this.$confirm('您确定要删除所选文章吗?', '删除提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
this.items.splice(idx, 1);
|
||||
this.$message({ type: 'success', message: '删除成功!', offset: 50 });
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message({ type: 'info', message: '已取消删除', offset: 50 });
|
||||
});
|
||||
},
|
||||
delCollectItem(item) {
|
||||
this.$confirm('您确定要取消收藏吗?', '取消提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
this.$emit('confirm', item);
|
||||
// apiFavorites.del(item){
|
||||
// console.log(this.$parent,"我拿到的父组件")
|
||||
// }
|
||||
})
|
||||
.catch(() => {});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// .one-line-ellipsis {
|
||||
// display: -webkit-box;
|
||||
// white-space:pre-wrap;
|
||||
// overflow: hidden;
|
||||
// text-overflow: ellipsis;
|
||||
// -webkit-box-orient: vertical;
|
||||
// -webkit-line-clamp: 1;
|
||||
// box-sizing: border-box;
|
||||
// }
|
||||
.text-status1 {
|
||||
padding: 3px;
|
||||
border: 1px dotted #1ea0fa;
|
||||
color: #1ea0fa;
|
||||
}
|
||||
.text-status2 {
|
||||
padding: 3px;
|
||||
border: 1px dotted #00aa00;
|
||||
color: #00aa00;
|
||||
}
|
||||
.text-status3 {
|
||||
padding: 3px;
|
||||
border: 1px dotted #ff0000;
|
||||
color: #ff0000;
|
||||
}
|
||||
.article-list {
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
margin: 5px 0;
|
||||
border-bottom: 1px solid #e8e8e8;
|
||||
padding-top: 15px;
|
||||
padding-bottom: 15px;
|
||||
}
|
||||
|
||||
.article-info-date {
|
||||
position: absolute;
|
||||
top: 130px;
|
||||
|
||||
left: 90%;
|
||||
font-weight: 200;
|
||||
color: #666;
|
||||
i {
|
||||
margin-right: 5px;
|
||||
}
|
||||
}
|
||||
.article-info {
|
||||
.article-info-title {
|
||||
font-size: 16px;
|
||||
font-weight: 400;
|
||||
color: #333;
|
||||
line-height: 40px;
|
||||
// line-height: 40px;
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
span{
|
||||
&:first-of-type{
|
||||
flex-shrink: 0;
|
||||
}
|
||||
&:last-of-type{
|
||||
overflow: hidden;
|
||||
white-space:nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
}
|
||||
}
|
||||
.article-info-summary {
|
||||
line-height: 25px;
|
||||
margin: 10px 0;
|
||||
color: #666;
|
||||
}
|
||||
.article-info-tools {
|
||||
color: #999999;
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
> span {
|
||||
font-size: 14px;
|
||||
margin-top: 2px;
|
||||
margin-left: 10px;
|
||||
color: #747474;
|
||||
}
|
||||
> span:last-of-type {
|
||||
// margin-top: -4px;
|
||||
margin-right: auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
307
src/components/Qa/replyList.vue
Normal file
307
src/components/Qa/replyList.vue
Normal file
@@ -0,0 +1,307 @@
|
||||
<template>
|
||||
<div class="artlist">
|
||||
<Remark>
|
||||
<ul>
|
||||
<li>几个小时前接口里面没有这个值,是否需要自己写js逻辑判断,先写死</li>
|
||||
<li>这里的路由传参存在问题</li>
|
||||
</ul>
|
||||
</Remark>
|
||||
<div class="article-list" v-for="(item, idx) in items" :key="idx" @click="routerJump(item)">
|
||||
<div class="article-info">
|
||||
<div class="article-info-title">
|
||||
<div style="line-height: 30px;font-size: 18px" >
|
||||
<div class="one-line-ellipsis art-tit" >
|
||||
<span v-if="item.isResolve == true" class="qa-basic qa-solve">【已解决】</span>
|
||||
<span v-if="item.isResolve == false" class="qa-basic qa-unSolve">【待解决】</span>
|
||||
<span style="padding-left: 5px;cursor: pointer;" >
|
||||
<span v-html="$keywordActiveShow(item.title,keyWord)"></span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="article-info-summary">
|
||||
<div style="height:28px;overflow: hidden;" class="one-line-ellipsis" v-html="$keywordActiveShow(item.content,keyWord)"></div>
|
||||
<div class="article-Reply">
|
||||
<div class="article-hd">
|
||||
<span style="color: #171717;float:left;margin-top: 8px;" class="one-line-ellipsis">我的回答:<span v-if="item.isBest" class="isBest">最佳</span><span v-html="$keywordActiveShow(item.answercontent,keyWord)"></span></span>
|
||||
</div>
|
||||
<!-- <div >
|
||||
<el-button class="edit" icon="el-icon-edit" type="text" @click="editItem(item)" size="mini">编辑</el-button>
|
||||
<el-button class="del" icon="el-icon-remove" type="text" @click="delItem(item)" size="mini">删除</el-button>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="article-info-tools">
|
||||
<div class="article-info-tools-auth">
|
||||
<!-- <span style="font-size: 13px; color: #7b7b7b;padding-right: 15px;">提问时间:{{ item.sysCreateTimeQ }}</span> -->
|
||||
<span style=" font-size: 13px; color: #7b7b7b;padding-right: 15px;">回复时间:{{ item.sysCreateTimeA }}</span>
|
||||
|
||||
</div>
|
||||
<div class="article-info-date">
|
||||
<!-- <el-button @click="shareItem(item)" type="text" icon="el-icon-share">分享</el-button> -->
|
||||
<el-button class="edit" @click.stop="editItem(item)" type="text" icon="el-icon-edit" >编辑</el-button>
|
||||
<el-button class="del" @click.stop="delItem(item)" type="text" icon="el-icon-delete">删除</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<el-dialog title="分享" :visible.sync="shareShow" :close-on-click-modal="false" width="500px" custom-class="g-dialog">
|
||||
<div style="height: 200px;padding-right: 30px;">
|
||||
<el-form label-width="100px">
|
||||
<el-form-item label="工号或姓名">
|
||||
<el-input v-model="shareInfo.name" placeholder="您要分享的人的工号或姓名"><el-button slot="append" icon="el-icon-search">搜索</el-button></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div>关于如何查询要分享的人,使用工号是否可以</div>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="shareShow = false">取 消</el-button>
|
||||
<el-button type="primary">提交分享</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
<editQuestion ref="editQuestion" @enSure="enSure" :editData="editData"></editQuestion>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import apiQa from '@/api/modules/qa.js';
|
||||
import editQuestion from '@/components/Qa/editQuestion.vue';
|
||||
export default {
|
||||
name: 'articleItems',
|
||||
components: {editQuestion },
|
||||
props: {
|
||||
items: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
keyWord:{
|
||||
type: String,
|
||||
default: '',
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
shareShow: false,
|
||||
shareInfo: {
|
||||
aid: '',
|
||||
name: '',
|
||||
article: null
|
||||
},
|
||||
fieldsList: {
|
||||
collects: 'favorites',
|
||||
praises: 'praises',
|
||||
answers: 'answers'
|
||||
},
|
||||
editData: {}
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
// deleteData(item){
|
||||
// console.log(item,"我拿到准备删除的数据")
|
||||
// apiQa.delAnswer()
|
||||
// },
|
||||
routerJump(item) {
|
||||
this.$router.push({ path: '/qa/answer', query: { id: item.answerqid } });
|
||||
// window.open(this.webBaseUrl+'/qa/answer?id='+item.answerqid, '_blank');
|
||||
|
||||
},
|
||||
|
||||
toStudy(item) {
|
||||
this.$router.push({ path: '/uc/study/index', params: { id: item.id } });
|
||||
},
|
||||
shareItem(item) {
|
||||
this.shareInfo.article = item;
|
||||
this.shareShow = true;
|
||||
},
|
||||
editItem(item) {
|
||||
this.editData={...item}
|
||||
this.editData.content = item.answercontent;
|
||||
this.$refs.editQuestion.updateDialog = true;
|
||||
},
|
||||
delItem(item) {
|
||||
this.$confirm('确定要删除您回答的内容吗?', '删除提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
apiQa
|
||||
.delAnswer(item.answerid)
|
||||
.then(res => {
|
||||
if (res.status == 200) {
|
||||
this.$message({ type: 'success', message: '删除成功!', offset: 50 });
|
||||
this.$emit('sure', true);
|
||||
} else {
|
||||
this.$message({ type: 'info', message: '删除失败', offset: 50 });
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.$message({ type: 'info', message: '删除失败', offset: 50 });
|
||||
});
|
||||
// this.items.splice(idx, 1);
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
enSure() {
|
||||
this.editData={}
|
||||
this.$emit('enSure', true);
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.art-tit{
|
||||
margin-left: -12px;
|
||||
}
|
||||
.artlist{
|
||||
padding-left: 21px;
|
||||
padding-right: 32px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.article-info-date {
|
||||
|
||||
position: absolute;
|
||||
top: -10px;
|
||||
right:0px;
|
||||
// height: 40px;
|
||||
line-height: 30px;
|
||||
font-weight: 200;
|
||||
// margin-left: 10%;
|
||||
color: #999999;
|
||||
i {
|
||||
margin-right: 5px;
|
||||
}
|
||||
}
|
||||
.article-hd{
|
||||
width: 100%;
|
||||
// display: ;
|
||||
span{
|
||||
line-height: 30px;
|
||||
}
|
||||
.isBest{
|
||||
display: inline-block;
|
||||
border-radius: 4px;
|
||||
background: #588afc;
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
color: #fff;
|
||||
margin: 0 5px 0 0;
|
||||
padding: 0 5px;
|
||||
}
|
||||
}
|
||||
.edit{
|
||||
font-size: 14px;
|
||||
color: #8590A6;
|
||||
margin-right: 10px;
|
||||
|
||||
}
|
||||
.del{
|
||||
color: #8590A6;
|
||||
font-size: 14px;
|
||||
}
|
||||
.article-Reply{
|
||||
padding-top: 10px;
|
||||
font-size: 14px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: 16px;
|
||||
font-family: PingFang SC-Semibold, PingFang SC;
|
||||
font-weight: 600;
|
||||
color: #444444;
|
||||
line-height: 21px;
|
||||
}
|
||||
.one-line-ellipsis{
|
||||
// display: -webkit-box;
|
||||
overflow: hidden;
|
||||
text-overflow:ellipsis;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 1;
|
||||
box-sizing: border-box;
|
||||
word-break:break-all;
|
||||
|
||||
}
|
||||
.two-line-ellipsis{
|
||||
// display: -webkit-box;
|
||||
overflow: hidden;
|
||||
line-height: 30px;
|
||||
text-overflow:ellipsis;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
box-sizing: border-box;
|
||||
word-break:break-all;
|
||||
}
|
||||
.text-status1 {
|
||||
padding: 3px;
|
||||
// border: 1px dotted #1ea0fa;
|
||||
color: #08A890;
|
||||
}
|
||||
.text-status2 {
|
||||
padding: 3px;
|
||||
// border: 1px dotted #00aa00;
|
||||
color: #00aa00;
|
||||
}
|
||||
.text-status3 {
|
||||
padding: 3px;
|
||||
// border: 1px dotted #ff0000;
|
||||
color: #588afc;
|
||||
}
|
||||
.article-list {
|
||||
margin: 5px 0;
|
||||
// border: 1px solid #dddddd;
|
||||
padding: 10px 0;
|
||||
border-bottom: 1px solid #E8E8E8;
|
||||
}
|
||||
|
||||
.article-info {
|
||||
// height: 100px;
|
||||
width: 100%;
|
||||
.article-info-title {
|
||||
font-size: 16px;
|
||||
font-weight: 400;
|
||||
// height: 40px;
|
||||
line-height: 40px;
|
||||
|
||||
}
|
||||
.article-info-summary {
|
||||
height: 85px;
|
||||
line-height: 25px;
|
||||
overflow: hidden;
|
||||
margin-top: 16px;
|
||||
color: #999999;
|
||||
|
||||
}
|
||||
|
||||
// .article-info-summary:nth-child(1){
|
||||
// padding-bottom: 20px;
|
||||
// }
|
||||
.article-info-tools {
|
||||
height: 30px;
|
||||
position: relative;
|
||||
.article-info-tools-auth {
|
||||
float: left;
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
font-size: 13px;
|
||||
|
||||
color: #999999;
|
||||
img {
|
||||
margin-right: 10px;
|
||||
width: 30px;
|
||||
border: 1px solid #eee;
|
||||
border-radius: 50%;
|
||||
vertical-align: middle;
|
||||
|
||||
}
|
||||
}
|
||||
.article-info-tools-btns {
|
||||
float: right;
|
||||
.article-info-tools-btn {
|
||||
margin: 0 0 0 15px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
216
src/components/Qa/shareList.vue
Normal file
216
src/components/Qa/shareList.vue
Normal file
@@ -0,0 +1,216 @@
|
||||
<template>
|
||||
<div style="">
|
||||
<div class="article-list" v-for="(item, idx) in items" :key="idx">
|
||||
<div class="article-info" @click="jumpRouter(item)">
|
||||
<div class="article-info-title">
|
||||
<span class="qa-basic" :class="item.question.isResolve ? 'qa-solve' : 'qa-unSolve'">{{ item.question.isResolve ? '【已解决】' : '【未解决】' }}</span>
|
||||
<span class="title one-line-ellipsis" v-html="$keywordActiveShow(item.question.title,keyword)"></span>
|
||||
</div>
|
||||
<div class="article-info-summary">
|
||||
<span class="two-line-ellipsis" v-html="$keywordActiveShow(item.question.content,keyword)"></span>
|
||||
</div>
|
||||
<div class="bestAnswer one-line-ellipsis " v-if="item.question.isResolve">
|
||||
<span>最佳回答:</span>
|
||||
<span class="one-line-ellipsi" style="color: #999999;" v-html="$keywordActiveShow(item.question.bestAnswer,keyword)"></span>
|
||||
<!-- v-if="item.question.isResolve" -->
|
||||
<!-- v-if="item.question.isResolve" -->
|
||||
<!-- <div style="margin-right:15px;width: 80px">
|
||||
|
||||
</div>
|
||||
|
||||
<div class="one-line-ellipsis" v-if="item.question.isResolve" style="color: #999999;padding:2px 0 0 0;width:90%" v-html="$keywordActiveShow(item.question.bestAnswer,keyword)"> -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div style="display:flex;justify-content: space-between;color: rgb(153, 153, 153);font-size: 14px;">
|
||||
<div class="article-info-tools">
|
||||
<span>{{ item.time }}</span>
|
||||
<span v-if="type=='myShare'">分享给{{ item.toAname }}</span>
|
||||
<span v-else>{{ item.sysCreateBy }}分享给我</span>
|
||||
<el-button v-if="item.isRead" class="common readed" style="color: #8590A6;margin-left:10px;" icon="el-icon-folder-opened" type="text">已查看</el-button>
|
||||
<el-button class="common noRead" v-else style="color: #8590A6;margin-left:10px;" icon="el-icon-folder" type="text">未查看</el-button>
|
||||
</div>
|
||||
<div>
|
||||
<el-button @click.stop="deleteshares(item)" style="color: #8590A6;margin-left:36px" v-if="!item.isRead&&type=='myShare'" icon="el-icon-refresh-right" type="text">撤回</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import apiShares from '@/api/modules/shares.js';
|
||||
// import interactBar from '@/components/Portal/interactBar.vue';
|
||||
// import authorInfo from '@/components/Portal/authorInfo.vue';
|
||||
export default {
|
||||
name: 'articleItems',
|
||||
props: {
|
||||
items: {
|
||||
//name,
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
type:{
|
||||
type:String,
|
||||
default:()=>{
|
||||
return 'myShare'
|
||||
}
|
||||
},
|
||||
keyword:{
|
||||
type:String,
|
||||
default:()=>{
|
||||
return ''
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
};
|
||||
},
|
||||
components: {
|
||||
},
|
||||
methods: {
|
||||
jumpRouter(item){
|
||||
if(this.type!='myShare'){
|
||||
apiShares.updateIsRead(item.id).then(res=>{
|
||||
if(res.status==200){
|
||||
this.$emit('confirm',item)
|
||||
}
|
||||
})
|
||||
}
|
||||
this.$router.push({path:'/qa/answer',query:{id:item.question.id}})
|
||||
// window.open(`${this.webBaseUrl}/qa/answer?id=${item.question.id}`)
|
||||
},
|
||||
shareItem(idx) {
|
||||
this.$refs.shareAction[idx].addShare()
|
||||
},
|
||||
delItem(item) {
|
||||
this.$confirm('您确定要删除所选问答吗?', '删除提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
this.$emit("confirm",item)
|
||||
})
|
||||
.catch(() => {
|
||||
});
|
||||
},
|
||||
deleteshares(item){
|
||||
this.$emit('confirm',item)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.one-line-ellipsis{
|
||||
display: -webkit-box;
|
||||
// white-space:pre-wrap;
|
||||
overflow: hidden;
|
||||
text-overflow:ellipsis;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 1;
|
||||
box-sizing: border-box;
|
||||
|
||||
}
|
||||
.two-line-ellipsis{
|
||||
display: -webkit-box;
|
||||
// white-space:pre-wrap;
|
||||
overflow: hidden;
|
||||
text-overflow:ellipsis;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
box-sizing: border-box;
|
||||
|
||||
}
|
||||
.text-status1 {
|
||||
// border: 1px dotted #1ea0fa;
|
||||
color: #1ea0fa;
|
||||
}
|
||||
.text-status2 {
|
||||
|
||||
// border: 1px dotted #00aa00;
|
||||
color: #00aa00;
|
||||
}
|
||||
.text-status3 {
|
||||
// border: 1px dotted #ff3e3e;
|
||||
color: #ff3e3e;
|
||||
}
|
||||
.article-list {
|
||||
// margin: 5px 0;
|
||||
// border: 1px solid #dddddd;
|
||||
// padding: 10px;
|
||||
padding-bottom: 21px;
|
||||
margin-top: 24px;
|
||||
border-bottom: 1px solid #E8E8E8;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.article-info {
|
||||
.article-info-title {
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
span:first-of-type{
|
||||
margin-top: -2px;
|
||||
}
|
||||
.title{
|
||||
margin-left: 8px;
|
||||
flex-shrink: 10000;
|
||||
}
|
||||
.common{
|
||||
margin-left: auto;
|
||||
}
|
||||
.readed{
|
||||
color: #2AB28B;
|
||||
}
|
||||
.noRead{
|
||||
color:#FF3E3E;
|
||||
}
|
||||
}
|
||||
.article-info-summary {
|
||||
color: #666666;
|
||||
// line-height: 1.5;
|
||||
font-size: 14px;
|
||||
height: 40px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin: 7px 0px;
|
||||
}
|
||||
.bestAnswer{
|
||||
// height: 30px;
|
||||
font-size: 16px;
|
||||
color: #444444;
|
||||
font-weight: 600;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
span:first-of-type{
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.one-line-ellipsi{
|
||||
overflow: hidden;
|
||||
text-overflow:ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
// padding-left: 20px;
|
||||
}
|
||||
.article-info-tools {
|
||||
color: #999999;
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
>span{
|
||||
font-size: 14px;
|
||||
line-height: 25px;
|
||||
color: #747474;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
213
src/components/Qa/toList.vue
Normal file
213
src/components/Qa/toList.vue
Normal file
@@ -0,0 +1,213 @@
|
||||
<template>
|
||||
<div style="">
|
||||
<div class="article-list" v-for="(item,idx) in items" :key="idx">
|
||||
<div class="article-info">
|
||||
<div class="article-info-title">
|
||||
<div class="article-info-date">
|
||||
<!--
|
||||
<el-button type="text" icon="el-icon-share">分享</el-button>
|
||||
-->
|
||||
</div>
|
||||
<div style="padding-left: 5px;line-height: 30px;">
|
||||
<span v-if="item.status>1" class="qa-basic qa-solve">【已解决】</span>
|
||||
<span v-if="item.status==1" class="qa-basic qa-unSolve">【待解决】</span>
|
||||
<span style="padding-left: 5px;">
|
||||
<a :href="`${webBaseUrl}/qa/answer?id=1`" target="_blank">{{item.title}}</a>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="article-info-summary">
|
||||
不懂就要问,求专家指点高刷新率、高色域、HDR的决定因素和限制条件
|
||||
</div>
|
||||
<div style="padding-left: 20px;color: #5a5a5a;">
|
||||
<span>最佳回答:</span>
|
||||
<div style="color: #5a5a5a;padding: 8px 0px 10px 20px;">这个对液晶、IC的要求都较高</div>
|
||||
</div>
|
||||
<div class="article-info-tools">
|
||||
<div class="article-info-tools-auth">
|
||||
<span style="font-size: 13px; color: #7b7b7b;"><i class="el-icon-user"></i> 2022-02-11 12:10:23 分享给 XXXX</span>
|
||||
</div>
|
||||
<div class="article-info-tools-btns">
|
||||
<interactBar :data="oData" :type="0" :views="false"></interactBar>
|
||||
<!-- <el-link icon="el-icon-chat-line-round" class="article-info-tools-btn" >回答57</el-link>
|
||||
<el-link icon="el-icon-s-promotion" class="article-info-tools-btn" >关注23</el-link>
|
||||
<el-link icon="el-icon-star-on" class="article-info-tools-btn">收藏12</el-link>
|
||||
<el-link icon="el-icon-thumb" class="article-info-tools-btn" >点赞20</el-link > -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<el-dialog title="分享" :visible.sync="shareShow" :close-on-click-modal="false" width="500px" custom-class="g-dialog">
|
||||
<div style="height: 200px;padding-right: 30px;">
|
||||
|
||||
<el-form label-width="100px">
|
||||
<el-form-item label="工号或姓名">
|
||||
<el-input v-model="shareInfo.name" placeholder="您要分享的人的工号或姓名">
|
||||
<el-button slot="append" icon="el-icon-search">搜索</el-button>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div>
|
||||
关于如何查询要分享的人,使用工号是否可以
|
||||
</div>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="shareShow= false">取 消</el-button>
|
||||
<el-button type="primary" >提交分享</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import interactBar from '@/components/Portal/interactBar.vue'
|
||||
export default {
|
||||
name: 'articleItems',
|
||||
props: {
|
||||
items: { //name,
|
||||
type: Array,
|
||||
default:()=>[]
|
||||
},
|
||||
share:{
|
||||
type: Boolean,
|
||||
default:true
|
||||
},
|
||||
remove:{
|
||||
type: Boolean,
|
||||
default:true
|
||||
},
|
||||
edit:{
|
||||
type: Boolean,
|
||||
default:true
|
||||
},
|
||||
collect:{
|
||||
type: Boolean,
|
||||
default:false
|
||||
}
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
shareShow:false,
|
||||
shareInfo:{
|
||||
aid:'',
|
||||
name:'',
|
||||
article:null
|
||||
},
|
||||
oData:{
|
||||
favorites:23,
|
||||
comments:18,
|
||||
shares:16,
|
||||
praises:68,
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
||||
},
|
||||
components:{
|
||||
interactBar
|
||||
},
|
||||
methods:{
|
||||
toStudy(item){
|
||||
this.$router.push({path:'/uc/study/index',params:{id:item.id}});
|
||||
},
|
||||
shareItem(item){
|
||||
this.shareInfo.article=item;
|
||||
this.shareShow=true;
|
||||
},
|
||||
editItem(item){
|
||||
this.$message({message:'编辑'+item.title+'内容',offset:50})
|
||||
},
|
||||
delItem(item,idx){
|
||||
this.$confirm('您确定要删除所选文章吗?', '删除提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.items.splice(idx,1);
|
||||
this.$message({type: 'success',message: '删除成功!',offset:50});
|
||||
}).catch(() => {
|
||||
this.$message({type: 'info',message: '已取消删除',offset:50});
|
||||
});
|
||||
},
|
||||
delCollectItem(item,idx){
|
||||
this.$confirm('您确定要取消收藏吗?', '取消提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.items.splice(idx,1);
|
||||
this.$message({type: 'success',message: '取消成功!',offset:50});
|
||||
}).catch(() => {
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.text-status1{
|
||||
padding: 3px;
|
||||
color: #1ea0fa;
|
||||
}
|
||||
.text-status2{
|
||||
padding: 3px;
|
||||
color: #00aa00;
|
||||
}
|
||||
.text-status3{
|
||||
padding: 3px;
|
||||
color: #ff0000;
|
||||
}
|
||||
.article-list {
|
||||
margin: 5px 0;
|
||||
border: 1px solid #dddddd;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.article-info {
|
||||
.article-info-title {
|
||||
font-size: 16px;
|
||||
font-weight: 400;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
.article-info-date {
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
float: right;
|
||||
font-weight: 200;
|
||||
color: #999999;
|
||||
i {
|
||||
margin-right: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.article-info-summary {
|
||||
height: 65px;
|
||||
color: #999999;
|
||||
}
|
||||
.article-info-tools {
|
||||
height: 30px;
|
||||
.article-info-tools-auth {
|
||||
float: left;
|
||||
font-size: 13px;
|
||||
color: #999999;
|
||||
img {
|
||||
margin-right: 10px;
|
||||
width: 30px;
|
||||
border: 1px solid #eee;
|
||||
border-radius: 50%;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
.article-info-tools-btns {
|
||||
float: right;
|
||||
.article-info-tools-btn {
|
||||
margin: 0 0 0 15px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
322
src/components/Qa/ucList.vue
Normal file
322
src/components/Qa/ucList.vue
Normal file
@@ -0,0 +1,322 @@
|
||||
<template>
|
||||
<div class="artlist">
|
||||
<div class="article-list" v-for="(item, idx) in items" :key="idx" @click="jumpRouter(item)">
|
||||
<div class="article-info">
|
||||
<div class="article-info-title">
|
||||
<span v-if="item.isResolve ==true" class="qa-basic qa-solve">【已解决】</span>
|
||||
<span v-if="item.isResolve == false" class="qa-basic qa-unSolve">【待解决】</span>
|
||||
<span class="title one-line-ellipsis" v-html="$keywordActiveShow(item.title,keyWord)"></span>
|
||||
|
||||
</div>
|
||||
<!-- 提问内容 -->
|
||||
<div class="article-info-summary ">
|
||||
<!-- <div class="summary-content two-line-ellipsis" style="word-wrap: break-word;">{{ item.content }}</div> -->
|
||||
<div class="summary-content two-line-ellipsis " v-html="$keywordActiveShow(item.content,keyWord)"></div>
|
||||
<!-- <div class="article-info-tools"> -->
|
||||
<!-- <div class="article-info-tools-source">来源:{{ item.course }}</div> -->
|
||||
<div class="two-line-ellipsis" style="margin-bottom: 10px;" v-if="item.bestAnswer !== ''">
|
||||
<!-- <span style="color: #7b7b7b;margin-right: 8px;"> -->
|
||||
最佳答案:<span v-html="$keywordActiveShow(item.bestAnswer,keyWord)"></span>
|
||||
<!-- </span> -->
|
||||
</div>
|
||||
<div style="position: relative; font-size: 15px;display: flex;justify-content: flex-start;align-items: center;">
|
||||
<!-- <div style="font-size:15px;margin:8px 0">提问人:{{ item.sysCreateBy }}</div> -->
|
||||
|
||||
<span style="color: #7b7b7b;margin-right: 8px;">
|
||||
|
||||
提问时间: {{ item.sysCreateTime }}
|
||||
</span>
|
||||
<span v-if="item.status==0||item.status==2" style="color: red">{{statusText(item.status)}}</span>
|
||||
<!-- <div class="article-info-tools-btns"> -->
|
||||
<!-- <interactBar :data="item" :type="0" class="test" :answers="true" :comments="false" :shares="false" :views="false"></interactBar> -->
|
||||
<div class="button-cla">
|
||||
<el-button class="edit" @click.stop="editItem(item)" type="text" icon="el-icon-edit" size="mini" >编辑</el-button>
|
||||
<el-button class="del" @click.stop="delItem(item)" type="text" icon="el-icon-delete" size="mini" >删除</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <el-link icon="el-icon-chat-line-round" class="article-info-tools-btn" >回答57</el-link>
|
||||
<el-link icon="el-icon-s-promotion" class="article-info-tools-btn" >分享57</el-link>
|
||||
<el-link icon="el-icon-star-on" class="article-info-tools-btn">收藏12</el-link>
|
||||
<el-link icon="el-icon-thumb" class="article-info-tools-btn" >点赞20</el-link > -->
|
||||
<!-- </div> -->
|
||||
<!-- </div> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<el-dialog :close-on-click-modal='false' title="编辑问题" width="700px" :visible.sync="askQuestionDialog">
|
||||
<el-form ref="askForm" :model="askForm" :rules="askFormRules" label-position="right" label-width="60px">
|
||||
<el-form-item label="标题:" prop="title"><el-input type="text" v-model="askForm.title" show-word-limit placeholder="请输入问题标题,字符长度不能高于100" maxlength="100"></el-input></el-form-item>
|
||||
<el-form-item label="内容:" prop="content">
|
||||
<el-input type="textarea" v-model="askForm.content" placeholder="请输入问题内容" :rows="6"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="图片" class="imageUrls">
|
||||
<imageUpload dir="qa" :value="imageShowUrl" @success="handleUploadSuccess" @remove="handleRemoveSuccess"></imageUpload>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="askQuestionDialog = false">取 消</el-button>
|
||||
<el-button type="primary" @click="editQaData">提交修改</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!-- <el-dialog title="分享" :visible.sync="shareShow" :close-on-click-modal="false" width="500px" custom-class="g-dialog">
|
||||
<div style="height: 200px;padding-right: 30px;">
|
||||
<el-form label-width="100px">
|
||||
<el-form-item label="工号或姓名">
|
||||
<el-input v-model="shareInfo.name" placeholder="您要分享的人的工号或姓名"><el-button slot="append" icon="el-icon-search">查询</el-button></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div>关于如何查询要分享的人,使用工号是否可以</div>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="shareShow = false">取 消</el-button>
|
||||
<el-button type="primary">提交分享</el-button>
|
||||
</span>
|
||||
</el-dialog> -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// import interactBar from '@/components/Portal/interactBar';
|
||||
import imageUpload from '@/components/ImageUpload/index.vue';
|
||||
import apiQa from '@/api/modules/qa.js'
|
||||
export default {
|
||||
name: 'articleItems',
|
||||
components: { imageUpload },
|
||||
props: {
|
||||
items: {
|
||||
//name,
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
keyWord:{
|
||||
type:String,
|
||||
default:()=>{
|
||||
return ''
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
askFormRules: {
|
||||
title: [{ required: true, message: '请输入问题标题', trigger: 'blur' }, { max: 100, message: '字符长度不能高于100', trigger: 'blur' }],
|
||||
content: [{ required: true, message: '请输入问题内容', trigger: 'blur' }]
|
||||
}, //表单验证
|
||||
askForm: {}, //发布问答绑定的数据
|
||||
imageShowUrl: '', //组件绑定的值
|
||||
askQuestionDialog: false, //控制编辑问题弹窗
|
||||
fileBaseUrl:process.env.VUE_APP_FILE_BASE_URL,
|
||||
// shareShow: false,
|
||||
// shareInfo: {
|
||||
// aid: '',
|
||||
// name: '',
|
||||
// article: null
|
||||
// },
|
||||
// fieldsList: {
|
||||
// answers: 'answers',
|
||||
// collects: 'favorites',
|
||||
// praises: 'praises',
|
||||
// }
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
handleUploadSuccess(file) {
|
||||
this.imageShowUrl=file.result.httpPath;
|
||||
this.askForm.images=file.result.filePath
|
||||
},
|
||||
handleRemoveSuccess(file) {
|
||||
this.imageShowUrl=''
|
||||
this.askForm.images=''
|
||||
},
|
||||
jumpRouter(item){
|
||||
if(item.status==2){
|
||||
return this.$message.warning('您发布的问题审核未通过,建议您编辑后重新发布')
|
||||
}
|
||||
if(item.status==0){
|
||||
return this.$message.warning('您发布的问题正在审核,请等待审核')
|
||||
}
|
||||
// window.open(this.webBaseUrl+'/qa/answer?id='+item.id, '_blank');
|
||||
|
||||
this.$router.push({path:'/qa/answer',query:{id:item.id}})
|
||||
},
|
||||
statusText(status){
|
||||
if(status==0){
|
||||
return '因存在敏感词,请等待人工审核'
|
||||
}
|
||||
if(status==2){
|
||||
return '经管理员审核,未通过'
|
||||
}
|
||||
},
|
||||
editQaData(){
|
||||
this.$refs.askForm.validate(valid =>{
|
||||
if(valid){
|
||||
apiQa.update(this.askForm).then(res=>{
|
||||
if(res.status==200){
|
||||
if(res.message=='服务处理成功'){
|
||||
this.$message(
|
||||
{
|
||||
type:'success',
|
||||
message:"修改问题成功"
|
||||
});
|
||||
}
|
||||
if(res.message.indexOf('审核')!=-1){
|
||||
this.$message(
|
||||
{
|
||||
type:'warning',
|
||||
message:"修改成功,因包含敏感词,请等待人工审核"
|
||||
});
|
||||
}
|
||||
this.askForm = {};
|
||||
this.imageShowUrl='',
|
||||
this.askQuestionDialog = false;
|
||||
this.$emit('sure',true)
|
||||
}else{
|
||||
this.$message.error('提交失败')
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
editItem(item) {
|
||||
this.askQuestionDialog=true;
|
||||
this.askForm={...item}
|
||||
if(this.askForm.images){
|
||||
this.imageShowUrl=this.fileBaseUrl+this.askForm.images
|
||||
}else{
|
||||
this.imageShowUrl='';
|
||||
}
|
||||
},
|
||||
delItem(item) {
|
||||
this.$confirm('您确定要删除所选问题吗?', '删除提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
apiQa.del(item.id).then(res=>{
|
||||
if(res.status==200){
|
||||
this.$message({ type: 'success', message: '删除成功!' });
|
||||
this.$emit('sure',true)
|
||||
}
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
});
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.button-cla{
|
||||
position: absolute;
|
||||
right:0px;
|
||||
}
|
||||
.edit{
|
||||
color: #8590A6;
|
||||
font-size: 14px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
.del{
|
||||
color: #8590A6;
|
||||
// margin-left: 70%;
|
||||
font-size: 14px;
|
||||
}
|
||||
.artlist{
|
||||
padding-left: 23px;
|
||||
padding-right: 32px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.one-line-ellipsis{
|
||||
// display: -webkit-box;
|
||||
overflow: hidden;
|
||||
line-height: 30px;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 1;
|
||||
// width: 80%;
|
||||
box-sizing: border-box;
|
||||
text-overflow:ellipsis;
|
||||
word-break:break-all;
|
||||
}
|
||||
.two-line-ellipsis{
|
||||
width: 100%;
|
||||
// display: -webkit-box;
|
||||
// white-space:pre-wrap;
|
||||
overflow: hidden;
|
||||
line-height: 25px;
|
||||
text-overflow:ellipsis;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
box-sizing: border-box;
|
||||
word-break:break-all;
|
||||
|
||||
}
|
||||
.test {
|
||||
margin-top: auto;
|
||||
}
|
||||
.text-status1 {
|
||||
padding: 3px;
|
||||
// border: 1px dotted #1ea0fa;
|
||||
color: #08A890;
|
||||
}
|
||||
.text-status2 {
|
||||
padding: 3px;
|
||||
// border: 1px dotted #00aa00;
|
||||
color: #00aa00;
|
||||
}
|
||||
.text-status3 {
|
||||
padding: 3px;
|
||||
// border: 1px dotted #ff0000;
|
||||
color: #588afc;
|
||||
}
|
||||
.article-list {
|
||||
margin: 5px 0;
|
||||
border-bottom: 1px solid #E8E8E8;
|
||||
padding: 10px 0;
|
||||
}
|
||||
|
||||
.article-info {
|
||||
|
||||
.article-info-title {
|
||||
font-size: 18px;
|
||||
font-weight: 400;
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
margin-left: -14px;
|
||||
.title{
|
||||
margin-left: 8px;
|
||||
flex-shrink: 10000;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
// height: 40px;
|
||||
// line-height: 40px;
|
||||
}
|
||||
.article-info-summary {
|
||||
margin-left: px;
|
||||
// height:70px;
|
||||
color: #666;
|
||||
.summary-content{
|
||||
margin:10px 0;
|
||||
}
|
||||
}
|
||||
.article-info-tools {
|
||||
// height: 30px;
|
||||
.article-info-tools-auth {
|
||||
// float: left;
|
||||
font-size: 13px;
|
||||
color: #333333;
|
||||
img {
|
||||
margin-right: 10px;
|
||||
width: 30px;
|
||||
border: 1px solid #eee;
|
||||
border-radius: 50%;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user