MemberWorksView.vue 6.59 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">
        <div>小选手:{{formData.name}}</div>
      </div>
      <div class="head-line"></div>
      <div class="swipe">
        <van-swipe :autoplay="5000">
          <van-swipe-item v-for="(item, index) in formData.worksList" :key="index">
            <!-- <img :src="works.worksUrl" /> -->
            <div
              v-if="item.worksType=='pic'"
              class="img"
              v-bind:style="{backgroundImage:'url(' + item.worksUrl + ')'}"
            ></div>
            <video v-if="item.worksType=='video'" controls>
              <source :src="item.worksUrl" type="video/mp4" />
            </video>
          </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 class="text-container space top">
        <div class="label">个人简介:</div>
        <div class="msg">{{formData.profile}}</div>
      </div>
    </div>

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

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

    <div class="bottom-line"></div>

    <biz-model v-model="model"></biz-model>
  </div>
</template>

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

import { request, httpGet } from "@/api/fetch-api";
import BizModel from "@/components/biz-model/biz-model";

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,
      model: {
        show: false,
        title: "",
        content: "",
        index: "subcribe",
        btnShow: false,
        btnText: "",
        confirmHandler: null,
        labelBtnShow: false,
        labelBtnText: "",
        labelBtnHandler: null
      }
    };
  },
  methods: {
    praiseHandler() {
      Toast.loading({
        mask: true,
        message: "请稍等..."
      });
      httpGet({ url: urls.index }).then(res => {
        if (res.isSubcribe == 1) {
          let data = {
            worksCode: this.formData.worksCode
          };
          request.post(urls.praise, data).then(res => {
            Toast.clear();
            this.$emit("praiseSuccess");
          });
        } else {
          Toast.clear();
          httpGet({
            url: urls.cache,
            data: { worksCode: this.formData.worksCode }
          }).then(res => {});
          this.model.show = true;
        }
      });
    },
    showShareHandler() {
      // 出现分享层
      this.$emit("showShare");
    },
    backHandler() {
      this.$emit("back");
    }
  },
  components: {
    BizModel
  }
};
</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: 320px;
    margin: auto;
    border: 2px solid #82acae;
    border-radius: 30px;
    overflow: hidden;

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

    video {
      height: 320px;
      width: 630px;
    }
  }

  .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 div {
  width: 350px;
  margin: auto;
  font-size: 28px;
  font-weight: bold;
  text-overflow: ellipsis;
  overflow: hidden;
}

.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: center;
  font-size: 24px;
  color: #303531;
  margin: auto;
  margin-top: 18px;
}

.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: 100;
}

.bottom-line {
  height: 100px;
}
</style>