From bfbffc1c066c14ad3d369a8278730e38cbda3bf8 Mon Sep 17 00:00:00 2001 From: daihh Date: Sun, 13 Nov 2022 21:14:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/study/courseStudy.vue | 134 ++++++++++++++++++++++++++---------- 1 file changed, 98 insertions(+), 36 deletions(-) diff --git a/pages/study/courseStudy.vue b/pages/study/courseStudy.vue index dc63d87..98c630a 100644 --- a/pages/study/courseStudy.vue +++ b/pages/study/courseStudy.vue @@ -37,7 +37,10 @@ {{tea.teacherName}} ({{tea.orgInfo}}) - +关注 + + 已关注 + +关注 + @@ -74,36 +77,66 @@ - - - - - - - {{con.cataName}} - - - - - {{con.contentName}} - - + + + + + + {{con.contentName}} - 未开始 - 进行中 - 已完成 - --> + + - - - + + + + + + + + + + + + {{con.cataName}} + + + + + {{con.contentName}} + + + + + + + + @@ -129,7 +162,7 @@ - + @@ -230,7 +263,8 @@ import apiVideoStudy from "@/api/modules/videoStudy.js"; import apiCourseGrade from "@/api/modules/courseGrade.js"; import apiCourseFile from "@/api/modules/courseFile.js"; - import apiUser from '@/api/system/user.js' + import apiUser from '@/api/system/user.js'; + import apiUserFollow from '@/api/phase2/userfollow.js' import apiResOwner from '@/api/modules/resowner.js' import apiPraises from "@/api/modules/praises.js"; import apiTrample from "@/api/modules/trample.js"; @@ -393,16 +427,21 @@ let userIds = []; //let ctoUsers = []; rs.result.teachers.forEach(item => { - // item.aid=''; + item.followed=false; item.name= ''; item.orgInfo= ''; item.avatar= ''; item.code= ''; item.sex=null; userIds.push(item.teacherId); - //ctoUsers.push({ aid: item.teacherId, name: item.teacherName }); + //检查是否已关注 + apiUserFollow.has(item.teacherId).then(followRs=>{ + if(followRs.status==200 && followRs.result){ + item.followed=true; + } + }) }); - //this.toUsers = ctoUsers; + $this.loadAuthorInfo(rs.result.teachers, userIds); $this.teachers=rs.result.teachers; } @@ -642,6 +681,30 @@ this.isTrample=true; } }); + + }, + followUser(tea){ + //实现关注处理 + if(tea.followed){ + apiUserFollow.remove(tea.teacherId).then(rs=>{ + if(rs.status==200){ + tea.followed=false; + this.$refs.messager.show({message:'取消关注',type:'success'}); + }else{ + this.$refs.messager.show({message:rs.message,type:'error'}); + } + }) + }else{ + apiUserFollow.save(tea.teacherId).then(rs=>{ + if(rs.status==200){ + tea.followed=true; + this.$refs.messager.show({message:'关注成功',type:'success'}); + }else{ + this.$refs.messager.show({message:rs.message,type:'error'}); + } + }) + } + }, changeTab(idx){ this.tabIndex=idx; @@ -839,7 +902,7 @@ border-bottom: 4upx solid #007DFF; } .tabrow-item{ - margin-right: 20upx; + margin-right: 30upx; line-height: 60upx; text{ padding-bottom: 10upx; @@ -929,7 +992,6 @@ } .scroll-item{ - // height: 125px; margin: 3px; .scroll-item-sec{ height: 20px; @@ -948,7 +1010,7 @@ display:inline-flex; border-radius: 8upx; padding: 20upx; - // height: 60rpx; + min-height: 100upx; // line-height: 60rpx; background-color: #f4f5f7; .scroll-item-name{