detail.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435
  1. <template>
  2. <view class="activity-detail-page">
  3. <u-navbar title="活动详情" :autoBack="true" :bgColor="bgColor" leftIconColor="#333"
  4. titleStyle="font-weight:bold;"></u-navbar>
  5. <image class="bg_dance" src="/static/images/enter/activity/bg_dance.png" mode=""></image>
  6. <view class="header-banner">
  7. <image src="/static/images/enter/activity/banner_dance.png" class="banner-text" mode=""></image>
  8. </view>
  9. <view class="content-container">
  10. <view class="action-grid u-f u-f-jsb" v-if="!joinShow">
  11. <view class="action-btn create" @click="handleCreate">
  12. <view class="btn-title">创建队伍</view>
  13. <image src="/static/images/enter/activity/icon_more.png" class="es-icon-32 rightIcon" mode="">
  14. </image>
  15. <image src="/static/images/enter/activity/icon_flag.png" class="bg-icon" mode=""></image>
  16. </view>
  17. <view class="action-btn join" @click="showJoinPopup = true">
  18. <view class="btn-title">加入队伍</view>
  19. <image src="/static/images/enter/activity/icon_more.png" class="es-icon-32 rightIcon" mode="">
  20. </image>
  21. <image src="/static/images/enter/activity/icon_join.png" class="bg-icon" mode=""></image>
  22. </view>
  23. </view>
  24. <view class="u-f-ajc u-f-jsb box es-mb-24" @tap="$navTo('/pages_enter/activity/team')" v-else>
  25. <view class="u-f-ajc">
  26. <view class="es-mr-40">
  27. <image :src="teamInfo.coverUrl || '/static/images/enter/activity/icon_team.png'"
  28. class="es-icon-88" mode="">
  29. </image>
  30. </view>
  31. <view class="">
  32. <view class="es-fs-36 es-c-22">
  33. {{teamInfo.title || ''}}
  34. </view>
  35. <!-- <view class="es-fs-28 es-c-55 es-mt-20" >
  36. 票数:123
  37. </view> -->
  38. </view>
  39. </view>
  40. <view class="">
  41. <image src="/static/images/enter/activity/icon_team_more.png" class="es-icon-36" mode="">
  42. </image>
  43. </view>
  44. </view>
  45. <!-- Awards Section -->
  46. <view class="section-box">
  47. <view class="section-title u-f u-f-ajc">
  48. <view class="line left"></view>
  49. <view class="dot"></view>
  50. <text class="title-text">活动奖品</text>
  51. <view class="dot"></view>
  52. <view class="line right"></view>
  53. </view>
  54. <view class="award-list">
  55. <view v-for="(item, index) in awards" :key="index" class="award-item u-f u-f-ac">
  56. <image :src="item.prizeUrl" class="award-img" mode="aspectFill"></image>
  57. <view class="award-info u-f u-f-ac">
  58. <view class="award-info-dot"></view>
  59. <view class="award-level">{{item.prizeLevel}}</view>
  60. <view class="award-name">{{item.prizeName}}</view>
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. <!-- Rules Section -->
  66. <view class="section-box">
  67. <view class="section-title u-f u-f-ajc">
  68. <view class="line left"></view>
  69. <view class="dot"></view>
  70. <text class="title-text">活动规则</text>
  71. <view class="dot"></view>
  72. <view class="line right"></view>
  73. </view>
  74. <view class="rules-content" v-html="teamInfo.rules"></view>
  75. </view>
  76. </view>
  77. <!-- Join Team Popup -->
  78. <u-popup :show="showJoinPopup" mode="center" :round="40" @close="showJoinPopup = false">
  79. <view class="join-popup-content">
  80. <view class="popup-title">队伍码</view>
  81. <view class="input-wrap">
  82. <u-input v-model="joinCode" placeholder="请输入队伍码" border="none" clearable></u-input>
  83. </view>
  84. <view class="input-wrap">
  85. <u-input v-model="joinName" placeholder="请输入名称" border="none" clearable></u-input>
  86. </view>
  87. <view class="popup-btns u-f">
  88. <view class="popup-btn cancel" @click="showJoinPopup = false">取消</view>
  89. <view class="popup-btn confirm" @click="handleConfirmJoin">加入</view>
  90. </view>
  91. </view>
  92. </u-popup>
  93. </view>
  94. </template>
  95. <script>
  96. import {
  97. signUpUser,
  98. getUserTeam,
  99. getActivityInfo
  100. } from '@/api/activity.js';
  101. export default {
  102. data() {
  103. return {
  104. showJoinPopup: false,
  105. joinName: '',
  106. joinCode: '',
  107. teamInfo: {},
  108. awards: [],
  109. joinShow: false, //是否组队
  110. bgColor: 'transparent',
  111. }
  112. },
  113. onShow() {
  114. this.fetchDetail();
  115. },
  116. onPageScroll(e) {
  117. if (e.scrollTop > 20) {
  118. this.bgColor = '#ffefef'
  119. } else {
  120. this.bgColor = 'transparent'
  121. }
  122. },
  123. methods: {
  124. async fetchDetail() {
  125. const res = await getUserTeam({
  126. activityId: 1
  127. })
  128. if (res.code == 200) {
  129. this.joinShow = true
  130. }
  131. const result = await getActivityInfo({
  132. activityId: 1
  133. })
  134. if (result.code == 200) {
  135. this.teamInfo = result.data
  136. this.awards = result.data.prize || []
  137. } else {
  138. uni.showToast({
  139. icon: 'none',
  140. title: result.msg
  141. })
  142. }
  143. },
  144. handleCreate() {
  145. uni.navigateTo({
  146. url: '/pages_enter/activity/create'
  147. });
  148. },
  149. async handleConfirmJoin() {
  150. if (!this.joinCode) {
  151. return uni.showToast({
  152. title: '请输入队伍码',
  153. icon: 'none'
  154. });
  155. }
  156. if (!this.joinName) {
  157. return uni.showToast({
  158. title: '请输入名称',
  159. icon: 'none'
  160. });
  161. }
  162. uni.showLoading({
  163. title: '正在加入...'
  164. });
  165. const res = await signUpUser({
  166. activityId: 1,
  167. teamCode: this.joinCode,
  168. userName: this.joinName
  169. })
  170. if (res.code == 200) {
  171. uni.hideLoading();
  172. uni.showToast({
  173. title: '加入成功',
  174. icon: 'success'
  175. });
  176. this.joinShow = true
  177. this.showJoinPopup = false;
  178. } else {
  179. uni.hideLoading();
  180. uni.showToast({
  181. icon: 'none',
  182. title: res.msg
  183. })
  184. }
  185. },
  186. goMyTeam() {
  187. uni.navigateTo({
  188. url: '/pages_enter/activity/team'
  189. });
  190. }
  191. }
  192. }
  193. </script>
  194. <style lang="scss" scoped>
  195. .activity-detail-page {
  196. min-height: 100vh;
  197. background-color: #FFF2F2;
  198. padding-bottom: 60rpx;
  199. }
  200. .bg_dance {
  201. width: 100%;
  202. position: absolute;
  203. top: 0;
  204. left: 0;
  205. z-index: 0;
  206. height: 530rpx;
  207. }
  208. .header-banner {
  209. height: 400rpx;
  210. background: linear-gradient(180deg, #FF9B9B 0%, #FFF2F2 100%);
  211. display: flex;
  212. align-items: center;
  213. justify-content: center;
  214. padding-top: 80rpx;
  215. .banner-text {
  216. width: calc(100vw - 48rpx);
  217. height: 200rpx;
  218. }
  219. }
  220. .content-container {
  221. padding: 0 30rpx;
  222. margin-top: -40rpx;
  223. position: relative;
  224. z-index: 2;
  225. }
  226. .action-grid {
  227. margin-bottom: 40rpx;
  228. .action-btn {
  229. width: 334rpx;
  230. height: 160rpx;
  231. border-radius: 24rpx;
  232. padding: 30rpx;
  233. position: relative;
  234. overflow: hidden;
  235. &.create {
  236. background: linear-gradient(135deg, #FF8E8E, #FF6B6B);
  237. }
  238. &.join {
  239. background: linear-gradient(135deg, #7EB1FF, #4D91FF);
  240. }
  241. .btn-title {
  242. font-size: 36rpx;
  243. font-weight: bold;
  244. color: #fff;
  245. margin-bottom: 16rpx;
  246. position: relative;
  247. z-index: 1;
  248. }
  249. .btn-icon {
  250. position: relative;
  251. z-index: 1;
  252. }
  253. .bg-icon {
  254. position: absolute;
  255. right: 10rpx;
  256. bottom: 0rpx;
  257. width: 124rpx;
  258. height: 112rpx;
  259. opacity: 0.3;
  260. }
  261. }
  262. }
  263. .section-box {
  264. background-color: #fff;
  265. border-radius: 24rpx;
  266. padding: 40rpx 30rpx;
  267. margin-bottom: 30rpx;
  268. .section-title {
  269. margin-bottom: 40rpx;
  270. .line {
  271. width: 60rpx;
  272. height: 2rpx;
  273. background: linear-gradient(90deg, transparent, #FF7E7E);
  274. &.right {
  275. background: linear-gradient(270deg, transparent, #FF7E7E);
  276. }
  277. }
  278. .dot {
  279. width: 8rpx;
  280. height: 8rpx;
  281. background-color: #FF7E7E;
  282. transform: rotate(45deg);
  283. margin: 0 16rpx;
  284. }
  285. .title-text {
  286. font-size: 32rpx;
  287. font-weight: bold;
  288. color: #333;
  289. }
  290. }
  291. }
  292. .award-list {
  293. max-height: 500rpx;
  294. overflow: hidden;
  295. overflow-y: auto;
  296. .award-item {
  297. background-color: #FFF8F8;
  298. border-radius: 16rpx;
  299. padding: 20rpx;
  300. margin-bottom: 20rpx;
  301. .award-img {
  302. width: 120rpx;
  303. height: 120rpx;
  304. border-radius: 12rpx;
  305. margin-right: 24rpx;
  306. background-color: #eee;
  307. }
  308. .award-info {
  309. flex: 1;
  310. .award-info-dot {
  311. width: 12rpx;
  312. height: 12rpx;
  313. background: #FF3245;
  314. border-radius: 50%;
  315. margin-right: 16rpx;
  316. }
  317. }
  318. .award-level {
  319. background-color: #ffddb6;
  320. color: #764105;
  321. font-size: 22rpx;
  322. padding: 4rpx 16rpx;
  323. border-radius: 8rpx;
  324. margin-right: 16rpx;
  325. }
  326. .award-name {
  327. font-size: 28rpx;
  328. color: #333;
  329. font-weight: 500;
  330. }
  331. }
  332. }
  333. .rules-content {
  334. .rule-line {
  335. font-size: 26rpx;
  336. color: #666;
  337. line-height: 1.8;
  338. margin-bottom: 20rpx;
  339. text-align: justify;
  340. }
  341. }
  342. .join-popup-content {
  343. width: 600rpx;
  344. padding: 60rpx 40rpx;
  345. background-color: #fff;
  346. .popup-title {
  347. font-size: 36rpx;
  348. font-weight: bold;
  349. color: #333;
  350. text-align: center;
  351. margin-bottom: 40rpx;
  352. }
  353. .input-wrap {
  354. background-color: #f8f8f8;
  355. border-radius: 40rpx;
  356. padding: 10rpx 40rpx;
  357. margin-bottom: 60rpx;
  358. }
  359. .popup-btns {
  360. justify-content: space-between;
  361. .popup-btn {
  362. width: 240rpx;
  363. height: 88rpx;
  364. border-radius: 44rpx;
  365. display: flex;
  366. align-items: center;
  367. justify-content: center;
  368. font-size: 32rpx;
  369. font-weight: 500;
  370. &.cancel {
  371. border: 2rpx solid #D9D9D9;
  372. color: #666;
  373. }
  374. &.confirm {
  375. background: linear-gradient(90deg, #2583EB, #4DA1FF);
  376. color: #fff;
  377. }
  378. }
  379. }
  380. }
  381. .box {
  382. background: #FFFFFF;
  383. border-radius: 24rpx;
  384. padding: 32rpx 34rpx;
  385. .es-icon-36 {
  386. width: 36rpx;
  387. height: 36rpx;
  388. }
  389. }
  390. </style>