爱简收旧衣按件回收前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

194 lines
4.8 KiB

5 days ago
  1. <template>
  2. <view class="promo-modal-page">
  3. <!-- 顶部导航栏 -->
  4. <view class="nav-bar" :style="{height: navBarTotalHeight + 'px', paddingTop: statusBarHeight + 'px'}">
  5. <view class="nav-bar-inner">
  6. <view class="back-icon" @tap="navigateBack">
  7. <uni-icons type="left" size="22" color="#222" />
  8. </view>
  9. <view class="nav-bar-title">推广链接</view>
  10. <view class="nav-bar-right">
  11. <uni-icons type="more-filled" size="22" color="#222" />
  12. </view>
  13. </view>
  14. </view>
  15. <!-- 用户信息 -->
  16. <view class="user-info-modal" :style="{ marginTop: navBarTotalHeight + 'px' }">
  17. <view class="avatar-frame">
  18. <image class="avatar-img" :src="userInfo.avatar" mode="aspectFill" />
  19. </view>
  20. <view class="nickname">{{userInfo.name}}</view>
  21. </view>
  22. <!-- 二维码区 -->
  23. <view class="qrcode-modal-section">
  24. <image class="qrcode-img" :src="qrcodeUrl" mode="aspectFit" />
  25. <view class="invite-code">邀请码{{inviteCode}}</view>
  26. </view>
  27. <!-- 底部按钮 -->
  28. <view class="bottom-btns-modal">
  29. <button class="btn gray">分享给好友</button>
  30. <button class="btn green">保存到本地</button>
  31. </view>
  32. </view>
  33. </template>
  34. <script>
  35. import pullRefreshMixin from '@/pages/mixins/pullRefreshMixin.js'
  36. export default {
  37. mixins: [pullRefreshMixin],
  38. data() {
  39. return {
  40. statusBarHeight: 0,
  41. navBarHeight: 44,
  42. navBarTotalHeight: 44,
  43. userInfo: {
  44. avatar: '/static/avatar.png',
  45. name: '战斗世界',
  46. },
  47. qrcodeUrl: '/static/qrcode.png',
  48. inviteCode: '888888',
  49. }
  50. },
  51. onLoad() {
  52. const sysInfo = uni.getSystemInfoSync()
  53. this.statusBarHeight = sysInfo.statusBarHeight
  54. this.navBarHeight = 44
  55. this.navBarTotalHeight = this.statusBarHeight + this.navBarHeight
  56. },
  57. methods: {
  58. async onRefresh() {
  59. // 模拟刷新数据
  60. await new Promise(resolve => setTimeout(resolve, 1000))
  61. this.stopPullRefresh()
  62. },
  63. navigateBack() {
  64. uni.navigateBack()
  65. },
  66. }
  67. }
  68. </script>
  69. <style lang="scss" scoped>
  70. .promo-modal-page {
  71. min-height: 100vh;
  72. background: linear-gradient(to bottom, #f6fff2 0%, #fff 100%);
  73. display: flex;
  74. flex-direction: column;
  75. align-items: center;
  76. position: relative;
  77. .nav-bar {
  78. position: fixed;
  79. top: 0;
  80. left: 0;
  81. right: 0;
  82. z-index: 1000;
  83. width: 100vw;
  84. background: linear-gradient(to right, #b2f08d 0%, #39e9d2 100%);
  85. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.03);
  86. .nav-bar-inner {
  87. display: flex;
  88. align-items: center;
  89. height: 44px;
  90. width: 100vw;
  91. position: relative;
  92. }
  93. .back-icon, .nav-bar-right {
  94. width: 44px;
  95. height: 44px;
  96. display: flex;
  97. align-items: center;
  98. justify-content: center;
  99. position: absolute;
  100. top: 0;
  101. }
  102. .back-icon { left: 0; }
  103. .nav-bar-right { right: 0; }
  104. .nav-bar-title {
  105. flex: 1;
  106. text-align: center;
  107. font-size: 36rpx;
  108. font-weight: bold;
  109. color: #222;
  110. letter-spacing: 2rpx;
  111. line-height: 44px;
  112. }
  113. }
  114. .user-info-modal {
  115. display: flex;
  116. flex-direction: column;
  117. align-items: center;
  118. .avatar-frame {
  119. width: 104rpx;
  120. height: 104rpx;
  121. border-radius: 10rpx;
  122. overflow: hidden;
  123. background: #f2f2f2;
  124. box-shadow: 0 4rpx 16rpx rgba(0,0,0,0.10);
  125. .avatar-img {
  126. width: 104rpx;
  127. height: 104rpx;
  128. object-fit: cover;
  129. display: block;
  130. }
  131. }
  132. .nickname {
  133. margin-top: 24rpx;
  134. font-size: 32rpx;
  135. font-weight: bold;
  136. color: #222;
  137. text-align: center;
  138. }
  139. }
  140. .qrcode-modal-section {
  141. margin-top: 48rpx;
  142. width: 80vw;
  143. display: flex;
  144. flex-direction: column;
  145. align-items: center;
  146. .qrcode-img {
  147. width: 80vw;
  148. height: 80vw;
  149. max-width: 480rpx;
  150. max-height: 480rpx;
  151. background: #fff;
  152. border-radius: 24rpx;
  153. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.08);
  154. }
  155. .invite-code {
  156. margin-top: 32rpx;
  157. font-size: 30rpx;
  158. color: #222;
  159. font-weight: bold;
  160. text-align: center;
  161. }
  162. }
  163. .bottom-btns-modal {
  164. position: fixed;
  165. left: 0;
  166. right: 0;
  167. bottom: 0;
  168. display: flex;
  169. justify-content: space-between;
  170. padding: 24rpx 32rpx calc(env(safe-area-inset-bottom) + 24rpx) 32rpx;
  171. background: #fff;
  172. z-index: 100;
  173. .btn {
  174. flex: 1;
  175. height: 88rpx;
  176. border-radius: 44rpx;
  177. font-size: 32rpx;
  178. font-weight: bold;
  179. margin: 0 12rpx;
  180. border: none;
  181. &.gray {
  182. background: linear-gradient(90deg, #f7f7f7, #f2f2f2);
  183. color: #888;
  184. }
  185. &.green {
  186. background: linear-gradient(90deg, #b2f08d, #39e9d2);
  187. color: #fff;
  188. }
  189. }
  190. }
  191. }
  192. </style>