From a3e2d496e80dd4f5331978b1ad4805a1714c8df4 Mon Sep 17 00:00:00 2001 From: xiangpei <xiangpei@timesnew.cn> Date: 星期五, 04 七月 2025 10:20:14 +0800 Subject: [PATCH] 我的关注页面 --- pages/mine/myAttention.vue | 132 ++++++++++++++++++++++++++++++++++++++++++++ pages/tabbar/user/my.vue | 2 pages.json | 8 ++ api/user.js | 13 ++++ 4 files changed, 154 insertions(+), 1 deletions(-) diff --git a/api/user.js b/api/user.js index 133f094..4aece02 100644 --- a/api/user.js +++ b/api/user.js @@ -77,3 +77,16 @@ }); } +/** + * 鎴戠殑鍏虫敞鍒嗛〉 + * + * @param params + */ + export function mySubscribePage(params) { + return http.request({ + url: "/lmk/my-subscribe/page", + method: Method.GET, + needToken: true, + params: params + }); +} \ No newline at end of file diff --git a/pages.json b/pages.json index a071262..fb8f8b7 100644 --- a/pages.json +++ b/pages.json @@ -827,6 +827,14 @@ "u-loadmore": "view" } } + }, + { + "path" : "myAttention", + "style" : + { + "navigationBarTitleText" : "鍏虫敞鍒楄〃", + "enablePullDownRefresh": true + } } ] }, diff --git a/pages/mine/myAttention.vue b/pages/mine/myAttention.vue new file mode 100644 index 0000000..fdf1518 --- /dev/null +++ b/pages/mine/myAttention.vue @@ -0,0 +1,132 @@ +<template> + <view class="container"> + + <view class="user-list"> + <view class="user-item" v-for="(user, index) in followList" :key="user.id"> + <image class="avatar" :src="user.subscribeUserAvatar" @click="jumpToHome(user.subscribeUserId)" mode="aspectFill"></image> + <text class="nickname">{{user.subscribeUserNickname}}</text> + <button class="unfollow-btn" @click="handleUnfollow(user.subscribeUserId)">鍙栨秷鍏虫敞</button> + </view> + + <view v-if="followList.length === 0" class="empty-tip"> + <text>鎮ㄨ繕娌℃湁鍏虫敞浠讳綍鐢ㄦ埛</text> + </view> + </view> + </view> +</template> + +<script> + import {mySubscribePage} from "@/api/user.js" + import {unSubscribe} from "@/api/video.js" +export default { + data() { + return { + followList: [], + query: { + pageNumber: 1, + pageSize: 10 + } + } + }, + onPullDownRefresh() { + this.query.pageNumber = 1 + this.getFollowList() + }, + onLoad() { + // 椤甸潰鍔犺浇鏃惰幏鍙栧叧娉ㄥ垪琛� + this.getFollowList(); + }, + methods: { + // 鑾峰彇鍏虫敞鍒楄〃 + getFollowList() { + mySubscribePage(this.query).then(res => { + this.followList = res.data.data + }) + }, + // 鍙栨秷鍏虫敞 + handleUnfollow(userId) { + unSubscribe(userId).then(res => { + this.getFollowList() + }) + }, + // 璺宠浆TA鐨勪富椤� + jumpToHome(authorId) { + uni.navigateTo({ + url: `/pages/video/home-page?authorId=${authorId}` + }) + } + } +} +</script> + +<style lang="scss"> +.container { + padding: 20rpx; + background-color: #f7f7f7; + min-height: 100vh; +} + +.header { + padding: 30rpx 0; + text-align: center; + + .title { + font-size: 36rpx; + font-weight: bold; + color: #333; + } +} + +.user-list { + background-color: #fff; + border-radius: 12rpx; + overflow: hidden; + box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05); + + .user-item { + display: flex; + align-items: center; + padding: 20rpx 30rpx; + border-bottom: 1rpx solid #f0f0f0; + + &:last-child { + border-bottom: none; + } + } + + .avatar { + width: 80rpx; + height: 80rpx; + border-radius: 50%; + margin-right: 20rpx; + } + + .nickname { + flex: 1; + font-size: 32rpx; + color: #333; + } + + .unfollow-btn { + margin: 0; + padding: 0 20rpx; + height: 60rpx; + line-height: 60rpx; + font-size: 26rpx; + color: #666; + background-color: #f5f5f5; + border-radius: 30rpx; + + &::after { + border: none; + } + } + + .empty-tip { + padding: 40rpx 0; + text-align: center; + font-size: 28rpx; + color: #999; + } +} +</style> \ No newline at end of file diff --git a/pages/tabbar/user/my.vue b/pages/tabbar/user/my.vue index 7d94e60..2bbfdd4 100644 --- a/pages/tabbar/user/my.vue +++ b/pages/tabbar/user/my.vue @@ -78,7 +78,7 @@ </view> <view>瑙嗛涓婚〉</view> </view> - <view class="order-item" @click="navigateTo('/pages/mine/myCollect')"> + <view class="order-item" @click="navigateTo('/pages/mine/myAttention')"> <view> <text class="iconfont"></text> </view> -- Gitblit v1.8.0