MemberWorksView.vue 5.32 KB
<template>
  <div class="viewClass" v-if="formData">
    <div class="btn-back" @click="backHandler"></div>
    <div class="sys-container-panel content">
      <div class="container-title">小选手:{{formData.name}}</div>
      <div class="head-line"></div>
      <div class="swipe">
        <van-swipe :autoplay="5000">
          <van-swipe-item v-for="(works, index) in formData.worksList" :key="index">
            <!-- <img :src="works.worksUrl" /> -->
            <div class="img" v-bind:style="{backgroundImage:'url(' + works.worksUrl + ')'}"></div>
          </van-swipe-item>
        </van-swipe>
      </div>
      <div class="text-container space">
        <div class="text-container inline">
          <div class="label">参数编号:</div>
          <div class="msg">{{formData.worksNo}}</div>
        </div>

        <div class="text-container inline right">
          <div class="width-label label">目前人气值:</div>
          <div class="msg primay">{{formData.praiseNumber}}</div>
        </div>
      </div>

      <div class="text-container space">
        <div class="text-container inline">
          <div class="label">来自城市:</div>
          <div class="msg">{{formData.province}} {{formData.city}}</div>
        </div>

        <div class="text-container inline right">
          <div class="label">目前排名:</div>
          <div class="msg primay">{{formData.rank}}</div>
        </div>
      </div>

      <div class="text-container space top">
        <div class="label">竞赛宣言:</div>
        <div class="msg">{{formData.slogan}}</div>
      </div>
    </div>

    <div class="view-btn-group">
      <div class="sys-btn-02" @click="selfPraiseHandler">投TA一票</div>
      <div class="sys-btn-02" @click="showShareHandler">呼叫亲友团</div>
    </div>

    <div class="btn-tips">*每用户每天仅能投票一次</div>
  </div>
</template>

<script>
let urls = {
  praise: "/jiajiaCHApi/app/works/praise"
};

import { request } from "@/api/fetch-api";

import Vue from "vue";
import { Toast } from "vant";
import { Swipe, SwipeItem } from "vant";

Vue.use(Swipe).use(SwipeItem);
Vue.use(Toast);

export default {
  props: ["value"],
  data() {
    return {
      formData: this.value.data,
      isMy: this.value.isMy
    };
  },
  methods: {
    formEditHandler() {
      this.$emit("edit");
    },
    selfPraiseHandler() {
      // 自己点赞
      let data = {
        worksCode: this.formData.worksCode
      };
      Toast.loading({
        mask: true,
        message: "数据提交..."
      });
      request
        .post(urls.praise, data)
        .then(res => {
          Toast.clear();
          this.$emit("praiseSuccess");
        })
        .catch(res => {
          let msg = res.data.errMsg;
          Toast(msg);
        });
    },
    showShareHandler() {
      // 出现分享层
      this.$emit("showShare");
    },
    backHandler() {
      this.$emit("back");
    }
  }
};
</script>

<style lang="scss" scoped>
.content {
  margin: 85px auto 60px auto;
  padding-bottom: 60px;

  .head-line {
    height: 60px;
  }

  .edit {
    width: 630px;
    text-align: right;
    u {
      font-size: 24px;
      color: #5db288;
      position: relative;
      z-index: 1000;
    }
  }

  .swipe {
    width: 630px;
    height: 451px;
    margin: auto;
    border: 2px solid #82acae;
    border-radius: 30px;
    overflow: hidden;

    .img {
      height: 451px;
      width: 630px;
      background-size: cover;
    }
  }

  .space {
    margin-top: 20px !important;
  }
  .top {
    display: flex;
    align-items: flex-start !important;
  }

  .inline-group-width {
    width: 500px;
  }

  .inline-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .text-container {
    display: flex;
    align-items: center;
    width: 620px;
    margin: auto;

    .inline {
      width: 315px !important;

      .label {
        width: 130px;
      }

      .width-label {
        width: 170px !important;
      }
      .msg {
        width: 185px;
      }
    }

    .inline-02 {
      width: 180px !important;
      padding: 0 30px;
      .label {
        font-size: 22px;
      }
    }

    .right {
      justify-content: flex-end !important;
    }

    .label {
      min-width: 128px;
      font-size: 24px;
      text-align: left;
    }
    .msg {
      color: #303531;
      font-size: 24px;
      text-align: left;
    }
    .primay {
      font-size: 32px !important;
      font-weight: 600;
      color: #ff9e30;
    }
  }

  .privacy {
    width: 630px;
    margin: auto;
    hr {
      border-top: 3px dashed #d4d1c5;
      margin: 60px auto;
    }
  }
}

.view-btn-group {
  display: flex;
  width: 730px;
  margin: auto;
  justify-content: space-between;
  .sys-btn-02 {
    width: 340px;
    line-height: 80px;
    height: 90px;
    background-size: 340px 90px;
  }
}

.container-title {
  font-size: 28px;
}

.auto-register-tips {
  width: 700px;
  margin: auto;
}

.icon-draw-down {
  width: 30px;
  height: 18px;
  background: url(../../../assets/imgs/draw-down.png) no-repeat;
  background-size: 100%;
}

.btn-tips {
  width: 640px;
  text-align: left;
  font-size: 24px;
  color: #303531;
  margin: auto;
}

.btn-back {
  width: 170px;
  height: 52px;
  background: url(../../../assets/imgs/list-btn-back.png);
  background-size: 100%;
  position: fixed;
  left: 0;
  top: 30px;
  z-index: 8000;
}
</style>