This commit is contained in:
2026-03-13 15:14:33 +08:00
8 changed files with 354 additions and 261 deletions

View File

@@ -35,6 +35,15 @@ export function updateApply(data) {
}) })
} }
// 保存助学金申请(第一次保存)
export function saveApply(data) {
return request({
url: '/comprehensive/zxj/apply/save',
method: 'post',
data: data
})
}
// 删除助学金申请 // 删除助学金申请
export function delApply(id) { export function delApply(id) {
return request({ return request({

View File

@@ -327,12 +327,11 @@
<view class="approval-section"> <view class="approval-section">
<view class="section-title">学校意见</view> <view class="section-title">学校意见</view>
<view class="approval-content"> <view class="approval-content">
<text v-if="formData.zzdj || formData.xxyj || formData.xxmc || formData.xxyjrq" class="approval-text">已审核</text> <text v-if="formData.zzdj || formData.xxmc || formData.xxyjrq" class="approval-text">已审核</text>
<text v-else class="no-content">暂无审核意见</text> <text v-else class="no-content">暂无审核意见</text>
</view> </view>
<view class="approval-info"> <view class="approval-info">
<text v-if="formData.zzdj">确认助学金等级:<text class="difficulty-level">{{ getLevelText(formData.zzdj) }}</text></text> <text v-if="formData.zzdj">确认助学金等级:<text class="difficulty-level">{{ getLevelText(formData.zzdj) }}</text></text>
<text v-if="formData.xxyj">学校意见{{ formData.xxyj }}</text>
<text v-if="formData.xxmc">审核人{{ formData.xxmc }}</text> <text v-if="formData.xxmc">审核人{{ formData.xxmc }}</text>
<text v-if="formData.xxyjrq">审核时间{{ formData.xxyjrq }}</text> <text v-if="formData.xxyjrq">审核时间{{ formData.xxyjrq }}</text>
</view> </view>
@@ -377,7 +376,7 @@
</template> </template>
<script> <script>
import { addApply, updateApply, getApply, getStuInfo, getExtraInfo, getFamilyInfo, getCurrentYear, getAidLevels, getZxjStudentInfo, getOwnStudentInfo, findByXhAndApplyYear } from '@/api/finance/financialaid' import { addApply, updateApply, saveApply, getApply, getStuInfo, getExtraInfo, getFamilyInfo, getCurrentYear, getAidLevels, getZxjStudentInfo, getOwnStudentInfo, findByXhAndApplyYear } from '@/api/finance/financialaid'
import uploadFile from "@/plugins/upload.js" import uploadFile from "@/plugins/upload.js"
import { queryAffixs, getAffixItems, uploadFiles, deleteAffix } from '@/api/affix' import { queryAffixs, getAffixItems, uploadFiles, deleteAffix } from '@/api/affix'
import { getUserProfile } from '@/api/system/user' import { getUserProfile } from '@/api/system/user'
@@ -589,6 +588,14 @@
// 处理用户个人信息 // 处理用户个人信息
if (userProfileRes.code === 200 && userProfileRes.data) { if (userProfileRes.code === 200 && userProfileRes.data) {
// 可以获取用户相关信息 // 可以获取用户相关信息
// 获取用户签名
const signature = userProfileRes.data.signature
if (signature) {
// 设置表单签名字段
this.formData.xsqm = signature
// 构造完整的图片URL
this.signImg = this.baseUrl + signature
}
} }
// 处理家庭成员信息 // 处理家庭成员信息
if (familyRes.code === 200 && familyRes.data && familyRes.data.length > 0) { if (familyRes.code === 200 && familyRes.data && familyRes.data.length > 0) {
@@ -632,6 +639,10 @@
this.formData.zzmm = extraRes.data.zzmm || this.formData.zzmm || '' this.formData.zzmm = extraRes.data.zzmm || this.formData.zzmm || ''
this.formData.dz = extraRes.data.xxlxdz || this.formData.dz || '' this.formData.dz = extraRes.data.xxlxdz || this.formData.dz || ''
this.formData.yb = extraRes.data.jtyzbm || this.formData.yb || '' this.formData.yb = extraRes.data.jtyzbm || this.formData.yb || ''
// 从 extraInfo 接口回显证件照
if (extraRes.data.whitePhoto) {
this.formData.zp = extraRes.data.whitePhoto
}
} }
// 查询贫困申请信息 // 查询贫困申请信息
if (this.formData.xh && this.formData.stuYearId) { if (this.formData.xh && this.formData.stuYearId) {
@@ -924,9 +935,19 @@
// 删除文件 // 删除文件
deleteFile(index) { deleteFile(index) {
const deletedFile = this.affixFiles[index]; const deletedFile = this.affixFiles[index];
// 从文件列表中移除
this.affixFiles.splice(index, 1); this.affixFiles.splice(index, 1);
if (this.affixFiles.length === 0) { // 重新生成 affixId确保后端知道文件列表已经发生变化
this.formData.affixId = null; this.formData.affixId = this.affixFiles.length > 0 ? this.generateUUID() : null;
// 调用后端接口删除文件
if (deletedFile.fileId) {
deleteAffix(deletedFile.fileId).then(res => {
if (res.code === 200) {
console.log('文件删除成功');
}
}).catch(err => {
console.error('文件删除失败:', err);
});
} }
uni.showToast({ uni.showToast({
title: '删除成功', title: '删除成功',
@@ -960,12 +981,12 @@
} }
this.loading = true this.loading = true
const submitData = { ...this.formData } const submitData = { ...this.formData }
// 如果有申请ID则更新申请否则新增申请 // 如果有申请ID则更新申请否则第一次保存调用save接口
const request = this.applyId ? updateApply(submitData) : addApply(submitData) const request = this.applyId ? updateApply(submitData) : saveApply(submitData)
request.then(res => { request.then(res => {
if (res.code === 200) { if (res.code === 200) {
uni.showToast({ title: '保存成功', icon: 'success' }) uni.showToast({ title: '保存成功', icon: 'success' })
// 如果是新增申请保存成功后获取申请ID // 如果是第一次保存保存成功后获取申请ID
if (!this.applyId) { if (!this.applyId) {
this.applyId = res.data.id this.applyId = res.data.id
} }
@@ -1186,6 +1207,7 @@
title: submit ? '申请提交成功' : '表单保存成功', title: submit ? '申请提交成功' : '表单保存成功',
icon: 'success' icon: 'success'
}) })
this.goBack()
// 如果是提交申请,跳转到列表页面 // 如果是提交申请,跳转到列表页面
if (submit) { if (submit) {
uni.redirectTo({ uni.redirectTo({
@@ -1208,13 +1230,15 @@
this.loading = false this.loading = false
}) })
} else { } else {
// 新增申请 // 第一次保存调用save接口提交申请调用add接口
addApply(data).then(res => { const request = submit ? addApply(data) : saveApply(data)
request.then(res => {
if (res.code === 200) { if (res.code === 200) {
uni.showToast({ uni.showToast({
title: submit ? '申请提交成功' : '表单保存成功', title: submit ? '申请提交成功' : '表单保存成功',
icon: 'success' icon: 'success'
}) })
this.goBack()
// 如果是提交申请,跳转到列表页面 // 如果是提交申请,跳转到列表页面
if (submit) { if (submit) {
uni.redirectTo({ uni.redirectTo({
@@ -1231,13 +1255,6 @@
}) })
} }
this.loading = false this.loading = false
}).catch(err => {
console.error('新增申请失败:', err)
uni.showToast({
title: submit ? '申请提交失败' : '表单保存失败',
icon: 'none'
})
this.loading = false
}) })
} }
}, },

View File

@@ -91,7 +91,7 @@
<view class="card-actions"> <view class="card-actions">
<view> <view>
<uni-button type="text" size="mini" @click="detail(item, '修改')" <uni-button type="text" size="mini" @click="detail(item, '修改')"
v-if="item.step == 0 || isRejected(item)"> v-if="item.step == 0">
<uni-icons type="eye-filled" size="14" class="mr-5"></uni-icons>修改 <uni-icons type="eye-filled" size="14" class="mr-5"></uni-icons>修改
</uni-button> </uni-button>
<uni-button type="text" size="mini" @click="handleRevoke(item)" <uni-button type="text" size="mini" @click="handleRevoke(item)"
@@ -99,7 +99,7 @@
<uni-icons type="back" size="14" class="mr-5"></uni-icons>撤回 <uni-icons type="back" size="14" class="mr-5"></uni-icons>撤回
</uni-button> </uni-button>
<uni-button type="text" size="mini" @click="handleDelete(item)" <uni-button type="text" size="mini" @click="handleDelete(item)"
v-if="item.step == 0"> v-if="item.step == 0 || isRejected(item)">
<uni-icons type="trash" size="14" class="mr-5"></uni-icons>删除 <uni-icons type="trash" size="14" class="mr-5"></uni-icons>删除
</uni-button> </uni-button>
</view> </view>

View File

@@ -297,6 +297,7 @@
import { getOwnSign } from '@/api/workStudy/post'; import { getOwnSign } from '@/api/workStudy/post';
import { getOwnKnrd, getOwnExtraInfo, getOwnInfo as getOwnStuInfo } from '@/api/finance/special'; import { getOwnKnrd, getOwnExtraInfo, getOwnInfo as getOwnStuInfo } from '@/api/finance/special';
import uploadFile from "@/plugins/upload.js" import uploadFile from "@/plugins/upload.js"
import { getUserProfile } from '@/api/system/user'
import config from '@/config' import config from '@/config'
export default { export default {
data() { data() {
@@ -418,17 +419,17 @@
this.loading = true; this.loading = true;
try { try {
// 并行请求所有基础信息 // 并行请求所有基础信息
const [signRes, knrdRes, stuInfoRes, extraInfoRes] = await Promise.all([ const [userProfileRes, knrdRes, stuInfoRes, extraInfoRes] = await Promise.all([
getOwnSign(), getUserProfile(),
getOwnKnrd(), getOwnKnrd(),
getOwnStuInfo(), getOwnStuInfo(),
getOwnExtraInfo() getOwnExtraInfo()
]); ]);
// 处理签名信息 // 处理签名信息
if (signRes && signRes.data) { if (userProfileRes && userProfileRes.code === 200 && userProfileRes.data && userProfileRes.data.signature) {
this.formData.applySign = signRes.data; this.formData.applySign = userProfileRes.data.signature;
this.signImg = this.baseUrl + signRes.data; this.signImg = this.baseUrl + userProfileRes.data.signature;
} }
// 处理困难认定信息 // 处理困难认定信息

View File

@@ -316,6 +316,7 @@
<script> <script>
import { add, update, reApply, getOwnSign, getOwnFamily, getStudentInfo, getExtraInfo } from '@/api/finance/knzzZsg'; import { add, update, reApply, getOwnSign, getOwnFamily, getStudentInfo, getExtraInfo } from '@/api/finance/knzzZsg';
import uploadFile from "@/plugins/upload.js" import uploadFile from "@/plugins/upload.js"
import { getUserProfile } from '@/api/system/user'
import config from '@/config' import config from '@/config'
export default { export default {
@@ -427,11 +428,11 @@ export default {
// 并行调用多个API接口 // 并行调用多个API接口
Promise.all([ Promise.all([
getOwnSign(), getUserProfile(),
getOwnFamily(), getOwnFamily(),
getStudentInfo(), getStudentInfo(),
getExtraInfo() getExtraInfo()
]).then(([signRes, familyRes, studentRes, extraRes]) => { ]).then(([userProfileRes, familyRes, studentRes, extraRes]) => {
uni.hideLoading(); uni.hideLoading();
// 处理学生基本信息 // 处理学生基本信息
@@ -483,8 +484,9 @@ export default {
} }
// 处理签名信息 // 处理签名信息
if (signRes.code === 200 && signRes.data) { if (userProfileRes.code === 200 && userProfileRes.data && userProfileRes.data.signature) {
// 这里可以处理签名信息,根据实际需求 this.formData.applySign = userProfileRes.data.signature;
this.signImg = this.baseUrl + userProfileRes.data.signature;
} }
}).catch(err => { }).catch(err => {
uni.hideLoading(); uni.hideLoading();

View File

@@ -93,19 +93,18 @@
<view class="form-item"> <view class="form-item">
<label class="form-label"><span class="red-tip">*</span>证件照</label> <label class="form-label"><span class="red-tip">*</span>证件照</label>
<!-- 编辑模式显示上传组件 --> <!-- 编辑模式显示上传组件 -->
<view class="upload-container" v-if="type !== 'detail'"> <view class="example-body" v-if="type !== 'detail'">
<view class="upload-btn" @click="handlePhotoUpload"> <uni-file-picker
<text class="upload-icon">+</text> @select="handlePhotoUpload"
<text>上传文件</text> @delete="deletePhoto"
</view> :auto-upload="false"
<view class="file-list" v-if="photoFiles.length"> limit="1"
<view class="file-item" v-for="(file, index) in photoFiles" :key="index"> :disabled="type === 'detail'"
<text class="file-name" @click="previewPhoto">{{ file.name }}</text> mode="grid"
<uni-icons type="trash-filled" size="30" @click="deletePhoto" class="delete-btn"></uni-icons> :value="filePickerValue"
</view> ></uni-file-picker>
</view>
<view class="upload-tip">请上传电子版一寸照支持JPGPNG格式</view>
</view> </view>
<view class="upload-tip" v-if="type !== 'detail'">支持上传jpg/png格式照片单个文件不超过5MB</view>
<!-- 详情模式显示照片预览 --> <!-- 详情模式显示照片预览 -->
<view class="photo-preview-container" v-if="formData.pic && type === 'detail'"> <view class="photo-preview-container" v-if="formData.pic && type === 'detail'">
<image :src="getFullImageUrl(formData.pic)" mode="aspectFill"></image> <image :src="getFullImageUrl(formData.pic)" mode="aspectFill"></image>
@@ -221,12 +220,12 @@
<view class="approval-section"> <view class="approval-section">
<view class="section-title">院系审核意见</view> <view class="section-title">院系审核意见</view>
<view class="approval-content"> <view class="approval-content">
<text v-if="formData.deptCmt" class="approval-text">{{ formData.deptCmt }}</text> <text v-if="formData.xwCmt" class="approval-text">{{ formData.xwCmt }}</text>
<text v-else class="no-content">暂无审核意见</text> <text v-else class="no-content">暂无审核意见</text>
</view> </view>
<view class="approval-info"> <view class="approval-info">
<text v-if="formData.xwName">审核人{{ formData.xwName }}</text> <text v-if="formData.xwName">审核人{{ formData.xwName }}</text>
<text v-if="formData.deptDate">审核时间{{ formData.deptDate }}</text> <text v-if="formData.xwDate">审核时间{{ formData.xwDate }}</text>
</view> </view>
</view> </view>
@@ -261,6 +260,7 @@
import { getDetail, doApply, doEdit, doReApply, getOwnInfo, getOwnExtraInfo, getYearByTag } from '@/api/finance/knzzZzq'; import { getDetail, doApply, doEdit, doReApply, getOwnInfo, getOwnExtraInfo, getYearByTag } from '@/api/finance/knzzZzq';
import { getOwnSign } from '@/api/workStudy/post'; import { getOwnSign } from '@/api/workStudy/post';
import uploadFile from "@/plugins/upload.js"; import uploadFile from "@/plugins/upload.js";
import { getUserProfile } from '@/api/system/user';
import config from "@/config.js"; import config from "@/config.js";
export default { export default {
name: "KnzzZzqApply", name: "KnzzZzqApply",
@@ -390,9 +390,9 @@ import config from "@/config.js";
await this.fetchYearData(); await this.fetchYearData();
// 并行请求所有基础信息 // 并行请求所有基础信息
const [infoRes, signRes] = await Promise.all([ const [infoRes, userProfileRes] = await Promise.all([
getOwnInfo(), getOwnInfo(),
getOwnSign() getUserProfile()
]); ]);
const infoData = infoRes.data || {}; const infoData = infoRes.data || {};
@@ -417,9 +417,9 @@ import config from "@/config.js";
} }
// 处理签名信息 // 处理签名信息
if (signRes && signRes.data) { if (userProfileRes && userProfileRes.code === 200 && userProfileRes.data && userProfileRes.data.signature) {
this.formData.applySign = signRes.data; this.formData.applySign = userProfileRes.data.signature;
this.signImg = this.baseUrl + signRes.data; this.signImg = this.baseUrl + userProfileRes.data.signature;
} }
// 获取个人扩展信息 // 获取个人扩展信息
@@ -523,26 +523,30 @@ import config from "@/config.js";
}, },
// 处理证件照上传 // 处理证件照上传
handlePhotoUpload() { handlePhotoUpload(e) {
// 如果是详情模式,不执行上传操作 // 如果是详情模式,不执行上传操作
if (this.type === 'detail') { if (this.type === 'detail') {
return; return;
} }
uni.chooseFile({ const tempFiles = e.tempFilePaths || [];
count: 1, // 最多选择1个文件
extension: ['jpg', 'jpeg', 'png'], // 限制文件类型
success: async (chooseRes) => {
// 遍历选择的文件,逐个上传 // 遍历选择的文件,逐个上传
for (const file of chooseRes.tempFiles) { for (const file of e.tempFiles) {
this.uploadFile(file);
}
},
// 上传文件的通用方法
async uploadFile(file) {
try { try {
// 检查文件大小(10MB = 10 * 1024 * 1024 bytes // 检查文件大小(5MB = 5 * 1024 * 1024 bytes
if (file.size > 10 * 1024 * 1024) { if (file.size > 5 * 1024 * 1024) {
uni.showToast({ uni.showToast({
title: `文件 ${file.name} 大小超过10MB请重新选择`, title: `文件 ${file.name} 大小超过5MB请重新选择`,
icon: 'none' icon: 'none'
}); });
continue; return;
} }
// 检查文件格式 // 检查文件格式
@@ -553,7 +557,7 @@ import config from "@/config.js";
title: `文件 ${file.name} 格式不支持,请选择 JPG、PNG 格式的文件`, title: `文件 ${file.name} 格式不支持,请选择 JPG、PNG 格式的文件`,
icon: 'none' icon: 'none'
}); });
continue; return;
} }
// 上传文件 // 上传文件
@@ -564,7 +568,7 @@ import config from "@/config.js";
if (result && (result.code === 200 || !result.code)) { if (result && (result.code === 200 || !result.code)) {
// 构造文件信息对象 // 构造文件信息对象
const fileUrl = result.savePath || result.fileName; const fileUrl = result.savePath || result.fileName;
const fullUrl = this.baseUrl + fileUrl; const fullUrl = this.getFullImageUrl(fileUrl);
const fileInfo = { const fileInfo = {
name: file.name, name: file.name,
path: fileUrl, path: fileUrl,
@@ -574,7 +578,7 @@ import config from "@/config.js";
// 更新 formData.pic // 更新 formData.pic
this.formData.pic = fileUrl; this.formData.pic = fileUrl;
// 更新 photoFiles 数组 // 更新 photoFiles 数组,确保 uni-file-picker 组件能获取预览路径
this.photoFiles = [fileInfo]; this.photoFiles = [fileInfo];
uni.showToast({ uni.showToast({
@@ -599,17 +603,6 @@ import config from "@/config.js";
duration: 2000 duration: 2000
}); });
} }
}
},
// 取消选择文件的处理
fail: (err) => {
console.error('选择文件失败:', err);
uni.showToast({
title: '选择文件失败,请重试',
icon: 'none'
});
}
});
}, },
// 删除证件照 // 删除证件照
@@ -1487,6 +1480,11 @@ import config from "@/config.js";
line-height: 1.4; line-height: 1.4;
} }
/* 证件照上传容器 */
.example-body {
margin-top: 10rpx;
}
/* 照片预览容器 */ /* 照片预览容器 */
.photo-preview-container { .photo-preview-container {
margin-top: 20rpx; margin-top: 20rpx;

View File

@@ -449,7 +449,9 @@
<script> <script>
import { addApply, updateApply, getApply, infoCheck, getStuByXh, getxh, extraInfo, stuInfoView, getOwnFamily, getCurrentYear, queryByStuNo, getKnrdYear } from '@/api/finance/poverty' import { addApply, updateApply, getApply, infoCheck, getStuByXh, getxh, extraInfo, stuInfoView, getOwnFamily, getCurrentYear, queryByStuNo, getKnrdYear } from '@/api/finance/poverty'
import uploadFile from "@/plugins/upload.js" import uploadFile from "@/plugins/upload.js"
import { queryAffixs, getAffixItems } from '@/api/affix' import { queryAffixs, getAffixItems, deleteAffix } from '@/api/affix'
import { getUserProfile } from '@/api/system/user'
import config from '@/config'
export default { export default {
data() { data() {
return { return {
@@ -547,7 +549,7 @@
affixFiles: [], affixFiles: [],
loading: false, loading: false,
signImg: '', signImg: '',
baseUrl: uni.getStorageSync('baseUrl') baseUrl: config.baseUrl || ''
} }
}, },
onLoad(option) { onLoad(option) {
@@ -625,6 +627,9 @@
this.formData.xb = res.data.gender this.formData.xb = res.data.gender
this.formData.phone = res.data.phone this.formData.phone = res.data.phone
// 获取用户签名
this.getUserSignature()
// 获取扩展信息 // 获取扩展信息
this.getOwnInfo() this.getOwnInfo()
// 获取家庭成员信息 // 获取家庭成员信息
@@ -638,6 +643,22 @@
this.loading = false this.loading = false
}) })
}, },
// 获取用户签名
getUserSignature() {
getUserProfile().then(res => {
if (res.code === 200 && res.data) {
const signature = res.data.signature
if (signature) {
// 设置表单签名字段
this.formData.sqrqm = signature
// 构造完整的图片URL
this.signImg = this.baseUrl + signature
}
}
}).catch(err => {
console.error('获取用户签名失败:', err)
})
},
// 获取申请详情 // 获取申请详情
getApplyDetail() { getApplyDetail() {
if (!this.applyId) return if (!this.applyId) return
@@ -671,12 +692,13 @@
this.formData.sqrcn = this.formData.sqrcn.toString() this.formData.sqrcn = this.formData.sqrcn.toString()
} }
// 处理手写签字 // 处理手写签字支持sqrqm和applySign字段
if (this.formData.sqrqm) { const signPath = this.formData.sqrqm || this.formData.applySign;
// 从sqrqm构造完整的图片URL if (signPath) {
this.signImg = this.baseUrl + this.formData.sqrqm // 构造完整的图片URL
this.signImg = this.baseUrl + signPath;
} else { } else {
this.signImg = '' this.signImg = '';
} }
// 处理困难佐证材料 // 处理困难佐证材料
@@ -945,11 +967,7 @@
} }
console.log('handleUpload方法被调用'); console.log('handleUpload方法被调用');
// 测试点击事件是否正常
uni.showToast({
title: '测试点击事件',
icon: 'none'
});
// 1. 定义affixId生成工具函数确保uuid唯一性 // 1. 定义affixId生成工具函数确保uuid唯一性
const generateUUID = () => { const generateUUID = () => {
@@ -1040,16 +1058,35 @@
}); });
}, },
// 删除文件 // 删除文件
deleteFile(index) { async deleteFile(index) {
const deletedFile = this.affixFiles[index]; const deletedFile = this.affixFiles[index];
if (!deletedFile) return;
try {
// 调用后端删除接口
if (deletedFile.fileId) {
await deleteAffix(deletedFile.fileId);
}
// 从数组中删除文件
this.affixFiles.splice(index, 1); this.affixFiles.splice(index, 1);
// 如果没有文件了清空affixId
if (this.affixFiles.length === 0) { if (this.affixFiles.length === 0) {
this.formData.affixId = null; this.formData.affixId = null;
} }
uni.showToast({ uni.showToast({
title: '删除成功', title: '删除成功',
icon: 'success' icon: 'success'
}); });
} catch (error) {
console.error('删除文件失败:', error);
uni.showToast({
title: '删除失败,请重试',
icon: 'none'
});
}
}, },
// 预览文件 // 预览文件
previewImage(url) { previewImage(url) {

View File

@@ -262,6 +262,8 @@
<script> <script>
import { addApply, updateApply, getApply, getOwnFamily, getOwnKnrd, getOwnExtraInfo, getOwnInfo, reApply } from '@/api/finance/special'; import { addApply, updateApply, getApply, getOwnFamily, getOwnKnrd, getOwnExtraInfo, getOwnInfo, reApply } from '@/api/finance/special';
import uploadFile from "@/plugins/upload.js" import uploadFile from "@/plugins/upload.js"
import { getUserProfile } from '@/api/system/user'
import config from '@/config'
export default { export default {
data() { data() {
@@ -333,7 +335,7 @@ export default {
], ],
affixFiles: [], affixFiles: [],
signImg: '', signImg: '',
baseUrl: uni.getStorageSync('baseUrl') baseUrl: config.baseUrl || ''
}; };
}, },
onLoad(option) { onLoad(option) {
@@ -393,20 +395,24 @@ export default {
} else { } else {
this.signImg = ''; this.signImg = '';
} }
// 处理困难佐证材料 // 处理困难佐证材料(支持多个文件)
if (this.listData.hardFile) { if (this.listData.hardFile) {
// 分割文件路径字符串
const filePaths = this.listData.hardFile.split(',');
// 构造文件信息对象数组
this.affixFiles = filePaths.map(filePath => {
// 从文件路径中提取文件名 // 从文件路径中提取文件名
const fileName = this.listData.hardFile.split('/').pop(); const fileName = filePath.split('/').pop();
// 构造文件信息对象 return {
this.affixFiles = [{
attachmentName: fileName, attachmentName: fileName,
attachmentUrl: this.listData.hardFile, attachmentUrl: filePath,
serverUrl: this.listData.hardFile, serverUrl: filePath,
fileId: '', fileId: '',
fileSize: 0, fileSize: 0,
fileSuffix: fileName.split('.').pop().toLowerCase(), fileSuffix: fileName.split('.').pop().toLowerCase(),
savePath: this.listData.hardFile savePath: filePath
}]; };
});
} else { } else {
this.affixFiles = []; this.affixFiles = [];
} }
@@ -451,6 +457,17 @@ export default {
this.formData.familyAddr = extraData.xjtdz || ''; this.formData.familyAddr = extraData.xjtdz || '';
this.formData.postCode = extraData.jtyzbm || ''; this.formData.postCode = extraData.jtyzbm || '';
} }
// 获取用户签名
const userProfileRes = await getUserProfile();
if (userProfileRes.code === 200 && userProfileRes.data) {
const signature = userProfileRes.data.signature;
if (signature) {
// 设置表单签名字段
this.formData.applySign = signature;
// 构造完整的图片URL
this.signImg = this.baseUrl + signature;
}
}
} catch (error) { } catch (error) {
console.error('获取用户信息失败:', error); console.error('获取用户信息失败:', error);
} }
@@ -693,20 +710,24 @@ export default {
} else { } else {
this.signImg = ''; this.signImg = '';
} }
// 处理困难佐证材料 // 处理困难佐证材料(支持多个文件)
if (data.hardFile) { if (data.hardFile) {
// 分割文件路径字符串
const filePaths = data.hardFile.split(',');
// 构造文件信息对象数组
this.affixFiles = filePaths.map(filePath => {
// 从文件路径中提取文件名 // 从文件路径中提取文件名
const fileName = data.hardFile.split('/').pop(); const fileName = filePath.split('/').pop();
// 构造文件信息对象 return {
this.affixFiles = [{
attachmentName: fileName, attachmentName: fileName,
attachmentUrl: data.hardFile, attachmentUrl: filePath,
serverUrl: data.hardFile, serverUrl: filePath,
fileId: '', fileId: '',
fileSize: 0, fileSize: 0,
fileSuffix: fileName.split('.').pop().toLowerCase(), fileSuffix: fileName.split('.').pop().toLowerCase(),
savePath: data.hardFile savePath: filePath
}]; };
});
} else { } else {
this.affixFiles = []; this.affixFiles = [];
} }
@@ -732,6 +753,14 @@ export default {
applyDate: new Date() applyDate: new Date()
}; };
// 处理困难佐证材料,将 affixFiles 转换为 hardFile支持多个文件用逗号分隔
if (this.affixFiles.length > 0) {
// 将所有文件的路径用逗号分隔拼接成一个字符串
submitData.hardFile = this.affixFiles.map(file => file.savePath).join(',');
} else {
submitData.hardFile = '';
}
this.loading = true; this.loading = true;
try { try {
let res; let res;
@@ -755,7 +784,7 @@ export default {
this.goBack(); this.goBack();
}, 1500); }, 1500);
} else { } else {
uni.showToast({ title: res.message || '提交失败', icon: 'none' }); uni.showToast({ title: res.msg || '提交失败', icon: 'none' });
} }
} catch (error) { } catch (error) {
console.error('提交申请失败:', error); console.error('提交申请失败:', error);