top-info.vue 2.8 KB

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