index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  1. <template>
  2. <div class="nav-wrap">
  3. <div class="top">
  4. <div class="top_png">
  5. <p>智慧社区管理平台</p>
  6. </div>
  7. <div class="lfet-right">
  8. <div class="logo"></div>
  9. <div style="display: flex">
  10. <div class="tenantName" @click="toggleTenant">{{ tenantName }}</div>
  11. <div class="logout" @click="logout"></div>
  12. </div>
  13. </div>
  14. </div>
  15. <select-tenant :selectDta="selectDta" v-show="isSelectTenant"></select-tenant>
  16. <div class="bottom_png"><span></span></div>
  17. <div class="bg-earth" v-show="!isSelectTenant">
  18. <div class="nav-content">
  19. <template v-for="(item, index) in navList">
  20. <div
  21. :key="index"
  22. @click="goPage(item.linkPath, item.isOwner, item.id, item.appId)"
  23. :class="[item.isOwner ? '' : 'unOwner', 'item']"
  24. >
  25. <span class="left-label"></span>
  26. <div class="item-cenText">
  27. <img class="img" :src="envConfig.baseImgApi + item.menuImage" :onerror="defaultImgSrc" />
  28. <img class="imghover" :src="envConfig.baseImgApi + item.menuDynamicImage" :onerror="defaultImgSrc" />
  29. <div class="contents">
  30. <div class="title">{{ item.name }}</div>
  31. <div class="subtitle">{{ item.englishName }}</div>
  32. </div>
  33. </div>
  34. <div class="right-img"></div>
  35. </div>
  36. </template>
  37. </div>
  38. </div>
  39. </div>
  40. </template>
  41. <script>
  42. import envConfig from '@/config';
  43. import SelectTenant from '@/components/ToggleTenant';
  44. export default {
  45. components: {
  46. SelectTenant
  47. },
  48. data() {
  49. return {
  50. envConfig: envConfig,
  51. navList: [],
  52. logo: '',
  53. menuImage: '',
  54. defaultImgSrc: 'this.src="' + require('@/assets/img/nav/bengzhanguanli1.png') + '"',
  55. selectDta: [],
  56. tenantName: null,
  57. isSelectTenant: false
  58. };
  59. },
  60. methods: {
  61. logout() {
  62. var access_token = localStorage.getItem('SC_token');
  63. this.$http.postForm('/user/logout', { access_token: access_token }).then(({ status, data, msg }) => {
  64. if (0 === status) {
  65. this.$message({
  66. type: 'success',
  67. message: '您已退出登录'
  68. });
  69. localStorage.removeItem('SC_token');
  70. localStorage.removeItem('menupath');
  71. localStorage.removeItem('ms_username');
  72. this.$store.commit('setloginInfo', '');
  73. // sessionStorage.removeItem('tabs');
  74. sessionStorage.clear();
  75. this.$router.push({
  76. path: '/login'
  77. });
  78. } else {
  79. this.$message.error(msg);
  80. }
  81. });
  82. },
  83. //页面跳转用,根据appid跳转到不同的界面,appid后端提供
  84. goPage(url, isOwner, id, appId) {
  85. if (!isOwner) {
  86. return;
  87. }
  88. if (url.indexOf('/IOT') != '-1') {
  89. this.$http.get('/user/getRangeCode', { appId: '1001' }).then(({ status, data, msg }) => {
  90. if (0 === status) {
  91. window.open(`${url}?code=${data}`);
  92. } else {
  93. this.$message.error(msg);
  94. }
  95. });
  96. } else if (appId == 1007) {
  97. this.$http.get('/sc-community/assets/community/getLoginParkUrl').then(({ status, data, msg }) => {
  98. if (0 === status) {
  99. window.open(`${data}`);
  100. } else {
  101. this.$message.error(msg);
  102. }
  103. });
  104. } else if (appId == 1009 || appId == 1010 || appId == 1011) {
  105. this.$http
  106. .post('/third/party/login/getLoginUrl', {
  107. menuId: id,
  108. systemType: 'YYSF'
  109. })
  110. .then(({ status, data, msg }) => {
  111. if (0 === status) {
  112. window.open(`${data}`);
  113. } else {
  114. this.$message.error(msg);
  115. }
  116. });
  117. } else {
  118. window.open(url);
  119. }
  120. },
  121. getNavList() {
  122. this.$http.get('/sc-user-center/user/findUserFirstMenu').then(({ status, data, msg }) => {
  123. if (0 === status) {
  124. if (data && data.length > 10) {
  125. let newdata = data.slice(0, 10);
  126. this.navList = newdata;
  127. } else {
  128. this.navList = data;
  129. }
  130. // let xx=data.find(item=>{
  131. // if(item.name=='客户服务'){
  132. // item.name="新物联网";
  133. // item.appId=1010
  134. // return item.linkPath="http://localhost:8081/"
  135. // }
  136. // })
  137. // if(this.navList[4].name)
  138. // {
  139. // this.navList[4].name="新物联网"
  140. // this.navList[4].linkPath="http://localhost:8081/"
  141. // this.navList[4].appId=1010
  142. // }
  143. // console.dir(this.navList);
  144. }
  145. });
  146. },
  147. toggleTenant() {
  148. if (this.selectDta.length > 1) {
  149. this.isSelectTenant = !this.isSelectTenant;
  150. }
  151. },
  152. selectTenant(item) {
  153. if (this.$route.query.tenantId == item.tenantId) {
  154. this.toggleTenant();
  155. return;
  156. }
  157. window.sessionStorage.setItem('loginJson', JSON.stringify(this.selectDta));
  158. window.sessionStorage.setItem('loginJsonActive', JSON.stringify(item));
  159. this.getlogin();
  160. },
  161. getlogin() {
  162. this.isSelectTenant = false;
  163. // let { phone, tenantId } = this.$route.query;
  164. this.selectDta = JSON.parse(window.sessionStorage.getItem('loginJson'));
  165. let { phone, tenantId } = JSON.parse(window.sessionStorage.getItem('loginJsonActive'));
  166. this.selectDta.map((item, index) => {
  167. if (item.tenantId == tenantId) {
  168. this.tenantName = item.tenantName;
  169. return;
  170. }
  171. });
  172. this.$http
  173. .postForm('/user/login', { mobile: phone, tenatId: tenantId, token: localStorage.getItem('SC_token') })
  174. .then(({ status, data, msg }) => {
  175. // localStorage.setItem('UMIS_token', data.token);
  176. localStorage.setItem('customerID', data.customerId);
  177. if (data.enableState === '0') {
  178. if (this.tenantName.length > 1) {
  179. this.$alert('该租户已被停用,请选择其他租户节点', '', {
  180. confirmButtonText: '确定',
  181. showClose: false
  182. })
  183. .then(() => {
  184. this.toggleTenant();
  185. })
  186. .catch(() => {});
  187. return;
  188. } else {
  189. this.$alert('你的账号已被停用,如有问题请联系管理员', '', {
  190. confirmButtonText: '确定',
  191. showClose: false
  192. })
  193. .then(() => {
  194. window.open('/login/', '_self');
  195. window.relogin = false;
  196. })
  197. .catch(() => {});
  198. return;
  199. }
  200. }
  201. this.logo = data.logo;
  202. this.getNavList();
  203. });
  204. }
  205. },
  206. created() {
  207. this.getlogin();
  208. }
  209. };
  210. </script>
  211. <style lang="scss" scoped>
  212. @import './style.scss';
  213. // .nav-wrap {
  214. // width: 100%;
  215. // height: 100%;
  216. // // min-width: 1500px;
  217. // background: linear-gradient(0deg, #000000 0%, #132037 100%);
  218. // overflow: hidden;
  219. // position: relative;
  220. // .top {
  221. // position: relative;
  222. // z-index: 101;
  223. // padding-top: 67px;
  224. // .lfet-right {
  225. // padding: 0 100px 0 100px;
  226. // display: flex;
  227. // justify-content: space-between;
  228. // text-align: center;
  229. // position: relative;
  230. // top: -25px;
  231. // .tenantName {
  232. // color: RGBA(254, 254, 254, 1);
  233. // padding: 0 20px;
  234. // height: 49px;
  235. // line-height: 49px;
  236. // font-size: 20px;
  237. // box-sizing: border-box;
  238. // border: 1px solid RGBA(71, 81, 98, 1);
  239. // border-radius: 10px;
  240. // margin-right: 20px;
  241. // cursor: pointer;
  242. // }
  243. // }
  244. // }
  245. // .logo {
  246. // width: 120px;
  247. // height: 36px;
  248. // background: url(../../assets/img/nav/logo.png);
  249. // background-size: 100% 100%;
  250. // z-index: 11;
  251. // }
  252. // .logout {
  253. // width: 49px;
  254. // height: 49px;
  255. // background: url(../../assets/img/btn_switch.png);
  256. // background-size: 100% 100%;
  257. // z-index: 11;
  258. // }
  259. // .top_png {
  260. // // position: absolute;
  261. // // z-index: 100;
  262. // // top: 67px;
  263. // // left: 50%;
  264. // width: 100%;
  265. // width: 1458px;
  266. // margin: auto;
  267. // height: 58px;
  268. // // transform: translateX(-50%);
  269. // animation-name: opacityAni;
  270. // background: url(../../assets/img/nav/img_toubu.png);
  271. // background-size: cover;
  272. // opacity: 0;
  273. // animation-delay: 0.668s;
  274. // animation-duration: 0.834s;
  275. // animation-fill-mode: forwards;
  276. // p {
  277. // font-size: 24px;
  278. // font-family: PingFang SC;
  279. // font-weight: 600;
  280. // color: #ffffff;
  281. // background: linear-gradient(1deg, #a8c4f5 0%, #ffffff 100%);
  282. // -webkit-background-clip: text;
  283. // -webkit-text-fill-color: transparent;
  284. // position: relative;
  285. // top: -10px;
  286. // text-align: center;
  287. // }
  288. // }
  289. // .bottom_png {
  290. // position: absolute;
  291. // z-index: 100;
  292. // bottom: 0;
  293. // width: 100%;
  294. // height: 83px;
  295. // height: 4.3vw;
  296. // background: #010305;
  297. // & > span {
  298. // display: block;
  299. // width: 100%;
  300. // height: 83px;
  301. // height: 4.3vw;
  302. // animation-name: opacityAni;
  303. // background: url(../../assets/img/nav/img_dibu.png);
  304. // background-size: cover;
  305. // opacity: 0;
  306. // animation-delay: 0.668s;
  307. // animation-duration: 0.834s;
  308. // animation-fill-mode: forwards;
  309. // }
  310. // }
  311. // .bg-earth {
  312. // position: absolute;
  313. // width: 1500px;
  314. // width: 1920 / 1500;
  315. // height: 600px;
  316. // top: 50%;
  317. // left: 50%;
  318. // transform: translate(-50%, -50%);
  319. // overflow-y: auto;
  320. // &::-webkit-scrollbar {
  321. // // width: 5px;
  322. // display: none;
  323. // }
  324. // // &::-webkit-scrollbar-track {
  325. // // background-color: white;
  326. // // border-radius: 10px;
  327. // // }
  328. // // &::-webkit-scrollbar-thumb {
  329. // // border-radius: 10px;
  330. // // background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0.6, RGBA(9, 14, 25, 1)));
  331. // // }
  332. // }
  333. // .nav-title {
  334. // position: absolute;
  335. // display: flex;
  336. // justify-content: center;
  337. // align-items: center;
  338. // flex-direction: column;
  339. // width: 381px;
  340. // height: 153px;
  341. // img {
  342. // width: 150px;
  343. // height: 40px;
  344. // }
  345. // .dot_icon {
  346. // display: flex;
  347. // justify-content: center;
  348. // align-items: center;
  349. // flex-direction: row;
  350. // margin-top: 10px;
  351. // p {
  352. // font-size: 36px;
  353. // font-weight: 600;
  354. // font-family: PingFang SC;
  355. // color: #ffffff;
  356. // // margin-top: 10px;
  357. // text-align: center;
  358. // }
  359. // .icon-blue-rect {
  360. // display: inline-block;
  361. // margin: 0 10px;
  362. // width: 6px;
  363. // height: 6px;
  364. // background: linear-gradient(-80deg, #2a68e6 0%, #2887f2 100%);
  365. // border-radius: 3px;
  366. // vertical-align: super;
  367. // }
  368. // }
  369. // }
  370. // .nav-content {
  371. // display: grid;
  372. // // 左右距离30 一列3等分
  373. // row-gap: 30px;
  374. // column-gap: 30px;
  375. // grid-template-columns: repeat(3, minmax(0, 1fr));
  376. // .item {
  377. // width: 480px;
  378. // height: 180px;
  379. // background: RGBA(32, 40, 57, 1);
  380. // border-radius: 10px;
  381. // border: 1px solid transparent;
  382. // position: relative;
  383. // cursor: pointer;
  384. // display: flex;
  385. // justify-content: space-between;
  386. // &:hover {
  387. // border-color: #ffffff;
  388. // .left-label {
  389. // opacity: 1;
  390. // }
  391. // .item-cenText .contents {
  392. // opacity: 1;
  393. // .subtitle {
  394. // color: #0eaeff;
  395. // }
  396. // }
  397. // .right-img {
  398. // opacity: 0.7;
  399. // }
  400. // .img {
  401. // display: none;
  402. // }
  403. // .imghover {
  404. // display: block;
  405. // }
  406. // }
  407. // .imghover {
  408. // display: none;
  409. // }
  410. // .item-cenText {
  411. // margin: 43px 0 0 56px;
  412. // display: flex;
  413. // .img,
  414. // .imghover {
  415. // width: 82px;
  416. // height: 92px;
  417. // }
  418. // .contents {
  419. // margin-left: 48px;
  420. // font-size: 24px;
  421. // font-family: Microsoft YaHei;
  422. // font-weight: bold;
  423. // color: #ffffff;
  424. // opacity: 0.8;
  425. // .subtitle {
  426. // font-size: 12px;
  427. // margin-top: 10px;
  428. // color: #748ba8;
  429. // white-space: nowrap;
  430. // }
  431. // }
  432. // }
  433. // .right-img {
  434. // background: url('../../assets/img/nav/img6.png') no-repeat;
  435. // background-size: cover;
  436. // width: 90px;
  437. // height: 180px;
  438. // opacity: 0.2;
  439. // }
  440. // .left-label {
  441. // width: 6px;
  442. // height: 50px;
  443. // background: #ffffff;
  444. // opacity: 0.3;
  445. // border-radius: 0px 4px 4px 0px;
  446. // position: absolute;
  447. // left: 0;
  448. // top: 50%;
  449. // transform: translateY(-50%);
  450. // }
  451. // }
  452. // .item.unOwner {
  453. // opacity: 0.3;
  454. // cursor: no-drop;
  455. // animation-name: opacityAni2;
  456. // &:hover {
  457. // border-color: transparent;
  458. // .left-label {
  459. // opacity: 0.3;
  460. // }
  461. // .item-cenText .contents {
  462. // opacity: 0.8;
  463. // .subtitle {
  464. // color: #748ba8;
  465. // }
  466. // }
  467. // .right-img {
  468. // opacity: 0.2;
  469. // }
  470. // .img {
  471. // display: block;
  472. // }
  473. // .imghover {
  474. // display: none;
  475. // }
  476. // }
  477. // }
  478. // }
  479. // }
  480. // @keyframes opacityAni {
  481. // 0% {
  482. // opacity: 0;
  483. // }
  484. // 100% {
  485. // opacity: 1;
  486. // }
  487. // }
  488. // @keyframes opacityAni2 {
  489. // 0% {
  490. // opacity: 0;
  491. // }
  492. // 100% {
  493. // opacity: 0.3;
  494. // }
  495. // }
  496. </style>