answerPromptPopup.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <template>
  2. <u-popup :show="showPopup" mode="center" round="30" @close="close">
  3. <view class="dialog-box">
  4. <template v-if="~~typeStatus === 1">
  5. <view class="dialog-title">恭喜你,回答正确</view>
  6. <view class="points-text">
  7. 获得<text class="red-num">{{ pointsNum }}</text>积分,自动到账
  8. </view>
  9. </template>
  10. <template v-if="~~typeStatus === 2">
  11. <view class="dialog-title">很遗憾答错了</view>
  12. <view class="points-text">请继续努力哦</view>
  13. </template>
  14. <template v-if="~~typeStatus === 3">
  15. <view class="dialog-title">今天答题次数已用完</view>
  16. <view class="points-text">明天再来哦</view>
  17. </template>
  18. <view class="tips-text">每节课拥有3次答题机会</view>
  19. <view v-if="~~typeStatus === 1" class="btn primary-btn">前往积分商城兑换</view>
  20. <view class="btn outline-btn" @tap="close">继续观看</view>
  21. </view>
  22. </u-popup>
  23. </template>
  24. <script>
  25. export default {
  26. props: {
  27. isShow: {
  28. type: Boolean,
  29. default: false
  30. },
  31. typeStatus: {
  32. type: Number,
  33. default: 1, //提示类型:1、回答正确,2、回答错误,3、答题次数用完
  34. },
  35. pointsNum: {
  36. type: Number,
  37. default: 0, // 积分数量
  38. }
  39. },
  40. data() {
  41. return {
  42. showPopup: false,
  43. }
  44. },
  45. watch: {
  46. isShow(newVal) {
  47. this.showPopup = newVal
  48. }
  49. },
  50. methods: {
  51. // 关闭弹框
  52. close() {
  53. this.$emit('closeMethod')
  54. },
  55. }
  56. }
  57. </script>
  58. <style lang="scss" scoped>
  59. @mixin u-flex($flexD, $alignI, $justifyC) {
  60. display: flex;
  61. flex-direction: $flexD;
  62. align-items: $alignI;
  63. justify-content: $justifyC;
  64. }
  65. .dialog-box {
  66. width: calc(100vw - 160rpx);
  67. min-height: 440rpx;
  68. background: #ffffff;
  69. border-radius: 30rpx;
  70. padding: 40rpx 40rpx 60rpx;
  71. box-sizing: border-box;
  72. @include u-flex(column, center, center);
  73. }
  74. /* 标题文字 */
  75. .dialog-title {
  76. font-weight: 600;
  77. font-size: 40rpx;
  78. color: #000000;
  79. margin-bottom: 40rpx;
  80. }
  81. /* 积分文字行 */
  82. .points-text {
  83. font-weight: 600;
  84. font-size: 36rpx;
  85. color: rgba(0, 0, 0, 0.85);
  86. line-height: 50rpx;
  87. margin-bottom: 36rpx;
  88. }
  89. /* 红色积分数字 */
  90. .red-num {
  91. font-weight: 600;
  92. font-size: 56rpx;
  93. color: #FF233C;
  94. }
  95. /* 底部灰色小字 */
  96. .tips-text {
  97. font-weight: 400;
  98. font-size: 32rpx;
  99. color: rgba(0, 0, 0, 0.65);
  100. margin-bottom: 40rpx;
  101. }
  102. /* 按钮通用样式 */
  103. .btn {
  104. width: 390rpx;
  105. height: 84rpx;
  106. line-height: 78rpx;
  107. text-align: center;
  108. font-size: 32rpx;
  109. border-radius: 42rpx;
  110. margin-bottom: 32rpx;
  111. font-weight: 600;
  112. }
  113. /* 红色实心主按钮 */
  114. .primary-btn {
  115. background: linear-gradient(135deg, #FF5267 0%, #FF233C 100%);
  116. color: #ffffff;
  117. }
  118. /* 红色边框空心按钮 */
  119. .outline-btn {
  120. border: 2rpx solid #FF233C;
  121. color: #FF233CFF;
  122. background: transparent;
  123. margin-bottom: 0;
  124. }
  125. </style>