体检与培训bug修复

This commit is contained in:
binbin_pan 2024-09-04 15:18:01 +08:00
parent bcfa1ef050
commit 76ccdca662
19 changed files with 830 additions and 82 deletions

11
package-lock.json generated
View File

@ -9,6 +9,7 @@
"version": "3.4.5",
"license": "MIT",
"dependencies": {
"crypto-js": "^4.2.0",
"image-tools": "^1.4.0",
"luch-request": "^3.1.1"
}
@ -18,6 +19,11 @@
"resolved": "https://registry.npmjs.org/@dcloudio/types/-/types-2.6.12.tgz",
"integrity": "sha512-mrCMwcINy1IFjU9VUqLeWBkj404yWs5paLDttBcA+eqUjanuUQbBcTVPqlrGgkyzLXDcV2oDDZRSNxNpXi4kMQ=="
},
"node_modules/crypto-js": {
"version": "4.2.0",
"resolved": "https://registry.npmmirror.com/crypto-js/-/crypto-js-4.2.0.tgz",
"integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q=="
},
"node_modules/image-tools": {
"version": "1.4.0",
"resolved": "https://registry.npmmirror.com/image-tools/-/image-tools-1.4.0.tgz",
@ -38,6 +44,11 @@
"resolved": "https://registry.npmjs.org/@dcloudio/types/-/types-2.6.12.tgz",
"integrity": "sha512-mrCMwcINy1IFjU9VUqLeWBkj404yWs5paLDttBcA+eqUjanuUQbBcTVPqlrGgkyzLXDcV2oDDZRSNxNpXi4kMQ=="
},
"crypto-js": {
"version": "4.2.0",
"resolved": "https://registry.npmmirror.com/crypto-js/-/crypto-js-4.2.0.tgz",
"integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q=="
},
"image-tools": {
"version": "1.4.0",
"resolved": "https://registry.npmmirror.com/image-tools/-/image-tools-1.4.0.tgz",

View File

@ -21,6 +21,7 @@
},
"homepage": "https://github.com/dcloudio/hello-uniapp#readme",
"dependencies": {
"crypto-js": "^4.2.0",
"image-tools": "^1.4.0",
"luch-request": "^3.1.1"
},

View File

@ -241,6 +241,13 @@
{
"navigationBarTitleText" : "图片学习"
}
},
{
"path" : "pages/HealthExaminationApp/myAppointment/bookSuccessfully",
"style" :
{
"navigationBarTitleText" : "体检预约"
}
}
],
"globalStyle": {

View File

@ -1,19 +1,507 @@
<template>
<view>
体检预约
</view>
<view>
<div class="content">
<h3>选择医院</h3>
<div class="item" @click="show = true">
<div v-if="!hospital">点击选择医院</div>
<div v-else>{{ hospital }}</div>
<div><u-icon name="arrow-right"></u-icon></div>
</div>
<h3 style="margin-top: 20px">检查类型</h3>
<div class="item" @click="showPropup = true">
<div v-if="!checkType">点击选择检查类型</div>
<div v-else>{{ checkType }}</div>
<div><u-icon name="arrow-right"></u-icon></div>
</div>
<h3 style="margin-top: 20px">体检时间</h3>
<div class="item" @click="handleShowTime">
<div v-if="!healthTime">点击选择时间</div>
<div v-else>{{ healthTime }}</div>
<div><u-icon name="arrow-right"></u-icon></div>
</div>
</div>
<!-- 选择医院 -->
<u-picker
:show="show"
:columns="[hospitalList]"
keyName="hospitalName"
@cancel="show = false"
@confirm="confirmHospital"
></u-picker>
<!-- 检查类型 -->
<u-popup :show="showPropup" :round="10" mode="bottom" closeable @close="showPropup = false">
<div class="propup-content">
<h3>请选择套餐</h3>
<div class="title-wrapper">
<div class="title title-tip" v-if="!checkType">
<div>请选择</div>
<div class="line"></div>
</div>
<div v-else>
<div class="title">{{ checkType }}</div>
<div class="line"></div>
</div>
</div>
<div>
<div
class="list-item"
:class="{ active: active == index }"
v-for="(item, index) in checkTypeList"
:key="index"
@click="handleCheckType(item, index)"
>
{{ item.text }}
</div>
</div>
<div class="cont-title" v-if="checkTypeContent">
<div class="cont">{{ checkTypeContent }}</div>
<div v-if="showIcon" class="cont-icon" @click="showIcon = false">
<div style="margin-right: 3px">展开</div>
<div>
<u-icon name="arrow-down" color="#1989fa" size="16" />
</div>
</div>
<div v-else class="cont-icon" @click="showIcon = true">
<div style="margin-right: 3px">收起</div>
<div>
<u-icon name="arrow-up" color="#1989fa" size="16" />
</div>
</div>
</div>
<div class="cont-line"></div>
<div v-show="!showIcon" class="contList-wrapper">
<div class="contList-item" v-for="(item, index) in checkTypeContentList" :key="index">
<div class="cont-title">{{ item.combinName }}</div>
<div>项目内容{{ item.combinContent }}</div>
<div>
项目价格
<span style="color: red">{{ item.combinPrice }}</span>
</div>
</div>
</div>
<div class="btn" v-if="checkType">
<u-button type="primary" text="确认套餐" size="small" @click="showPropup = false"></u-button>
</div>
</div>
</u-popup>
<!-- 体检时间 -->
<u-calendar :show="showTime" mode="single" @confirm="confirmTime" @close="showTime = false"></u-calendar>
<div v-if="healthTime" class="reservation-number">当天剩余可预约人数{{ reservationNumber }}</div>
<div class="content" v-if="hospitalInfo.hospitalName">
<h3>医院信息</h3>
<div class="hospital-name">{{ hospitalInfo.hospitalName }}</div>
<div>地址: {{ hospitalInfo.address }}</div>
<div>营业时间: 周一至周五 {{ hospitalInfo.businessEnd }}-{{ hospitalInfo.businessHours }}</div>
<div>负责人: {{ hospitalInfo.responsible }}</div>
<div>联系方式: {{ hospitalInfo.telPhone }}</div>
</div>
<div style="margin: 30px 60px" v-if="hospital && checkType && healthTime">
<u-button type="primary" text="确定预约" shape="circle" size="small" @click="handleSave"></u-button>
</div>
</view>
</template>
<script>
export default {
data() {
return {
};
}
}
import config from '@/config'
import Crypoto from '@/utils/aescbc'
export default {
data() {
return {
token: uni.getStorageSync('tjToken'),
idcard: '',
active: null,
//
hospitalList: [],
//
hospital: '',
//
hospitalInfo: {},
//
healthTime: '',
show: false,
showTime: false,
columns: [],
showPropup: false,
setMealId: '',
//
checkType: '',
// -
checkTypeList: [],
// -
checkTypeContent: '',
checkTypeContentList: [],
showIcon: false,
reservationNumber: 0,
isDisabled: true
}
},
onLoad(opt) {
opt = JSON.parse(opt.params)
console.log('🚀 ~ onLoad ~ opt:', opt)
this.idcard = opt.idcard
},
mounted() {
this.getHospitalList()
this.getCheckType()
},
methods: {
// app/getCareerHospital
getHospitalList() {
const params = {
token: this.token,
idcard: this.idcard
}
console.log('🚀 ~ getHospitalList ~ params:', params)
uni.request({
url: config.tjBaseUrl + '/app/getCareerHospital',
method: 'post',
data: params,
header: {
'Content-Type': 'application/x-www-form-urlencoded',
token: this.token
},
success: res => {
res = res.data
console.log('🚀 ~ getHospitalList ~ res:', res)
if (res.res == 1) {
this.hospitalList = res.obj
// this.hospitalInfo = res.obj[0]
// this.columns , pushcolumns
this.columns.push(this.hospitalList)
console.log('🚀 ~ getHospitalList ~ this.hospitalList:', this.hospitalList)
}
},
fail: err => {
console.log('🚀 ~ getHospitalList ~ err:', err)
}
})
},
//
getCheckType() {
const params = {
token: this.token,
idcard: this.idcard
}
console.log('🚀 ~ getCheckType ~ params:', params)
uni.request({
url: config.tjBaseUrl + '/app/getPhysicalExamination',
method: 'post',
data: params,
header: {
'Content-Type': 'application/x-www-form-urlencoded',
token: this.token
},
success: res => {
res = res.data
console.log('🚀 ~ getCheckType ~ res:', res)
if (res.res == 1) {
this.checkTypeList = res.obj
}
},
fail: err => {
console.log('🚀 ~ getCheckType ~ err:', err)
}
})
},
//
confirmHospital(e) {
console.log('🚀 ~ confirmHospital ~ e:', e)
this.hospital = e.value[0].hospitalName
this.hospitalInfo = e.value[0]
console.log('🚀 ~ confirmHospital ~ this.hospitalInfo:', this.hospitalInfo)
if (this.hospitalInfo.id) this.isDisabled = false
this.show = false
},
//
handleCheckType(item, index) {
console.log('🚀 ~ handleCheckType ~ item:', item)
this.active = index
this.checkType = item.text
this.getCheckTypeContent(item)
},
//
getCheckTypeContent(item) {
const params = {
token: this.token,
checkId: item.id,
combType: 2
}
console.log('🚀 ~ getCheckTypeContent ~ params:', params)
uni.request({
url: config.tjBaseUrl + '/app/getexamination',
method: 'post',
data: params,
header: {
'Content-Type': 'application/x-www-form-urlencoded',
token: this.token
},
success: res => {
res = res.data
console.log('🚀 ~ getCheckTypeContent ~ res:', res)
if (res.res == 1) {
this.setMealId = res.obj.tibean[0].id
this.checkTypeContent = res.obj.tibean[0].combName
this.checkTypeContentList = res.obj.tibeanson
}
},
fail: err => {
console.log('🚀 ~ getCheckTypeContent ~ err:', err)
}
})
},
handleShowTime() {
if (this.isDisabled) {
uni.showToast({
title: '请选择医院',
icon: 'none'
})
} else {
this.showTime = true
}
},
getCurrentDate() {
const date = new Date()
const year = date.getFullYear()
const month = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0')
return `${year}-${month}-${day}`
},
//
confirmTime(e) {
console.log('🚀 ~ confirmTime ~ e:', e)
const today = this.getCurrentDate()
if (e[0] == today) {
uni.showToast({
title: '不可以预约今天',
icon: 'none'
})
return
}
this.healthTime = e[0]
this.showTime = false
this.getReservationNumber()
},
//
getReservationNumber() {
const params = {
token: this.token,
hosId: this.hospitalInfo.id,
phyAppontTime: this.healthTime,
type: '2'
}
console.log('🚀 ~ getReservationNumber ~ params:', params)
uni.request({
url: config.tjBaseUrl + '/app/getphyappointnum',
method: 'post',
data: params,
header: {
'Content-Type': 'application/x-www-form-urlencoded',
token: this.token
},
success: res => {
res = res.data
console.log('🚀 ~ getReservationNumber ~ res:', res)
if (res.res == 1) {
this.reservationNumber = res.obj
}
},
fail: err => {
console.log('🚀 ~ getReservationNumber ~ err:', err)
}
})
},
// phyappoint
handleSave() {
const cry = new Crypoto()
const params = {
hospitalId: this.hospitalInfo.id,
setMealId: this.setMealId,
// checkId: '1',
phyAppontTime: this.healthTime,
setMealType: '2',
combName: this.checkTypeContent,
token: this.token
}
console.log('🚀 ~ handleSave ~ params:', params)
console.log('🚀 ~ handleSave ~ params:', cry.encrypt(JSON.stringify(params)))
uni.request({
url: config.tjBaseUrl + '/app/phyappoint',
method: 'post',
// data: { encryptedData: params, token: this.token },
data: params,
header: {
'Content-Type': 'application/x-www-form-urlencoded',
token: this.token
},
success: res => {
res = res.data
console.log('🚀 ~ handleSave ~ res:', res)
if (res.res == 1) {
uni.showToast({
title: '预约成功',
icon: 'success'
})
uni.reLaunch({
// url: '/pages/HealthExaminationApp/index/index'
})
}
},
fail: err => {
console.log('🚀 ~ handleSave ~ err:', err)
}
})
}
}
}
</script>
<style lang="scss" scoped>
.content {
margin: 10px;
padding: 10px;
border-radius: 5px;
background: #fff;
h3 {
margin-bottom: 10px;
}
.hospital-wrapper {
/* display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: center; */
margin-bottom: 20px;
}
.item {
padding: 0 15px;
width: calc(100% -30px);
height: 50px;
display: flex;
justify-content: space-between;
align-items: center;
background: #f5f5f5;
border-radius: 50px;
font-size: 14px;
}
.hospital-name {
font-weight: 600;
font-size: 16px;
color: #1989fa;
line-height: 35px;
}
}
.propup-content {
height: 500px;
padding: 20px;
.title-wrapper {
display: flex;
justify-content: flex-start;
align-items: center;
}
.title {
margin-top: 20px;
color: #333;
display: flex;
flex-direction: column;
align-items: center;
}
.title-tip {
color: #999;
}
.line {
margin: 10px 0;
width: 42px;
height: 2px;
background: #1989fa;
border-radius: 2px;
}
.list-item {
margin-right: 10px;
color: #333;
&.active {
color: #1989fa;
}
}
.cont-title {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 20px;
color: #1989fa;
font-size: 16px;
.cont-icon {
display: flex;
align-items: center;
}
}
.cont-line {
margin-top: 6px;
width: 100%;
height: 1px;
background: #ccc;
}
.contList-wrapper {
max-height: 300px;
overflow: auto;
}
.contList-item {
margin: 10px 0;
color: #333;
display: flex;
flex-direction: column;
justify-content: center;
align-items: flex-start;
word-break: break-all;
overflow: auto;
.cont-title {
font-size: 16px;
color: #1989fa;
line-height: 30px;
}
}
.btn {
//
position: absolute;
bottom: 20px;
left: 20px;
/* width: 80px; */
}
}
.reservation-number {
height: 20px;
margin: 10px;
margin-top: 0;
padding: 10px;
color: #999;
background: #fff;
border-radius: 5px;
font-size: 15px;
/* text-align: start; */
}
</style>

View File

@ -33,10 +33,14 @@
</template>
<script>
import config from '@/config'
export default {
data() {
return {
token: uni.getStorageSync('tjToken'),
isShow: true,
userInfo: {},
selectValue: 0,
homeIcon: '/static/images-tijian/home-selected.png',
myIcon: '/static/images-tijian/my-unselected.png',
@ -53,6 +57,11 @@ export default {
]
}
},
mounted() {
console.log('🚀 ~ mounted ~ mounted:', this.token)
this.getStatus()
this.getAppLoginInfo()
},
methods: {
changeTab(e) {
console.log('🚀 ~ changeTab ~ e:', e)
@ -64,7 +73,64 @@ export default {
//
handlePage(url) {
uni.navigateTo({
url: `/pages/HealthExaminationApp/${url}/${url}`
url: `/pages/HealthExaminationApp/${url}/${url}?params=${JSON.stringify(this.userInfo)}`
})
},
//
getStatus() {
const params = {
token: this.token,
telephone: uni.getStorageSync('tjPhone')
}
console.log('🚀 ~ getStatus ~ params:', params)
uni.request({
url: config.tjBaseUrl + '/app/getStatus',
method: 'post',
data: params,
header: {
'content-type': 'application/x-www-form-urlencoded',
token: this.token
},
success: res => {
console.log('🚀 ~ getStatus ~ res:', res)
// if (res.data.code === 200) {
// if (res.data.data.status === 1) {
// this.isShow = true
// } else {
// this.isShow = false
// }
// }
},
fail: err => {
console.log('🚀 ~ getStatus ~ err:', err)
}
})
},
// app
getAppLoginInfo() {
const params = {
token: this.token
}
console.log('🚀 ~ getapplogininfo ~ params:', params)
uni.request({
url: config.tjBaseUrl + '/app/getapplogininfo',
method: 'post',
data: params,
header: {
'content-type': 'application/x-www-form-urlencoded',
token: this.token
},
success: res => {
res = res.data
console.log('🚀 ~ getapplogininfo ~ res:', res)
if (res.res === 1) {
this.userInfo = res.obj[0]
}
},
fail: err => {
console.log('🚀 ~ getapplogininfo ~ err:', err)
}
})
}
}

View File

@ -0,0 +1,51 @@
<template>
<view>
<div class="img"></div>
<h2 style="text-align: center">恭喜您预约成功</h2>
<div class="btn">
<u-button
type="primary"
shape="circle"
text="返回首页"
plain
style="margin-bottom: 10px"
@click="handleBack"
></u-button>
<u-button type="primary" shape="circle" text="查看预约" @click="handleSee"></u-button>
</div>
</view>
</template>
<script>
export default {
data() {
return {}
},
methods: {
handleBack() {
uni.reLaunch({
url: '/pages/HealthExaminationApp/index/index'
})
},
handleSee() {
uni.reLaunch({
url: '/pages/HealthExaminationApp/myAppointment/myAppointment'
})
}
}
}
</script>
<style lang="scss" scoped>
.img {
margin: 130px auto 0;
width: 344px;
height: 247px;
background: url('/static/images-tijian/success.png') no-repeat;
background-size: 100% 100%;
}
.btn {
margin: 20px 80px;
}
</style>

View File

@ -1,19 +1,20 @@
<template>
<view>
我的预约
</view>
<div>
</div>
</template>
<script>
export default {
data() {
return {
};
return {}
},
methods: {
}
}
</script>
<style lang="scss" scoped>
</style>
</style>

View File

@ -62,7 +62,7 @@ export default {
content: '是否确认进入考试?',
examId: '',
examNum: 0, //
examCount: 1, // 1: 2: 3:
examCount: '', // 1: 2: 3:
examCustom: 0, //
score: 0,
passScore: 0
@ -75,6 +75,10 @@ export default {
this.title = opt.name
this.subtitle = opt.validityDate
this.duration = opt.responseTime
this.examNum = opt.examNum
this.count = opt.examCount === 1 ? '不限次' : opt.examCount === 2 ? '及格终止' : opt.examCustom
this.examCount = opt.examCount
this.examCustom = opt.examCustom
this.switchCount = opt.cutNum.includes('null') || opt.cutNum.includes('undefined') ? '不限次' : opt.cutNum
this.studyId = opt.studyId
this.score = opt.score

View File

@ -95,11 +95,13 @@ export default {
},
success: res => {
console.log('🚀 ~ getList ~ res:', res)
this.activeIndex = 0
res = res.data
this.list = this.allList
this.allList = this.list = res.data
this.waitList = res.data.filter(item => item.status === 1)
this.alreadyList = res.data.filter(item => item.status === 2)
this.absentList = res.data.filter(item => item.status === 3 && item.examNum === 0)
},
fail: err => {
console.log(err)
@ -121,6 +123,19 @@ export default {
//
handleExamination(item) {
console.log('🚀 ~ handleExamination ~ item:', item)
// item.validityDate 2021-09-01~2021-09-30 ,
const date = new Date()
const year = date.getFullYear()
const month = date.getMonth() + 1
const day = date.getDate()
const today = `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`
if (today < item.validityDate.split('~')[0] || today > item.validityDate.split('~')[1]) {
uni.showToast({
title: '当前时间不在考试时间范围内',
icon: 'none'
})
return
}
if (item.examEquipment == 2) {
uni.showToast({
title: '请在电脑端进行考试',
@ -151,7 +166,7 @@ export default {
examNum: item.examNum, //
examCount: item.examCount, //
examCustom: item.examCustom, //
score: item.score, //
score: item.score, //
passScore: item.passScore //
}
uni.navigateTo({

View File

@ -66,15 +66,24 @@
@click="clickImg(fileUrl + item.examTopicUrl)"
/>
<div class="options">
<div
class="option"
v-for="(option, optionIndex) in item.listOption"
:key="optionIndex"
:class="{ isActive: option.isActive }"
@click="handleSelectOption(item, index, option, optionIndex)"
>
<div class="option-item">{{ option.optionIdent }}.</div>
<div class="option-content">{{ option.optionContent }}</div>
<div class="option-wrapper" v-for="(option, optionIndex) in item.listOption" :key="optionIndex">
<div
class="option"
:class="{ isActive: option.isActive }"
@click="handleSelectOption(item, index, option, optionIndex)"
>
<div class="option-item">{{ option.optionIdent }}.</div>
<div class="option-content">{{ option.optionContent }}</div>
</div>
<u--image
v-if="option.optionUrl"
:showLoading="true"
:src="fileUrl + option.optionUrl || ''"
width="60px"
height="60px"
style="margin-bottom: 10px"
@click="clickImg(fileUrl + option.optionUrl)"
/>
</div>
</div>
</div>
@ -391,7 +400,7 @@ export default {
examTime: this.examTime,
questionCount: this.questionList.length,
switchCount: this.switchCount,
examNum: this.examNum,
examNum: this.examNum + 1,
examCount: this.examCount,
examCustom: this.examCustom,
results: res.examResult,
@ -626,27 +635,32 @@ export default {
}
.options {
margin-top: 10px;
.option {
display: flex;
justify-content: flex-start;
align-items: center;
margin-top: 10px;
background: #f4f9fe;
border-radius: 5px;
&.isActive {
background: #8cbff1;
color: #fff;
}
.option-item {
width: 33px;
height: 33px;
line-height: 33px;
text-align: center;
color: #333;
}
.option-content {
margin-left: 10px;
color: #333;
margin-bottom: 30px;
.option-wrapper {
max-height: 500px;
overflow: auto;
.option {
display: flex;
justify-content: flex-start;
align-items: center;
margin-top: 10px;
background: #f4f9fe;
border-radius: 5px;
&.isActive {
background: #8cbff1;
color: #fff;
}
.option-item {
width: 33px;
height: 33px;
line-height: 33px;
text-align: center;
color: #333;
}
.option-content {
margin-left: 10px;
color: #333;
}
}
}
}

View File

@ -94,7 +94,7 @@ export default {
questionCount: 0,
//
examNum: 0,
examCount: 1, // 1: 2: 3:
examCount: '', // 1: 2: 3:
examCustom: 0, //
results: 0, //
studyId: '',
@ -138,7 +138,7 @@ export default {
} else {
from = '/pages/YNEduApp/exam/exam'
}
// examCount 1: 2: 3:
if (this.examCount == 2 && this.results == 1) {
uni.showToast({
@ -146,7 +146,7 @@ export default {
icon: 'none'
})
setTimeout(() => {
uni.navigateTo({
uni.reLaunch({
url: from
})
}, 1000)
@ -156,23 +156,24 @@ export default {
icon: 'none'
})
setTimeout(() => {
uni.navigateTo({
uni.reLaunch({
url: from
})
}, 1000)
} else {
const params = {
examId: this.examId,
examNum: this.examNum,
examCount: this.examCount,
examCustom: this.examCustom,
switchCount: this.switchCount,
studyId: this.studyId
}
console.log('🚀 ~ handleResetExamination ~ params:', params)
uni.navigateTo({
url: `/pages/YNEduApp/exam/examination?params=${JSON.stringify(params)}`
})
}
const params = {
examId: this.examId,
examNum: this.examNum,
examCount: this.examCount,
examCustom: this.examCustom,
switchCount: this.switchCount,
studyId: this.studyId
}
console.log('🚀 ~ handleResetExamination ~ params:', params)
uni.navigateTo({
url: `/pages/YNEduApp/exam/examination?params=${JSON.stringify(params)}`
})
},
handleArrow() {
let from = ''

View File

@ -45,7 +45,7 @@
height="8"
activeColor="#579AF8"
/>
<div>{{ item.trainPercentage }}%</div>
<div>{{ item.trainPercentage || 0 }}%</div>
</div>
</div>
<view class="no-task" v-show="!taskList || taskList.length === 0">

View File

@ -53,7 +53,8 @@ export default {
//
currentTime: 0,
showModal: false, //
content: '是否确认结束学习?'
content: '是否确认结束学习?',
isEnd: false
}
},
onLoad(opt) {
@ -69,11 +70,24 @@ export default {
console.log('🚀 ~ onLoad ~ this.path:', this.path)
this.studyDuration = this.currentTime = Number(opt.studyDuration)
this.allStudyDuration = Number(opt.allStudyDuration)
this.isEnd = opt.isEnd
if (opt.isEnd) {
this.studyDuration = 0
}
},
onHide() {
console.log('🚀 ~ onHide ~ 页面隐藏')
if (!this.isEnd) {
//
this.handleEnd()
}
},
onUnload() {
console.log('🚀 ~ onUnload ~ 页面关闭')
//
this.handleEnd()
if (!this.isEnd) {
//
this.handleEnd()
}
},
methods: {
videoErrorCallback(e) {
@ -89,6 +103,12 @@ export default {
},
//
handleEnd() {
if (this.isEnd) {
uni.reLaunch({
url: '/pages/YNEduApp/learnProj/learnProjDetail?id=' + this.studyId
})
return
}
//
const video = uni.createVideoContext('myVideo')
video.pause()
@ -96,7 +116,10 @@ export default {
console.log('当前播放时间:', this.currentTime, this.allStudyDuration)
this.studyDuration = this.currentTime
//
this.studyPercentage = Math.ceil((this.studyDuration / this.allStudyDuration) * 100).toFixed(2)
this.studyPercentage =
Math.ceil((this.studyDuration / this.allStudyDuration) * 100).toFixed(2) > 100
? 100
: Math.ceil((this.studyDuration / this.allStudyDuration) * 100).toFixed(2)
console.log('🚀 ~ handleEnd ~ this.studyPercentage:', this.studyPercentage)
const params = {
@ -127,7 +150,7 @@ export default {
success: res => {
console.log('🚀 ~ handleEnd ~ res:', res)
this.showModal = false
uni.navigateTo({
uni.reLaunch({
url: '/pages/YNEduApp/learnProj/learnProjDetail?id=' + this.studyId
})
},

View File

@ -276,7 +276,8 @@ export default {
sourceId: item.id, // id
path: item.path, //
studyDuration: item.studyDuration || 0, //
allStudyDuration: item.allStudyDuration //
allStudyDuration: item.allStudyDuration, //
isEnd: item.studyPercentage >= 100 ? true : false
}
console.log('🚀 ~ toggleTheoryLearn ~ params:', params)
console.log('🚀 ~ toggleTheoryLearn ~ item:', item.path)

View File

@ -376,6 +376,39 @@ export default {
console.log('🚀 ~ handleJump ~ res:', res)
res = res.data
this.questionList.push(res.data)
if (res.data.selectAnswer) {
if (this.questionList[0].examType === 2) {
this.questionList[0].select = res.data.selectAnswer.split('')
this.questionList[0].isSelect = true
// selectAnswer,
this.questionList[0].listOption.forEach(item => {
if (res.data.selectAnswer.includes(item.optionIdent)) {
item.isSelect = true
}
if (item.optionIdent === this.questionList[0].correctGrade) {
item.isCorrect = true
}
if (item.isSelect && !this.questionList[0].correctGrade.includes(item.optionIdent)) {
item.isError = true
}
})
} else {
this.questionList[0].select = res.data.selectAnswer
this.questionList[0].isSelect = true
// selectAnswer,
this.questionList[0].listOption.forEach(item => {
if (res.data.selectAnswer === item.optionIdent) {
item.isSelect = true
}
if (item.optionIdent === this.questionList[0].correctGrade) {
item.isCorrect = true
}
if (item.isSelect && item.optionIdent !== this.questionList[0].correctGrade) {
item.isError = true
}
})
}
}
},
fail: err => {
console.log(err)

View File

@ -197,7 +197,7 @@
jwtToken: uni.getStorageSync('App-Token')
}
const tjparams = {
username: '13908860263',
username: '13708411772',
password: 'YNsbd@123456'
}
console.log('🚀 ~ gotoYy ~ tjparams:', tjparams)
@ -251,7 +251,10 @@
console.log('🚀 ~ gotoYy ~ res:', res,)
console.log('🚀 ~ gotoYy ~ res:', res.data.token)
if (res.statusCode == 200) {
uni.removeStorageSync('tjToken')
uni.removeStorageSync('tjPhone')
uni.setStorageSync('tjToken', res.data.token)
uni.setStorageSync('tjPhone', tjparams.username)
setTimeout(() => {
uni.reLaunch({
url: '/pages/HealthExaminationApp/index/index'

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

35
utils/aescbc.js Normal file
View File

@ -0,0 +1,35 @@
import CryptoJS from 'crypto-js'
export default class Crypoto {
key = CryptoJS.enc.Utf8.parse('zhgd@bonus@zhgd@bonus@1234567890') // 这里找后端要;
iv = CryptoJS.enc.Utf8.parse('1234567812345678')
/* 加密 */
encrypt(word) {
let aqEnnable = true
if (!aqEnnable) {
return word
}
var srcs = CryptoJS.enc.Utf8.parse(word)
var encrypted = CryptoJS.AES.encrypt(srcs, this.key, {
iv: this.iv,
mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.Pkcs7
})
return encrypted.toString()
}
encrypts(word) {
const srcs = CryptoJS.enc.Utf8.parse(word)
const encrypted = CryptoJS.AES.encrypt(srcs, this.key, {
iv: this.iv,
mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.Pkcs7
})
const ciphertext = encrypted.ciphertext.toString(CryptoJS.enc.Base64url) // 将加密结果转换为 Base64URL 格式 确认后端要的是Base64URL 还是Base64 这两种编码格式不一样
return ciphertext
}
decrypt
}

View File

@ -16,13 +16,7 @@ const request = config => {
config.header['Authorization'] = 'Bearer ' + getToken()
} else {
// 没有token - 去登录
// store.dispatch('LogOut').then(() => {
// uni.reLaunch({ url: '/pages/login' })
// })
// const token = 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX2lkIjozMSwidXNlcl9rZXkiOiJiZmJmOGEzZC1hYTc1LTQ4MzQtOGM3NC0yZmQzOTEwZDllYzAiLCJ1c2VybmFtZSI6IuaWueS6riJ9.kv1WmthbgTrqapbsGLvevk-nwbWbYJMniyjj8DC3BSnQjCwm8csQ5GaNpfsLFFFYIHBYa8CrN_sBxXhDKOfR_A'
// const userId = 31
// setUserId(userId)
// setToken(token)
uni.reLaunch({ url: '/pages/login' })
}
// get请求映射params参数
if (config.params) {