voluntary-bottom.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <template>
  2. <view class="h-[50px] bg-white px-20 fx-row fx-bet-cen mx-shadow-up">
  3. <view class="flex-1 fx-row fx-sta-cen text-content text-2xs" @click="openModify">
  4. {{ `${model.score}分 ${model.seatInput || model.rank.lowestRank}位` }}
  5. {{ batch.name }} {{ userSnapshot.examMajorName }}
  6. <uv-icon v-if="!id" name="edit-pen-fill" color="primary" class="ml-10"/>
  7. </view>
  8. <uv-tags shape="circle" :text="previewText" @click="openVolunteer"/>
  9. </view>
  10. </template>
  11. <script setup>
  12. import {computed, ref} from 'vue';
  13. import {useInjectVoluntaryCart} from "@/pages/voluntary/hooks/useVoluntaryCartInjection";
  14. import {useInjectVoluntaryForm} from "@/pages/voluntary/hooks/useVoluntaryFormInjection";
  15. import {toast} from "@/uni_modules/uv-ui-tools/libs/function";
  16. import {useInjectUserSnapshot} from "@/pages/ie/hooks/useUserSnapshotInjection";
  17. const emits = defineEmits(['cart', 'modify'])
  18. const {model, batch, simpleMode} = useInjectVoluntaryForm()
  19. const {id, selectedList} = useInjectVoluntaryCart()
  20. const {userSnapshot} = useInjectUserSnapshot()
  21. const previewText = computed(() => {
  22. const len = selectedList.value.length
  23. const lenStr = len ? `(${len})` : ''
  24. return '预览志愿表' + lenStr
  25. })
  26. const openModify = () => {
  27. if (id.value) return
  28. emits('modify')
  29. }
  30. const openVolunteer = () => {
  31. if (!selectedList.value.length) return toast('至少选择1个专业组')
  32. emits('cart')
  33. }
  34. </script>
  35. <style scoped lang="scss">
  36. ::v-deep(.uv-tags) {
  37. .uv-tags--medium {
  38. padding: 3px 10px;
  39. }
  40. }
  41. </style>