<template>
  <div id="everyDayStudyNum">
    <!-- 每天节学习数量 -->
    <el-dialog
      :visible.sync="everyDaySetBox"
      width="300px"
      :show-close="false"
      :close-on-click-modal="false"
    >
      <div slot="title" class="hearders">
        <div class="leftTitle">每天学习限制</div>
        <div class="rightBoxs">
          <img
            src="@/assets/images/Close@2x.png"
            alt=""
            @click="everyDaySetBox = false"
          />
        </div>
      </div>
      每天最多学习<el-input
        style="width: 60px; margin: 0px 10px"
        size="mini"
        v-model="everyDaystyleNum"
      />节视频
      <span slot="footer" class="dialog-footer">
        <el-button @click="everyDaySetBox = false">取 消</el-button>
        <el-button type="primary" @click="submitEveryDayStyleNumData"
          >确 定</el-button
        >
      </span>
    </el-dialog>
  </div>
</template>

<script>
export default {
  data() {
    return {
      everyDaySetBox: false,
      everyDaystyleNum: "",
    };
  },
  methods: {
    openBox(num) {
      this.everyDaystyleNum = num;
      this.everyDaySetBox = true
    },
    submitEveryDayStyleNumData() {
      if (this.everyDaystyleNum) {
        var ty = /^([1-9][0-9]*){1,3}$/;
        if (ty.test(this.everyDaystyleNum)) {
          this.$emit("backData", this.everyDaystyleNum);
          this.everyDaySetBox = false;
        } else {
          this.$message.warning("请输入非零正整数");
          return;
        }
      } else {
        this.$emit("backData", "");
        this.everyDaySetBox = false;
      }
    },
  },
};
</script>

<style lang="less" scoped>
</style>
