answerPromptPopup.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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" @tap="goIntegralGoodsList">前往积分商城兑换</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. goIntegralGoodsList() {
  57. uni.navigateTo({
  58. url: '/pages_points/integralGoodsList'
  59. })
  60. }
  61. }
  62. }
  63. </script>
  64. <style lang="scss" scoped>
  65. @mixin u-flex($flexD, $alignI, $justifyC) {
  66. display: flex;
  67. flex-direction: $flexD;
  68. align-items: $alignI;
  69. justify-content: $justifyC;
  70. }
  71. .dialog-box {
  72. width: calc(100vw - 160rpx);
  73. min-height: 440rpx;
  74. background: #ffffff;
  75. border-radius: 30rpx;
  76. padding: 40rpx 40rpx 60rpx;
  77. box-sizing: border-box;
  78. @include u-flex(column, center, center);
  79. }
  80. /* 标题文字 */
  81. .dialog-title {
  82. font-weight: 600;
  83. font-size: 40rpx;
  84. color: #000000;
  85. margin-bottom: 40rpx;
  86. }
  87. /* 积分文字行 */
  88. .points-text {
  89. font-weight: 600;
  90. font-size: 36rpx;
  91. color: rgba(0, 0, 0, 0.85);
  92. line-height: 50rpx;
  93. margin-bottom: 36rpx;
  94. }
  95. /* 红色积分数字 */
  96. .red-num {
  97. font-weight: 600;
  98. font-size: 56rpx;
  99. color: #FF233C;
  100. }
  101. /* 底部灰色小字 */
  102. .tips-text {
  103. font-weight: 400;
  104. font-size: 32rpx;
  105. color: rgba(0, 0, 0, 0.65);
  106. margin-bottom: 40rpx;
  107. }
  108. /* 按钮通用样式 */
  109. .btn {
  110. width: 390rpx;
  111. height: 84rpx;
  112. line-height: 78rpx;
  113. text-align: center;
  114. font-size: 32rpx;
  115. border-radius: 42rpx;
  116. margin-bottom: 32rpx;
  117. font-weight: 600;
  118. }
  119. /* 红色实心主按钮 */
  120. .primary-btn {
  121. background: linear-gradient(135deg, #FF5267 0%, #FF233C 100%);
  122. color: #ffffff;
  123. }
  124. /* 红色边框空心按钮 */
  125. .outline-btn {
  126. border: 2rpx solid #FF233C;
  127. color: #FF233CFF;
  128. background: transparent;
  129. margin-bottom: 0;
  130. }
  131. </style>