| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300 |
- <template>
- <view class="content">
- <view class="content-money">
- <view class="money-box">
- <view class="money_name money">
- <image class="top-img" :src="userInfo.ext_info.photo || userInfo.avatar"></image>
- </view>
- <view class="money_name">{{userInfo.ext_info.name}}</view>
- </view>
- <view class="flex buttom-box">
- <view class="buttom">
- <view class="money">{{ userInfo.spread_num || 0}}</view>
- <text class="text">推荐人数(人)</text>
- </view>
- <view class="interval"></view>
- <view class="buttom">
- <view class="money">{{userInfo.brokerage || 0.00}}</view>
- <text class="text">推荐奖励(元)</text>
- </view>
- </view>
- </view>
- <view class="swiper-box">
- <scroll-view scroll-y class="cate-list" @scrolltolower="loadData">
- <view v-for="(item, index) in List" :key="index" class="order-item flex">
- <view class="title-box flex_item">
- <view class="title-avatar"><image :src="item.avatar"></image></view>
- <view class="list_tpl">
- <view class="title flex_item">
- <view class="name">{{ item.nickname }}</view>
- <text class="" v-if="item.type == 1"></text>
- <text class="type-item" v-if="item.type == 2">医生</text>
- <text class="type-item" v-if="item.type == 3">机构</text>
- </view>
- <view class="time">
- <text>{{ item.add_time }}</text>
- </view>
- </view>
- </view>
- </view>
- <uni-load-more :status="loadingType"></uni-load-more>
- </scroll-view>
- </view>
- </view>
- </template>
- <script>
- import { mapState, mapMutations } from 'vuex';
- import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
- import empty from '@/components/empty';
- import {spread_people} from '@/api/recommend.js';
- import { getTime } from '@/utils/rocessor.js';
- export default {
- components: {
- empty,
- uniLoadMore,
- },
- onReady() {
- // 初始化获取页面宽度
- uni.createSelectorQuery()
- .select('.content')
- .fields(
- {
- size: true
- },
- data => {
- // console.log(data);
- // console.log(Math.floor((data.width / 750) * 300));
- // 保存头部高度
- this.maxheight = data.height - Math.floor((data.width / 750) * 570);
- // console.log(this.maxheight);
- }
- )
- .exec();
- },
- data() {
- return {
- // 头部图高度
- List:[],
- limit: 10, //每次加载数据条数
- page: 1, //当前页数
- loadingType: 'more', //加载更多状态
- loading:0
- };
- },
- onShow() {
- this.loadData();
- },
- //下拉刷新
- onPullDownRefresh() {
- this.loadData('refresh');
- },
- computed: {
- ...mapState(['userInfo'])
- },
- methods: {
- async loadData(source) {
- let obj = this;
- if (source != 'refresh') {
- //没有更多数据直接跳出方法
- if (obj.loadingType === 'nomore') {
- return;
- } else {
- // 设置当前为数据载入中
- obj.loadingType = 'loading';
- }
- } else {
- //当重新加载数据时更新状态为可继续添加数据
- obj.loadingType = 'more';
- }
- spread_people({
- page: obj.page,
- limit: obj.limit
- })
- .then(({ data }) => {
- if (source === 'refresh') {
- obj.List = [];
- }
- let arr = data.users_layer_1.map(e => {
- e.add_time = getTime(e.add_time);
- return e;
- });
- obj.List = obj.List.concat(arr);
- //判断是否还有下一页,有是more 没有是nomore
- if (obj.limit == arr.length) {
- obj.page++;
- obj.loadingType = 'more';
- } else {
- obj.loadingType = 'nomore';
- }
- // 判断是否为刷新数据
- if (source == 'refresh') {
- // 判断是否为点击搜索按钮跳转加载
- if (obj.loading == 1) {
- uni.hideLoading();
- } else {
- uni.stopPullDownRefresh();
- }
- }
- })
- .catch(e => {
- obj.loadingType = 'nomore';
- uni.stopPullDownRefresh();
- uni.hideLoading();
- });
- },
- }
- };
- </script>
- <style lang="scss">
- page {
- height: 100%;
- .content{
- height: 100%;
- }
- }
- .content-money {
- padding-bottom: 30rpx;
- background: $page-color-base;
- .buttom-box {
- background-color: #ffffff;
- text-align: center;
- margin: 0 30rpx;
- padding: 30rpx 0;
- border-radius: $border-radius-sm;
- margin-top: -60rpx;
- .buttom {
- font-size: $font-lg;
- flex-grow: 1;
- .money{
- font-weight: bold;
- font-size: 32rpx;
- color: $font-color;
- }
- }
- .text {
- color: #666666;
- }
- .interval {
- width: 2rpx;
- height: 60rpx;
- background-color: #eeeeee;
- }
- .icon {
- height: 50rpx;
- width: 48rpx;
- margin: 0 auto;
- .icon-img {
- width: 100%;
- height: 100%;
- }
- }
- }
- }
- .money-box {
- background:linear-gradient(52deg,rgba(126,153,254,1),rgba(151,143,250,1));
- height: 320rpx;
- color: #ffffff;
- text-align: center;
- padding-top: 50rpx;
- .money_name{
- width: 100%;
- text-align: center;
- font-size: $font-base;
- font-weight: 500;
- .top-img {
- width: 120rpx;
- height: 120rpx;
- border-radius: 50%;
- margin-bottom: 15rpx;
- // border: 2rpx solid #FFFFFF;
- }
- }
- }
- .navbar {
- display: flex;
- height: 40px;
- padding: 0 5px;
- background: #fff;
- box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
- position: relative;
- z-index: 10;
- .nav-item {
- flex: 1;
- display: flex;
- justify-content: center;
- align-items: center;
- height: 100%;
- font-size: 15px;
- color: $font-color-dark;
- position: relative;
- &.current {
- color: $font-color;
- &:after {
- content: '';
- position: absolute;
- left: 50%;
- bottom: 0;
- transform: translateX(-50%);
- width: 44px;
- height: 0;
- border-bottom: 2px solid $font-color;
- }
- }
- }
- }
- // 列表
- .swiper-box {
- background: #FFFFFF;
- height:65%;
- .cate-list{
- height: 100%;
- .order-item {
- margin: 0 24rpx;
- padding: 20rpx 0;
- line-height: 1.5;
- border-bottom: 1px solid #F0F0F0;
- .title-box {
- width: 100%;
- .title-avatar{
- width:80rpx;
- height:80rpx;
- border-radius:50%;
- margin-right: 20rpx;
- image{
- width: 100%;
- height: 100%;
- border-radius: 100%;
- }
- }
- .list_tpl{
- width: 85%;
- .title {
- font-size: $font-base + 2rpx;
- color: $font-color-base;
- font-weight: 500;
- .name{
- max-width: 80%;
- }
- .type-item{
- margin-left: 25rpx;
- background:rgba(103,134,251,0.18);
- color:rgba(103,134,251,1);
- font-size: 24rpx;
- padding: 4rpx 15rpx;
- border-radius: 10rpx;
- }
- }
- .time {
- font-size: 22rpx;
- color: $font-color-light;
- }
- }
- }
- }
- }
- }
- </style>
|