个人主页接口对接

This commit is contained in:
zhaofang
2022-09-20 19:53:09 +08:00
parent 44253f06f0
commit b99f54189d
19 changed files with 533 additions and 886 deletions

View File

@@ -20,10 +20,11 @@
<div style="padding-top:10px;">
<p class="ach-title">TA的成就</p>
<ul class="ach-ul">
<li class="ach-box" v-for="ach in 5">
<img src="/images/medal.png" alt="">
<p>跬步千里</p>
<p>LV.1</p>
<li class="ach-box" v-for="ach in medalList" :key="ach.id">
<!-- <img src="/images/medal.png" alt=""> -->
<medal-img style="width:52px;height:58px" :item="ach"></medal-img>
<p>{{ach.medalName}}</p>
<p>LV.{{ach.medalLevel}}</p>
</li>
</ul>
</div>
@@ -47,24 +48,34 @@
<script>
import top from '../../layout/components/TopNav/Index.vue'
import UcHeader from '@/components/HomePage/homePage.vue'
import CaseList from '@/components/HomePage/caseList.vue'
import CourseList from '@/components/HomePage/courseList.vue'
import NoteList from "@/components/HomePage/noteList.vue"
import PutList from "@/components/HomePage/putTo.vue"
import AnswerList from "@/components/HomePage/answerList.vue"
import ArticleList from "@/components/HomePage/articleList.vue"
import FollowList from "@/components/HomePage/followList.vue"
import BookList from "@/components/HomePage/bookList.vue"
import MedalImg from '@/components/Portal/medalImg.vue';
import apiStat from '@/api/phase2/stat.js';
import { mapGetters } from 'vuex';
export default{
components:{top,UcHeader,CaseList,CourseList,NoteList,PutList,AnswerList,ArticleList,FollowList,BookList},
components:{top,UcHeader,MedalImg},
data(){
return{
input:'',
activeName:'first',
pageId:'',
medalList:[]
}
},
mounted() {
console.log(this.$route.query.id);
this.pageId = this.$route.query.id;
this.getMedal();
},
methods:{
getMedal() {
apiStat.userMedal(this.pageId).then(res=>{
if(res.status == 200) {
this.medalList = res.result;
}
})
},
handleClick() {
}
@@ -168,15 +179,29 @@
flex-wrap: wrap;
border-bottom: 1px solid rgba($color: #999999, $alpha: 0.21);
padding-bottom: 4px;
.ach-box{
flex: 33%;
width: 57px;
::v-deep .ach-box{
// flex: 33%;
width: 58px;
// margin: 0 auto;/
text-align: center;
margin-left: 4px;
margin-right: 40px;
margin-bottom: 18px;
img{
width: 52px;
height: 58px;
margin-bottom: 4px;
&:nth-child(3){
margin-right: 0px;
}
.medal-text{
font-size: 12px;
transform: scale(.5);
width: 58px;
}
.medal-icon .medal-level{
top:18%;
left:-6%;
}
.medal-icon .medal-name{
bottom: 3%;
left:-6%;
}
p{
font-size: 14px;

View File

@@ -6,44 +6,56 @@
<i style="color: #333333" class="el-icon-search"></i>
</div>
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane name="first">
<el-tab-pane name="">
<span slot="label"><svg-icon icon-class="home-dynamic" style="font-size: 30px;"></svg-icon> <span class="tabs-info">动态</span></span>
动态
</el-tab-pane>
<el-tab-pane name="second">
<el-tab-pane name="1">
<span slot="label"><svg-icon icon-class="home-course" style="font-size: 30px;"></svg-icon><span class="tabs-info">课程</span></span>
<course-list></course-list>
<course-list :list="cousrePageList"></course-list>
</el-tab-pane>
<el-tab-pane name="case">
<el-tab-pane name="3">
<span slot="label"><svg-icon icon-class="home-case" style="font-size: 30px;"></svg-icon><span class="tabs-info">案例</span></span>
<case-list></case-list>
<case-list :list="casePageList"></case-list>
</el-tab-pane>
<el-tab-pane name="note">
<el-tab-pane name="6">
<span slot="label"><svg-icon icon-class="home-note" style="font-size: 30px;"></svg-icon><span class="tabs-info">笔记</span></span>
<note-list></note-list>
<note-list :list="notePageList"></note-list>
</el-tab-pane>
<el-tab-pane name="qa">
<el-tab-pane name="4">
<span slot="label"><svg-icon icon-class="home-qa" style="font-size: 30px;"></svg-icon><span class="tabs-info">提问</span></span>
<put-list></put-list>
<put-list :list="qaPageList"></put-list>
</el-tab-pane>
<el-tab-pane name="answer">
<el-tab-pane name="5">
<span slot="label"><svg-icon icon-class="home-answer" style="font-size: 30px;"></svg-icon><span class="tabs-info">回答</span></span>
<answer-list></answer-list>
<answer-list :list="answerPageList"></answer-list>
</el-tab-pane>
<el-tab-pane name="article">
<el-tab-pane name="2">
<span slot="label"><svg-icon icon-class="home-article" style="font-size: 30px;"></svg-icon><span class="tabs-info">文章</span></span>
<article-list></article-list>
<article-list :list="articlePageList"></article-list>
</el-tab-pane>
<el-tab-pane name="fourth">
<el-tab-pane name="7">
<span slot="label"><svg-icon icon-class="home-follow" style="font-size: 30px;"></svg-icon><span class="tabs-info">关注</span></span>
<follow-list></follow-list>
</el-tab-pane>
<el-tab-pane name="book">
<el-tab-pane name="8">
<span slot="label"><svg-icon icon-class="home-book" style="font-size: 30px;"></svg-icon><span class="tabs-info">书籍</span></span>
<book-list></book-list>
</el-tab-pane>
</el-tabs>
<div style="width:200px"></div>
<div style="text-align: center; margin-top:57px;" v-show="page.count > 0">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="page.pageIndex"
:page-sizes="[10, 20, 30, 40]"
:page-size="page.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="page.count">
</el-pagination>
</div>
<div style="height:200px"></div>
</div>
</template>
@@ -58,20 +70,270 @@
import ArticleList from "@/components/HomePage/articleList.vue"
import FollowList from "@/components/HomePage/followList.vue"
import BookList from "@/components/HomePage/bookList.vue"
import apiStat from '@/api/phase2/stat.js';
import apiCourse from '@/api/modules/course.js'
import apiArticle from '@/api/modules/article.js'
import apiCases from '@/api/modules/cases.js'
import apiQa from '@/api/modules/qa.js'
import apiNote from '@/api/phase2/note.js'
import { mapGetters } from 'vuex';
import apiUser from "@/api/system/user.js";
import {cutFullName} from "@/utils/tools.js";
export default{
components:{top,UcHeader,CaseList,CourseList,NoteList,PutList,AnswerList,ArticleList,FollowList,BookList},
computed: {
...mapGetters(['userInfo']),
},
data(){
return{
page:{
pageIndex:1,
pageSize:10,
count:0
},
input:'',
activeName:'first',
activeName:'',
pageId:'',
pageList:[],
casePageList:[],
notePageList:[],
articlePageList:[],
qaPageList:[],
answerPageList:[],
cousrePageList:[],
}
},
methods:{
handleClick() {
}
}
mounted() {
this.pageId = this.$route.query.id;
this.getList();
},
methods:{
handleSizeChange(val) {
this.page.pageSize = val;
this.page.pageIndex = 1;
this.getList();
},
handleCurrentChange(val) {
this.page.pageIndex = val;
this.getList();
},
getList() {
let data = {
pageIndex:this.page.pageIndex,
pageSize:this.page.pageSize,
contentType:this.activeName,//内容类型
aid:this.pageId, //指定用户的动态,
hidden:true,//是否隐藏,不指定,查询全部
}
apiStat.userDynamicList(data).then(res=>{
if(res.status == 200) {
this.page.count = res.result.count;
let ids = res.result.list.map(item=>item.contentId);
const noReapetIds = [...new Set(ids)];
res.result.list.forEach(item=>{
item.info = {};
item.authorInfo = {
aid: "",
name: "",
orgInfo: "",
avatar: "",
sex: null
}
item.isAll = false;
})
if(this.activeName == 1){
this.cousrePageList = res.result.list
this.getCourse(noReapetIds,res.result.list);
}
if(this.activeName == 2) {
this.articlePageList = res.result.list;
this.getArticle(noReapetIds,res.result.list);
}
if(this.activeName == 3) {
this.casePageList = res.result.list;
this.getCase(noReapetIds,res.result.list);
}
if(this.activeName == 6) { // 笔记
this.getNote(noReapetIds,res.result.list);
this.notePageList = res.result.list;
}
if(this.activeName == 4) { // 提问
this.qaPageList = res.result.list;
this.getQa(noReapetIds,res.result.list);
}
if(this.activeName == 5) { // 回答
this.answerPageList = res.result.list;
this.getAnswer(ids,res.result.list);
}
}
})
},
getAnswer(ids,list){
if(ids.length == 0){
return
}
apiQa.answerIds(ids).then(res=>{
if(res.status == 200) {
list.forEach((item, index) => {
res.result.some(con => {
if (con.id == item.contentId) {
item.info = con;
return true;
} else {
return false;
}
});
});
}
})
},
getQa(ids,list){
apiQa.ids(ids).then(res=>{
if(res.status == 200) {
list.forEach((item, index) => {
res.result.some(con => {
if (con.id == item.contentId) {
item.info = con;
return true;
} else {
return false;
}
});
});
}
})
},
getNote(ids,list) {
apiNote.ids(ids).then(res=>{
if(res.status == 200) {
list.forEach((item, index) => {
res.result.some(con => {
if (con.id == item.contentId) {
item.info = con;
return true;
} else {
return false;
}
});
});
}
})
},
getCase(ids,list){
apiCases.ids(ids).then(res=>{
if(res.status == 200) {
list.forEach((item, index) => {
res.result.some(con => {
if (con.id == item.contentId) {
item.info = con;
return true;
} else {
return false;
}
});
});
this.getCaseUserData(list);
}
})
},
getCaseUserData(list) {
// let ids = caseList.map((item, index) => {
// return item.info.authorId;
// });
// const noReapetIds = [...new Set(ids)];
let data = list.filter((item, index) => {
return item.info && item.info.authorId != null;
});
let ids = data.map((item, index) => {
return item.info.authorId;
});
const noReapetIds = [...new Set(ids)];
apiUser.getByIds(noReapetIds).then(res => {
if (res.status == 200) {
list.forEach((item, index) => {
res.result.some(author => {
if (author.aid == item.info.authorId) {
item.authorInfo = author;
author.orgInfo=cutFullName(author.orgInfo,1);
return true;
} else {
return false;
}
});
});
} else {
this.$message.error(res.message);
}
});
},
getArticle(ids,list){
apiArticle.ids(ids).then(res=>{
if(res.status == 200) {
list.forEach((item, index) => {
res.result.some(con => {
if (con.id == item.contentId) {
item.info = con;
return true;
} else {
return false;
}
});
});
this.getArticleUserData(list);
}
})
},
getArticleUserData(list) {
let data = list.filter((item, index) => {
return item.info && item.info.sysCreateAid != null;
});
let ids = data.map((item, index) => {
return item.info.sysCreateAid;
});
const noReapetIds = [...new Set(ids)];
apiUser.getByIds(noReapetIds).then(res => {
if (res.status == 200) {
list.forEach((item, index) => {
res.result.some(author => {
if (author.aid == item.info.sysCreateAid) {
item.authorInfo = author;
author.orgInfo=cutFullName(author.orgInfo,1);
return true;
} else {
return false;
}
});
});
} else {
this.$message.error(res.message);
}
});
},
getCourse(ids,list) {
apiCourse.ids(ids).then(res=>{
if(res.status == 200) {
list.forEach((item, index) => {
res.result.some(con => {
if (con.id == item.contentId) {
item.info = con;
return true;
} else {
return false;
}
});
});
// this.getArticleUserData(list);
}
})
},
handleClick() {
this.getList();
}
},
watch:{
},
}
</script>

View File

@@ -172,24 +172,6 @@ export default {
this.handleScroll
);
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(){
window.removeEventListener("scroll",this.handleScroll);
@@ -246,6 +228,24 @@ export default {
this.articleDetailData=res.result;
//if(this.articleDetailData.toString()!='{}'){
this.getAuthorInfo(this.articleDetailData)
let event = {
key: "ViewArticle",//后台的事件key 发布文章且审核通过
title: "阅读文章事件",//事件的标题
parameters:"",//用户自定义参数 name:value,name:value
content: this.articleDetailData.title,//事件的内容
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 = this.articleDetailData.title;
this.$store.dispatch("userTrigger", event);
},1000 * 60 *2)
//}
}else{
this.noData = false;

View File

@@ -232,9 +232,9 @@ export default {
);
let event = {
key: "ViewCase",//后台的事件key 发布文章且审核通过
title: "阅读案例",//事件的标题
title: this.caseDetail.title,//事件的标题
parameters:"",//用户自定义参数 name:value,name:value
content: "打开案例事",//事件的内容
content: this.caseDetail.summary,//事件的内容
objId: this.resolveId,//关联的id
objType: "3",//关联的类型
objInfo: "案例",
@@ -245,8 +245,8 @@ export default {
this.$store.dispatch("userTrigger", event);
this.setTimeCase = setTimeout(()=>{
event.key = 'ReadCase';
event.title = '阅读案例大于等于3分钟';
event.content = '打开案例详细页面案例内容加载成功后停留时间达到3分钟时触发';
event.title = this.caseDetail.title;
event.content = this.caseDetail.summary;
this.$store.dispatch("userTrigger", event);
},1000 * 60 *3)
},

View File

@@ -419,19 +419,6 @@ export default {
window.addEventListener("scroll", this.handleScroll);
this.getAnkingData();
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() {
window.removeEventListener("scroll", this.handleScroll);
@@ -532,6 +519,19 @@ export default {
if (JSON.stringify(this.detailData) != "{}") {
this.getQaUserData(this.detailData);
}
let event = {
key: "ReadQuestion",//后台的事件key 发布文章且审核通过
title: "阅读问题",//事件的标题
parameters:"",//用户自定义参数 name:value,name:value
content: this.detailData.title,//事件的内容
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 {
this.noData = false;
this.$message.error(res.message);
@@ -691,9 +691,9 @@ export default {
key: "AnswerQuestion",//后台的事件key
title: "回答问题",//事件的标题
parameters:"",//用户自定义参数 name:value,name:value
content: "回答别人提出的问题",//事件的内容
objId: this.qid,//关联的id
objType: "4",//关联的类型
content: this.detailData.title,//事件的内容
objId: res.result.id,//关联的id
objType: "5",//关联的类型
objInfo: "问答",
aid: this.userInfo.aid, //当前登录人的id
aname: this.userInfo.name,//当前人的姓名

View File

@@ -394,6 +394,7 @@ export default {
let $this = this;
this.resType = r.contentType;
this.contentData = r;
this.contentData.name = this.courseInfo.name;
this.saveStudyDuration();
if(r.contentType == 10 || r.contentType == 20) {