index.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. <template>
  2. <view class="container">
  3. <!-- 顶部标题和积分区 -->
  4. <view class="header">
  5. <text class="title">星球造物</text>
  6. <view class="currency-area">
  7. <view class="coin-box">
  8. <image src="/static/icon/coin.png" class="coin-icon"></image>
  9. <text class="coin-count">999</text>
  10. </view>
  11. <view class="gold-box">
  12. <image src="/static/icon/gold.png" class="gold-icon"></image>
  13. <text class="gold-count">2</text>
  14. </view>
  15. </view>
  16. </view>
  17. <!-- 功能卡片区域 -->
  18. <view class="card-grid">
  19. <!-- AI创角卡片 -->
  20. <view class="card card-large blue" @click="handleCardClick('character')">
  21. <view class="card-content">
  22. <view class="text-area">
  23. <text class="card-title">AI创角</text>
  24. <text class="card-desc">生成独一无二的星球成员</text>
  25. </view>
  26. <image src="/static/icon/star.png" class="star-icon star-1" mode="aspectFit"></image>
  27. <image src="/static/icon/star.png" class="star-icon star-2" mode="aspectFit"></image>
  28. <image src="/static/make/character.png" class="card-image" mode="aspectFit"></image>
  29. </view>
  30. </view>
  31. <!-- AI灵感写歌卡片 -->
  32. <view class="card card-medium pink" @click="handleCardClick('music')">
  33. <view class="card-content">
  34. <view class="text-area">
  35. <text class="card-title">AI灵感写歌</text>
  36. <text class="card-desc">快速生成专属原创曲目</text>
  37. </view>
  38. <image src="/static/make/planet.png" class="card-image" mode="aspectFit"></image>
  39. </view>
  40. </view>
  41. <!-- 萌萌智绘魔方卡片 -->
  42. <view class="card card-medium purple" @click="handleCardClick('cube')">
  43. <view class="card-content">
  44. <view class="text-area">
  45. <text class="card-title">萌萌智绘魔方</text>
  46. <text class="card-desc">AI随机生成萌玩原型</text>
  47. </view>
  48. <image src="/static/make/book.png" class="card-image" mode="aspectFit"></image>
  49. </view>
  50. </view>
  51. <!-- AI造物卡片 -->
  52. <view class="card card-small gray" @click="handleCardClick('build')">
  53. <view class="card-content">
  54. <text class="card-title">AI造物</text>
  55. <text class="card-desc">一键生成想要的建筑</text>
  56. </view>
  57. </view>
  58. <!-- 潮能充能站卡片 -->
  59. <view class="card card-small gray" @click="handleCardClick('build')">
  60. <view class="card-content">
  61. <text class="card-title">潮能充能站</text>
  62. <text class="card-desc">一键生成想要的建筑</text>
  63. </view>
  64. </view>
  65. <!-- 星轨预测卡片 -->
  66. <view class="card card-small gray" @click="handleCardClick('build')">
  67. <view class="card-content">
  68. <text class="card-title">星轨预测</text>
  69. <text class="card-desc">AI大数据综合星座为你测算</text>
  70. </view>
  71. </view>
  72. </view>
  73. <!-- 引导教程区域 -->
  74. <view class="tutorial">
  75. <view class="tutorial-block" @click="handleTutorialClick(index)" v-for="(tutorial, index) in 5" :key="index">
  76. <text class="tutorial-title">引导教程{{ index + 1 }}</text>
  77. <view class="tutorial-content">
  78. <!-- 教程内容将在这里添加 -->
  79. </view>
  80. </view>
  81. </view>
  82. <tabbar-view :tabbars="tabbars" :currentIndex="1" ref="tabbar"></tabbar-view>
  83. </view>
  84. </template>
  85. <script>
  86. import sortble from "@/components/sortble/sortble.vue";
  87. import tabbarView from "@/components/tabbar/tabbar.vue";
  88. import pageNavbar from "@/components/page-navbar/page-navbar.vue";
  89. import wWaterfall from "@/components/w-waterfall/w-waterfall.vue";
  90. import tabbar from "@/mixins/tabbar";
  91. import swiperItemList from "@/components/swiper-item-list/swiper-item-list.vue";
  92. import card from "@/components/card/card.vue";
  93. export default {
  94. components: {
  95. sortble,
  96. tabbarView,
  97. pageNavbar,
  98. wWaterfall,
  99. swiperItemList
  100. },
  101. mixins: [tabbar],
  102. data() {
  103. return {
  104. refreshing: false,
  105. loadinging: false,
  106. windowHeight: uni.getWindowInfo().windowHeight,
  107. bannerList: [
  108. 'https://e.zhichao.art/AI_images/1112 (1).png',
  109. 'https://e.zhichao.art/AI_images/1112 (101).png',
  110. 'https://e.zhichao.art/AI_images/1112 (102).png',
  111. ],
  112. cardList: [{
  113. img: '/static/img/img-1.png',
  114. bgimg: '/static/image/bg-2.png'
  115. }, {
  116. img: '/static/img/img-3.png',
  117. bgimg: '/static/image/bg-3.png'
  118. }, {
  119. img: '/static/img/img-2.png',
  120. bgimg: '/static/image/bg-1.png'
  121. }, ],
  122. list: [], // 瀑布流全部数据
  123. dataList: [],
  124. tabList: ['收藏', '关注', '推荐', '音频', '视频', '图片'],
  125. tabCurrent: 0
  126. }
  127. },
  128. onLoad() {
  129. this.getData().then(res => {
  130. this.list = res.data;
  131. });
  132. },
  133. // 下拉刷新数据
  134. methods: {
  135. goMake() {
  136. uni.navigateTo({
  137. url: '/pages/make/make'
  138. })
  139. },
  140. goMake2() {
  141. uni.navigateTo({
  142. url: '/pages/make/make2'
  143. })
  144. },
  145. queryList() {
  146. this.getData().then(res => {
  147. this.list = res.data;
  148. this.$refs.paging.complete(this.list);
  149. });
  150. },
  151. async init() {
  152. const {
  153. data
  154. } = await this.getData();
  155. this.list.push.apply(this.list, data);
  156. },
  157. tabChange(index) {
  158. this.tabCurrent = index;
  159. },
  160. // swiper change时触发
  161. swiperChange(e) {
  162. let current = e.target.current || e.detail.current;
  163. this.tabChange(current);
  164. },
  165. queryData(params) {
  166. const {
  167. pageNo,
  168. pageSize,
  169. type,
  170. complete
  171. } = params;
  172. this.getData(pageNo, pageSize).then(res => {
  173. const dataList = complete(res.data);
  174. this.list = pageNo !== 1 ? [...this.list, ...dataList] : dataList;
  175. });
  176. },
  177. // 模拟的后端数据
  178. getData(pageNo, pageSize) {
  179. return new Promise((resolve) => {
  180. const imgs = [{
  181. url: 'https://e.zhichao.art/AI_images/1112 (103).png',
  182. },
  183. {
  184. url: 'https://e.zhichao.art/AI_images/1112 (104).png',
  185. },
  186. {
  187. url: 'https://e.zhichao.art/AI_images/1112 (106).png',
  188. },
  189. {
  190. url: 'https://e.zhichao.art/AI_images/1112 (109).png',
  191. },
  192. {
  193. url: 'https://e.zhichao.art/AI_images/1112 (111).png',
  194. },
  195. {
  196. url: 'https://e.zhichao.art/AI_images/1112 (112).png',
  197. },
  198. {
  199. url: 'https://e.zhichao.art/AI_images/1112 (116).png',
  200. },
  201. {
  202. url: 'https://e.zhichao.art/AI_images/1112 (106).png',
  203. },
  204. {
  205. url: 'https://e.zhichao.art/AI_images/1112 (109).png',
  206. },
  207. {
  208. url: 'https://e.zhichao.art/AI_images/1112 (111).png',
  209. },
  210. {
  211. url: 'https://e.zhichao.art/AI_images/1112 (112).png',
  212. },
  213. {
  214. url: 'https://e.zhichao.art/AI_images/1112 (116).png',
  215. }
  216. ];
  217. let list = [];
  218. const doFn = (i) => {
  219. const randomIndex = Math.floor(Math.random() * 10);
  220. return {
  221. allowEdit: i == 0,
  222. image: imgs[randomIndex].url,
  223. w: imgs[randomIndex].width,
  224. h: imgs[randomIndex].height,
  225. title: i % 2 == 0 ? `玛丽` : `凌音`,
  226. desc: i % 2 == 0 ?
  227. `欢迎使用uv-ui,uni-app生态专用的UI框架` : `开发者编写一套代码, 可发布到iOS、Android、H5、以及各种小程序`
  228. }
  229. };
  230. // 模拟异步
  231. setTimeout(() => {
  232. for (let i = 0; i < 20; i++) {
  233. list.push(doFn(i));
  234. }
  235. resolve({
  236. data: list
  237. });
  238. }, 200)
  239. })
  240. },
  241. handleCardClick(type) {
  242. console.log('Card clicked:', type);
  243. },
  244. handleTutorialClick(index) {
  245. console.log('Tutorial clicked:', index + 1);
  246. }
  247. }
  248. }
  249. </script>
  250. <style lang="scss">
  251. @import './index.scss';
  252. </style>