0402
This commit is contained in:
parent
c262c00cfe
commit
536a1d41a3
@ -361,7 +361,7 @@
|
||||
background-color: rgba(255, 255, 255, 1);
|
||||
border-radius: 8px;
|
||||
width: 686rpx;
|
||||
height: 490rpx;
|
||||
height: 590rpx;
|
||||
margin: 20rpx 0 182rpx 32rpx;
|
||||
.text_16 {
|
||||
width: 56rpx;
|
||||
@ -374,10 +374,10 @@
|
||||
text-align: left;
|
||||
white-space: nowrap;
|
||||
line-height: 28rpx;
|
||||
margin: 30rpx 0 0 20rpx;
|
||||
margin: 30rpx 0 10rpx 20rpx;
|
||||
}
|
||||
.text_17 {
|
||||
width: 646rpx;
|
||||
width: 600rpx;
|
||||
height: 64rpx;
|
||||
overflow-wrap: break-word;
|
||||
color: rgba(51, 51, 51, 1);
|
||||
@ -414,4 +414,30 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
.block_8 {
|
||||
background-color: rgba(255, 255, 255, 1);
|
||||
height: 120rpx;
|
||||
margin-top: -2rpx;
|
||||
width: 750rpx;
|
||||
.text-wrapper_8 {
|
||||
background-color: rgba(4, 78, 242, 1);
|
||||
border-radius: 20px;
|
||||
height: 80rpx;
|
||||
width: 686rpx;
|
||||
margin: 20rpx 0 0 32rpx;
|
||||
.text_19 {
|
||||
width: 192rpx;
|
||||
height: 32rpx;
|
||||
overflow-wrap: break-word;
|
||||
color: rgba(255, 255, 255, 1);
|
||||
font-size: 32rpx;
|
||||
font-family: PingFang SC-Semibold;
|
||||
font-weight: 600;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
line-height: 32rpx;
|
||||
margin: 24rpx 0 0 254rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,7 @@
|
||||
class="label_1"
|
||||
referrerpolicy="no-referrer"
|
||||
src="/static/lanhu_kaoshijieguo/FigmaDDSSlicePNGacf527a62cbe7351c6472edd8f5b2814.png"
|
||||
@click="handleBack()"
|
||||
/>
|
||||
<text class="text_1">考试结果</text>
|
||||
|
||||
@ -68,7 +69,7 @@
|
||||
<u--input
|
||||
placeholder="请输入姓名"
|
||||
border="none"
|
||||
v-model="process.name"
|
||||
v-model="process.userName"
|
||||
maxlength="3"
|
||||
inputAlign="right"
|
||||
>分</u--input>
|
||||
@ -99,12 +100,18 @@
|
||||
</view>
|
||||
<view class="group_5 flex-col">
|
||||
<text class="text_16">备注</text>
|
||||
<text class="text_17">
|
||||
备注信息备注信息备注信息备注信息备注信息备注信息备注信息备注信息备注信息备注信息
|
||||
</text>
|
||||
<u--textarea class="text_17" v-model="process.remark" placeholder="请输入内容" count ></u--textarea>
|
||||
<text class="text_18">图片</text>
|
||||
<view class="image-wrapper_4 flex-row justify-between">
|
||||
<image
|
||||
<u-upload
|
||||
|
||||
:fileList="displayFileList"
|
||||
@afterRead="afterRead"
|
||||
@delete="deletePic"
|
||||
multiple
|
||||
:maxCount="2"
|
||||
></u-upload>
|
||||
<!-- <image
|
||||
class="image_3"
|
||||
referrerpolicy="no-referrer"
|
||||
src="/static/lanhu_kaoshijieguo/FigmaDDSSlicePNG531b2664a25a7d42a43f00faa060acb1.png"
|
||||
@ -113,12 +120,20 @@
|
||||
class="image_4"
|
||||
referrerpolicy="no-referrer"
|
||||
src="/static/lanhu_kaoshijieguo/FigmaDDSSlicePNG66b1c863f069a58fb4ff203ed443e5ad.png"
|
||||
/>
|
||||
/> -->
|
||||
</view>
|
||||
</view>
|
||||
<view class="block_8 flex-col">
|
||||
<view class="text-wrapper_8 flex-col" @click="saveData()">
|
||||
<text class="text_19">确定</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import upload from '@/utils/upload.js'
|
||||
import request from '@/utils/request.js'
|
||||
import { getLocalUserInfo } from '../../utils/auth';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@ -129,23 +144,57 @@ export default {
|
||||
subjectColumns: [['科目一', '科目四' ]],
|
||||
selectedValue: '',
|
||||
subjectValue: '',
|
||||
fileList: [],
|
||||
imageUrl: this.$imagesUrl,
|
||||
userInfo: [],
|
||||
process: {
|
||||
name: null,
|
||||
userName: null,
|
||||
userId: null,
|
||||
subject:null,
|
||||
courseType: null,
|
||||
examNum: null,
|
||||
examStatus: null,
|
||||
examScore: null,
|
||||
remark: null,
|
||||
remark: '',
|
||||
examTime: null,
|
||||
images: null,
|
||||
tenantId: null,
|
||||
|
||||
},
|
||||
constants: {}
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
this.userInfo = getLocalUserInfo()
|
||||
this.getUserOrderDetails()
|
||||
},
|
||||
computed: {
|
||||
displayFileList() {
|
||||
return this.fileList.map(item => {
|
||||
// 如果 url 已经是完整路径(http/https),直接使用
|
||||
if (item.url.startsWith('http')) {
|
||||
return item;
|
||||
}
|
||||
|
||||
// 否则拼接全局前缀(注意处理路径分隔符)
|
||||
const prefix = this.$imagesUrl.endsWith('/') ? this.$imagesUrl : `${this.$imagesUrl}/`;
|
||||
const fullUrl = item.url.startsWith('/')
|
||||
? `${prefix}${item.url.slice(1)}` // 避免双斜杠(如 https://domain.com//path)
|
||||
: `${prefix}${item.url}`; // 直接拼接(如 https://domain.com/path)
|
||||
|
||||
return {
|
||||
...item,
|
||||
url: fullUrl,
|
||||
};
|
||||
});
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
handleBack() {
|
||||
uni.navigateBack({
|
||||
delta: 1
|
||||
});
|
||||
},
|
||||
ifPassOnConfirm(value) {
|
||||
console.log('选中的值:', value);
|
||||
|
||||
@ -198,6 +247,108 @@ export default {
|
||||
return `${year}-${month}-${day} ${hours}:${minutes}`;
|
||||
},
|
||||
|
||||
// 删除图片
|
||||
/* deletePic(event) {
|
||||
this[`fileList${event.name}`].splice(event.index, 1)
|
||||
if (event.name == '1') {
|
||||
this.photoUrl.splice(event.index, 1)
|
||||
}
|
||||
if (event.name == '2') {
|
||||
this.videoUr = null
|
||||
}
|
||||
|
||||
}, */
|
||||
deletePic(event) {
|
||||
this.fileList.splice(event.index, 1); // 直接操作唯一的 fileList
|
||||
},
|
||||
// 新增图片
|
||||
async afterRead(event) {
|
||||
let lists = [].concat(event.file); // 兼容单个和多个文件
|
||||
let fileListLen = this.fileList.length;
|
||||
|
||||
for (let i = 0; i < lists.length; i++) {
|
||||
try {
|
||||
const resultUrl = await this.uploadFilePromise(lists[i].url); // 上传图片并获取 URL
|
||||
let item = {
|
||||
status: 'success',
|
||||
url: resultUrl, // 服务器返回的 URL
|
||||
};
|
||||
this.fileList.splice(fileListLen, 0, item);
|
||||
fileListLen++;
|
||||
} catch (error) {
|
||||
console.error('图片上传失败', error);
|
||||
}
|
||||
}
|
||||
},
|
||||
uploadFilePromise(filePath) {
|
||||
console.log('图片地址', filePath)
|
||||
return new Promise((resolve, reject) => {
|
||||
upload({
|
||||
url: '/app-api/small-upload/common/upload',
|
||||
filePath: filePath,
|
||||
}).then((res) => {
|
||||
if (res.data && res.data.url) {
|
||||
resolve(res.data.url); // 返回图片 URL
|
||||
console.log('返回', res)
|
||||
console.log('返回url', res.data.url)
|
||||
} else {
|
||||
reject(new Error('上传失败'));
|
||||
}
|
||||
}).catch(err => reject(err));
|
||||
});
|
||||
},
|
||||
|
||||
getUserOrderDetails() {
|
||||
request({
|
||||
url: '/app-api/small/drive/school-course-order/page',
|
||||
method: 'GET',
|
||||
params: {
|
||||
userId: this.userId,
|
||||
paymentStatus:'2',
|
||||
ifEnd: 0,
|
||||
},
|
||||
tenantIdFlag : false
|
||||
}).then(res => {
|
||||
this.orderList = res.data.records;
|
||||
console.log('订单信息',res.data)
|
||||
|
||||
});
|
||||
},
|
||||
|
||||
saveData() {
|
||||
this.process.userId = this.userInfo.id
|
||||
this.process.tenantId = this.userInfo.tenantId
|
||||
// 1. 拼接图片 URL
|
||||
this.process.images = this.fileList?.map(item => item.url).join(',') || '';
|
||||
console.log('process', this.process)
|
||||
|
||||
// 2. 校验必填字段(可选)
|
||||
if (!this.process.userId || !this.process.subject) {
|
||||
uni.showToast({ title: '用户ID和科目不能为空', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
|
||||
request({
|
||||
url: '/app-api/process/updateProcess',
|
||||
method: 'PUT',
|
||||
data: this.process,
|
||||
}).then(res => {
|
||||
if(res.code === 0){
|
||||
uni.showToast({
|
||||
title: '保存成功',
|
||||
icon: 'success',
|
||||
duration: 1000
|
||||
});
|
||||
setTimeout(() => {
|
||||
uni.navigateTo({
|
||||
url: '/newPages/examinationList/index'
|
||||
});
|
||||
}, 1500);
|
||||
}else{
|
||||
uni.showToast({ title: res.data?.message || '保存失败', icon: 'none' });
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user