cate.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  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. type : Object,
  69. value : null
  70. },
  71. index : 0
  72. },
  73. data() {
  74. return {
  75. swiperList: [],
  76. }
  77. },
  78. created() {
  79. this.fetch = this.param;
  80. this.getData();
  81. },
  82. methods:{
  83. getData : function() {
  84. },
  85. choose : function(id) {
  86. if (this.fetch.show[id] == 1) {
  87. return;
  88. }
  89. for(var i in this.fetch.show) {
  90. if (id == i) {
  91. this.fetch.show[id] = 1;
  92. } else {
  93. this.fetch.show[i] = 2;
  94. }
  95. }
  96. },
  97. go : function(index, page_id) {
  98. if (this.page_id != page_id) {
  99. this.Dever.location('dream/view?id=' + this.info_id + '&page_id='+page_id+'&index=' + index);
  100. } else {
  101. this.$emit('goIndex', index);
  102. }
  103. },
  104. },
  105. }
  106. </script>
  107. <style lang="less">
  108. .category-content {
  109. margin-bottom: 20rpx;
  110. }
  111. .category {
  112. .category-wrapper {
  113. width: 100%;
  114. display: flex;
  115. flex-direction: row;
  116. position: absolute;
  117. top: 0;
  118. bottom: 0;
  119. left: 0;
  120. .left-wrapper {
  121. width: 200rpx;
  122. flex: 0 0 200rpx;
  123. background-color: #f6f6f6;
  124. .left-content {
  125. .title-content {
  126. width: 100%;
  127. height: 100rpx;
  128. display: flex;
  129. justify-content: center;
  130. align-items: center;
  131. font-size: 25rpx;
  132. border-bottom: 1px solid #dedede;
  133. cursor: pointer;
  134. &:last-child {
  135. border-bottom: 0;
  136. }
  137. &.onSelected {
  138. background-color: #fff;
  139. position: relative;
  140. color: #feb436;
  141. &::before {
  142. content: '';
  143. position: absolute;
  144. left: 0;
  145. top: 0;
  146. width: 10rpx;
  147. height: 100%;
  148. background: linear-gradient(124deg, #feb436 0%, #fb7c22 100%);
  149. }
  150. }
  151. }
  152. }
  153. }
  154. .right-wrapper {
  155. flex: 1;
  156. .right-content {
  157. width: 100%;
  158. padding: 20rpx 0;
  159. border-left: 1rpx solid #efefef;
  160. box-sizing: border-box;
  161. .banner-wrapper {
  162. padding: 0 20rpx;
  163. .swiper-content {
  164. width: 100%;
  165. height: 180rpx;
  166. margin-bottom: 20rpx;
  167. .swiper-item {
  168. .swiper-img {
  169. width: 100%;
  170. height: 180rpx;
  171. }
  172. }
  173. }
  174. }
  175. .product-wrapper {
  176. .category-item {
  177. .category-title {
  178. height: 60rpx;
  179. font-size: 26rpx;
  180. line-height: 60rpx;
  181. font-weight: 500;
  182. background-color: #f6f6f6;
  183. padding-left: 20rpx;
  184. color: #000;
  185. }
  186. .category-content {
  187. display: flex;
  188. flex-direction: row;
  189. flex-flow: wrap;
  190. padding: 20rpx 20rpx 0;
  191. .product-item {
  192. width: 33%;
  193. display: flex;
  194. flex-direction: column;
  195. justify-content: center;
  196. align-items: center;
  197. margin-bottom: 20rpx;
  198. .product-img {
  199. width: 120rpx;
  200. height: 140rpx;
  201. margin-bottom: 10rpx;
  202. }
  203. .product-title {
  204. font-size: 23rpx;
  205. height: 50rpx;
  206. }
  207. }
  208. }
  209. }
  210. }
  211. }
  212. }
  213. }
  214. }
  215. </style>