Onezhan.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540
  1. <template>
  2. <div class="Onezhan">
  3. <!-- 左边的框 -->
  4. <div class="leftList" v-if="oneShow">
  5. <div class="leftCon">
  6. <div class="row" v-for="val in leftData.son" :key="val.id" @click="toZhan(3,leftData.id,val.id,val.code)">
  7. {{ val.name }}
  8. </div>
  9. </div>
  10. </div>
  11. <div class="main">
  12. <p class="botTit">第一展厅</p>
  13. <div
  14. v-for="item in data"
  15. :key="item.id"
  16. @click="boxClick(item)"
  17. :class="{
  18. active: oneShow === item.id,
  19. box6: item.id == 6,
  20. box7: item.id == 7,
  21. }"
  22. >
  23. {{ item.name }}
  24. </div>
  25. </div>
  26. <div class="rightZhan">
  27. <div class="top" @keyup.enter="mySearch">
  28. <el-input placeholder="参展单位搜索" v-model="name"> </el-input>
  29. <div class="el-icon-search" @click="mySearch"></div>
  30. </div>
  31. <div class="cont">
  32. <!-- 搜索结果 -->
  33. <div class="searchResBox" v-if="searShow">
  34. <!-- 关闭按钮 -->
  35. <div
  36. class="searClose el-icon-close"
  37. @click="(searShow = false), (name = '')"
  38. ></div>
  39. <div class="searTiele">搜索结果</div>
  40. <div class="none" v-if="searchData.length === 0">
  41. 没有找到对应结果...
  42. </div>
  43. <div class="searMainBox" v-else>
  44. <div class="searMain" v-for="item in searchData" :key="item.id">
  45. <!-- <div class="searTit">{{ item.name }}</div> -->
  46. <div
  47. class="searRow"
  48. @click="toZhan(3,item.id,val.id,val.code)"
  49. v-for="val in item.son"
  50. :key="val.id"
  51. v-html="val.name"
  52. ></div>
  53. </div>
  54. </div>
  55. </div>
  56. <div
  57. class="contRow"
  58. :class="{
  59. shouqi:
  60. oneShow !== item.id &&
  61. Number(oneShow) - 1 != item.id &&
  62. Number(oneShow) + 1 != item.id &&
  63. oneShow,
  64. base: !oneShow,
  65. }"
  66. v-for="item in rightData"
  67. :key="item.id"
  68. >
  69. <div
  70. @click="sonShow(item.id)"
  71. class="inco"
  72. :class="
  73. item.id == oneShow ? 'el-icon-arrow-up' : 'el-icon-arrow-down'
  74. "
  75. ></div>
  76. <div class="contRowTop">
  77. {{ item.name }}
  78. </div>
  79. <div class="contRowSon" v-if="item.id == oneShow">
  80. <div
  81. @click="toZhan(3,item.id,val.id,val.code)"
  82. v-for="val in item.son"
  83. :key="val.id"
  84. >
  85. {{ val.name }}
  86. </div>
  87. </div>
  88. </div>
  89. </div>
  90. </div>
  91. </div>
  92. </template>
  93. <script>
  94. import { exArr3 } from "./zhan.js";
  95. export default {
  96. name: "Onezhan",
  97. components: {},
  98. data() {
  99. return {
  100. leftData: {},
  101. searShow: false,
  102. name: "",
  103. searchData: [],
  104. data: [
  105. { name: "分区一", id: "1", class: "box1" },
  106. { name: "分区二", id: "2", class: "box2" },
  107. { name: "分区三", id: "3", class: "box3" },
  108. { name: "分区四", id: "4", class: "box4" },
  109. { name: "分区五", id: "5", class: "box5" },
  110. { name: "分区六", id: "6", class: "box6" },
  111. { name: "分区七", id: "7", class: "box7" },
  112. ],
  113. oneShow: null,
  114. rightData: exArr3,
  115. };
  116. },
  117. watch: {
  118. oneShow(val) {
  119. if (val) {
  120. this.leftData = exArr3.find((v) => v.id === val)
  121. let dom = document.querySelector('.leftCon')
  122. if(dom) dom.scrollTop=0
  123. } else this.leftData = {};
  124. },
  125. },
  126. computed: {},
  127. methods: {
  128. toZhan(bs,id1,id2,code){
  129. if(code==='') return this.$message.warning('数据计算中,敬请期待')
  130. this.$emit('toZhan', bs,id1,id2,code)
  131. },
  132. // 方块盒子点击
  133. boxClick(item) {
  134. if (this.oneShow === item.id) return (this.oneShow = null);
  135. this.oneShow = item.id;
  136. this.searShow = false;
  137. this.name = "";
  138. },
  139. mySearch() {
  140. if (this.name.trim() === "") return this.$message.warning("不能为空!");
  141. this.searShow = true;
  142. let arr1 = [];
  143. this.rightData.forEach((v) => {
  144. let arr2 = [];
  145. v.son.forEach((c) => {
  146. if (c.name.includes(this.name)) {
  147. arr2.push({
  148. id: c.id,
  149. name: c.name.replaceAll(
  150. this.name,
  151. `<span style="color:#034c52">${this.name}</span>`
  152. ),
  153. code: c.code,
  154. });
  155. }
  156. });
  157. if (arr2.length > 0) {
  158. arr1.push({
  159. id: v.id,
  160. name: v.name,
  161. son: arr2,
  162. });
  163. }
  164. });
  165. this.searchData = arr1;
  166. },
  167. sonShow(id) {
  168. // if(!this.oneShow) this.oneShow=id
  169. // else this.oneShow=null
  170. if (this.oneShow === id) this.oneShow = null;
  171. else this.oneShow = id;
  172. },
  173. },
  174. //生命周期 - 创建完成(可以访问当前this实例)
  175. created() {
  176. // this.oneShow='1'
  177. },
  178. //生命周期 - 挂载完成(可以访问DOM元素)
  179. mounted() {},
  180. beforeCreate() {}, //生命周期 - 创建之前
  181. beforeMount() {}, //生命周期 - 挂载之前
  182. beforeUpdate() {}, //生命周期 - 更新之前
  183. updated() {}, //生命周期 - 更新之后
  184. beforeDestroy() {}, //生命周期 - 销毁之前
  185. destroyed() {}, //生命周期 - 销毁完成
  186. activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
  187. };
  188. </script>
  189. <style lang='less' scoped>
  190. .Onezhan {
  191. z-index: 9;
  192. position: absolute;
  193. width: 1303px;
  194. height: 560px;
  195. top: 80px;
  196. left: 50%;
  197. transform: translateX(-50%);
  198. background-image: url("../assets/img/zhanBac.png");
  199. background-size: 100% 100%;
  200. .leftList {
  201. position: absolute;
  202. z-index: 15;
  203. top: 0px;
  204. left: -76px;
  205. width: 222px;
  206. height: 558px;
  207. background-image: url("../assets/img/leftList.png");
  208. background-size: 100% 100%;
  209. padding: 40px 14px 40px 20px;
  210. .leftCon::-webkit-scrollbar {
  211. width: 4px;
  212. height: 0px;
  213. }
  214. .leftCon::-webkit-scrollbar-track-piece {
  215. background-color: transparent;
  216. }
  217. .leftCon::-webkit-scrollbar-thumb {
  218. background: #292724;
  219. }
  220. .leftCon {
  221. width: 100%;
  222. height: 100%;
  223. overflow-y: auto;
  224. .row {
  225. cursor: pointer;
  226. width: 85%;
  227. margin: 0 auto;
  228. font-size: 14px;
  229. opacity: 0.8;
  230. color: #fff;
  231. padding: 10px 3px 10px 0;
  232. border-bottom: 1px solid #fff;
  233. text-align: center;
  234. &:hover {
  235. opacity: 1;
  236. color: #c48871;
  237. }
  238. }
  239. }
  240. }
  241. .main {
  242. .botTit {
  243. position: absolute;
  244. bottom: 116px;
  245. left: 490px;
  246. font-size: 20px;
  247. color: #fff;
  248. letter-spacing: 8px;
  249. }
  250. & > div {
  251. z-index: 10;
  252. cursor: pointer;
  253. position: absolute;
  254. background-color: #034c52;
  255. display: flex;
  256. justify-content: center;
  257. align-items: center;
  258. color: rgba(255, 255, 255, 0.7);
  259. transition: all 0.3s;
  260. &:hover {
  261. background-color: #c48871;
  262. color: #fff;
  263. }
  264. &:nth-of-type(1) {
  265. top: 150px;
  266. right: 489px;
  267. width: 184px;
  268. height: 114px;
  269. }
  270. &:nth-of-type(2) {
  271. width: 184px;
  272. height: 109px;
  273. top: 26px;
  274. right: 489px;
  275. }
  276. &:nth-of-type(3) {
  277. width: 94px;
  278. height: 239px;
  279. top: 26px;
  280. right: 683px;
  281. }
  282. &:nth-of-type(4) {
  283. width: 158px;
  284. height: 109px;
  285. top: 26px;
  286. left: 357px;
  287. }
  288. &:nth-of-type(5) {
  289. width: 177px;
  290. height: 114px;
  291. top: 150px;
  292. left: 339px;
  293. }
  294. &:nth-of-type(6) {
  295. background-color: transparent;
  296. z-index: 9;
  297. width: 165px;
  298. height: 161px;
  299. background-image: url("../assets/img/zhan/1_6.png");
  300. background-size: 100% 100%;
  301. top: 151px;
  302. left: 166px;
  303. padding-left: 20px;
  304. &::after {
  305. content: "";
  306. position: absolute;
  307. top: -1px;
  308. right: -8px;
  309. width: 12px;
  310. height: 115px;
  311. }
  312. &:hover {
  313. background-color: transparent;
  314. background-image: url("../assets/img/zhan/1_6Ac.png");
  315. }
  316. }
  317. &:nth-of-type(7) {
  318. z-index: 8;
  319. width: 272px;
  320. height: 204px;
  321. background-color: transparent;
  322. top: 27px;
  323. left: 73px;
  324. background-image: url("../assets/img/zhan/1_7.png");
  325. background-size: 100% 100%;
  326. padding-bottom: 20px;
  327. &:hover {
  328. background-image: url("../assets/img/zhan/1_7Ac.png");
  329. background-color: transparent;
  330. }
  331. }
  332. }
  333. .active {
  334. background-color: #c48871;
  335. }
  336. .box6.active {
  337. background-image: url("../assets/img/zhan/1_6Ac.png");
  338. }
  339. .box7.active {
  340. background-image: url("../assets/img/zhan/1_7Ac.png");
  341. }
  342. }
  343. .rightZhan {
  344. position: absolute;
  345. top: 7px;
  346. right: 10px;
  347. height: 540px;
  348. width: 410px;
  349. padding: 35px 30px;
  350. overflow: hidden;
  351. .top {
  352. padding: 0 15px;
  353. position: relative;
  354. /deep/input {
  355. border-radius: 20px;
  356. }
  357. .el-icon-search {
  358. color: #9a9a9a;
  359. font-weight: 700;
  360. position: absolute;
  361. right: 15px;
  362. z-index: 10;
  363. top: 0;
  364. width: 40px;
  365. height: 40px;
  366. display: flex;
  367. justify-content: center;
  368. align-items: center;
  369. cursor: pointer;
  370. }
  371. }
  372. .cont {
  373. margin-top: 20px;
  374. width: 100%;
  375. height: 420px;
  376. position: relative;
  377. background-color: rgba(112, 112, 112, 0.2);
  378. .searchResBox {
  379. color: #fff;
  380. &::after {
  381. content: "";
  382. position: absolute;
  383. top: 0;
  384. left: 0;
  385. width: 100%;
  386. height: 100%;
  387. z-index: -1;
  388. background-image: linear-gradient(
  389. rgba(69, 114, 119, 0.9),
  390. rgba(69, 114, 119, 0.4)
  391. );
  392. }
  393. position: absolute;
  394. background-image: url("../assets/img/searBac.png");
  395. background-size: 100% 100%;
  396. // background-color: #034c52;
  397. // background-color: rgba(255, 255, 255, 0.3);
  398. // backdrop-filter: blur(30px);
  399. top: 0;
  400. left: 0;
  401. width: 100%;
  402. height: 100%;
  403. z-index: 12;
  404. .searMainBox {
  405. padding: 5px 20px;
  406. width: 96%;
  407. height: calc(100% - 60px);
  408. overflow-y: auto;
  409. .searMain {
  410. .searTit {
  411. height: 30px;
  412. line-height: 30px;
  413. font-size: 20px;
  414. }
  415. .searRow {
  416. padding: 10px 0;
  417. border-bottom: 1px solid #d5d5d5;
  418. cursor: pointer;
  419. &:hover {
  420. color: #034c52;
  421. }
  422. }
  423. }
  424. }
  425. .searMainBox::-webkit-scrollbar {
  426. width: 4px;
  427. height: 0px;
  428. }
  429. .searMainBox::-webkit-scrollbar-track-piece {
  430. background-color: transparent;
  431. }
  432. .searMainBox::-webkit-scrollbar-thumb {
  433. background: #445859;
  434. }
  435. .none {
  436. width: 100%;
  437. height: 300px;
  438. display: flex;
  439. justify-content: center;
  440. align-items: center;
  441. font-size: 20px;
  442. }
  443. .searTiele {
  444. font-size: 20px;
  445. text-align: center;
  446. // color: #034c52;
  447. height: 48px;
  448. line-height: 48px;
  449. }
  450. .searClose {
  451. cursor: pointer;
  452. position: absolute;
  453. z-index: 10;
  454. top: 10px;
  455. right: 10px;
  456. width: 20px;
  457. height: 20px;
  458. color: #034c52;
  459. font-size: 24px;
  460. }
  461. }
  462. .contRow {
  463. width: 100%;
  464. position: relative;
  465. margin-bottom: 6px;
  466. .inco {
  467. z-index: 10;
  468. cursor: pointer;
  469. position: absolute;
  470. width: 100%;
  471. height: 34px;
  472. display: flex;
  473. justify-content: flex-end;
  474. padding-right: 20px;
  475. align-items: center;
  476. top: 0;
  477. right: 0px;
  478. }
  479. .contRowTop {
  480. color: #fff;
  481. height: 34px;
  482. // transition: height 0.1s;
  483. text-align: center;
  484. line-height: 34px;
  485. background-image: url("../assets/img/zhanRBac.png");
  486. background-size: 100% 100%;
  487. font-size: 16px;
  488. }
  489. .contRowSon::-webkit-scrollbar {
  490. width: 4px;
  491. height: 0px;
  492. }
  493. .contRowSon::-webkit-scrollbar-track-piece {
  494. background-color: transparent;
  495. }
  496. .contRowSon::-webkit-scrollbar-thumb {
  497. background: #aeaeae;
  498. }
  499. .contRowSon {
  500. width: 96%;
  501. max-height: 305px;
  502. overflow-y: auto;
  503. padding: 10px 20px 4px 50px;
  504. & > div {
  505. cursor: pointer;
  506. padding: 8px 0;
  507. border-bottom: 1px solid #b7aeae;
  508. &:hover {
  509. color: #c48871;
  510. }
  511. }
  512. }
  513. }
  514. .shouqi {
  515. margin: 0;
  516. .inco {
  517. opacity: 0;
  518. pointer-events: none;
  519. }
  520. .contRowTop {
  521. height: 0px;
  522. overflow: hidden;
  523. }
  524. }
  525. .base {
  526. .contRowTop {
  527. background-image: url("../assets/img/zhanRBac1.png");
  528. }
  529. }
  530. }
  531. }
  532. }
  533. </style>