diff --git a/src/pages/home/detail.vue b/src/pages/home/detail.vue index a9bfe499..4e51f0d2 100644 --- a/src/pages/home/detail.vue +++ b/src/pages/home/detail.vue @@ -173,27 +173,30 @@ import request from '@/common/request'; const userCity = computed(() => sheep.$store('user').userCity); + + const scrollTop = ref(0); + const userDetail = ref({}); + const actionShow = ref(false); const params = reactive({ scene: 'DYNAMIC_RECOMMEND', province: '', city: userCity.value.t, memberId: '', }); - const scrollTop = ref(0); - const userDetail = ref({}); - const actionShow = ref(false); - onLoad((options: any) => { + onLoad(async (options: any) => { const { memberId } = options; if (!memberId) return uni.showToast({ title: '参数错误', icon: 'none' }); params.memberId = memberId; + const { data = null } = await RecentApi.getRecentDetail({ id: memberId }); + userDetail.value = data ?? {}; - const instance: any = getCurrentInstance()?.proxy; - const eventChannel = instance.getOpenerEventChannel(); + // const instance: any = getCurrentInstance()?.proxy; + // const eventChannel = instance.getOpenerEventChannel(); - eventChannel.on('recentDetail', function (user: any) { - userDetail.value = user; - }); + // eventChannel.on('recentDetail', function (user: any) { + // userDetail.value = user; + // }); }); onMounted(() => { @@ -292,6 +295,7 @@ }); }; + // 拉黑 举报 async function actionSelect({ item, index }) { if (index === 0) { await RecentApi.recentOperate({ diff --git a/src/sheep/api/member/recent.ts b/src/sheep/api/member/recent.ts index 6f63b216..784985ae 100644 --- a/src/sheep/api/member/recent.ts +++ b/src/sheep/api/member/recent.ts @@ -58,6 +58,18 @@ const RecentApi = { }, }); }, + // 获取用户详情页 + getRecentDetail: (params: { id: string | number }) => { + return request({ + url: '/member/recent/getById', + method: 'GET', + params, + custom: { + showLoading: true, + loadingMsg: '加载中', + }, + }); + }, // 查看我喜欢 likeIt: (data: any) => { return request({