chuanCheng.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. <template>
  2. <view class="">
  3. <view class="box">
  4. <view class="box_top">
  5. <image style="width: 100%; height: 100%" src="https://huli-app.wenlvti.net/app_static/minnanhun/image/ccbg.png"></image>
  6. </view>
  7. <view class="gy_box" @click="tougaoBtn">
  8. <view class="">投稿</view>
  9. <uni-icons type="compose" size="22" color="#ffffff"></uni-icons>
  10. </view>
  11. <view class="box_search" @click="searchBtn">
  12. <view class="">
  13. <uni-icons type="search" size="20"></uni-icons>
  14. </view>
  15. <view class="">请输入搜索内容</view>
  16. </view>
  17. <view class="box_tab">
  18. <u-tabs
  19. @click="tabsBtn"
  20. :duration="200"
  21. :list="listTab"
  22. :lineWidth="25"
  23. :lineHeight="12"
  24. lineColor="#4E7198"
  25. :lineColor="`url(${tabImg}) 100% 100%`"
  26. :activeStyle="{
  27. color: '#4E7198',
  28. fontSize: '34rpx'
  29. }"
  30. ></u-tabs>
  31. </view>
  32. <uv-waterfall ref="waterfall" v-model="list" :add-time="10" left-gap="10" right-gap="10" :column-gap="columnGap" @changeList="changeList">
  33. <template v-slot:list1>
  34. <view>
  35. <view @click="detailsBtn(index)" v-for="(item, index) in list1" :key="item.id" class="waterfall-item">
  36. <view class="waterfall-item__image" :style="[imageStyle(item)]">
  37. <image :src="item.image" mode="widthFix" style="border-radius: 25rpx 60rpx 0rpx 30rpx" :style="{ width: item.width + 'px' }"></image>
  38. </view>
  39. <view class="waterfall-item__ft">
  40. <view class="waterfall-item__ft__title">
  41. <text class="value">{{ item.title }}</text>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. </template>
  47. <template v-slot:list2>
  48. <view>
  49. <view @click="detailsBtn2(index)" v-for="(item, index) in list2" :key="item.id" class="waterfall-item">
  50. <view class="waterfall-item__image" :style="[imageStyle(item)]">
  51. <image :src="item.image" mode="widthFix" style="border-radius: 25rpx 60rpx 0rpx 30rpx" :style="{ width: item.width + 'px' }"></image>
  52. </view>
  53. <view class="waterfall-item__ft">
  54. <view class="waterfall-item__ft__title">
  55. <text class="value">{{ item.title }}</text>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. </template>
  61. </uv-waterfall>
  62. </view>
  63. <mntabBar footerTab="2" :messageCount="0"></mntabBar>
  64. </view>
  65. </template>
  66. <script>
  67. import { mapState } from 'vuex';
  68. let that;
  69. export default {
  70. components: {},
  71. data() {
  72. return {
  73. main_body_id: '',
  74. tabImg: 'https://huli-app.wenlvti.net/app_static/minnanhun/image/tab.png',
  75. model_id: '',
  76. list: [],
  77. list1: [], // 瀑布流第一列数据
  78. list2: [], // 瀑布流第二列数据
  79. columnGap: 10,
  80. listTab: [
  81. {
  82. name: '非遗',
  83. tabid: 2
  84. },
  85. {
  86. name: '建筑',
  87. tabid: 1
  88. }
  89. // {
  90. // name: '书法',
  91. // tabid: 1
  92. // },
  93. // {
  94. // name: '戏曲',
  95. // tabid: 2
  96. // },
  97. // {
  98. // name: '文化',
  99. // tabid: 4
  100. // },
  101. // {
  102. // name: '创作',
  103. // tabid: 5
  104. // }
  105. ]
  106. };
  107. },
  108. onLoad(option) {
  109. that = this;
  110. this.main_body_id = this.$db.get('main_body_id');
  111. this.getContentList();
  112. },
  113. computed: {
  114. imageStyle(item) {
  115. return (item) => {
  116. const v = uni.upx2px(750) - this.leftGap - this.rightGap - this.columnGap;
  117. const w = v / 2;
  118. const rate = w / item.w;
  119. const h = rate * item.h;
  120. return {
  121. width: w + 'px',
  122. height: h + 'px'
  123. };
  124. };
  125. }
  126. },
  127. methods: {
  128. // 栏目内容列表
  129. getContentList(id) {
  130. this.$api.getContentList(
  131. {
  132. model_id: id ? id : 2,
  133. main_body_id: this.main_body_id,
  134. page: 1,
  135. pageSize: '10'
  136. },
  137. function (res) {
  138. that.list = res.data;
  139. that.model_id = res.data[0].model_id;
  140. // console.log(that.model_id, 'that.model_id');
  141. }
  142. );
  143. },
  144. detailsBtn(i) {
  145. uni.navigateTo({
  146. url: this.list1[i].page
  147. });
  148. },
  149. detailsBtn2(i) {
  150. uni.navigateTo({
  151. url: this.list2[i].page
  152. });
  153. },
  154. tabsBtn(i) {
  155. that.list = [];
  156. that.$refs.waterfall.clear();
  157. that.list1 = [];
  158. that.list2 = [];
  159. // this.id1 = index.id;
  160. this.getContentList(this.listTab[i.index].tabid);
  161. },
  162. changeList(e) {
  163. this[e.name].push(e.value);
  164. },
  165. searchBtn() {
  166. uni.navigateTo({
  167. url: '/chuanCheng_fenbao/search?id=' + this.model_id
  168. });
  169. },
  170. tougaoBtn() {
  171. uni.navigateTo({
  172. url: '/chuanCheng_fenbao/touGao'
  173. });
  174. }
  175. }
  176. };
  177. </script>
  178. <style>
  179. .body {
  180. /* background-image: url('https://huli-app.wenlvti.net/uploads/20230512/88f8347924d08296bbde9d55afd74c15.jpg');
  181. background-size: 100% 100%; */
  182. background-attachment: fixed;
  183. }
  184. /deep/.u-tabs__wrapper__nav__item.data-v-48634e29 {
  185. padding: 0 40rpx !important;
  186. }
  187. /deep/.u-tabs__wrapper__nav__line.data-v-48634e29 {
  188. bottom: 16rpx !important;
  189. }
  190. /deep/.u-tabs__wrapper__nav__item.data-v-48634e29 {
  191. align-items: end !important;
  192. }
  193. /deep/.column-value.data-v-ddfcbb1c {
  194. border-radius: 25rpx 60rpx 0rpx 30rpx !important;
  195. }
  196. .box {
  197. height: auto;
  198. width: 100%;
  199. background-color: #eff6ff;
  200. background-attachment: fixed;
  201. border-radius: 16px 16px 0 0;
  202. position: relative;
  203. display: flex;
  204. flex-direction: column;
  205. }
  206. .box_top {
  207. width: 100%;
  208. height: 410rpx;
  209. }
  210. .box_search {
  211. display: flex;
  212. align-items: center;
  213. padding-left: 20rpx;
  214. box-sizing: border-box;
  215. width: 685rpx;
  216. height: 80rpx;
  217. color: #999999;
  218. font-size: 28rpx;
  219. background-color: #ffffff;
  220. z-index: 2;
  221. border-radius: 40rpx;
  222. margin: -90rpx 32rpx 0 34rpx;
  223. }
  224. .box_tab {
  225. margin: 45rpx 32rpx 20rpx 32rpx;
  226. }
  227. .gy_box {
  228. width: 160rpx;
  229. height: 60rpx;
  230. display: flex;
  231. align-items: center;
  232. position: absolute;
  233. top: 240rpx;
  234. right: 0;
  235. padding-left: 10rpx;
  236. font-size: 28rpx;
  237. font-family: MiSans, MiSans;
  238. font-weight: 500;
  239. color: #ffffff;
  240. justify-content: space-evenly;
  241. line-height: 44rpx;
  242. z-index: 11;
  243. border-radius: 20rpx 0rpx 0rpx 20rpx;
  244. background-color: #ca5642;
  245. }
  246. .waterfall-item__ft__title {
  247. width: 100%;
  248. height: 65rpx;
  249. position: absolute;
  250. bottom: 0;
  251. left: 0;
  252. line-height: 65rpx;
  253. background-color: #ca5642;
  254. font-size: 30rpx;
  255. text-align: center;
  256. color: #ffffff;
  257. border-radius: 0 0 10rpx 10rpx;
  258. }
  259. .waterfall-item__ft {
  260. position: relative;
  261. }
  262. .waterfall-item {
  263. margin-bottom: 30rpx;
  264. }
  265. </style>