top-info.vue 2.8 KB

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