index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537
  1. <template>
  2. <view :style="{ height: windowHeight + 'px'}">
  3. <view style="display: flex;justify-content: flex-end;">
  4. <view class="view0 step1"></view>
  5. </view>
  6. <view class="view1 step2"></view>
  7. <view class="view2 step3"></view>
  8. <view class="view3 step4"></view>
  9. <view class="view4 step5"></view>
  10. <view class="view5 step6"></view>
  11. <view style="display: flex;justify-content: flex-end;">
  12. <view class="view6 step7"></view>
  13. </view>
  14. <image src="@/static/image/white-bg.png" :style="{ height: windowHeight + 'px',width:'750rpx'}"></image>
  15. <z-paging ref="paging" v-model="dataList" @query="queryList" :style="{ height: windowHeight - 50 + 'px'}"
  16. :show-scrollbar="false">
  17. <template #top>
  18. <page-navbar>
  19. <template #navLeft>
  20. <view style="display:flex;flex-direction: row;justify-content: center; align-items: center;">
  21. <image src="@/static/icon/loacltion.png" style="width: 30rpx; height: 38rpx;"></image>
  22. <text style="margin-left:10rpx;font-size: 28rpx;">
  23. 杭州
  24. </text>
  25. <image src="@/static/icon/down.png" style="width: 30rpx; height: 16rpx;"></image>
  26. </view>
  27. </template>
  28. <template #navCenter>
  29. <view style="width: 520rpx;height: 50rpx;margin-left:126rpx;">
  30. <uv-input placeholder="“潮玩大作战” 派对季重磅开启!" border="none"
  31. :custom-style="{background:'#8BDB67',paddingLeft:'20rpx'}" shape="circle">
  32. <template #prefix>
  33. <image src="@/static/icon/fiery.png" style="width: 14px;height: 18px;"></image>
  34. </template>
  35. <template #suffix>
  36. <view style="width: 77rpx;height: 42rpx;
  37. background-color: #57A335;border-radius: 20rpx;
  38. margin-right: 5rpx;display: flex;align-items: center;justify-content: center;">
  39. <image src="@/static/icon/search.png" style="width: 32rpx;height: 32rpx;">
  40. </image>
  41. </view>
  42. </template>
  43. </uv-input>
  44. </view>
  45. </template>
  46. </page-navbar>
  47. </template>
  48. <z-paging-cell>
  49. <sortble :default-sorts="['uvSwiper','classModel','uvSwiperCard']">
  50. <template #uvSwiper>
  51. <uv-swiper :list="bannerList" :autoplay="true" circular :interval="5000" indicator
  52. indicator-mode="dot" height='380' radius='0'></uv-swiper>
  53. </template>
  54. <template #classModel>
  55. <view class="classModel">
  56. <view class="classModel-bg classModel-bg1" ref="classModel1">
  57. <image class="classModel-img" src="@/static/zhHans-text-icon/text-2.png" mode="">
  58. </image>
  59. </view>
  60. <view class="classModel-bg classModel-bg2" ref="classModel2">
  61. <image class="classModel-img" src="@/static/zhHans-text-icon/text-3.png" mode="">
  62. </image>
  63. </view>
  64. <view class="classModel-bg" ref="classModel3">
  65. <image class="classModel-img" src="@/static/zhHans-text-icon/text-4.png" mode="">
  66. </image>
  67. </view>
  68. </view>
  69. </template>
  70. <template #uvSwiperCard>
  71. <view style="background: #fff;padding: 30rpx 0;">
  72. <image src="/static/zhHans-text-icon/text-1.png" ref="classModel4"
  73. style="width: 432rpx;height: 34rpx;margin-left: 28rpx;margin-bottom: 43rpx"></image>
  74. <swiper-card :width="257" :height="290">
  75. <template v-for="(item,index) in cardList" :slot="`card-${index}`">
  76. <view style="position: relative;align-items: center;"
  77. :style="{width:`${257}rpx`,height:`${290}rpx`}">
  78. <image style="position: absolute;top:15px;" :src="item.img"
  79. :style="{width:`${257}rpx`,height:`${290}rpx`}">
  80. </image>
  81. <image style="position: absolute;" :src="item.bgimg"
  82. :style="{width:`${257}rpx`,height:`${290}rpx`}"></image>
  83. </view>
  84. </template>
  85. </swiper-card>
  86. </view>
  87. </template>
  88. </sortble>
  89. </z-paging-cell>
  90. <z-paging-cell>
  91. <view class="tab-nav">
  92. <view
  93. v-for="(tab, index) in tabs"
  94. :key="index"
  95. :class="['tab-item', currentTab === index ? 'active' : '']"
  96. @click="switchTab(index)"
  97. >
  98. {{ tab }}
  99. </view>
  100. </view>
  101. <view v-if="currentTab === 2" class="hot-topics">
  102. <view class="hot-topics-header">
  103. <text class="hot-topics-title">热搜资讯!</text>
  104. </view>
  105. <swiper
  106. class="hot-topics-swiper"
  107. :current="currentTopicPage"
  108. @change="handleTopicPageChange"
  109. >
  110. <swiper-item v-for="(page, pageIndex) in topicPages" :key="pageIndex">
  111. <view class="hot-topics-list">
  112. <view v-for="(topic, index) in page" :key="index" class="topic-item">
  113. <text class="topic-index">{{ pageIndex * 5 + index + 1 }}</text>
  114. <view class="topic-content">
  115. <view class="topic-title-row">
  116. <text class="topic-title">{{ topic.title }}</text>
  117. <text v-if="topic.isHot" class="hot-tag">HOT</text>
  118. </view>
  119. <text class="topic-participants">{{ topic.participants }}人正在热议</text>
  120. </view>
  121. </view>
  122. </view>
  123. </swiper-item>
  124. </swiper>
  125. <view class="indicator-dots">
  126. <view
  127. v-for="i in 2"
  128. :key="i"
  129. :class="['dot', currentTopicPage === i-1 ? 'active' : '']"
  130. ></view>
  131. </view>
  132. </view>
  133. <w-waterfall :data="currentList">
  134. <template v-slot:content="{item,width}">
  135. <card :item="item" :width="width" :custom-style="{background:'#fff'}" textColor="#000"></card>
  136. </template>
  137. </w-waterfall>
  138. </z-paging-cell>
  139. </z-paging>
  140. <tabbar-vue :tabbars="tabbars" :currentIndex="0" ref="tabbar"></tabbar-vue>
  141. <novice-guidance :step="step"></novice-guidance>
  142. </view>
  143. </template>
  144. <script>
  145. import sortble from "@/components/sortble/sortble.vue";
  146. import tabbarVue from "@/components/tabbar/tabbar.vue";
  147. import pageNavbar from "@/components/page-navbar/page-navbar.vue";
  148. import wWaterfall from "@/components/w-waterfall/w-waterfall.vue";
  149. import tabbar from "@/mixins/tabbar";
  150. import card from "@/components/card/card.vue";
  151. // import noviceGuidance from "@/components/novice-guidance/index.vue";
  152. export default {
  153. components: {
  154. sortble,
  155. tabbarVue,
  156. pageNavbar,
  157. wWaterfall,
  158. // noviceGuidance
  159. },
  160. mixins: [tabbar],
  161. data() {
  162. return {
  163. step: {
  164. name: 'workbenchSet5',
  165. guideList: [{
  166. el: '.step1',
  167. tips: '这里是第一步的介绍~',
  168. next: '下一步',
  169. }, {
  170. el: '.step2',
  171. tips: '这里是第二步的介绍~',
  172. next: '下一步',
  173. }, {
  174. el: '.step3',
  175. tips: '这里是第三步的介绍~',
  176. next: '下一步',
  177. }, {
  178. el: '.step4',
  179. tips: '这里是第四步的介绍~',
  180. next: '下一步',
  181. }, {
  182. el: '.step5',
  183. tips: '这里是第五步的介绍~',
  184. next: '下一步',
  185. }, {
  186. el: '.step6',
  187. tips: '这里是第六步的介绍~',
  188. next: '下一步',
  189. }, {
  190. el: '.step7',
  191. tips: '最后一步啦~',
  192. next: '完成',
  193. }]
  194. },
  195. windowHeight: uni.getWindowInfo().windowHeight,
  196. bannerList: [
  197. 'https://e.zhichao.art/AI_images/a_1112_10.png',
  198. 'https://e.zhichao.art/AI_images/a_1112_108.png',
  199. 'https://e.zhichao.art/AI_images/a_1112_113.png',
  200. ],
  201. cardList: [{
  202. img: '/static/img/img-1.png',
  203. bgimg: '/static/image/bg-2.png'
  204. }, {
  205. img: '/static/img/img-3.png',
  206. bgimg: '/static/image/bg-3.png'
  207. }, {
  208. img: '/static/img/img-2.png',
  209. bgimg: '/static/image/bg-1.png'
  210. }, ],
  211. list: [], // 瀑布流全部数据
  212. dataList: [],
  213. tabs: ['关注', '推荐', '探索'],
  214. currentTab: 1,
  215. currentTopicPage: 0,
  216. followList: [], // 关注列表数据
  217. recommendList: [], // 推荐列表数据
  218. exploreList: [], // 探索列表数据
  219. hotTopics: [
  220. { title: '今日热门话题一', participants: 275, isHot: true },
  221. { title: '人气话题二', participants: 183, isHot: false },
  222. { title: '热门讨论三', participants: 156, isHot: true },
  223. { title: '今日话题四', participants: 142, isHot: false },
  224. { title: '热门话题五', participants: 138, isHot: true },
  225. { title: '今日热点六', participants: 127, isHot: false },
  226. { title: '热门讨论七', participants: 119, isHot: true },
  227. { title: '人气话题八', participants: 108, isHot: false },
  228. { title: '今日话题九', participants: 96, isHot: true },
  229. { title: '热门话题十', participants: 89, isHot: false },
  230. ],
  231. }
  232. },
  233. computed: {
  234. currentList() {
  235. switch(this.currentTab) {
  236. case 0: return this.followList;
  237. case 1: return this.list; // 使用原有的list作为推荐列表
  238. case 2: return this.exploreList;
  239. default: return [];
  240. }
  241. },
  242. topicPages() {
  243. const pages = [];
  244. for (let i = 0; i < this.hotTopics.length; i += 5) {
  245. pages.push(this.hotTopics.slice(i, i + 5));
  246. }
  247. return pages;
  248. }
  249. },
  250. onLoad() {
  251. let that = this;
  252. // this.$nextTick(() => {
  253. // let step = [{
  254. // el: '.step1',
  255. // tips: '这里是第一步的介绍~',
  256. // next: '下一步',
  257. // }, {
  258. // el: '.step2',
  259. // tips: '这里是第二步的介绍~',
  260. // next: '下一步',
  261. // }, {
  262. // el: '.step3',
  263. // tips: '这里是第三步的介绍~',
  264. // next: '下一步',
  265. // }, {
  266. // el: '.step4',
  267. // tips: '这里是第四步的介绍~',
  268. // next: '下一步',
  269. // }, {
  270. // el: '.step5',
  271. // tips: '这里是第五步的介绍~',
  272. // next: '下一步',
  273. // }, {
  274. // el: '.step6',
  275. // tips: '这里是第六步的介绍~',
  276. // next: '下一步',
  277. // }, {
  278. // el: '.step7',
  279. // tips: '最后一步啦~',
  280. // next: '完成',
  281. // }]
  282. // for (var i = 0; i < step.length; i++) {
  283. // that.step.guideList.push(step[i])
  284. // }
  285. // setTimeout(() => {
  286. // // that.$refs.guidance.start(that.step)
  287. // }, 1000)
  288. // })
  289. this.getData().then(res => {
  290. this.list = res.data;
  291. });
  292. },
  293. // 下拉刷新数据
  294. methods: {
  295. queryList() {
  296. this.getData().then(res => {
  297. this.list = res.data;
  298. this.$refs.paging.complete(this.list);
  299. });
  300. },
  301. async init() {
  302. const {
  303. data
  304. } = await this.getData();
  305. this.list.push.apply(this.list, data);
  306. },
  307. // 模拟的后端数据
  308. getData() {
  309. return new Promise((resolve) => {
  310. const imgs = [{
  311. url: 'https://e.zhichao.art/AI_images/a_1112_10.png',
  312. },
  313. {
  314. url: 'https://e.zhichao.art/AI_images/a_1112_108.png',
  315. },
  316. {
  317. url: 'https://e.zhichao.art/AI_images/a_1112_113.png',
  318. },
  319. {
  320. url: 'https://e.zhichao.art/AI_images/a_1112_13.png',
  321. },
  322. {
  323. url: 'https://e.zhichao.art/AI_images/a_1112_137.png',
  324. },
  325. {
  326. url: 'https://e.zhichao.art/AI_images/a_1112_141.png',
  327. },
  328. {
  329. url: 'https://e.zhichao.art/AI_images/a_1114__562.png',
  330. },
  331. {
  332. url: 'https://e.zhichao.art/AI_images/a_1114__568.png',
  333. },
  334. {
  335. url: 'https://e.zhichao.art/AI_images/a_1114__569.png',
  336. },
  337. {
  338. url: 'https://e.zhichao.art/AI_images/a_1114__570.png',
  339. },
  340. {
  341. url: 'https://e.zhichao.art/AI_images/a_1114__571.png',
  342. },
  343. {
  344. url: 'https://e.zhichao.art/AI_images/a_1114__575.png',
  345. },
  346. ];
  347. let list = [];
  348. const doFn = (i) => {
  349. const randomIndex = Math.floor(Math.random() * 10);
  350. return {
  351. allowEdit: i == 0,
  352. image: imgs[randomIndex].url,
  353. w: imgs[randomIndex].width,
  354. h: imgs[randomIndex].height,
  355. title: i % 2 == 0 ? `玛丽` : `凌音`,
  356. desc: i % 2 == 0 ?
  357. `欢迎使用uv-ui,uni-app生态专用的UI框架` : `开发者编写一套代码, 可发布到iOS、Android、H5、以及各种小程序`
  358. }
  359. };
  360. // 模拟异步
  361. setTimeout(() => {
  362. for (let i = 0; i < 20; i++) {
  363. list.push(doFn(i));
  364. }
  365. resolve({
  366. data: list
  367. });
  368. }, 200)
  369. })
  370. },
  371. switchTab(index) {
  372. this.currentTab = index;
  373. // 根据需要加载对应标签的数据
  374. this.loadTabData(index);
  375. },
  376. loadTabData(index) {
  377. // 这里添加加载不同标签数据的逻辑
  378. switch(index) {
  379. case 0:
  380. if (!this.followList.length) {
  381. this.getData().then(res => {
  382. this.followList = res.data;
  383. });
  384. }
  385. break;
  386. case 2:
  387. if (!this.exploreList.length) {
  388. this.getData().then(res => {
  389. this.exploreList = res.data;
  390. });
  391. }
  392. break;
  393. }
  394. },
  395. handleTopicPageChange(e) {
  396. this.currentTopicPage = e.detail.current;
  397. },
  398. }
  399. }
  400. </script>
  401. <style lang="scss">
  402. .classModel {
  403. width: 750rpx;
  404. height: 110rpx;
  405. // #ifndef APP-NVUE
  406. display: flex;
  407. // #endif
  408. // #ifdef APP-NVUE
  409. flex-direction: row;
  410. // #endif
  411. justify-content: space-around;
  412. margin-bottom: 20rpx;
  413. .classModel-bg {
  414. width: 210rpx;
  415. height: 90rpx;
  416. background-color: #3F4141;
  417. border-radius: 60rpx;
  418. box-shadow: 3px 3px 2px rgba(174, 230, 93, 1);
  419. .classModel-img {
  420. width: 175rpx;
  421. height: 75rpx;
  422. }
  423. }
  424. }
  425. .tab-nav {
  426. display: flex;
  427. justify-content: center;
  428. padding: 20rpx 0;
  429. background: #161616;
  430. .tab-item {
  431. padding: 0 30rpx;
  432. color: #808080;
  433. font-size: 28rpx;
  434. &.active {
  435. color: #ffffff;
  436. font-weight: bold;
  437. }
  438. }
  439. }
  440. .hot-topics {
  441. padding: 20rpx;
  442. background: #28292D;
  443. margin: 20rpx;
  444. border-radius: 16rpx;
  445. .hot-topics-header {
  446. margin-bottom: 20rpx;
  447. .hot-topics-title {
  448. font-size: 32rpx;
  449. font-weight: bold;
  450. color: #ffffff;
  451. }
  452. }
  453. .hot-topics-swiper {
  454. height: 400rpx; // Adjust this value based on your content
  455. }
  456. .hot-topics-list {
  457. padding: 10rpx 0;
  458. }
  459. .topic-item {
  460. display: flex;
  461. align-items: center;
  462. padding: 15rpx 0;
  463. .topic-index {
  464. width: 40rpx;
  465. color: #808080;
  466. }
  467. .topic-content {
  468. flex: 1;
  469. .topic-title-row {
  470. display: flex;
  471. align-items: center;
  472. .topic-title {
  473. color: #ffffff;
  474. font-size: 28rpx;
  475. }
  476. .hot-tag {
  477. margin-left: 10rpx;
  478. padding: 4rpx 10rpx;
  479. background: #FF4B4B;
  480. color: #ffffff;
  481. font-size: 20rpx;
  482. border-radius: 8rpx;
  483. }
  484. }
  485. .topic-participants {
  486. font-size: 24rpx;
  487. color: #808080;
  488. margin-top: 6rpx;
  489. }
  490. }
  491. }
  492. .indicator-dots {
  493. display: flex;
  494. justify-content: center;
  495. margin-top: 20rpx;
  496. .dot {
  497. width: 12rpx;
  498. height: 12rpx;
  499. border-radius: 50%;
  500. background: #808080;
  501. margin: 0 6rpx;
  502. &.active {
  503. background: #ffffff;
  504. }
  505. }
  506. }
  507. }
  508. </style>