opencourse.vue 4.1 KB
<template>
  <div class="containerbox">
    <div class="opencoursetop flexone">
      <div class="zhibo flexone" :class="selcourse==1?'courseactive':''" @click="chosecourse(1)">
        <img src="../../../assets/zhibocourse.png" alt class="zhiboimg" v-if="selcourse==1" />
        <img src="../../../assets/zhibogray.png" alt class="zhiboimg" v-else />

        <div class="zhiboname">直播课</div>
      </div>
      <div
        class="zhibo lubo flexone"
        :class="selcourse==2?'courseactive':''"
        :data-id="2"
        @click="chosecourse(2)"
      >
        <img src="../../../assets/lubowhite.png" alt class="zhiboimg" v-if="selcourse==2" />
        <img src="../../../assets/lubo.png" alt class="zhiboimg" v-else />
        <div class="zhiboname">录播课</div>
      </div>
    </div>
    <!-- 直播课程 -->
    <div class="zhibotextbox" v-if="selcourse==1">
      <div class="coursetitle flexone">
        <div class="coursename">开课时间</div>
        <div class="coursenameright" @click="showdate">
          <input type="text" placeholder="开课时间" />
        </div>
      </div>
      <div class="coursetitle flexone">
        <div class="coursename">
          直播标题
          <img src="../../../assets/xuehua.png" alt class="xuehuaimg" />
        </div>
        <div class="coursenameright">
          <input type="text" placeholder="直播标题" />
        </div>
      </div>
      <div class="zhibocontent">
        <div class="flexone zhibojianjie">直播简介</div>
        <div class="zhibotextbox">
          <textarea name id cols="30" rows="10" placeholder="预设内容"></textarea>
        </div>
      </div>
      <div class="coursetitle flexone">
        <div class="coursename">
          直播封面图
          <img src="../../../assets/xuehua.png" alt class="xuehuaimg" />
        </div>
      </div>
      <div class="courseimgbox">
        <img src="../../../assets/addpub.png" alt class="addcourseimg" />
      </div>
    </div>

    <!-- 录播课程 -->

    <div class="zhibotextbox" v-if="selcourse==2">
      <div class="coursetitle flexone">
        <div class="coursename">
          录播时间标题
          <img src="../../../assets/xuehua.png" alt class="xuehuaimg" />
        </div>
        <div class="coursenameright">
          <input type="text" placeholder="录播时间标题" />
        </div>
      </div>

      <div class="coursetitle flexone">
        <div class="coursename">
          录播封面图
          <img src="../../../assets/xuehua.png" alt class="xuehuaimg" />
        </div>
      </div>
      <div class="courseimgbox">
        <img src="../../../assets/addpub.png" alt class="addcourseimg" />
      </div>
    </div>

    <!-- 直播时间 -->
    <div class="register" v-if="zhibodate">
      <van-datetime-picker
        v-model="currentDate"
        type="datetime"
        title="选择完整时间"
        :min-date="minDate"
        :max-date="maxDate"
        @confirm="sure"
        @cancel="cancel"
      />
    </div>

    <!-- 开始录制 -->
    <div class="kaishilu" v-if="selcourse==2">开始录制</div>
    <div class="kaishilu" v-else>开启</div>
  </div>
</template>

<script>
import Vue from 'vue';
import { DatetimePicker } from 'vant';

Vue.use(DatetimePicker);
export default {
  data() {
    return {
      selcourse: 1,
      minDate: new Date(2020, 0, 1),
      maxDate: new Date(2025, 10, 1),
      currentDate: new Date(),
      zhibodate: false
    }
  },
  methods: {
    chosecourse(event) {
      console.log(event)
      this.selcourse = event;
    },
    cancel() {
      this.zhibodate = false
    },

    // 确定选择时间
    sure(e) {
      console.log(e)
      var date = new Date()
      // var hour=date.getHour()

      let year = e.getFullYear();
      var month = e.getMonth() + 1;
      var date = e.getDate();
      var hour = e.getHours()
      var minute = e.getMinutes()
      console.log(hour)
      this.zhibodate = false
      this.zhibodte=year+''
    },
    showdate() {
      this.zhibodate = true
    }
  }

}
</script>

<style scoped>
@import "../../../style/usercenter.css";
</style>