| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291 |
- <template>
- <view style="height: 100vh;" class="flex flex-direction">
- <!-- 顶部导航栏 -->
- <view class="navbar" :style="{ paddingTop: (12 + statusBarHeight) + 'px' }">
- <view class="navbar-content">
- <view class="navbar-left" @click="goBack">
- <u-icon name="arrow-leftward" size="36" color="#333"></u-icon>
- </view>
- <view class="navbar-title">附件管理</view>
- <view class="navbar-right"></view>
- </view>
- </view>
- <!-- <nav-bar title="基本信息"></nav-bar> -->
- <view class="contain flex flex-direction">
- <!-- #ifdef APP-PLUS -->
- <view
- class="upload-card"
- :is-shadow="true"
- @click="handleWeChatMiniApp"
- >
- <view class="card-icon"></view>
- <view class="card-text">微信小程序上传</view>
- <view class="card-badge"></view>
- </view>
- <!-- #endif -->
- <view
- class="upload-card"
- :is-shadow="true"
- >
- <view class="card-icon-phone"></view>
- <view class="card-text">手机文件上传</view>
- <fileSelector
- class="upload-file-selector"
- :isShowStyle="false"
- title=""
- allowType=".doc,.docx,.xls,.xlsx,.pdf"
- @fileSelected="uploadResumes"
- />
- </view>
- </view>
- </view>
- </template>
- <script>
- import fileSelector from '@/uni_modules/zhouquan-fileSelector/components/zhouquan-fileSelector/file-selector.vue';
- export default {
- components: {
- fileSelector
- },
- data() {
- return {
- statusBarHeight: 0, // 状态栏高度
- content: [],
- showLoadCard: false,
- showResumesAnalysis: false,
- validInfoCount: 0, // 有效信息数量
- loading: false,
- showTipPopup: false
- };
- },
- onLoad(e) {
- // 获取状态栏高度
- let systemInfo = uni.getSystemInfoSync();
- this.statusBarHeight = systemInfo.statusBarHeight || 0;
- this.getUserInfo()
- // this.avatar = uni.getStorageSync('avatar')
- },
- methods: {
- // 返回上一页
- goBack() {
- uni.navigateBack();
- },
- getUserInfo() {
- this.$Request.get("/app/resumes/getAttachment").then(res => {
- if (res.code == 0) {
- res.data.forEach(function (item) {
- const ext = item.attachmentName.split('.').pop().toLowerCase();
- item.fileType = ext
- })
- this.content = res.data
- }
- uni.hideLoading();
- });
- },
- // 保存
- uploadResumes(e) {
- var that = this
- console.log(e.path)
- const validExtensions = ['pdf', 'doc', 'docx'];
- const ext = e.name.split('.').pop().toLowerCase();
- if (!validExtensions.includes(ext)) {
- this.$queue.showToast('仅支持PDF/DOC/DOCX格式')
- return;
- }
- uni.getFileInfo({
- filePath: e.path,
- success: (info) => {
- let attachment_size = (info.size / 1024).toFixed(1)
- that.$queue.uploadFile(e.path, function (path) {
- uni.showLoading({ title: '上传中' })
- if (path)
- that.$Request.postJson("/app/resumes/saveAttachment", {
- attachmentAddress: path,
- attachmentName: e.name,
- attachmentSize: attachment_size
- }).then(res => {
- uni.hideLoading()
- if (res.code === 0) {
- uni.showToast({
- title: '上传成功',
- icon: "none"
- })
- uni.navigateBack({
- delta: 1
- })
- } else {
- uni.showToast({
- title: res.msg,
- icon: "none"
- })
- }
- })
- else {
- uni.hideLoading()
- that.$queue.showToast('文件上传失败')
- }
- })
- },
- fail: (err) => {
- uni.hideLoading()
- console.error('获取失败', err);
- }
- });
- },
- // 微信小程序上传
- handleWeChatUpload() {
- plus.share.getServices(res => {
- let weixinService = null;
- for (let i in res) {
- if (res[i].id === 'weixin') {
- weixinService = res[i];
- break;
- }
- }
- const userId = uni.getStorageSync('userId')
- if (weixinService) {
- weixinService.launchMiniProgram({
- id: 'gh_854ab5288c2d',
- path: `/pages/index/index?userId=${userId}`,
- type: 0 // 小程序版本类型:0-正式版;1-测试版;2-体验版
- });
- } else {
- console.log('未安装微信或获取微信服务失败');
- }
- });
- },
- // 打开微信小程序
- handleWeChatMiniApp() {
- uni.showModal({
- title: '提示',
- content: '即将离开亿职赞打开微信小程序,请选择是否打开',
- success: (res) => {
- if (res.confirm) {
- this.handleWeChatUpload()
- }
- }
- })
- }
- },
- };
- </script>
- <style lang="scss" scoped>
- .navbar {
- padding: 24rpx 32rpx 20rpx 32rpx;
- background: #fff;
- .navbar-content {
- display: flex;
- align-items: center;
- justify-content: space-between;
- height: 60rpx;
- .navbar-left {
- width: 60rpx;
- height: 60rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .navbar-title {
- color: rgba(23, 23, 37, 1);
- font-family: DM Sans;
- font-size: 36rpx;
- font-weight: 700;
- line-height: 52rpx;
- letter-spacing: 0%;
- text-align: center;
- }
- .navbar-right {
- width: 60rpx;
- height: 60rpx;
- }
- }
- }
- .contain {
- flex: 1;
- padding: 30rpx;
- background: #f1f5f8;
- .upload-card {
- position: relative;
- display: flex;
- height: 100rpx;
- padding: 0 30rpx;
- background: #fff;
- align-items: center;
- line-height: 100rpx;
- border-radius: 10rpx;
- margin-bottom: 20rpx;
- .card-icon {
- width: 44rpx;
- height: 44rpx;
- background: url('@/static/images/resumeUpload/miniApp.png') no-repeat center center;
- background-size: 100% 100%;
- margin-right: 10rpx;
- }
- .card-icon-phone {
- width: 44rpx;
- height: 44rpx;
- background: url('@/static/images/resumeUpload/phone.png') no-repeat center center;
- background-size: 100% 100%;
- margin-right: 10rpx;
- }
- .card-badge {
- width: 44rpx;
- height: 44rpx;
- background: url('@/static/images/resumeUpload/recommendation.png') no-repeat center center;
- background-size: 100% 100%;
- margin-right: 10rpx;
- }
- .card-text {
- margin: 0 10rpx;
- font-size: 30rpx;
- color: #666666;
- }
- }
- .upload-file-selector {
- position: absolute;
- left: 0;
- top: 0;
- width: 100%;
- height: 100%;
- opacity: 0;
- z-index: 5;
- }
- .upload-button {
- width: 100%;
- display: flex;
- height: 100rpx;
- position: relative;
- background: #fff;
- .upload-button-content {
- display: flex;
- z-index: 2;
- position: absolute;
- top: 0;
- left: 0;
-
-
- }
-
- }
- }
- </style>
|