crowdFunding.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. <template>
  2. <view class="crowd-funding-page">
  3. <!-- 头部导航 -->
  4. <page-navbar>
  5. <template #navLeft>
  6. <view class="nav-left" @click="goBack">
  7. <image src="/static/icon/arrow-left.png" class="back-icon"></image>
  8. </view>
  9. </template>
  10. <template #navCenter>
  11. <view class="nav-title">众筹</view>
  12. </template>
  13. <template #navRight>
  14. <view class="nav-right">
  15. <image src="/static/icon/star.png" class="action-icon"></image>
  16. <image src="/static/icon/avatar-placeholder.png" class="avatar-icon"></image>
  17. </view>
  18. </template>
  19. </page-navbar>
  20. <!-- 搜索框 -->
  21. <view class="search-bar-container">
  22. <view class="search-input-wrapper">
  23. <image src="/static/icon/search-gray.png" class="search-icon"></image>
  24. <input type="text" placeholder="搜索你感兴趣的内容" class="search-input" />
  25. </view>
  26. </view>
  27. <!-- Banner -->
  28. <view class="banner-section">
  29. <swiper class="banner-swiper" :autoplay="true" :circular="true" :interval="5000" :indicator-dots="true" indicator-color="rgba(255, 255, 255, 0.6)" indicator-active-color="#ffffff">
  30. <swiper-item v-for="(item, index) in bannerList" :key="index">
  31. <image :src="item.image" class="banner-image" mode="aspectFill"></image>
  32. </swiper-item>
  33. </swiper>
  34. </view>
  35. <!-- Tab导航 -->
  36. <view class="tabs-section">
  37. <scroll-view scroll-x class="tabs-scroll-view" :show-scrollbar="false" :scroll-into-view="'tab-' +( currentTab -1)" scroll-with-animation>
  38. <view class="tabs-wrapper">
  39. <view v-for="(tab, index) in tabs" :key="index" :id="'tab-' + index" :class="['tab-item', currentTab === index ? 'active' : '']" @click="switchTab(index)">
  40. <image v-if="tab.icon" :src="tab.icon" class="tab-icon"></image>
  41. {{ tab.name }}
  42. </view>
  43. </view>
  44. </scroll-view>
  45. </view>
  46. <!-- 内容区域 -->
  47. <scroll-view scroll-y class="content-scroll">
  48. <view class="items-grid">
  49. <CrowdFundingItem
  50. v-for="(item, index) in itemList"
  51. :key="index"
  52. :item="item"
  53. @click="goToDetail"
  54. />
  55. </view>
  56. </scroll-view>
  57. </view>
  58. </template>
  59. <script>
  60. import pageNavbar from '@/components/page-navbar/page-navbar.vue';
  61. import CrowdFundingItem from './components/CrowdFundingItem/CrowdFundingItem.vue';
  62. export default {
  63. components: {
  64. pageNavbar,
  65. CrowdFundingItem
  66. },
  67. data() {
  68. return {
  69. bannerList: [
  70. { image: '/static/placeholder/banner-crowdfunding.png' } // Placeholder banner
  71. ],
  72. tabs: [
  73. { name: '全部', icon: '' },
  74. { name: '创意', icon: '/static/icon/creative-star.png' }, // Placeholder icon
  75. { name: '潮玩', icon: '/static/icon/toy-bear.png' }, // Placeholder icon
  76. { name: '出版', icon: '' },
  77. { name: '桌游', icon: '' },
  78. { name: '桌游', icon: '' },
  79. { name: '桌游', icon: '' },
  80. { name: '桌游', icon: '' },
  81. { name: '桌游', icon: '' },
  82. { name: '桌游', icon: '' },
  83. { name: '卡片', icon: '' }
  84. ],
  85. currentTab: 0, // 默认选中"创意"
  86. itemList: [
  87. {
  88. id: 1,
  89. imageUrl: '/static/placeholder/item1.png',
  90. title: '糖指数100%12分BJD可动人偶盲盒',
  91. raisedAmount: '769.8',
  92. supporters: 3788
  93. },
  94. {
  95. id: 2,
  96. imageUrl: '/static/placeholder/item2.png',
  97. title: '糖指数100%12分BJD可动人偶盲盒',
  98. raisedAmount: '769.8',
  99. supporters: 3788
  100. },
  101. {
  102. id: 3,
  103. imageUrl: '/static/placeholder/item3.png',
  104. title: '糖指数100%12分BJD可动人偶盲盒',
  105. raisedAmount: '769.8',
  106. supporters: 3788
  107. },
  108. {
  109. id: 4,
  110. imageUrl: '/static/placeholder/item4.png',
  111. title: '糖指数100%12分BJD可动人偶盲盒',
  112. raisedAmount: '769.8',
  113. supporters: 3788
  114. }
  115. ]
  116. };
  117. },
  118. methods: {
  119. goBack() {
  120. uni.navigateBack();
  121. },
  122. switchTab(index) {
  123. this.currentTab = index;
  124. // 在这里可以根据选择的tab加载不同的数据
  125. console.log('Switched to tab:', this.tabs[index].name);
  126. },
  127. goToDetail(id) {
  128. console.log('Go to detail page for item ID:', id);
  129. // uni.navigateTo({ url: '/pages/crowdFunding/detail?id=' + id });
  130. }
  131. }
  132. };
  133. </script>
  134. <style lang="scss" scoped>
  135. .crowd-funding-page {
  136. display: flex;
  137. flex-direction: column;
  138. height: 100vh;
  139. background: #f6f7fb;
  140. }
  141. .page-navbar {
  142. background: #fff;
  143. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.03);
  144. .nav-title {
  145. font-size: 36rpx;
  146. font-weight: bold;
  147. color: #222;
  148. letter-spacing: 2rpx;
  149. }
  150. .nav-right {
  151. display: flex;
  152. align-items: center;
  153. .action-icon {
  154. width: 48rpx;
  155. height: 48rpx;
  156. margin-right: 16rpx;
  157. background: #fffbe6;
  158. border-radius: 50%;
  159. padding: 8rpx;
  160. }
  161. .avatar-icon {
  162. width: 56rpx;
  163. height: 56rpx;
  164. border-radius: 50%;
  165. border: 2rpx solid #fff;
  166. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.04);
  167. }
  168. }
  169. }
  170. .search-bar-container {
  171. margin: 18rpx 24rpx 0 24rpx;
  172. background: #fff;
  173. border-radius: 32rpx;
  174. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.03);
  175. padding: 0 24rpx;
  176. height: 64rpx;
  177. display: flex;
  178. align-items: center;
  179. .search-input-wrapper {
  180. display: flex;
  181. align-items: center;
  182. .search-icon {
  183. width: 32rpx;
  184. height: 32rpx;
  185. margin-right: 10rpx;
  186. }
  187. .search-input {
  188. font-size: 28rpx;
  189. color: #999;
  190. line-height: 64rpx;
  191. }
  192. }
  193. }
  194. .banner-section {
  195. margin: 16rpx 24rpx 0 24rpx;
  196. border-radius: 24rpx;
  197. overflow: hidden;
  198. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.03);
  199. background: #fff;
  200. .banner-swiper {
  201. height: 180rpx;
  202. .banner-image {
  203. width: 100%;
  204. height: 100%;
  205. display: block;
  206. object-fit: cover;
  207. }
  208. }
  209. }
  210. .tabs-section {
  211. background: #fff;
  212. border-bottom: 1rpx solid #eee;
  213. margin-top: 12rpx;
  214. .tabs-scroll-view {
  215. width: 100%;
  216. .tabs-wrapper {
  217. display: flex;
  218. align-items: center;
  219. padding-left: 12rpx;
  220. }
  221. }
  222. .tab-item {
  223. display: flex;
  224. align-items: center;
  225. font-size: 28rpx;
  226. color: #666;
  227. padding: 8rpx 28rpx;
  228. margin-right: 8rpx;
  229. border-radius: 32rpx;
  230. font-weight: 500;
  231. background: transparent;
  232. transition: background 0.2s, color 0.2s;
  233. .tab-icon {
  234. width: 32rpx;
  235. height: 32rpx;
  236. margin-right: 8rpx;
  237. }
  238. &.active {
  239. font-weight: bold;
  240. color: #fff;
  241. background: #222;
  242. .tab-icon {
  243. filter: brightness(1.5) saturate(2);
  244. }
  245. }
  246. }
  247. }
  248. .content-scroll {
  249. flex: 1;
  250. overflow-y: auto;
  251. padding-bottom: 24rpx;
  252. }
  253. .items-grid {
  254. display: grid;
  255. grid-template-columns: repeat(2, 1fr);
  256. gap: 24rpx;
  257. padding: 16rpx 24rpx 0 24rpx;
  258. .grid-item {
  259. background: #fff;
  260. border-radius: 20rpx;
  261. overflow: hidden;
  262. box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
  263. margin-bottom: 8rpx;
  264. .item-image {
  265. width: 100%;
  266. height: 220rpx;
  267. display: block;
  268. object-fit: cover;
  269. border-top-left-radius: 20rpx;
  270. border-top-right-radius: 20rpx;
  271. }
  272. .item-title {
  273. font-size: 26rpx;
  274. color: #222;
  275. padding: 12rpx 12rpx 0 12rpx;
  276. font-weight: 500;
  277. white-space: nowrap;
  278. overflow: hidden;
  279. text-overflow: ellipsis;
  280. }
  281. .item-info {
  282. display: flex;
  283. justify-content: space-between;
  284. align-items: center;
  285. padding: 0 12rpx 12rpx 12rpx;
  286. font-size: 22rpx;
  287. .item-price {
  288. color: #ff5000;
  289. font-weight: bold;
  290. }
  291. .item-supporters {
  292. color: #999;
  293. }
  294. }
  295. }
  296. }
  297. </style>