public.js 1.18 KB
/*
 * @Description: 
 * @Autor: renchao
 * @LastEditTime: 2023-05-17 10:38:51
 */
import { getForm } from "../flowform";
import { getHomeNoticeList } from "@/api/user.js"
export default {
  data () {
    return {
      noticeList: []
    }
  },
  created () {
    this.getHomeNotice()
  },
  mounted () {
    window.addEventListener('message', function (messageEvent) {
      this.getHomeNotice()
    }, false)
  },
  methods: {
    getHomeNotice () {
      getHomeNoticeList().then(res => {
        if (res.result) {
          this.noticeList = res.result.noticeList
        }
      })
    },
    //右侧表单选项卡事件
    beforeLeave (activeName, oldActiveName) {
      if (activeName && activeName != 0) this.getFromRouter(activeName)
    },
    //切换选项卡内容组件
    getFromRouter (tabname) {
      //根据tabname获取选中的表单  此操作为了获取后端返回的表单对象,使用里面的是否可操作的属性
      for (let item of this.tabList) {
        if (item.value === tabname) {
          this.currentSelectTab = item
          break;
        }
      }
      this.componentTag = getForm(tabname, this.$route.query.sqywbm);
      console.log(tabname);
    }
  }
}