fastest-progress.vue 3.34 KB
Newer Older
leiqingsong's avatar
leiqingsong committed
1 2 3
<template>
  <div class="fastest-progress">
    <div class="bg">
leiqingsong's avatar
leiqingsong committed
4
      <van-icon name="arrow-left" @click="handlerBack" />
leiqingsong's avatar
leiqingsong committed
5
      <span class="title">本月进步最大奖励池</span>
xulili's avatar
xulili committed
6
      <span class="award">{{ growthTotal }}</span>
leiqingsong's avatar
leiqingsong committed
7 8 9 10 11
    </div>
    <div class="rank">
      <div class="header rank-flex">
        <span style="flex:1;text-align:center;">排名</span>
        <span style="flex:1"></span>
12
        <span style="flex:2;text-align:center">用户名</span>
leiqingsong's avatar
leiqingsong committed
13 14 15 16 17 18
        <span style="flex:2">本月业绩增长率</span>
        <span style="flex:1;text-align:center">奖金</span>
      </div>
      <div class="rank-flex rank-content">
        <base-refresh-scroll>
          <div slot="content">
leiqingsong's avatar
leiqingsong committed
19
            <rank-item
xulili's avatar
xulili committed
20
              v-for="(item, index) in prizeVos"
leiqingsong's avatar
leiqingsong committed
21 22
              :key="index"
              :rank-index="index + 1"
xulili's avatar
xulili committed
23
              :prizeVos="item"
leiqingsong's avatar
leiqingsong committed
24
            />
leiqingsong's avatar
leiqingsong committed
25 26 27 28 29 30 31 32 33 34
          </div>
        </base-refresh-scroll>
      </div>
    </div>
  </div>
</template>

<script>
import BaseRefreshScroll from "../../components/BaseRefreshScroll.vue";
import RankItem from "./compoments/rankItem.vue";
xulili's avatar
xulili committed
35
import { getProgressPrizes } from "@/api/progressPrizes";
leiqingsong's avatar
leiqingsong committed
36 37 38 39 40
export default {
  name: "FastestProgress",
  components: {
    RankItem,
    BaseRefreshScroll
xulili's avatar
xulili committed
41 42 43 44 45 46 47
  },
  data() {
    return {
      growthTotal: 0,
      prizeVos: []
    };
  },
leiqingsong's avatar
leiqingsong committed
48
  beforeRouteEnter(to, from, next) {
leiqingsong's avatar
leiqingsong committed
49
    console.log("路由前");
leiqingsong's avatar
leiqingsong committed
50
    try {
leiqingsong's avatar
leiqingsong committed
51
      this.$bridgeToAppFun.showBottomBar(false);
leiqingsong's avatar
leiqingsong committed
52
    } catch {
leiqingsong's avatar
leiqingsong committed
53 54
      console.log("无法请求App");
      next();
leiqingsong's avatar
leiqingsong committed
55 56 57 58 59
    }
  },
  beforeRouteLeave(to, form, next) {
    console.log("离开");
    try {
leiqingsong's avatar
leiqingsong committed
60
      this.$bridgeToAppFun.showBottomBar(true);
leiqingsong's avatar
leiqingsong committed
61
    } catch {
leiqingsong's avatar
leiqingsong committed
62
      console.log("未能和App交互");
leiqingsong's avatar
leiqingsong committed
63 64 65
      next();
    }
  },
xulili's avatar
xulili committed
66 67 68 69
  mounted() {
    this.getProgressPrizes();
  },
  methods: {
leiqingsong's avatar
leiqingsong committed
70
    handlerBack() {
leiqingsong's avatar
leiqingsong committed
71
      try {
leiqingsong's avatar
leiqingsong committed
72
        this.$bridgeToAppFun.navigateBack();
leiqingsong's avatar
leiqingsong committed
73
      } catch {
leiqingsong's avatar
leiqingsong committed
74
        console.log("不能和App交互");
leiqingsong's avatar
leiqingsong committed
75 76
        this.$router.go(-1);
      }
leiqingsong's avatar
leiqingsong committed
77
    },
xulili's avatar
xulili committed
78 79 80 81 82 83 84 85 86 87 88 89
    getProgressPrizes() {
      const _this = this;
      getProgressPrizes().then(res => {
        if (res.code === 0) {
          _this.growthTotal = res.data.growthTotal;
          _this.prizeVos = res.data.prizeVos;
        } else {
          _this.growthTotal = 0;
          _this.prizeVos = [];
        }
      });
    }
leiqingsong's avatar
leiqingsong committed
90 91 92 93 94 95 96
  }
};
</script>

<style lang="scss" scoped>
.fastest-progress {
  position: relative;
leiqingsong's avatar
leiqingsong committed
97
  height: 100vh;
leiqingsong's avatar
leiqingsong committed
98 99 100 101 102 103 104 105
}
.bg {
  position: relative;
  height: 178px;
  color: #ffffff;
  background-image: url("../../assets/images/进步奖背景图.png");
  background-size: cover;
  .van-icon {
leiqingsong's avatar
leiqingsong committed
106 107 108 109 110 111 112 113
    position: absolute;
    top: 0;
    bottom: 0;
    width: 52px;
    height: 46px;
    line-height: 46px;
    text-align: center;
    font-size: 16px;
leiqingsong's avatar
leiqingsong committed
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
    color: #ffffff;
  }
  .title {
    position: absolute;
    top: 113px;
    left: 35px;
    font-size: 14px;
  }
  .award {
    position: absolute;
    top: 136px;
    left: 35px;
    font-size: 16px;
  }
}
.rank {
  position: absolute;
  top: 168px;
  box-sizing: border-box;
  width: 100%;
  height: calc(100% - 178px);
leiqingsong's avatar
leiqingsong committed
135
  overflow: hidden;
leiqingsong's avatar
leiqingsong committed
136 137 138 139 140 141 142
  padding: 10px;
  background-color: #ffffff;
  border-radius: 12px;

  .header {
    height: 36px;
    font-size: 13px;
leiqingsong's avatar
leiqingsong committed
143
    font-weight: bold;
leiqingsong's avatar
leiqingsong committed
144 145
    border-bottom: 1px solid #eeeeee;
  }
leiqingsong's avatar
leiqingsong committed
146 147 148 149 150
  .rank-content {
    position: relative;
    height: 100%;
    overflow: hidden;
  }
leiqingsong's avatar
leiqingsong committed
151 152 153 154 155
  .rank-flex {
    display: flex;
  }
}
</style>