questionPopup.nvue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <template>
  2. <view class="video_question_popup_mask" @touchmove.stop.prevent>
  3. <view class="video_question_popup_wrapper">
  4. <view class="video_question_popup_header">
  5. <text class="video_question_popup_title">试题弹出</text>
  6. </view>
  7. <view class="video_question_popup_content">
  8. <view class="video_question_popup_content_title">{{ question?.codeName }}:{{ question?.questionsName }}
  9. </view>
  10. <textarea class="video_question_popup_content_textarea" v-model="answer" placeholder="请输入你的回答"
  11. placeholder-style="font-weight: 400;font-size: 28rpx;color: #999999;" :auto-height="false"
  12. maxlength="500" />
  13. </view>
  14. <view class="video_question_popup_footer">
  15. <view class="video_question_popup_footer_confirm_btn" @click="handleSubmit">
  16. <text class="video_question_popup_footer_confirm_btn_text">确定</text>
  17. </view>
  18. </view>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. import {
  24. onLoad,
  25. onUnload
  26. } from '@dcloudio/uni-app';
  27. export default {
  28. data() {
  29. return {
  30. question: null,
  31. answer: ''
  32. }
  33. },
  34. onLoad() {
  35. const question = uni.getStorageSync('videoDetailSendQuestion');
  36. this.question = question ? JSON.parse(question) : null;
  37. this.answer = '';
  38. },
  39. methods: {
  40. handleSubmit() {
  41. if (!this.answer.trim()) {
  42. uni.showToast({
  43. title: '请输入答案!',
  44. icon: 'none'
  45. });
  46. return;
  47. }
  48. // 将提交结果写入临时存储
  49. uni.setStorageSync('videoDetailQuestionPopupSubmit', this.answer)
  50. uni.navigateBack()
  51. }
  52. },
  53. onUnload() {
  54. // 兜底清理
  55. uni.removeStorageSync('videoDetailSendQuestion')
  56. }
  57. }
  58. </script>
  59. <style>
  60. .video_question_popup_mask {
  61. flex: 1;
  62. background-color: rgba(0, 0, 0, 0.5);
  63. display: flex;
  64. justify-content: center;
  65. align-items: center;
  66. }
  67. .video_question_popup_wrapper {
  68. width: 702rpx;
  69. background-color: #ffffff;
  70. border-radius: 16rpx;
  71. overflow: hidden;
  72. }
  73. .video_question_popup_header {
  74. width: 702rpx;
  75. height: 96rpx;
  76. background-color: #F5F7FA;
  77. border-radius: 16px 16px 0px 0px;
  78. }
  79. .video_question_popup_title {
  80. font-weight: 500;
  81. font-size: 32rpx;
  82. color: #303133;
  83. margin-left: 40rpx;
  84. line-height: 96rpx;
  85. }
  86. .video_question_popup_content {
  87. padding: 40rpx;
  88. height: 504rpx;
  89. }
  90. .video_question_popup_content_title {
  91. display: flex;
  92. font-weight: 400;
  93. font-size: 32rpx;
  94. color: #303133;
  95. text-align: left;
  96. }
  97. .video_question_popup_content_textarea {
  98. margin-top: 20rpx;
  99. flex: 1;
  100. height: 440rpx;
  101. border: 2rpx solid #E9E9E9;
  102. border-radius: 8rpx;
  103. padding: 20rpx 24rpx;
  104. font-size: 28rpx;
  105. color: #303133;
  106. }
  107. .video_question_popup_footer {
  108. display: flex;
  109. flex-direction: row;
  110. border-top: 2rpx solid #EBEEF5;
  111. padding: 30rpx 40rpx;
  112. justify-content: flex-end;
  113. }
  114. .video_question_popup_footer_confirm_btn {
  115. background-color: #2E64FA;
  116. border-radius: 8rpx;
  117. flex: 1;
  118. height: 72rpx;
  119. display: flex;
  120. justify-content: center;
  121. align-items: center;
  122. }
  123. .video_question_popup_footer_confirm_btn_text {
  124. font-weight: 500;
  125. font-size: 28rpx;
  126. color: #FFFFFF;
  127. }
  128. </style>