mine.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <template>
  2. <view class="index">
  3. <view class="bg"></view>
  4. <view class="user" v-if="isLogin">
  5. <image :src="userinfo.avatar" mode=""></image>
  6. <view class="right">
  7. <text class="t1">{{ userinfo.nickname }}</text>
  8. <text class="t2">积分:{{ userinfo.score }}</text>
  9. <text class="t2 bio">{{ userinfo.bio }}</text>
  10. </view>
  11. </view>
  12. <view class="user" v-if="!isLogin">
  13. <view class="to-login" @tap="navigateTo('/pages/login/login')">请登录</view>
  14. </view>
  15. <view class="m_list">
  16. <view class="item" @tap="navigateTo('/pages/mine/updataUser')">
  17. <image src="../../static/yh.png" mode=""></image>
  18. <text class="t3">个人资料</text>
  19. <text class="icon right">&#xe60f;</text>
  20. </view>
  21. <view class="item" @tap="navigateTo('/pages/mine/order')">
  22. <image src="../../static/order.png" mode=""></image>
  23. <text class="t3">我的订单</text>
  24. <text class="icon right">&#xe60f;</text>
  25. </view>
  26. <view class="item" @tap="navigateTo(userinfo.dirver == 0 ? '/pages/mine/applyDriving' : '/pages/myDriving/myDriving')">
  27. <image src="../../static/dj.png" mode=""></image>
  28. <text class="t3">我是代驾</text>
  29. <text class="icon right">&#xe60f;</text>
  30. </view>
  31. <view class="item" @tap="navigateTo('/pages/mine/integral')">
  32. <image src="../../static/jf.png" mode=""></image>
  33. <text class="t3">积分</text>
  34. <text class="icon right">&#xe60f;</text>
  35. </view>
  36. <view class="item" @tap="navigateTo('/pages/mine/myForum')">
  37. <image src="../../static/wdcl.png" mode=""></image>
  38. <text class="t3">我的畅聊</text>
  39. <text class="icon right">&#xe60f;</text>
  40. </view>
  41. <view class="item" @tap="navigateTo('/pages/mine/setting')">
  42. <image src="../../static/sz.png" mode=""></image>
  43. <text class="t3">设置</text>
  44. <text class="icon right">&#xe60f;</text>
  45. </view>
  46. </view>
  47. </view>
  48. </template>
  49. <script>
  50. import helper from '../../common/helper.js';
  51. import api from '../../common/api.js';
  52. export default {
  53. data() {
  54. return {
  55. userinfo: {
  56. group_id: 1,
  57. nickname: '',
  58. score: 0,
  59. dirver:0
  60. },
  61. isLogin:false
  62. };
  63. },
  64. onShow() {
  65. if (!helper.hasLogin()) {
  66. this.isLogin=false;
  67. } else {
  68. this.isLogin=true;
  69. this.getUserInfo();
  70. }
  71. },
  72. methods: {
  73. async getUserInfo() {
  74. let res = await api.getUserInfo();
  75. this.userinfo = res.data;
  76. },
  77. navigateTo(url) {
  78. if(!helper.hasLogin()){
  79. url='/pages/login/login'
  80. }
  81. uni.navigateTo({
  82. url: url
  83. });
  84. }
  85. }
  86. };
  87. </script>
  88. <style lang="scss" scoped>
  89. page {
  90. background-color: #f7f7f7;
  91. }
  92. .bg {
  93. width: 100%;
  94. height: 260upx;
  95. background-color: #32c45e;
  96. }
  97. .user {
  98. width: 90%;
  99. display: flex;
  100. align-items: center;
  101. border-radius: 20upx;
  102. margin-left: 5%;
  103. margin-top: -110upx;
  104. background-color: #ffffff;
  105. box-shadow: 1px 1px 4px 0px #dfdfdf;
  106. height: 240upx;
  107. .to-login{
  108. text-align: center;
  109. color: #32c45e;
  110. width: 100%;
  111. }
  112. image {
  113. width: 140upx;
  114. height: 140upx;
  115. margin: 40upx;
  116. border-radius: 50%;
  117. }
  118. .right {
  119. display: flex;
  120. flex-direction: column;
  121. .t1 {
  122. font-size: 28upx;
  123. font-weight: 800;
  124. margin-bottom: 10upx;
  125. }
  126. .t2 {
  127. font-size: 24upx;
  128. font-weight: 800;
  129. }
  130. .bio{
  131. margin-top: 30upx;
  132. color: #555555;
  133. }
  134. }
  135. }
  136. .m_list {
  137. width: 90%;
  138. margin-left: 5%;
  139. background-color: #ffffff;
  140. border-radius: 20upx;
  141. margin-top: 10%;
  142. box-shadow: 1px 1px 4px 0px #dfdfdf;
  143. .item {
  144. display: flex;
  145. align-items: center;
  146. justify-content: center;
  147. padding: 40upx 20upx;
  148. image {
  149. width: 50upx;
  150. height: 50upx;
  151. }
  152. .icon {
  153. text-align: right;
  154. width: 10%;
  155. font-size: 28upx;
  156. color: #d7d7d7;
  157. }
  158. .t3 {
  159. width: 75%;
  160. margin-left: 5%;
  161. font-size: 28upx;
  162. }
  163. }
  164. }
  165. </style>