ViewModel.vue 5.78 KB
<template>
  <div class="viewClass">
    <div class="sys-container-panel content">
      <div class="container-title">我要报名</div>
      <div class="head-line"></div>
      <div class="edit">
        <div class="btn-edit" @click="formEditHandler">
          <div class="icon-edit"></div>
          <u>信息编辑</u>
        </div>
      </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="label">目前人气值:</div>
          <div class="msg primay">{{formData.praiseNumber}}</div>
        </div>
      </div>

      <div class="text-container space">
        <div class="label">来自城市:</div>
        <div class="msg">{{formData.province}} {{formData.city}}</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 class="privacy">
        <hr />
        <div class="text-container space top">
          <div class="label">家长称呼:</div>
          <div class="msg">{{formData.parentName}}</div>
        </div>
      </div>
    </div>

    <div class="view-btn-group">
      <div class="sys-btn-02" @click="selfPraiseHandler">投自己一票</div>
      <div class="sys-btn-02" @click="showShareHandler">呼叫亲友团</div>
    </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";
import { Icon } from "vant";

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

export default {
  props: ["value"],
  data() {
    return {
      formData: this.value
    };
  },
  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");
      console.log("show share");
    }
  },
  created() {
    console.log("view model === ", this.formData);
  }
};
</script>

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

  .head-line {
    height: 60px;
  }

  .edit {
    width: 630px;
    display: flex;
    justify-content: flex-end;

    .btn-edit {
      width: auto;
      display: flex;
      align-items: center;

      .icon-edit {
        width: 21px;
        height: 26px;
        background: url(../../../assets/imgs/edit-pancel.png) no-repeat;
        background-size: 100%;
      }

      u {
        font-size: 24px;
        color: #5db288;
        position: relative;
        z-index: 1000;
        display: flex;
        align-items: center;
        justify-content: flex-end;
      }
    }
  }

  .swipe {
    width: 630px;
    height: 320px;
    margin: auto;
    margin-top: 15px;
    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;
    }

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

    .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;
      min-width: 120px;
    }
    .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;
  margin-bottom: 100px;

  .sys-btn-02 {
    width: 300px;
    line-height: 90px;
  }
}

.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%;
}
.van-icon-edit {
  font-size: 32px;
}
</style>