index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  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 frame" @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 frame" @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 frame" @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. props: {
  40. token: {
  41. type: String,
  42. default: () => '',
  43. },
  44. userInfo: {
  45. type: Object,
  46. default: () => {},
  47. },
  48. },
  49. data() {
  50. return {}
  51. },
  52. mounted() {},
  53. methods: {
  54. // 刷新token
  55. // refreshTokenil() {
  56. // var token = this.$cache.getToken()
  57. // this.token = token
  58. // var userInfo = this.$cache.getCache('userInfo')
  59. // this.userInfo = userInfo
  60. // this.$forceUpdate()
  61. // },
  62. // 登录注册
  63. login() {
  64. uni.navigateTo({
  65. url: '/pages/login'
  66. });
  67. },
  68. // 个人资料
  69. goPersonal() {
  70. if (this.token) {
  71. uni.navigateTo({
  72. url: '/pages/mine/personal'
  73. });
  74. } else {
  75. uni.$u.toast('请先登录')
  76. }
  77. },
  78. // 修改密码
  79. changePassword() {
  80. if (this.token) {
  81. uni.navigateTo({
  82. url: '/pages/mine/password'
  83. });
  84. } else {
  85. uni.$u.toast('请先登录')
  86. }
  87. },
  88. // 地址管理
  89. goAddress() {
  90. if (this.token) {
  91. uni.navigateTo({
  92. url: '/pages/mine/address'
  93. });
  94. } else {
  95. uni.$u.toast('请先登录')
  96. }
  97. },
  98. // 系统设置
  99. goSet() {
  100. if (this.token) {
  101. uni.navigateTo({
  102. url: '/pages/mine/system'
  103. });
  104. } else {
  105. uni.$u.toast('请先登录')
  106. }
  107. }
  108. }
  109. }
  110. </script>
  111. <style lang="scss">
  112. .card_user_title {
  113. display: flex;
  114. flex-direction: column;
  115. align-items: flex-start;
  116. }
  117. .card_mine {
  118. padding-top: var(--status-bar-height);
  119. padding: 0rpx 30rpx;
  120. }
  121. .mine_image {
  122. width: 100rpx;
  123. height: 100rpx;
  124. border-radius: 50%;
  125. }
  126. .mine_phone {
  127. margin-left: 20rpx;
  128. font-size: 30rpx;
  129. }
  130. .mine_title {
  131. margin-left: 20rpx;
  132. font-size: 40rpx;
  133. font-weight: bold;
  134. }
  135. .card_avatar {
  136. display: flex;
  137. align-items: center;
  138. margin-bottom: 60rpx;
  139. padding-top: 60rpx;
  140. }
  141. .card_mine_option {
  142. margin: 40rpx 0rpx;
  143. padding-bottom: 30rpx;
  144. // border-bottom: 2rpx solid transparent;
  145. // border-image: linear-gradient(to bottom, transparent 50%, #e7e6e4 50%) 0 0 100% 0;
  146. }
  147. .frame {
  148. position: relative; //重要
  149. }
  150. .frame::after {
  151. position: absolute;
  152. content: '';
  153. border-bottom: 2rpx solid #e7e6e4;
  154. // border-radius: 16rpx;
  155. width: 200%;
  156. height: 200%;
  157. top: 0;
  158. left: 0;
  159. transform: scale(0.5);
  160. transform-origin: 0 0;
  161. pointer-events: none;
  162. /* 使伪元素不会阻止鼠标事件 */
  163. }
  164. .option_title {
  165. font-size: 32rpx;
  166. font-weight: bold;
  167. }
  168. </style>