surveyBox.vue 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <template>
  2. <n-card :title="title" class="survey-box" @click="handleDetail">
  3. <div class="info">
  4. {{ content }}
  5. </div>
  6. <template #footer>
  7. <div class="time">
  8. {{ time }}
  9. </div>
  10. </template>
  11. </n-card>
  12. </template>
  13. <script setup>
  14. import { useRouter } from "vue-router";
  15. const router = useRouter();
  16. defineOptions({
  17. name: "survey-box",
  18. });
  19. const props = defineProps({
  20. id: {
  21. type: [String, Number],
  22. default: () => "",
  23. },
  24. title: {
  25. type: String,
  26. default: () => "",
  27. },
  28. content: {
  29. type: String,
  30. default: () => "",
  31. },
  32. time: {
  33. type: String,
  34. default: () => "",
  35. },
  36. });
  37. const handleDetail = () => {
  38. if (props.id) {
  39. router.push("/survey-detail/" + props.id);
  40. } else {
  41. console.warn("missing id");
  42. }
  43. };
  44. </script>
  45. <style lang="scss" scoped>
  46. .n-card.survey-box {
  47. --n-title-font-weight: 600 !important;
  48. --n-title-font-size: 1.75rem !important;
  49. --n-padding-top: 1.875rem !important;
  50. border-radius: 1.875rem;
  51. background-repeat: no-repeat;
  52. border: none;
  53. cursor: pointer;
  54. background-color: transparent;
  55. background-image: var(--main-sub-list-bg);
  56. background-position: top right;
  57. background-size: cover;
  58. background-repeat: no-repeat;
  59. height: 15.75rem;
  60. overflow: hidden;
  61. }
  62. .time {
  63. color: var(--main-sub-text-color);
  64. }
  65. .info {
  66. font-size: calc(var(--base-font-size) * 1.3);
  67. }
  68. </style>