index.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <template>
  2. <view>
  3. <!-- 非H5撑高元素 -->
  4. <view class="status_bar"></view>
  5. <!-- 头部背景 -->
  6. <view class="user"></view>
  7. <!-- 账户信息 -->
  8. <view class="account">
  9. <view class="flex account-ava">
  10. <image src="../../static/logo.png" mode=""></image>
  11. <view class="account-ava-name" v-if="loginState">寒露</view>
  12. <view class="account-ava-no" @click="toLogin">登录</view>
  13. </view>
  14. <view class="flex account-info">
  15. <navigator url="/pages/prize/index" class="flex account-info-item" hover-class="navigator-hover">
  16. <view>7</view>
  17. <view>我的奖品库</view>
  18. </navigator>
  19. <navigator url="/pages/ticket/index" class="flex account-info-item" hover-class="navigator-hover">
  20. <view>7</view>
  21. <view>我的盲票包</view>
  22. </navigator>
  23. <navigator url="/pages/bean/index" class="flex account-info-item" hover-class="navigator-hover">
  24. <view>7</view>
  25. <view>我的盲豆</view>
  26. </navigator>
  27. </view>
  28. </view>
  29. <!-- 操作项 -->
  30. <view class="action">
  31. <u-cell-group :border="false">
  32. <u-cell icon="order" title="我的订单" :isLink="true" :url="'/pages/order/index'"></u-cell>
  33. <u-cell icon="map" title="我的地址" :isLink="true" :url="'/pages/address/index'"></u-cell>
  34. <u-cell icon="kefu-ermai" title="联系客服" :isLink="true"></u-cell>
  35. <u-cell icon="info-circle" title="关于我们" :border="false" :isLink="true" :url="'/pages/about/index'">
  36. </u-cell>
  37. </u-cell-group>
  38. </view>
  39. <view class="cancel">
  40. <u-cell icon="close-circle" title="注销登录" :isLink="true" :border="false" @click="logout"></u-cell>
  41. </view>
  42. <custom-tab-bar :activeValue="'user'" />
  43. </view>
  44. </template>
  45. <script>
  46. import env from '../../config/env.js'
  47. import $http from '@/utils/request.js'
  48. import CustomTabBar from '../../components/custom-tab-bar/custom-tab-bar.vue'
  49. export default {
  50. components: {
  51. CustomTabBar,
  52. },
  53. data() {
  54. return {
  55. loginState: false, // 判断是否登录
  56. userInfo: {}, //
  57. avatar: '',
  58. certifyStatus: {},
  59. info: {},
  60. };
  61. },
  62. onShow() {
  63. this.loginState = uni.getStorageSync('token') ? true : false
  64. },
  65. methods: {
  66. // 跳转登录
  67. toLogin() {
  68. uni.navigateTo({
  69. url: "/pages/login/index"
  70. })
  71. },
  72. // 注销登录
  73. logout() {
  74. uni.showModal({
  75. title: '注销登录',
  76. content: '确定要注销登录吗?',
  77. success(res) {
  78. if (res.confirm) {
  79. uni.clearStorage({
  80. success: () => {
  81. wx.reLaunch({
  82. url: '/pages/login/entry',
  83. })
  84. }
  85. })
  86. }
  87. }
  88. })
  89. },
  90. },
  91. }
  92. </script>
  93. <style lang="scss" scoped>
  94. /deep/ .u-cell__body {
  95. padding: 20rpx 0;
  96. }
  97. .status_bar {
  98. width: 100%;
  99. height: var(--status-bar-height);
  100. }
  101. </style>
  102. <style lang="scss" scoped>
  103. .user {
  104. display: flex;
  105. align-items: center;
  106. height: 230rpx;
  107. padding: 0 36rpx;
  108. background: url(https://file02.16sucai.com/d/file/2014/1103/1b73e5346d5579badbc83cb15586f0a8.jpg) center no-repeat;
  109. }
  110. .account {
  111. margin: 0 20rpx;
  112. padding: 34rpx;
  113. background-color: #FFFFFF;
  114. border-radius: 10rpx;
  115. margin-top: -106rpx;
  116. margin-bottom: 40rpx;
  117. &-ava {
  118. justify-content: flex-start;
  119. margin-bottom: 46rpx;
  120. image {
  121. width: 106rpx;
  122. height: 106rpx;
  123. border-radius: 50%;
  124. overflow: hidden;
  125. }
  126. &-name {
  127. margin-left: 20rpx;
  128. font-size: 32rpx;
  129. }
  130. &-no {
  131. margin-left: 20rpx;
  132. color: #C0C0C0;
  133. font-size: 32rpx;
  134. }
  135. }
  136. &-info {
  137. justify-content: space-around;
  138. &-item {
  139. flex-direction: column;
  140. view {
  141. line-height: 40rpx;
  142. }
  143. view:first-child {
  144. line-height: 56rpx;
  145. font-size: 40rpx;
  146. }
  147. }
  148. }
  149. }
  150. .action {
  151. margin: 0 20rpx;
  152. padding: 10rpx 20rpx 0;
  153. background-color: #FFFFFF;
  154. border-radius: 10rpx;
  155. margin-bottom: 40rpx;
  156. }
  157. .cancel {
  158. margin: 0 20rpx;
  159. padding: 10rpx 20rpx;
  160. background-color: #FFFFFF;
  161. border-radius: 10rpx;
  162. }
  163. </style>