Onezhan.vue 12 KB

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