jianzhu.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <template>
  2. <view class="body2">
  3. <u-navbar :autoBack="true" title="建筑文化" bgColor="rgba(255,255,255,0)" :placeholder="true" titleStyle="font-weight:bold;color:#121212"></u-navbar>
  4. <view class="jz_swiper">
  5. <u-swiper
  6. :list="list1"
  7. height="335rpx"
  8. :indicator="true"
  9. :autoplay="true"
  10. indicatorMode="dot"
  11. indicatorActiveColor="#fff"
  12. indicatorInactiveColor="rgba(255, 255, 255, 0.35)"
  13. :circular="true"
  14. indicatorStyle="bottom: 10px"
  15. ></u-swiper>
  16. </view>
  17. <view class="" style="margin: 30rpx 0 0 0">
  18. <u-tabs
  19. :duration="200"
  20. :list="listTab"
  21. :lineWidth="25"
  22. :lineHeight="12"
  23. lineColor="#4E7198"
  24. :lineColor="`url(${tabImg}) 100% 100%`"
  25. :activeStyle="{
  26. color: '#4E7198',
  27. fontSize: '34rpx'
  28. }"
  29. ></u-tabs>
  30. </view>
  31. <view class="banxin">
  32. <view style="margin-bottom: 30rpx" v-for="(item, index) in jianZhuList" :key="item">
  33. <view @click="buildBtn(index)" class="jz_item">
  34. <image style="width: 100%; height: 100%" :src="item.thumbnail"></image>
  35. </view>
  36. <view class="" style="width: 650rpx; display: flex; justify-content: space-between">
  37. <view>{{ item.title }}</view>
  38. <view class="" style="display: flex; align-items: center; justify-content: space-evenly">
  39. <uni-icons type="heart-filled" color="#ca5642" size="20"></uni-icons>
  40. <text style="font-size: 28rpx">{{ item.likes }}</text>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. </template>
  47. <script>
  48. let that;
  49. export default {
  50. data() {
  51. return {
  52. isLoading: false, // 节流阀 默认为关闭状态
  53. main_body_id: '',
  54. page: '1',
  55. model_id: '',
  56. tabImg: 'https://huli-app.wenlvti.net/app_static/minnanhun/image/tab.png',
  57. list1: [
  58. 'https://img1.baidu.com/it/u=3551075903,1493549593&fm=253&fmt=auto&app=138&f=JPEG?w=667&h=500',
  59. 'https://img0.baidu.com/it/u=1667631211,245764236&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=357',
  60. 'https://img1.baidu.com/it/u=2554021422,1871009309&fm=253&fmt=auto&app=138&f=JPEG?w=700&h=500'
  61. ],
  62. listTab: [
  63. {
  64. name: '全部',
  65. tabid: 1
  66. },
  67. {
  68. name: '民居大厝',
  69. tabid: 2
  70. },
  71. {
  72. name: '宫殿建筑',
  73. tabid: 3
  74. },
  75. {
  76. name: '礼制性祭祀建筑',
  77. tabid: 4
  78. },
  79. {
  80. name: '百家争鸣',
  81. tabid: 5
  82. }
  83. ],
  84. jianZhuList: []
  85. };
  86. },
  87. onLoad(o) {
  88. console.log(o, 'ooooooooo');
  89. that = this;
  90. this.model_id = o.id;
  91. this.main_body_id = this.$db.get('main_body_id');
  92. this.getColumnList(o.id);
  93. this.getContentList(o.id);
  94. },
  95. onReachBottom() {
  96. if (this.isLoading) {
  97. return;
  98. } else {
  99. // 每次触发上拉触底 请求的页码 自加一
  100. this.page++;
  101. // 重新请求数据
  102. this.getContentList();
  103. }
  104. },
  105. methods: {
  106. // 栏目列表
  107. getColumnList(id) {
  108. this.$api.getColumnList(
  109. {
  110. model_id: 1,
  111. main_body_id: this.main_body_id
  112. },
  113. function (res) {
  114. let a = {
  115. diyname: 'crzx',
  116. id: '',
  117. image: '',
  118. name: '全部'
  119. };
  120. that.listTab = res.data;
  121. that.listTab.unshift(a);
  122. // console.log(that.listTab, '全部');
  123. }
  124. );
  125. },
  126. // 栏目内容列表
  127. getContentList(id) {
  128. this.isLoading = true;
  129. this.$api.getContentList(
  130. {
  131. model_id: 1,
  132. main_body_id: this.main_body_id,
  133. page: this.page,
  134. pageSize: '10'
  135. },
  136. function (res) {
  137. // 关闭节流阀
  138. that.isLoading = false;
  139. // console.log(res, '内容列表');
  140. that.jianZhuList = [...that.jianZhuList, ...res.data];
  141. }
  142. );
  143. },
  144. // 建筑详情
  145. buildBtn(i) {
  146. uni.navigateTo({
  147. url: this.jianZhuList[i].page
  148. });
  149. }
  150. }
  151. };
  152. </script>
  153. <style>
  154. .body2 {
  155. background-size: 100% 100%;
  156. background-attachment: fixed;
  157. background-repeat: repeat-y;
  158. background-color: #efefef;
  159. padding-bottom: 50rpx;
  160. }
  161. /deep/.u-swiper-indicator__wrapper__dot--active {
  162. width: 5px !important;
  163. }
  164. /deep/.u-tabs__wrapper__nav__item.data-v-48634e29 {
  165. padding: 0 40rpx !important;
  166. }
  167. /deep/.u-tabs__wrapper__nav__line.data-v-48634e29 {
  168. bottom: 16rpx !important;
  169. }
  170. /deep/.u-tabs__wrapper__nav__item.data-v-48634e29 {
  171. align-items: end !important;
  172. }
  173. .banxin {
  174. margin: 0 32rpx 0 32rpx;
  175. }
  176. .jz_swiper {
  177. }
  178. .jz_item {
  179. width: 686rpx;
  180. height: 345rpx;
  181. border-radius: 26rpx 26rpx 0rpx 0rpx;
  182. }
  183. </style>