QuestionBase.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <template>
  2. <div class="question">
  3. <div class="question-container">
  4. <div class="question-content">
  5. <slot name="content"></slot>
  6. </div>
  7. <div v-if="isSetting" class="property">
  8. <slot name="property"></slot>
  9. </div>
  10. </div>
  11. <slot name="question-footer">
  12. <slot name="footer"></slot>
  13. </slot>
  14. </div>
  15. </template>
  16. <script>
  17. export default {
  18. name: 'QuestionBase',
  19. inject: ['isSetUp'],
  20. data() {
  21. return {};
  22. },
  23. computed: {
  24. isSetting() {
  25. return this.isSetUp();
  26. },
  27. },
  28. methods: {},
  29. };
  30. </script>
  31. <style lang="scss" scoped>
  32. .question {
  33. width: 100%;
  34. &-container {
  35. display: flex;
  36. width: 100%;
  37. padding: 24px;
  38. background-color: #fff;
  39. border: $border;
  40. border-radius: 0 0 8px 8px;
  41. .question-content {
  42. flex: 1;
  43. .stem {
  44. padding-bottom: 8px;
  45. margin-bottom: 8px;
  46. border-bottom: 1px solid $border-color;
  47. .el-textarea {
  48. margin-top: 8px;
  49. }
  50. }
  51. .content {
  52. > ul {
  53. display: flex;
  54. flex-direction: column;
  55. row-gap: 8px;
  56. width: 100%;
  57. .content-item {
  58. display: flex;
  59. column-gap: 4px;
  60. align-items: center;
  61. .question-number {
  62. min-width: 40px;
  63. height: 32px;
  64. padding: 4px 8px;
  65. color: $text-color;
  66. cursor: default;
  67. background-color: $fill-color;
  68. border-radius: 2px;
  69. }
  70. .option-content {
  71. display: flex;
  72. flex: 1;
  73. align-items: center;
  74. padding-left: 16px;
  75. background-color: $fill-color;
  76. .rich-text {
  77. flex: 1;
  78. min-height: 32px;
  79. :deep &.mce-content-body {
  80. padding-top: 4px;
  81. }
  82. :deep &:not(.mce-edit-focus) {
  83. p {
  84. margin: 0;
  85. }
  86. }
  87. :deep &.mce-content-body[data-mce-placeholder]:not(.mce-visualblocks)::before {
  88. top: 6px;
  89. }
  90. }
  91. }
  92. .delete {
  93. margin-left: 12px;
  94. }
  95. }
  96. }
  97. }
  98. .footer {
  99. display: flex;
  100. justify-content: center;
  101. margin-top: 14px;
  102. color: $main-color;
  103. .add-option {
  104. display: flex;
  105. column-gap: 8px;
  106. align-items: center;
  107. font-size: 14px;
  108. cursor: pointer;
  109. }
  110. }
  111. }
  112. .property {
  113. display: flex;
  114. &::before {
  115. display: inline-block;
  116. width: 2px;
  117. height: 100%;
  118. margin: 0 24px;
  119. content: '';
  120. background-color: $border-color;
  121. }
  122. .el-form {
  123. .el-input {
  124. width: 250px;
  125. }
  126. }
  127. :deep .el-form-item.el-form-item--small {
  128. display: flex;
  129. }
  130. }
  131. }
  132. }
  133. </style>