top-info.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <template>
  2. <view>
  3. <view class="info-box">
  4. <image class="avatar" :src="childInfo.gender==='M'?'/static/default_icons/boy_avatar.svg':childInfo.gender===null?'/static/default_icons/boy_avatar.svg':'/static/default_icons/girl_avatar.svg'"></image>
  5. <view class="flex-column">
  6. <view class="info-name">{{childInfo.name}}</view>
  7. <view class="info-class">{{childInfo.className}}</view>
  8. </view>
  9. <view class="capsule-box">
  10. <view class="time-stamp">
  11. {{timeStamp}}更新
  12. </view>
  13. <view class="sub-tag" @click="navSubscribe">
  14. <view class="t-icon t-icon-huangguan1"></view>
  15. <view class="sub-tag-text">
  16. {{userData.subscribeLevel}}
  17. </view>
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. import {
  25. mapState,
  26. mapMutations
  27. } from 'vuex'
  28. export default {
  29. name: "top-info",
  30. props: {
  31. timeStamp: {
  32. type: String,
  33. default: false
  34. }
  35. },
  36. computed: {
  37. ...mapState('m_children', ['childInfo']),
  38. ...mapState('m_parent', ['userData'])
  39. },
  40. data() {
  41. return {
  42. capsuleWidth: ''
  43. };
  44. },
  45. created() {
  46. this.getCapsuleSite()
  47. },
  48. methods: {
  49. getCapsuleSite() {
  50. let res = uni.getMenuButtonBoundingClientRect()
  51. this.capsuleWidth = res.width - 14
  52. },
  53. navSubscribe() {
  54. uni.navigateTo({
  55. url: '/subpkg/mine/subInfo'
  56. })
  57. }
  58. }
  59. }
  60. </script>
  61. <style lang="scss">
  62. .info-box {
  63. margin: 560rpx 50rpx 0 50rpx;
  64. display: flex;
  65. align-items: center;
  66. z-index: 3;
  67. .avatar {
  68. width: 112rpx;
  69. height: 112rpx;
  70. border-radius: 100%;
  71. border: 4rpx solid #FFF;
  72. box-shadow: 0 10rpx 20rpx rgba(0, 0, 0, 0.2);
  73. z-index: 55;
  74. }
  75. .flex-column {
  76. margin-left: 40rpx;
  77. width: 200rpx;
  78. height: 120rpx;
  79. justify-content: space-around;
  80. .info-name {
  81. font-size: 55rpx;
  82. font-family: YSfont;
  83. color: #FFF;
  84. z-index: 99;
  85. }
  86. .info-class {
  87. font-size: 40rpx;
  88. font-family: YSfont;
  89. color: #FFF;
  90. z-index: 99;
  91. }
  92. }
  93. .capsule-box {
  94. display: flex;
  95. flex-direction: column;
  96. align-items: center;
  97. justify-content: space-around;
  98. margin-left: auto;
  99. height: 120rpx;
  100. .sub-tag {
  101. display: flex;
  102. align-items: center;
  103. border-radius: 6rpx;
  104. padding: 2rpx 12rpx;
  105. transform: skew(-5deg);
  106. background: #2f3137;
  107. z-index: 99;
  108. .sub-tag-text {
  109. margin-left: 2rpx;
  110. font-size: 28rpx;
  111. font-family: YSfont;
  112. color: #d0a97e;
  113. z-index: 99;
  114. }
  115. .t-icon {
  116. width: 28rpx;
  117. height: 28rpx;
  118. margin-top: -2rpx;
  119. margin-right: 2rpx;
  120. }
  121. }
  122. .time-stamp {
  123. color: #FFF;
  124. font-size: 24rpx;
  125. font-family: YSfont;
  126. }
  127. }
  128. }
  129. </style>