index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685
  1. <template>
  2. <div class="wrapper">
  3. <div class="mobileLayout" v-if="isMobile">
  4. <img class="back-icon" @click="$router.push({path:'/'})" :src="`${$cdn}images/back-icon.png`" alt="">
  5. <div class="list-con">
  6. <div class="l-h">
  7. <img :src="`${$cdn}images/icon-story.png`" alt="" />
  8. <p>部件赏析</p>
  9. </div>
  10. <div class="l-type">
  11. <div class="louti">
  12. <span class="txt-bold" id="label-louti" @click="loutiVisible = !loutiVisible">楼体 <svg viewBox='0 0 140 140' width='12' height='12' xmlns='http://www.w3.org/2000/svg'><g><path d='m121.3,34.6c-1.6-1.6-4.2-1.6-5.8,0l-51,51.1-51.1-51.1c-1.6-1.6-4.2-1.6-5.8,0-1.6,1.6-1.6,4.2 0,5.8l53.9,53.9c0.8,0.8 1.8,1.2 2.9,1.2 1,0 2.1-0.4 2.9-1.2l53.9-53.9c1.7-1.6 1.7-4.2 0.1-5.8z' fill='black'/></g></svg></span>
  13. <div class="select-box" id="select-louti" v-if="loutiVisible">
  14. <ul>
  15. <li
  16. :class="{ active: item.id === l_active }"
  17. v-for="(item, i) in louti"
  18. @click="l_active = item.id; loutiVisible = false"
  19. :key="i"
  20. >
  21. {{ item.name }}
  22. </li>
  23. </ul>
  24. </div>
  25. </div>
  26. <div class="area">
  27. <span class="txt-bold" id="label-area" @click="areaVisible = !areaVisible">区域 <svg viewBox='0 0 140 140' width='12' height='12' xmlns='http://www.w3.org/2000/svg'><g><path d='m121.3,34.6c-1.6-1.6-4.2-1.6-5.8,0l-51,51.1-51.1-51.1c-1.6-1.6-4.2-1.6-5.8,0-1.6,1.6-1.6,4.2 0,5.8l53.9,53.9c0.8,0.8 1.8,1.2 2.9,1.2 1,0 2.1-0.4 2.9-1.2l53.9-53.9c1.7-1.6 1.7-4.2 0.1-5.8z' fill='black'/></g></svg></span>
  28. <div class="select-box" id="select-area" v-if="areaVisible">
  29. <ul>
  30. <li
  31. :class="{ active: item.id === a_active }"
  32. v-for="(item, i) in area"
  33. @click="a_active = item.id; areaVisible = false"
  34. :key="i"
  35. >
  36. {{ item.name }}
  37. </li>
  38. </ul>
  39. </div>
  40. </div>
  41. <div class="types">
  42. <span class="txt-bold" id="label-types" @click="typesVisible = !typesVisible">类型 <svg viewBox='0 0 140 140' width='12' height='12' xmlns='http://www.w3.org/2000/svg'><g><path d='m121.3,34.6c-1.6-1.6-4.2-1.6-5.8,0l-51,51.1-51.1-51.1c-1.6-1.6-4.2-1.6-5.8,0-1.6,1.6-1.6,4.2 0,5.8l53.9,53.9c0.8,0.8 1.8,1.2 2.9,1.2 1,0 2.1-0.4 2.9-1.2l53.9-53.9c1.7-1.6 1.7-4.2 0.1-5.8z' fill='black'/></g></svg></span>
  43. <div class="select-box" id="select-types" v-if="typesVisible">
  44. <ul>
  45. <li
  46. :class="{ active: item.id == t_active }"
  47. @click="t_active = item.id; typesVisible = false"
  48. v-for="(item, i) in types"
  49. :key="i"
  50. >
  51. {{ item.name }}
  52. </li>
  53. </ul>
  54. </div>
  55. </div>
  56. </div>
  57. <div class="l-con">
  58. <template v-if="list.length>0">
  59. <Card @handleItem="handleItem(item)" v-for="(item, i) in list" :item="item" :key="i" />
  60. </template>
  61. <template v-else>
  62. <div class="no-result">
  63. <img :src="`${$cdn}images/search-icon.png`" alt />
  64. <span>暂时没有内容呢~</span>
  65. </div>
  66. </template>
  67. </div>
  68. </div>
  69. </div>
  70. <div class="layout" v-if="!isMobile">
  71. <div class="list-con">
  72. <div class="l-h">
  73. <img :src="`${$cdn}images/icon-story.png`" alt="" />
  74. <p>部件赏析</p>
  75. </div>
  76. <div class="l-type">
  77. <div class="louti">
  78. <span class="txt-bold">楼体:</span>
  79. <ul>
  80. <li
  81. :class="{ active: item.id === l_active }"
  82. v-for="(item, i) in louti"
  83. @click="l_active = item.id"
  84. :key="i"
  85. >
  86. {{ item.name }}
  87. </li>
  88. </ul>
  89. </div>
  90. <div class="area">
  91. <span class="txt-bold">区域:</span>
  92. <ul>
  93. <li
  94. :class="{ active: item.id === a_active }"
  95. v-for="(item, i) in area"
  96. @click="a_active = item.id"
  97. :key="i"
  98. >
  99. {{ item.name }}
  100. </li>
  101. </ul>
  102. </div>
  103. <div class="types">
  104. <span class="txt-bold">类型:</span>
  105. <ul>
  106. <li
  107. :class="{ active: item.id == t_active }"
  108. @click="t_active = item.id"
  109. v-for="(item, i) in types"
  110. :key="i"
  111. >
  112. {{ item.name }}
  113. </li>
  114. </ul>
  115. </div>
  116. </div>
  117. <div class="l-con">
  118. <template v-if="list.length>0">
  119. <Card @handleItem="handleItem(item)" v-for="(item, i) in list" :item="item" :key="i" />
  120. </template>
  121. <template v-else>
  122. <div class="no-result">
  123. <img :src="`${$cdn}images/search-icon.png`" alt />
  124. <span>暂时没有内容呢~</span>
  125. </div>
  126. </template>
  127. </div>
  128. <div class="paging" v-if="total" :class="{ pagingshow: total }">
  129. <Paging
  130. @clickHandle="pageChange"
  131. :current="currentPage"
  132. :total="total"
  133. :equable="pageSize"
  134. />
  135. </div>
  136. </div>
  137. <div class="qihuan" @click="$router.push({path:'/story'})">
  138. <img :src="`${$cdn}images/qh-icon.png`" alt />
  139. <p>海报模式</p>
  140. </div>
  141. </div>
  142. </div>
  143. </template>
  144. <script>
  145. import browser from "@/utils/browser.js";
  146. import Paging from "@/components/paging";
  147. import Card from "@/components/card";
  148. let area = [
  149. {
  150. name: "全部",
  151. id: '',
  152. },
  153. {
  154. name: "室内",
  155. id: 'in',
  156. },
  157. {
  158. name: "室外",
  159. id: 'out',
  160. }
  161. ];
  162. let louti = [
  163. {
  164. name: "全部",
  165. id: '',
  166. },
  167. {
  168. name: "东楼",
  169. id: 1,
  170. },
  171. {
  172. name: "西楼",
  173. id: 2,
  174. },
  175. {
  176. name: "钟楼",
  177. id: 3,
  178. }
  179. ];
  180. let list = [
  181. {
  182. name: "全部",
  183. id: "",
  184. },
  185. {
  186. name: "墙饰面",
  187. id: "",
  188. },
  189. {
  190. name: "廊道构件",
  191. id: "",
  192. },
  193. {
  194. name: "栏柱构件",
  195. id: "",
  196. },
  197. {
  198. name: "雕饰构件",
  199. id: "",
  200. },
  201. {
  202. name: "墙面构件",
  203. id: "",
  204. },
  205. {
  206. name: "楼梯构件",
  207. id: "",
  208. },
  209. {
  210. name: "楼梯构件",
  211. id: "",
  212. },
  213. ];
  214. export default {
  215. components: {
  216. Paging,
  217. Card
  218. },
  219. data() {
  220. return {
  221. isMobile: browser.mobile,
  222. area,
  223. types:[],
  224. list,
  225. louti,
  226. a_active: '',
  227. l_active: '',
  228. t_active: this.$route.query.id ||'',
  229. total: 100,
  230. pageSize: 8,
  231. currentPage: 1,
  232. type:'part',
  233. loutiVisible: false,
  234. areaVisible: false,
  235. typesVisible: false
  236. };
  237. },
  238. methods: {
  239. handleItem(){
  240. this.$router.push({
  241. name:'Parts',
  242. query:{
  243. block: this.l_active,
  244. typeId: this.t_active,
  245. zone: this.a_active
  246. }
  247. })
  248. },
  249. pageChange(num) {
  250. this.currentPage = num
  251. },
  252. async getType(){
  253. let res = await this.$http({
  254. type:'get',
  255. url:`/api/web/nav/${this.type}`
  256. })
  257. res.data.unshift({
  258. id:'',
  259. name:'全部'
  260. })
  261. this.types = res.data
  262. },
  263. async getList(){
  264. let res = await this.$http({
  265. method:'post',
  266. data:{
  267. block: this.l_active,
  268. pageNum: this.currentPage,
  269. pageSize: this.isMobile ? 100 : this.pageSize,
  270. searchKey: "",
  271. typeId: this.t_active,
  272. zone: this.a_active
  273. },
  274. url:`/api/web/part/list`
  275. })
  276. this.list = res.data.list
  277. this.total = res.data.total
  278. console.log(this.pageSize);
  279. },
  280. refresh(){
  281. this.currentPage===1?(this.getList()):(this.currentPage = 1)
  282. }
  283. },
  284. watch:{
  285. a_active(){
  286. this.refresh()
  287. },
  288. l_active(){
  289. this.refresh()
  290. },
  291. t_active(){
  292. this.refresh()
  293. },
  294. currentPage(){
  295. this.getList()
  296. }
  297. },
  298. mounted(){
  299. this.getType()
  300. this.getList()
  301. }
  302. };
  303. </script>
  304. <style lang="less" scoped>
  305. @import '../../assets/css/globalVars.less';
  306. .wrapper {
  307. position: fixed;
  308. top: 0;
  309. left: 0;
  310. width: 100%;
  311. height: 100%;
  312. }
  313. .mobileLayout {
  314. width: 100%;
  315. position: relative;
  316. .back-icon {
  317. position: fixed;
  318. top: 40px;
  319. left: 20px;
  320. }
  321. .list-con {
  322. width: 100%;
  323. padding-top: 5vh;
  324. text-align: center;
  325. .l-h {
  326. color: @theme;
  327. font-family: "SY-bold";
  328. font-weight: bolder;
  329. font-size: 0;
  330. img {
  331. width: 110px;
  332. }
  333. p {
  334. font-size: 32px;
  335. }
  336. }
  337. .l-type {
  338. text-align: left;
  339. width: 50%;
  340. margin: 20px 5vw 0;
  341. display: flex;
  342. justify-content: space-between;
  343. .area,
  344. .louti,
  345. .types {
  346. margin-bottom: 20px;
  347. display: flex;
  348. align-items: baseline;
  349. .select-box {
  350. position: fixed;
  351. background-color: #f5ede2;
  352. border-radius: 8px;
  353. z-index: 10;
  354. ul {
  355. display: block;
  356. font-size: 0;
  357. li {
  358. display: block;
  359. padding: 2px 6px;
  360. // margin: 0 6px;
  361. cursor: pointer;
  362. text-align: left;
  363. color: #382e2c;
  364. font-size: 16px;
  365. }
  366. .active {
  367. background: @theme;
  368. color: #c9a27b;
  369. }
  370. }
  371. }
  372. #label-louti {
  373. position: fixed;
  374. top: 18vh;
  375. left: 5vw;
  376. }
  377. #label-area {
  378. position: fixed;
  379. top: 18vh;
  380. left: 25vw;
  381. }
  382. #label-types {
  383. position: fixed;
  384. top: 18vh;
  385. left: 45vw;
  386. }
  387. #select-louti {
  388. top: 21vh;
  389. left: 5vw;
  390. }
  391. #select-area {
  392. top: 21vh;
  393. left: 25vw;
  394. }
  395. #select-types {
  396. top: 21vh;
  397. left: 45vw;
  398. }
  399. }
  400. }
  401. .l-con {
  402. position: fixed;
  403. top: 25vh;
  404. left: 5vw;
  405. width: 93vw;
  406. height: 55vh;
  407. padding: 0;
  408. box-sizing: border-box;
  409. text-align: left;
  410. font-size: 0;
  411. overflow-y: scroll;
  412. }
  413. .paging {
  414. // border-left: #e5e5e5 1px solid;
  415. height: 100%;
  416. margin-bottom: 40px;
  417. transition: all 0.4s ease;
  418. & /deep/ .p-layout {
  419. text-align: center;
  420. margin-top: 10px;
  421. }
  422. & /deep/ .p-layout a:not(:last-child) {
  423. margin: 10px 14px;
  424. display: inline-block;
  425. font-weight: 500;
  426. cursor: pointer;
  427. user-select: none;
  428. position: relative;
  429. transition: color 0.3s;
  430. color: @theme;
  431. font-size: 16px;
  432. }
  433. & /deep/ .p-layout a:last-child {
  434. position: relative;
  435. top: -5px;
  436. display: -ms-inline-flexbox;
  437. display: inline-flex;
  438. -ms-flex-align: center;
  439. align-items: center;
  440. height: 22px;
  441. padding: 0 9px;
  442. }
  443. & /deep/ .p-layout a:last-child::before,
  444. & /deep/ .p-layout a:last-child::after {
  445. content: "";
  446. display: inline-block;
  447. will-change: transform;
  448. transition: transform 0.3s;
  449. }
  450. & /deep/ .p-layout a:not(:last-child).active::after,
  451. & /deep/ .p-layout a:not(:last-child).active,
  452. & /deep/ .p-layout a:not(:last-child):hover,
  453. & /deep/ .p-layout a:not(:last-child):hover::after {
  454. color: @sub-theme;
  455. transform: scaleX(1);
  456. text-align: center;
  457. }
  458. & /deep/ .p-layout a:not(:last-child).active{
  459. position: relative;
  460. width: 29px;
  461. font-size: 14px;
  462. &::after{
  463. position: absolute;
  464. bottom: -2px;
  465. right: 0;
  466. content: '';
  467. width: 100%;
  468. height: 40px;
  469. background: url('@{cdn}page-active.png') no-repeat center center;
  470. z-index: -1;
  471. }
  472. }
  473. }
  474. }
  475. .qihuan{
  476. position: fixed;
  477. right: 250px;
  478. }
  479. }
  480. .layout {
  481. width: calc(100% - 200px);
  482. position: relative;
  483. .list-con {
  484. width: 100%;
  485. padding-top: 80px;
  486. text-align: center;
  487. .l-h {
  488. color: @theme;
  489. font-family: "SY-bold";
  490. font-weight: bolder;
  491. font-size: 0;
  492. img {
  493. width: 110px;
  494. }
  495. p {
  496. font-size: 32px;
  497. }
  498. }
  499. .l-type {
  500. text-align: center;
  501. width: 76%;
  502. margin: 20px auto 0;
  503. display: flex;
  504. justify-content: space-between;
  505. .area,
  506. .louti,
  507. .types {
  508. margin-bottom: 20px;
  509. display: flex;
  510. align-items: baseline;
  511. ul {
  512. display: inline-block;
  513. font-size: 0;
  514. li {
  515. display: inline-block;
  516. padding: 2px 6px;
  517. margin: 0 6px;
  518. cursor: pointer;
  519. text-align: center;
  520. color: #382e2c;
  521. font-size: 16px;
  522. }
  523. .active {
  524. background: @theme;
  525. color: #c9a27b;
  526. }
  527. }
  528. }
  529. }
  530. .l-con {
  531. width: 76%;
  532. margin: 40px auto 0;
  533. box-sizing: border-box;
  534. text-align: left;
  535. font-size: 0;
  536. min-height: 58vh;
  537. }
  538. .paging {
  539. // border-left: #e5e5e5 1px solid;
  540. height: 100%;
  541. margin-bottom: 40px;
  542. transition: all 0.4s ease;
  543. & /deep/ .p-layout {
  544. text-align: center;
  545. margin-top: 10px;
  546. }
  547. & /deep/ .p-layout a:not(:last-child) {
  548. margin: 10px 14px;
  549. display: inline-block;
  550. font-weight: 500;
  551. cursor: pointer;
  552. user-select: none;
  553. position: relative;
  554. transition: color 0.3s;
  555. color: @theme;
  556. font-size: 16px;
  557. }
  558. & /deep/ .p-layout a:last-child {
  559. position: relative;
  560. top: -5px;
  561. display: -ms-inline-flexbox;
  562. display: inline-flex;
  563. -ms-flex-align: center;
  564. align-items: center;
  565. height: 22px;
  566. padding: 0 9px;
  567. }
  568. & /deep/ .p-layout a:last-child::before,
  569. & /deep/ .p-layout a:last-child::after {
  570. content: "";
  571. display: inline-block;
  572. will-change: transform;
  573. transition: transform 0.3s;
  574. }
  575. & /deep/ .p-layout a:not(:last-child).active::after,
  576. & /deep/ .p-layout a:not(:last-child).active,
  577. & /deep/ .p-layout a:not(:last-child):hover,
  578. & /deep/ .p-layout a:not(:last-child):hover::after {
  579. color: @sub-theme;
  580. transform: scaleX(1);
  581. text-align: center;
  582. }
  583. & /deep/ .p-layout a:not(:last-child).active{
  584. position: relative;
  585. width: 29px;
  586. font-size: 14px;
  587. &::after{
  588. position: absolute;
  589. bottom: -2px;
  590. right: 0;
  591. content: '';
  592. width: 100%;
  593. height: 40px;
  594. background: url('@{cdn}page-active.png') no-repeat center center;
  595. z-index: -1;
  596. }
  597. }
  598. }
  599. }
  600. .qihuan{
  601. position: fixed;
  602. right: 250px;
  603. }
  604. }
  605. @media screen and (min-width: 500px) and (max-width: 1400px) {
  606. .layout{
  607. .list-con{
  608. .l-type {
  609. text-align: center;
  610. width: 90%;
  611. display: block;
  612. margin: 10px auto 0;
  613. .area,
  614. .louti,
  615. .types {
  616. margin-bottom: 5px;
  617. display: flex;
  618. align-items: baseline;
  619. ul {
  620. display: inline-block;
  621. font-size: 0;
  622. li {
  623. display: inline-block;
  624. padding: 2px 6px;
  625. margin: 0 6px;
  626. cursor: pointer;
  627. text-align: center;
  628. color: #382e2c;
  629. font-size: 16px;
  630. }
  631. .active {
  632. background: @theme;
  633. color: #c9a27b;
  634. }
  635. }
  636. }
  637. }
  638. .l-con{
  639. width: 90%;
  640. margin: 30px auto 0;
  641. }
  642. }
  643. }
  644. }
  645. @media screen and (max-width: 500px) {
  646. .item {
  647. width: 42.4vw;
  648. margin-right: 5vw;
  649. margin-bottom: 5vw;
  650. &:nth-of-type(2n) {
  651. margin-right: 0;
  652. }
  653. // &:nth-of-type(4n){
  654. // margin-right: @margin;
  655. // }
  656. }
  657. }
  658. </style>