/*
 * @Author: xiejiang
 * @Date: 2024-12-03 09:32:36
 * @LastEditors: xiejiang
 * @LastEditTime: 2024-12-03 09:40:52
 * @Description: 获取设备类型
 * Copyright（c）2024 by 好老师教育科技有限公司 All right Reserved.
 */
export function getDeviceType(): '手机' | '平板' | 'pc' {
  const userAgent = navigator.userAgent.toLowerCase()

  const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent)
  const isTablet = /(ipad)|android(?!.*mobile)/i.test(userAgent)

  if (isMobile) {
    return '手机'
  } else if (isTablet) {
    return '平板'
  } else {
    return 'pc'
  }
}
