<template>
  <div class="notice-editor-wrap" id="screenSet">
    <bread-crumb
      :curmbFirst="curmbFirst"
      :curmbSecond="curmbSecond"
      :curmbThird="curmbThird"
      :jumPathThird="jumPathThird"
    ></bread-crumb>

    <div class="add-content screenSet">
      <el-tabs v-model="activeName" @tab-click="handleClick">
        <el-tab-pane label="发送公告" name="first">
          <SendNotice :formData="noticeInfo.noticeInfo"></SendNotice>
        </el-tab-pane>
        <el-tab-pane label="发送推送" name="second">
          <PushNotice :formData="noticeInfo.pushInfo"></PushNotice>
        </el-tab-pane>
      </el-tabs>
    </div>
  </div>
</template>

<script>
import BreadCrumb from '@/components/breadcrumb.vue'
import SendNotice from '@/components/education/notice/sendNotice'
import PushNotice from '@/components/education/notice/pushNotice'
import { openLoading, closeLoading } from '@/utils/utils'
import * as commonUtil from '@/utils/utils'
let vm = null
export default {
  data() {
    return {
      curmbFirst: '教培项目',
      curmbSecond: '项目管理',
      jumPathThird: 'template-manager',
      curmbThird: '发送通知',
      activeName: 'first',
      noticeInfo: {
        noticeInfo: {
          noticeContent: '',
          noticeId: 0,
          noticeTitle: '',
          openFlag: 0,
          projectId: 0,
        },
        pushInfo: {
          channel: null,
          customPushTime: null,
          noticeContent: '',
          noticeId: 0,
          noticeTitle: '',
          projectId: 0,
          sendScopeType: null,
        },
      },
    }
  },
  components: {
    BreadCrumb,
    SendNotice,
    PushNotice,
  },
  created() {
    vm = this
    console.log('wwwwwwwww')
    vm.projectId = vm.getUrlSearch(window.location.href, 'projectId') || 1476
    // vm.formData.projectId = vm.projectId
    vm.getNoticeInfo2()
  },
  mounted() {
    commonUtil.resizeHeight()
  },
  methods: {
    handleClick(tab) {
      console.log(tab)
    },

    //获取推送信息
    getNoticeInfo2() {
      let req = {
        projectId: vm.projectId,
      }
      openLoading(vm)
      vm.GET('portal/noticeInfo/getNoticeInfo', req).then((res) => {
        closeLoading(vm)
        if (res.code == '000000') {
          vm.noticeInfo = res.data
        }
      })
    },
  },
}
</script>

<style lang="scss" scoped>
.notice-editor-wrap {
  background: #fff;
}
</style>
