index.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <template>
  2. <div
  3. class="com-main"
  4. element-loading-text="Loading"
  5. v-loading="listLoading">
  6. <div class="com-width-1400 com-margin-auto">
  7. <div class="metal-hardPlastic">
  8. <div class="metal-title">
  9. <p>Search Results</p>
  10. <div>
  11. <div class="sort">
  12. <el-dropdown
  13. trigger="click"
  14. @command="handleCommand">
  15. <span class="el-dropdown-link">
  16. Sort by {{ command }}
  17. <i class="el-icon-arrow-down el-icon--right"></i>
  18. </span>
  19. <el-dropdown-menu slot="dropdown">
  20. <el-dropdown-item
  21. v-for="command in commandList"
  22. :command="command.value"
  23. :key="command.label"
  24. >{{ command.label }}
  25. </el-dropdown-item>
  26. </el-dropdown-menu>
  27. </el-dropdown>
  28. </div>
  29. </div>
  30. </div>
  31. <div class="metal-content">
  32. <div class="metal-content-left">
  33. <category-filter
  34. :leadTimeList="leadTimeList"
  35. :colourList="colourList"
  36. :collectionsList="collectionsList"
  37. :complianceList="complianceList"
  38. :featureList="featureList"
  39. :decorationList="decorationList"
  40. :priceRange1="priceRange1"
  41. :priceRange2="priceRange2"
  42. @reset="reset"
  43. @getList="getList"
  44. @handleChangeColor="handleChangeColor"
  45. @handleChangeFeature="handleChangeFeature"
  46. @handleChangePrice="handleChangePrice"
  47. @handleChangeCollection="handleChangeCollection"
  48. @handleChangeCompliance="handleChangeCompliance"
  49. @handleChangeDecoration="handleChangeDecoration"
  50. @handleChangeLeadtime="handleChangeLeadtime"
  51. @handleChangeQuantity="handleChangeQuantity"></category-filter>
  52. </div>
  53. <div
  54. v-if="listLoading"
  55. class="metal-content-right"></div>
  56. <div
  57. class="metal-content-right"
  58. v-show="cardList.length > 0 && !listLoading">
  59. <div class="metal-content-right-item">
  60. <card
  61. class="card"
  62. v-for="(item, index) in cardList"
  63. :key="parseInt(index)"
  64. :cardData="item"></card>
  65. <transition
  66. @before-enter="beforeEnter"
  67. @enter="enter"
  68. @after-enter="afterEnter">
  69. <div
  70. class="ball"
  71. v-show="shopCarBall"
  72. ref="ball">
  73. <div class="linner_ball"></div>
  74. </div>
  75. </transition>
  76. </div>
  77. <!-- <pagination
  78. v-show="total > 0"
  79. :total="total"
  80. :page.sync="listQuery.page"
  81. :limit.sync="listQuery.limit"
  82. @pagination="getList"
  83. /> -->
  84. <infinite-loading
  85. spinner="spiral"
  86. @infinite="infiniteHandler"
  87. :identifier="computedProductList"
  88. :distance="200"
  89. class="infinite-loading-wrap">
  90. <div
  91. v-loading="true"
  92. slot="spinner"
  93. element-loading-text="Loading"
  94. element-loading-spinner="el-icon-loading"></div>
  95. <div
  96. class="loading-text"
  97. slot="no-more"></div>
  98. <div
  99. slot="error"
  100. slot-scope="{ trigger }">
  101. Error Data, click
  102. <a
  103. href="javascript:;"
  104. @click="trigger"
  105. >here</a
  106. >
  107. toretry
  108. </div>
  109. </infinite-loading>
  110. </div>
  111. <div
  112. class="metal-content-right-item empty"
  113. v-show="cardList.length === 0 && !listLoading">
  114. <category-no-data></category-no-data>
  115. </div>
  116. </div>
  117. </div>
  118. </div>
  119. </div>
  120. </template>
  121. <script>
  122. import InfiniteLoading from 'vue-infinite-loading'
  123. import categoryMixin from '@/mixins/category'
  124. export default {
  125. components: {
  126. InfiniteLoading,
  127. },
  128. mixins: [categoryMixin],
  129. data() {
  130. return {
  131. listLoading: true,
  132. activeNames: ['1'],
  133. cardList: [],
  134. priceList: [],
  135. shopCarBall: false,
  136. shopCarBallEl: null,
  137. ss: null,
  138. }
  139. },
  140. watch: {},
  141. async created() {},
  142. methods: {
  143. addCompareList(target) {
  144. this.shopCarBallEl = target
  145. this.shopCarBall = true
  146. },
  147. // 动画开始
  148. beforeEnter(el) {
  149. // 获取元素的大小及其相对于视口的位置
  150. if (process.client) {
  151. const dom = this.shopCarBallEl.getBoundingClientRect()
  152. const comparePosition = document
  153. .querySelector('.compare-list')
  154. .getBoundingClientRect()
  155. const offsetX = comparePosition.left - dom.left
  156. const offsetY = dom.top - comparePosition.top - 20
  157. el.style.display = ''
  158. // y轴是曲直向上的,x轴是蜿蜒的向右的
  159. el.style.transform = `translate3D( -${offsetX}px,${offsetY}px,0)`
  160. }
  161. },
  162. enter(el, done) {
  163. // 触发重绘,来实现动画的移动过程
  164. if (process.client) {
  165. this.ss = document.body.offsetHeight
  166. el.style.transform = `translate3D( 0,0,0)`
  167. el.addEventListener('transitionend', done)
  168. }
  169. },
  170. afterEnter(el) {
  171. this.shopCarBall = false
  172. el.style.display = 'none'
  173. },
  174. },
  175. }
  176. </script>
  177. <style lang="scss" scoped>
  178. .com-main a img {
  179. width: 100%;
  180. height: 450px;
  181. }
  182. @import './category.scss';
  183. </style>