index.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <template>
  2. <view>
  3. <uni-segmented-control :current="current" :values="controlList" @clickItem="handleChange" styleType="text" activeColor="#00897B"></uni-segmented-control>
  4. <scroll-view class="scrollBox defaultBgc" scroll-y="true" @scrolltolower="loadingMore" style="height: calc(100vh - 36px);">
  5. <view v-if="items.length">
  6. <PositionList v-if="current === 0" class="pb-10" :list="items" :noMore="false"></PositionList>
  7. <Items v-else class="pb-10" :list="items" @action="handleAction"></Items>
  8. <uni-load-more :status="more" />
  9. </view>
  10. <view v-else class="nodata-img-parent">
  11. <image src="https://minio.citupro.com/dev/static/nodata.png" mode="widthFix" style="width: 100vw;height: 100vh;"></image>
  12. </view>
  13. </scroll-view>
  14. <!-- 同意、拒绝面试 -->
  15. <uni-popup ref="popup" type="dialog">
  16. <uni-popup-dialog :type="type === 'agree' ? 'success' : 'warn'" cancelText="取消" confirmText="确认"
  17. title="系统提示" :content="type === 'agree' ? '确认接受面试吗?' : '确认拒绝面试吗?'" @confirm="handleConfirm" @close="handleClose"
  18. ></uni-popup-dialog>
  19. </uni-popup>
  20. </view>
  21. </template>
  22. <script setup>
  23. import { ref } from 'vue'
  24. import { getJobDeliveryList, getUserInterviewInvitePage, userInterviewInviteConsent, userInterviewInviteReject } from '@/api/user'
  25. import { dealDictObjData } from '@/utils/position'
  26. import PositionList from '@/components/PositionList'
  27. import Items from './item.vue'
  28. import { userStore } from '@/store/user'
  29. import { onLoad } from '@dcloudio/uni-app'
  30. const useUserStore = userStore()
  31. const current = ref(0)
  32. const controlList = ['已投递', '待同意', '待面试', '已完成', '已拒绝']
  33. const statusList = [0, 1, 3, 98]
  34. const more = ref('more')
  35. const items = ref([])
  36. const queryParams = ref({
  37. pageNo: 1,
  38. pageSize: 10
  39. })
  40. const popup = ref()
  41. const type = ref('')
  42. const id = ref(null)
  43. onLoad((options) => {
  44. if (options?.index) {
  45. current.value = Number(options.index)
  46. items.value = []
  47. }
  48. getList()
  49. })
  50. const getList = async () => {
  51. const api = current.value === 0 ? getJobDeliveryList : getUserInterviewInvitePage
  52. if (current.value !== 0) queryParams.value.status = statusList[current.value - 1]
  53. const { data } = await api(queryParams.value)
  54. const list = data?.list || []
  55. if (!list.length && queryParams.value.pageNo === 1) {
  56. items.value = []
  57. return
  58. }
  59. if (list?.length) {
  60. list.forEach(e => {
  61. e.job = { ...e.job, ...dealDictObjData({}, e.job) }
  62. e.enterprise = { ...e.enterprise, ...dealDictObjData({}, e.enterprise)}
  63. })
  64. items.value = items.value.concat(list)
  65. }
  66. // more.value = list?.length < queryParams.value.pageSize ? 'noMore' : 'more'
  67. more.value = list?.length === +data.total ? 'noMore' : 'more'
  68. }
  69. const handleChange = (e) => {
  70. items.value = []
  71. queryParams.value.pageNo = 1
  72. current.value = e.currentIndex
  73. getList()
  74. }
  75. // 加载更多
  76. const loadingMore = () => {
  77. more.value = 'loading'
  78. queryParams.value.pageNo++
  79. getList()
  80. }
  81. // 同意、拒绝
  82. const handleAction = (item, typeVal) => {
  83. id.value = item.id
  84. type.value = typeVal
  85. popup.value.open()
  86. }
  87. const handleClose = () => {
  88. popup.value.close()
  89. type.value = ''
  90. id.value = null
  91. }
  92. const handleConfirm = async () => {
  93. if (!id.value) return
  94. const api = type.value === 'agree' ? userInterviewInviteConsent : userInterviewInviteReject
  95. // 同意需提交手机号
  96. let phone = ''
  97. if (useUserStore?.baseInfo?.phone) phone = useUserStore?.baseInfo?.phone
  98. await api(type.value === 'agree' ? { id: id.value, phone } : id.value)
  99. handleClose()
  100. uni.showToast({
  101. title: '操作成功',
  102. icon: 'success'
  103. })
  104. queryParams.value.pageNo = 1
  105. items.value = []
  106. getList()
  107. }
  108. </script>
  109. <style scoped lang="scss">
  110. </style>