index.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <template>
  2. <!-- 我的 -->
  3. <view class="card_mine">
  4. <view class="card_avatar" v-if="token != ''">
  5. <image class="mine_image" src="../../static/portrait.png" mode=""></image>
  6. <view class="card_user_title">
  7. <view class="mine_phone">{{userInfo.nickName}}</view>
  8. <view class="mine_phone">{{userInfo.username}}</view>
  9. </view>
  10. </view>
  11. <view class="card_avatar" v-else @click="login">
  12. <image class="mine_image" src="../../static/portrait.png" mode=""></image>
  13. <view class="mine_title">登录/注册</view>
  14. </view>
  15. <view class="space_between card_mine_option" @click="goPersonal">
  16. <view class="option_title">个人资料</view>
  17. <u-icon name="arrow-right" size="20"></u-icon>
  18. </view>
  19. <view class="space_between card_mine_option" @click="goErweima">
  20. <view class="option_title">我的二维码</view>
  21. <span class="iconfont icon-erweima"></span>
  22. </view>
  23. <view class="space_between card_mine_option" @click="goSet">
  24. <view class="option_title">系统设置</view>
  25. <u-icon name="arrow-right" size="20"></u-icon>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. export default {
  31. props: {
  32. token: {
  33. type: String,
  34. default: () => '',
  35. },
  36. userInfo: {
  37. type: Object,
  38. default: () => {},
  39. },
  40. },
  41. data() {
  42. return {}
  43. },
  44. mounted() {},
  45. methods: {
  46. //微信授权
  47. set_is_login(val) {
  48. let _this = this;
  49. uni.getUserProfile({
  50. 'desc': '获取用户基本信息',
  51. 'lang': 'zh_CN',
  52. success: function(infoRes) {
  53. console.log(infoRes, 8)
  54. uni.login({
  55. success: function(loginRes) {
  56. console.log(loginRes, 23)
  57. }
  58. });
  59. },
  60. });
  61. },
  62. // 登录注册
  63. login() {
  64. uni.navigateTo({
  65. url: '/pages/login'
  66. });
  67. },
  68. // 个人资料
  69. goPersonal() {
  70. uni.navigateTo({
  71. url: '/pages/mine/personal'
  72. });
  73. },
  74. // 我的二维码
  75. goErweima() {
  76. uni.navigateTo({
  77. url: '/pages/mine/erweima'
  78. });
  79. },
  80. // 系统设置
  81. goSet() {
  82. uni.navigateTo({
  83. url: '/pages/mine/system'
  84. });
  85. }
  86. }
  87. }
  88. </script>
  89. <style lang="scss">
  90. .card_user_title {
  91. display: flex;
  92. flex-direction: column;
  93. align-items: flex-start;
  94. }
  95. .card_mine {
  96. padding-top: var(--status-bar-height);
  97. padding: 0rpx 30rpx;
  98. }
  99. .mine_image {
  100. width: 100rpx;
  101. height: 100rpx;
  102. border-radius: 50%;
  103. }
  104. .mine_phone {
  105. margin-left: 20rpx;
  106. font-size: 30rpx;
  107. }
  108. .mine_title {
  109. margin-left: 20rpx;
  110. font-size: 40rpx;
  111. font-weight: bold;
  112. }
  113. .card_avatar {
  114. display: flex;
  115. align-items: center;
  116. margin-bottom: 60rpx;
  117. padding-top: 60rpx;
  118. }
  119. .card_mine_option {
  120. margin: 40rpx 0rpx;
  121. padding-bottom: 30rpx;
  122. border-bottom: 2rpx solid #E4E7ED;
  123. }
  124. .option_title {
  125. font-size: 32rpx;
  126. font-weight: bold;
  127. }
  128. </style>