followList.vue 2.19 KB
<!--
 * @Date: 2022-04-28 18:37:45
 * @LastEditors: hookehuyr hookehuyr@gmail.com
 * @LastEditTime: 2022-06-24 22:23:24
 * @FilePath: /tswj/src/views/me/followList.vue
 * @Description: 文件描述
-->
<template>
  <div class="follow-list-page">
    <template v-for="(item) in followList" :key="item.id">
      <div class="info van-hairline--bottom"
        @click="go('/client/personIndex', { perf_id: item.id, type: 'read-only' })">
        <van-row>
          <van-col>
            <van-image round width="50" height="50" :src="item.avatar ? item.avatar : icon_avatar"
              style="padding-right: 1rem;" />
          </van-col>
          <van-col class="text-wrapper" span="18">
            <div class="user-wrapper">
              <div class="username">{{ item.name }}</div>
              <div class="user-status">已关注</div>
            </div>
            <div class="address">{{ item.kg_name }}</div>
          </van-col>
        </van-row>
      </div>
    </template>
    <van-empty v-if="emptyStatus" class="custom-image" :image="no_image" description="暂无关注" />
  </div>
  <div style="height: 2rem;" />
</template>

<script setup>
import no_image from '@images/que-shuju@2x.png'
import { ref, onMounted } from 'vue'
import icon_avatar from '@images/que-touxiang@2x.png'
import { myFollowAPI } from '@/api/C/me'
import { useGo } from '@/hooks/useGo'

const go = useGo()
const emptyStatus = ref(false);
const followList = ref([])
onMounted(async () => {
  const { code, data } = await myFollowAPI()
  if (code) {
    followList.value = data;
    emptyStatus.value = data.length ? false : true;
  }
});
</script>

<style lang="less" scoped>
.follow-list-page {
  .info {
    padding: 2rem; 
    padding-right: 0;
    .text-wrapper {
      line-height: 1.5;
      .username {
        display: inline-block; 
        overflow: auto; 
        font-size: 1.15rem; 
        color: #222222;
      }
      .user-status {
        float: right;
        font-size: 0.8rem; 
        background-color: white; 
        border-radius: 15px; 
        padding: 5px 10px; 
        color: #999999;
        border: 1px solid #EEEDED;
      }
    }
    .address {
      font-size: 0.85rem; 
      color: #999999;
    }
  }
}
</style>