学生资助-修复图片文件预览问题
This commit is contained in:
@@ -228,15 +228,15 @@
|
||||
<textarea v-model="formData.applyReasonExtra" placeholder="请详细描述申请理由" class="form-textarea" rows="4" :disabled="detailMode"></textarea>
|
||||
</view>
|
||||
<view class="form-item">
|
||||
<label class="form-label"><span class="red-tip">*</span>申请人签名</label>
|
||||
<view class="sign-img" v-if="signImg">
|
||||
<image :src="signImg" mode="aspectFit" style="width: 200px; height: 50px; cursor: pointer;"></image>
|
||||
<text @tap="signToggle" class="re-sign-text">重新签名</text>
|
||||
</view>
|
||||
<view v-else class="sign" @tap="signToggle" :class="{ 'sign-disabled': detailMode }">
|
||||
点击签名
|
||||
</view>
|
||||
<label class="form-label"><span class="red-tip">*</span>申请人签名</label>
|
||||
<view class="sign-img" v-if="signImg">
|
||||
<image :src="signImg" mode="aspectFit" style="width: 200px; height: 50px; cursor: pointer;" @tap="previewSign"></image>
|
||||
<text @tap="signToggle" class="re-sign-text" v-if="!detailMode">重新签名</text>
|
||||
</view>
|
||||
<view v-else class="sign" @tap="signToggle" :class="{ 'sign-disabled': detailMode }">
|
||||
点击签名
|
||||
</view>
|
||||
</view>
|
||||
<view class="form-item">
|
||||
<label class="form-label"><span class="red-tip">*</span>中职毕业证</label>
|
||||
<view class="upload-btn" @click="handleDiplomaUpload" :class="{ 'upload-disabled': detailMode }">
|
||||
@@ -316,6 +316,7 @@
|
||||
<script>
|
||||
import { add, update, reApply, getOwnSign, getOwnFamily, getStudentInfo, getExtraInfo } from '@/api/finance/knzzZsg';
|
||||
import uploadFile from "@/plugins/upload.js"
|
||||
import config from '@/config'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
@@ -324,7 +325,7 @@ export default {
|
||||
detailMode: false,
|
||||
formScrollHeight: '',
|
||||
signImg: '',
|
||||
baseUrl: uni.getStorageSync('baseUrl'),
|
||||
baseUrl: config.baseUrl || '',
|
||||
diplomaFiles: [],
|
||||
diplomaAffixId: '',
|
||||
genderOptions: [
|
||||
@@ -575,9 +576,12 @@ export default {
|
||||
this.formData.applyReasonExtra = item.applyExtraReason || '';
|
||||
|
||||
// 签名和文件信息
|
||||
this.formData.applySign = item.applySign || '';
|
||||
this.formData.diplomaFile = item.diplomaCertificate || '';
|
||||
this.signImg = item.applySign || '';
|
||||
this.formData.applySign = item.applySign || '';
|
||||
this.formData.diplomaFile = item.diplomaCertificate || '';
|
||||
// 构造完整的签名图片URL
|
||||
this.signImg = item.applySign ? this.getFullImageUrl(item.applySign) : '';
|
||||
console.log('处理签名图片,item.applySign:', item.applySign);
|
||||
console.log('signImg:', this.signImg);
|
||||
|
||||
// 审核意见
|
||||
this.formData.fdyCmt = item.fdyCmt || '';
|
||||
@@ -806,9 +810,38 @@ export default {
|
||||
uploadFile('/common/upload', e).then((res) => {
|
||||
const data = JSON.parse(res);
|
||||
this.formData.applySign = data.fileName;
|
||||
this.signImg = data.url || (this.baseUrl + data.fileName);
|
||||
this.signImg = data.url || this.getFullImageUrl(data.fileName);
|
||||
})
|
||||
},
|
||||
// 获取完整图片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;
|
||||
},
|
||||
// 预览签名图片
|
||||
previewSign() {
|
||||
if (this.signImg) {
|
||||
uni.previewImage({
|
||||
urls: [this.signImg]
|
||||
});
|
||||
}
|
||||
},
|
||||
// 处理中职毕业证上传
|
||||
handleDiplomaUpload() {
|
||||
if (this.detailMode) {
|
||||
|
||||
Reference in New Issue
Block a user