result.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <template>
  2. <view class="main-page">
  3. <view class="header">
  4. <view class="header-main" :style="view_height">
  5. <view class="header-img" >
  6. <view class="img"><image src="../../static/img/reult.png"></image></view>
  7. <p>您的得分为{{ scoreList.total_score }}分!</p>
  8. <p v-html="scoreList.content"></p>
  9. </view>
  10. </view>
  11. </view>
  12. <view v-if="likeList.length > 0 && isTrue" class="list-li" :style="view_class">
  13. <list :List="likeList"></list>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. import { getquestionresult,gettextList,getorderResult } from '../../api/test.js';
  19. import list from '@/components/list/list';
  20. import { mapGetters } from 'vuex';
  21. export default {
  22. components: {
  23. list
  24. },
  25. data() {
  26. return {
  27. isTrue: false,
  28. score: 0,
  29. view_height:{
  30. height: '240upx'
  31. },
  32. view_class:{
  33. top: '280px',
  34. width: '100%',
  35. position: 'absolute'
  36. },
  37. id: '',
  38. scoreList: {},
  39. likeList: []
  40. };
  41. },
  42. computed: {
  43. ...mapGetters(['allScorce','nameId','oid']),
  44. },
  45. onLoad(option) {
  46. // 获取分值
  47. let oid = uni.getStorageSync('oid');
  48. getorderResult({oid:oid}).then(res => {
  49. if (res.code == 1) {
  50. this.scoreList = res.data;
  51. }
  52. })
  53. this.getLikelist();
  54. },
  55. mounted() {
  56. // 动态计算高度,注意这个获取高度由于不准确,所以添加计时器,等dom元素展示后再获取高度
  57. setTimeout(() => {
  58. const query = uni.createSelectorQuery().in(this);
  59. let height;
  60. let top;
  61. query.select('.header-img').boundingClientRect(data => {
  62. top = data.height
  63. }).exec();
  64. query.select('.header').boundingClientRect(datas => {
  65. height = datas.height
  66. }).exec();
  67. this.view_height.height = top+'px'
  68. this.view_class.top = height+top+10+'px';
  69. this.isTrue = true;
  70. },1000)
  71. },
  72. methods: {
  73. // 获取喜欢数据的列表
  74. getLikelist(){
  75. gettextList().then(res => {
  76. if (res.code == 1) {
  77. this.likeList = res.data.list
  78. }
  79. })
  80. }
  81. }
  82. };
  83. </script>
  84. <style lang="scss" scoped>
  85. page {
  86. background-color: #F7F7F7;
  87. position: relative;
  88. .header{
  89. width: 100%;
  90. height: 291upx;
  91. background-color: #FFFFFF;
  92. background-position: 0 0;
  93. background-repeat: no-repeat;
  94. background-size: 100% 100%;
  95. position: relative;
  96. background-image: url('~@/static/img/result_banner.png');
  97. .header-main{
  98. width: 100%;
  99. background-color: #FFFFFF;
  100. min-height: 240upx;
  101. top: 291upx;
  102. position: absolute;
  103. }
  104. .header-img{
  105. width: 90%;
  106. left: 5%;
  107. box-shadow: 0upx 0upx 8upx rgba(128, 106, 0, 0.2);
  108. opacity: 1;
  109. overflow: hidden;
  110. clear: both;
  111. border-radius: 12upx;
  112. background-color: #FFFFFF;
  113. top: -30upx;
  114. padding-bottom: 20upx;
  115. position: absolute;
  116. // height: 462upx;
  117. .img{
  118. text-align: center;
  119. margin-top: 36upx;
  120. image{
  121. width: 350upx;
  122. height: 60upx;
  123. }
  124. }
  125. p{
  126. padding: 0upx 24upx;
  127. color: #434343;
  128. &:nth-child(1){
  129. text-align: center;
  130. }
  131. &:nth-child(2){
  132. text-align: center;
  133. font-size: 34upx;
  134. font-weight: 600;
  135. margin: 32upx 0upx;
  136. color: #3A3A3A;
  137. opacity: 1;
  138. }
  139. &:nth-child(3){
  140. margin-bottom: 20upx;
  141. }
  142. }
  143. }
  144. }
  145. .list-li{
  146. padding: 32upx 32upx 0upx 32upx;
  147. // margin-top: 480upx;
  148. background-color: #FFFFFF;
  149. }
  150. }
  151. </style>