0409
This commit is contained in:
parent
58c3b759bf
commit
074afe19fa
@ -20,8 +20,7 @@
|
||||
<view class="text-group_1 flex-col justify-between">
|
||||
<text class="text_3">{{ item.tittle }}</text>
|
||||
<view class="text-wrapper_1 flex-row justify-between">
|
||||
<text class="text_4">¥{{ item.price - item.favour }}</text>
|
||||
<text class="text_5">¥{{ item.price }}</text>
|
||||
<text class="text_4">¥{{ item.price }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="text-wrapper_3 flex-col">
|
||||
@ -107,6 +106,7 @@ export default {
|
||||
url: `/newPages/courseDetail/index?courseId=${courseId}&tenantId=${this.tenantId}`,
|
||||
});
|
||||
},
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
@ -348,7 +348,7 @@ export default {
|
||||
if (item.fraction == null ) {
|
||||
return { text: '成绩录入', type: 'input' }
|
||||
} else if (!item.ifPass) {
|
||||
return { text: '考试未通过', type: 'failed' }
|
||||
return { text: '成绩录入', type: 'input' }
|
||||
} else if (item.ifEvaluate) {
|
||||
return { text: '查看评价', type: 'view' }
|
||||
} else {
|
||||
|
@ -117,6 +117,7 @@
|
||||
.label_2 {
|
||||
width: 70rpx;
|
||||
height: 70rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
.text-wrapper_1 {
|
||||
@ -137,7 +138,7 @@
|
||||
line-height: 28rpx;
|
||||
}
|
||||
.text_4 {
|
||||
width: 112rpx;
|
||||
width: 198rpx;
|
||||
height: 28rpx;
|
||||
overflow-wrap: break-word;
|
||||
color: rgba(51, 51, 51, 1);
|
||||
@ -170,7 +171,7 @@
|
||||
width: 198rpx;
|
||||
height: 28rpx;
|
||||
overflow-wrap: break-word;
|
||||
color: rgba(51, 51, 51, 1);
|
||||
color: rgba(113, 113, 113, 1.0);
|
||||
font-size: 28rpx;
|
||||
font-family: PingFang SC-Regular;
|
||||
font-weight: NaN;
|
||||
@ -208,9 +209,12 @@
|
||||
width: 646rpx;
|
||||
height: 196rpx;
|
||||
margin: 30rpx 0 30rpx 20rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
.image_3 {
|
||||
width: 312rpx;
|
||||
width: 300rpx;
|
||||
height: 196rpx;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
.image_4 {
|
||||
width: 312rpx;
|
||||
@ -241,7 +245,6 @@
|
||||
.list_1 {
|
||||
width: 700rpx;
|
||||
height: 160rpx;
|
||||
justify-content: space-between;
|
||||
margin: 30rpx 0 30rpx 20rpx;
|
||||
.list-items_1 {
|
||||
height: 160rpx;
|
||||
|
@ -1,18 +1,6 @@
|
||||
<template>
|
||||
<view class="page flex-col">
|
||||
<view class="block_1 flex-row">
|
||||
<image
|
||||
class="image_1"
|
||||
referrerpolicy="no-referrer"
|
||||
src="/static/lanhu_gerenxinxi/FigmaDDSSlicePNG5472ef46deab947fe098747eb1b07bd2.png"
|
||||
/>
|
||||
<view class="section_1 flex-col"></view>
|
||||
<view class="section_2 flex-col"></view>
|
||||
<image
|
||||
class="image_2"
|
||||
referrerpolicy="no-referrer"
|
||||
src="/static/lanhu_gerenxinxi/FigmaDDSSlicePNGb239db97c719ec7467ee7c9615d3d24a.png"
|
||||
/>
|
||||
</view>
|
||||
<view class="block_2 flex-col">
|
||||
<view class="group_1 flex-row">
|
||||
@ -20,88 +8,151 @@
|
||||
class="label_1"
|
||||
referrerpolicy="no-referrer"
|
||||
src="/static/lanhu_gerenxinxi/FigmaDDSSlicePNGacf527a62cbe7351c6472edd8f5b2814.png"
|
||||
@click="handleBack()"
|
||||
/>
|
||||
<text class="text_1">个人信息</text>
|
||||
<view class="box_1 flex-col">
|
||||
<view class="image-wrapper_1 flex-row">
|
||||
<image
|
||||
class="thumbnail_1"
|
||||
referrerpolicy="no-referrer"
|
||||
src="/static/lanhu_gerenxinxi/FigmaDDSSlicePNGdc9929c2b5fd86c1689cc5990a0b4397.png"
|
||||
/>
|
||||
</view>
|
||||
<view class="block_3 flex-row justify-between">
|
||||
<view class="group_2 flex-col"></view>
|
||||
<view class="group_3 flex-col"></view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="group_4 flex-col">
|
||||
<view class="block_4 flex-row justify-between">
|
||||
<text class="text_2">头像</text>
|
||||
<image
|
||||
<view class="label_2">
|
||||
<u-upload
|
||||
:fileList="avatarList"
|
||||
@afterRead="avatarAfterRead"
|
||||
@delete="avatarDelete"
|
||||
:maxCount="1"
|
||||
width="70rpx"
|
||||
height="70rpx"
|
||||
border-radius="50%"
|
||||
>
|
||||
<!-- <image
|
||||
class="label_2"
|
||||
referrerpolicy="no-referrer"
|
||||
src="/static/lanhu_gerenxinxi/FigmaDDSSlicePNGcc6ee579083c2c921f6c93c250df5d44.png"
|
||||
:src="(item ? imageUrl + '/' + userDetails.avatar : '/static/lanhu_gerenxinxiweitianxie/FigmaDDSSlicePNG6ea89e46a56641bc7e118ef1d4d789d5.png')"
|
||||
/> -->
|
||||
|
||||
<image
|
||||
class="label_2"
|
||||
:src="avatarList[0] ? avatarList[0].url : '/static/lanhu_gerenxinxiweitianxie/FigmaDDSSlicePNG6ea89e46a56641bc7e118ef1d4d789d5.png'"
|
||||
/>
|
||||
</u-upload>
|
||||
</view>
|
||||
</view>
|
||||
<!-- src="/static/lanhu_gerenxinxi/FigmaDDSSlicePNGcc6ee579083c2c921f6c93c250df5d44.png" -->
|
||||
<view class="text-wrapper_1 flex-row justify-between">
|
||||
<text class="text_3">昵称</text>
|
||||
<text class="text_4">千舟寻渡</text>
|
||||
<input class="text_4" v-model="userDetails.name" type="text" placeholder="请填写昵称">
|
||||
</view>
|
||||
<view class="text-wrapper_2 flex-row justify-between">
|
||||
<text class="text_5">联系方式</text>
|
||||
<text class="text_6">166 8888 6666</text>
|
||||
<text class="text_6" >{{ userDetails.phone }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="group_5 flex-col">
|
||||
<view class="group_5 flex-col" v-if="noN">
|
||||
<view class="text-wrapper_3 flex-row">
|
||||
<text class="text_7">身份证照片</text>
|
||||
</view>
|
||||
<view class="image-wrapper_2 flex-row justify-between">
|
||||
<u-upload
|
||||
:fileList="idCardfileList"
|
||||
@afterRead="idCardAfterRead"
|
||||
@delete="idCardDelete"
|
||||
:maxCount="2"
|
||||
width="300rpx"
|
||||
height="196rpx"
|
||||
margin-right="10rpx"
|
||||
:previewFullImage="true"
|
||||
>
|
||||
<!-- <view v-if="idCardList.length > 0" class="flex-row">
|
||||
<image
|
||||
v-for="(item, index) in idCardList"
|
||||
:key="index"
|
||||
class="image_3"
|
||||
:style="{ marginRight: index === 0 ? '20rpx' : '0' }"
|
||||
:src="imageUrl + '/' + item"
|
||||
referrerpolicy="no-referrer"
|
||||
src="/static/lanhu_gerenxinxi/FigmaDDSSlicePNGf4315b7a8c2a646d315744186cd274fd.png"
|
||||
/>
|
||||
</view>
|
||||
<image
|
||||
class="image_4"
|
||||
v-else
|
||||
class="image_3"
|
||||
src="/static/lanhu_gerenxinxiweitianxie/FigmaDDSSlicePNG613ddce187a71bcc667c56c84cd2d022.png"
|
||||
referrerpolicy="no-referrer"
|
||||
src="/static/lanhu_gerenxinxi/FigmaDDSSlicePNG9cc25f833e523a66521975aa9828e644.png"
|
||||
/>
|
||||
/> -->
|
||||
</u-upload>
|
||||
|
||||
|
||||
</view>
|
||||
</view>
|
||||
<view class="group_6 flex-col">
|
||||
<view class="group_6 flex-col" v-if="noN">
|
||||
<text class="text_8">生活照片</text>
|
||||
<view class="list_1 flex-row">
|
||||
<u-upload
|
||||
:fileList="lifePhotoFileList"
|
||||
@afterRead="lifePhotoAfterRead"
|
||||
@delete="lifePhotoDelete"
|
||||
:maxCount="3"
|
||||
:previewFullImage="true"
|
||||
>
|
||||
<!-- <view class="flex-row">
|
||||
<view
|
||||
class="list-items_1 flex-col"
|
||||
:style="{ background: item.lanhuBg0 }"
|
||||
v-for="(item, index) in loopData0"
|
||||
v-for="(item, index) in lifePhotoList"
|
||||
:key="index"
|
||||
>
|
||||
<view class="image-wrapper_3 flex-col">
|
||||
<image
|
||||
class="thumbnail_2"
|
||||
class="list-items_1"
|
||||
referrerpolicy="no-referrer"
|
||||
:src="item.lanhuimage0"
|
||||
:src="imageUrl + '/' + item"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<image
|
||||
v-if="lifePhotoList.length === 0"
|
||||
class="list-items_1"
|
||||
referrerpolicy="no-referrer"
|
||||
src="/static/lanhu_gerenxinxiweitianxie/FigmaDDSSlicePNG6ea89e46a56641bc7e118ef1d4d789d5.png"
|
||||
/>
|
||||
</view> -->
|
||||
</u-upload>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="block_5 flex-col">
|
||||
<view class="text-wrapper_4 flex-col">
|
||||
<view class="text-wrapper_4 flex-col" @click="handleSave">
|
||||
<text class="text_9">保存</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 {
|
||||
usersMsg: {},
|
||||
userId: null,
|
||||
constants: {},
|
||||
avatarList: [],
|
||||
idCardfileList: [],
|
||||
// idCardList: [],
|
||||
// lifePhotoList: [],
|
||||
lifePhotoFileList: [],
|
||||
imageUrl: this.$imagesUrl,
|
||||
userDetails: {
|
||||
userId: null,
|
||||
avatar: '',
|
||||
name: null,
|
||||
phone: null,
|
||||
idCardImg: '',
|
||||
lifeImg: '',
|
||||
},
|
||||
noN:true,
|
||||
|
||||
loopData0: [
|
||||
{
|
||||
lanhuBg0:
|
||||
@ -131,7 +182,293 @@ export default {
|
||||
constants: {}
|
||||
};
|
||||
},
|
||||
methods: {}
|
||||
onLoad(option) {
|
||||
this.usersMsg = getLocalUserInfo()
|
||||
this.userId = option.userId;
|
||||
this.userDetails.userId = option.userId;
|
||||
console.log('option', option)
|
||||
console.log('userId', this.userId)
|
||||
this.getUserInfo()
|
||||
},
|
||||
methods: {
|
||||
handleBack() {
|
||||
uni.navigateBack({
|
||||
delta: 1
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
/* getUserInfo() {
|
||||
request({
|
||||
url: '/app-api/small/dl-drive-school-student/getByUserId',
|
||||
method: 'GET',
|
||||
params: { userId: this.userId }
|
||||
}).then(res => {
|
||||
if(!res.data){
|
||||
this.noN = false
|
||||
this.userDetails.name = this.usersMsg.nickname
|
||||
this.userDetails.phone = this.usersMsg.username
|
||||
this.userDetails.avatar = this.usersMsg.avatar
|
||||
console.log('userDetails',this.userDetails)
|
||||
if (this.usersMsg.avatar) {
|
||||
this.avatarList = [{
|
||||
url: `${this.imageUrl}/${this.usersMsg.avatar}`,
|
||||
fileName: this.usersMsg.avatar
|
||||
}]
|
||||
}
|
||||
return
|
||||
}
|
||||
this.userDetails = { ...res.data }
|
||||
console.log('userDetailsRes', res)
|
||||
console.log('userDetails',this.userDetails)
|
||||
|
||||
// 初始化头像
|
||||
if (res.data.avatar) {
|
||||
this.avatarList = [{
|
||||
url: `${this.imageUrl}/${res.data.avatar}`,
|
||||
fileName: res.data.avatar
|
||||
}]
|
||||
}
|
||||
|
||||
// 初始化身份证照片
|
||||
this.idCardfileList = res.data.idPhoto
|
||||
? res.data.idPhoto.split(',')
|
||||
.filter(url => url.trim())
|
||||
.map(url => ({
|
||||
url: `${this.imageUrl}/${url.trim()}`,
|
||||
fileName: url.trim()
|
||||
}))
|
||||
: []
|
||||
|
||||
// 初始化生活照
|
||||
this.lifePhotoFileList = res.data.lifePhoto
|
||||
? res.data.lifePhoto.split(',')
|
||||
.filter(url => url.trim())
|
||||
.map(url => ({
|
||||
url: `${this.imageUrl}/${url.trim()}`,
|
||||
fileName: url.trim()
|
||||
}))
|
||||
: []
|
||||
})
|
||||
}, */
|
||||
getUserInfo() {
|
||||
console.log('123',this.userId)
|
||||
request({
|
||||
url: '/app-api/small/dl-drive-school-student/getByUserId',
|
||||
method: 'GET',
|
||||
params: { userId: this.userId }
|
||||
}).then(res => {
|
||||
if (!res.data) {
|
||||
console.log('1')
|
||||
this.noN = false;
|
||||
this.userDetails = {
|
||||
name: this.usersMsg.nickname,
|
||||
phone: this.usersMsg.username,
|
||||
avatar: this.usersMsg.avatar
|
||||
};
|
||||
// 头像初始化
|
||||
if (this.usersMsg.avatar) {
|
||||
this.avatarList = [{
|
||||
url: `${this.imageUrl}/${this.usersMsg.avatar}`,
|
||||
fileName: this.usersMsg.avatar,
|
||||
status: 'success',
|
||||
response: { url: this.usersMsg.avatar }
|
||||
}];
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
this.userDetails = { ...res.data };
|
||||
|
||||
// 头像初始化
|
||||
if (res.data.avatar) {
|
||||
this.avatarList = [{
|
||||
url: `${this.imageUrl}/${res.data.avatar}`,
|
||||
fileName: res.data.avatar,
|
||||
status: 'success',
|
||||
response: { url: res.data.avatar }
|
||||
}];
|
||||
}
|
||||
|
||||
// 身份证照片初始化
|
||||
this.idCardfileList = res.data.idPhoto
|
||||
? res.data.idPhoto.split(',')
|
||||
.filter(url => url.trim())
|
||||
.map(url => ({
|
||||
url: `${this.imageUrl}/${url.trim()}`,
|
||||
fileName: url.trim(),
|
||||
status: 'success',
|
||||
response: { url:`${this.imageUrl}/${url.trim()}` }
|
||||
}))
|
||||
: [];
|
||||
|
||||
// 生活照初始化
|
||||
this.lifePhotoFileList = res.data.lifePhoto
|
||||
? res.data.lifePhoto.split(',')
|
||||
.filter(url => url.trim())
|
||||
.map(url => ({
|
||||
url: `${this.imageUrl}/${url.trim()}`,
|
||||
fileName: url.trim(),
|
||||
status: 'success',
|
||||
response: { url: `${this.imageUrl}/${url.trim()}` }
|
||||
}))
|
||||
: [];
|
||||
});
|
||||
},
|
||||
|
||||
// 头像上传
|
||||
avatarAfterRead(event) {
|
||||
const file = event.file[0] || event.file
|
||||
this.uploadFile(file, 'avatar').then(res => {
|
||||
this.avatarList = [{
|
||||
url: `${this.imageUrl}/${res.data.url}`,
|
||||
fileName: res.data.url
|
||||
}]
|
||||
this.userDetails.avatar = res.data.url
|
||||
})
|
||||
},
|
||||
// 头像删除
|
||||
avatarDelete() {
|
||||
this.avatarList = []
|
||||
this.userDetails.avatar = ''
|
||||
},
|
||||
|
||||
// 身份证照片上传
|
||||
idCardAfterRead(event) {
|
||||
const files = Array.isArray(event.file) ? event.file : [event.file]
|
||||
if (this.idCardfileList.length + files.length > 2) {
|
||||
uni.showToast({ title: '最多上传2张身份证照片', icon: 'none' })
|
||||
return
|
||||
}
|
||||
|
||||
Promise.all(
|
||||
files.map(file =>
|
||||
this.uploadFile(file, 'idCard').then(res => ({
|
||||
url: `${this.imageUrl}/${res.data.url}`,
|
||||
fileName: res.data.url
|
||||
}))
|
||||
)
|
||||
).then(newFiles => {
|
||||
this.idCardfileList = [...this.idCardfileList, ...newFiles];
|
||||
console.log('idCardFileListAdd', this.idCardfileList)
|
||||
});
|
||||
},
|
||||
|
||||
// 身份证照片删除
|
||||
idCardDelete(event) {
|
||||
this.idCardfileList.splice(event.index, 1)
|
||||
console.log('idCardFileListDel', this.idCardfileList)
|
||||
},
|
||||
|
||||
|
||||
// 生活照上传
|
||||
lifePhotoAfterRead(event) {
|
||||
const files = Array.isArray(event.file) ? event.file : [event.file]
|
||||
if (this.lifePhotoFileList.length + files.length > 3) {
|
||||
uni.showToast({ title: '最多上传3张生活照片', icon: 'none' })
|
||||
return
|
||||
}
|
||||
|
||||
Promise.all(files.map(file =>
|
||||
this.uploadFile(file, 'lifePhoto').then(res => ({
|
||||
url: `${this.imageUrl}/${res.data.url}`,
|
||||
fileName: res.data.url
|
||||
}))
|
||||
)).then(newFiles => {
|
||||
this.lifePhotoFileList = [...this.lifePhotoFileList, ...newFiles]
|
||||
})
|
||||
},
|
||||
// 生活照删除
|
||||
lifePhotoDelete(event) {
|
||||
this.lifePhotoFileList.splice(event.index, 1)
|
||||
},
|
||||
|
||||
// 上传
|
||||
uploadFile(file, type) {
|
||||
return new Promise((resolve, reject) => {
|
||||
upload({
|
||||
url: '/app-api/small-upload/common/upload',
|
||||
filePath: file.url || file.path,
|
||||
name: 'file',
|
||||
formData: { type }
|
||||
}).then(resolve).catch(reject)
|
||||
})
|
||||
},
|
||||
|
||||
getUserOrder(){
|
||||
request({
|
||||
url: '/app-api/small/drive/school-course-order/getCourseByLoginUser',
|
||||
method: 'GET',
|
||||
}).then(res => {
|
||||
console.log('111',res.data)
|
||||
if(res.data === null){
|
||||
// this.insertSchoolStudent()
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
insertSchoolStudent() {
|
||||
request({
|
||||
url: '/app-api/small/dl-drive-school-student/create',
|
||||
method: 'POST',
|
||||
data: this.userDetails
|
||||
})
|
||||
this.updateSysUsersNickName()
|
||||
},
|
||||
updateSysUsersNickName(name, userId,avatar) {
|
||||
console.log(name)
|
||||
console.log(userId)
|
||||
console.log(avatar)
|
||||
request({
|
||||
url: '/app-api/system/user/update',
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
data: {
|
||||
nickname: name,
|
||||
id: userId,
|
||||
avatar: avatar,
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
handleSave() {
|
||||
if(!this.noN){
|
||||
const submitData = {
|
||||
...this.userDetails,
|
||||
avatar: this.avatarList[0]?.fileName || '',
|
||||
idPhoto: this.idCardfileList.map(item => item.fileName).join(','),
|
||||
lifePhoto: this.lifePhotoFileList.map(item => item.fileName).join(',')
|
||||
}
|
||||
this.updateSysUsersNickName(submitData.name, submitData.userId, submitData.avatar)
|
||||
return
|
||||
}
|
||||
// 准备提交数据(只使用fileName)
|
||||
const submitData = {
|
||||
...this.userDetails,
|
||||
avatar: this.avatarList[0]?.fileName || '',
|
||||
idPhoto: this.idCardfileList.map(item => item.fileName).join(','),
|
||||
lifePhoto: this.lifePhotoFileList.map(item => item.fileName).join(',')
|
||||
}
|
||||
console.log('submitData2', submitData)
|
||||
this.updateSysUsersNickName(submitData.name, submitData.userId, submitData.avatar)
|
||||
|
||||
request({
|
||||
url: '/app-api/small/dl-drive-school-student/update',
|
||||
method: 'PUT',
|
||||
data: submitData
|
||||
}).then(() => {
|
||||
uni.showToast({ title: '保存成功', icon: 'success' })
|
||||
setTimeout(() => uni.navigateBack(), 1500)
|
||||
}).catch(() => {
|
||||
uni.showToast({ title: '保存失败', icon: 'none' })
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang='scss'>
|
||||
|
@ -101,15 +101,28 @@
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import upload from '@/utils/upload.js'
|
||||
import request from '@/utils/request.js'
|
||||
import {getLocalUserInfo} from '../../utils/auth';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
userDetails: [],
|
||||
// userDetails: [],
|
||||
userId: null,
|
||||
constants: {},
|
||||
fileList1: [] // 用于上传组件的文件列表
|
||||
avatarList: [],// 用于上传组件的文件列表
|
||||
idCardfileList: [],
|
||||
idCardList: [],
|
||||
lifePhotoList: [],
|
||||
imageUrl: this.$imagesUrl,
|
||||
userDetails: {
|
||||
avatar: '',
|
||||
name: null,
|
||||
phone: null,
|
||||
idCardImg: '',
|
||||
lifeImg: '',
|
||||
},
|
||||
};
|
||||
},
|
||||
onLoad(option) {
|
||||
@ -187,7 +200,7 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
// 上传文件方法 - 修改为与其他页面一致
|
||||
// 上传文件方法
|
||||
uploadFilePromise(e) {
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.uploadFile({
|
||||
|
@ -142,6 +142,8 @@ export default {
|
||||
selfInfo: {},
|
||||
coachDetails: {},
|
||||
userDetails: {},
|
||||
orderList: {},
|
||||
processList: {},
|
||||
loopData: [
|
||||
{
|
||||
url: '/static/myImgs/alreadyPaid.png',
|
||||
@ -222,7 +224,7 @@ export default {
|
||||
},
|
||||
goMyInDetails() {
|
||||
uni.navigateTo({
|
||||
url: `/newPages/informationAdd/index?userId=${this.selfInfo.id}`
|
||||
url: `/newPages/information/index?userId=${this.selfInfo.id}`
|
||||
})
|
||||
},
|
||||
|
||||
@ -235,24 +237,74 @@ export default {
|
||||
},
|
||||
}).then(res => {
|
||||
this.userDetails = res.data
|
||||
this.getOrder()
|
||||
console.log('userDetails', this.userDetails)
|
||||
if (this.userDetails.sourceUserId !== null) {
|
||||
/* if (this.userDetails.sourceUserId !== null) {
|
||||
this.getCoachDetails(this.userDetails.sourceUserId)
|
||||
}
|
||||
} */
|
||||
})
|
||||
},
|
||||
|
||||
getCoachDetails(userId) {
|
||||
getCoachDetails(coachId) {
|
||||
request({
|
||||
url: '/app-api/dl-drive-school-coach-small/getCoachByUserId',
|
||||
url: '/app-api/dl-drive-school-coach-small/get',
|
||||
method: 'GET',
|
||||
params: {
|
||||
userId: userId
|
||||
id: coachId
|
||||
}
|
||||
}).then(res => {
|
||||
this.coachDetails = res.data
|
||||
console.log('coachDetails', this.coachDetails);
|
||||
})
|
||||
},
|
||||
getOrder() {
|
||||
request({
|
||||
url: '/app-api/small/drive/school-course-order/getCourseByLoginUser',
|
||||
method: 'GET',
|
||||
}).then(res => {
|
||||
this.orderList = res.data
|
||||
if (this.orderList.length > 0) {
|
||||
console.log('orderList', this.orderList)
|
||||
this.getProcess(this.orderList[0].courseId)
|
||||
|
||||
}
|
||||
})
|
||||
},
|
||||
getProcess(courseId) {
|
||||
request({
|
||||
url: '/app-api/process/getAllByCourseId',
|
||||
method: 'GET',
|
||||
params: {
|
||||
courseId: courseId
|
||||
}
|
||||
}).then(res => {
|
||||
let result = null; // 默认返回 null(如果没有符合条件的数据)
|
||||
|
||||
if (res.data && Array.isArray(res.data)) {
|
||||
this.processList = res.data;
|
||||
|
||||
// 1. 筛选出所有 status === "1" 的数据(注意是字符串 "1")
|
||||
const statusOneItems = this.processList.filter(item => item.status === "1");
|
||||
|
||||
if (statusOneItems.length === 1) {
|
||||
// 2. 如果只有一条,直接赋值
|
||||
result = statusOneItems[0];
|
||||
this.getCoachDetails(result.coachId)
|
||||
} else if (statusOneItems.length > 1) {
|
||||
// 3. 如果有多条,按 subject(int 类型)降序排序,取第一条(subject 最大的)
|
||||
const sortedItems = [...statusOneItems].sort((a, b) => b.subject - a.subject);
|
||||
result = sortedItems[0];
|
||||
this.getCoachDetails(result.coachId)
|
||||
}
|
||||
// 如果没有数据,result 保持 null
|
||||
}
|
||||
|
||||
console.log('最终结果:', result); // 调试用,可删除
|
||||
return result; // 如果需要返回结果,可以加上 return
|
||||
}).catch(error => {
|
||||
console.error('请求出错:', error);
|
||||
return null; // 出错时也返回 null
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -49,10 +49,10 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="text-wrapper_3 flex-col">
|
||||
<text class="text_7">{{typeFormat(item.type).code}}</text>
|
||||
<text class="text_7">{{item.type}}</text>
|
||||
</view>
|
||||
<view class="text-wrapper_4 flex-col">
|
||||
<text class="text_8">{{typeFormat(item.type).desc}}</text>
|
||||
<text class="text_8">{{item.type}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -321,23 +321,6 @@ export default {
|
||||
const tabWidth = uni.getSystemInfoSync().windowWidth / 4; // 假设有 4 个选项,均分屏幕宽度
|
||||
this.underlinePosition = index * tabWidth;
|
||||
}, */
|
||||
typeFormat(type) {
|
||||
const typeMap = {
|
||||
'1': {code: 'C1', desc: '小型手动挡汽车', full: 'C1小型手动挡汽车'},
|
||||
'2': {code: 'C2', desc: '小型自动档汽车', full: 'C2小型自动档汽车'},
|
||||
'3': {code: 'B1', desc: '中型客车', full: 'B1中型客车'},
|
||||
'4': {code: 'B2', desc: '大型货车', full: 'B2大型货车'},
|
||||
'5': {code: 'A1', desc: '大型客车', full: 'A1大型客车'},
|
||||
'6': {code: 'A2', desc: '牵引车', full: 'A2牵引车'},
|
||||
'7': {code: 'A3', desc: '城市公交车', full: 'A3城市公交车'},
|
||||
'8': {code: 'D', desc: '三轮摩托车', full: 'D三轮摩托车'},
|
||||
'9': {code: 'E', desc: '两轮摩托车', full: 'E两轮摩托车'},
|
||||
'10': {code: 'F', desc: '轻便摩托车', full: 'F轻便摩托车'}
|
||||
};
|
||||
|
||||
const typeStr = typeof type === 'number' ? type.toString() : type;
|
||||
return typeMap[typeStr] || {code: '未知', desc: '未知类型', full: '未知类型'};
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
@ -678,6 +678,18 @@ export default {
|
||||
|
||||
}
|
||||
})
|
||||
this.updateSysUsersNickName()
|
||||
},
|
||||
|
||||
updateSysUsersNickName(){
|
||||
request({
|
||||
url: '/app-api/system/user/update',
|
||||
method: 'PUT',
|
||||
params: {
|
||||
nickName: this.name,
|
||||
id: this.userInfo.id
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
checkLogin() {
|
||||
|
@ -81,8 +81,7 @@
|
||||
<view class="text-group_2 flex-col justify-between">
|
||||
<text class="text_9">{{ item.tittle }}</text>
|
||||
<view class="text-wrapper_2 flex-row justify-between">
|
||||
<text class="text_10">¥{{ item.price - item.favour }}</text>
|
||||
<text class="text_11">¥{{ item.price }}</text>
|
||||
<text class="text_10">¥{{ item.price }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="text-wrapper_3 flex-col">-->
|
||||
@ -134,7 +133,7 @@
|
||||
<!-- <u-rate :count="1" activeColor="#eda23a"></u-rate>-->
|
||||
<!-- </view>-->
|
||||
</view>
|
||||
<text class="text_28">学员 598人</text>
|
||||
<!-- <text class="text_28">学员 598人</text> -->
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
Loading…
Reference in New Issue
Block a user