my-grades.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <template>
  2. <view class="page-container">
  3. <u-nav-bar title="本人成绩" ></u-nav-bar>
  4. <view class="u-bg"/>
  5. <view class="main-content">
  6. <view class="des">
  7. <view style="margin-bottom: 12rpx;">您的成绩绩点 {{myGrades.avgScore.toFixed(2) || '--'}} 已超越了</view>
  8. <view class="">
  9. <text class="value">{{myGrades.avgScoreMaxRank || '--'}}</text> 位同学
  10. </view>
  11. </view>
  12. <view class="statistics-item u-flex">
  13. <view class="name-grade">
  14. <view class="name">
  15. {{myGrades.studentName}}
  16. </view>
  17. <view class="grade">
  18. <!-- {{myGrades.genderId || '--'}} {{myGrades.majorName || '--'}} {{myGrades.gradeName}} -->
  19. {{myGrades.gradeName || '--'}}
  20. </view>
  21. </view>
  22. <view class="avg-score">
  23. 平均绩点:<text class="value">{{myGrades.avgScore.toFixed(2)}}</text>
  24. </view>
  25. <view class="icon-container u-flex-center">
  26. <view class="name">
  27. {{ Math.min(myGrades.avgScoreRank, myGrades.avgScoreMaxRank) }}
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. </template>
  34. <script>
  35. export default {
  36. data() {
  37. return {
  38. myGrades: {},
  39. }
  40. },
  41. mounted() {
  42. this.init()
  43. },
  44. methods: {
  45. async init() {
  46. uni.showLoading({
  47. title: '加载中'
  48. });
  49. this.$ajax.post('/shunt/score').then(res => {
  50. this.myGrades = res.data || {}
  51. }).catch(error => {
  52. this.myGrades = {}
  53. }).finally(() => {
  54. uni.hideLoading();
  55. })
  56. },
  57. }
  58. }
  59. </script>
  60. <style lang="scss" scoped>
  61. $bg-height: 560rpx;
  62. .page-container {
  63. .u-bg {
  64. height: $bg-height;
  65. background: url('/static/my_grades_bg.png');
  66. background-size: 100% 100%;
  67. background-repeat: no-repeat;
  68. background-position: center;
  69. background-origin: content-box;
  70. }
  71. .main-content {
  72. padding: 0 32rpx;
  73. }
  74. .des {
  75. margin-top: $bg-height - 112rpx - 230rpx - $u-nav-bar-height;
  76. height: 112rpx;
  77. font-size: 36rpx;
  78. font-weight: 400;
  79. color: #FFFFFF;
  80. .value {
  81. font-weight: bold;
  82. font-size: 64rpx;
  83. margin-right: 16rpx;
  84. }
  85. }
  86. .statistics-item {
  87. height: 230rpx;
  88. background: #FFFFFF;
  89. box-shadow: 0px 4px 22px 0px rgba(232, 237, 251, 0.8);
  90. border-radius: 16px;
  91. padding: 20rpx 20rpx 20rpx 126rpx;
  92. position: relative;
  93. transform: translateY(50%);
  94. .name-grade {
  95. .name {
  96. font-size: 36rpx;
  97. font-weight: bold;
  98. color: #333333;
  99. margin-bottom: 40rpx;
  100. }
  101. .grade {
  102. font-size: 24rpx;
  103. font-weight: bold;
  104. color: #A3ABBF;
  105. }
  106. }
  107. .avg-score {
  108. font-size: 28rpx;
  109. font-weight: 400;
  110. color: #A3ABBF;
  111. .value {
  112. font-weight: bold;
  113. color: #ED6E4E;
  114. }
  115. }
  116. .icon-container {
  117. position: absolute;
  118. top: 1rpx;
  119. left: 20rpx;
  120. width: 74rpx;
  121. height: 85rpx;
  122. background: url('/static/achievement_label.png');
  123. background-size: 100% 100%;
  124. background-repeat: no-repeat;
  125. background-position: center;
  126. background-origin: content-box;
  127. font-size: 32rpx;
  128. font-weight: bold;
  129. color: #FFFFFF;
  130. }
  131. }
  132. }
  133. </style>