a0e749c333574549ac99e2838201ffd72e8ec3a6.svn-base 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <template>
  2. <div class="navbar">
  3. <div class="left-menu">
  4. <hamburger :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" />
  5. </div>
  6. <h3 class="tmrTitle">TMRWatch全混合日粮监管系统</h3>
  7. <div class="right-menu">
  8. <!-- <search id="header-search" class="right-menu-item" />-->
  9. <!--<screenfull id="screenfull" class="right-menu-item hover-effect" /> -->
  10. <!-- <el-dropdown id="news" class="avatar-container" trigger="click">
  11. <span class="right-menu-news">
  12. <svg-icon class="right-menu-news-icon" :icon-class="'icon-news'" />
  13. <i class="right-menu-news-right">{{ sumAmount }}</i>
  14. </span>
  15. <el-dropdown-menu slot="dropdown" class="user-dropdown">
  16. <div class="newsTitle" style="padding-left: 10px">
  17. 消息通知
  18. </div>
  19. <el-dropdown-item v-for="(item,index) in meslist" :key="index" divided>
  20. <span style="display:block;" @click="clickList(item)"><span style="margin-right:30px;">{{ item.remark }}</span><span style="float:right;">{{ item.mesTime }}</span></span>
  21. </el-dropdown-item>
  22. <router-link to="/console/News">
  23. <el-dropdown-item style="text-align:center;margin-top:10px;">
  24. 查看全部
  25. </el-dropdown-item>
  26. </router-link>
  27. </el-dropdown-menu>
  28. </el-dropdown> -->
  29. <el-dropdown class="avatar-container" trigger="click">
  30. <div class="avatar-wrapper">
  31. <!-- <img src="@/assets/cow.jpg" class="user-avatar"> -->
  32. <span style="font-size:12px;color: #fff;">欢迎您,{{ employename }}</span>
  33. <i class="el-icon-caret-bottom" style="color: #fff;" />
  34. </div>
  35. <el-dropdown-menu slot="dropdown" class="user-dropdown">
  36. <router-link to="/">
  37. <el-dropdown-item> 主页 </el-dropdown-item>
  38. </router-link>
  39. <el-dropdown-item divided>
  40. <span style="display:block;" @click="logout">注销</span>
  41. </el-dropdown-item>
  42. <router-link to="/changpwd/Changpwd">
  43. <el-dropdown-item> 修改密码 </el-dropdown-item>
  44. </router-link>
  45. </el-dropdown-menu>
  46. </el-dropdown>
  47. </div>
  48. </div>
  49. </template>
  50. <script>
  51. // import { GetDataByName } from '@/api/common'
  52. import { mapGetters } from 'vuex'
  53. import Hamburger from '@/components/Hamburger'
  54. // import Screenfull from '@/components/Screenfull'
  55. // import Search from '@/components/HeaderSearch'
  56. // import path from 'path'
  57. // import Cookies from 'js-cookie'
  58. export default {
  59. components: {
  60. Hamburger
  61. // Screenfull,
  62. // Search
  63. },
  64. data() {
  65. return {
  66. sumAmount: '',
  67. meslist: ''
  68. }
  69. },
  70. computed: {
  71. ...mapGetters([
  72. 'sidebar',
  73. 'avatar',
  74. 'employename',
  75. 'employeid',
  76. 'pastureid',
  77. 'departmentid',
  78. 'sumamount'
  79. ])
  80. },
  81. created() {
  82. // window.setInterval(() => {
  83. // setTimeout(() => {
  84. // this.sumAmount = JSON.parse(sessionStorage.sumamount)
  85. // this.meslist = JSON.parse(sessionStorage.meslist)
  86. // }, 0)
  87. // }, 100)
  88. },
  89. methods: {
  90. toggleSideBar() {
  91. this.$store.dispatch('app/toggleSideBar')
  92. },
  93. async logout() {
  94. await this.$store.dispatch('user/logout')
  95. this.$store.dispatch('tagsView/delAllViews').then(({ visitedViews }) => {
  96. this.$router.push(`/login}`) // 跳转到主页
  97. })
  98. // this.$router.push(`/login?redirect=${this.$route.fullPath}`) //跳转到登陆前页面
  99. }
  100. }
  101. }
  102. </script>
  103. <style lang="scss" scoped>
  104. .navbar {
  105. height: 50px;
  106. overflow: hidden;
  107. position: relative;
  108. background: url(../../assets/images/index/topBg.png);
  109. box-shadow: 0 1px 4px rgba(0,21,41,.08);
  110. .tmrTitle{color: #fff;float: left;}
  111. .hamburger-container {
  112. line-height: 46px;
  113. height: 100%;
  114. float: left;
  115. cursor: pointer;
  116. color: #fff !important;
  117. transition: background .3s;
  118. -webkit-tap-highlight-color:transparent;
  119. &:hover {
  120. background: rgba(255, 255, 255, .025)
  121. }
  122. }
  123. h3{
  124. margin-top: 13px;
  125. }
  126. .breadcrumb-container {
  127. float: left;
  128. }
  129. .right-menu {
  130. float: right;
  131. height: 100%;
  132. line-height: 50px;
  133. &:focus {
  134. outline: none;
  135. }
  136. .right-menu-item {
  137. display: inline-block;
  138. padding: 0 8px;
  139. height: 100%;
  140. font-size: 18px;
  141. color: #5a5e66;
  142. vertical-align: text-bottom;
  143. &.hover-effect {
  144. cursor: pointer;
  145. transition: background .3s;
  146. &:hover {
  147. background: rgba(0, 0, 0, .025)
  148. }
  149. }
  150. }
  151. .avatar-container {
  152. margin-right: 30px;
  153. .avatar-wrapper {
  154. margin-top: 5px;
  155. position: relative;
  156. .user-avatar {
  157. cursor: pointer;
  158. width: 40px;
  159. height: 40px;
  160. border-radius: 10px;
  161. }
  162. .el-icon-caret-bottom {
  163. cursor: pointer;
  164. position: absolute;
  165. right: -20px;
  166. top: 18px;
  167. font-size: 12px;
  168. }
  169. }
  170. }
  171. .right-menu-news{
  172. margin-right:25px;
  173. position:relative;
  174. .right-menu-news-icon{
  175. display:block;
  176. float:left;
  177. width:25px;
  178. height:40px;
  179. }
  180. .right-menu-news-right{
  181. display:block;
  182. width:20px;
  183. height:20px;
  184. float:left;
  185. border-radius: 10px;
  186. background:red;
  187. font-style:normal;
  188. position:absolute;
  189. right:-12px;
  190. bottom:25px;
  191. font-weight: 300;
  192. font-size:12px ;
  193. line-height: 20px;
  194. text-align:center;
  195. color:#fff;
  196. }
  197. }
  198. }
  199. }
  200. </style>
  201. <style lang="scss" >
  202. .user-dropdown{
  203. top: 40px!important;
  204. color: #fff !important;
  205. }
  206. </style>