From ceaa19ab1b836b39cfe3b81d49010369905b9a04 Mon Sep 17 00:00:00 2001 From: daihh Date: Fri, 28 Oct 2022 17:31:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=85=B3=E9=97=AD=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/system/user.js | 7 +++++++ src/store/modules/user.js | 1 + src/views/homepage/Index.vue | 32 ++++++++++++++++++++++++++++++-- src/views/homepage/page.vue | 2 +- src/views/user/Setting.vue | 6 +++--- 5 files changed, 42 insertions(+), 6 deletions(-) diff --git a/src/api/system/user.js b/src/api/system/user.js index 65608edc..6bd48f47 100644 --- a/src/api/system/user.js +++ b/src/api/system/user.js @@ -1,5 +1,11 @@ import ajax from '@/utils/xajax.js' +/**获取home信息*/ +const home=function(aid) { + return ajax.get('/xboe/sys/user/home?aid='+aid); +} + + /** * 分页查询 * @param { @@ -98,6 +104,7 @@ const findSignDynamic=function (id){ } export default{ + home, list, searchLoginName, getByIds, diff --git a/src/store/modules/user.js b/src/store/modules/user.js index e83e6869..f2c10f3b 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -163,6 +163,7 @@ const user = { studyTotalH:studyTotalH, sign:res.result.sign, }; + //console.log(user,'user'); // user.avatar = user.avatar == "" ? require("@/assets/images/user/default.png") : process.env.VUE_APP_FILE_BASE_URL + user.avatar; user.avatar = user.avatar == "" ? "" : process.env.VUE_APP_FILE_BASE_URL + user.avatar; commit('SET_UserInfo', user); diff --git a/src/views/homepage/Index.vue b/src/views/homepage/Index.vue index 21697163..f23e2b0d 100644 --- a/src/views/homepage/Index.vue +++ b/src/views/homepage/Index.vue @@ -3,7 +3,10 @@
-
+
+
此用户已关闭个人主页
+
+
    @@ -42,6 +45,7 @@
+ @@ -64,6 +68,7 @@ data(){ return{ baseUrl:process.env.VUE_APP_FILE_BASE_URL, + showHomeNum:0, self:false, input:'', activeName:'first', @@ -82,7 +87,30 @@ if(!this.pageId){ this.$router.push({path:'/404'}) }else{ - this.init(); + //代表不是自己的主页 + let $this=this; + if(this.pageId!=this.userInfo.aid){ + apiUser.home(this.pageId).then(res=>{ + if(res.status==200){ + if(res.result.showHome){ + $this.showHomeNum=2; + this.init(); + }else{ + $this.showHomeNum=1; + } + }else{ + //如果加载失败,也是显示内容 + this.showHomeNum=2; + this.init(); + } + }) + + }else{ + this.showHomeNum=2; + this.init(); + } + + } }, diff --git a/src/views/homepage/page.vue b/src/views/homepage/page.vue index db92bfd4..089d7cd9 100644 --- a/src/views/homepage/page.vue +++ b/src/views/homepage/page.vue @@ -131,7 +131,7 @@ }, watch:{ '$route' (to, from) { //监听路由是否变化 - + if(to.params.id != from.params.id){ this.pageId = to.params.id; let urlPre=window.location.protocol+'//'+window.location.host; diff --git a/src/views/user/Setting.vue b/src/views/user/Setting.vue index ccc4f2d7..c635e008 100644 --- a/src/views/user/Setting.vue +++ b/src/views/user/Setting.vue @@ -268,9 +268,9 @@ //执行隐藏操作 userApi.updateShowHome(!this.hideHome).then(res=>{ if(res.status == 200) { - this.userInfo.showHome = !this.hideHome; - this.$message.success('修改成功'); - this.$store.dispatch('InitData'); + //this.userInfo.showHome = !this.hideHome; + this.$message.success('修改成功'); + this.$store.dispatch('InitData'); } }) },