CheatDialog.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <template>
  2. <Base-dialog
  3. title="操作提示:"
  4. :disabledBtn="disabledBtn"
  5. :isShow.sync="isShow"
  6. @submit="submitForm"
  7. @close="close"
  8. >
  9. <el-form
  10. :model="formData"
  11. ref="formData"
  12. label-width="80px"
  13. label-position="right"
  14. >
  15. <el-form-item
  16. label="作弊原因"
  17. prop="cheating_reason"
  18. :rules="[
  19. {
  20. required: true,
  21. message: '请填写作弊原因',
  22. trigger: ['blur', 'change'],
  23. },
  24. ]"
  25. >
  26. <el-input
  27. v-model="formData.cheating_reason"
  28. type="textarea"
  29. :rows="4"
  30. placeholder="请输入作弊原因"
  31. ></el-input>
  32. </el-form-item>
  33. <ul style="padding-left: 80px">
  34. <li
  35. class="li_sty"
  36. @click="uploadText(item.label)"
  37. v-for="(item, index) in msgTitle"
  38. :key="index"
  39. >
  40. {{ item.label }}
  41. </li>
  42. </ul>
  43. </el-form>
  44. </Base-dialog>
  45. </template>
  46. <script>
  47. export default {
  48. props: {
  49. vidBoxHours: {
  50. type: Boolean,
  51. default: false,
  52. },
  53. disabledBtn: {
  54. type: Boolean,
  55. default: false,
  56. },
  57. },
  58. data() {
  59. return {
  60. msgTitle: [
  61. { label: "学习拍照异常", value: 1 },
  62. {
  63. label: "学习拍照太黑无法识别人像,请确保拍照光线充足并拍到全脸",
  64. value: 2,
  65. },
  66. {
  67. label: "学习拍照太模糊无法识别人像,请确保拍照光线充足并拍到全脸",
  68. value: 3,
  69. },
  70. {
  71. label: "学习拍照人像不全无法识别,请确保拍照光线充足并拍到全脸",
  72. value: 4,
  73. },
  74. ],
  75. formData: {
  76. cheating_reason: "",
  77. },
  78. };
  79. },
  80. methods: {
  81. submitForm() {
  82. this.$refs.formData.validate((valid) => {
  83. if (valid) {
  84. this.$emit("submit", this.formData.cheating_reason);
  85. } else {
  86. console.log("error submit!!");
  87. return false;
  88. }
  89. });
  90. },
  91. uploadText(msg) {
  92. this.formData.cheating_reason = msg;
  93. },
  94. close() {
  95. this.$emit("close");
  96. },
  97. },
  98. computed: {
  99. isShow: {
  100. get() {
  101. return this.vidBoxHours;
  102. },
  103. set(val) {
  104. this.$emit("update:vidBoxHours", false);
  105. },
  106. },
  107. },
  108. watch: {
  109. vidBoxHours(val) {
  110. if (val === false) {
  111. this.uploadText("");
  112. } else {
  113. this.$nextTick(() => {
  114. this.$refs.formData.clearValidate();
  115. });
  116. }
  117. },
  118. },
  119. };
  120. </script>
  121. <style lang="less" scoped>
  122. .li_sty {
  123. cursor: pointer;
  124. transition: all 0.3s;
  125. background-color: #eee;
  126. padding: 0px 10px;
  127. margin-bottom: 6px;
  128. font-size: 12px;
  129. line-height: 26px;
  130. display: table;
  131. &:hover {
  132. box-shadow: 0px 0px 4px 2px rgba(0, 0, 0, 0.2);
  133. }
  134. }
  135. </style>