ActiveDialog.vue 3.0 KB
<template>
  <!-- 活动名称弹窗 -->
  <div>
    <div class="comment_dialog clearfix">
      <el-dialog
        :title="activeList.name"
        :visible="activeVisible"
        :close-on-click-modal="false"
        @update:visible="v=>$emit('update:activeVisible',v)"
      >
        <!-- 评语 -->
        <div class="comment_content clearfix">
          <!-- 活动举办者 -->
          <div class="comment_single clearfix">
            <div class="active_title">活动举办者:</div>
            <div class="active_content">{{activeList.school_name}}</div>
          </div>
          <!-- 活动时间 -->
          <div class="comment_single clearfix">
            <div class="active_title">活动时间:</div>
            <div class="active_content">{{activeList.starttime | date}} —— {{activeList.endtime | date}}</div>
          </div>
          <!-- 活动地点 -->
          <div class="comment_single clearfix">
            <div class="active_title">活动地点:</div>
            <div class="active_content">{{activeList.address}}</div>
          </div>
          <!-- 活动介绍 -->
          <div class="comment_single clearfix">
            <div class="active_title">活动介绍:</div>
            <div class="active_content active_color active_three">{{activeList.description}}</div>
          </div>
          <!-- 活动内容 -->
          <div class="comment_single clearfix top">
            <div class="active_title">活动内容:</div>
            <div class="active_content active_color">{{activeList.content}}</div>
          </div>
          <!-- 备注 -->
          <div class="comment_single clearfix top">
            <div class="active_title">备注:</div>
            <div class="active_content active_color">{{activeList.remark}}</div>
          </div>
          <div
            class="active_btn"
            @click="signUp"
            :class="{signed:sign_btn == 1}"
          >{{sign_btn == 0?'立即报名':'已报名'}}</div>
        </div>
      </el-dialog>
    </div>
  </div>
</template>
<script>
import { post } from "@/api/http";
export default {
  props: ["activeVisible", "activityId"],
  data() {
    return {
      activeList: "",
      sign_btn: 0,
      id: ""
    };
  },
  methods: {
    //   报名
    signUp() {
      let url = "/api/activity/joinActivity";
      let params = {
        id: this.id
      };
      post(url, params)
      .then(res => {
        this.sign_btn = 1;
        this.$parent.getActivityList();
        this.$emit('update:activeVisible',false)
      });
    },
    // 学生活动详情
    getActivityDetail() {
      let url = "/api/activity/getActivityDetail";
      let params = {
        id: this.id
      };
      post(url, params).then(res => {
        this.activeList = res.activity;
      });
    }
  },
  mounted() {
    this.id = this.activityId;
    if (this.id) {
      this.getActivityDetail();
    }
  }
};
</script>
<style scoped>
@import "../../../../style/personal.css";

.top {
  margin-top: 2px;
}
</style>