Header.vue 8.7 KB

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