feat: fileicon, filetext 组件改为全局,新增一体机上传简历(接口待调)
This commit is contained in:
@@ -127,6 +127,7 @@
|
||||
<view class="footer-button btn-feel" @click="chooseResume">上传简历</view>
|
||||
</view>
|
||||
</template>
|
||||
<UploadQrcode ref="qrcodeRef" @onSend="handleFileSend" :leaveFileCount="1" ></UploadQrcode>
|
||||
</AppLayout>
|
||||
</template>
|
||||
|
||||
@@ -137,11 +138,14 @@ import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import useUserStore from '@/stores/useUserStore';
|
||||
import useDictStore from '@/stores/useDictStore';
|
||||
const { userInfo, isMiniProgram } = storeToRefs(useUserStore());
|
||||
const { userInfo, isMiniProgram,isMachineEnv } = storeToRefs(useUserStore());
|
||||
const { getUserResume } = useUserStore();
|
||||
const { getDictData, oneDictData } = useDictStore();
|
||||
import { playTextDirectly } from '@/hook/useTTSPlayer-all-in-one';
|
||||
import config from '@/config.js';
|
||||
import UploadQrcode from './components/uploadQrcode.vue';
|
||||
|
||||
const qrcodeRef = ref(null);
|
||||
const showNotice = ref(true);
|
||||
onLoad(() => {
|
||||
getUserResume();
|
||||
@@ -152,6 +156,10 @@ function closeNotice() {
|
||||
}
|
||||
|
||||
function chooseResume() {
|
||||
if(isMachineEnv.value){
|
||||
qrcodeRef.value?.open()
|
||||
return
|
||||
}
|
||||
uni.chooseImage({
|
||||
sizeType: ['original', 'compressed'],
|
||||
sourceType: ['album', 'camera'],
|
||||
@@ -162,9 +170,11 @@ function chooseResume() {
|
||||
res = JSON.parse(res);
|
||||
getUserResume();
|
||||
$api.msg('上传成功');
|
||||
playTextDirectly('上传成功')
|
||||
})
|
||||
.catch((err) => {
|
||||
$api.msg('上传失败');
|
||||
playTextDirectly('上传失败')
|
||||
});
|
||||
},
|
||||
fail: (error) => {},
|
||||
@@ -209,6 +219,23 @@ function uploadResume(tempFilePath, loading) {
|
||||
});
|
||||
});
|
||||
}
|
||||
const handleFileSend = (rows)=>{
|
||||
const file = {
|
||||
url: rows[0].fileUrl,
|
||||
type: rows[0].fileSuffix,
|
||||
name: rows[0].originalName,
|
||||
}
|
||||
|
||||
$api.createRequest('/app/oss/uploadToObs', { userId: userInfo.value.userId,url:file.url }, 'POST').then((res) => {
|
||||
getUserResume();
|
||||
$api.msg('上传成功');
|
||||
playTextDirectly('上传失败')
|
||||
}).catch(()=>{
|
||||
$api.msg('上传失败');
|
||||
playTextDirectly('上传失败')
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
|
||||
Reference in New Issue
Block a user