question-correct-popup.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <template>
  2. <!-- #ifdef H5 -->
  3. <teleport to="body">
  4. <!-- #endif -->
  5. <!-- #ifdef MP-WEIXIN -->
  6. <root-portal externalClass="theme-ie">
  7. <!-- #endif -->
  8. <uv-popup ref="popupRef" mode="center" :close-on-click-overlay="false" :closeable="false" :round="12">
  9. <view class="theme-ie popup-content box-border bg-white">
  10. <view class="popup-header">
  11. <view class="popup-header-title">
  12. <text>试题纠错</text>
  13. </view>
  14. </view>
  15. <view class="px-30">
  16. <view class="h-60 flex items-center justify-between border-0 border-b border-solid border-[#efefef]">
  17. <view class="flex items-center gap-x-10">
  18. <text>试题编号</text>
  19. <ie-image src="/static/image/icon-lock.png" custom-class="w-26 h-26" mode="aspectFit" />
  20. </view>
  21. <text class="text-fore-light">{{ questionId }}</text>
  22. </view>
  23. <view class="mt-30">
  24. <uv-textarea v-model="remark" placeholder="在这里填写问题描述" count :height="100" :maxlength="200" />
  25. </view>
  26. </view>
  27. <view class="mt-50 mx-30 mb-30 flex items-center gap-x-30">
  28. <view class="flex-1">
  29. <uv-button type="error" plain shape="circle" @click="close">取消</uv-button>
  30. </view>
  31. <view class="flex-1">
  32. <uv-button type="primary" shape="circle" :disabled="submitBtnDisabled"
  33. @click="handleSubmit">提交</uv-button>
  34. </view>
  35. </view>
  36. </view>
  37. </uv-popup>
  38. <!-- #ifdef MP-WEIXIN -->
  39. </root-portal>
  40. <!-- #endif -->
  41. <!-- #ifdef H5 -->
  42. </teleport>
  43. <!-- #endif -->
  44. </template>
  45. <script lang="ts" setup>
  46. import { correctQuestion } from '@/api/modules/study';
  47. const popupRef = ref();
  48. const questionId = ref(0);
  49. const remark = ref('');
  50. const loading = ref(false);
  51. const submitBtnDisabled = computed(() => !remark.value?.trim() || loading.value);
  52. const open = (id: number) => {
  53. if (id !== questionId.value) {
  54. remark.value = '';
  55. }
  56. questionId.value = id;
  57. popupRef.value.open();
  58. }
  59. const emit = defineEmits<{
  60. close: [];
  61. }>();
  62. const close = () => {
  63. popupRef.value.close();
  64. emit('close');
  65. }
  66. const handleSubmit = () => {
  67. loading.value = true;
  68. correctQuestion({ questionid: questionId.value, remark: remark.value.trim() }).then((res) => {
  69. loading.value = false;
  70. uni.$ie.showToast('提交成功,等待工作人员处理');
  71. close();
  72. }).catch((err) => {
  73. console.log(err)
  74. loading.value = false;
  75. })
  76. }
  77. defineExpose({
  78. open,
  79. close
  80. });
  81. </script>
  82. <style lang="scss" scoped>
  83. .popup-content {
  84. @apply w-[88vw];
  85. }
  86. .popup-header {
  87. @apply px-30 h-100 flex items-center justify-center;
  88. }
  89. .popup-header-title {
  90. @apply flex items-center text-30 text-fore-title font-bold;
  91. }
  92. </style>