H5Mall.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <template>
  2. <el-scrollbar class="H5Mall">
  3. <div class="search line">
  4. <el-icon :size="25" class="searchIcon"><Search /></el-icon>
  5. <input
  6. class="searchinput"
  7. type="text"
  8. placeholder="请输入搜索内容"
  9. v-model="searchText"
  10. />
  11. </div>
  12. <div class="main">
  13. <div
  14. class="item"
  15. @click="() => toH5Editor(item)"
  16. v-for="(item, index) in list"
  17. :key="index"
  18. >
  19. <component :is="components[item.type]" :item="item"></component>
  20. <div class="main_item" v-text="item.title"></div>
  21. <div class="body">
  22. <img style="width: 20px; float: left" :src="defaultIcon" />
  23. <span>
  24. <img style="width: 20px" :src="eyeIcon" />
  25. <span style="vertical-align: middle" v-text="item.hot"></span>
  26. </span>
  27. </div>
  28. </div>
  29. </div>
  30. </el-scrollbar>
  31. </template>
  32. <script setup>
  33. import { ref } from 'vue';
  34. import { useRouter } from 'vue-router';
  35. import defaultIcon from '../../assets/img/default_user.png';
  36. import eyeIcon from '../../assets/img/eye.png';
  37. import H5 from './components/H5.vue';
  38. import LONGPAGE from './components/LONGPAGE.vue';
  39. import POSTER from './components/POSTER.vue';
  40. import { getH5Mall } from '../../api/index.js';
  41. const components = {
  42. H5,
  43. LONGPAGE,
  44. POSTER,
  45. };
  46. const router = useRouter();
  47. // const route = useRoute();
  48. const searchText = ref('');
  49. const list = ref([]);
  50. getH5Mall({}).then(r => {
  51. list.value = r.list || [];
  52. });
  53. const toH5Editor = item => {
  54. router.push({
  55. path: '/h5editor',
  56. query: {
  57. item: JSON.stringify(item),
  58. },
  59. });
  60. };
  61. </script>
  62. <style scoped>
  63. .H5Mall {
  64. padding: 1em;
  65. height: 100%;
  66. }
  67. .searchinput {
  68. outline: none;
  69. border: none;
  70. height: 40px;
  71. line-height: 40px;
  72. font-size: 16px;
  73. display: block;
  74. width: 100%;
  75. }
  76. .search {
  77. width: 60%;
  78. margin: 0 auto;
  79. font-size: 0;
  80. height: 40px;
  81. line-height: 40px;
  82. border-radius: 20px;
  83. padding: 0 50px 0 20px;
  84. position: relative;
  85. overflow: hidden;
  86. border: 1px solid var(--el-border-color);
  87. }
  88. .searchIcon {
  89. position: absolute;
  90. right: 15px;
  91. top: 5px;
  92. color: var(--el-border-color);
  93. }
  94. .main {
  95. font-weight: 500;
  96. margin-top: 1em;
  97. padding: 1em 0 1em 1em;
  98. }
  99. .main .item {
  100. display: inline-block;
  101. width: 184px;
  102. height: 363px;
  103. transition: all 0.3s;
  104. border-radius: 2px;
  105. vertical-align: middle;
  106. margin-right: 1em;
  107. border-radius: 5px;
  108. overflow: hidden;
  109. cursor: pointer;
  110. box-shadow: var(--el-box-shadow-lighter);
  111. }
  112. .el-image {
  113. height: 280px;
  114. }
  115. .main_item {
  116. color: #666;
  117. padding: 0 5px;
  118. margin: 5px 0;
  119. font-size: 14px;
  120. overflow: hidden;
  121. white-space: nowrap;
  122. text-overflow: ellipsis;
  123. }
  124. .main .item:hover {
  125. box-shadow: var(--el-box-shadow);
  126. margin-top: -15px;
  127. }
  128. .main .body {
  129. padding: 0 5px;
  130. text-align: right;
  131. }
  132. .main img {
  133. vertical-align: middle;
  134. }
  135. </style>