风险测评小程序前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

128 lines
2.8 KiB

  1. <template>
  2. <view class="card">
  3. <view class="flex card-header">
  4. <!-- todo: 缺切图 -->
  5. <image class="icon" src="@/static/image/icon.png" mode="widthFix"></image>
  6. <view>{{ unfinishCount ? `您还有${unfinishCount}道题未完成` : '您已完成测评,还未获取报告' }}</view>
  7. </view>
  8. <view class="card-content">
  9. <view class="row">
  10. <view class="row-label">答题时间</view>
  11. <view class="row-content">{{ $dayjs(data.createTime).format('YYYY-MM-DD HH:mm') }}</view>
  12. </view>
  13. </view>
  14. <view class="flex card-footer">
  15. <button class="btn" @click="onRestart">重新测评</button>
  16. <button v-if="unfinishCount" class="btn btn-primary" @click="onContinue">继续答题</button>
  17. <button v-else class="btn btn-primary" @click="onCreateReport">获取报告</button>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. export default {
  23. props: {
  24. data: {
  25. type: Object,
  26. default() {
  27. return {}
  28. }
  29. }
  30. },
  31. computed: {
  32. unfinishCount() {
  33. const { allNum, finishNum } = this.data
  34. return allNum - finishNum
  35. },
  36. },
  37. methods: {
  38. onRestart() {
  39. // todo: fetch by this.data.paperId
  40. // let id
  41. // uni.navigateTo({
  42. // url: `/pages_order/test/answer?id=${id}`
  43. // })
  44. uni.navigateTo({
  45. url: `/pages_order/test/start`
  46. })
  47. },
  48. onContinue() {
  49. uni.navigateTo({
  50. url: `/pages_order/test/answer?examId=${this.data.id}`,
  51. })
  52. },
  53. onCreateReport() {
  54. if (this.data.isPay) {
  55. uni.navigateTo({
  56. url: `/pages_order/report/userInfo?batchNo=${this.batchNo}`
  57. })
  58. } else {
  59. uni.navigateTo({
  60. url: `/pages_order/report/pay?batchNo=${this.data.batchNo}`
  61. })
  62. }
  63. },
  64. },
  65. }
  66. </script>
  67. <style scoped lang="scss">
  68. .card {
  69. position: relative;
  70. padding: 17rpx 0 22rpx 0;
  71. color: #000000;
  72. background: #FFFFFF;
  73. border-radius: 15rpx;
  74. overflow: hidden;
  75. &-header {
  76. justify-content: flex-start;
  77. column-gap: 24rpx;
  78. padding: 0 26rpx;
  79. font-size: 30rpx;
  80. .icon {
  81. width: 48rpx;
  82. height: auto;
  83. }
  84. }
  85. &-content {
  86. padding-left: 94rpx;
  87. }
  88. &-footer {
  89. padding: 22rpx 35rpx 0 35rpx;
  90. column-gap: 25rpx;
  91. }
  92. }
  93. .row {
  94. margin-top: 12rpx;
  95. display: flex;
  96. align-items: center;
  97. justify-content: flex-start;
  98. column-gap: 26rpx;
  99. font-size: 28rpx;
  100. color: #999999;
  101. }
  102. .btn {
  103. flex: 1;
  104. padding: 17rpx 0;
  105. box-sizing: border-box;
  106. font-family: PingFang SC;
  107. font-size: 22rpx;
  108. line-height: 1.4;
  109. color: #014FA2;
  110. border: 3rpx solid #014FA2;
  111. border-radius: 35rpx;
  112. &-primary {
  113. color: #FFFFFF;
  114. background: #014FA2;
  115. }
  116. }
  117. </style>