import store from '@/store'
import defaultSettings from '@/settings'

/**
 * 动态修改标题
 */
export function useDynamicTitle() {
  if (store.state.settings.dynamicTitle) {
    document.title = store.state.settings.title + ' - ' + defaultSettings.title;
  } else {
    document.title = getTitle() + defaultSettings.title;
  }
}

export function getTitle() {
  let title = ''
  const role = localStorage.getItem('select_identity')
 if (role == 1) {
      // 企业
      title = '企业'
    } else if (role == 2) {
      // 专家
      title = '专家'
    } else if (role == 4) {
      // 研究机构
      title = '研究机构'
    } else if (role == 8) {
      // 实验室
      title = '实验室'
    } else if (role == 16) {
      // 科技经纪人
      title = '科技经纪人'
    }
    return title
}