Q3学习计划
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.

234 lines
5.4 KiB

  1. <template>
  2. <scroll-view class="viewport" scroll-y enable-back-to-top @scrolltolower="onScrolltolower">
  3. <!-- 个人资料 -->
  4. <view class="profile" :style="{ paddingTop: safeAreaInsets!.top + 'px' }">
  5. <!-- 情况1已登录 -->
  6. <view class="overview" v-if="memberStore.profile">
  7. <navigator url="/pagesMember/profile/profile" hover-class="none">
  8. <image class="avatar" :src="memberStore.profile.avatar" mode="aspectFill"></image>
  9. </navigator>
  10. <view class="meta">
  11. <view class="nickname">
  12. {{ memberStore.profile.nickname || memberStore.profile.account }}
  13. </view>
  14. <navigator class="extra" url="/pagesMember/profile/profile" hover-class="none">
  15. <text class="update">更新头像昵称</text>
  16. </navigator>
  17. </view>
  18. </view>
  19. <!-- 情况2未登录 -->
  20. <view class="overview" v-else>
  21. <navigator url="/pages/login/login" hover-class="none">
  22. <image
  23. class="avatar gray"
  24. mode="aspectFill"
  25. src="http://yjy-xiaotuxian-dev.oss-cn-beijing.aliyuncs.com/picture/2021-04-06/db628d42-88a7-46e7-abb8-659448c33081.png"
  26. ></image>
  27. </navigator>
  28. <view class="meta">
  29. <navigator url="/pages/login/login" hover-class="none" class="nickname">
  30. 未登录
  31. </navigator>
  32. <view class="extra">
  33. <text class="tips">点击登录账号</text>
  34. </view>
  35. </view>
  36. </view>
  37. <navigator class="settings" url="/pagesMember/settings/settings" hover-class="none">
  38. 设置
  39. </navigator>
  40. </view>
  41. <!-- 我的订单 -->
  42. <view class="orders">
  43. <view class="title">
  44. 我的订单
  45. <navigator class="navigator" url="/pagesOrder/list/list?type=0" hover-class="none">
  46. 查看全部订单<text class="icon-right"></text>
  47. </navigator>
  48. </view>
  49. <view class="section">
  50. <!-- 订单 -->
  51. <navigator
  52. v-for="item in orderTypes"
  53. :key="item.type"
  54. :class="item.icon"
  55. :url="`/pagesOrder/list/list?type=${item.type}`"
  56. class="navigator"
  57. hover-class="none"
  58. >
  59. {{ item.text }}
  60. </navigator>
  61. <!-- 客服 -->
  62. <button class="contact icon-handset" open-type="contact">售后</button>
  63. </view>
  64. </view>
  65. <!-- 猜你喜欢 -->
  66. <view class="guess">
  67. <XtxGuess ref="guessRef" />
  68. </view>
  69. </scroll-view>
  70. </template>
  71. <script setup lang="ts">
  72. import { useMemberStore } from '@/stores'
  73. import { useGuessList } from '@/composables'
  74. // 获取屏幕边界到安全区域距离
  75. const { safeAreaInsets } = uni.getSystemInfoSync()
  76. // 订单选项
  77. const orderTypes = [
  78. { type: 1, text: '待付款', icon: 'icon-currency' },
  79. { type: 2, text: '待发货', icon: 'icon-gift' },
  80. { type: 3, text: '待收货', icon: 'icon-check' },
  81. { type: 4, text: '待评价', icon: 'icon-comment' },
  82. ]
  83. // 获取会员信息
  84. const memberStore = useMemberStore()
  85. // 猜你喜欢
  86. const { guessRef, onScrolltolower } = useGuessList()
  87. </script>
  88. <style lang="scss">
  89. page {
  90. height: 100%;
  91. overflow: hidden;
  92. background-color: #f7f7f8;
  93. }
  94. .viewport {
  95. height: 100%;
  96. background-repeat: no-repeat;
  97. background-image: url(https://pcapi-xiaotuxian-front-devtest.itheima.net/miniapp/images/center_bg.png);
  98. background-size: 100% auto;
  99. }
  100. /* 用户信息 */
  101. .profile {
  102. margin-top: 30rpx;
  103. position: relative;
  104. .overview {
  105. display: flex;
  106. height: 120rpx;
  107. padding: 0 36rpx;
  108. color: #fff;
  109. }
  110. .avatar {
  111. width: 120rpx;
  112. height: 120rpx;
  113. border-radius: 50%;
  114. background-color: #eee;
  115. }
  116. .gray {
  117. filter: grayscale(100%);
  118. }
  119. .meta {
  120. display: flex;
  121. flex-direction: column;
  122. justify-content: center;
  123. align-items: flex-start;
  124. line-height: 30rpx;
  125. padding: 16rpx 0;
  126. margin-left: 20rpx;
  127. }
  128. .nickname {
  129. max-width: 180rpx;
  130. margin-bottom: 16rpx;
  131. font-size: 30rpx;
  132. overflow: hidden;
  133. text-overflow: ellipsis;
  134. white-space: nowrap;
  135. }
  136. .extra {
  137. display: flex;
  138. font-size: 20rpx;
  139. }
  140. .tips {
  141. font-size: 22rpx;
  142. }
  143. .update {
  144. padding: 3rpx 10rpx 1rpx;
  145. color: rgba(255, 255, 255, 0.8);
  146. border: 1rpx solid rgba(255, 255, 255, 0.8);
  147. margin-right: 10rpx;
  148. border-radius: 30rpx;
  149. }
  150. .settings {
  151. position: absolute;
  152. bottom: 0;
  153. right: 40rpx;
  154. font-size: 30rpx;
  155. color: #fff;
  156. }
  157. }
  158. /* 我的订单 */
  159. .orders {
  160. position: relative;
  161. z-index: 99;
  162. padding: 30rpx;
  163. margin: 50rpx 20rpx 0;
  164. background-color: #fff;
  165. border-radius: 10rpx;
  166. box-shadow: 0 4rpx 6rpx rgba(240, 240, 240, 0.6);
  167. .title {
  168. height: 40rpx;
  169. line-height: 40rpx;
  170. font-size: 28rpx;
  171. color: #1e1e1e;
  172. .navigator {
  173. font-size: 24rpx;
  174. color: #939393;
  175. float: right;
  176. }
  177. }
  178. .section {
  179. width: 100%;
  180. display: flex;
  181. justify-content: space-between;
  182. padding: 40rpx 20rpx 10rpx;
  183. .navigator,
  184. .contact {
  185. text-align: center;
  186. font-size: 24rpx;
  187. color: #333;
  188. &::before {
  189. display: block;
  190. font-size: 60rpx;
  191. color: #ff9545;
  192. }
  193. &::after {
  194. border: none;
  195. }
  196. }
  197. .contact {
  198. padding: 0;
  199. margin: 0;
  200. border: 0;
  201. background-color: transparent;
  202. line-height: inherit;
  203. }
  204. }
  205. }
  206. /* 猜你喜欢 */
  207. .guess {
  208. background-color: #f7f7f8;
  209. margin-top: 20rpx;
  210. }
  211. </style>