UserMenu.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <template>
  2. <div class="user-wrapper">
  3. <div class="content-box">
  4. <!-- <a href="https://pro.loacg.com/docs/getting-started" target="_blank">-->
  5. <!-- <span class="action">-->
  6. <!-- <a-icon type="question-circle-o"></a-icon>-->
  7. <!-- </span>-->
  8. <!-- </a>-->
  9. <!-- <notice-icon class="action"/>-->
  10. <!-- <a-dropdown>
  11. <span class="action ant-dropdown-link user-dropdown-menu">
  12. <a-icon type="setting"/>
  13. <span>{{$t('m.common.language')}}</span>
  14. </span>
  15. <a-menu slot="overlay" class="user-dropdown-menu-wrapper">
  16. <a-menu-item key="0" v-show="!BaseTool.Util._isMobile()">
  17. <a href="javascript:;" @click="changeLangEvent('zh-CN')">
  18. <span>Chinese</span>
  19. </a>
  20. </a-menu-item>
  21. <a-menu-divider v-show="!BaseTool.Util._isMobile()" />
  22. <a-menu-item key="1">
  23. <a href="javascript:;" @click="changeLangEvent('en-US')">
  24. <span>English</span>
  25. </a>
  26. </a-menu-item>
  27. </a-menu>
  28. </a-dropdown>-->
  29. <a style="margin-left: 8px;" @click="handleScreen(1)">设备大屏</a>
  30. <a style="margin-left: 8px;" @click="handleScreen(2)">详情大屏</a>
  31. <a style="margin-left: 8px;" @click="handleScreen(3)">维保大屏</a>
  32. <a style="margin-left: 8px;" @click="handleScreen(4)">仓库大屏</a>
  33. <a-dropdown>
  34. <span class="action ant-dropdown-link user-dropdown-menu">
  35. <a-avatar class="avatar" size="small" :src="avatar"/>
  36. <span>{{ nickname }}</span>
  37. </span>
  38. <a-menu slot="overlay" class="user-dropdown-menu-wrapper">
  39. <!-- <a-menu-item key="0">-->
  40. <!-- <router-link :to="{ name: 'center' }">-->
  41. <!-- <a-icon type="user"/>-->
  42. <!-- <span>个人中心</span>-->
  43. <!-- </router-link>-->
  44. <!-- </a-menu-item>-->
  45. <a-menu-item key="1" v-show="!BaseTool.Util._isMobile()">
  46. <router-link :to="{ name: 'settings' }">
  47. <a-icon type="setting"/>
  48. <span>账户设置</span>
  49. </router-link>
  50. </a-menu-item>
  51. <!-- <a-menu-item key="2" disabled>-->
  52. <!-- <a-icon type="setting"/>-->
  53. <!-- <span>测试</span>-->
  54. <!-- </a-menu-item>-->
  55. <a-menu-divider v-show="!BaseTool.Util._isMobile()" />
  56. <a-menu-item key="3">
  57. <a href="javascript:;" @click="handleLogout">
  58. <a-icon type="logout"/>
  59. <span>退出登录</span>
  60. </a>
  61. </a-menu-item>
  62. </a-menu>
  63. </a-dropdown>
  64. </div>
  65. </div>
  66. </template>
  67. <script>
  68. import NoticeIcon from '@/components/NoticeIcon'
  69. import { mapActions, mapGetters } from 'vuex'
  70. export default {
  71. name: 'UserMenu',
  72. components: {
  73. NoticeIcon
  74. },
  75. computed: {
  76. ...mapGetters(['nickname', 'avatar'])
  77. },
  78. methods: {
  79. ...mapActions(['Logout']),
  80. changeLangEvent (type) {
  81. // localStorage.setItem('locale', type)
  82. localStorage.setItem('locale', 'zh-CN')
  83. this.$i18n.locale = type
  84. this.$router.go(0)
  85. },
  86. handleScreen (type) {
  87. const a = document.createElement('a')
  88. a.target = '_blank'
  89. if (type === 1) {
  90. a.href = '/InfoBigScreen'
  91. } else if (type === 2) {
  92. a.href = '/InfoDetailBigScreen'
  93. } else if (type === 3) {
  94. a.href = '/RepairBigScreen'
  95. } else {
  96. a.href = '/StoreBigScreen'
  97. }
  98. a.click()
  99. },
  100. handleLogout () {
  101. this.$confirm({
  102. title: '提示',
  103. content: '真的要注销登录吗 ?',
  104. okText: '确定',
  105. cancelText: '取消',
  106. onOk: () => {
  107. return this.Logout({}).then(() => {
  108. setTimeout(() => {
  109. window.location.reload()
  110. }, 16)
  111. }).catch(err => {
  112. this.$message.error({
  113. title: '错误',
  114. description: err.message
  115. })
  116. })
  117. },
  118. onCancel () {
  119. }
  120. })
  121. }
  122. }
  123. }
  124. </script>