123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- <template>
- <view class="ss-p-b-100">
- <view v-if="bioList.length > 0">
- <uni-card v-for="(item, index) in bioList" :key="index" :is-shadow="true" :border='false' shadow="0px 0px 3px 1px rgba(0,0,0,0.1)">
- <view class="d-flex align-center">
- <view @click="preview(item.url)" style="flex: 1;">
- <view style="font-weight: bold;">{{ item.title }}</view>
- <view>上传时间:{{ 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>
- </uni-card>
- </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">
- <button class="recomm-button" @click="handleUpload">从微信聊天中导入简历</button>
- </view>
- <uni-popup ref="popup" type="bottom">
- <button class="big-cancel-button" style="color: #333 !important;" @click="handleDelete">删除附件</button>
- <button class="big-cancel-button" @click="popup.close(); currentId = ''">取消</button>
- </uni-popup>
- </view>
- </template>
- <script setup>
- import { ref } from 'vue'
- import { getPersonResumeCv, saveResume, deleteResume } from '@/api/user'
- import { uploadFileTest } from '@/api/file'
- import { timesTampChange } from '@/utils/date'
- import { preview } from '@/utils/preview'
- // 获取附件
- const bioList = ref([])
- const getList = async () => {
- const { data } = await getPersonResumeCv()
- bioList.value = data
- }
- 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 = () => {
- wx.chooseMessageFile({
- count: 1,
- type: 'file',
- success (res) {
- const title = res.tempFiles[0].name
- const path = res.tempFiles[0].path
- //效验是否为支持的文件格式
- if(/\.(pdf|docx|doc)$/.test(title)){
- uploadFileTest(path).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、word类型的文件',
- duration: 2000
- })
- return
- }
- }
- })
- }
- </script>
- <style scoped lang="scss">
- </style>
|