analysis-result-voluntary.vue 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <script>
  2. import {computed, getCurrentInstance} from 'vue';
  3. import AnalysisResult from "@/pages/ie/entry-analysis/analysis-result.vue";
  4. import {useProvidePageScroll} from "@/hooks/usePageScrollInjection";
  5. import {useTransfer} from "@/hooks/useTransfer";
  6. import {useProvideUserSnapshot} from "@/pages/ie/hooks/useUserSnapshotInjection";
  7. export default {
  8. extends: AnalysisResult,
  9. setup() {
  10. const scrollTop = useProvidePageScroll()
  11. const {prevData, transferTo} = useTransfer()
  12. const instance = getCurrentInstance()
  13. const snapshot = computed(() => instance.proxy.voluntaryRef?.userSnapshot)
  14. useProvideUserSnapshot(snapshot)
  15. return {
  16. prevData,
  17. scrollTop,
  18. transferTo
  19. }
  20. },
  21. methods: {
  22. getAnalysisResult() {
  23. const {request, details} = this.prevData
  24. this.voluntaryRef = this.prevData // keep this ref for report
  25. this.prevData = request
  26. this.results = details
  27. // try to fix this.prevData.form.universities' `num` prop
  28. this.prevData.universities.forEach((u, i) => {
  29. if (!u.hasOwnProperty('num')) this.$set(u, 'num', i)
  30. })
  31. }
  32. }
  33. }
  34. </script>
  35. <style>
  36. </style>