index.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <template>
  2. <div>
  3. <card-judge-item
  4. v-for="item in value"
  5. :key="item.id"
  6. :success="item.level"
  7. :state="item.state"
  8. >
  9. <div>
  10. <b-checkbox
  11. class="checkbox-section"
  12. v-model="item.level"
  13. :type="item.state === 'SOLVING' ? 'is-primary' : 'is-success'"
  14. :disabled="judgeDisable(item)"
  15. >
  16. <b-tooltip :label="item.explain" position="is-top">
  17. {{ item.content }}
  18. </b-tooltip>
  19. </b-checkbox>
  20. <b-tooltip :label="`申诉备注 : ${item.remark}`" type="is-warning">
  21. <b-tag v-if="item.state === 'PENDING'" type="is-warning">
  22. 学生申诉
  23. </b-tag>
  24. <b-tag v-if="item.state === 'SOLVING'" type="is-primary">
  25. 处理申诉
  26. </b-tag>
  27. </b-tooltip>
  28. </div>
  29. <input
  30. v-model="item.comment"
  31. class="input-custom"
  32. :class="{
  33. 'input-custom--success': item.level,
  34. 'input-custom--danger': !item.level,
  35. 'input-custom--primary': item.state === 'SOLVING',
  36. 'input-custom--warning': item.state === 'PENDING',
  37. 'input-custom--end': item.state === 'ARGUED'
  38. }"
  39. :disabled="judgeDisable(item)"
  40. type="text"
  41. placeholder="填写备注"
  42. style="box-shadow:none;border-color:white"
  43. />
  44. <div
  45. class="action-section--warning action-section "
  46. v-if="item.state === 'PENDING' && review.state === 'ARGUING'"
  47. >
  48. <span
  49. @click="acceptArgue(item)"
  50. :class="{ 'is-loading': acceptArgueLoading }"
  51. class="button is-warning"
  52. >接受申诉</span
  53. >
  54. <span
  55. @click="refuseArgue(item)"
  56. :class="{ 'is-loading': refuseArgueLoading }"
  57. class="button is-danger"
  58. >拒绝申诉</span
  59. >
  60. </div>
  61. <div
  62. class="action-section--primary action-section "
  63. v-if="item.state === 'SOLVING' && review.state === 'SOLVING'"
  64. >
  65. <span
  66. @click="submitSolution(item)"
  67. :class="{ 'is-loading': submitSolutionLoading }"
  68. class="button is-primary"
  69. >
  70. 提交处理好的申诉
  71. </span>
  72. </div>
  73. </card-judge-item>
  74. </div>
  75. </template>
  76. <script>
  77. import CardJudgeItem from "@/components/CardJudgeItem/index";
  78. export default {
  79. name: "CheckListItem",
  80. components: { CardJudgeItem },
  81. props: {
  82. value: {
  83. type: Array,
  84. default: () => []
  85. },
  86. review: {
  87. type: Object,
  88. default: () => ({
  89. state: "DEFAULT"
  90. })
  91. },
  92. isTeacher: {
  93. type: Boolean,
  94. default: false
  95. }
  96. },
  97. data() {
  98. return {
  99. acceptArgueLoading: false,
  100. refuseArgueLoading: false,
  101. submitSolutionLoading: false
  102. };
  103. },
  104. watch: {
  105. value: {
  106. handler(newValue) {
  107. this.$emit("onchange", newValue);
  108. },
  109. deep: true
  110. }
  111. },
  112. methods: {
  113. judgeDisable(item) {
  114. if (this.isTeacher) {
  115. return false;
  116. }
  117. return (
  118. item.state === "PENDING" ||
  119. item.state === "ARGUED" ||
  120. this.review.state === "ARGUING"
  121. );
  122. },
  123. async acceptArgue(item) {
  124. this.acceptArgueLoading = true;
  125. await this.$emit("accept-argue", item);
  126. this.acceptArgueLoading = false;
  127. },
  128. async refuseArgue(item) {
  129. this.refuseArgueLoading = true;
  130. await this.$emit("refuse-argue", item);
  131. this.refuseArgueLoading = false;
  132. },
  133. async submitSolution(item) {
  134. this.submitSolutionLoading = true;
  135. await this.$emit("submit-solution", item);
  136. this.submitSolutionLoading = false;
  137. }
  138. // getColor(state) {}
  139. }
  140. };
  141. </script>
  142. <style lang="scss" scoped>
  143. @import "../../assets/scss/app";
  144. .checkbox-section {
  145. padding: $default-margin;
  146. }
  147. .argue-section {
  148. padding: $default-margin;
  149. background-color: $warning;
  150. }
  151. .action-section {
  152. .button {
  153. border-radius: 0;
  154. }
  155. &--warning {
  156. .button {
  157. width: 50%;
  158. }
  159. }
  160. &--primary {
  161. .button {
  162. width: 100%;
  163. }
  164. }
  165. }
  166. .input-custom {
  167. padding: $default-margin;
  168. width: 100%;
  169. border: 0;
  170. box-shadow: none;
  171. color: hsl(0, 0%, 21%);
  172. font-size: $size-normal;
  173. &--danger {
  174. background-color: #fff8fa;
  175. }
  176. &--success {
  177. background-color: #ebfff2;
  178. }
  179. &--primary {
  180. background-color: lighten($primary, 30%);
  181. }
  182. &--warning {
  183. background-color: lighten($warning, 30%);
  184. }
  185. &--end {
  186. background-color: lighten($grey, 50%);
  187. }
  188. &::placeholder {
  189. /*color: hsl(0, 0%, 96%);*/
  190. }
  191. }
  192. </style>