事件添加

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

@@ -1,12 +1,12 @@
<template> <template>
<view class="item-author" style="display: flex;"> <view class="item-author" style="display: flex;">
<view> <view>
<u-avatar shape="circle" v-if="data.avatar && data.avatar!=''" :size="20" :src="data.avatar"></u-avatar> <u-avatar shape="circle" v-if="data.avatar && data.avatar!=''" :size="size" :src="data.avatar"></u-avatar>
<view v-else :size="20" :sex="data.sex" random-bg-color > <view v-else :sex="data.sex" random-bg-color >
<view v-if="data.sex == null" class="peo"></view> <view v-if="data.sex == null" class="peo"></view>
<view v-else> <view v-else>
<view class="peo" v-if="data.sex === 1 "><image src="../../static/images/man.png" alt=""></view> <view :style="{width:width,height:height}" class="peo" v-if="data.sex === 1 "><image src="../../static/images/man.png" alt=""></view>
<view class="peo" v-else><image src="../../static/images/woman.png" alt=""></view> <view :style="{width:width,height:height}" class="peo" v-else><image src="../../static/images/woman.png" alt=""></view>
</view> </view>
</view> </view>
<!-- <u-avatar v-else :size="25" random-bg-color :text="data.name" shape="square"></u-avatar> --> <!-- <u-avatar v-else :size="25" random-bg-color :text="data.name" shape="square"></u-avatar> -->
@@ -36,7 +36,19 @@
showCode:{ showCode:{
type:Boolean, type:Boolean,
default:true default:true
} },
size:{
type:Number,
default:24
},
width:{
type:String,
default:'24px'
},
height:{
type:String,
default:'24px'
},
}, },
data(){ data(){
return { return {
@@ -65,8 +77,10 @@
<style lang="scss" scoped > <style lang="scss" scoped >
.peo{ .peo{
width: 25px; width: 100%;
height: 25px; height: 100%;
// width: 25px;
// height: 25px;
image{ image{
width: 100%; width: 100%;
height: 100%; height: 100%;

View File

@@ -133,6 +133,7 @@
import apiComment from '@/api/modules/comments.js' import apiComment from '@/api/modules/comments.js'
import apiUser from '@/api/system/user.js' import apiUser from '@/api/system/user.js'
import apiShares from '@/api/modules/shares.js' import apiShares from '@/api/modules/shares.js'
import apiStat from '@/api/phase2/stat.js'
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
export default { export default {
props:{ props:{
@@ -375,6 +376,20 @@
this.list[this.curCommentIndex].replyList.push(res.result); this.list[this.curCommentIndex].replyList.push(res.result);
this.$refs.interactToast.show({message:'发布成功',type:'success'}); this.$refs.interactToast.show({message:'发布成功',type:'success'});
this.inputShow=false; this.inputShow=false;
let event = {
key: "ReplyComment",//后台的事件key 发布文章且审核通过
title: "回复评论",//事件的标题
parameters:"",//用户自定义参数 name:value,name:value
content: "每回一个评论",//事件的内容
objId: this.replyInfo.commentId,//关联的id
objType: "81",//关联的类型
objInfo: "回复评论",
aid: this.userInfo.aid, //当前登录人的id
aname: this.userInfo.name,//当前人的姓名
status: 1 ,//状态直接写1
source:2,
}
apiStat.sendEvent(event);
}else{ }else{
this.$refs.interactToast.show({message:'发布失败',type:'error'}); this.$refs.interactToast.show({message:'发布失败',type:'error'});
} }
@@ -545,7 +560,6 @@
this.$refs.interactToast.show({message:'删除回复成功',type:'success'}); this.$refs.interactToast.show({message:'删除回复成功',type:'success'});
this.btnsShow=false; this.btnsShow=false;
}else{ }else{
console.log(res.error);
this.$refs.interactToast.show({message:'删除回复失败',type:'error'}); this.$refs.interactToast.show({message:'删除回复失败',type:'error'});
} }
}); });

View File

@@ -84,7 +84,6 @@
}, },
watch:{ watch:{
data(newVal,oldVal){ data(newVal,oldVal){
console.log(newVal,'newVal')
if(newVal && newVal.id!=''){ if(newVal && newVal.id!=''){
this.checkHas(); this.checkHas();
} }
@@ -303,7 +302,8 @@
objInfo: this.data.title, objInfo: this.data.title,
aid: this.userInfo.aid, //当前登录人的id aid: this.userInfo.aid, //当前登录人的id
aname: this.userInfo.name,//当前人的姓名 aname: this.userInfo.name,//当前人的姓名
status: 1 //状态直接写1 status: 1 ,//状态直接写1
source:2,
} }
apiStat.sendEvent(event); apiStat.sendEvent(event);
// this.$store.dispatch("userTrigger", event); // this.$store.dispatch("userTrigger", event);

View File

@@ -78,6 +78,7 @@
import apiUser from '@/api/system/user.js' import apiUser from '@/api/system/user.js'
import apiCoursePortal from '@/api/modules/coursePortal.js' import apiCoursePortal from '@/api/modules/coursePortal.js'
import apiMessage from '@/api/system/message.js' import apiMessage from '@/api/system/message.js'
import apiStat from '@/api/phase2/stat.js'
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
export default { export default {
props: { props: {
@@ -323,6 +324,20 @@ export default {
this.toUserDig.chooseUserName=''; this.toUserDig.chooseUserName='';
this.inputShow=false; this.inputShow=false;
this.$emit("comment-success", res.result); this.$emit("comment-success", res.result);
let event = {
key: "PublishComment",//后台的事件key 发布文章且审核通过
title: "发表评论",//事件的标题
parameters:"",//用户自定义参数 name:value,name:value
content: "每发表一个评论",//事件的内容
objId: res.result.id,//关联的id
objType: '80',//关联的类型,这里关联的类型应该是评论,不是课程
objInfo: "评论",
aid: this.userInfo.aid, //当前登录人的id
aname: this.userInfo.name,//当前人的姓名
status: 1 ,//状态直接写1
source:2,
}
apiStat.sendEvent(event);
}else{ }else{
this.$refs.interactToast.show({message:'发布失败',type:'error'}); this.$refs.interactToast.show({message:'发布失败',type:'error'});
} }
@@ -359,12 +374,58 @@ export default {
this.isPraise=false; this.isPraise=false;
this.$refs.interactToast.show({message:'取消点赞',type:'success'}); this.$refs.interactToast.show({message:'取消点赞',type:'success'});
this.$emit("praise-success", res.result); this.$emit("praise-success", res.result);
let event = {
key: "CancelPraise",//
title: "取消点赞",//事件的标题
parameters:"author:"+authorId,//用户自定义参数 name:value,name:value
content: "取消点赞"+postData.title,//事件的内容
objId: this.data.id,//关联的id
objType: this.type,//关联的类型
objInfo: this.data.title,
aid: this.userInfo.aid, //当前登录人的id
aname: this.userInfo.name,//当前人的姓名
status: 1 ,//状态直接写1
source:2,
}
apiStat.sendEvent(event);
}else{ }else{
this.$refs.interactToast.show({message:'取消失败',type:'error'}); this.$refs.interactToast.show({message:'取消失败',type:'error'});
} }
}) })
} else { } else {
let contentText = '';
if(this.type==1){
contentText='课程';
// conType = this.data.type;
}
if(this.type==2){
contentText='文章'
}
if(this.type==3){
contentText='案例'
}
if(this.type==4){
contentText='提问'
}
if(this.type==5){
contentText='回答'
}
if(this.type==6){
contentText='课程笔记'
}
if(this.type==60){
contentText='课程笔记评论'
}
// 点赞type
if(this.type==10){
contentText='课程评论'
}
if(this.type==20){
contentText='文章评论'
}
if(this.type==30){
contentText='案例评论'
}
apiPraises.save(postData).then(res=>{ apiPraises.save(postData).then(res=>{
this.loading=false; this.loading=false;
if(res.status==200){ if(res.status==200){
@@ -375,6 +436,20 @@ export default {
this.$refs.interactToast.show({message:'点赞成功',type:'success'}); this.$refs.interactToast.show({message:'点赞成功',type:'success'});
this.messageSave(this.data.id,this.data.title,this.userInfo.name,this.data.sysCreateBy,this.data.sysCreateAid,'点赞了我的'); this.messageSave(this.data.id,this.data.title,this.userInfo.name,this.data.sysCreateBy,this.data.sysCreateAid,'点赞了我的');
this.$emit("praise-success", res.result); this.$emit("praise-success", res.result);
let event = {
key: "Praise",//后台的事件key 发布文章且审核通过
title: "点赞",//事件的标题
parameters:"author:"+this.data.sysCreateAid,//用户自定义参数 name:value,name:value
content: "点赞了"+contentText,//事件的内容
objId: this.data.id,//关联的id
objType: this.type,//关联的类型
objInfo: this.data.title,
aid: this.userInfo.aid, //当前登录人的id
aname: this.userInfo.name,//当前人的姓名
status: 1 ,//状态直接写1
source:2,
}
apiStat.sendEvent(event);
}else{ }else{
this.$refs.interactToast.show({message:'点赞失败',type:'error'}); this.$refs.interactToast.show({message:'点赞失败',type:'error'});
} }

View File

@@ -138,6 +138,7 @@
allClear() { allClear() {
apiMessage.cleanAll().then(res=>{ apiMessage.cleanAll().then(res=>{
if(res.status == 200) { if(res.status == 200) {
this.modalShow = false;
this.$emit('loadMessage'); this.$emit('loadMessage');
} }
}) })

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 class="tabs-text" @click="tabsClick(2)" :class="{'active':active ==2}">回答<text v-show="active ==2" class="active-line"></text></view>
</view> </view>
<view class="my-qa-list" v-show="active ==1"> <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 class="artical-box-top">
<view style="" class="artical-tit"> <view style="" class="artical-tit">
<text class="qa-basic qa-solve" v-if="put.isResolve">已解决</text> <text class="qa-basic qa-solve" v-if="put.isResolve">已解决</text>
@@ -44,7 +44,7 @@
<view class="rowbtn" @click.stop="toEdit(put)"> <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> <image class="btn-img" src="../../static/images/icon/edit.png" size="24"></image><text class="btn-text">编辑</text>
</view> </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> <image class="btn-img" src="../../static/images/icon/del.png" size="24"></image><text class="btn-text">删除</text>
</view> </view>
</view> </view>
@@ -265,7 +265,7 @@
url:'/pages/plus/editQuestion?value='+JSON.stringify(item) url:'/pages/plus/editQuestion?value='+JSON.stringify(item)
}) })
}, },
del(item){ del(item,index){
const $this=this const $this=this
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
@@ -275,8 +275,24 @@
apiQa.del(item.id).then(res=>{ apiQa.del(item.id).then(res=>{
if(res.status=200){ if(res.status=200){
$this.$refs.articleToast.show({message:'删除成功',type:'success'}); $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(()=>{ setTimeout(()=>{
$this.findData(true) // $this.findData(true)
$this.putList.list.splice(index, 1);
},1000) },1000)
}else{ }else{
$this.$refs.articleToast.show({message:'删除失败,请稍后再试',type:'error'}); $this.$refs.articleToast.show({message:'删除失败,请稍后再试',type:'error'});

View File

@@ -32,7 +32,7 @@
<script> <script>
import apiArticle from '@/api/modules/article.js' import apiArticle from '@/api/modules/article.js'
import apiUser from '@/api/system/user.js' import apiUser from '@/api/system/user.js'
import apiStat from '@/api/phase2/stat.js'
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
export default { export default {
data() { data() {
@@ -56,6 +56,32 @@
this.id = options.id; this.id = options.id;
this.getDetail(); 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(){ onReachBottom(){
this.getDetail() this.getDetail()
}, },

View File

@@ -52,15 +52,17 @@
<view v-for="(an, anidx) in answerList" :key="anidx" class="comment"> <view v-for="(an, anidx) in answerList" :key="anidx" class="comment">
<view class="comment-top"> <view class="comment-top">
<view style="display: flex;"> <view style="display: flex;">
<author :showInfo="true" :size="30" width="30px" height="30px" :data="an"></author>
<!-- {{an}} --> <!-- {{an}} -->
<author-img :avatar="an.avatar" :sex="an.sex" width="30px" height="30px" :size="30"></author-img> <!-- <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> <text style="color: #333333;font-weight: 500;font-size: 28upx;margin-left: 22upx;">{{an.sysCreateBy}}</text> -->
</view> </view>
<view class="comment-time"> <view class="comment-time">
<view> <view>
<view v-if="detailData.isResolve"> <view v-if="detailData.isResolve">
<text v-if="an.isBest" style="color:#FFB30F;">最佳答案</text> <text v-if="an.isBest" style="color:#FFB30F;">最佳答案</text>
</view> </view>
<view class="set-good-an" v-if="userInfo.aid==detailData.sysCreateAid && !detailData.isResolve && an.id && an.clevel==1" @click="setBest()">设置为最佳答案</view>
</view> </view>
</view> </view>
@@ -96,7 +98,7 @@
</view> --> </view> -->
</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 v-for="(ele, replyIndex) in an.answers" :key="replyIndex" class="comment">
<view class="comment-top"> <view class="comment-top">
<view style="display: flex;"> <view style="display: flex;">
@@ -162,7 +164,7 @@
</view> </view>
</view> </view>
</view> </view>
</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 apiPraises from '@/api/modules/praises.js'
import apiMessage from '@/api/system/message.js' import apiMessage from '@/api/system/message.js'
import apiFollow from "@/api/phase2/userfollow.js" import apiFollow from "@/api/phase2/userfollow.js"
import apiStat from '@/api/phase2/stat.js'
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
export default { export default {
data() { data() {
@@ -394,6 +397,20 @@ export default {
} }
}) })
setTimeout(function(){ uni.hideLoading() },100); 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 => { .catch(err => {
@@ -526,6 +543,20 @@ export default {
this.answerList=[] this.answerList=[]
//console.log("我经过这里面美哟") //console.log("我经过这里面美哟")
this.getAnswerList(this.questionId) 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 => { .catch(err => {
@@ -573,6 +604,20 @@ export default {
this.getAnswerList(this.questionId); this.getAnswerList(this.questionId);
this.answercontent = ''; this.answercontent = '';
this.replyShow = false; 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 { } else {
uni.showToast({icon: 'none',title:"发布失败"}) uni.showToast({icon: 'none',title:"发布失败"})
} }
@@ -589,10 +634,13 @@ export default {
list.forEach(item=>{ list.forEach(item=>{
res.result.some(author=>{ res.result.some(author=>{
if(author.aid==item.sysCreateAid){ if(author.aid==item.sysCreateAid){
// if(author.avatar!=''){ // if(item.parentId == "" ) {
// item.avatar=$this.fileUrl+author.avatar; // item.avatar= author.avatar;
// } // } else
item.avatar=author.avatar; if(author.avatar != ''){
item.avatar=this.$config.fileUrl + author.avatar;
}
// item.avatar=author.avatar;
item.sex=author.sex; item.sex=author.sex;
item.ucode=author.code; item.ucode=author.code;
item.orgInfo=author.orgInfo; item.orgInfo=author.orgInfo;
@@ -634,6 +682,20 @@ export default {
this.answerList=[] this.answerList=[]
$this.$refs.messager.show({message:'删除成功',type:'success'}); $this.$refs.messager.show({message:'删除成功',type:'success'});
$this.getAnswerList($this.questionId);//questionId要移出去 $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{ }else{
$this.$refs.messager.show({message:'删除失败:'+rs.message,type:'error'}); $this.$refs.messager.show({message:'删除失败:'+rs.message,type:'error'});
} }
@@ -736,6 +798,20 @@ export default {
} }
uni.showToast({icon: 'none',title:"回复成功"}); uni.showToast({icon: 'none',title:"回复成功"});
this.replyShow = false; 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{ }else{
uni.showToast({icon: 'none',title:"回复失败"}); uni.showToast({icon: 'none',title:"回复失败"});
this.replyShow = false; this.replyShow = false;
@@ -951,6 +1027,11 @@ export default {
} }
.comment-time{ .comment-time{
color: #696969;font-size: 0.9em; color: #696969;font-size: 0.9em;
.set-good-an{
color: #387DF7;
background: #F6F6F6;
padding: 0 10upx;
}
} }
} }
.comment-body{ .comment-body{