爱简收旧衣按件回收前端代码仓库
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.

196 lines
4.9 KiB

1 month 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. this.qrcodeUrl = getApp().globalData.configData.qr_path
  58. },
  59. methods: {
  60. async onRefresh() {
  61. // 模拟刷新数据
  62. await new Promise(resolve => setTimeout(resolve, 1000))
  63. uni.stopPullRefresh()
  64. },
  65. navigateBack() {
  66. uni.navigateBack()
  67. },
  68. }
  69. }
  70. </script>
  71. <style lang="scss" scoped>
  72. .promo-modal-page {
  73. min-height: 100vh;
  74. background: linear-gradient(to bottom, #f6fff2 0%, #fff 100%);
  75. display: flex;
  76. flex-direction: column;
  77. align-items: center;
  78. position: relative;
  79. .nav-bar {
  80. position: fixed;
  81. top: 0;
  82. left: 0;
  83. right: 0;
  84. z-index: 1000;
  85. width: 100vw;
  86. background: linear-gradient(to right, #b2f08d 0%, #39e9d2 100%);
  87. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.03);
  88. .nav-bar-inner {
  89. display: flex;
  90. align-items: center;
  91. height: 44px;
  92. width: 100vw;
  93. position: relative;
  94. }
  95. .back-icon, .nav-bar-right {
  96. width: 44px;
  97. height: 44px;
  98. display: flex;
  99. align-items: center;
  100. justify-content: center;
  101. position: absolute;
  102. top: 0;
  103. }
  104. .back-icon { left: 0; }
  105. .nav-bar-right { right: 0; }
  106. .nav-bar-title {
  107. flex: 1;
  108. text-align: center;
  109. font-size: 36rpx;
  110. font-weight: bold;
  111. color: #222;
  112. letter-spacing: 2rpx;
  113. line-height: 44px;
  114. }
  115. }
  116. .user-info-modal {
  117. display: flex;
  118. flex-direction: column;
  119. align-items: center;
  120. .avatar-frame {
  121. width: 104rpx;
  122. height: 104rpx;
  123. border-radius: 10rpx;
  124. overflow: hidden;
  125. background: #f2f2f2;
  126. box-shadow: 0 4rpx 16rpx rgba(0,0,0,0.10);
  127. .avatar-img {
  128. width: 104rpx;
  129. height: 104rpx;
  130. object-fit: cover;
  131. display: block;
  132. }
  133. }
  134. .nickname {
  135. margin-top: 24rpx;
  136. font-size: 32rpx;
  137. font-weight: bold;
  138. color: #222;
  139. text-align: center;
  140. }
  141. }
  142. .qrcode-modal-section {
  143. margin-top: 48rpx;
  144. width: 120vw;
  145. display: flex;
  146. flex-direction: column;
  147. align-items: center;
  148. .qrcode-img {
  149. width: 100%;
  150. height: 100%;
  151. max-width: 480rpx;
  152. max-height: 480rpx;
  153. background: #fff;
  154. border-radius: 24rpx;
  155. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.08);
  156. }
  157. .invite-code {
  158. margin-top: 32rpx;
  159. font-size: 30rpx;
  160. color: #222;
  161. font-weight: bold;
  162. text-align: center;
  163. }
  164. }
  165. .bottom-btns-modal {
  166. position: fixed;
  167. left: 0;
  168. right: 0;
  169. bottom: 0;
  170. display: flex;
  171. justify-content: space-between;
  172. padding: 24rpx 32rpx calc(env(safe-area-inset-bottom) + 24rpx) 32rpx;
  173. background: #fff;
  174. z-index: 100;
  175. .btn {
  176. flex: 1;
  177. height: 88rpx;
  178. border-radius: 44rpx;
  179. font-size: 32rpx;
  180. font-weight: bold;
  181. margin: 0 12rpx;
  182. border: none;
  183. &.gray {
  184. background: linear-gradient(90deg, #f7f7f7, #f2f2f2);
  185. color: #888;
  186. }
  187. &.green {
  188. background: linear-gradient(90deg, #b2f08d, #39e9d2);
  189. color: #fff;
  190. }
  191. }
  192. }
  193. }
  194. </style>