mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-mobile.git
synced 2025-12-06 09:26:45 +08:00
事件添加
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
<template>
|
||||
<view class="item-author" style="display: flex;">
|
||||
<view>
|
||||
<u-avatar shape="circle" v-if="data.avatar && data.avatar!=''" :size="20" :src="data.avatar"></u-avatar>
|
||||
<view v-else :size="20" :sex="data.sex" random-bg-color >
|
||||
<u-avatar shape="circle" v-if="data.avatar && data.avatar!=''" :size="size" :src="data.avatar"></u-avatar>
|
||||
<view v-else :sex="data.sex" random-bg-color >
|
||||
<view v-if="data.sex == null" class="peo"></view>
|
||||
<view v-else>
|
||||
<view 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-if="data.sex === 1 "><image src="../../static/images/man.png" alt=""></view>
|
||||
<view :style="{width:width,height:height}" class="peo" v-else><image src="../../static/images/woman.png" alt=""></view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <u-avatar v-else :size="25" random-bg-color :text="data.name" shape="square"></u-avatar> -->
|
||||
@@ -36,7 +36,19 @@
|
||||
showCode:{
|
||||
type:Boolean,
|
||||
default:true
|
||||
}
|
||||
},
|
||||
size:{
|
||||
type:Number,
|
||||
default:24
|
||||
},
|
||||
width:{
|
||||
type:String,
|
||||
default:'24px'
|
||||
},
|
||||
height:{
|
||||
type:String,
|
||||
default:'24px'
|
||||
},
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
@@ -65,8 +77,10 @@
|
||||
|
||||
<style lang="scss" scoped >
|
||||
.peo{
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
// width: 25px;
|
||||
// height: 25px;
|
||||
image{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
@@ -133,6 +133,7 @@
|
||||
import apiComment from '@/api/modules/comments.js'
|
||||
import apiUser from '@/api/system/user.js'
|
||||
import apiShares from '@/api/modules/shares.js'
|
||||
import apiStat from '@/api/phase2/stat.js'
|
||||
import { mapGetters } from 'vuex';
|
||||
export default {
|
||||
props:{
|
||||
@@ -375,6 +376,20 @@
|
||||
this.list[this.curCommentIndex].replyList.push(res.result);
|
||||
this.$refs.interactToast.show({message:'发布成功',type:'success'});
|
||||
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{
|
||||
this.$refs.interactToast.show({message:'发布失败',type:'error'});
|
||||
}
|
||||
@@ -545,7 +560,6 @@
|
||||
this.$refs.interactToast.show({message:'删除回复成功',type:'success'});
|
||||
this.btnsShow=false;
|
||||
}else{
|
||||
console.log(res.error);
|
||||
this.$refs.interactToast.show({message:'删除回复失败',type:'error'});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -84,7 +84,6 @@
|
||||
},
|
||||
watch:{
|
||||
data(newVal,oldVal){
|
||||
console.log(newVal,'newVal')
|
||||
if(newVal && newVal.id!=''){
|
||||
this.checkHas();
|
||||
}
|
||||
@@ -303,7 +302,8 @@
|
||||
objInfo: this.data.title,
|
||||
aid: this.userInfo.aid, //当前登录人的id
|
||||
aname: this.userInfo.name,//当前人的姓名
|
||||
status: 1 //状态,直接写1
|
||||
status: 1 ,//状态,直接写1
|
||||
source:2,
|
||||
}
|
||||
apiStat.sendEvent(event);
|
||||
// this.$store.dispatch("userTrigger", event);
|
||||
|
||||
@@ -78,6 +78,7 @@
|
||||
import apiUser from '@/api/system/user.js'
|
||||
import apiCoursePortal from '@/api/modules/coursePortal.js'
|
||||
import apiMessage from '@/api/system/message.js'
|
||||
import apiStat from '@/api/phase2/stat.js'
|
||||
import { mapGetters } from 'vuex';
|
||||
export default {
|
||||
props: {
|
||||
@@ -323,6 +324,20 @@ export default {
|
||||
this.toUserDig.chooseUserName='';
|
||||
this.inputShow=false;
|
||||
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{
|
||||
this.$refs.interactToast.show({message:'发布失败',type:'error'});
|
||||
}
|
||||
@@ -359,12 +374,58 @@ export default {
|
||||
this.isPraise=false;
|
||||
this.$refs.interactToast.show({message:'取消点赞',type:'success'});
|
||||
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{
|
||||
this.$refs.interactToast.show({message:'取消失败',type:'error'});
|
||||
}
|
||||
})
|
||||
} 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=>{
|
||||
this.loading=false;
|
||||
if(res.status==200){
|
||||
@@ -375,6 +436,20 @@ export default {
|
||||
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.$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{
|
||||
this.$refs.interactToast.show({message:'点赞失败',type:'error'});
|
||||
}
|
||||
|
||||
@@ -138,6 +138,7 @@
|
||||
allClear() {
|
||||
apiMessage.cleanAll().then(res=>{
|
||||
if(res.status == 200) {
|
||||
this.modalShow = false;
|
||||
this.$emit('loadMessage');
|
||||
}
|
||||
})
|
||||
|
||||
@@ -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'});
|
||||
|
||||
@@ -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()
|
||||
},
|
||||
|
||||
@@ -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{
|
||||
|
||||
Reference in New Issue
Block a user