index.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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" v-if="getQrcode() == true" @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. getQrcode() {
  48. var userInfo = this.$cache.getCache('userInfo')
  49. let flag = false
  50. if (userInfo.provUser) {
  51. if (userInfo.provUser.isorders == 0 && userInfo.provUser.userType == 3) {
  52. flag = false
  53. } else if (userInfo.provUser.userType == 3) {
  54. flag = true
  55. } else if (userInfo.provUser.userType == 4) {
  56. flag = false
  57. } else if (userInfo.provUser.userType == 5) {
  58. flag = true
  59. }
  60. } else {
  61. flag = false
  62. }
  63. return flag
  64. },
  65. //微信授权
  66. set_is_login(val) {
  67. let _this = this;
  68. uni.getUserProfile({
  69. 'desc': '获取用户基本信息',
  70. 'lang': 'zh_CN',
  71. success: function(infoRes) {
  72. console.log(infoRes, 8)
  73. uni.login({
  74. success: function(loginRes) {
  75. console.log(loginRes, 23)
  76. }
  77. });
  78. },
  79. });
  80. },
  81. // 登录注册
  82. login() {
  83. uni.navigateTo({
  84. url: '/pages/login'
  85. });
  86. },
  87. // 个人资料
  88. goPersonal() {
  89. uni.navigateTo({
  90. url: '/pages/mine/personal'
  91. });
  92. },
  93. // 我的二维码
  94. goErweima() {
  95. uni.navigateTo({
  96. url: '/pages/mine/erweima'
  97. });
  98. },
  99. // 系统设置
  100. goSet() {
  101. uni.navigateTo({
  102. url: '/pages/mine/system'
  103. });
  104. }
  105. }
  106. }
  107. </script>
  108. <style lang="scss">
  109. .card_user_title {
  110. display: flex;
  111. flex-direction: column;
  112. align-items: flex-start;
  113. }
  114. .card_mine {
  115. padding-top: var(--status-bar-height);
  116. padding: 0rpx 30rpx;
  117. }
  118. .mine_image {
  119. width: 100rpx;
  120. height: 100rpx;
  121. border-radius: 50%;
  122. }
  123. .mine_phone {
  124. margin-left: 20rpx;
  125. font-size: 30rpx;
  126. }
  127. .mine_title {
  128. margin-left: 20rpx;
  129. font-size: 40rpx;
  130. font-weight: bold;
  131. }
  132. .card_avatar {
  133. display: flex;
  134. align-items: center;
  135. margin-bottom: 60rpx;
  136. padding-top: 60rpx;
  137. }
  138. .card_mine_option {
  139. margin: 40rpx 0rpx;
  140. padding-bottom: 30rpx;
  141. border-bottom: 2rpx solid #E4E7ED;
  142. }
  143. .option_title {
  144. font-size: 32rpx;
  145. font-weight: bold;
  146. }
  147. </style>