From b6337714ccd0a128b7e9bbddb819865048724a0d Mon Sep 17 00:00:00 2001
From: weishengyou <2454197255@qq.com>
Date: Thu, 5 Mar 2026 14:37:37 +0800
Subject: [PATCH] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E8=B5=84=E5=8A=A9-=E4=BF=AE?=
=?UTF-8?q?=E5=A4=8D=E5=9B=BE=E7=89=87=E6=96=87=E4=BB=B6=E9=A2=84=E8=A7=88?=
=?UTF-8?q?=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pages/finance/aid/apply.vue | 128 ++++++++++++++++++-----------
pages/finance/knzzGl/apply.vue | 138 +++++++++++++++++++++++++++-----
pages/finance/knzzZsg/apply.vue | 59 +++++++++++---
pages/finance/knzzZzq/apply.vue | 67 ++++++++++++++--
4 files changed, 309 insertions(+), 83 deletions(-)
diff --git a/pages/finance/aid/apply.vue b/pages/finance/aid/apply.vue
index 78ca0e5..85c53c8 100644
--- a/pages/finance/aid/apply.vue
+++ b/pages/finance/aid/apply.vue
@@ -96,19 +96,25 @@
-
-
-
-
- 支持上传jpg/png格式照片,单个文件不超过5MB
+
+
+
+
+ 支持上传jpg/png格式照片,单个文件不超过5MB
+
+
+
+
+
@@ -375,6 +381,7 @@
import uploadFile from "@/plugins/upload.js"
import { queryAffixs, getAffixItems, uploadFiles, deleteAffix } from '@/api/affix'
import { getUserProfile } from '@/api/system/user'
+ import config from '@/config'
export default {
data() {
return {
@@ -402,33 +409,33 @@
yb: '',
zzls: '',
gyhd: '',
- rkzs: '',
- rjnsr: '',
- srly: '',
- dz: '',
- kndj: '',
- knlx: '',
- bankCard: '',
- bankAddr: '',
- jtcyObj: [
- {
- xm: '',
- nl: '',
- gx: '',
- dw: '',
- lxdh: '',
- zy: '',
- nsr: '',
- jkzk: ''
- }
- ],
- sqly: '',
- affixId: null,
- bjyj: '',
- bjyjdj: '',
- ejxyyj: '',
- ejxyyjdj: ''
- },
+ rkzs: '',
+ rjnsr: '',
+ srly: '',
+ dz: '',
+ kndj: '',
+ knlx: '',
+ bankCard: '',
+ bankAddr: '',
+ jtcyObj: [
+ {
+ xm: '',
+ nl: '',
+ gx: '',
+ dw: '',
+ lxdh: '',
+ zy: '',
+ nsr: '',
+ jkzk: ''
+ }
+ ],
+ sqly: '',
+ affixId: null,
+ bjyj: '',
+ bjyjdj: '',
+ ejxyyj: '',
+ ejxyyjdj: ''
+ },
genderOptions: [
{ value: '男', text: '男' },
{ value: '女', text: '女' }
@@ -438,7 +445,19 @@
affixFiles: [],
loading: false,
signImg: '',
- baseUrl: uni.getStorageSync('baseUrl') || ''
+ baseUrl: config.baseUrl || ''
+ }
+ },
+ computed: {
+ filePickerValue() {
+ if (this.formData.zp) {
+ return [{
+ url: this.getFullImageUrl(this.formData.zp),
+ name: '证件照',
+ size: 0
+ }];
+ }
+ return [];
}
},
onLoad(option) {
@@ -524,6 +543,12 @@
if (this.formData.xsqm) {
this.signImg = this.baseUrl + this.formData.xsqm;
}
+ // 处理证件照回显
+ if (this.formData.zp) {
+ console.log('证件照路径:', this.formData.zp);
+ console.log('baseUrl:', this.baseUrl);
+ console.log('完整URL:', this.getFullImageUrl(this.formData.zp));
+ }
}
}).finally(() => {
this.loading = false
@@ -884,8 +909,8 @@
if (path.startsWith('http://') || path.startsWith('https://')) {
return path;
}
- // 直接从存储中获取最新的baseUrl
- const currentBaseUrl = uni.getStorageSync('baseUrl') || '';
+ // 使用配置文件中的baseUrl
+ const currentBaseUrl = config.baseUrl || '';
console.log('当前baseUrl:', currentBaseUrl);
// 处理baseUrl,确保结尾没有斜杠
const baseUrlClean = currentBaseUrl.replace(/\/$/, '');
@@ -1501,9 +1526,22 @@
cursor: pointer;
}
.sign-disabled {
- opacity: 0.5;
- cursor: not-allowed;
- }
+ opacity: 0.5;
+ cursor: not-allowed;
+ }
+
+ /* 证件照预览容器样式 */
+ .photo-preview-container {
+ margin-top: 20rpx;
+ border-radius: 8rpx;
+ overflow: hidden;
+ }
+
+ .photo-preview-container image {
+ width: 200rpx;
+ height: 200rpx;
+ border-radius: 8rpx;
+ }
.submit-container {
position: fixed;
bottom: 0;
diff --git a/pages/finance/knzzGl/apply.vue b/pages/finance/knzzGl/apply.vue
index 9d941d9..517d6d8 100644
--- a/pages/finance/knzzGl/apply.vue
+++ b/pages/finance/knzzGl/apply.vue
@@ -82,20 +82,28 @@
-
+
+
+
+ 支持上传jpg/png格式照片,单个文件不超过5MB
+
+
+
+
- 支持上传jpg/png格式照片,单个文件不超过5MB
- -->
@@ -289,6 +297,7 @@
import { getOwnSign } from '@/api/workStudy/post';
import { getOwnKnrd, getOwnExtraInfo, getOwnInfo as getOwnStuInfo } from '@/api/finance/special';
import uploadFile from "@/plugins/upload.js"
+ import config from '@/config'
export default {
data() {
return {
@@ -354,7 +363,7 @@
},
affixFiles: [],
signImg: '',
- baseUrl: uni.getStorageSync('baseUrl')
+ baseUrl: config.baseUrl || ''
};
},
onLoad(option) {
@@ -382,6 +391,18 @@
onShow() {
this.calculateFormHeight();
},
+ computed: {
+ filePickerValue() {
+ if (this.formData.pic) {
+ return [{
+ url: this.getFullImageUrl(this.formData.pic),
+ name: '证件照',
+ size: 0
+ }];
+ }
+ return [];
+ }
+ },
methods: {
// 计算表单滚动区域高度
calculateFormHeight() {
@@ -639,6 +660,22 @@
};
});
}
+ // 处理证件照
+ if (this.formData.pic) {
+ // 从文件路径中提取文件名
+ const fileName = this.formData.pic.split('/').pop();
+ // 构造完整的图片URL
+ const fullUrl = this.getFullImageUrl(this.formData.pic);
+ // 更新 photoFiles 数组,使 uni-file-picker 组件能够预览图片
+ this.photoFiles = [{
+ name: fileName,
+ path: this.formData.pic,
+ url: fullUrl
+ }];
+ console.log('处理证件照,formData.pic:', this.formData.pic);
+ console.log('fullUrl:', fullUrl);
+ console.log('photoFiles:', this.photoFiles);
+ }
}).catch(error => {
console.error('获取详情失败:', error);
uni.showToast({
@@ -951,7 +988,18 @@
// 处理证件照上传
handlePhotoUpload(e) {
- const file = e.tempFile;
+ // 检查事件参数格式
+ console.log('handlePhotoUpload 事件参数:', e);
+
+ // 从事件参数中获取文件信息
+ const file = e.tempFiles ? e.tempFiles[0] : e.tempFile;
+ if (!file) {
+ uni.showToast({
+ title: '获取文件信息失败',
+ icon: 'none'
+ });
+ return;
+ }
// 检查文件大小
if (file.size > 5 * 1024 * 1024) {
@@ -974,11 +1022,33 @@
uni.showLoading({ title: '上传中...' });
- uploadFile('/common/upload', file.path).then((res) => {
+ // 获取文件路径
+ const filePath = file.path || file.tempFilePath;
+ if (!filePath) {
+ uni.showToast({
+ title: '获取文件路径失败',
+ icon: 'none'
+ });
+ return;
+ }
+
+ uploadFile('/common/upload', filePath).then((res) => {
uni.hideLoading();
const result = typeof res === 'string' ? JSON.parse(res) : res;
if (result && result.code === 200) {
this.formData.pic = result.fileName || result.savePath;
+ // 构造完整的图片URL
+ const fullUrl = this.getFullImageUrl(this.formData.pic);
+ // 更新 photoFiles 数组,使 uni-file-picker 组件能够预览图片
+ this.photoFiles = [{
+ name: file.name,
+ path: filePath,
+ url: fullUrl
+ }];
+ console.log('上传成功,formData.pic:', this.formData.pic);
+ console.log('fullUrl:', fullUrl);
+ console.log('filePickerValue:', this.filePickerValue);
+ console.log('photoFiles:', this.photoFiles);
uni.showToast({
title: '证件照上传成功',
icon: 'success'
@@ -1006,6 +1076,27 @@
title: '证件照已删除',
icon: 'success'
});
+ },
+ // 获取完整图片URL
+ getFullImageUrl(path) {
+ if (!path) return '';
+ // 调试信息
+ console.log('getFullImageUrl调用,path:', path);
+ // 如果已经是完整URL,则直接返回
+ if (path.startsWith('http://') || path.startsWith('https://')) {
+ return path;
+ }
+ // 使用配置文件中的baseUrl
+ const currentBaseUrl = config.baseUrl || '';
+ console.log('当前baseUrl:', currentBaseUrl);
+ // 处理baseUrl,确保结尾没有斜杠
+ const baseUrlClean = currentBaseUrl.replace(/\/$/, '');
+ // 处理path,确保开头没有斜杠
+ const pathClean = path.replace(/^\//, '');
+ // 拼接URL
+ const fullUrl = `${baseUrlClean}/${pathClean}`;
+ console.log('拼接后的完整URL:', fullUrl);
+ return fullUrl;
}
}
};
@@ -1231,8 +1322,19 @@
}
.example-body {
- margin-top: 10rpx;
- }
+ margin-top: 10rpx;
+ }
+
+ .photo-preview-container {
+ margin-top: 20rpx;
+ border-radius: 8rpx;
+ overflow: hidden;
+ }
+ .photo-preview-container image {
+ width: 200rpx;
+ height: 200rpx;
+ border-radius: 8rpx;
+ }
.sign {
width: 200px;
diff --git a/pages/finance/knzzZsg/apply.vue b/pages/finance/knzzZsg/apply.vue
index bd31dc3..941b3dc 100644
--- a/pages/finance/knzzZsg/apply.vue
+++ b/pages/finance/knzzZsg/apply.vue
@@ -228,15 +228,15 @@
-
-
-
- 重新签名
-
-
- 点击签名
-
+
+
+
+ 重新签名
+
+ 点击签名
+
+
@@ -316,6 +316,7 @@