top-box.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <template>
  2. <view>
  3. <view class="no-login" v-if="!token">
  4. <view class="avatar"><image src="../../static/no-login.png"></image></view>
  5. <view class="context">您好,请授权登录</view>
  6. </view>
  7. <view class="login" v-else>
  8. <view class="avatar"><image :src="userinfo.avatarUrl"></image></view>
  9. <view class="info">
  10. <view class="name">{{userinfo.nickName}}</view>
  11. <view class="phone">
  12. <view><image src="../../static/ucenter/icon2.png"></image></view>
  13. <view>{{userinfo.mobile}}</view>
  14. </view>
  15. </view>
  16. <view class="join">
  17. <image src="../../static/ucenter/icon1.png"></image>
  18. <view class="days">已加入156天</view>
  19. </view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. export default {
  25. name:"top-box",
  26. data(){
  27. return{
  28. token:this.$store.getters.getToken,
  29. user:null
  30. }
  31. },
  32. watch:{
  33. token(val){
  34. console.log(val)
  35. }
  36. }
  37. }
  38. </script>
  39. <style lang="scss" scoped>
  40. .no-login{
  41. margin-top: 15rpx;
  42. display: flex;
  43. .avatar image{
  44. width: 70rpx;
  45. height: 70rpx;
  46. margin: 0 20rpx;
  47. }
  48. .context{
  49. color: #58be6b;
  50. font-size: 32rpx;
  51. font-weight: bold;
  52. line-height: 70rpx;
  53. }
  54. }
  55. .login{
  56. margin-top: 15rpx;
  57. display: flex;
  58. .avatar image{
  59. width: 110rpx;
  60. height: 110rpx;
  61. margin: 0 30rpx;
  62. border-radius: 50%;
  63. }
  64. .info{
  65. display: flex;
  66. flex-direction: column;
  67. height: 100rpx;
  68. justify-content: space-around;
  69. padding-top: 10rpx;
  70. margin-left: 5rpx;
  71. .name{
  72. color: #1d2129;
  73. font-size: 36rpx;
  74. font-weight: bold;
  75. }
  76. .phone{
  77. display: flex;
  78. font-size: 24rpx;
  79. color: #86909c;
  80. line-height: 36rpx;
  81. image{
  82. width: 36rpx;
  83. height: 36rpx;
  84. }
  85. }
  86. }
  87. .join{
  88. display: flex;
  89. padding-top: 15rpx;
  90. margin-left: 20rpx;
  91. position: relative;
  92. image{
  93. width: 42rpx;
  94. height: 48rpx;
  95. position: absolute;
  96. }
  97. .days{
  98. background-color: #f5f5f5;
  99. height: 44rpx;
  100. padding: 0 20rpx;
  101. margin-left: 20rpx;
  102. margin-top: 5rpx;
  103. border-top-right-radius:20rpx;
  104. border-bottom-right-radius:20rpx;
  105. font-size: 24rpx;
  106. color: #86909c;
  107. line-height: 44rpx;
  108. }
  109. }
  110. }
  111. </style>