index.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387
  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">
  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/ai-character.png" class="card-image" mode="aspectFit"></image>
  27. </view>
  28. </view>
  29. <!-- AI灵感写歌卡片 -->
  30. <view class="card card-medium pink">
  31. <view class="card-content">
  32. <view class="text-area">
  33. <text class="card-title">AI灵感写歌</text>
  34. <text class="card-desc">快速生成专属原创曲目</text>
  35. </view>
  36. <image src="/static/icon/planet.png" class="card-image" mode="aspectFit"></image>
  37. </view>
  38. </view>
  39. <!-- 萌萌智绘魔方卡片 -->
  40. <view class="card card-medium purple">
  41. <view class="card-content">
  42. <view class="text-area">
  43. <text class="card-title">萌萌智绘魔方</text>
  44. <text class="card-desc">AI随机生成萌玩原型</text>
  45. </view>
  46. <image src="/static/icon/book.png" class="card-image" mode="aspectFit"></image>
  47. </view>
  48. </view>
  49. <!-- AI造物卡片 -->
  50. <view class="card card-small gray">
  51. <view class="card-content">
  52. <text class="card-title">AI造物</text>
  53. <text class="card-desc">一键生成想要的建筑</text>
  54. </view>
  55. </view>
  56. <!-- 潮能充能站卡片 -->
  57. <view class="card card-small gray">
  58. <view class="card-content">
  59. <text class="card-title">潮能充能站</text>
  60. <text class="card-desc">一键生成想要的建筑</text>
  61. </view>
  62. </view>
  63. <!-- 星轨预测卡片 -->
  64. <view class="card card-small gray">
  65. <view class="card-content">
  66. <text class="card-title">星轨预测</text>
  67. <text class="card-desc">AI大数据综合星座为你测算</text>
  68. </view>
  69. </view>
  70. </view>
  71. <!-- 引导教程区域 -->
  72. <view class="tutorial">
  73. <text class="tutorial-title">引导教程</text>
  74. <view class="tutorial-content">
  75. <!-- 教程内容将在这里添加 -->
  76. </view>
  77. </view>
  78. <tabbar-view :tabbars="tabbars" :currentIndex="1" ref="tabbar"></tabbar-view>
  79. </view>
  80. </template>
  81. <script>
  82. import sortble from "@/components/sortble/sortble.vue";
  83. import tabbarView from "@/components/tabbar/tabbar.vue";
  84. import pageNavbar from "@/components/page-navbar/page-navbar.vue";
  85. import wWaterfall from "@/components/w-waterfall/w-waterfall.vue";
  86. import tabbar from "@/mixins/tabbar";
  87. import swiperItemList from "@/components/swiper-item-list/swiper-item-list.vue";
  88. import card from "@/components/card/card.vue";
  89. export default {
  90. components: {
  91. sortble,
  92. tabbarView,
  93. pageNavbar,
  94. wWaterfall,
  95. swiperItemList
  96. },
  97. mixins: [tabbar],
  98. data() {
  99. return {
  100. refreshing: false,
  101. loadinging: false,
  102. windowHeight: uni.getWindowInfo().windowHeight,
  103. bannerList: [
  104. 'https://e.zhichao.art/AI_images/1112 (1).png',
  105. 'https://e.zhichao.art/AI_images/1112 (101).png',
  106. 'https://e.zhichao.art/AI_images/1112 (102).png',
  107. ],
  108. cardList: [{
  109. img: '/static/img/img-1.png',
  110. bgimg: '/static/image/bg-2.png'
  111. }, {
  112. img: '/static/img/img-3.png',
  113. bgimg: '/static/image/bg-3.png'
  114. }, {
  115. img: '/static/img/img-2.png',
  116. bgimg: '/static/image/bg-1.png'
  117. }, ],
  118. list: [], // 瀑布流全部数据
  119. dataList: [],
  120. tabList: ['收藏', '关注', '推荐', '音频', '视频', '图片'],
  121. tabCurrent: 0
  122. }
  123. },
  124. onLoad() {
  125. this.getData().then(res => {
  126. this.list = res.data;
  127. });
  128. },
  129. // 下拉刷新数据
  130. methods: {
  131. goMake() {
  132. uni.navigateTo({
  133. url: '/pages/make/make'
  134. })
  135. },
  136. goMake2() {
  137. uni.navigateTo({
  138. url: '/pages/make/make2'
  139. })
  140. },
  141. queryList() {
  142. this.getData().then(res => {
  143. this.list = res.data;
  144. this.$refs.paging.complete(this.list);
  145. });
  146. },
  147. async init() {
  148. const {
  149. data
  150. } = await this.getData();
  151. this.list.push.apply(this.list, data);
  152. },
  153. tabChange(index) {
  154. this.tabCurrent = index;
  155. },
  156. // swiper change时触发
  157. swiperChange(e) {
  158. let current = e.target.current || e.detail.current;
  159. this.tabChange(current);
  160. },
  161. queryData(params) {
  162. const {
  163. pageNo,
  164. pageSize,
  165. type,
  166. complete
  167. } = params;
  168. this.getData(pageNo, pageSize).then(res => {
  169. const dataList = complete(res.data);
  170. this.list = pageNo !== 1 ? [...this.list, ...dataList] : dataList;
  171. });
  172. },
  173. // 模拟的后端数据
  174. getData(pageNo, pageSize) {
  175. return new Promise((resolve) => {
  176. const imgs = [{
  177. url: 'https://e.zhichao.art/AI_images/1112 (103).png',
  178. },
  179. {
  180. url: 'https://e.zhichao.art/AI_images/1112 (104).png',
  181. },
  182. {
  183. url: 'https://e.zhichao.art/AI_images/1112 (106).png',
  184. },
  185. {
  186. url: 'https://e.zhichao.art/AI_images/1112 (109).png',
  187. },
  188. {
  189. url: 'https://e.zhichao.art/AI_images/1112 (111).png',
  190. },
  191. {
  192. url: 'https://e.zhichao.art/AI_images/1112 (112).png',
  193. },
  194. {
  195. url: 'https://e.zhichao.art/AI_images/1112 (116).png',
  196. },
  197. {
  198. url: 'https://e.zhichao.art/AI_images/1112 (106).png',
  199. },
  200. {
  201. url: 'https://e.zhichao.art/AI_images/1112 (109).png',
  202. },
  203. {
  204. url: 'https://e.zhichao.art/AI_images/1112 (111).png',
  205. },
  206. {
  207. url: 'https://e.zhichao.art/AI_images/1112 (112).png',
  208. },
  209. {
  210. url: 'https://e.zhichao.art/AI_images/1112 (116).png',
  211. }
  212. ];
  213. let list = [];
  214. const doFn = (i) => {
  215. const randomIndex = Math.floor(Math.random() * 10);
  216. return {
  217. allowEdit: i == 0,
  218. image: imgs[randomIndex].url,
  219. w: imgs[randomIndex].width,
  220. h: imgs[randomIndex].height,
  221. title: i % 2 == 0 ? `玛丽` : `凌音`,
  222. desc: i % 2 == 0 ?
  223. `欢迎使用uv-ui,uni-app生态专用的UI框架` : `开发者编写一套代码, 可发布到iOS、Android、H5、以及各种小程序`
  224. }
  225. };
  226. // 模拟异步
  227. setTimeout(() => {
  228. for (let i = 0; i < 20; i++) {
  229. list.push(doFn(i));
  230. }
  231. resolve({
  232. data: list
  233. });
  234. }, 200)
  235. })
  236. }
  237. }
  238. }
  239. </script>
  240. <style lang="scss">
  241. .container {
  242. min-height: 100vh;
  243. background: linear-gradient(180deg, #f0f7ff 0%, #fff1f9 100%);
  244. padding: 30rpx 30rpx 0 0;
  245. }
  246. .header {
  247. padding-left: 30rpx;
  248. display: flex;
  249. justify-content: space-between;
  250. align-items: center;
  251. margin-bottom: 40rpx;
  252. .title {
  253. font-size: 36rpx;
  254. font-weight: bold;
  255. color: #333;
  256. }
  257. .currency-area {
  258. display: flex;
  259. gap: 20rpx;
  260. .coin-box, .gold-box {
  261. display: flex;
  262. align-items: center;
  263. padding: 10rpx 20rpx;
  264. background: #fff;
  265. border-radius: 30rpx;
  266. box-shadow: 0 2rpx 10rpx rgba(0,0,0,0.1);
  267. image {
  268. width: 40rpx;
  269. height: 40rpx;
  270. margin-right: 10rpx;
  271. }
  272. }
  273. .coin-box {
  274. background: #90d369;
  275. .coin-count {
  276. color: #478C2A;
  277. }
  278. }
  279. .gold-box {
  280. background: #FFD700;
  281. .gold-count {
  282. color: #B8860B;
  283. }
  284. }
  285. }
  286. }
  287. .card-grid {
  288. padding-left: 30rpx;
  289. display: grid;
  290. grid-template-columns: repeat(2, 1fr);
  291. gap: 20rpx;
  292. margin-bottom: 40rpx;
  293. .card {
  294. border-radius: 20rpx;
  295. padding: 30rpx;
  296. position: relative;
  297. overflow: hidden;
  298. &.blue { background: #3B82F6; }
  299. &.pink { background: #EC4899; }
  300. &.purple { background: #8B5CF6; }
  301. &.gray { background: #4B5563; }
  302. &.card-large {
  303. grid-column: span 2;
  304. height: 240rpx;
  305. }
  306. &.card-medium {
  307. height: 200rpx;
  308. }
  309. &.card-small {
  310. height: 160rpx;
  311. }
  312. .card-content {
  313. height: 100%;
  314. display: flex;
  315. flex-direction: column;
  316. justify-content: space-between;
  317. .text-area {
  318. z-index: 1;
  319. }
  320. .card-title {
  321. font-size: 32rpx;
  322. color: #fff;
  323. font-weight: bold;
  324. margin-bottom: 10rpx;
  325. }
  326. .card-desc {
  327. font-size: 24rpx;
  328. color: rgba(255,255,255,0.8);
  329. }
  330. .card-image {
  331. position: absolute;
  332. right: 20rpx;
  333. bottom: 20rpx;
  334. width: 120rpx;
  335. height: 120rpx;
  336. z-index: 0;
  337. }
  338. }
  339. }
  340. }
  341. .tutorial {
  342. margin-left: 30rpx;
  343. background: #fff;
  344. border-radius: 20rpx;
  345. padding: 30rpx;
  346. .tutorial-title {
  347. font-size: 32rpx;
  348. font-weight: bold;
  349. color: #333;
  350. margin-bottom: 20rpx;
  351. }
  352. .tutorial-content {
  353. min-height: 200rpx;
  354. }
  355. }
  356. </style>