个人主页关注,跳转到指定tab

This commit is contained in:
zhaofang
2022-10-22 11:40:51 +08:00
parent 5d947a555d
commit 0879df5fe2
7 changed files with 22 additions and 20 deletions

View File

@@ -26,7 +26,7 @@
<svg-icon style="margin-right: 10px;font-size:22px;padding-top: 4px;" icon-class="eyes"></svg-icon>隐藏 <svg-icon style="margin-right: 10px;font-size:22px;padding-top: 4px;" icon-class="eyes"></svg-icon>隐藏
</div> </div>
<div class="btn-right"> <div class="btn-right">
<el-button class="btn" type="primary" @click="jumpDetail(item.info)">继续学习</el-button> <el-button class="btn" type="primary" @click="jumpDetail(item.info)">{{pageId == userInfo.aid || isFollow? '继续学习' : '我也去学'}}</el-button>
</div> </div>
</div> </div>
</div> </div>
@@ -43,6 +43,7 @@
<script> <script>
import { toScore} from '@/utils/tools.js'; import { toScore} from '@/utils/tools.js';
import courseImage from "@/components/Course/courseImage.vue"; import courseImage from "@/components/Course/courseImage.vue";
import { mapGetters } from 'vuex'
export default{ export default{
data(){ data(){
return{ return{
@@ -50,6 +51,9 @@
courseList:[] courseList:[]
} }
}, },
computed:{
...mapGetters(['curIdentity','identity','userInfo']),
},
components: { components: {
courseImage, courseImage,
}, },
@@ -71,6 +75,9 @@
default:false, default:false,
} }
}, },
mounted() {
this.pageId = this.$xpage.getHomeId(this.$route);
},
methods:{ methods:{
emitHide(id) { emitHide(id) {
this.$emit('hideIndex',id) this.$emit('hideIndex',id)

View File

@@ -142,6 +142,10 @@ import apiUser from "@/api/system/user.js";
}, },
mounted() { mounted() {
this.pageId = this.$xpage.getHomeId(this.$route); this.pageId = this.$xpage.getHomeId(this.$route);
this.$bus.$on('followIndex',(num)=>{
console.log(num,'num');
this.active = num;
})
}, },
methods:{ methods:{
resetActive(){ resetActive(){

View File

@@ -11,7 +11,6 @@ const getters = {
orgId: state => state.user.orgId, orgId: state => state.user.orgId,
permissions: state => state.user.permissions, permissions: state => state.user.permissions,
identity: state => state.user.identity, identity: state => state.user.identity,
attention: state => state.user.attention,
intTimeNote: state => state.user.intTimeNote, intTimeNote: state => state.user.intTimeNote,
curIdentity: state => state.user.curIdentity, curIdentity: state => state.user.curIdentity,
permission_routes: state => state.permission.routes, permission_routes: state => state.permission.routes,

View File

@@ -17,7 +17,6 @@ const user = {
curIdentity: sessionStorage.getItem("curIdentity") == null ? 1 : sessionStorage.getItem("curIdentity"), // 用户当前选择的身份 1学员 2教师 3管理员 curIdentity: sessionStorage.getItem("curIdentity") == null ? 1 : sessionStorage.getItem("curIdentity"), // 用户当前选择的身份 1学员 2教师 3管理员
permissions: [], permissions: [],
intTimeNote:0, intTimeNote:0,
attention:false,
}, },
mutations: { mutations: {
SET_IntTimeNote: (state, u) => { SET_IntTimeNote: (state, u) => {
@@ -45,15 +44,8 @@ const user = {
SET_PERMISSIONS: (state, permissions) => { SET_PERMISSIONS: (state, permissions) => {
state.permissions = permissions state.permissions = permissions
}, },
SET_Attention: (state, m)=>{
state.attention = m
}
}, },
actions: { actions: {
// /用户触发事件
setAttention({ commit }, iden) {
commit('SET_Attention', iden);
},
// /用户触发事件 // /用户触发事件
userTrigger({ commit }, event) { userTrigger({ commit }, event) {
event.source='page'; event.source='page';

View File

@@ -7,11 +7,11 @@
<router-view /> <router-view />
<div class="home-page-right"> <div class="home-page-right">
<ul class="total-per"> <ul class="total-per">
<li class="per-li pointer" @click="jumpAttention()"> <li class="per-li pointer" @click="jumpAttention(2)">
<span class="per-info">{{follow.passive}}</span> <span class="per-info">{{follow.passive}}</span>
<span class="per-text">关注{{self?'我':'他'}}的人</span> <span class="per-text">关注{{self?'我':'他'}}的人</span>
</li> </li>
<li class="per-li pointer" @click="jumpAttention()"> <li class="per-li pointer" @click="jumpAttention(1)">
<span class="per-info">{{follow.initiative}}</span> <span class="per-info">{{follow.initiative}}</span>
<span class="per-text">{{self?'我':'他'}}关注的人</span> <span class="per-text">{{self?'我':'他'}}关注的人</span>
</li> </li>
@@ -94,8 +94,9 @@
toHome(ava) { toHome(ava) {
this.$router.push({path:this.$xpage.getHomePath(ava.aid)}) this.$router.push({path:this.$xpage.getHomePath(ava.aid)})
}, },
jumpAttention() {// 点击事件跳转关注 jumpAttention(num) {// 点击事件跳转关注
this.$store.dispatch("setAttention", true); // this.$store.dispatch("setAttention", true);
this.$bus.$emit('followIndex',num)
}, },
init(){ init(){
this.getMedal(); this.getMedal();

View File

@@ -93,7 +93,7 @@
export default{ export default{
components:{top,UcHeader,CaseList,CourseList,NoteList,PutList,AnswerList,ArticleList,FollowList,BookList}, components:{top,UcHeader,CaseList,CourseList,NoteList,PutList,AnswerList,ArticleList,FollowList,BookList},
computed: { computed: {
...mapGetters(['userInfo','majorTypeMap','orgDomainMap','attention']), ...mapGetters(['userInfo','majorTypeMap','orgDomainMap']),
}, },
data(){ data(){
return{ return{
@@ -137,12 +137,11 @@
location.href=urlPre+process.env.VUE_APP_PUBLIC_PATH+this.$xpage.getHomePath(this.pageId); location.href=urlPre+process.env.VUE_APP_PUBLIC_PATH+this.$xpage.getHomePath(this.pageId);
} }
}, },
attention(val) {
this.activeName = "7";
},
}, },
mounted() { mounted() {
this.$bus.$on('followIndex',(num)=>{
this.activeName = "7";
})
}, },
methods:{ methods:{
init(){ init(){

View File

@@ -121,7 +121,7 @@
} }
}, },
computed: { computed: {
...mapGetters(['userInfo','majorTypeMap','orgDomainMap','attention']), ...mapGetters(['userInfo','majorTypeMap','orgDomainMap']),
}, },
created() { created() {
apiFollow.list().then(res=>{ apiFollow.list().then(res=>{