mine.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. <template>
  2. <view class="container">
  3. <view class="user">
  4. <view class="userInfo">
  5. <image class="userPhoto" :src="userInfo.avatarUrl"></image>
  6. <view class="info">
  7. <view class="name" v-if="hasLogin">
  8. {{userInfo.nickName}}
  9. </view>
  10. <view class="loginText" @click="toLogin" v-else>
  11. 点击登录
  12. </view>
  13. <view class="id">
  14. ID: {{userId}}
  15. </view>
  16. </view>
  17. </view>
  18. <view class="row">
  19. <view class="box">
  20. <view class="value" style="color: #FF2C43;">
  21. 1000
  22. </view>
  23. <view class="label">
  24. 积分
  25. </view>
  26. </view>
  27. <view class="box">
  28. <view class="value">
  29. 2
  30. </view>
  31. <view class="label">
  32. 优惠卷
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. <view class="menus">
  38. <view class="title">
  39. <image src="/static/img/mine/title.png" mode=""></image>
  40. </view>
  41. <view class="menuList">
  42. <view class="menu" @click="pageTo('/pages/addressManage/addressManage')">
  43. <image src="/static/img/mine/menu1.png"></image>
  44. <span>地址管理</span>
  45. </view>
  46. <view class="menu">
  47. <image src="/static/img/mine/menu2.png"></image>
  48. <span>消费记录</span>
  49. </view>
  50. <view class="menu">
  51. <image src="/static/img/mine/menu3.png"></image>
  52. <span>加群交流</span>
  53. </view>
  54. <view class="menu">
  55. <image src="/static/img/mine/menu4.png"></image>
  56. <span>游戏规则</span>
  57. </view>
  58. <view class="menu">
  59. <image src="/static/img/mine/menu5.png"></image>
  60. <span>用户协议</span>
  61. </view>
  62. <view class="menu">
  63. <image src="/static/img/mine/menu6.png"></image>
  64. <span>联系客服</span>
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. </template>
  70. <script>
  71. export default {
  72. data() {
  73. return {
  74. isLogin: false,
  75. userInfo: null,
  76. userId: '-',
  77. hasLogin: false,
  78. }
  79. },
  80. onShow() {
  81. //获取用户的登录信息
  82. if (wx.getStorageSync('token')) {
  83. this.userInfo = wx.getStorageSync('userInfo');
  84. this.userId = wx.getStorageSync('userId');
  85. this.hasLogin = true
  86. }
  87. },
  88. methods: {
  89. toLogin() {
  90. wx.navigateTo({url: '/pages/login/login'})
  91. },
  92. pageTo(url) {
  93. wx.navigateTo({url: url})
  94. },
  95. }
  96. }
  97. </script>
  98. <style scoped lang="scss">
  99. .container {
  100. background: #9EC8F9;
  101. padding: 0 10px;
  102. overflow: scroll;
  103. }
  104. .user {
  105. background: #fff;
  106. border-radius: 10px;
  107. padding: 0 10px;
  108. position: relative;
  109. margin-top: 10vw;
  110. .userInfo {
  111. display: flex;
  112. .userPhoto {
  113. width: 74px;
  114. height: 74px;
  115. border-radius: 50%;
  116. border: solid 3px #6BAFFF;
  117. position: relative;
  118. top: -20px;
  119. background: #dedede;
  120. }
  121. .info {
  122. padding: 10px;
  123. .name {
  124. font-weight: 600;
  125. }
  126. .loginText {
  127. font-weight: 600;
  128. }
  129. .id {
  130. margin-top: 5px;
  131. font-size: 13px;
  132. }
  133. }
  134. }
  135. .row {
  136. display: flex;
  137. justify-content: space-around;
  138. .box {
  139. display: flex;
  140. flex-direction: column;
  141. text-align: center;
  142. padding: 20px 10px;
  143. .label {
  144. margin-top: 5px;
  145. font-size: 15px;
  146. }
  147. .value {
  148. font-size: 20px;
  149. font-weight: 600;
  150. }
  151. }
  152. }
  153. }
  154. .menus {
  155. margin-top: 20px;
  156. background: #fff;
  157. border-radius: 10px;
  158. // padding: 0 10px;
  159. .title {
  160. position: relative;
  161. left: -10px;
  162. top: -10px;
  163. width: calc(100% + 10px);
  164. height: 55px;
  165. image {
  166. width: 100%;
  167. height: 100%;
  168. }
  169. }
  170. .menuList {
  171. display: grid;
  172. grid-template-columns: 1fr 1fr 1fr;
  173. padding: 20px 20px 0 20px;
  174. .menu {
  175. margin-bottom: 30px;
  176. display: flex;
  177. flex-direction: column;
  178. justify-content: center;
  179. align-items: center;
  180. image {
  181. width: 36px;
  182. height: 36px;
  183. }
  184. span {
  185. margin-top: 10px;
  186. font-size: 14px;
  187. }
  188. }
  189. }
  190. }
  191. </style>