<template>
  <div class="navbar">
    <div class="pageTitle">{{ this.$route.meta.title }}</div>
    <!--收缩左侧菜单按钮-->
    <!-- <hamburger id="hamburger-container" :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" />
    <hamburger id="hamburger-container" :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" /> -->
    <!-- <breadcrumb id="breadcrumb-container" class="breadcrumb-container" /> -->
    <div class="right-menu">
      <!--搜索，全屏，大小写转换和翻译-->
      <!-- <template v-if="device!=='mobile'">
        <search id="header-search" class="right-menu-item" />
        <error-log class="errLog-container right-menu-item hover-effect" />
        <screenfull id="screenfull" class="right-menu-item hover-effect" />
        <el-tooltip :content="$t('navbar.size')" effect="dark" placement="bottom">
          <size-select id="size-select" class="right-menu-item hover-effect" />
        </el-tooltip>
        <lang-select class="right-menu-item hover-effect" />
      </template> -->
      <div class="noticeIconBox">
        <img src="@/assets/public/nav/notice1.png" class="noticeIconImg" @click="showTabs = !showTabs" />
        <span class="unreadCount">{{ msg.count }}</span>
        <!-- <img src="@/assets/public/nav/arrowDown.png" class="arrowDown" /> -->

        <div class="noticeTabsBox" v-if="showTabs" ref="noticeTabsBox">
          <div class="noticeTabsTitleBox">
            <img class="arrowLeft" src="@/assets/chat/left.png" @click="pages <= 1 ? pages = 1 : pages--"
              v-if="pages == 2">
            <div class="box1" v-show="pages == 1">
              <div :class="{ 'noticeTabs': true, 'active': tabsIndex == 1 }" @click="changeTabs(1)">
                <div class="noticeTabsItem">
                  资讯
                  <span class="noticeMessageNew" v-if="msg.apply_articale.length > 0"></span>
                </div>
              </div>
              <div :class="{ 'noticeTabs': true, 'active': tabsIndex == 2 }" @click="changeTabs(2)">
                <div class="noticeTabsItem">
                  商品
                  <span class="noticeMessageNew" v-if="msg.good.length > 0"></span>
                </div>
              </div>
              <div :class="{ 'noticeTabs': true, 'active': tabsIndex == 4 }" @click="changeTabs(4)">
                <div class="noticeTabsItem">
                  书刊
                  <span class="noticeMessageNew" v-if="msg.book.length > 0"></span>
                </div>
              </div>
              <!-- <div :class="{ 'noticeTabs': true, 'active': tabsIndex == 5 }" @click="changeTabs(5)">
                <div class="noticeTabsItem">
                  聊天
                  <span class="noticeMessageNew" v-if="msg.chat.length > 0"></span>
                </div>
              </div> -->
              <div :class="{ 'noticeTabs': true, 'active': tabsIndex == 8 }" @click="changeTabs(8)">
                <div class="noticeTabsItem">
                  企业
                  <span class="noticeMessageNew" v-if="msg.complany.length > 0"></span>
                </div>
              </div>
              <div :class="{ 'noticeTabs': true, 'active': tabsIndex == 9 }" @click="changeTabs(9)">
                <div class="noticeTabsItem">
                  项目
                  <span class="noticeMessageNew" v-if="msg.project.length > 0"></span>
                </div>
              </div>
            </div>
            <div class="box2" v-show="pages == 2">
              <div :class="{ 'noticeTabs': true, 'active': tabsIndex == 3 }" @click="changeTabs(3)"
                v-if="userType == 10000 || userType == 1 || userType == 3">
                <div class="noticeTabsItem">
                  求职招聘
                  <span class="noticeMessageNew"
                    v-if="msg.job_hunting.length > 0 || msg.job_recruiting.length > 0 || msg.job_apply.length > 0 || msg.job_resume.length > 0">
                  </span>
                </div>
              </div>
              <div :class="{ 'noticeTabs': true, 'active': tabsIndex == 6 }" @click="changeTabs(6)"
                v-if="userType == 10000 || userType == 2">
                <div class="noticeTabsItem">
                  通知
                  <span class="noticeMessageNew" v-if="msg.notice.length > 0"></span>
                </div>
              </div>
              <div :class="{ 'noticeTabs': true, 'active': tabsIndex == 7 }" @click="changeTabs(7)"
                v-if="userType == 10000 || userType == 2">
                <div class="noticeTabsItem">
                  投诉
                  <span class="noticeMessageNew"
                    v-if="msg.complaint.length > 0 || msg.complaint_deal.length > 0"></span>
                </div>
              </div>
            </div>
            <img class="arrowRight" src="@/assets/chat/right.png" @click="pages >= 2 ? pages = 2 : pages++"
              v-if="pages == 1 && userType != 4">
          </div>
          <!-- 求职,招聘切换按钮 -->
          <div class="noticeTabsLine" v-if="tabsIndex == 3" style="height: 20px; margin: 0px; margin-top: -20px;">
            <ul class="noticeTabsLink">
              <li v-if="userType == 1">
                求职
              </li>
              <li v-if="userType == 3">
                招聘
              </li>
            </ul>
            <ul class="noticeTabsLink" v-if="userType == 10000">
              <li v-if="qiu" @click="changeJob(1)">
                求职
                <img src="@/assets/public/nav/arrowDown.png" class="arrowDown" />
              </li>
              <li v-if="zhao" @click="changeJob(2)">
                招聘
                <img src="@/assets/public/nav/arrowDown.png" class="arrowDown" />
              </li>
            </ul>
          </div>

          <div class="noticeTabsLinkLine">
            <div v-if="userType == 10000">
              <div v-if="tabsIndex == 1" @click="goToPath(1, 0)">待审核列表</div>
              <div v-if="tabsIndex == 2" @click="goToPath(2, 0)">待审核列表</div>
              <div class="qiuFlex" v-if="tabsIndex == 3 && qiu == true && userType == 10000" @click="goToPath(3, 0)">
                <span :class="{ 'qiuPillow': true, 'qiuPillowHover': qiu1 == true }" @mouseover="handleQiu(1)"
                  @click="goToPath(3.1, 0)">待审核列表</span>
                <span :class="{ 'qiuPillow': true, 'qiuPillowHover': qiu2 == true }" @mouseover="handleQiu(2)"
                  @click="goToPath(3.2, 0)">职场机会</span>
              </div>
              <div class="qiuFlex" v-if="tabsIndex == 3 && zhao == true && userType == 10000" @click="goToPath(3, 0)">
                <span :class="{ 'qiuPillow': true, 'qiuPillowHover': zhao1 == true }" @mouseover="handleQiu(3)"
                  @click="goToPath(3.3, 0)">待审核列表</span>
                <span :class="{ 'qiuPillow': true, 'qiuPillowHover': zhao2 == true }" @mouseover="handleQiu(4)"
                  @click="goToPath(3.4, 0)">人才库</span>
              </div>
              <div v-if="tabsIndex == 4" @click="goToPath(4, 0)">待审核列表</div>
              <!-- 聊天 -->
              <div class="qiuFlex" v-if="tabsIndex == 5">
                <span style="cursor: default;" :class="{ 'qiuPillow': true, 'qiuPillowHover': single == true }"
                  @mouseover="handleQiu(5)">单聊</span>
                <span style="cursor: default;" :class="{ 'qiuPillow': true, 'qiuPillowHover': group == true }"
                  @mouseover="handleQiu(6)">群聊</span>
              </div>
              <!-- 通知 -->
              <div v-if="tabsIndex == 6" @click="goToPath(6, 0)">待审核列表</div>
              <!-- 投诉 -->
              <div v-if="tabsIndex == 7" @click="goToPath(7, 0)">待审核列表</div>
              <!-- 企业 -->
              <div v-if="tabsIndex == 8" @click="goToPath(8, 0)">待审核列表</div>
              <!-- 项目 -->
              <div v-if="tabsIndex == 9" @click="goToPath(9, 0)">待审核列表</div>
            </div>
            <div v-else>
              <div v-if="tabsIndex == 1" @click="goToPath(1, -1)">资讯列表</div>
              <div v-if="tabsIndex == 2" @click="goToPath(2, -1)">商品列表</div>
              <div v-if="tabsIndex == 3 && (userType == 2 || userType == 4)" @click="goToPath(3, -1)">求职招聘列表</div>
              <div class="qiuFlex" v-if="tabsIndex == 3 && qiu == true && userType == 1" @click="goToPath(3, 0)">
                <span :class="{ 'qiuPillow': true, 'qiuPillowHover': qiu1 == true }" @mouseover="handleQiu(1)"
                  @click="goToPath(3.1, -1)">求职列表</span>
                <span :class="{ 'qiuPillow': true, 'qiuPillowHover': qiu2 == true }" @mouseover="handleQiu(2)"
                  @click="goToPath(3.2, 0)">职场机会</span>
              </div>
              <div class="qiuFlex" v-if="tabsIndex == 3 && zhao == true && userType == 3" @click="goToPath(3, 0)">
                <span :class="{ 'qiuPillow': true, 'qiuPillowHover': zhao1 == true }" @mouseover="handleQiu(3)"
                  @click="goToPath(3.3, -1)">招聘列表</span>
                <span :class="{ 'qiuPillow': true, 'qiuPillowHover': zhao2 == true }" @mouseover="handleQiu(4)"
                  @click="goToPath(3.4, 0)">人才库</span>
              </div>
              <div v-if="tabsIndex == 4" @click="goToPath(4, -1)">书刊列表</div>
              <!-- <div class="qiuFlex" v-if="tabsIndex == 5">
                <span style="cursor: default;" :class="{ 'qiuPillow': true, 'qiuPillowHover': single == true }"
                  @mouseover="handleQiu(5)">单聊</span>
                <span style="cursor: default;" :class="{ 'qiuPillow': true, 'qiuPillowHover': group == true }"
                  @mouseover="handleQiu(6)">群聊</span>
              </div> -->
              <!-- 通知 -->
              <div v-if="tabsIndex == 6" @click="goToPath(6.1, -1)">通知列表</div>
              <!-- <div class="qiuFlex" v-if="tabsIndex == 6 && userType == 2">
                <span @click="goToPath(6.1, -1)" :class="{ 'qiuPillow': true, 'qiuPillowHover': notice1 == true }"
                  @mouseover="handleQiu(7)">通知列表</span>
                <span @click="goToPath(6.2, 0)" :class="{ 'qiuPillow': true, 'qiuPillowHover': notice2 == true }"
                  @mouseover="handleQiu(8)">行政通知</span>
              </div> -->
              <!-- 投诉 -->
              <div class="qiuFlex" v-if="tabsIndex == 7 && userType == 2">
                <span @click="goToPath(7.1, -1)" :class="{ 'qiuPillow': true, 'qiuPillowHover': complaint1 == true }"
                  @mouseover="handleQiu(9)">投诉列表</span>
                <span @click="goToPath(7.2, -1)" :class="{ 'qiuPillow': true, 'qiuPillowHover': complaint2 == true }"
                  @mouseover="handleQiu(10)">待处理列表</span>
                <!-- <span @click="goToPath(7.3, -1)" :class="{ 'qiuPillow': true, 'qiuPillowHover': complaint3 == true }"
                  @mouseover="handleQiu(11)">行政投诉</span> -->
              </div>
              <!-- 企业 -->
              <div v-if="tabsIndex == 8" @click="goToPath(8, -1)">企业列表</div>
              <!-- 项目 -->
              <div v-if="tabsIndex == 9" @click="goToPath(9, -1)">项目列表</div>
            </div>
          </div>
          <div class="infinite-list" v-infinite-scroll style="overflow:overlay">
            <!-- 资讯 -->
            <div class="noticeTabsDataBox" v-if="tabsIndex == 1">
              <div v-if="msg.apply_articale && msg.apply_articale.length > 0">
                <div class="noticeTabsDataItem" v-for="item in msg.apply_articale" :key="item.id"
                  @click="goToPath(1, item.id)">
                  <div class="noticeTabsDataItemImg">
                    <img src="@/assets/public/nav/news.png">
                  </div>
                  <div class="noticeTabsDataItemContent">
                    <div class="noticeNewsTitle">{{ item.title }}</div>
                    <div class="noticeNewsTime">{{ item.updated_at }}</div>
                  </div>
                </div>
              </div>
              <div v-else class="noticeTabsDataItemEmpty">
                <div class="noticeEmpty">
                  <img src="@/assets/public/nav/message-empty.png">
                </div>
                <div class="noticeEmptyText">
                  暂无消息
                </div>
              </div>
            </div>
            <!-- 商品 -->
            <div class="noticeTabsDataBox" v-if="tabsIndex == 2">
              <div v-if="msg.good && msg.good.length > 0">
                <div class="noticeTabsDataItem" v-for="item in msg.good" :key="item.id" @click="goToPath(2, item.id)">
                  <div class="noticeTabsDataItemImg ">
                    <img src="@/assets/public/nav/goods.png">
                  </div>
                  <div class="noticeTabsDataItemContent">
                    <div class="noticeNewsTitle">{{ item.name }}</div>
                    <div class="noticeNewsTime">{{ item.updated_at }}</div>
                  </div>
                </div>
              </div>
              <div v-else class="noticeTabsDataItemEmpty">
                <div class="noticeEmpty">
                  <img src="@/assets/public/nav/message-empty.png">
                </div>
                <div class="noticeEmptyText">
                  暂无消息
                </div>
              </div>
            </div>
            <!-- 求职信息  待审核 -->
            <div class="noticeTabsDataBox" v-if="tabsIndex == 3 && qiu == true && qiu1 == true && userType == 10000">
              <div v-if="msg.job_hunting && msg.job_hunting.length > 0">
                <div class="noticeTabsDataItem" v-for="item in msg.job_hunting" :key="item.id"
                  @click="goToPath(3.1, item.id)">
                  <!-- 待审核求职 -->
                  <div class="noticeTabsDataItemImg">
                    <img src="@/assets/public/nav/job.png">
                  </div>
                  <div class="noticeTabsDataItemContent">
                    <div class="noticeNewsTitle">{{ item.user_name + ':' + item.website_name + '-' + '发布求职信息了' }}</div>
                    <div class="noticeNewsTime">{{ item.updated_at }}</div>
                  </div>
                </div>
              </div>
              <div v-else class="noticeTabsDataItemEmpty">
                <div class="noticeEmpty">
                  <img src="@/assets/public/nav/message-empty.png">
                </div>
                <div class="noticeEmptyText">
                  暂无消息
                </div>
              </div>
            </div>

            <!-- 求职信息  职场机会 -->
            <div class="noticeTabsDataBox" v-if="tabsIndex == 3 && qiu == true && qiu2 == true && userType == 10000">
              <div v-if="msg.job_resume && msg.job_resume.length > 0">
                <div class="noticeTabsDataItem" v-for="item in msg.job_resume" :key="item.id"
                  @click="goToPath(3.2, item.recruit_id)">
                  <div class="noticeTabsDataItemImg">
                    <img src="@/assets/public/nav/job.png">
                  </div>
                  <div class="noticeTabsDataItemContent">
                    <div class="noticeNewsTitle">{{ item.business_name + ':' + item.website_name + ' ' + '关注了' +
                      item.user_name
                      + '的简历' }}</div>
                    <div class="noticeNewsTime">{{ item.updated_at }}</div>
                  </div>
                </div>
              </div>
              <div v-else class="noticeTabsDataItemEmpty">
                <div class="noticeEmpty">
                  <img src="@/assets/public/nav/message-empty.png">
                </div>
                <div class="noticeEmptyText">
                  暂无消息
                </div>
              </div>
            </div>

            <!-- 招聘信息  招聘信息  job_recruiting -->
            <div class="noticeTabsDataBox" v-if="tabsIndex == 3 && zhao == true && zhao1 == true && userType == 10000">
              <div v-if="msg.job_recruiting && msg.job_recruiting.length > 0">
                <div class="noticeTabsDataItem" v-for="item in msg.job_recruiting" :key="item.id"
                  @click="goToPath(3.3, item.id)">
                  <!-- 招聘信息 job_recruiting -->
                  <div class="noticeTabsDataItemImg">
                    <img src="@/assets/public/nav/job.png">
                  </div>
                  <div class="noticeTabsDataItemContent">
                    <div class="noticeNewsTitle">{{ item.user_name + ':' + item.website_name + ' ' + '-' + item.title
                      + '岗位' }}
                    </div>
                    <div class="noticeNewsTime">{{ item.updated_at }}</div>
                  </div>
                </div>
              </div>
              <div v-else class="noticeTabsDataItemEmpty">
                <div class="noticeEmpty">
                  <img src="@/assets/public/nav/message-empty.png">
                </div>
                <div class="noticeEmptyText">
                  暂无消息
                </div>
              </div>
            </div>

            <!-- 招聘信息  人才库   job_apply -->
            <div class="noticeTabsDataBox" v-if="tabsIndex == 3 && zhao == true && zhao2 == true && userType == 10000">
              <div v-if="msg.job_apply && msg.job_apply.length > 0">
                <div class="noticeTabsDataItem" v-for="item in msg.job_apply" :key="item.id"
                  @click="goToPath(3.4, item.hunt_id)">
                  <!-- 人才库 job_apply -->
                  <div class="noticeTabsDataItemImg">
                    <img src="@/assets/public/nav/job.png">
                  </div>
                  <div class="noticeTabsDataItemContent">

                    <div class="noticeNewsTitle">{{ item.user_name + ': 求职了' + '-' + item.business_name +
                      '-' +
                      item.job_name }}</div>
                    <div class="noticeNewsTime">{{ item.updated_at }}</div>
                  </div>
                </div>
              </div>
              <div v-else class="noticeTabsDataItemEmpty">
                <div class="noticeEmpty">
                  <img src="@/assets/public/nav/message-empty.png">
                </div>
                <div class="noticeEmptyText">
                  暂无消息
                </div>
              </div>
            </div>

            <!-- 求职信息  待审核 -->
            <div class="noticeTabsDataBox" v-if="tabsIndex == 3 && qiu == true && qiu1 == true && userType == 1">
              <div v-if="msg.job_hunting && msg.job_hunting.length > 0">
                <div class="noticeTabsDataItem" v-for="item in msg.job_hunting" :key="item.id"
                  @click="goToPath(3.1, item.id)">
                  <!-- 待审核求职 -->
                  <div class="noticeTabsDataItemImg">
                    <img src="@/assets/public/nav/job.png">
                  </div>
                  <div class="noticeTabsDataItemContent">
                    <div class="noticeNewsTitle">{{ item.user_name + ':' + item.website_name + '-' + '发布求职信息了' }}</div>
                    <div class="noticeNewsTime">{{ item.updated_at }}</div>
                  </div>
                </div>
              </div>
              <div v-else class="noticeTabsDataItemEmpty">
                <div class="noticeEmpty">
                  <img src="@/assets/public/nav/message-empty.png">
                </div>
                <div class="noticeEmptyText">
                  暂无消息
                </div>
              </div>
            </div>

            <!-- 求职信息  职场机会 -->
            <div class="noticeTabsDataBox" v-if="tabsIndex == 3 && qiu == true && qiu2 == true && userType == 1">
              <div v-if="msg.job_resume && msg.job_resume.length > 0">
                <div class="noticeTabsDataItem" v-for="item in msg.job_resume" :key="item.id"
                  @click="goToPath(3.2, item.recruit_id)">
                  <div class="noticeTabsDataItemImg">
                    <img src="@/assets/public/nav/message-news.png">
                  </div>
                  <div class="noticeTabsDataItemContent">
                    <div class="noticeNewsTitle">{{ item.business_name + ':' + item.website_name + ' ' + '关注了' +
                      item.user_name
                      + '的简历' }}</div>
                    <div class="noticeNewsTime">{{ item.updated_at }}</div>
                  </div>
                </div>
              </div>
              <div v-else class="noticeTabsDataItemEmpty">
                <div class="noticeEmpty">
                  <img src="@/assets/public/nav/message-empty.png">
                </div>
                <div class="noticeEmptyText">
                  暂无消息
                </div>
              </div>
            </div>

            <!-- 招聘信息  招聘信息  job_recruiting -->
            <div class="noticeTabsDataBox" v-if="tabsIndex == 3 && zhao == true && zhao1 == true && userType == 3">
              <div v-if="msg.job_recruiting && msg.job_recruiting.length > 0">
                <div class="noticeTabsDataItem" v-for="item in msg.job_recruiting" :key="item.id"
                  @click="goToPath(3.3, item.id)">
                  <!-- 招聘信息 job_recruiting -->
                  <div class="noticeTabsDataItemImg newsIcon">
                    <img src="@/assets/public/nav/message-news.png">
                  </div>
                  <div class="noticeTabsDataItemContent">
                    <div class="noticeNewsTitle">{{ item.user_name + ':' + item.website_name + ' ' + '-' + item.title
                      + '岗位' }}
                    </div>
                    <div class="noticeNewsTime">{{ item.updated_at }}</div>
                  </div>
                </div>
              </div>
              <div v-else class="noticeTabsDataItemEmpty">
                <div class="noticeEmpty">
                  <img src="@/assets/public/nav/message-empty.png">
                </div>
                <div class="noticeEmptyText">
                  暂无消息
                </div>
              </div>
            </div>

            <!-- 招聘信息  人才库   job_apply -->
            <div class="noticeTabsDataBox" v-if="tabsIndex == 3 && zhao == true && zhao2 == true && userType == 3">
              <div v-if="msg.job_apply && msg.job_apply.length > 0">
                <div class="noticeTabsDataItem" v-for="item in msg.job_apply" :key="item.id"
                  @click="goToPath(3.4, item.hunt_id)">
                  <!-- 人才库 job_apply -->
                  <div class="noticeTabsDataItemImg">
                    <img src="@/assets/public/nav/job.png">
                  </div>
                  <div class="noticeTabsDataItemContent">

                    <div class="noticeNewsTitle">{{ item.user_name + ': 求职了' + '-' + item.business_name +
                      '-' +
                      item.job_name }}</div>
                    <div class="noticeNewsTime">{{ item.updated_at }}</div>
                  </div>
                </div>
              </div>
              <div v-else class="noticeTabsDataItemEmpty">
                <div class="noticeEmpty">
                  <img src="@/assets/public/nav/message-empty.png">
                </div>
                <div class="noticeEmptyText">
                  暂无消息
                </div>
              </div>
            </div>

            <!-- 书刊信息 -->
            <div class="noticeTabsDataBox" v-if="tabsIndex == 4">
              <div v-if="msg.book && msg.book.length > 0">
                <div class="noticeTabsDataItem" v-for="item in msg.book" :key="item.id" @click="goToPath(4, item.id)">
                  <div class="noticeTabsDataItemImg ">
                    <img src="@/assets/public/nav/book.png">
                  </div>
                  <div class="noticeTabsDataItemContent">
                    <div class="noticeNewsTitle">{{ item.title }}</div>
                    <div class="noticeNewsTime">{{ item.updated_at }}</div>
                  </div>
                </div>
              </div>
              <div v-else class="noticeTabsDataItemEmpty">
                <div class="noticeEmpty">
                  <img src="@/assets/public/nav/message-empty.png">
                </div>
                <div class="noticeEmptyText">
                  暂无消息
                </div>
              </div>
            </div>

            <!-- 单聊 -->
            <!-- <div class="noticeTabsDataBox" v-if="tabsIndex == 5 && single == true && group == false">
              <div v-if="msg.chat && msg.chat.length > 0">
                <div class="noticeTabsDataItem" v-for="item in msg.chat" :key="item.id" @click="goToPath(5.1, 0)">
                  <div class="noticeTabsDataItemImg chatIcon">
                    <img src="@/assets/public/nav/single.png">
                  </div>
                  <div class="noticeTabsDataItemContent">
                    <div class="noticeNewsTitle">{{ item.user_name + ':' + item.content }}</div>
                    <div class="noticeNewsTime">{{ item.updated_at }}</div>
                  </div>
                </div>
              </div>
              <div v-else class="noticeTabsDataItemEmpty">
                <div class="noticeEmpty">
                  <img src="@/assets/public/nav/message-empty.png">
                </div>
                <div class="noticeEmptyText">
                  暂无消息
                </div>
              </div>
            </div> -->
            <!-- 群聊 -->
            <!-- <div class="noticeTabsDataBox" v-if="tabsIndex == 5 && group == true && single == false">
              <div v-if="msg.chat_group && msg.chat_group.length > 0">
                <div class="noticeTabsDataItem" v-for="item in msg.chat_group" :key="item.id" @click="goToPath(5.2, 0)">
                  <div class="noticeTabsDataItemImg chatIcon">
                    <img src="@/assets/public/nav/single.png">
                  </div>
                  <div class="noticeTabsDataItemContent">
                    <div class="noticeNewsTitle">{{ item.user_name + ':' + item.content }}</div>
                    <div class="noticeNewsTime">{{ item.updated_at }}</div>
                  </div>
                </div>
              </div>
              <div v-else class="noticeTabsDataItemEmpty">
                <div class="noticeEmpty">
                  <img src="@/assets/public/nav/message-empty.png">
                </div>
                <div class="noticeEmptyText">
                  暂无消息
                </div>
              </div>
            </div> -->

            <!-- 通知 -->
            <div class="noticeTabsDataBox" v-if="tabsIndex == 6 && notice1 == true && notice2 == false">
              <div v-if="msg.notice && msg.notice.length > 0">
                <div class="noticeTabsDataItem" v-for="item in msg.notice" :key="item.id" @click="goToPath(6, item.id)">
                  <div class="noticeTabsDataItemImg ">
                    <img src="@/assets/public/nav/notices.png">
                  </div>
                  <div class="noticeTabsDataItemContent">
                    <div class="noticeNewsTitle">{{ item.title }}</div>
                    <div class="noticeNewsTime">{{ item.updated_at }}</div>
                  </div>
                </div>
              </div>
              <div v-else class="noticeTabsDataItemEmpty">
                <div class="noticeEmpty">
                  <img src="@/assets/public/nav/message-empty.png">
                </div>
                <div class="noticeEmptyText">
                  暂无消息
                </div>
              </div>
            </div>
            <!-- 行政通知 -->
            <!-- <div class="noticeTabsDataBox" v-if="tabsIndex == 6 && notice1 == true && notice2 == false">
            <div v-if="msg.notice && msg.notice.length > 0">
              <div class="noticeTabsDataItem" v-for="item in msg.notice" :key="item.id" @click="goToPath(6.1, item.id)">
                <div class="noticeTabsDataItemImg ">
                  <img src="@/assets/public/nav/notices.png">
                </div>
                <div class="noticeTabsDataItemContent">
                  <div class="noticeNewsTitle">{{ item.title }}</div>
                  <div class="noticeNewsTime">{{ item.updated_at }}</div>
                </div>
              </div>
            </div>
            <div v-else class="noticeTabsDataItemEmpty">
              <div class="noticeEmpty">
                <img src="@/assets/public/nav/message-empty.png">
              </div>
              <div class="noticeEmptyText">
                暂无消息
              </div>
            </div>
          </div> -->

            <!-- 投诉 待审核列表 -->
            <div class="noticeTabsDataBox" v-if="tabsIndex == 7 && complaint1 == true && complaint2 == false">
              <div v-if="msg.complaint && msg.complaint.length > 0">
                <div class="noticeTabsDataItem" v-for="item in msg.complaint" :key="item.id"
                  @click="goToPath(7, item.id)">
                  <div class="noticeTabsDataItemImg">
                    <img src="@/assets/public/nav/complaint.png">
                  </div>
                  <div class="noticeTabsDataItemContent">
                    <div class="noticeNewsTitle">{{ item.title }}</div>
                    <div class="noticeNewsTime">{{ item.updated_at }}</div>
                  </div>
                </div>
              </div>
              <div v-else class="noticeTabsDataItemEmpty">
                <div class="noticeEmpty">
                  <img src="@/assets/public/nav/message-empty.png">
                </div>
                <div class="noticeEmptyText">
                  暂无消息
                </div>
              </div>
            </div>
            <div class="noticeTabsDataBox" v-if="tabsIndex == 7 && complaint1 == false && complaint2 == true">
              <div v-if="msg.complaint_deal && msg.complaint_deal.length > 0">
                <div class="noticeTabsDataItem" v-for="item in msg.complaint_deal" :key="item.id"
                  @click="goToPath(7, item.id)">
                  <div class="noticeTabsDataItemImg">
                    <img src="@/assets/public/nav/complaint.png">
                  </div>
                  <div class="noticeTabsDataItemContent">
                    <div class="noticeNewsTitle">{{ item.title }}</div>
                    <div class="noticeNewsTime">{{ item.updated_at }}</div>
                  </div>
                </div>
              </div>
              <div v-else class="noticeTabsDataItemEmpty">
                <div class="noticeEmpty">
                  <img src="@/assets/public/nav/message-empty.png">
                </div>
                <div class="noticeEmptyText">
                  暂无消息
                </div>
              </div>
            </div>

            <!-- 企业 -->
            <div class="noticeTabsDataBox" v-if="tabsIndex == 8">
              <div v-if="msg.complany && msg.complany.length > 0">
                <div class="noticeTabsDataItem" v-for="item in msg.complany" :key="item.id"
                  @click="goToPath(8, item.id)">
                  <div class="noticeTabsDataItemImg ">
                    <img src="@/assets/public/nav/company.png">
                  </div>
                  <div class="noticeTabsDataItemContent">
                    <div class="noticeNewsTitle">{{ item.title }}</div>
                    <div class="noticeNewsTime">{{ item.updated_at }}</div>
                  </div>
                </div>
              </div>
              <div v-else class="noticeTabsDataItemEmpty">
                <div class="noticeEmpty">
                  <img src="@/assets/public/nav/message-empty.png">
                </div>
                <div class="noticeEmptyText">
                  暂无消息
                </div>
              </div>
            </div>

            <!-- 项目 -->
            <div class="noticeTabsDataBox" v-if="tabsIndex == 9">
              <div v-if="msg.project && msg.project.length > 0">
                <div class="noticeTabsDataItem" v-for="item in msg.project" :key="item.id"
                  @click="goToPath(9, item.id)">
                  <div class="noticeTabsDataItemImg ">
                    <img src="@/assets/public/nav/project.png">
                  </div>
                  <div class="noticeTabsDataItemContent">
                    <div class="noticeNewsTitle">{{ item.title }}</div>
                    <div class="noticeNewsTime">{{ item.updated_at }}</div>
                  </div>
                </div>
              </div>
              <div v-else class="noticeTabsDataItemEmpty">
                <div class="noticeEmpty">
                  <img src="@/assets/public/nav/message-empty.png">
                </div>
                <div class="noticeEmptyText">
                  暂无消息
                </div>
              </div>
            </div>
          </div>


        </div>
      </div>

      <!-- 用户头像和菜单 -->
      <el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click">
        <div class="avatar-wrapper">
          <!-- <img src="@/assets/public/nav/notice.png" class="user-notice"> -->
          <img :src="avatar + '?imageView2/1/w/80/h/80'" class="user-avatar" v-if="avatar != ''">
          <img src="@/assets/login/userDefault.png" class="user-avatar" v-else>
          <span class="userName">{{ this.$store.state.user.name }}</span>
          <img src="@/assets/public/nav/arrowDown.png" class="arrowDown">
          <!--向下按钮-->
          <!-- <i class="el-icon-caret-bottom" /> -->
        </div>
        <el-dropdown-menu slot="dropdown">
          <router-link to="/profile/index">
            <div class="userMenuDownItem">
              <el-dropdown-item>
                <span style="display:block;">{{ $t('navbar.profile') }}</span>
              </el-dropdown-item>
            </div>
          </router-link>
          <!-- <router-link to="/">
            <el-dropdown-item>
              {{ $t('navbar.dashboard') }}
            </el-dropdown-item>
          </router-link>
          <a target="_blank" href="https://github.com/PanJiaChen/vue-element-admin/">
            <el-dropdown-item>
              {{ $t('navbar.github') }}
            </el-dropdown-item>
          </a>
          <a target="_blank" href="https://panjiachen.github.io/vue-element-admin-site/#/">
            <el-dropdown-item>Docs</el-dropdown-item>
          </a> -->
          <el-dropdown-item divided @click.native="logout">
            <div class="userMenuDownItem">
              <span style="display:block;">{{ $t('navbar.logOut') }}</span>
              <img src="@/assets/public/nav/Logout.png">
            </div>
          </el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>
    </div>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import Breadcrumb from '@/components/Breadcrumb'
import Hamburger from '@/components/Hamburger'
import ErrorLog from '@/components/ErrorLog'
import Screenfull from '@/components/Screenfull'
import SizeSelect from '@/components/SizeSelect'
import LangSelect from '@/components/LangSelect'
import Search from '@/components/HeaderSearch'
import axios from 'axios';
import router, { resetRouter } from '@/router'
import BASEURL from '@/utils/baseUrl'
import { getUseType, removeLoginStatus } from '@/utils/auth'

export default {
  components: {
    Breadcrumb,
    Hamburger,
    ErrorLog,
    Screenfull,
    SizeSelect,
    LangSelect,
    Search
  },
  data() {
    return {
      msg: {},
      userType: '', //用户类型
      tabsIndex: 1, //显示哪个选项卡
      showTabs: false, //是否显示悬浮菜单
      //求职招聘
      qiu: false,
      zhao: true,
      qiu1: true,
      qiu2: false,
      zhao1: true,
      zhao2: false,
      pages: 1,
      single: true, //单聊
      group: false, //群聊
      notice1: true, //通知待审核列表
      notice2: false, //行政通知
      complaint1: true, //投诉待审核列表
      complaint2: false, //投诉待处理列表
      complaint3: false, //行政投诉
    }
  },
  computed: {
    ...mapGetters([
      'sidebar',
      'avatar',
      'device'
    ]),
  },
  mounted() {
    this.getMsg();
    //获得用户类型
    this.userType = getUseType();
    if (this.userType == 1) {
      this.qiu = true;
    }

    // 添加点击事件监听器
    document.addEventListener('click', this.handleClickOutside);
  },
  beforeDestroy() {
    // 组件销毁前移除事件监听器
    document.removeEventListener('click', this.handleClickOutside);
  },
  methods: {
    //0.收缩菜单 start---------------------------------------->
    toggleSideBar() {
      this.$store.dispatch('app/toggleSideBar')
    },
    //0.收缩菜单 end---------------------------------------->

    //1.退出登录 start---------------------------------------->
    logout() {
      //获取 token
      const token = this.getTokenFromCookie();
      // 新做的，待替换
      // this.$store.dispatch('user/logoutapi', {token: token}).then(response => {
      //   //重置访问过的路由
      //   resetRouter()
      //   dispatch('tagsView/delAllViews', null, { root: true })
      //   console.log(response);
      //   this.$store.commit("user/LOGOUT");
      //   this.$router.push(`/login`);
      // }).catch(error => {
      //   this.$store.commit("user/LOGOUT");
      //   this.$router.push(`/login`);
      // });
      axios.get(BASEURL.WebCLogoutUrl, { params: { token: token } }).then(response => {
        console.log(response);
        this.$store.commit("user/LOGOUT");
        //this.$router.push(`/login`);
        //刷新页面
        window.location.reload();
      }).catch(error => {
        console.log(error);
        this.$store.commit("user/LOGOUT");
        //this.$router.push(`/login`);
        //this.$message.error(response.message);
        window.location.reload();
      });

      removeLoginStatus();
    },
    // async logout() {
    //   await this.$store.dispatch('user/logout')
    //   this.$router.push(`/login?redirect=${this.$route.fullPath}`)
    // },
    getTokenFromCookie() {
      const name = "Admin-Token=";
      const decodedCookie = decodeURIComponent(document.cookie);
      const cookieArray = decodedCookie.split(';');
      for (let i = 0; i < cookieArray.length; i++) {
        let cookie = cookieArray[i].trim();
        if (cookie.indexOf(name) === 0) {
          return cookie.substring(name.length, cookie.length); // 返回 token
        }
      }
      return ""; // 如果没有找到 token，返回空字符串
    },
    //1.退出登录 end---------------------------------------->

    //2.通知消息 start---------------------------------------->
    //2.1 获取通知消息列表
    getMsg() {
      this.$store.dispatch('news/getMSG').then(response => {
        console.log('response1111111111', response);
        this.msg = response.data;
        console.log('response1111111111msg', this.msg);
      }).catch(error => {
        console.log(error);
      });
    },
    //2.2 切换
    changeTabs(index) {
      this.tabsIndex = index;
    },
    //2.3跳转方法
    goToPath(type, id) {
      //如果id是0 跳转到列表
      if (id == 0) {
        if (type == 1) {
          this.$router.push(`/examine`);
        }
        else if (type == 2) {
          this.$router.push(`/goodListApply`);
        }
        else if (type == 3.1) {  //求职 待审核
          this.$router.push(`/jobHuntingListApply`);
        }
        else if (type == 3.2) { // 职场机会
          this.$router.push(`/jobOpportunities`);
        }
        else if (type == 3.3) {   // 招聘 待审核
          this.$router.push(`/checkjobRecruitingList`);
        }
        else if (type == 3.4) {   // 人才库
          this.$router.push(`/jobHuntingApplyList`);
        }
        else if (type == 4) { //书刊 待审核
          this.$router.push(`/bookListApply`);
        }
        else if (type == 6) { //通知 待审核
          this.$router.push(`/noticeListApply`);
        }
        else if (type == 7) { //投诉 待审核
          this.$router.push(`/ncomplaintListApply`);
        }
        else if (type == 8) { //企业 待审核
          this.$router.push(`/checkcompanyList`);
        }
        else if (type == 9) { //项目 待审核
          this.$router.push(`/checkprojectList`);
        }
      } else if (id == -1) {
        if (type == 1) {
          this.$router.push(`/articleList`);
        }
        else if (type == 2) {
          this.$router.push(`/goodList`);
        }
        else if (type == 3) {
          this.$router.push(`/jobHuntingList`);
        }
        else if (type == 3.1) {  //求职 待审核
          this.$router.push(`/jobHuntingList`);
        }
        else if (type == 3.2) { // 职场机会
          this.$router.push(`/jobOpportunities`);
        }
        else if (type == 3.3) {   // 招聘 待审核
          this.$router.push(`/jobRecruitingList`);
        }
        else if (type == 3.4) {   // 人才库
          this.$router.push(`/jobHuntingApplyList`);
        }
        else if (type == 4) {  //书刊
          this.$router.push(`/bookList`);
        }
        else if (type == 6.1) { //通知
          this.$router.push(`/noticeList`);
        }
        else if (type == 7.1) { //投诉
          this.$router.push(`/ncomplaintList`);
        }
        else if (type == 7.2) { //投诉处理
          this.$router.push(`/ncomplaintListDeal`);
        }
        else if (type == 8) { //企业
          this.$router.push(`/companyList`);
        }
        else if (type == 9) { //项目
          this.$router.push(`/projectList`);
        }
      } else {
        if (type == 1) {
          this.$router.push(`/creatNews?id=${id}`);
        }
        else if (type == 2) {
          this.$router.push(`/addGood?id=${id}`);
        }
        else if (type == 3) {
          this.$router.push(`/addJobHunting?id=${id}`);
        }
        else if (type == 3.1) {  //求职 待审核
          this.$router.push(`/addJobHunting?id=${id}`);
        }
        else if (type == 3.2) { // 职场机会
          this.$router.push(`/jobOpportunitiesDetails?id=${id}`);
        }
        else if (type == 3.3) {   // 招聘 待审核
          this.$router.push(`/creatJob?id=${id}&to=checkjob`);
        }
        else if (type == 3.4) {   // 人才库
          this.$router.push(`/jobHuntingApplyDetil?id=${id}`);
        }
        else if (type == 4) { //书刊
          this.$router.push(`/addBook?id=${id}`);
        }
        else if (type == 6) { //通知
          this.$router.push(`/addNotice?id=${id}`);
        }
        else if (type == 7) { //投诉
          this.$router.push(`/addNcomplaint?id=${id}`);
        }
        else if (type == 7.1) { //投诉处理
          this.$router.push(`/addNComplaint?id=${id}&read=1`);
        }
        else if (type == 8) { //企业
          this.$router.push(`/creatCompany?id=${id}&to=checkCompany`);
        }
        else if (type == 9) { //项目
          this.$router.push(`/creatProject?id=${id}&to=checkProject`);
        }
      }
      this.showTabs = false;
    },
    // 添加处理点击外部的方法
    handleClickOutside(event) {
      const noticeTabsBox = this.$refs.noticeTabsBox;
      const noticeIconImg = event.target.closest('.noticeIconImg');

      // 如果点击的不是通知图标，并且点击的区域不在通知框内，则关闭通知框
      if (!noticeIconImg && noticeTabsBox && !noticeTabsBox.contains(event.target)) {
        this.showTabs = false;
      }
    },
    //2.通知消息 end---------------------------------------->
    changeJob(index) {
      if (index == 1) {
        this.qiu = false;
        this.zhao = true;
      } else if (index == 2) {
        this.qiu = true;
        this.zhao = false;
      }
    },
    handleQiu(index) {
      if (index == 1) { //求职招聘
        this.qiu1 = true;
        this.qiu2 = false;
      } else if (index == 2) {
        this.qiu1 = false;
        this.qiu2 = true;
      } else if (index == 3) {
        this.zhao1 = true;
        this.zhao2 = false;
      } else if (index == 4) {
        this.zhao1 = false;
        this.zhao2 = true;
      } else if (index == 5) { //聊天部分
        this.single = true;
        this.group = false;
      } else if (index == 6) {
        this.single = false;
        this.group = true;
      } else if (index == 7) { //通知
        this.notice1 = true;
        this.notice2 = false;
      } else if (index == 8) {
        this.notice1 = false;
        this.notice2 = true;
      } else if (index == 9) { //投诉
        this.complaint1 = true;
        this.complaint2 = false;
      } else if (index == 10) {
        this.complaint1 = false;
        this.complaint2 = true;
      } else if (index == 11) {
        this.complaint1 = false;
        this.complaint2 = false;
        this.complaint3 = true;
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.navbar {
  height: 60px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  // box-shadow: 0 1px 4px rgba(0,21,41,.08);
  border-bottom: 1px solid #E9EDF7;

  .pageTitle {
    font-size: 20px;
    font-weight: bold;
    padding-left: 30px;
    color: #45464E;
  }

  .userName {
    font-size: 14px;
    color: #1C1D22;
    margin-left: 10px;
    font-weight: bold;
  }


  .hamburger-container {
    line-height: 46px;
    height: 100%;
    float: left;
    cursor: pointer;
    transition: background .3s;
    -webkit-tap-highlight-color: transparent;

    &:hover {
      background: rgba(0, 0, 0, .025)
    }
  }

  .breadcrumb-container {
    float: left;
  }

  .errLog-container {
    display: inline-block;
    vertical-align: top;
  }

  .right-menu {
    float: right;
    height: 100%;
    line-height: 50px;
    display: flex;
    align-items: center;
    position: relative;

    &:focus {
      outline: none;
    }

    .right-menu-item {
      display: inline-block;
      padding: 0 8px;
      height: 100%;
      font-size: 18px;
      color: #5a5e66;
      vertical-align: text-bottom;

      &.hover-effect {
        cursor: pointer;
        transition: background .3s;

        &:hover {
          background: rgba(0, 0, 0, .025)
        }
      }
    }

    .avatar-container {
      margin-right: 30px;

      .avatar-wrapper {
        margin-top: 5px;
        display: flex;
        align-items: center;

        .user-avatar {
          cursor: pointer;
          width: 32px;
          height: 32px;
        }

        .arrowDown {
          width: 12px;
          height: 8px;
          margin-left: 10px;
        }

        .user-notice {
          width: 20px;
          height: 20px;
          margin-right: 20px;
        }

        .el-icon-caret-bottom {
          cursor: pointer;
          position: absolute;
          right: -20px;
          top: 25px;
          font-size: 12px;
        }
      }
    }

    //通知消息 图标
    .noticeIconBox {
      width: 55px;
      height: 50px;
      box-sizing: border-box;
      padding-top: 8px;
      position: relative;

      .noticeIconImg {
        width: 34px;
        height: 34px;
        cursor: pointer;
      }

      .unreadCount {
        position: absolute;
        top: 5px;
        right: 8px;
        width: 30px;
        height: 20px;
        background: #FF4E4E;
        font-size: 12px;
        line-height: 20px;
        text-align: center;
        color: #fff;
        border-radius: 23px;
      }

      //通知消息 悬浮菜单
      .noticeTabsBox {
        position: absolute;
        width: 380px;
        height: 640px;
        border-radius: 8px;
        background: #fff;
        z-index: 999;
        right: 20px;
        top: 50px;
        box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.15);
        padding: 25px 20px;
        box-sizing: border-box;

        .noticeTabsTitleBox {
          display: flex;
          // align-items: center;
          border-bottom: 1px solid #E9EDF7;
          position: relative;
          margin-left: 15px;
          margin-right: 10px;

          .arrowRight {
            width: 24px;
            height: 24px;
            position: absolute;
            right: -20px;
            top: 0;
            cursor: pointer;
          }

          .arrowLeft {
            width: 24px;
            height: 24px;
            position: absolute;
            left: -30px;
            top: 0;
            cursor: pointer;
          }

          .box1,
          .box2 {
            display: flex;
          }

          .noticeTabs {
            height: 41px;
            border-bottom: 2px solid #fff;
            margin-right: 30px;
            display: flex;
            cursor: pointer;

            .noticeTabsItem {
              height: 20px;
              line-height: 20px;
              font-size: 16px;
              position: relative;

              .noticeMessageNew {
                width: 5px;
                height: 5px;
                border-radius: 50%;
                background: #FF4E4E;
                position: absolute;
                right: -5px;
                top: 0;
              }
            }
          }

          .active {
            border-bottom: 2px solid #5570F1;
          }
        }

        .noticeTabsLinkLine {
          height: 38px;
          box-sizing: border-box;
          font-size: 14px;
          cursor: pointer;
          background: #F5F7FB;
          border: 1px solid #E3E8FA;
          text-align: center;
          line-height: 38px;
          border-radius: 8px;
          margin: 20px 0;
        }

        .noticeTabsDataBox {
          height: 470px;

          .noticeTabsDataItem {
            display: flex;
            align-items: flex-start;
            cursor: pointer;
            border-radius: 8px;
            box-sizing: border-box;
            padding: 5px 10px;

            &:hover {
              background: #F5F7FB;
            }

            height: 95px;

            .noticeTabsDataItemImg {
              border-radius: 50%;
              width: 26px;
              height: 26px;
              display: flex;
              align-items: center;
              justify-content: center;
              margin-right: 15px;
              margin-top: 6px;
            }

            .newsIcon {
              background: #BAC5F8;
            }

            .chatIcon {
              background: #dbe8e3;
            }

            .noticeTabsDataItemContent {
              flex: 1;

              .noticeNewsTitle {
                font-size: 14px;
                line-height: 28px;
                height: 56px;
                color: #333;
                overflow: hidden;
                text-overflow: ellipsis;
                display: -webkit-box;
                -webkit-line-clamp: 2;
                -webkit-box-orient: vertical;
              }

              .noticeNewsTime {
                height: 30px;
                line-height: 30px;
                font-size: 14px;
                color: #999;
              }
            }
          }

          .noticeTabsDataItemEmpty {
            .noticeEmpty {
              text-align: center;
              padding-top: 150px;
              box-sizing: border-box;
            }

            .noticeEmptyText {
              text-align: center;
              color: #999;
              font-size: 14px;
            }
          }
        }
      }
    }

  }
}

.userMenuDownItem {
  width: 100px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.el-dropdown-menu__item:not(.is-disabled):hover {
  background: none;
  color: #606266;
}

.unread-count {
  position: relative;
  display: inline-block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: red;
  color: white;
  font-size: 12px;
  text-align: center;
  line-height: 20px;
  margin-left: -40px;
  margin-top: -20px;
  /* 调整位置，使其贴合通知图标 */
}

/* 如果未读数量为 0，则隐藏角标 */
.unread-count:empty {
  display: none;
}

.noticeTabsLink {
  padding-left: 10px;
  //  去掉圆点
  list-style: none;
}

.qiuPillow {
  border-radius: 4px;
  padding: -1px;
  width: 48%;
  height: 36px;
  display: block;
}

.qiuPillowHover {
  border-radius: 4px;
  padding: -1px;
  width: 48%;
  height: 36px;
  background: #dfe9ee;
  border: #dfe1e7 1px solid;
}

.qiuFlex {
  display: flex;
  justify-content: space-between;
  text-align: center;
}
</style>
