add-student-hint.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <template>
  2. <view class="modal" v-if="visible">
  3. <view class="modal-content">
  4. <image :src="config.ossPathPerfixs + '/pop-up-bg.png'" mode="widthFix" class="modal-content-bg"></image>
  5. <view class="modal-content-box">
  6. <view class="modal-content-box-title">
  7. <text class="modal-content-box-title-text">温馨提示</text>
  8. </view>
  9. <view class="modal-content-box-section" v-html="innerHtml" v-if="innerHtml"></view>
  10. <fs-empty padding="100rpx 0" imageWidth="200rpx" v-else></fs-empty>
  11. <view class="modal-content-box-footer-btn">
  12. <fs-button round type="primary" @click="handleSubmit" :disabled="isDisabled">
  13. <text>我已阅读并同意</text>
  14. <text v-if="timerNum > 0">({{ timerNum }}s)</text>
  15. </fs-button>
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. </template>
  21. <script setup>
  22. import config from '@/utils/config'
  23. const props = defineProps({
  24. time: {
  25. type: Number,
  26. default: 5
  27. }
  28. })
  29. const emits = defineEmits(['change'])
  30. const visible = ref(false)
  31. const timer = ref(null)
  32. const timerNum = ref(0)
  33. const isDisabled = computed(() => timerNum.value > 0)
  34. const innerHtml = ref('')
  35. onMounted(() => {
  36. visible.value = true
  37. timerNum.value = props.time
  38. timer.value = setInterval(() => {
  39. if (timerNum.value <= 0) return clearInterval(timer.value)
  40. timerNum.value -= 1
  41. }, 1000)
  42. getWarmPromptData()
  43. })
  44. const getWarmPromptData = async () => {
  45. // getWarmPrompt().then(res => {
  46. // innerHtml.value = res.data || ''
  47. // })
  48. innerHtml.value = `
  49. <p>为保障学生安全、规范信息管理并提升校园体验,现发布以下注意事项,请全体学生及家长予以重视和配合。</p>
  50. <p>录入信息时,请严格按学号顺序排列。‌</p>
  51. <p>姓名、身份证号必须与户口本信息完全一致。‌‌</p>
  52. <p>出生日期、入学年月等日期信息,应统一使用“YYYY-MM-DD”格式的阳历日期,并与身份证保持一致。‌‌‌</p>
  53. `
  54. }
  55. const handleSubmit = () => {
  56. if (isDisabled.value) return uni.showToast({ title: `${timerNum.value}s后可同意`, icon: 'none' })
  57. closeModal()
  58. }
  59. const closeModal = () => {
  60. visible.value = false
  61. emits('change', false)
  62. }
  63. </script>
  64. <style lang="scss" scoped>
  65. .modal {
  66. position: fixed;
  67. top: 0;
  68. left: 0;
  69. right: 0;
  70. bottom: 0;
  71. background-color: rgba(0, 0, 0, 0.5);
  72. z-index: 999;
  73. display: flex;
  74. justify-content: center;
  75. align-items: center;
  76. .modal-content {
  77. padding: 70rpx;
  78. border-radius: 50rpx;
  79. position: relative;
  80. .modal-content-bg {
  81. position: absolute;
  82. width: 100%;
  83. height: auto;
  84. top: 0;
  85. left: 0;
  86. z-index: 0;
  87. }
  88. .modal-content-box {
  89. position: relative;
  90. z-index: 1;
  91. .modal-content-box-title {
  92. font-size: 32rpx;
  93. padding-bottom: 20rpx;
  94. font-weight: 700;
  95. text-align: center;
  96. color: #333;
  97. position: relative;
  98. &-text {
  99. position: relative;
  100. z-index: 1;
  101. }
  102. &::after {
  103. content: '';
  104. position: absolute;
  105. z-index: 0;
  106. bottom: 20rpx;
  107. left: 50%;
  108. transform: translateX(-50%);
  109. width: 160rpx;
  110. height: 16rpx;
  111. border-radius: 8rpx;
  112. background-image: linear-gradient(90deg, #0871FF 0%, #00EEA8 100%);
  113. }
  114. }
  115. .modal-content-box-section {
  116. min-height: 180rpx;
  117. max-height: 340rpx;
  118. overflow-y: auto;
  119. word-wrap: break-word;
  120. }
  121. .modal-content-box-footer-btn {
  122. padding-top: 20rpx;
  123. text-align: center;
  124. }
  125. }
  126. }
  127. }
  128. </style>