fans.vue 4.5 KB
Newer Older
喷火的神灵's avatar
喷火的神灵 已提交
1
<template>
喷火的神灵's avatar
喷火的神灵 已提交
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
  <div class="idxs">
    <!--        设置关注和粉丝之间的跳转-->
    <el-menu mode="horizontal" :default-active="activeIndex" @select="handleSelect" active-text-color="orange" router>
      <el-menu-item index="/fans">粉丝</el-menu-item>
      <el-menu-item index="/follow">关注</el-menu-item>
    </el-menu>
    <el-empty description="没有关注" v-if="abc"></el-empty>
    <div v-for="v of number">
      <el-card class="zoom" style="height: 120px;
  width: 800px;
  margin-left: 200px;
  margin-top: 30px;">
        <el-col>
          <el-row :span="8" style="margin-top: 10px">
            <div>
              <el-popover
                  placement="bottom"
                  width="200"
                  trigger="hover"
              >
                <el-row :gutter="10">
                  <el-col :span="12">
                    <span><i class="el-icon-user"></i><span>粉丝数:</span></span>
                    <span>{{ v.fans }}</span>
                  </el-col>
                  <el-col :span="12">
                    <span><i class="el-icon-user"></i><span>关注数:</span></span>
                    <span>{{ v.follow }}</span>
                  </el-col>
                </el-row>
                <div>
                  {{ v.tag }}
                </div>
                <el-avatar slot="reference" style="cursor: pointer" shape="square" :size="60"
                           src="../../../public/logo1.png"></el-avatar>
              </el-popover>
            </div>
          </el-row>
          <el-row :span="8" style="margin-top: -45px;margin-left: 50px">
            <div style="margin-left: 50px;margin-top: 0px"><h3>{{ v.name }}</h3></div>
          </el-row>
          <el-row :span="8" style="margin-left: 650px;margin-top: -30px">
            <el-button :type="v.type ? 'danger' : 'primary'" round @click="toggleFollow($event)" v-model="v.type" :value="v.id">
              {{ v.type ? '取消关注' : '关注' }}</el-button>
          </el-row>
        </el-col>
      </el-card>
喷火的神灵's avatar
喷火的神灵 已提交
49
    </div>
喷火的神灵's avatar
喷火的神灵 已提交
50
  </div>
喷火的神灵's avatar
喷火的神灵 已提交
51 52 53
</template>

<script>
喷火的神灵's avatar
喷火的神灵 已提交
54 55 56
import Handder from "@/components/Handder.vue";
import Sidebar from "@/components/sidebar.vue";

喷火的神灵's avatar
喷火的神灵 已提交
57
export default {
喷火的神灵's avatar
喷火的神灵 已提交
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
  name: "personalCenter",
  components: {Sidebar, Handder},
  data() {
    return {
      activeName: 'first',
      abc: false,
      number: [
        {
          id: 1,
          name: '张三',
          tag: '美好的生活大概就是白天又说有笑晚上睡个好觉',
          type: false,
          fans: 12, follow: 120
        },
        {
          id: 2,
          name: '李四',
          tag: '我够坚强,但不是所有的伤我都能抗',
          type: true,
          fans: 40, follow: 300
        },
        {
          id: 3,
          name: '王五',
          tag: '你的微博辣妹有那么多,原来我只是其中一个',
          type: false,
          fans: 67, follow: 420
        },
        {
          id: 4,
          name: '赵六',
          tag: '姑娘姑娘我就要嫁人啦',
          type: false,
          fans: 80, follow: 720
        },
      ]
    }
  },
  methods: {
    handleClick(tab, event) {
      console.log(tab, event);
喷火的神灵's avatar
喷火的神灵 已提交
99
    },
喷火的神灵's avatar
喷火的神灵 已提交
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
    toggleFollow(event) {
      // 获取点击的按钮对应的用户 id
      let id = event.target.value;
      // 在 number 数组中找到对应的用户对象
      let user = this.number.find(v => v.id == id);
      // 切换用户的关注状态
      user.type = !user.type;
      if (user.type) {
        // 弹出关注成功的框框
        Notification(this.$notify)({
          title: '关注成功',
          offset: 100,
          type: "success"
        });
      } else {
        // 弹出取消关注成功的框框
        Notification(this.$notify)({
          title: '取消关注',
          offset: 100,
          type: "error"
        });
      }
喷火的神灵's avatar
喷火的神灵 已提交
122
    },
喷火的神灵's avatar
喷火的神灵 已提交
123 124
  },
  created() {
喷火的神灵's avatar
喷火的神灵 已提交
125

喷火的神灵's avatar
喷火的神灵 已提交
126
  }
喷火的神灵's avatar
喷火的神灵 已提交
127
}
喷火的神灵's avatar
喷火的神灵 已提交
128

喷火的神灵's avatar
喷火的神灵 已提交
129 130 131
</script>

<style scoped>
喷火的神灵's avatar
喷火的神灵 已提交
132

喷火的神灵's avatar
喷火的神灵 已提交
133 134 135 136 137 138 139
@media screen and (min-width: 1970px) {
  .idxs {
    margin: 60px auto;
    width: calc(100% - 290px);
    max-width: 1570px;
    min-width: 1200px;
  }
喷火的神灵's avatar
喷火的神灵 已提交
140 141
}

喷火的神灵's avatar
喷火的神灵 已提交
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
@media screen and (max-width: 1969px) {
  .idxs {
    /*width: 1270px;*/
    /*min-width: 1000px;*/
    /*margin-top: 60px;*/
    /*margin-left: 270px;*/
    /*padding: 40px;*/
    width: calc(100% - 290px);
    max-width: 1570px;
    min-width: 1200px;
    margin: 60px auto;
  }

  .idxs {
    margin-left: 250px;
  }
喷火的神灵's avatar
喷火的神灵 已提交
158
}
喷火的神灵's avatar
喷火的神灵 已提交
159

喷火的神灵's avatar
喷火的神灵 已提交
160
.el-card:hover {
喷火的神灵's avatar
喷火的神灵 已提交
161 162 163

}

喷火的神灵's avatar
喷火的神灵 已提交
164 165 166 167 168 169 170
.zoom:hover {
  transform: scale(1.1); /* (150% zoom - Note: if the zoom is too large, it will go outside of the viewport) */
}
.zoom {
  transition: transform 0.3s; /* Animation */
}

喷火的神灵's avatar
喷火的神灵 已提交
171
</style>