123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- <template>
- <view>
- <mescroll-body top="40" bottom="40" @init="mescrollInit" @down="downCallback" @up="upCallback" :option="{}">
- <view class="fans-list">
- <view class="fans-item" v-for="(item,index) in list" :key="item.id">
- <image class="fans-avatar" :src="item.fansUserPortrait" mode="">
- </image>
- <view class="fans-content">
- <view class="fans-name">{{item.fansUserName}}</view>
- <view class="fans-organization">{{item.date}}</view>
- </view>
- <view class="fans-icon"
- @click="$navigateTo('/pages/chat/chat?userId='+item.fansUserId+'&userName='+item.fansUserName)">
- <uni-icons type="chat-filled" color="#fff" size="22"></uni-icons>
- </view>
- </view>
- </view>
- </mescroll-body>
- </view>
- </template>
- <script>
- import {
- getFansListByPage
- } from '@/request/api/my.js'
- import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
- export default {
- mixins: [MescrollMixin], // 使用mixin
- data() {
- return {
- list: []
- }
- },
- methods: {
- /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
- upCallback(page) {
- getFansListByPage(page.num, 10).then(res => {
- if (res.code === 200) {
- this.mescroll.endBySize(res.data.dataList.length, res.data.totalCount);
- if (page.num == 1) this.list = []; //如果是第一页需手动制空列表
- let data = res.data.dataList;
- this.list = this.list.concat(data); //追加新数据
- } else {
- this.mescroll.endErr();
- }
- }).catch(() => {
- //联网失败, 结束加载
- this.mescroll.endErr();
- })
- },
- }
- }
- </script>
- <style lang="scss">
- .fans-list {
- padding: 0 30rpx;
- box-sizing: border-box;
- .fans-item {
- height: 140rpx;
- background-color: #ffffff;
- border-radius: 8px;
- box-shadow: 0px 1px 12px rgba(3, 3, 3, 0.08);
- display: flex;
- align-items: center;
- padding: 0 30rpx;
- }
- .fans-avatar {
- width: 100rpx;
- height: 100rpx;
- border-radius: 100rpx;
- }
- .fans-content {
- flex: 1;
- width: 0;
- margin-left: 20rpx;
- }
- .fans-name {
- font-size: 32rpx;
- }
- .fans-organization {
- color: $uni-secondary-color;
- font-weight: 300;
- margin-top: 4rpx;
- font-size: 24rpx;
- }
- .fans-icon {
- width: 80rpx;
- height: 80rpx;
- border-radius: 50%;
- background: $uni-primary;
- text-align: center;
- line-height: 80rpx;
- }
- }
- </style>
|