|
|
@@ -2,30 +2,51 @@
|
|
|
<view class="company">
|
|
|
<nav-bar title="公司认证" color="#000"></nav-bar>
|
|
|
<view class="company-content">
|
|
|
+ <!-- 营业执照上传 -->
|
|
|
<view class="company-title">上传公司营业执照</view>
|
|
|
<view class="company-desc">请上传“{{ companyName }}”的营业执照</view>
|
|
|
-
|
|
|
- <!-- 上传区域 -->
|
|
|
<view class="upload-img">
|
|
|
<image v-if="filePath" :src="filePath" mode="aspectFit"
|
|
|
- style="height:322rpx; width:100%; border-radius:8rpx">
|
|
|
- </image>
|
|
|
- <view v-else
|
|
|
- style="color:#666;font-size:24rpx; flex:1; display:flex; justify-content:center; align-items:center;"
|
|
|
- @click="chooseImage">
|
|
|
- 点击上传图片
|
|
|
+ style="height:100%; width:100%; border-radius:8rpx"></image>
|
|
|
+ <view v-else class="text-item" @click="chooseImage">
|
|
|
+ <u-icon name="plus" color="#999" size="40" style="margin-bottom: 8rpx;"></u-icon>
|
|
|
+ 上传营业执照
|
|
|
</view>
|
|
|
-
|
|
|
- <!-- 删除按钮 -->
|
|
|
<view v-if="filePath" class="delete-btn" @click="deleteImage">×</view>
|
|
|
- <!-- 点击整个区域选择图片 -->
|
|
|
- <view v-if="!filePath" class="choose-overlay" @click="chooseImage"></view>
|
|
|
</view>
|
|
|
+ <view class="warning-title">注意事项</view>
|
|
|
+ <view class="warning-desc">1.请上传所填公司一致的营业执照</view>
|
|
|
+ <view class="warning-desc">2.营业执照信息和公章清晰可辨</view>
|
|
|
+
|
|
|
+ <!-- 在职证明上传 -->
|
|
|
+ <view class="upload-img">
|
|
|
+ <view v-if="pdfFilePath" class="text-item">
|
|
|
+ <u-icon name="file-text" color="#016bf6" size="40"></u-icon>
|
|
|
+ <text style="margin-top: 8rpx;">已选择 PDF</text>
|
|
|
+ <view class="delete-btn" @click="deletePDF">×</view>
|
|
|
+ </view>
|
|
|
+ <view v-else class="text-item" @click="choosePDF">
|
|
|
+ <u-icon name="plus" color="#999" size="40" style="margin-bottom: 8rpx;"></u-icon>
|
|
|
+ 上传在职证明
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="warning-title">注意事项</view>
|
|
|
+ <view class="warning-desc">1.请上传加盖公章的在职证明(仅限 PDF 文件)</view>
|
|
|
|
|
|
+ <!-- 公司证明上传 -->
|
|
|
+ <view class="upload-group">
|
|
|
+ <view v-for="(img, index) in companyProofList" :key="index" class="upload-img">
|
|
|
+ <image :src="img" mode="aspectFill" style="width:100%;height:100%;border-radius:8rpx;"></image>
|
|
|
+ <view class="delete-btn" @click="deleteCompanyProof(index)">×</view>
|
|
|
+ </view>
|
|
|
+ <view v-if="companyProofList.length < 4" class="upload-img text-item" @click="chooseCompanyProof">
|
|
|
+ <u-icon name="plus" color="#999" size="40" style="margin-bottom: 8rpx;"></u-icon>
|
|
|
+ 上传公司证明
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
<view class="warning-title">注意事项</view>
|
|
|
- <view class="warning-desc">1.拍摄与所填公司一致的营业执照上传</view>
|
|
|
- <view class="warning-desc">2.最新下发的营业执照</view>
|
|
|
- <view class="warning-desc">3.营业执照信息和公章清晰可辨</view>
|
|
|
+ <view class="warning-desc">1.请上传公司前台LOGO照1-2张</view>
|
|
|
+ <view class="warning-desc">2.请上传公司办公区照片1-2张</view>
|
|
|
</view>
|
|
|
|
|
|
<view class="bottom-btn" @click="goUnderReview">确认并提交</view>
|
|
|
@@ -41,58 +62,136 @@
|
|
|
return {
|
|
|
companyName: "",
|
|
|
companyId: "",
|
|
|
- filePath: "", // 图片路径
|
|
|
- uploadUrl: "", // 上传服务器返回的 URL
|
|
|
+ filePath: "", // 营业执照本地路径
|
|
|
+ licenseUrl: "", // 营业执照上传后URL
|
|
|
+
|
|
|
+ pdfFilePath: "", // 在职证明本地路径
|
|
|
+ employmentVerification: "", // PDF 上传后URL
|
|
|
+
|
|
|
+ companyProofList: [], // 公司证明本地预览图
|
|
|
+ companyProofUrls: [], // 上传后URL列表
|
|
|
+
|
|
|
action: configdata.APIHOST1 + '/alioss/upload'
|
|
|
};
|
|
|
},
|
|
|
- components: {
|
|
|
- navBar
|
|
|
- },
|
|
|
+ components: { navBar },
|
|
|
onLoad(options) {
|
|
|
if (options.companyName) this.companyName = decodeURIComponent(options.companyName);
|
|
|
if (options.companyId) this.companyId = options.companyId;
|
|
|
},
|
|
|
methods: {
|
|
|
- // 选择图片
|
|
|
- chooseImage() {
|
|
|
+ // 通用上传
|
|
|
+ async uploadSingleFile(path) {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ uni.uploadFile({
|
|
|
+ url: this.action,
|
|
|
+ filePath: path,
|
|
|
+ name: 'file',
|
|
|
+ success: (res) => {
|
|
|
+ const data = JSON.parse(res.data);
|
|
|
+ if (data.code === 0 && data.data) resolve(data.data);
|
|
|
+ else reject(data.msg || '上传失败');
|
|
|
+ },
|
|
|
+ fail: (err) => reject(err)
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ // ======= 营业执照上传 =======
|
|
|
+ async chooseImage() {
|
|
|
uni.chooseImage({
|
|
|
count: 1,
|
|
|
success: async (res) => {
|
|
|
let tempFilePath = res.tempFilePaths[0];
|
|
|
|
|
|
- // iOS HEIC 转 JPG
|
|
|
+ // HEIC 转换
|
|
|
if (tempFilePath.toLowerCase().endsWith('.heic')) {
|
|
|
- // uni.showLoading({
|
|
|
- // title: '正在转换图片...'
|
|
|
- // });
|
|
|
try {
|
|
|
- const newPath = await this.convertHeicToJpg(tempFilePath);
|
|
|
- this.filePath = newPath;
|
|
|
+ tempFilePath = await this.convertHeicToJpg(tempFilePath);
|
|
|
} catch (e) {
|
|
|
- console.error('HEIC 转换失败:', e);
|
|
|
- uni.showToast({
|
|
|
- title: 'HEIC 转换失败,请使用 JPG/PNG',
|
|
|
- icon: 'none'
|
|
|
- });
|
|
|
- return;
|
|
|
- } finally {
|
|
|
- // uni.hideLoading();
|
|
|
+ return uni.showToast({ title: 'HEIC 转换失败,请使用 JPG/PNG', icon: 'none' });
|
|
|
}
|
|
|
- } else {
|
|
|
- this.filePath = tempFilePath;
|
|
|
+ }
|
|
|
+ this.filePath = tempFilePath;
|
|
|
+
|
|
|
+ // 自动上传
|
|
|
+ uni.showLoading({ title: '上传营业执照中...' });
|
|
|
+ try {
|
|
|
+ this.licenseUrl = await this.uploadSingleFile(tempFilePath);
|
|
|
+ uni.showToast({ title: '上传成功', icon: 'success' });
|
|
|
+ } catch (e) {
|
|
|
+ uni.showToast({ title: '上传失败', icon: 'none' });
|
|
|
+ } finally {
|
|
|
+ uni.hideLoading();
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
-
|
|
|
- // 删除图片
|
|
|
deleteImage() {
|
|
|
this.filePath = "";
|
|
|
- this.uploadUrl = "";
|
|
|
+ this.licenseUrl = "";
|
|
|
},
|
|
|
|
|
|
- // Canvas 转 JPG
|
|
|
+ // ======= 在职证明上传 (PDF) =======
|
|
|
+ async choosePDF() {
|
|
|
+ uni.chooseFile({
|
|
|
+ count: 1,
|
|
|
+ type: 'file',
|
|
|
+ extension: ['pdf'],
|
|
|
+ success: async (res) => {
|
|
|
+ const path = res.tempFiles[0].path;
|
|
|
+ this.pdfFilePath = path;
|
|
|
+
|
|
|
+ uni.showLoading({ title: '上传PDF中...' });
|
|
|
+ try {
|
|
|
+ this.employmentVerification = await this.uploadSingleFile(path);
|
|
|
+ uni.showToast({ title: 'PDF上传成功', icon: 'success' });
|
|
|
+ } catch (e) {
|
|
|
+ uni.showToast({ title: '上传失败', icon: 'none' });
|
|
|
+ } finally {
|
|
|
+ uni.hideLoading();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail: () => {
|
|
|
+ uni.showToast({ title: '请选择PDF文件', icon: 'none' });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ deletePDF() {
|
|
|
+ this.pdfFilePath = "";
|
|
|
+ this.employmentVerification = "";
|
|
|
+ },
|
|
|
+
|
|
|
+ // ======= 公司证明上传(多图) =======
|
|
|
+ async chooseCompanyProof() {
|
|
|
+ if (this.companyProofList.length >= 4) {
|
|
|
+ return uni.showToast({ title: '最多上传4张图片', icon: 'none' });
|
|
|
+ }
|
|
|
+ uni.chooseImage({
|
|
|
+ count: 4 - this.companyProofList.length,
|
|
|
+ success: async (res) => {
|
|
|
+ const imgs = res.tempFilePaths;
|
|
|
+ for (let img of imgs) {
|
|
|
+ this.companyProofList.push(img);
|
|
|
+ uni.showLoading({ title: '上传中...' });
|
|
|
+ try {
|
|
|
+ const url = await this.uploadSingleFile(img);
|
|
|
+ this.companyProofUrls.push(url);
|
|
|
+ } catch (e) {
|
|
|
+ uni.showToast({ title: '部分图片上传失败', icon: 'none' });
|
|
|
+ } finally {
|
|
|
+ uni.hideLoading();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ deleteCompanyProof(index) {
|
|
|
+ this.companyProofList.splice(index, 1);
|
|
|
+ this.companyProofUrls.splice(index, 1);
|
|
|
+ },
|
|
|
+
|
|
|
+ // ======= HEIC 转 JPG =======
|
|
|
convertHeicToJpg(path) {
|
|
|
return new Promise((resolve, reject) => {
|
|
|
uni.getImageInfo({
|
|
|
@@ -115,70 +214,33 @@
|
|
|
});
|
|
|
},
|
|
|
|
|
|
- // 上传文件
|
|
|
- async uploadFile() {
|
|
|
- return new Promise((resolve, reject) => {
|
|
|
- uni.uploadFile({
|
|
|
- url: this.action,
|
|
|
- filePath: this.filePath,
|
|
|
- name: 'file',
|
|
|
- success: (res) => {
|
|
|
- const data = JSON.parse(res.data);
|
|
|
- if (data.code === 0 && data.data) {
|
|
|
- this.uploadUrl = data.data;
|
|
|
- resolve(this.uploadUrl);
|
|
|
- } else {
|
|
|
- reject(data.msg || '上传失败');
|
|
|
- }
|
|
|
- },
|
|
|
- fail: (err) => reject(err)
|
|
|
- });
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
- // 提交
|
|
|
+ // ======= 提交 =======
|
|
|
async goUnderReview() {
|
|
|
- if (!this.filePath) {
|
|
|
- uni.showToast({
|
|
|
- title: '请先选择图片',
|
|
|
- icon: 'none'
|
|
|
- });
|
|
|
- return;
|
|
|
- }
|
|
|
+ if (!this.licenseUrl) return uni.showToast({ title: '请上传营业执照', icon: 'none' });
|
|
|
+ if (!this.employmentVerification) return uni.showToast({ title: '请上传在职证明PDF', icon: 'none' });
|
|
|
+ if (this.companyProofUrls.length === 0) return uni.showToast({ title: '请上传公司证明图片', icon: 'none' });
|
|
|
|
|
|
- uni.showLoading({
|
|
|
- title: '上传中...'
|
|
|
- });
|
|
|
- try {
|
|
|
- await this.uploadFile();
|
|
|
- const data = {
|
|
|
- companyCertification: this.uploadUrl,
|
|
|
- companyId: this.companyId || ''
|
|
|
- };
|
|
|
+ const data = {
|
|
|
+ companyId: this.companyId,
|
|
|
+ companyCertification: this.licenseUrl,
|
|
|
+ employmentVerification: this.employmentVerification,
|
|
|
+ companyVerification: this.companyProofUrls.join(',')
|
|
|
+ };
|
|
|
|
|
|
+ uni.showLoading({ title: '提交中...' });
|
|
|
+ try {
|
|
|
const res = await this.$Request.postJson("/app/company/updateCompany", data);
|
|
|
uni.hideLoading();
|
|
|
if (res.code === 0) {
|
|
|
- uni.showToast({
|
|
|
- title: '提交成功',
|
|
|
- icon: 'success'
|
|
|
- });
|
|
|
- uni.navigateTo({
|
|
|
- url: "/package/jobIntention/completeMsg"
|
|
|
- });
|
|
|
+ uni.showToast({ title: '提交成功', icon: 'success' });
|
|
|
+ uni.navigateTo({ url: "/package/jobIntention/completeMsg" });
|
|
|
} else {
|
|
|
- uni.showToast({
|
|
|
- title: res.msg || '提交失败',
|
|
|
- icon: 'none'
|
|
|
- });
|
|
|
+ uni.showToast({ title: res.msg || '提交失败', icon: 'none' });
|
|
|
}
|
|
|
} catch (e) {
|
|
|
uni.hideLoading();
|
|
|
console.error('提交失败', e);
|
|
|
- uni.showToast({
|
|
|
- title: e || '网络异常',
|
|
|
- icon: 'none'
|
|
|
- });
|
|
|
+ uni.showToast({ title: '网络异常,请重试', icon: 'none' });
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -202,7 +264,6 @@
|
|
|
flex: 1;
|
|
|
padding: 40rpx;
|
|
|
box-sizing: border-box;
|
|
|
- overflow: hidden;
|
|
|
overflow-y: auto;
|
|
|
|
|
|
.company-title {
|
|
|
@@ -213,39 +274,45 @@
|
|
|
}
|
|
|
|
|
|
.company-desc {
|
|
|
- color: rgba(102, 102, 102, 1);
|
|
|
- font-family: DM Sans;
|
|
|
- font-size: 24rpx;
|
|
|
- font-weight: 400;
|
|
|
- line-height: 32rpx;
|
|
|
- }
|
|
|
-
|
|
|
- .company-btn {
|
|
|
- color: #016bf6;
|
|
|
- font-family: DM Sans;
|
|
|
+ color: #666;
|
|
|
font-size: 24rpx;
|
|
|
- font-weight: 400;
|
|
|
line-height: 32rpx;
|
|
|
- margin-top: 20rpx;
|
|
|
}
|
|
|
|
|
|
.upload-img {
|
|
|
- width: 100%;
|
|
|
- height: 388rpx;
|
|
|
- background: #fce9dc;
|
|
|
+ width: 142rpx;
|
|
|
+ height: 142rpx;
|
|
|
display: flex;
|
|
|
justify-content: center;
|
|
|
align-items: center;
|
|
|
margin-top: 20rpx;
|
|
|
position: relative;
|
|
|
- cursor: pointer;
|
|
|
}
|
|
|
|
|
|
- /* 删除按钮 */
|
|
|
+ .upload-group {
|
|
|
+ display: flex;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ gap: 20rpx;
|
|
|
+ margin-top: 20rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .text-item {
|
|
|
+ width: 142rpx;
|
|
|
+ height: 142rpx;
|
|
|
+ color: #666;
|
|
|
+ font-size: 16rpx;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ flex-direction: column;
|
|
|
+ background: #eee;
|
|
|
+ border-radius: 12rpx;
|
|
|
+ }
|
|
|
+
|
|
|
.delete-btn {
|
|
|
position: absolute;
|
|
|
- top: 10rpx;
|
|
|
- right: 10rpx;
|
|
|
+ top: 0;
|
|
|
+ right: 0;
|
|
|
width: 36rpx;
|
|
|
height: 36rpx;
|
|
|
line-height: 36rpx;
|
|
|
@@ -258,37 +325,30 @@
|
|
|
}
|
|
|
|
|
|
.warning-title {
|
|
|
- color: #1f2c37;
|
|
|
- font-family: DM Sans;
|
|
|
- font-size: 28rpx;
|
|
|
- font-weight: 500;
|
|
|
+ color: #666;
|
|
|
+ font-size: 24rpx;
|
|
|
margin-top: 20rpx;
|
|
|
+ font-weight: 500;
|
|
|
}
|
|
|
|
|
|
.warning-desc {
|
|
|
- color: #666666;
|
|
|
- font-family: DM Sans;
|
|
|
+ color: #666;
|
|
|
font-size: 24rpx;
|
|
|
- font-weight: 400;
|
|
|
- margin-top: 20rpx;
|
|
|
+ margin-top: 8rpx;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
.bottom-btn {
|
|
|
border-radius: 999px;
|
|
|
background: #016bf6;
|
|
|
- flex-shrink: 0;
|
|
|
display: flex;
|
|
|
justify-content: center;
|
|
|
align-items: center;
|
|
|
- color: rgba(255, 255, 255, 1);
|
|
|
- font-family: DM Sans;
|
|
|
+ color: #fff;
|
|
|
font-size: 32rpx;
|
|
|
- font-weight: 400;
|
|
|
padding: 16rpx 32rpx;
|
|
|
- box-sizing: border-box;
|
|
|
margin: 20rpx;
|
|
|
margin-bottom: 110rpx;
|
|
|
}
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|