This commit is contained in:
Lx 2025-04-02 14:02:49 +08:00
parent c262c00cfe
commit 536a1d41a3
2 changed files with 189 additions and 12 deletions

View File

@ -361,7 +361,7 @@
background-color: rgba(255, 255, 255, 1); background-color: rgba(255, 255, 255, 1);
border-radius: 8px; border-radius: 8px;
width: 686rpx; width: 686rpx;
height: 490rpx; height: 590rpx;
margin: 20rpx 0 182rpx 32rpx; margin: 20rpx 0 182rpx 32rpx;
.text_16 { .text_16 {
width: 56rpx; width: 56rpx;
@ -374,10 +374,10 @@
text-align: left; text-align: left;
white-space: nowrap; white-space: nowrap;
line-height: 28rpx; line-height: 28rpx;
margin: 30rpx 0 0 20rpx; margin: 30rpx 0 10rpx 20rpx;
} }
.text_17 { .text_17 {
width: 646rpx; width: 600rpx;
height: 64rpx; height: 64rpx;
overflow-wrap: break-word; overflow-wrap: break-word;
color: rgba(51, 51, 51, 1); 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;
}
}
}
} }

View File

@ -9,6 +9,7 @@
class="label_1" class="label_1"
referrerpolicy="no-referrer" referrerpolicy="no-referrer"
src="/static/lanhu_kaoshijieguo/FigmaDDSSlicePNGacf527a62cbe7351c6472edd8f5b2814.png" src="/static/lanhu_kaoshijieguo/FigmaDDSSlicePNGacf527a62cbe7351c6472edd8f5b2814.png"
@click="handleBack()"
/> />
<text class="text_1">考试结果</text> <text class="text_1">考试结果</text>
@ -68,7 +69,7 @@
<u--input <u--input
placeholder="请输入姓名" placeholder="请输入姓名"
border="none" border="none"
v-model="process.name" v-model="process.userName"
maxlength="3" maxlength="3"
inputAlign="right" inputAlign="right"
></u--input> ></u--input>
@ -99,12 +100,18 @@
</view> </view>
<view class="group_5 flex-col"> <view class="group_5 flex-col">
<text class="text_16">备注</text> <text class="text_16">备注</text>
<text class="text_17"> <u--textarea class="text_17" v-model="process.remark" placeholder="请输入内容" count ></u--textarea>
备注信息备注信息备注信息备注信息备注信息备注信息备注信息备注信息备注信息备注信息
</text>
<text class="text_18">图片</text> <text class="text_18">图片</text>
<view class="image-wrapper_4 flex-row justify-between"> <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" class="image_3"
referrerpolicy="no-referrer" referrerpolicy="no-referrer"
src="/static/lanhu_kaoshijieguo/FigmaDDSSlicePNG531b2664a25a7d42a43f00faa060acb1.png" src="/static/lanhu_kaoshijieguo/FigmaDDSSlicePNG531b2664a25a7d42a43f00faa060acb1.png"
@ -113,12 +120,20 @@
class="image_4" class="image_4"
referrerpolicy="no-referrer" referrerpolicy="no-referrer"
src="/static/lanhu_kaoshijieguo/FigmaDDSSlicePNG66b1c863f069a58fb4ff203ed443e5ad.png" src="/static/lanhu_kaoshijieguo/FigmaDDSSlicePNG66b1c863f069a58fb4ff203ed443e5ad.png"
/> /> -->
</view> </view>
</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> </view>
</template> </template>
<script> <script>
import upload from '@/utils/upload.js'
import request from '@/utils/request.js'
import { getLocalUserInfo } from '../../utils/auth';
export default { export default {
data() { data() {
return { return {
@ -129,23 +144,57 @@ export default {
subjectColumns: [['科目一', '科目四' ]], subjectColumns: [['科目一', '科目四' ]],
selectedValue: '', selectedValue: '',
subjectValue: '', subjectValue: '',
fileList: [],
imageUrl: this.$imagesUrl,
userInfo: [],
process: { process: {
name: null, userName: null,
userId: null, userId: null,
subject:null, subject:null,
courseType: null, courseType: null,
examNum: null, examNum: null,
examStatus: null, examStatus: null,
examScore: null, examScore: null,
remark: null, remark: '',
examTime: null, examTime: null,
images: null, images: null,
tenantId: null,
}, },
constants: {} 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: { methods: {
handleBack() {
uni.navigateBack({
delta: 1
});
},
ifPassOnConfirm(value) { ifPassOnConfirm(value) {
console.log('选中的值:', value); console.log('选中的值:', value);
@ -197,7 +246,109 @@ export default {
const minutes = String(date.getMinutes()).padStart(2, '0'); const minutes = String(date.getMinutes()).padStart(2, '0');
return `${year}-${month}-${day} ${hours}:${minutes}`; 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' });
}
})
}
} }
}; };