student.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <template>
  2. <view class="container">
  3. <!-- 背景图片区域 -->
  4. <img class="img_bg" src="../../static/images/center-bg.png" />
  5. <!-- 学生信息区域 -->
  6. <view class="identity">学生</view>
  7. <view class="box">
  8. <img
  9. class="box_img"
  10. mode="aspectFill"
  11. :src="msg.headImage || '../../static/images/user-photo.png'"
  12. @click="previewImage(msg.headImage || '../../static/images/user-photo.png')"
  13. />
  14. <view class="box_info">
  15. <view class="info_name">{{ msg.name }}</view>
  16. <view class="info_phone">{{ msg.cardNo }}</view>
  17. </view>
  18. </view>
  19. <!-- 家长信息区域 -->
  20. <view class="identity">家长</view>
  21. <view class="box mb-50" v-for="item in msg.userParents" :key="item.id">
  22. <img
  23. class="box_img"
  24. mode="aspectFill"
  25. :src="item.headImage || '../../static/images/user-photo.png'"
  26. @click="previewImage(item.headImage || '../../static/images/user-photo.png')"
  27. />
  28. <view class="box_info">
  29. <view class="info_name">
  30. {{ item.name }}
  31. <view class="info_type">家长</view>
  32. </view>
  33. <view class="info_phone">{{ item.phone }}</view>
  34. </view>
  35. <view class="box_btn" @click="callPhone(item.phone)">呼叫</view>
  36. </view>
  37. <NoData v-if="!msg.userParents?.length" />
  38. </view>
  39. </template>
  40. <script setup>
  41. import { ref } from 'vue'
  42. import { onLoad } from '@dcloudio/uni-app'
  43. import { previewImage } from '@/utils/previewImage.js'
  44. import NoData from '@/components/noData.vue'
  45. onLoad((options) => {
  46. msg.value = JSON.parse(options.msg)
  47. })
  48. const msg = ref({})
  49. // 点击呼叫按钮回调
  50. const callPhone = (phoneNumber) => {
  51. uni.makePhoneCall({
  52. phoneNumber
  53. })
  54. }
  55. </script>
  56. <style lang="scss" scoped>
  57. .container {
  58. display: flex;
  59. flex-direction: column;
  60. padding: 0 20rpx;
  61. min-height: 100vh;
  62. background-color: #f1f6fe;
  63. // 背景图片区域样式
  64. .img_bg {
  65. position: absolute;
  66. top: -70rpx;
  67. right: 0;
  68. width: 589rpx;
  69. height: 320rpx;
  70. pointer-events: none;
  71. }
  72. .identity {
  73. margin: 20rpx 0 40rpx 0;
  74. color: #808080;
  75. font-size: 28rpx;
  76. }
  77. .box {
  78. display: flex;
  79. margin-bottom: 30rpx;
  80. height: 120rpx;
  81. .box_img {
  82. width: 120rpx;
  83. height: 120rpx;
  84. border-radius: 50%;
  85. }
  86. .box_info {
  87. display: flex;
  88. flex-direction: column;
  89. justify-content: space-evenly;
  90. margin-left: 22rpx;
  91. .info_name {
  92. display: flex;
  93. align-items: center;
  94. font-size: 32rpx;
  95. .info_type {
  96. margin-left: 15rpx;
  97. padding: 0 14rpx;
  98. height: 37rpx;
  99. line-height: 37rpx;
  100. font-size: 20rpx;
  101. color: #0061ff;
  102. border: 1rpx solid #0061ff;
  103. border-radius: 6rpx;
  104. background-color: #d9e7ff;
  105. }
  106. }
  107. .info_phone {
  108. color: #808080;
  109. font-size: 28rpx;
  110. }
  111. }
  112. .box_btn {
  113. display: flex;
  114. justify-content: center;
  115. align-items: center;
  116. align-self: center;
  117. margin-left: auto;
  118. width: 140rpx;
  119. height: 68rpx;
  120. color: #fff;
  121. font-size: 28rpx;
  122. border-radius: 10rpx;
  123. background-color: #0061ff;
  124. }
  125. }
  126. .mb-50 {
  127. margin-bottom: 50rpx;
  128. }
  129. }
  130. </style>