cate.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. <template name="cate">
  2. <view slot="links">
  3. <view class="category">
  4. <view class="category-wrapper" v-if="fetch.cate.length>0">
  5. <!-- 左边导航 -->
  6. <scroll-view scroll-y="true" class="left-wrapper" scroll-with-animation="true">
  7. <view class="left-content">
  8. <view class="title-content" :class="fetch.show[v.id] == 1?'onSelected':''" v-for="(v,k) in fetch.cate" :key="v.id" @click="choose(v.id)">{{v.name}}</view>
  9. </view>
  10. </scroll-view>
  11. <!-- 右边内容 -->
  12. <scroll-view scroll-y="true" class="right-wrapper" scroll-with-animation="true">
  13. <view class="right-content">
  14. <!-- banner区域 -->
  15. <view class="banner-wrapper" v-if="swiperList.length > 0">
  16. <swiper class="swiper-content" :autoplay="true" :interval="3000" :circular="true">
  17. <swiper-item class="swiper-item" v-for="imgs in swiperList" :key="imgs.id">
  18. <image class="swiper-img" :src="imgs.src"></image>
  19. </swiper-item>
  20. </swiper>
  21. </view>
  22. <!-- 产品区 -->
  23. <view class="product-wrapper">
  24. <view class="category-item" :id="'list'+v.id" v-for="(v,k) in fetch.child" :key="k" v-if="fetch.show[v.page_id] == 1">
  25. <view class="category-title">{{v.name}}</view>
  26. <view class="category-content" v-if="v.content">
  27. <view class="product-item" v-for="(v1,k1) in v.content" :key="k1" @click="go(k1,v1.page_id)">
  28. <image class="product-img" :src="v1.pic"></image>
  29. <text class="product-title">{{v1.name}}</text>
  30. </view>
  31. </view>
  32. <view class="category-content" v-if="!v.content">
  33. 敬请期待
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </scroll-view>
  39. </view>
  40. </view>
  41. </view>
  42. </template>
  43. <script>
  44. export default {
  45. name: "cate",
  46. props: {
  47. info_id : {
  48. type : String,
  49. value : null
  50. },
  51. content_id : {
  52. type : String,
  53. value : null
  54. },
  55. page_id : {
  56. type : String,
  57. value : null
  58. },
  59. parent_page_id : {
  60. type : String,
  61. value : null
  62. },
  63. width : {
  64. type : String,
  65. default : '100%'
  66. },
  67. param : {},
  68. index : 0
  69. },
  70. data() {
  71. return {
  72. swiperList: [],
  73. }
  74. },
  75. created() {
  76. this.fetch = this.param;
  77. this.getData();
  78. },
  79. methods:{
  80. getData : function() {
  81. },
  82. choose : function(id) {
  83. if (this.fetch.show[id] == 1) {
  84. return;
  85. }
  86. for(var i in this.fetch.show) {
  87. if (id == i) {
  88. this.fetch.show[id] = 1;
  89. } else {
  90. this.fetch.show[i] = 2;
  91. }
  92. }
  93. },
  94. go : function(index, page_id) {
  95. if (this.page_id != page_id) {
  96. this.Dever.location('dream/view?id=' + this.info_id + '&page_id='+page_id+'&index=' + index);
  97. } else {
  98. this.$emit('goIndex', index);
  99. }
  100. },
  101. },
  102. }
  103. </script>
  104. <style lang="less">
  105. .category-content {
  106. margin-bottom: 20rpx;
  107. }
  108. .category {
  109. .category-wrapper {
  110. width: 100%;
  111. display: flex;
  112. flex-direction: row;
  113. position: absolute;
  114. top: 0;
  115. bottom: 0;
  116. left: 0;
  117. .left-wrapper {
  118. width: 200rpx;
  119. flex: 0 0 200rpx;
  120. background-color: #f6f6f6;
  121. .left-content {
  122. .title-content {
  123. width: 100%;
  124. height: 100rpx;
  125. display: flex;
  126. justify-content: center;
  127. align-items: center;
  128. font-size: 25rpx;
  129. border-bottom: 1px solid #dedede;
  130. cursor: pointer;
  131. &:last-child {
  132. border-bottom: 0;
  133. }
  134. &.onSelected {
  135. background-color: #fff;
  136. position: relative;
  137. color: #feb436;
  138. &::before {
  139. content: '';
  140. position: absolute;
  141. left: 0;
  142. top: 0;
  143. width: 10rpx;
  144. height: 100%;
  145. background: linear-gradient(124deg, #feb436 0%, #fb7c22 100%);
  146. }
  147. }
  148. }
  149. }
  150. }
  151. .right-wrapper {
  152. flex: 1;
  153. .right-content {
  154. width: 100%;
  155. padding: 20rpx 0;
  156. border-left: 1rpx solid #efefef;
  157. box-sizing: border-box;
  158. .banner-wrapper {
  159. padding: 0 20rpx;
  160. .swiper-content {
  161. width: 100%;
  162. height: 180rpx;
  163. margin-bottom: 20rpx;
  164. .swiper-item {
  165. .swiper-img {
  166. width: 100%;
  167. height: 180rpx;
  168. }
  169. }
  170. }
  171. }
  172. .product-wrapper {
  173. .category-item {
  174. .category-title {
  175. height: 60rpx;
  176. font-size: 26rpx;
  177. line-height: 60rpx;
  178. font-weight: 500;
  179. background-color: #f6f6f6;
  180. padding-left: 20rpx;
  181. color: #000;
  182. }
  183. .category-content {
  184. display: flex;
  185. flex-direction: row;
  186. flex-flow: wrap;
  187. padding: 20rpx 20rpx 0;
  188. .product-item {
  189. width: 33%;
  190. display: flex;
  191. flex-direction: column;
  192. justify-content: center;
  193. align-items: center;
  194. margin-bottom: 20rpx;
  195. .product-img {
  196. width: 120rpx;
  197. height: 140rpx;
  198. margin-bottom: 10rpx;
  199. }
  200. .product-title {
  201. font-size: 23rpx;
  202. height: 50rpx;
  203. }
  204. }
  205. }
  206. }
  207. }
  208. }
  209. }
  210. }
  211. }
  212. </style>