Header.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. <template>
  2. <div class="v-header">
  3. <div class="v-header-left">
  4. <div class="left-img inlineBlock"></div>
  5. <div class="system-title">
  6. <div class="zh">智慧社区指挥调度中心</div>
  7. <div class="en">Smart Community Space Management System</div>
  8. </div>
  9. <div class="left-img rights inlineBlock"></div>
  10. </div>
  11. <div class="v-header-center">
  12. <div
  13. class="tabSelect"
  14. v-for="(item, index) in tagTableArr"
  15. :key="index"
  16. :class="tagTabIndex == index ? 'active' : ''"
  17. @click="selectTab(index)"
  18. >
  19. {{ item }}
  20. </div>
  21. </div>
  22. <div class="v-header-right">
  23. <div class="right-imgs"></div>
  24. <div>
  25. <span class="selectIocn"></span>
  26. <el-select
  27. v-model="communityId"
  28. placeholder="所有社区"
  29. clearable
  30. class="saveColumn-select"
  31. @change="$store.commit('setHomeCommunityAll', communityId)"
  32. >
  33. <el-option v-for="(item, index) in communityList" :label="item.communityName" :value="item.id" :key="index"></el-option>
  34. </el-select>
  35. </div>
  36. <div class="time">
  37. <div class="date">{{ time.date }}</div>
  38. <div class="dates">
  39. <div class="thisTime">{{ time.thisTime }}</div>
  40. <div class="week">{{ time.week }}</div>
  41. </div>
  42. </div>
  43. </div>
  44. </div>
  45. </template>
  46. <script>
  47. import envConfig from '@/config';
  48. export default {
  49. name: 'vheader',
  50. data() {
  51. return {
  52. name: '',
  53. envConfig: envConfig,
  54. tagTableArr: ['指挥调度', '社区资产', '产业招商', '运营服务', '财务分析', '视频监控'],
  55. tagTabIndex: 0,
  56. time: {
  57. thisTime: '2000/01/01',
  58. week: '星期一',
  59. date: '00:00:00'
  60. },
  61. communityList: [],
  62. communityId: ''
  63. };
  64. },
  65. computed: {
  66. cruUserInfo() {
  67. return this.$store.getters['getCruUserInfo'];
  68. }
  69. },
  70. methods: {
  71. getUserInfo() {
  72. this.$http.postForm('/sc-user-center/user/findLoginUserById').then(({ status, data, msg }) => {
  73. if (status === 0) {
  74. this.$store.commit('setcCruUserInfo', data);
  75. } else {
  76. this.$message.error('获取用户信息失败');
  77. }
  78. });
  79. },
  80. // 退出登录
  81. logOut() {
  82. var access_token = localStorage.getItem('SC_token');
  83. this.$http.postForm('/sc-user-auth/user/logout', { access_token: access_token }).then(({ status, data, msg }) => {
  84. if (0 === status) {
  85. this.$message({
  86. type: 'success',
  87. message: '您已退出登录'
  88. });
  89. localStorage.removeItem('SC_token');
  90. sessionStorage.removeItem('SC_listMuen');
  91. this.$store.commit('setloginInfo', '');
  92. this.$store.dispatch('tags', []);
  93. sessionStorage.removeItem('tabs');
  94. window.location.href = this.envConfig.loginUrl;
  95. } else {
  96. this.$message.error(msg);
  97. }
  98. });
  99. },
  100. getTime() {
  101. this.time.date = this.$moment().format('HH:mm:ss');
  102. this.time.week = this.$moment().format('dddd');
  103. this.time.thisTime = this.$moment().format('YYYY/MM/DD');
  104. },
  105. communityNameList() {
  106. this.$http.get('/sc-community/assets/community/list').then(({ data, msg, status }) => {
  107. if (status == 0) {
  108. this.communityList = data;
  109. this.$store.commit('setAreaSelect', data);
  110. }
  111. });
  112. },
  113. selectTab(index) {
  114. this.tagTabIndex = index;
  115. }
  116. },
  117. mounted() {},
  118. created() {
  119. setInterval(() => {
  120. this.getTime();
  121. }, 1000);
  122. this.getUserInfo();
  123. this.communityNameList();
  124. }
  125. };
  126. </script>
  127. <style lang='scss' scoped>
  128. @import '@assets/css/public-style.scss';
  129. $name: v-header;
  130. $colorOption: rgba(250, 250, 250, 0.6);
  131. .inlineBlock {
  132. display: inline-block;
  133. }
  134. .#{$name} {
  135. width: 100%;
  136. height: 110px;
  137. position: absolute;
  138. top: 0;
  139. z-index: 10;
  140. display: flex;
  141. justify-content: space-between;
  142. background-image: url('~@/assets/img/homeTop/bg_top.png');
  143. background-size: cover;
  144. padding-top: 15px;
  145. &-left {
  146. width: 530px;
  147. display: flex;
  148. color: #fff;
  149. .left-img {
  150. width: 50px;
  151. height: 18px;
  152. background-image: url('~@/assets/img/homeTop/top_big.png');
  153. background-size: cover;
  154. margin: 20px;
  155. }
  156. .system-title {
  157. .zh {
  158. font-size: 30px;
  159. line-height: 42px;
  160. letter-spacing: 5px;
  161. text-shadow: 0px 4px 8px rgba(7, 80, 92, 0.5);
  162. }
  163. .en {
  164. font-size: 12px;
  165. letter-spacing: 2px;
  166. white-space: nowrap;
  167. overflow: hidden;
  168. text-overflow: ellipsis;
  169. }
  170. }
  171. }
  172. &-center {
  173. display: flex;
  174. column-gap: 20px;
  175. font-size: 20px;
  176. height: 32px;
  177. color: $colorOption;
  178. .tabSelect {
  179. border: 1px solid $colorOption;
  180. cursor: pointer;
  181. box-sizing: border-box;
  182. width: 100px;
  183. line-height: 30px;
  184. text-align: center;
  185. border-radius: 5px;
  186. &.active {
  187. border-color: #01b1fe;
  188. background: #01b1fe;
  189. color: rgb(250, 250, 250);
  190. }
  191. }
  192. }
  193. &-right {
  194. margin-right: 20px;
  195. display: flex;
  196. .right-imgs {
  197. width: 98px;
  198. height: 2px;
  199. background-image: url('~@/assets/img/homeTop/yuansu2@2x.png');
  200. background-size: cover;
  201. margin-top: 20px;
  202. margin-right: 60px;
  203. }
  204. .saveColumn-select {
  205. width: 125px;
  206. }
  207. .selectIocn {
  208. display: inline-block;
  209. width: 26px;
  210. height: 24px;
  211. background-image: url('~@/assets/img/homeTop/icon_shequ@2x.png');
  212. background-size: cover;
  213. margin-top: 5px;
  214. }
  215. .time {
  216. display: flex;
  217. .date {
  218. line-height: 40px;
  219. font-size: 24px;
  220. color: #fff;
  221. }
  222. .dates {
  223. color: #01b1fe;
  224. text-align: center;
  225. line-height: 20px;
  226. margin-left: 10px;
  227. }
  228. }
  229. }
  230. }
  231. .saveColumn-select {
  232. /deep/ .el-input__inner {
  233. background: transparent;
  234. color: white;
  235. border: none;
  236. font-size: 20px;
  237. }
  238. }
  239. </style>