| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170 | 
							- <template>
 
-   <view class="ss-p-b-100" style="height: 100vh; background-color: #f2f4f7;">
 
-     <uni-notice-bar text="温馨提示:最多可以上传5份附件简历。请在手机上打开此小程序进行文件上传,暂不支持在桌面版小程序中上传文件。" />
 
-     <view v-if="bioList?.length > 0">
 
-       <view v-for="(item, index) in bioList" :key="index" class="default-border list-item">
 
-         <view class="d-flex align-center">
 
-           <view v-if="props.resumeAnalysis" class="ss-m-r-15">
 
-             <radio :value="index" color="#00B760" :checked="index === checkedIndex" @tap="radioChange(index)" />
 
-           </view>
 
-           <view @click="preview(item.url)"  style="flex: 1;">
 
-             <view class="MiSans-Semibold" style="font-weight: bold;">{{ item.title }}</view>
 
-             <view class="color-666 MiSans-Normal ss-m-t-10 font-size-14">上传时间:{{ timesTampChange(item.createTime, 'Y-M-D') }}</view>
 
-           </view>
 
-           <view class="ss-m-l-30" style="width: 60rpx;">
 
-             <uni-icons @click="handleOpenPopup(item)" type="more-filled" size="20"></uni-icons>
 
-           </view>
 
-         </view>
 
-       </view>
 
- 		</view>
 
- 		<view v-else class="nodata-img-parent">
 
- 			<image src="https://minio.citupro.com/dev/static/nodata.png" mode="widthFix" style="width: 100vw;height: 100vh;"></image>
 
- 		</view>
 
-     <view class="bottom-sticky flex-column">
 
-       <button v-if="props.resumeAnalysis" class="recomm-button" style="margin-bottom: 0; border-radius: 25px;" :loading="analysisLoading" @click="handleResumeAnalysis">开始解析</button>
 
-       <button class="recomm-button MiSans-Medium" style="margin-bottom: 0; border-radius: 25px;" @click="handleUpload">微信聊天文件上传</button>
 
-       <view class="color-primary font-size-14 ss-m-b-25 ss-m-t-10 MiSans-Normal" style="text-align: center;">上传文件大小不能超过20MB</view>
 
-     </view>
 
-     <uni-popup ref="popup" type="bottom">
 
-       <button class="big-cancel-button MiSans-Normal" style="color: #666 !important;" @click="handleDelete">删除附件</button>
 
-       <button class="big-cancel-button MiSans-Normal" @click="popup.close(); currentId = ''">取消</button>
 
-     </uni-popup>
 
-   </view>
 
- </template>
 
- <script setup>
 
- import { ref } from 'vue'
 
- import { getPersonResumeCv, saveResume, deleteResume } from '@/api/user'
 
- import { uploadFile } from '@/api/file'
 
- import { timesTampChange } from '@/utils/date'
 
- import { preview } from '@/utils/preview'
 
- const emit = defineEmits(['submit'])
 
- const props = defineProps({
 
-   resumeAnalysis: { type: Boolean, default: false }
 
- })
 
- // 获取附件
 
- const bioList = ref([])
 
- const getList = async () => {
 
-   uni.showLoading({ title: '加载中...' })
 
-   try {
 
-     const { data } = await getPersonResumeCv()
 
-     bioList.value = data
 
-   } catch {
 
-     uni.hideLoading()
 
-   } finally {
 
-     uni.hideLoading()
 
-   }
 
- }
 
- getList()
 
- // 更多
 
- const currentId = ref('')
 
- const popup = ref()
 
- const handleOpenPopup = (item) => {
 
-   currentId.value = item.id
 
-   popup.value.open()
 
- }
 
- // 删除附件
 
- const handleDelete = async () => {
 
-   if (!currentId.value) return
 
-   await deleteResume(currentId.value)
 
-   uni.showToast({
 
-     title: '删除成功',
 
-     icon: 'success',
 
-     duration: 2000
 
-   })
 
-   currentId.value = ''
 
-   popup.value.close()
 
-   getList()
 
- }
 
- // 上传附件
 
- const handleUpload = () => {
 
-   if (bioList.value.length >= 5) {
 
-     uni.showToast({
 
-       icon: 'none',
 
-       title: '最多可上传5份简历'
 
-     })
 
-     return
 
-   }
 
-   wx.chooseMessageFile({
 
-     count: 1,
 
-     type: 'file',
 
-     success (res) {
 
-       // 限制文件上传大小
 
-       const size = res.tempFiles[0].size
 
-       if (size / (1024*1024) > 20) {
 
-         uni.showToast({ icon: 'none', title: '文件大小不能超过20M' })
 
-         return
 
-       }
 
-       const title = res.tempFiles[0].name
 
-       const path = res.tempFiles[0].path
 
-       //效验是否为支持的文件格式
 
-       if(/\.(pdf|docx|doc)$/.test(title)){
 
-         uploadFile(path, 'attachment').then(async (res) => {
 
-           if (!res.data) {
 
-             uni.showToast({
 
-               title: '上传失败',
 
-               icon: 'none'
 
-             })
 
-             return
 
-           }
 
-           await saveResume({ title, url: res.data })
 
-           uni.showToast({
 
-             title: '上传成功',
 
-             icon: 'success'
 
-           })
 
-           getList()
 
-         })
 
-       }else{
 
-         uni.showToast({
 
-           icon: 'none',
 
-           title: '请上传pdf、doc、docx类型的文件',
 
-           duration: 2000
 
-         })
 
-         return
 
-       }
 
-     }
 
-   })
 
- }
 
- const fileUrl = ref('')
 
- const checkedIndex = ref()
 
- const radioChange = (index) => {
 
-   if (!props.resumeAnalysis) return
 
-   checkedIndex.value = index
 
-   if (bioList.value[index]?.url) fileUrl.value = encodeURIComponent(bioList.value[index].url)
 
- }
 
- const analysisLoading = ref(false)
 
- const handleResumeAnalysis = () => {
 
-   if (!fileUrl.value) return uni.showToast({ icon: 'none', title: '请选择要解析的简历' })
 
-   analysisLoading.value = true
 
-   emit('submit', fileUrl.value)
 
- 	// uni.navigateTo({
 
- 	// 	url: `/pagesA/resumeAnalysis/index?fileUrl=${fileUrl.value}`
 
- 	// })
 
- }
 
- </script>
 
- <style scoped lang="scss">
 
- .list-item {
 
-   margin: 30rpx;
 
-   border-radius: 20rpx;
 
-   padding: 30rpx;
 
-   background-color: #fff;
 
-   box-shadow: 1px 2px 12px rgba(0, 0, 0, 0.17);
 
-   &:last-child {
 
-     margin-bottom: 0;
 
-   }
 
-   &:first-child {
 
-     margin-top: 0;
 
-   }
 
- }
 
- </style>
 
 
  |