index.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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.principalPhone}}</view>
  8. <view class="mine_phone">{{userInfo.principalName}}</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="changePassword">
  20. <view class="option_title">修改密码</view>
  21. <u-icon name="arrow-right" size="20"></u-icon>
  22. </view>
  23. <view class="space_between card_mine_option" @click="goAddress">
  24. <view class="option_title">地址管理</view>
  25. <u-icon name="arrow-right" size="20"></u-icon>
  26. </view>
  27. <!-- <view class="space_between card_mine_option" @click="goPersonal">
  28. <view class="option_title">我的安全检查</view>
  29. <u-icon name="arrow-right" size="20"></u-icon>
  30. </view> -->
  31. <view class="space_between card_mine_option" @click="goSet">
  32. <view class="option_title">系统设置</view>
  33. <u-icon name="arrow-right" size="20"></u-icon>
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. export default {
  39. data() {
  40. return {
  41. token: '',
  42. userInfo: {},
  43. }
  44. },
  45. created() {
  46. var token = this.$cache.getToken()
  47. this.token = token
  48. var userInfo = this.$cache.getCache('userInfo')
  49. this.userInfo = userInfo
  50. },
  51. mounted() {},
  52. methods: {
  53. // 刷新token
  54. refreshTokenil() {
  55. var token = this.$cache.getToken()
  56. this.token = token
  57. var userInfo = this.$cache.getCache('userInfo')
  58. this.userInfo = userInfo
  59. this.$forceUpdate()
  60. },
  61. // 登录注册
  62. login() {
  63. uni.navigateTo({
  64. url: '/pages/login'
  65. });
  66. },
  67. // 个人资料
  68. goPersonal() {
  69. if (this.token) {
  70. uni.navigateTo({
  71. url: '/pages/mine/personal'
  72. });
  73. } else {
  74. uni.$u.toast('请先登录')
  75. }
  76. },
  77. // 修改密码
  78. changePassword() {
  79. if (this.token) {
  80. uni.navigateTo({
  81. url: '/pages/mine/password'
  82. });
  83. } else {
  84. uni.$u.toast('请先登录')
  85. }
  86. },
  87. // 地址管理
  88. goAddress() {
  89. if (this.token) {
  90. uni.navigateTo({
  91. url: '/pages/mine/address'
  92. });
  93. } else {
  94. uni.$u.toast('请先登录')
  95. }
  96. },
  97. // 系统设置
  98. goSet() {
  99. if (this.token) {
  100. uni.navigateTo({
  101. url: '/pages/mine/system'
  102. });
  103. } else {
  104. uni.$u.toast('请先登录')
  105. }
  106. }
  107. }
  108. }
  109. </script>
  110. <style lang="scss">
  111. .card_user_title {
  112. display: flex;
  113. flex-direction: column;
  114. align-items: flex-start;
  115. }
  116. .card_mine {
  117. padding-top: var(--status-bar-height);
  118. padding: 0rpx 30rpx;
  119. }
  120. .mine_image {
  121. width: 100rpx;
  122. height: 100rpx;
  123. border-radius: 50%;
  124. }
  125. .mine_phone {
  126. margin-left: 20rpx;
  127. font-size: 30rpx;
  128. }
  129. .mine_title {
  130. margin-left: 20rpx;
  131. font-size: 40rpx;
  132. font-weight: bold;
  133. }
  134. .card_avatar {
  135. display: flex;
  136. align-items: center;
  137. margin-bottom: 60rpx;
  138. padding-top: 60rpx;
  139. }
  140. .card_mine_option {
  141. margin: 40rpx 0rpx;
  142. padding-bottom: 30rpx;
  143. border-bottom: 2rpx solid transparent;
  144. border-image: linear-gradient(to bottom, transparent 50%, #e7e6e4 50%) 0 0 100% 0;
  145. }
  146. .option_title {
  147. font-size: 32rpx;
  148. font-weight: bold;
  149. }
  150. </style>