index.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. <template>
  2. <view :style="{ height: windowHeight + 'px',background:'#1a1a1a'}">
  3. <image src="/static/image/black-bg.png" :style="{ height: windowHeight + 'px',width:'750rpx'}"></image>
  4. <z-paging-swiper :style="{ height: windowHeight - 50 + 'px',width:'750rpx;'}">
  5. <template #top>
  6. <page-navbar>
  7. <template #navLeft>
  8. <view style="background: #90d369;
  9. width: 126rpx;height: 48rpx;
  10. border-radius: 10rpx;
  11. display: flex;flex-direction: row;
  12. align-items: center;
  13. justify-content: space-around;
  14. ">
  15. <image src="/static/icon/caidou.png" mode="" style="width:36rpx;height: 38rpx;">
  16. </image>
  17. <view style="height: 30rpx;border-right: 4rpx #478C2A solid;"></view>
  18. <text style="font-size: 29rpx;color: #478C2A;">437</text>
  19. </view>
  20. </template>
  21. <template #navCenter>
  22. <view style="width: 520rpx;height: 50rpx;margin-left:126rpx;">
  23. <uv-input placeholder="“潮玩大作战” 派对季重磅开启!" border="none"
  24. :custom-style="{background:'#8BDB67',paddingLeft:'20rpx'}" shape="circle">
  25. <template #prefix>
  26. <image src="@/static/icon/fiery.png" style="width: 14px;height: 18px;"></image>
  27. </template>
  28. <template #suffix>
  29. <view style="width: 77rpx;height: 42rpx;
  30. background-color: #57A335;border-radius: 20rpx;
  31. margin-right: 5rpx;display: flex;align-items: center;justify-content: center;">
  32. <image src="@/static/icon/search.png" style="width: 32rpx;height: 32rpx;">
  33. </image>
  34. </view>
  35. </template>
  36. </uv-input>
  37. </view>
  38. </template>
  39. </page-navbar>
  40. <uv-subsection :list="tabList" :current="tabCurrent" @change="tabChange"
  41. custom-style="width:710rpx; margin-left:20rpx;" bgColor="#000000" inactive-color="#ffffff"
  42. active-color="#000000"
  43. custom-item-style="background: #90d369;border-radius: 11rpx;"></uv-subsection>
  44. </template>
  45. <swiper class="swiper" :current="tabCurrent" @change="swiperChange">
  46. <swiper-item class="swiper-item" v-for="(item, index) in tabList" :key="index">
  47. <swiper-item-list :tabIndex="index" :currentIndex="tabCurrent" @query="queryData">
  48. <z-paging-cell>
  49. <view class="classModel">
  50. <view class="classModel-item" @click="goMake">
  51. <image class="classModel-bgimg" src="/static/make/bg-4.png" mode=""></image>
  52. <image class="classModel-img" src="/static/zhHans-text-icon/text-7.png" mode="">
  53. </image>
  54. </view>
  55. <view class="classModel-item" @click="goMake2">
  56. <image class="classModel-bgimg" src="/static/make/bg-4.png" mode=""></image>
  57. <image class="classModel-img" src="/static/zhHans-text-icon/text-5.png" mode="">
  58. </image>
  59. </view>
  60. <view class="classModel-item">
  61. <image class="classModel-bgimg" src="/static/make/bg-4.png" mode=""></image>
  62. <image class="classModel-img" src="/static/zhHans-text-icon/text-6.png" mode="">
  63. </image>
  64. </view>
  65. </view>
  66. </z-paging-cell>
  67. <z-paging-cell>
  68. <view class="history">
  69. <image class="history-img" src="/static/zhHans-text-icon/text-8.png" mode=""></image>
  70. </view>
  71. </z-paging-cell>
  72. <z-paging-cell>
  73. <image src="/static/zhHans-text-icon/text-9.png"
  74. style="width: 452rpx;height: 34rpx;margin:0 0 31rpx 25rpx;"></image>
  75. </z-paging-cell>
  76. <z-paging-cell>
  77. <w-waterfall :data="list">
  78. <template v-slot:content="{item,width}">
  79. <card :item="item" :width="width" :custom-style="{background:'#fff'}"
  80. textColor="#000000"></card>
  81. </template>
  82. </w-waterfall>
  83. </z-paging-cell>
  84. </swiper-item-list>
  85. </swiper-item>
  86. </swiper>
  87. </z-paging-swiper>
  88. <tabbar-view :tabbars="tabbars" :currentIndex="1" ref="tabbar"></tabbar-view>
  89. </view>
  90. </template>
  91. <script>
  92. import sortble from "@/components/sortble/sortble.vue";
  93. import tabbarView from "@/components/tabbar/tabbar.vue";
  94. import pageNavbar from "@/components/page-navbar/page-navbar.vue";
  95. import wWaterfall from "@/components/w-waterfall/w-waterfall.vue";
  96. import tabbar from "@/mixins/tabbar";
  97. import swiperItemList from "@/components/swiper-item-list/swiper-item-list.vue";
  98. import card from "@/components/card/card.vue";
  99. export default {
  100. components: {
  101. sortble,
  102. tabbarView,
  103. pageNavbar,
  104. wWaterfall,
  105. swiperItemList
  106. },
  107. mixins: [tabbar],
  108. data() {
  109. return {
  110. refreshing: false,
  111. loadinging: false,
  112. windowHeight: uni.getWindowInfo().windowHeight,
  113. bannerList: [
  114. 'https://e.zhichao.art/AI_images/1112 (1).png',
  115. 'https://e.zhichao.art/AI_images/1112 (101).png',
  116. 'https://e.zhichao.art/AI_images/1112 (102).png',
  117. ],
  118. cardList: [{
  119. img: '/static/img/img-1.png',
  120. bgimg: '/static/image/bg-2.png'
  121. }, {
  122. img: '/static/img/img-3.png',
  123. bgimg: '/static/image/bg-3.png'
  124. }, {
  125. img: '/static/img/img-2.png',
  126. bgimg: '/static/image/bg-1.png'
  127. }, ],
  128. list: [], // 瀑布流全部数据
  129. dataList: [],
  130. tabList: ['收藏', '关注', '推荐', '音频', '视频', '图片'],
  131. tabCurrent: 0
  132. }
  133. },
  134. onLoad() {
  135. this.getData().then(res => {
  136. this.list = res.data;
  137. });
  138. },
  139. // 下拉刷新数据
  140. methods: {
  141. goMake() {
  142. uni.navigateTo({
  143. url: '/pages/make/make'
  144. })
  145. },
  146. goMake2() {
  147. uni.navigateTo({
  148. url: '/pages/make/make2'
  149. })
  150. },
  151. queryList() {
  152. this.getData().then(res => {
  153. this.list = res.data;
  154. this.$refs.paging.complete(this.list);
  155. });
  156. },
  157. async init() {
  158. const {
  159. data
  160. } = await this.getData();
  161. this.list.push.apply(this.list, data);
  162. },
  163. tabChange(index) {
  164. this.tabCurrent = index;
  165. },
  166. // swiper change时触发
  167. swiperChange(e) {
  168. let current = e.target.current || e.detail.current;
  169. this.tabChange(current);
  170. },
  171. queryData(params) {
  172. const {
  173. pageNo,
  174. pageSize,
  175. type,
  176. complete
  177. } = params;
  178. this.getData(pageNo, pageSize).then(res => {
  179. const dataList = complete(res.data);
  180. this.list = pageNo !== 1 ? [...this.list, ...dataList] : dataList;
  181. });
  182. },
  183. // 模拟的后端数据
  184. getData(pageNo, pageSize) {
  185. return new Promise((resolve) => {
  186. const imgs = [{
  187. url: 'https://e.zhichao.art/AI_images/1112 (103).png',
  188. },
  189. {
  190. url: 'https://e.zhichao.art/AI_images/1112 (104).png',
  191. },
  192. {
  193. url: 'https://e.zhichao.art/AI_images/1112 (106).png',
  194. },
  195. {
  196. url: 'https://e.zhichao.art/AI_images/1112 (109).png',
  197. },
  198. {
  199. url: 'https://e.zhichao.art/AI_images/1112 (111).png',
  200. },
  201. {
  202. url: 'https://e.zhichao.art/AI_images/1112 (112).png',
  203. },
  204. {
  205. url: 'https://e.zhichao.art/AI_images/1112 (116).png',
  206. },
  207. {
  208. url: 'https://e.zhichao.art/AI_images/1112 (106).png',
  209. },
  210. {
  211. url: 'https://e.zhichao.art/AI_images/1112 (109).png',
  212. },
  213. {
  214. url: 'https://e.zhichao.art/AI_images/1112 (111).png',
  215. },
  216. {
  217. url: 'https://e.zhichao.art/AI_images/1112 (112).png',
  218. },
  219. {
  220. url: 'https://e.zhichao.art/AI_images/1112 (116).png',
  221. }
  222. ];
  223. let list = [];
  224. const doFn = (i) => {
  225. const randomIndex = Math.floor(Math.random() * 10);
  226. return {
  227. allowEdit: i == 0,
  228. image: imgs[randomIndex].url,
  229. w: imgs[randomIndex].width,
  230. h: imgs[randomIndex].height,
  231. title: i % 2 == 0 ? `玛丽` : `凌音`,
  232. desc: i % 2 == 0 ?
  233. `欢迎使用uv-ui,uni-app生态专用的UI框架` : `开发者编写一套代码, 可发布到iOS、Android、H5、以及各种小程序`
  234. }
  235. };
  236. // 模拟异步
  237. setTimeout(() => {
  238. for (let i = 0; i < 20; i++) {
  239. list.push(doFn(i));
  240. }
  241. resolve({
  242. data: list
  243. });
  244. }, 200)
  245. })
  246. }
  247. }
  248. }
  249. </script>
  250. <style lang="scss">
  251. .swiper {
  252. flex: 1;
  253. /* #ifndef APP-NVUE */
  254. height: 100%;
  255. /* #endif */
  256. }
  257. .swiper-list-item-n {
  258. /* #ifndef APP-NVUE */
  259. height: 100%;
  260. /* #endif */
  261. }
  262. .classModel {
  263. width: 750rpx;
  264. display: flex;
  265. flex-direction: row;
  266. justify-content: space-around;
  267. margin-top: 28rpx;
  268. margin-bottom: 22rpx;
  269. .classModel-item {
  270. position: relative;
  271. .classModel-bgimg {
  272. width: 216rpx;
  273. height: 190rpx;
  274. }
  275. .classModel-img {
  276. position: absolute;
  277. top: 15rpx;
  278. left: 15rpx;
  279. width: 106rpx;
  280. height: 157rpx;
  281. }
  282. }
  283. }
  284. .history {
  285. width: 657rpx;
  286. height: 163rpx;
  287. background-color: #3f4140;
  288. border-radius: 16rpx;
  289. margin-left: 46.5rpx;
  290. margin-bottom: 62rpx;
  291. display: flex;
  292. justify-content: center;
  293. align-items: center;
  294. .history-img {
  295. width: 100rpx;
  296. height: 96rpx;
  297. }
  298. }
  299. </style>