事件添加

This commit is contained in:
zhaofang
2022-11-15 17:09:30 +08:00
parent 145b2988f7
commit 0001f411fe
8 changed files with 251 additions and 24 deletions

View File

@@ -20,7 +20,7 @@
<view class="tabs-text" @click="tabsClick(2)" :class="{'active':active ==2}">回答<text v-show="active ==2" class="active-line"></text></view>
</view>
<view class="my-qa-list" v-show="active ==1">
<view class="my-qa-index" v-for="put in putList.list" :key="put.id" @click="toDetail(put)">
<view class="my-qa-index" v-for="(put, index) in putList.list" :key="put.id" @click="toDetail(put)">
<view class="artical-box-top">
<view style="" class="artical-tit">
<text class="qa-basic qa-solve" v-if="put.isResolve">已解决</text>
@@ -44,7 +44,7 @@
<view class="rowbtn" @click.stop="toEdit(put)">
<image class="btn-img" src="../../static/images/icon/edit.png" size="24"></image><text class="btn-text">编辑</text>
</view>
<view class="rowbtn" style="margin-left: 12upx;" @click.stop="del(put)">
<view class="rowbtn" style="margin-left: 12upx;" @click.stop="del(put,index)">
<image class="btn-img" src="../../static/images/icon/del.png" size="24"></image><text class="btn-text">删除</text>
</view>
</view>
@@ -265,7 +265,7 @@
url:'/pages/plus/editQuestion?value='+JSON.stringify(item)
})
},
del(item){
del(item,index){
const $this=this
uni.showModal({
title: '提示',
@@ -275,8 +275,24 @@
apiQa.del(item.id).then(res=>{
if(res.status=200){
$this.$refs.articleToast.show({message:'删除成功',type:'success'});
let event = {
key: "DeleteQuestion",//
title: "删除提问",//事件的标题
parameters:"author:"+item.sysCreateAid,//作者参数
content: "删除提问【"+item.title+"】",//事件的内容
source:'page',
objId: item.id,//关联的id
objType: "2",//关联的类型
objInfo: item.title,
aid: $this.userInfo.aid, //当前登录人的id
aname: $this.userInfo.name,//当前人的姓名
status: 1 ,//状态直接写1
source:2,
}
apiStat.sendEvent(event);
setTimeout(()=>{
$this.findData(true)
// $this.findData(true)
$this.putList.list.splice(index, 1);
},1000)
}else{
$this.$refs.articleToast.show({message:'删除失败,请稍后再试',type:'error'});

View File

@@ -32,7 +32,7 @@
<script>
import apiArticle from '@/api/modules/article.js'
import apiUser from '@/api/system/user.js'
import apiStat from '@/api/phase2/stat.js'
import { mapGetters } from 'vuex';
export default {
data() {
@@ -56,6 +56,32 @@
this.id = options.id;
this.getDetail();
},
mounted() {
let event = {
key: "ViewArticle",//后台的事件key 发布文章且审核通过
title: "查看文章",//事件的标题
parameters:"",//用户自定义参数 name:value,name:value
content: "查看了文章",//事件的内容
source:'page',
objId: this.id,//关联的id
objType: "2",//关联的类型
objInfo: this.detail.title,
aid: this.userInfo.aid, //当前登录人的id
aname: this.userInfo.name,//当前人的姓名
status: 1 ,//状态直接写1
source:2,
}
apiStat.sendEvent(event);
// this.$store.dispatch("userTrigger", event);
this.setTime = setTimeout(()=>{
event.key = 'ReadArticle';
event.title = "阅读文章";
event.parameters='second:60';//增加60秒的学习时长
event.content = "阅读了文章"
apiStat.sendEvent(event);
// $this.$store.dispatch("userTrigger", event);
},61000);//1分钟后记录
},
onReachBottom(){
this.getDetail()
},

View File

@@ -52,15 +52,17 @@
<view v-for="(an, anidx) in answerList" :key="anidx" class="comment">
<view class="comment-top">
<view style="display: flex;">
<author :showInfo="true" :size="30" width="30px" height="30px" :data="an"></author>
<!-- {{an}} -->
<author-img :avatar="an.avatar" :sex="an.sex" width="30px" height="30px" :size="30"></author-img>
<text style="color: #333333;font-weight: 500;font-size: 28upx;margin-left: 22upx;">{{an.sysCreateBy}}</text>
<!-- <author-img :avatar="an.avatar" :sex="an.sex" width="30px" height="30px" :size="30"></author-img>
<text style="color: #333333;font-weight: 500;font-size: 28upx;margin-left: 22upx;">{{an.sysCreateBy}}</text> -->
</view>
<view class="comment-time">
<view>
<view v-if="detailData.isResolve">
<text v-if="an.isBest" style="color:#FFB30F;">最佳答案</text>
</view>
<view class="set-good-an" v-if="userInfo.aid==detailData.sysCreateAid && !detailData.isResolve && an.id && an.clevel==1" @click="setBest()">设置为最佳答案</view>
</view>
</view>
@@ -96,7 +98,7 @@
</view> -->
</view>
<!--一级评论二级数据-->
<!-- <view v-if="an.answers && an.answers.length!=0" class="comment-replys" style="margin-left: 60upx;">
<view v-if="an.answers && an.answers.length!=0" class="comment-replys" style="margin-left: 60upx;">
<view v-for="(ele, replyIndex) in an.answers" :key="replyIndex" class="comment">
<view class="comment-top">
<view style="display: flex;">
@@ -162,7 +164,7 @@
</view>
</view>
</view>
</view> -->
</view>
</view>
</view>
</view>
@@ -230,6 +232,7 @@ import apiUser from '@/api/system/user.js'
import apiPraises from '@/api/modules/praises.js'
import apiMessage from '@/api/system/message.js'
import apiFollow from "@/api/phase2/userfollow.js"
import apiStat from '@/api/phase2/stat.js'
import { mapGetters } from 'vuex';
export default {
data() {
@@ -394,6 +397,20 @@ export default {
}
})
setTimeout(function(){ uni.hideLoading() },100);
let event = {
key: "ReadQuestion",//后台的事件key 发布文章且审核通过
title: "阅读问题",//事件的标题
parameters:"author:"+res.result.sysCreateAid,//用户自定义参数 name:value,name:value
content: '阅读了问题',//事件的内容
objId: id,//关联的id
objType: "4",//关联的类型
objInfo: $this.detailData.title,
aid: $this.userInfo.aid, //当前登录人的id
aname: $this.userInfo.name,//当前人的姓名
status: 1 ,//状态直接写1
source:2,
}
apiStat.sendEvent(event);
}
})
.catch(err => {
@@ -526,6 +543,20 @@ export default {
this.answerList=[]
//console.log("我经过这里面美哟")
this.getAnswerList(this.questionId)
let event = {
key: "AnswerBest",//设置为最佳答案
title: "回答被选为最佳答案",//
parameters:"author:"+this.curItem.sysCreateAid,//内容的作者
content: '回答被选为最佳答案',//事件的内容
objId: this.curItem.id,//关联的id
objType: '5',//关联的类型
objInfo: '设置最佳答案',
aid: this.userInfo.aid, //当前登录人的id
aname: this.userInfo.name,//当前人的姓名
status: 1 ,//状态直接写1
source:2,
}
apiStat.sendEvent(event);
}
})
.catch(err => {
@@ -573,6 +604,20 @@ export default {
this.getAnswerList(this.questionId);
this.answercontent = '';
this.replyShow = false;
let event = {
key: "AnswerQuestion",//后台的事件key
title: "回答问题",//事件的标题
parameters:"",//用户自定义参数 name:value,name:value
content: '回答了问题',//事件的内容
objId: res.result.id,//关联的id
objType: "5",//关联的类型
objInfo: this.detailData.title,
aid: this.userInfo.aid, //当前登录人的id
aname: this.userInfo.name,//当前人的姓名
status: 1 ,//状态直接写1
source:2,
}
apiStat.sendEvent(event);
} else {
uni.showToast({icon: 'none',title:"发布失败"})
}
@@ -589,10 +634,13 @@ export default {
list.forEach(item=>{
res.result.some(author=>{
if(author.aid==item.sysCreateAid){
// if(author.avatar!=''){
// item.avatar=$this.fileUrl+author.avatar;
// }
item.avatar=author.avatar;
// if(item.parentId == "" ) {
// item.avatar= author.avatar;
// } else
if(author.avatar != ''){
item.avatar=this.$config.fileUrl + author.avatar;
}
// item.avatar=author.avatar;
item.sex=author.sex;
item.ucode=author.code;
item.orgInfo=author.orgInfo;
@@ -634,6 +682,20 @@ export default {
this.answerList=[]
$this.$refs.messager.show({message:'删除成功',type:'success'});
$this.getAnswerList($this.questionId);//questionId要移出去
let event = {
key: "DeleteAnswer",//自己删除自己的回答
title: "删除自己的回答",//事件的标题
parameters:"",//用户自定义参数 name:value,name:value
content: '删除了自己问题',//事件的内容
objId: $this.curItem.id,//关联的id
objType: "5",//关联的类型
objInfo: $this.detailData.title,
aid: $this.userInfo.aid, //当前登录人的id
aname: $this.userInfo.name,//当前人的姓名
status: 1 ,//状态直接写1
source:2,
}
apiStat.sendEvent(event);
}else{
$this.$refs.messager.show({message:'删除失败:'+rs.message,type:'error'});
}
@@ -736,6 +798,20 @@ export default {
}
uni.showToast({icon: 'none',title:"回复成功"});
this.replyShow = false;
let event = {
key: "ReplyAnswer",//
title: '回复回答',//
parameters:"",//作者
content: '回复回答',//
objId: this.curItem.id,//关联的id
objType: "5",//关联的类型
objInfo:'',
aid: this.userInfo.aid, //当前登录人的id
aname: this.userInfo.name,//当前人的姓名
status: 1,
source:2,
}
apiStat.sendEvent(event);
}else{
uni.showToast({icon: 'none',title:"回复失败"});
this.replyShow = false;
@@ -951,6 +1027,11 @@ export default {
}
.comment-time{
color: #696969;font-size: 0.9em;
.set-good-an{
color: #387DF7;
background: #F6F6F6;
padding: 0 10upx;
}
}
}
.comment-body{