mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-11 03:46:44 +08:00
添加动态事件
This commit is contained in:
@@ -20,7 +20,7 @@ const baseURL = process.env.VUE_APP_STAT_BASE_API;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
const sendEvent = function(data) {
|
const sendEvent = function(data) {
|
||||||
return ajax.get(baseURL,'/xboe/m/stat/event/send');
|
return ajax.postJson(baseURL,'/xboe/m/stat/event/send',data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -142,8 +142,8 @@ export default {
|
|||||||
// let content= this.addForm.content.replace(/<.*?>/ig,"");
|
// let content= this.addForm.content.replace(/<.*?>/ig,"");
|
||||||
// let content= this.addForm.content.replace(/[^\u4E00-\u9FA5|\d|\a-zA-Z|\r\n\s,.?!,。?!<>…—&$=()-+/*{}[\]]|\r\n\s/g,"");
|
// let content= this.addForm.content.replace(/[^\u4E00-\u9FA5|\d|\a-zA-Z|\r\n\s,.?!,。?!<>…—&$=()-+/*{}[\]]|\r\n\s/g,"");
|
||||||
if(this.addForm.content.trim() == ''){
|
if(this.addForm.content.trim() == ''){
|
||||||
this.$message('您输入的内容为空,无法发布')
|
this.$message.warning('您输入的内容为空,无法发布')
|
||||||
type: 'warning'
|
// type: 'warning'
|
||||||
this.loading=false
|
this.loading=false
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -156,6 +156,19 @@ export default {
|
|||||||
type:'success',
|
type:'success',
|
||||||
message:"发布文章成功"
|
message:"发布文章成功"
|
||||||
});
|
});
|
||||||
|
let event = {
|
||||||
|
key: "PublishArticle",//后台的事件key 发布文章且审核通过
|
||||||
|
title: "首次发表文章(审核通过)",//事件的标题
|
||||||
|
parameters:"",//用户自定义参数 name:value,name:value
|
||||||
|
content: this.addForm.title,//事件的内容
|
||||||
|
objId: this.addForm.id,//关联的id
|
||||||
|
objType: "2",//关联的类型
|
||||||
|
objInfo: "文章",
|
||||||
|
aid: this.userInfo.aid, //当前登录人的id
|
||||||
|
aname: this.userInfo.name,//当前人的姓名
|
||||||
|
status: 1 //状态,直接写1
|
||||||
|
}
|
||||||
|
this.$store.dispatch("userTrigger", event);
|
||||||
}
|
}
|
||||||
if(res.message.indexOf('审核')!=-1){
|
if(res.message.indexOf('审核')!=-1){
|
||||||
this.$message(
|
this.$message(
|
||||||
@@ -164,6 +177,7 @@ export default {
|
|||||||
message:"发布文章失败,因包含敏感词,请等待人工审核"
|
message:"发布文章失败,因包含敏感词,请等待人工审核"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$emit("success",{result:res.result,status: this.addForm.status});
|
this.$emit("success",{result:res.result,status: this.addForm.status});
|
||||||
if(!this.jumpLimit){
|
if(!this.jumpLimit){
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -147,7 +147,6 @@
|
|||||||
autoSaveNote() {
|
autoSaveNote() {
|
||||||
this.autoSave = setInterval(()=>{
|
this.autoSave = setInterval(()=>{
|
||||||
localStorage.setItem("NOTE_TEXT",this.mynoteData.content);
|
localStorage.setItem("NOTE_TEXT",this.mynoteData.content);
|
||||||
console.log("2222222222");
|
|
||||||
},10000);
|
},10000);
|
||||||
},
|
},
|
||||||
noteEdit(note) {
|
noteEdit(note) {
|
||||||
@@ -198,6 +197,20 @@
|
|||||||
if(res.status == 200 ) {
|
if(res.status == 200 ) {
|
||||||
if(!this.mynoteData.id) {
|
if(!this.mynoteData.id) {
|
||||||
this.inAnimation = true;
|
this.inAnimation = true;
|
||||||
|
// 是编辑新增
|
||||||
|
let event = {
|
||||||
|
key: "PublishNote",//后台的事件key
|
||||||
|
title: "发布公开的笔记",//事件的标题
|
||||||
|
parameters:"",//用户自定义参数 name:value,name:value
|
||||||
|
content: "每发布一个公开 的笔记",//事件的内容
|
||||||
|
objId: res.result.id,//关联的id
|
||||||
|
objType: "4",//关联的类型
|
||||||
|
objInfo: "笔记",
|
||||||
|
aid: this.userInfo.aid, //当前登录人的id
|
||||||
|
aname: this.userInfo.name,//当前人的姓名
|
||||||
|
status: 1 //状态,直接写1
|
||||||
|
}
|
||||||
|
this.$store.dispatch("userTrigger", event);
|
||||||
}
|
}
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
localStorage.setItem("NOTE_TEXT",'');
|
localStorage.setItem("NOTE_TEXT",'');
|
||||||
|
|||||||
@@ -42,6 +42,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { mapGetters } from 'vuex';
|
||||||
import apiQa from '@/api/modules/qa.js';
|
import apiQa from '@/api/modules/qa.js';
|
||||||
import imageUpload from '@/components/ImageUpload/index.vue';
|
import imageUpload from '@/components/ImageUpload/index.vue';
|
||||||
import agreement from '@/components/Portal/agreement.vue'
|
import agreement from '@/components/Portal/agreement.vue'
|
||||||
@@ -59,6 +60,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
components:{imageUpload,agreement},
|
components:{imageUpload,agreement},
|
||||||
|
computed: {
|
||||||
|
...mapGetters(['userInfo'])
|
||||||
|
},
|
||||||
methods:{
|
methods:{
|
||||||
handleClose(done) {
|
handleClose(done) {
|
||||||
this.$confirm('确认关闭?')
|
this.$confirm('确认关闭?')
|
||||||
@@ -85,6 +89,20 @@
|
|||||||
if (res.status == 200) {
|
if (res.status == 200) {
|
||||||
if(res.message=='服务处理成功'){
|
if(res.message=='服务处理成功'){
|
||||||
this.$message.success("发布问题成功")
|
this.$message.success("发布问题成功")
|
||||||
|
let event = {
|
||||||
|
key: "PulishQuestion",//后台的事件key 发布文章且审核通过
|
||||||
|
title: "发布问题",//事件的标题
|
||||||
|
parameters:"",//用户自定义参数 name:value,name:value
|
||||||
|
content: "在问答中发布一个问题",//事件的内容
|
||||||
|
objId: res.result.id,//关联的id
|
||||||
|
objType: "4",//关联的类型
|
||||||
|
objInfo: "问答",
|
||||||
|
aid: this.userInfo.aid, //当前登录人的id
|
||||||
|
aname: this.userInfo.name,//当前人的姓名
|
||||||
|
status: 1 //状态,直接写1
|
||||||
|
}
|
||||||
|
this.$store.dispatch("userTrigger", event);
|
||||||
|
|
||||||
}
|
}
|
||||||
if(res.message.indexOf('审核')!=-1){
|
if(res.message.indexOf('审核')!=-1){
|
||||||
this.$message.warning("发布失败,因包含敏感词,请等待人工审核")
|
this.$message.warning("发布失败,因包含敏感词,请等待人工审核")
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import apiMessage from '@/api/system/message.js'
|
|||||||
import apiCourse from "@/api/modules/course.js";
|
import apiCourse from "@/api/modules/course.js";
|
||||||
import apiBoeCourse from "@/api/boe/course.js";
|
import apiBoeCourse from "@/api/boe/course.js";
|
||||||
import apiBoeLogout from "@/api/boe/login.js";
|
import apiBoeLogout from "@/api/boe/login.js";
|
||||||
|
import apiStat from "@/api/phase2/stat.js";
|
||||||
|
|
||||||
const user = {
|
const user = {
|
||||||
state: {
|
state: {
|
||||||
@@ -45,6 +46,13 @@ const user = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
|
// /用户触发事件
|
||||||
|
userTrigger({ commit }, event) {
|
||||||
|
console.log(event,'event');
|
||||||
|
apiStat.sendEvent(event).then(res=>{
|
||||||
|
console.log(res,'userTrigger');
|
||||||
|
})
|
||||||
|
},
|
||||||
SetIntTimeNote({
|
SetIntTimeNote({
|
||||||
commit
|
commit
|
||||||
}, iden) {
|
}, iden) {
|
||||||
|
|||||||
@@ -151,6 +151,7 @@ export default {
|
|||||||
diagSync:false,//控制弹窗
|
diagSync:false,//控制弹窗
|
||||||
isPraise:false,
|
isPraise:false,
|
||||||
isFavorite: false,
|
isFavorite: false,
|
||||||
|
setTime: null
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created(){
|
created(){
|
||||||
@@ -167,9 +168,28 @@ export default {
|
|||||||
this.handleScroll
|
this.handleScroll
|
||||||
);
|
);
|
||||||
this.couresreso();
|
this.couresreso();
|
||||||
|
let event = {
|
||||||
|
key: "ViewArticle",//后台的事件key 发布文章且审核通过
|
||||||
|
title: "阅读文章事件",//事件的标题
|
||||||
|
parameters:"",//用户自定义参数 name:value,name:value
|
||||||
|
content: "记录阅读事件",//事件的内容
|
||||||
|
objId: this.articleId,//关联的id
|
||||||
|
objType: "2",//关联的类型
|
||||||
|
objInfo: "文章",
|
||||||
|
aid: this.userInfo.aid, //当前登录人的id
|
||||||
|
aname: this.userInfo.name,//当前人的姓名
|
||||||
|
status: 1 //状态,直接写1
|
||||||
|
}
|
||||||
|
this.$store.dispatch("userTrigger", event);
|
||||||
|
this.setTime = setTimeout(()=>{
|
||||||
|
event.key = 'ReadArticle';
|
||||||
|
event.title = '阅读文章(大于等于2分钟)';
|
||||||
|
this.$store.dispatch("userTrigger", event);
|
||||||
|
},1000 * 60 *2)
|
||||||
},
|
},
|
||||||
beforeDestroy(){
|
beforeDestroy(){
|
||||||
window.removeEventListener("scroll",this.handleScroll);
|
window.removeEventListener("scroll",this.handleScroll);
|
||||||
|
clearInterval(this.setTime);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
couresreso(){
|
couresreso(){
|
||||||
|
|||||||
@@ -206,6 +206,7 @@ export default {
|
|||||||
domain: [],
|
domain: [],
|
||||||
Profess: [],
|
Profess: [],
|
||||||
orgData: [],
|
orgData: [],
|
||||||
|
setTimeCase: null,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
@@ -228,6 +229,29 @@ export default {
|
|||||||
"scroll",
|
"scroll",
|
||||||
this.handleScroll
|
this.handleScroll
|
||||||
);
|
);
|
||||||
|
let event = {
|
||||||
|
key: "ViewCase",//后台的事件key 发布文章且审核通过
|
||||||
|
title: "阅读案例",//事件的标题
|
||||||
|
parameters:"",//用户自定义参数 name:value,name:value
|
||||||
|
content: "打开案例事",//事件的内容
|
||||||
|
objId: this.resolveId,//关联的id
|
||||||
|
objType: "3",//关联的类型
|
||||||
|
objInfo: "案例",
|
||||||
|
aid: this.userInfo.aid, //当前登录人的id
|
||||||
|
aname: this.userInfo.name,//当前人的姓名
|
||||||
|
status: 1 //状态,直接写1
|
||||||
|
}
|
||||||
|
this.$store.dispatch("userTrigger", event);
|
||||||
|
this.setTimeCase = setTimeout(()=>{
|
||||||
|
event.key = 'ReadCase';
|
||||||
|
event.title = '阅读案例(大于等于3分钟)';
|
||||||
|
event.content = '打开案例详细页面,案例内容加载成功后,停留时间达到3分钟时触发';
|
||||||
|
this.$store.dispatch("userTrigger", event);
|
||||||
|
},1000 * 60 *3)
|
||||||
|
},
|
||||||
|
beforeDestroy(){
|
||||||
|
window.removeEventListener("scroll",this.handleScroll);
|
||||||
|
clearInterval(this.setTimeCase);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
couresreso(){
|
couresreso(){
|
||||||
|
|||||||
@@ -384,6 +384,19 @@ export default {
|
|||||||
window.addEventListener("scroll", this.handleScroll);
|
window.addEventListener("scroll", this.handleScroll);
|
||||||
this.getAnkingData();
|
this.getAnkingData();
|
||||||
this.couresreso();
|
this.couresreso();
|
||||||
|
let event = {
|
||||||
|
key: "ReadQuestion",//后台的事件key 发布文章且审核通过
|
||||||
|
title: "阅读问题",//事件的标题
|
||||||
|
parameters:"",//用户自定义参数 name:value,name:value
|
||||||
|
content: "打开问题页面时触发",//事件的内容
|
||||||
|
objId: this.qid,//关联的id
|
||||||
|
objType: "4",//关联的类型
|
||||||
|
objInfo: "问答",
|
||||||
|
aid: this.userInfo.aid, //当前登录人的id
|
||||||
|
aname: this.userInfo.name,//当前人的姓名
|
||||||
|
status: 1 //状态,直接写1
|
||||||
|
}
|
||||||
|
this.$store.dispatch("userTrigger", event);
|
||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
window.removeEventListener("scroll", this.handleScroll);
|
window.removeEventListener("scroll", this.handleScroll);
|
||||||
@@ -639,6 +652,19 @@ export default {
|
|||||||
this.getQuestionDetail();
|
this.getQuestionDetail();
|
||||||
this.loadAnswer();
|
this.loadAnswer();
|
||||||
this.content = "";
|
this.content = "";
|
||||||
|
let event = {
|
||||||
|
key: "AnswerQuestion",//后台的事件key
|
||||||
|
title: "回答问题",//事件的标题
|
||||||
|
parameters:"",//用户自定义参数 name:value,name:value
|
||||||
|
content: "回答别人提出的问题",//事件的内容
|
||||||
|
objId: this.qid,//关联的id
|
||||||
|
objType: "4",//关联的类型
|
||||||
|
objInfo: "问答",
|
||||||
|
aid: this.userInfo.aid, //当前登录人的id
|
||||||
|
aname: this.userInfo.name,//当前人的姓名
|
||||||
|
status: 1 //状态,直接写1
|
||||||
|
}
|
||||||
|
this.$store.dispatch("userTrigger", event);
|
||||||
} else {
|
} else {
|
||||||
this.$message({ message: res.message, type: "error" });
|
this.$message({ message: res.message, type: "error" });
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user