@ -1,6 +1,6 @@
< template >
< view class = "page flex-col" >
<!-- < view class = "group_1 flex-row" >
< view class = "page flex-col" >
<!-- < view class = "group_1 flex-row" >
< / view >
@ -14,57 +14,43 @@
< text class = "text_1" > 考试结果 < / text >
< / view > -- >
< view style = "width: 100%;background: #f4f5f6;box-sizing: border-box;padding-top: 88px;" >
< headers titles = "考试结果" >
< uni -icons type = "left" color = "#000000" size = "22px" > < / u n i - i c o n s >
< / headers >
< / view >
< view >
< scroll -view
: style = "{ height: scrollHeight + 'px' }"
scroll - y = "true" class = "scroll-view"
>
< view class = "group_4 flex-col" >
< view class = "block_1 flex-row justify-between" @ click = "show = true" >
< text class = "text_19" > 是否通过 < / text >
< view >
< u -picker v -model = " process.examStatus " :show ="show" :columns ="ifPassColumns" title = "是否通过"
@ confirm = "ifPassOnConfirm" @ cancel = "show = false" >
< / u - p i c k e r >
< text class = "text_191" > { { selectedValue || '请选择' } } < / text >
< / view >
< / view >
< view class = "text-wrapper_7 flex-row justify-between" >
< text class = "text_4" > 分数 < / text >
< view class = "text_5_1 " >
< u - -input
placeholder = "请输入分数"
border = "none"
v - model = "process.examScore"
maxlength = "3"
inputAlign = "right"
> 分
< / u - - i n p u t >
< / view >
< / view >
< view class = "text-wrapper_8 flex-row justify-between" >
< text class = "text_20" > 时间 < / text >
< view >
< u -datetime -picker
: show = "showTimePicker"
v - model = "process.examTime"
mode = "datetime"
: minDate = "minTime"
: maxDate = "maxTime"
@ confirm = "onConfirmExamTime"
@ cancel = "showTimePicker = false"
> < / u - d a t e t i m e - p i c k e r >
< text class = "text_3" @ click = "showTimePicker = true" >
{ { process . examTime ? formatDate ( process . examTime ) : '选择时间' } }
< / text >
< / view >
< / view >
<!-- < view class = "text-wrapper_9 flex-row justify-between" >
< view style = "width: 100%;background: #f4f5f6;box-sizing: border-box;padding-top: 88px;" >
< headers titles = "考试结果" >
< uni -icons type = "left" color = "#000000" size = "22px" > < / u n i - i c o n s >
< / headers >
< / view >
< view >
< scroll -view : style = "{ height: scrollHeight + 'px' }" scroll -y = " true " class = "scroll-view" >
< view class = "group_4 flex-col" >
< view class = "block_1 flex-row justify-between" @ click = "show = true" >
< text class = "text_19" > 是否通过 < / text >
< view >
< u -picker v -model = " process.examStatus " :show ="show" :columns ="ifPassColumns" title = "是否通过"
@ confirm = "ifPassOnConfirm" @ cancel = "show = false" >
< / u - p i c k e r >
< text class = "text_191" > { { selectedValue || '请选择' } } < / text >
< / view >
< / view >
< view class = "text-wrapper_7 flex-row justify-between" >
< text class = "text_4" > 分数 < / text >
< view class = "text_5_1 " >
< u - -input placeholder = "请输入分数" border = "none" v -model = " process.examScore " maxlength = "3"
inputAlign = "right" > 分
< / u - - i n p u t >
< / view >
< / view >
< view class = "text-wrapper_8 flex-row justify-between" >
< text class = "text_20" > 时间 < / text >
< view >
< u -datetime -picker :show ="showTimePicker" v -model = " process.examTime " mode = "datetime"
: minDate = "minTime" : maxDate = "maxTime" @ confirm = "onConfirmExamTime"
@ cancel = "showTimePicker = false" > < / u - d a t e t i m e - p i c k e r >
< text class = "text_3" @ click = "showTimePicker = true" >
{ { process . examTime ? formatDate ( process . examTime ) : '选择时间' } }
< / text >
< / view >
< / view >
<!-- < view class = "text-wrapper_9 flex-row justify-between" >
< text class = "text_6" > 姓名 < / text >
< view class = "text_5_1 " >
< u - -input
@ -76,427 +62,460 @@
> < / u - - i n p u t >
< / view >
< / view > -- >
< view class = "text-wrapper_10 flex-row justify-between" >
< text class = "text_8" > 考试类型 < / text >
< text class = "text_9" v-if ="process.subject != 2 && process.subject != 3" > {{ courseType }} < / text >
< text class = "text_9" v-else > {{ opCourseType }} < / text >
< / view >
< view class = "text-wrapper_11 flex-row justify-between" @ click = "subjectShow = true"
v - if = "process.subject != 2 && process.subject != 3" >
< text class = "text_10" > 考试科目 < / text >
< view >
< u -picker v -model = " process.subject " :show ="subjectShow" :columns ="subjectColumns" title = "科目"
@ confirm = "subjectOnConfirm" @ cancel = "subjectShow = false" >
< / u - p i c k e r >
< text class = "text_11" > { { subjectValue || '请选择科目' } } < / text >
< / view >
< / view >
< view class = "text-wrapper_11 flex-row justify-between"
v - else - if = "process.subject == 2 || process.subject == 3" >
< text class = "text_10" > 考试科目 < / text >
< text class = "text_11" > { { formatSubject ( process . subject ) } } < / text >
< / view >
<!-- < view class = "text-wrapper_3 flex-row justify-between" v-if ="item.subject == 2 || item.subject == 3" >
< view class = "text-wrapper_10 flex-row justify-between" >
< text class = "text_8" > 考试类型 < / text >
< text class = "text_9" v-if ="process.subject != 2 && process.subject != 3" > {{ courseType }} < / text >
< text class = "text_9" v-else > {{ opCourseType }} < / text >
< / view >
< view class = "text-wrapper_11 flex-row justify-between" @ click = "subjectShow = true"
v - if = "process.subject != 2 && process.subject != 3" >
< text class = "text_10" > 考试科目 < / text >
< view >
< u -picker v -model = " process.subject " :show ="subjectShow" :columns ="subjectColumns" title = "科目"
@ confirm = "subjectOnConfirm" @ cancel = "subjectShow = false" >
< / u - p i c k e r >
< text class = "text_11" > { { subjectValue || '请选择科目' } } < / text >
< / view >
< / view >
< view class = "text-wrapper_11 flex-row justify-between"
v - else - if = "process.subject == 2 || process.subject == 3" >
< text class = "text_10" > 考试科目 < / text >
< text class = "text_11" > { { formatSubject ( process . subject ) } } < / text >
< / view >
<!-- < view class = "text-wrapper_3 flex-row justify-between" v-if ="item.subject == 2 || item.subject == 3" >
< text class = "text_8" > 考试地址 : < / text >
< text class = "text_9" > { { item . addr } } < / text >
< / view > -- >
< / view >
< view class = "group_5 flex-col" >
< text class = "text_16" > 备注 < / text >
< u - -textarea class = "text_17" v -model = " process.remark " placeholder = "请输入内容" count > < / u - - t e x t a r e a >
< text class = "text_18" > 图片 < / text >
< view class = "image-wrapper_4 flex-row justify-between" >
< u -upload
: fileList = "displayFileList"
@ afterRead = "afterRead"
@ delete = "deletePic"
multiple
: maxCount = "2"
> < / u - u p l o a d >
< / view >
< / view >
< / s c r o l l - v i e w >
< / view >
< view class = "group_5 flex-col" >
< text class = "text_16" > 备注 < / text >
< u - -textarea class = "text_17" v -model = " process.remark " placeholder = "请输入内容" count > < / u - - t e x t a r e a >
< text class = "text_18" > 图片 < / text >
< view class = "image-wrapper_4 flex-row justify-between" >
< u -upload :fileList ="displayFileList" @afterRead ="afterRead" @delete ="deletePic" multiple
: maxCount = "2" > < / u - u p l o a d >
< / view >
< / view >
< / s c r o l l - v i e w >
< / 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 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' ;
import headers from "@/components/header/headers.vue" ;
import upload from '@/utils/upload.js'
import request from '@/utils/request.js'
import {
getLocalUserInfo
} from '../../utils/auth' ;
import headers from "@/components/header/headers.vue" ;
export default {
components : {
headers
} ,
data ( ) {
return {
show : false ,
showTimePicker : false ,
subjectShow : false ,
ifPassColumns : [ [ '已通过' , '未通过' ] ] ,
subjectColumns : [ [ '科目一' ] ] ,
selectedValue : '' ,
subjectValue : '' ,
fileList : [ ] ,
imageUrl : this . $imagesUrl ,
userInfo : [ ] ,
courseType : null ,
courseCompleteStatusList : { } ,
opTenantId : null ,
opCourseType : null ,
examId : null ,
batchId : null ,
batchItemId : null ,
process : {
id : null ,
userName : null ,
userId : null ,
subject : null ,
fraction : null ,
examNum : null ,
examStatus : null ,
examScore : null ,
remark : '' ,
examTime : Date . now ( ) ,
images : null ,
tenantId : null ,
courseId : null ,
ifPass : null ,
batchId : null ,
coachId : null ,
} ,
minTime : 0 ,
maxTime : 0 ,
scrollHeight : 0 ,
constants : { }
} ;
} ,
onLoad ( options ) {
console . log ( 'options' , options )
this . userInfo = getLocalUserInfo ( )
/ / t h i s . g e t U s e r O r d e r D e t a i l s ( )
this . process . subject = options . subject
this . opTenantId = options . tenantId
this . opCourseType = options . courseType
this . process . subject = options . subject
this . process . courseId = options . courseId
this . process . batchId = options . batchId
this . examId = options . id
this . batchId = options . batchId
this . batchItemId = options . id
this . process . id = options . id
this . process . coachId = options . coachId
this . process . userId = this . userInfo . id
this . process . coachId = options . coachId
this . process . userName = options . nickname
this . process . tenantId = options . tenantId
this . getCourseCompleteStatus ( ) ;
} ,
onReady ( ) {
/ / 动 态 计 算 滚 动 区 域 高 度
this . calculateScrollHeight ( ) ;
} ,
computed : {
displayFileList ( ) {
return this . fileList . map ( item => {
if ( item . url . startsWith ( 'http' ) ) {
return item ;
}
export default {
components : {
headers
} ,
data ( ) {
return {
show : false ,
showTimePicker : false ,
subjectShow : false ,
ifPassColumns : [
[ '已通过' , '未通过' ]
] ,
subjectColumns : [
[ '科目一' ]
] ,
selectedValue : '' ,
subjectValue : '' ,
fileList : [ ] ,
imageUrl : this . $imagesUrl ,
userInfo : [ ] ,
courseType : null ,
courseCompleteStatusList : { } ,
opTenantId : null ,
opCourseType : null ,
examId : null ,
batchId : null ,
batchItemId : null ,
process : {
id : null ,
userName : null ,
userId : null ,
subject : null ,
fraction : null ,
examNum : null ,
examStatus : null ,
examScore : null ,
remark : '' ,
examTime : Date . now ( ) ,
images : null ,
tenantId : null ,
courseId : null ,
ifPass : null ,
batchId : null ,
coachId : null ,
} ,
minTime : 0 ,
maxTime : 0 ,
scrollHeight : 0 ,
constants : { }
} ;
} ,
onLoad ( options ) {
console . log ( 'options' , options )
this . userInfo = getLocalUserInfo ( )
console . log ( 'userInfo' , this . userInfo )
/ / t h i s . g e t U s e r O r d e r D e t a i l s ( )
this . process . subject = options . subject
this . opTenantId = options . tenantId
this . opCourseType = options . courseType
this . process . subject = options . subject
this . process . courseId = options . courseId
this . process . batchId = options . batchId
this . examId = options . id
this . batchId = options . batchId
this . batchItemId = options . id
this . process . id = options . id
this . process . coachId = options . coachId
this . process . userId = this . userInfo . id
this . process . coachId = options . coachId
this . process . userName = options . nickname
this . process . tenantId = options . tenantId
this . getCourseCompleteStatus ( ) ;
} ,
onReady ( ) {
/ / 动 态 计 算 滚 动 区 域 高 度
this . calculateScrollHeight ( ) ;
} ,
computed : {
displayFileList ( ) {
return this . fileList . map ( item => {
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 ) } `
: ` ${ prefix } ${ item . url } ` ;
const prefix = this . $imagesUrl . endsWith ( '/' ) ? this . $imagesUrl : ` ${ this . $imagesUrl } / ` ;
const fullUrl = item . url . startsWith ( '/' ) ?
` ${ prefix } ${ item . url . slice ( 1 ) } ` :
` ${ prefix } ${ item . url } ` ;
return {
... item ,
url : fullUrl ,
} ;
} ) ;
} ,
} ,
created ( ) {
const now = new Date ( )
this . maxTime = now . getTime ( )
const min = new Date ( )
min . setFullYear ( min . getFullYear ( ) - 5 )
this . minTime = min . getTime ( )
} ,
methods : {
handleBack ( ) {
uni . navigateBack ( {
delta : 1
} ) ;
} ,
ifPassOnConfirm ( value ) {
const statusMap = {
'已通过' : 1 ,
'未通过' : 0
} ;
return {
... item ,
url : fullUrl ,
} ;
} ) ;
} ,
} ,
created ( ) {
const now = new Date ( )
this . maxTime = now . getTime ( )
/ / 更 新 数 据
this . process . examStatus = statusMap [ value . value [ 0 ] ] ;
this . selectedValue = value . value [ 0 ] ;
this . show = false ;
} ,
const min = new Date ( )
min . setFullYear ( min . getFullYear ( ) - 5 )
this . minTime = min . getTime ( )
} ,
methods : {
handleBack ( ) {
uni . navigateBack ( {
delta : 1
} ) ;
} ,
ifPassOnConfirm ( value ) {
const statusMap = {
'已通过' : 1 ,
'未通过' : 0
} ;
subjectOnConfirm ( value ) {
const statusMap = {
'科目一' : 1 ,
'科目四' : 4
} ;
/ / 更 新 数 据
this . process . examStatus = statusMap [ value . value [ 0 ] ] ;
this . selectedValue = value . value [ 0 ] ;
this . show = false ;
} ,
/ / 更 新 数 据
this . process . subject = statusMap [ value . value [ 0 ] ] ;
this . subjectValue = value . value [ 0 ] ;
this . subjectShow = false ;
} ,
subjectOnConfirm ( value ) {
const statusMap = {
'科目一' : 1 ,
'科目四' : 4
} ;
onConfirmExamTime ( value ) {
this . process . examTime = value ;
this . showTimePicker = false ;
console . log ( 'process' , this . process )
} ,
/ / 格 式 化 时 间
formatDate ( timestamp ) {
const date = new Date ( timestamp ) ;
const year = date . getFullYear ( ) ;
const month = String ( date . getMonth ( ) + 1 ) . padStart ( 2 , '0' ) ;
const day = String ( date . getDate ( ) ) . padStart ( 2 , '0' ) ;
const hours = String ( date . getHours ( ) ) . padStart ( 2 , '0' ) ;
const minutes = String ( date . getMinutes ( ) ) . padStart ( 2 , '0' ) ;
return ` ${ year } - ${ month } - ${ day } ${ hours } : ${ minutes } ` ;
} ,
formatSubject ( subject ) {
switch ( Number ( subject ) ) {
case 2 : return '科目二' ;
case 3 : return '科目三' ;
default : return '未知科目' ;
}
} ,
/ / 更 新 数 据
this . process . subject = statusMap [ value . value [ 0 ] ] ;
this . subjectValue = value . value [ 0 ] ;
this . subjectShow = false ;
} ,
onConfirmExamTime ( value ) {
this . process . examTime = value ;
this . showTimePicker = false ;
console . log ( 'process' , this . process )
} ,
/ / 格 式 化 时 间
formatDate ( timestamp ) {
const date = new Date ( timestamp ) ;
const year = date . getFullYear ( ) ;
const month = String ( date . getMonth ( ) + 1 ) . padStart ( 2 , '0' ) ;
const day = String ( date . getDate ( ) ) . padStart ( 2 , '0' ) ;
const hours = String ( date . getHours ( ) ) . padStart ( 2 , '0' ) ;
const minutes = String ( date . getMinutes ( ) ) . padStart ( 2 , '0' ) ;
return ` ${ year } - ${ month } - ${ day } ${ hours } : ${ minutes } ` ;
} ,
formatSubject ( subject ) {
switch ( Number ( subject ) ) {
case 2 :
return '科目二' ;
case 3 :
return '科目三' ;
default :
return '未知科目' ;
}
} ,
deletePic ( event ) {
this . fileList . splice ( event . index , 1 ) ;
} ,
/ / 新 增 图 片
async afterRead ( event ) {
let lists = [ ] . concat ( event . file ) ;
let fileListLen = this . fileList . length ;
deletePic ( event ) {
this . fileList . splice ( event . index , 1 ) ;
} ,
/ / 新 增 图 片
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 ) ;
let item = {
status : 'success' ,
url : resultUrl ,
} ;
this . fileList . splice ( fileListLen , 0 , item ) ;
fileListLen ++ ;
} catch ( error ) {
console . error ( '图片上传失败' , error ) ;
}
}
} ,
uploadFilePromise ( 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 ) ;
} else {
reject ( new Error ( '上传失败' ) ) ;
}
} ) . catch ( err => reject ( err ) ) ;
} ) ;
} ,
for ( let i = 0 ; i < lists . length ; i ++ ) {
try {
const resultUrl = await this . uploadFilePromise ( lists [ i ] . url ) ;
let item = {
status : 'success' ,
url : resultUrl ,
} ;
this . fileList . splice ( fileListLen , 0 , item ) ;
fileListLen ++ ;
} catch ( error ) {
console . error ( '图片上传失败' , error ) ;
}
}
} ,
uploadFilePromise ( 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 ) ;
} else {
reject ( new Error ( '上传失败' ) ) ;
}
} ) . catch ( err => reject ( err ) ) ;
} ) ;
} ,
/ / g e t U s e r O r d e r D e t a i l s ( ) {
/ / r e q u e s t ( {
/ / u r l : ' / a p p - a p i / s m a l l / d r i v e / s c h o o l - c o u r s e - o r d e r / p a g e ' ,
/ / m e t h o d : ' G E T ' ,
/ / p a r a m s : {
/ / u s e r I d : t h i s . u s e r I n f o . i d ,
/ / p a y m e n t S t a t u s : ' 2 ' ,
/ / i f E n d : f a l s e ,
/ / t e n a n t I d : 1 8 0 ,
/ / } ,
/ / t e n a n t I d F l a g : f a l s e
/ / } ) . t h e n ( r e s = > {
/ / c o n s o l e . l o g ( ' 1 2 3 1 2 3 ' , r e s )
/ / t h i s . o r d e r L i s t = r e s . d a t a . r e c o r d s ;
/ / i f ( r e s . d a t a . r e c o r d s . l e n g t h > 0 ) {
/ / c o n s t t e m p D a t a = r e s . d a t a . r e c o r d s [ 0 ]
/ / i f ( t h i s . p r o c e s s . s u b j e c t ! = 2 & & t h i s . p r o c e s s . s u b j e c t ! = 3 ) {
/ / t h i s . p r o c e s s . c o u r s e I d = t e m p D a t a . c o u r s e I d
/ / }
/ / g e t U s e r O r d e r D e t a i l s ( ) {
/ / r e q u e s t ( {
/ / u r l : ' / a p p - a p i / s m a l l / d r i v e / s c h o o l - c o u r s e - o r d e r / p a g e ' ,
/ / m e t h o d : ' G E T ' ,
/ / p a r a m s : {
/ / u s e r I d : t h i s . u s e r I n f o . i d ,
/ / p a y m e n t S t a t u s : ' 2 ' ,
/ / i f E n d : f a l s e ,
/ / t e n a n t I d : 1 8 0 ,
/ / } ,
/ / t e n a n t I d F l a g : f a l s e
/ / } ) . t h e n ( r e s = > {
/ / c o n s o l e . l o g ( ' 1 2 3 1 2 3 ' , r e s )
/ / t h i s . o r d e r L i s t = r e s . d a t a . r e c o r d s ;
/ / i f ( r e s . d a t a . r e c o r d s . l e n g t h > 0 ) {
/ / c o n s t t e m p D a t a = r e s . d a t a . r e c o r d s [ 0 ]
/ / i f ( t h i s . p r o c e s s . s u b j e c t ! = 2 & & t h i s . p r o c e s s . s u b j e c t ! = 3 ) {
/ / t h i s . p r o c e s s . c o u r s e I d = t e m p D a t a . c o u r s e I d
/ / }
/ / i f ( t h i s . p r o c e s s . s u b j e c t ! = 2 & & t h i s . p r o c e s s . s u b j e c t ! = 3 ) {
/ / t h i s . c o u r s e T y p e = t e m p D a t a . c o u r s e T y p e
/ / }
/ / i f ( t h i s . p r o c e s s . s u b j e c t ! = 2 & & t h i s . p r o c e s s . s u b j e c t ! = 3 ) {
/ / t h i s . c o u r s e T y p e = t e m p D a t a . c o u r s e T y p e
/ / }
/ / t h i s . p r o c e s s . t e n a n t I d = t e m p D a t a . t e n a n t I d
/ / t h i s . g e t C o u r s e C o m p l e t e S t a t u s ( )
/ / }
/ / } ) ;
/ / } ,
/ / t h i s . p r o c e s s . t e n a n t I d = t e m p D a t a . t e n a n t I d
/ / t h i s . g e t C o u r s e C o m p l e t e S t a t u s ( )
/ / }
/ / } ) ;
/ / } ,
getCourseCompleteStatus ( ) {
request ( {
url : '/app-api/process/page' ,
method : 'GET' ,
params : {
userId : this . userInfo . id ,
courseId : this . process . courseId ,
}
} ) . then ( res => {
console . log ( 'res123' , res )
this . courseCompleteStatusList = res . data . records
if ( this . courseCompleteStatusList . length > 0 ) {
const subject2 = this . courseCompleteStatusList . find ( item => item . subject === 2 )
const subject3 = this . courseCompleteStatusList . find ( item => item . subject === 3 )
const subject1Or4 = this . courseCompleteStatusList . find ( item => item . subject === 1 || item . subject === 4 )
if ( subject1Or4 ) {
this . courseType = subject1Or4 . courseType
getCourseCompleteStatus ( ) {
request ( {
url : '/app-api/process/page' ,
method : 'GET' ,
params : {
userId : this . userInfo . id ,
courseId : this . process . courseId ,
}
} ) . then ( res => {
console . log ( 'res123' , res )
this . courseCompleteStatusList = res . data . records
if ( this . courseCompleteStatusList . length > 0 ) {
const subject2 = this . courseCompleteStatusList . find ( item => item . subject === 2 )
const subject3 = this . courseCompleteStatusList . find ( item => item . subject === 3 )
const subject1Or4 = this . courseCompleteStatusList . find ( item => item . subject === 1 || item
. subject === 4 )
if ( subject1Or4 ) {
this . courseType = subject1Or4 . courseType
}
if ( subject2 ? . status === '2' && subject3 ? . status === '2' ) {
this . subjectColumns = [
[ '科目一' , '科目四' ]
]
}
}
} )
} ,
calculateScrollHeight ( ) {
/ / 获 取 屏 幕 高 度
const screenHeight = uni . getSystemInfoSync ( ) . windowHeight ;
/ / 获 取 顶 部 区 域 高 度
const topHeight = 145 ;
/ / 计 算 滚 动 区 域 高 度
this . scrollHeight = screenHeight - topHeight ;
} ,
saveData ( ) {
console . log ( 'process' , this . process )
if ( ! this . process . userId || ! this . process . subject || this . process . examScore === null || this . process
. examStatus === null || ! this . process . examTime ) {
uni . showToast ( {
title : '信息填写不完整' ,
icon : 'none'
} ) ;
return ;
}
if ( this . process . subject == 1 || this . process . subject == 4 ) {
this . saveDataOne ( )
}
if ( this . process . subject == 2 || this . process . subject == 3 ) {
this . saveDataTwo ( )
}
} ,
saveDataOne ( ) {
if ( this . process . subject === 1 && this . courseCompleteStatusList . length <= 0 ) {
uni . showToast ( {
title : '请联系驾校人员!' ,
icon : 'none'
} ) ;
return ;
}
if ( this . process . subject === 4 && this . courseCompleteStatusList . length <= 0 ) {
uni . showToast ( {
title : '请联系驾校人员!' ,
icon : 'none'
} ) ;
return ;
}
const postData = {
... this . process , / / 先 拷 贝 p r o c e s s 原 有 数 据
remark : this . process . remark ,
userName : this . userInfo . nickname ,
images : this . fileList ? . map ( item => item . url ) . join ( ',' ) || '' ,
}
/ / t h i s . p r o c e s s . i m a g e s = t h i s . f i l e L i s t ? . m a p ( i t e m = > i t e m . u r l ) . j o i n ( ' , ' ) | | ' ' ;
if ( ! this . process . userId || ! this . process . subject || this . process . examScore === null || this . process
. examStatus === null || ! this . process . examTime ) {
uni . showToast ( {
title : '信息填写不完整' ,
icon : 'none'
} ) ;
return ;
}
console . log ( 'postData' , postData )
request ( {
url : '/app-api/process/updateProcess' ,
method : 'PUT' ,
data : postData ,
/ / d a t a : t h i s . p r o c e s s ,
} ) . then ( res => {
if ( res . code === 0 ) {
uni . showToast ( {
title : '保存成功' ,
icon : 'success' ,
duration : 1000
} ) ;
setTimeout ( ( ) => {
uni . navigateBack ( {
delta : 1
} ) ;
} , 1500 ) ;
} else {
uni . showToast ( {
title : res . data ? . message || '保存失败' ,
icon : 'none'
} ) ;
}
} )
} ,
saveDataTwo ( ) {
const postData = {
... this . process , / / 先 拷 贝 p r o c e s s 原 有 数 据
tenantId : this . opTenantId ,
fraction : this . process . examScore ,
ifPass : this . process . examStatus === 1 ,
id : this . batchItemId ,
remark : this . process . remark ,
userName : this . userInfo . nickname ,
images : this . fileList ? . map ( item => item . url ) . join ( ',' ) || '' ,
}
console . log ( 'postData' , postData )
/ * t h i s . p r o c e s s . u s e r I d = t h i s . u s e r I n f o . i d
this . process . tenantId = this . opTenantId
this . process . fraction = this . process . examScore
this . process . ifPass = this . process . examStatus
this . process . images = this . fileList ? . map ( item => item . url ) . join ( ',' ) || '' ; * /
if ( ! this . process . userId || ! this . process . subject || this . process . examScore === null || this . process
. examStatus === null || ! this . process . examTime ) {
uni . showToast ( {
title : '信息填写不完整' ,
icon : 'none'
} ) ;
return ;
}
request ( {
url : '/app-api/examBatch/update' ,
method : 'PUT' ,
data : postData ,
/ / d a t a : t h i s . p r o c e s s ,
} ) . then ( res => {
if ( res . code === 0 ) {
uni . showToast ( {
title : '保存成功' ,
icon : 'success' ,
duration : 1000
} ) ;
setTimeout ( ( ) => {
uni . navigateBack ( {
delta : 1
} ) ;
} , 1500 ) ;
} else {
uni . showToast ( {
title : res . data ? . message || '保存失败' ,
icon : 'none'
} ) ;
}
} )
}
if ( subject2 ? . status === '2' && subject3 ? . status === '2' ) {
this . subjectColumns = [ [ '科目一' , '科目四' ] ]
}
}
} )
} ,
calculateScrollHeight ( ) {
/ / 获 取 屏 幕 高 度
const screenHeight = uni . getSystemInfoSync ( ) . windowHeight ;
/ / 获 取 顶 部 区 域 高 度
const topHeight = 145 ;
/ / 计 算 滚 动 区 域 高 度
this . scrollHeight = screenHeight - topHeight ;
} ,
saveData ( ) {
console . log ( 'process' , this . process )
if ( ! this . process . userId || ! this . process . subject || this . process . examScore === null || this . process . examStatus === null || ! this . process . examTime ) {
uni . showToast ( { title : '信息填写不完整' , icon : 'none' } ) ;
return ;
}
if ( this . process . subject == 1 || this . process . subject == 4 ) {
this . saveDataOne ( )
}
if ( this . process . subject == 2 || this . process . subject == 3 ) {
this . saveDataTwo ( )
}
} ,
saveDataOne ( ) {
if ( this . process . subject === 1 && this . courseCompleteStatusList . length <= 0 ) {
uni . showToast ( { title : '请联系驾校人员!' , icon : 'none' } ) ;
return ;
}
if ( this . process . subject === 4 && this . courseCompleteStatusList . length <= 0 ) {
uni . showToast ( { title : '请联系驾校人员!' , icon : 'none' } ) ;
return ;
}
const postData = {
... this . process , / / 先 拷 贝 p r o c e s s 原 有 数 据
remark : this . process . remark ,
images : this . fileList ? . map ( item => item . url ) . join ( ',' ) || '' ,
}
/ / t h i s . p r o c e s s . i m a g e s = t h i s . f i l e L i s t ? . m a p ( i t e m = > i t e m . u r l ) . j o i n ( ' , ' ) | | ' ' ;
if ( ! this . process . userId || ! this . process . subject || this . process . examScore === null || this . process . examStatus === null || ! this . process . examTime ) {
uni . showToast ( { title : '信息填写不完整' , icon : 'none' } ) ;
return ;
}
console . log ( 'postData' , postData )
request ( {
url : '/app-api/process/updateProcess' ,
method : 'PUT' ,
data : postData ,
/ / d a t a : t h i s . p r o c e s s ,
} ) . then ( res => {
if ( res . code === 0 ) {
uni . showToast ( {
title : '保存成功' ,
icon : 'success' ,
duration : 1000
} ) ;
setTimeout ( ( ) => {
uni . navigateBack ( {
delta : 1
} ) ;
} , 1500 ) ;
} else {
uni . showToast ( { title : res . data ? . message || '保存失败' , icon : 'none' } ) ;
}
} )
} ,
saveDataTwo ( ) {
const postData = {
... this . process , / / 先 拷 贝 p r o c e s s 原 有 数 据
tenantId : this . opTenantId ,
fraction : this . process . examScore ,
ifPass : this . process . examStatus ,
id : this . batchItemId ,
remark : this . process . remark ,
images : this . fileList ? . map ( item => item . url ) . join ( ',' ) || '' ,
}
/ * t h i s . p r o c e s s . u s e r I d = t h i s . u s e r I n f o . i d
this . process . tenantId = this . opTenantId
this . process . fraction = this . process . examScore
this . process . ifPass = this . process . examStatus
this . process . images = this . fileList ? . map ( item => item . url ) . join ( ',' ) || '' ; * /
if ( ! this . process . userId || ! this . process . subject || this . process . examScore === null || this . process . examStatus === null || ! this . process . examTime ) {
uni . showToast ( { title : '信息填写不完整' , icon : 'none' } ) ;
return ;
}
request ( {
url : '/app-api/examBatch/update' ,
method : 'PUT' ,
data : postData ,
/ / d a t a : t h i s . p r o c e s s ,
} ) . then ( res => {
if ( res . code === 0 ) {
uni . showToast ( {
title : '保存成功' ,
icon : 'success' ,
duration : 1000
} ) ;
setTimeout ( ( ) => {
uni . navigateBack ( {
delta : 1
} ) ;
} , 1500 ) ;
} else {
uni . showToast ( { title : res . data ? . message || '保存失败' , icon : 'none' } ) ;
}
} )
}
}
} ;
}
} ;
< / script >
< style lang = 'scss' >
@ import '../common/common.scss' ;
@ import './assets/style/index.rpx.scss' ;
< / style >
@ import '../common/common.scss' ;
@ import './assets/style/index.rpx.scss' ;
< / style >