Merge remote-tracking branch 'origin/hyx_2025-01-13_xgf2.0' into hyx_2025-01-13_xgf2.0

hyx_2025-01-13_xgf2.0
liujun 2025-03-20 18:32:00 +08:00
commit 28a6a65387
5 changed files with 267 additions and 227 deletions

View File

@ -435,8 +435,7 @@ export default {
}, 2000) }, 2000)
}).catch((e) => { }).catch((e) => {
console.info(e) console.info(e)
// uni.$u.toast('') uni.$u.toast('请补全必填项')
uni.$u.toast(e)
}) })
} }
}, },

View File

@ -26,16 +26,9 @@
</view> </view>
</view> </view>
</view> </view>
<u-modal <u-modal :show="updateVersion.modalShow" title="温馨提示" :showConfirmButton="updateVersion.showConfirmButton"
:show="updateVersion.modalShow" :showCancelButton="updateVersion.showCancelButton" :confirmText="updateVersion.confirmText"
title="温馨提示" :cancelText="updateVersion.cancelText" @cancel="modalCancel" @confirm="modalConfirm">
:showConfirmButton="updateVersion.showConfirmButton"
:showCancelButton="updateVersion.showCancelButton"
:confirmText="updateVersion.confirmText"
:cancelText="updateVersion.cancelText"
@cancel="modalCancel"
@confirm="modalConfirm"
>
<view style="text-align: center; color: #606266"> <view style="text-align: center; color: #606266">
<rich-text :nodes="updateVersion.modalContent"></rich-text> <rich-text :nodes="updateVersion.modalContent"></rich-text>
</view> </view>
@ -45,220 +38,255 @@
</template> </template>
<script> <script>
import updateVersion from '../../utils/updateVersion' import updateVersion from '../../utils/updateVersion'
import {setEntry, getIsUploadFace, getClassInfoByParams, getClassList} from '../../api' import {
import { getStudentInfoApi, setEntryV1} from "../../api/api"; setEntry,
import store from "../../store"; getIsUploadFace,
getClassInfoByParams,
getClassList
} from '../../api'
import {
getStudentInfoApi,
setEntryV1
} from "../../api/api";
import store from "../../store";
export default { export default {
mixins: [updateVersion], mixins: [updateVersion],
data() { data() {
return { return {
baseList: [ baseList: [{
{ img: require('../../static/icon-apps/app_icons.png'),
img: require('../../static/icon-apps/app_icons.png'), title: '电子工牌',
title: '电子工牌', url: '/pages/electronic_work_card/index'
url: '/pages/electronic_work_card/index' },
}, {
{ img: require('../../static/icon-apps/app_icons2.png'),
img: require('../../static/icon-apps/app_icons2.png'), title: '服务单位 管理',
title: '服务单位 管理', url: '/pages/service_unit_management/index'
url: '/pages/service_unit_management/index' },
}, {
{ img: require('../../static/icon-apps/app_icons3.png'),
img: require('../../static/icon-apps/app_icons3.png'), title: '我的信息',
title: '我的信息', url: '/pages/mine/information/index'
url: '/pages/mine/information/index' },
}, {
{ img: require('../../static/icon-apps/app_icons4.png'),
img: require('../../static/icon-apps/app_icons4.png'), title: '证书信息',
title: '证书信息', url: '/pages/certificate_information/index'
url: '/pages/certificate_information/index' },
}, {
{ img: require('../../static/icon-apps/app_icons5.png'),
img: require('../../static/icon-apps/app_icons5.png'), title: '就职单位',
title: '就职单位', url: '/pages/employed_by/index'
url: '/pages/employed_by/index' },
}, {
{ img: require('../../static/icon-apps/app_icons7.png'),
img: require('../../static/icon-apps/app_icons7.png'), title: '高危作业',
title: '高危作业', url: '/pages/eight_assignments/index'
url: '/pages/eight_assignments/index' },
}, {
{ img: require('../../static/icon-apps/app_icons8.png'),
img: require('../../static/icon-apps/app_icons8.png'), title: '培训管理',
title: '培训管理', url: '/pages/train_management/index'
url: '/pages/train_management/index' }
} ],
] classInfo: null,
} }
},
computed: {
userInfo() {
return this.$store.getters.getUserInfo
}
},
onLoad() {
if (this.$store.getters.getUserInfo.USER_ID) {
// , /utils/updateVersion.js
this.fnUpdateVersion(false)
this.getUserFaceCompleted()
}
},
methods: {
handleGetClassInfoByParams(classId) {
return new Promise(async (resolve, reject) => {
const userInfo = store.getters.getUserInfo
await getClassInfoByParams({
classId,
userId: userInfo.USER_ID
})
.then((resData) => {
resolve(resData.classInfo)
})
.catch(() => {
uni.$u.toast('网络开小差了,请稍后尝试')
reject()
})
})
}, },
async fnScan() { computed: {
uni.scanCode({ userInfo() {
success: async (res) => { return this.$store.getters.getUserInfo
// let obj = JSON.parse(res.result) }
// let type = obj[0].CODE_TYPE },
const { classId, type, RELEVANT_UNIT_NAME } = JSON.parse(res.result) onLoad() {
const classInfo = await this.handleGetClassInfoByParams(classId); if (this.$store.getters.getUserInfo.USER_ID) {
const resData = await getStudentInfoApi({classId:classInfo.classId}) // , /utils/updateVersion.js
await this.$store.dispatch('setStudentInfo', resData.studentInfo) this.fnUpdateVersion(false)
switch(type) { this.getUserFaceCompleted()
case "0": { }
let info = await setEntryV1({ },
userId: this.userInfo.USER_ID, methods: {
// corpinfoId: obj[0].CORPINFO_ID, handleGetClassInfoByParams(classId) {
RELEVANT_UNIT_NAME: RELEVANT_UNIT_NAME, return new Promise(async (resolve, reject) => {
postMethod: 'application/json' const userInfo = store.getters.getUserInfo
await getClassInfoByParams({
classId,
userId: userInfo.USER_ID
}) })
if (info.code === 200) { .then((resData) => {
uni.$u.toast('入职成功') resolve(resData.classInfo)
} else { })
uni.$u.toast('入职失败,请联系管理员') .catch(() => {
} uni.$u.toast('网络开小差了,请稍后尝试')
break; reject()
}; })
// case "1": { })
// // type=1 },
// uni.$u.route({ async fnScan() {
// url: '/pages/electronic_work_card/index', this.classInfo = null; // classInfo
// params: { uni.scanCode({
// USER_ID: obj[0].USER_ID, success: async (res) => {
// CODE_TYPE: obj[0].CODE_TYPE // let obj = JSON.parse(res.result)
// } // let type = obj[0].CODE_TYPE
// }) const {
// break; classId,
// }; stageexampaperinputId,
case "2": { type,
// , [type: 2 --> ] CORPINFO_ID,
if (store.getters.getVerification === '0') { RELEVANT_UNIT_NAME
uni.showModal({ } = JSON.parse(res.result);
title: '温馨提示', if (type !== '0') {
content: '检测到您还未完成人脸信息读取,请先完成人脸信息认证!', this.classInfo = await this.handleGetClassInfoByParams(classId);
success: function (res) { const resData = await getStudentInfoApi({
if (res.confirm) { classId: this.classInfo.classId
uni.$u.route({ })
url: '/pages/train_management/face_authentication', await this.$store.dispatch('setStudentInfo', resData.studentInfo)
params: { }
type: 'facial_input' switch (type) {
} case "0": {
}) let info = await setEntryV1({
} userId: this.userInfo.USER_ID,
if (res.cancel) { corpinfoId: CORPINFO_ID,
uni.navigateBack({ delta: 1 }) RELEVANT_UNIT_NAME: RELEVANT_UNIT_NAME,
} postMethod: 'application/json'
}
})
}
if (classInfo) {
uni.$u.route({
url: '/pages/train_management/realname_info_auth',
params: {
type: 'scan_face',
classId
}
}) })
} else { if (info.code === 200) {
uni.$u.toast('您未在培训计划内,无法入班签到,请联系教师') uni.$u.toast('入职成功')
} else {
uni.$u.toast('入职失败,请联系管理员')
}
break;
} }
break; // case "1": {
}; // // type=1
case "3": { // uni.$u.route({
// [type: 3 --> ] // url: '/pages/electronic_work_card/index',
if (classInfo) { // params: {
// USER_ID: obj[0].USER_ID,
// CODE_TYPE: obj[0].CODE_TYPE
// }
// })
// break;
// };
case "2": {
// , [type: 2 --> ]
if (store.getters.getVerification === '0') {
uni.showModal({
title: '温馨提示',
content: '检测到您还未完成人脸信息读取,请先完成人脸信息认证!',
success: function(res) {
if (res.confirm) {
uni.$u.route({
url: '/pages/train_management/face_authentication',
params: {
type: 'facial_input'
}
})
}
if (res.cancel) {
uni.navigateBack({
delta: 1
})
}
}
})
}
if (store.getters.getVerification === '1') {
if (this.classInfo) {
if (this.classInfo.studystate === "3") {
uni.$u.toast("您已经入班签到,无需再次签到!")
return;
}
uni.$u.route({
url: '/pages/train_management/realname_info_auth',
params: {
type: 'scan_face',
classId
}
})
} else {
uni.$u.toast('您未在培训计划内,无法入班签到,请联系教师')
}
} else {
uni.$u.toast('您还未完成人脸信息读取,请先完成人脸信息认证!')
}
break;
}
case "3": {
// [type: 3 --> ]
if (store.getters.getVerification === '1') {
if (this.classInfo) {
uni.$u.route({
url: '/pages/train_management/face_authentication',
params: {
type: 'learning_certification',
stageexampaperinputId,
classId,
}
})
} else {
uni.$u.toast('您未在培训计划内,无法进行考试,请联系教师')
}
} else {
uni.$u.toast('您还未完成人脸信息读取,请先完成人脸信息认证!')
}
break;
}
default: {
break;
}
}
}
})
},
fnIsShow(index) {
if (index === 5) return !!this.userInfo.CORPINFO_ID
return true
},
fnNavigator(e) {
uni.$u.route({
url: this.baseList[e].url
})
},
/**
* 获取是否已经完成上传人脸信息
*/
async getUserFaceCompleted() {
const userFaceData = await getIsUploadFace()
// userFaceData.authentication --> 0:
// userFaceData.authentication --> 1:
this.$store.dispatch('setVerification', userFaceData.authentication ? userFaceData.authentication :
"0"); //
const isPassedVerification = userFaceData.authentication === '0'
if (isPassedVerification) {
uni.showModal({
title: '温馨提示',
content: '为了能够得到更好的体验,我们会获取您个人信息,请完成人脸信息认证!',
success: function(res) {
if (res.confirm) {
uni.$u.route({ uni.$u.route({
url: '/pages/train_management/face_authentication', url: '/pages/train_management/face_authentication',
params: { params: {
type: 'learning_certification', type: 'facial_input'
stageexampaperinputId,
classId,
} }
}) })
} else {
uni.$u.toast('您未在培训计划内,无法进行考试,请联系教师')
} }
break; if (res.cancel) {
uni.$u.toast("您可进入[我的]-[人脸认证]完成信息认证")
}
} }
default: { })
break;
};
}
} }
})
},
fnIsShow(index) {
if (index === 5) return !!this.userInfo.CORPINFO_ID
return true
},
fnNavigator(e) {
uni.$u.route({
url: this.baseList[e].url
})
},
/**
* 获取是否已经完成上传人脸信息
*/
async getUserFaceCompleted() {
const userFaceData = await getIsUploadFace()
// userFaceData.authentication --> 0:
// userFaceData.authentication --> 1:
this.$store.dispatch('setVerification', userFaceData.authentication ? userFaceData.authentication : "0"); //
const isPassedVerification = userFaceData.authentication === '0'
if (isPassedVerification) {
uni.showModal({
title: '温馨提示',
content: '为了能够得到更好的体验,我们会获取您个人信息,请完成人脸信息认证!',
success: function (res) {
if (res.confirm) {
uni.$u.route({
url: '/pages/train_management/face_authentication',
params: {
type: 'facial_input'
}
})
}
if (res.cancel) {
uni.$u.toast("您可进入[我的]-[人脸认证]完成信息认证")
}
}
})
} }
} }
} }
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.page { .page {
background-color: #f7f9ff; background-color: #f7f9ff;
min-height: 100vh; min-height: 100vh;
} }
</style> </style>

View File

@ -43,6 +43,7 @@
}, 1000) }, 1000)
}, },
onLoad(query) { onLoad(query) {
console.log('query: >> ', query)
// facial_input 人脸认证 isFirst 1 第一次登录添加人脸 // facial_input 人脸认证 isFirst 1 第一次登录添加人脸
// scan_face 扫码 // scan_face 扫码
// update_facial_input 更新人脸 // update_facial_input 更新人脸
@ -61,25 +62,18 @@
// this.showButton = query.showButton || "yes"; // this.showButton = query.showButton || "yes";
this.routeQueryparams = query ?? {} this.routeQueryparams = query ?? {}
}, },
onBackPress(event) { // onBackPress(event) {
// if (event.from === 'backbutton') { // return false
// if ((this.type === 'scan_face' && this.isFirst === '1') || this.type === 'learning_certification' || this.type === 'facial_input') { // },
// uni.$u.toast('请完成人脸验证')
// return true
// }
// }
if (this.type === 'facial_input') {
uni.$u.route({
type: 'redirect',
url: '/pages/index/index',
})
}
return false
},
onUnload() { onUnload() {
this.startPreviewTimer && clearInterval(this.startPreviewTimer) this.startPreviewTimer && clearInterval(this.startPreviewTimer)
}, },
methods: { methods: {
handleBack() {
uni.navigateBack({
delta: 2,
})
},
snapshot() { snapshot() {
uni.showLoading({ uni.showLoading({
title: '加载中' title: '加载中'

View File

@ -31,7 +31,7 @@
<view> <text class="content_label">任务状态: </text>{{ handleCalcTaskStatus(item.state) }} </view> <view> <text class="content_label">任务状态: </text>{{ handleCalcTaskStatus(item.state) }} </view>
<view class="action-row"> <view class="action-row">
<u-button size="mini" type="primary" text="签到信息" :disabled="item.userSignPath === '0'" @click="signInInformation(item.classId)" /> <u-button size="mini" type="primary" text="签到信息" :disabled="item.userSignPath === '0'" @click="signInInformation(item.classId)" />
<u-button size="mini" type="primary" text="考试记录" :disabled="item.stageexamstate === '1' || item.stageexamstate === '4'" @click="ExamRecord(item)" /> <u-button v-if="item.examination === '1'" size="mini" type="primary" text="考试记录" :disabled="item.stageexamstate === '1' || item.stageexamstate === '4'" @click="ExamRecord(item)" />
</view> </view>
</view> </view>
</view> </view>
@ -46,7 +46,7 @@
<script> <script>
import store from '@/store/index' import store from '@/store/index'
import {getClassInfoByParams, getClassList} from "../../api"; import {getClassInfoByParams, getClassList, getExamExercises} from "../../api";
import {getStudentInfoApi} from "../../api/api"; import {getStudentInfoApi} from "../../api/api";
export default { export default {
@ -127,6 +127,10 @@ export default {
if (type === '2') { if (type === '2') {
// , [type: 2 --> ] // , [type: 2 --> ]
if (classInfo) { if (classInfo) {
if (classInfo.studystate === "3") {
uni.$u.toast("您已经入班签到,无需再次签到!")
return;
}
uni.$u.route({ uni.$u.route({
url: '/pages/train_management/realname_info_auth', url: '/pages/train_management/realname_info_auth',
params: { params: {
@ -140,6 +144,19 @@ export default {
} else if (type === '3') { } else if (type === '3') {
// [type: 3 --> ] // [type: 3 --> ]
if (classInfo) { if (classInfo) {
console.log('classInfo :>> ', classInfo);
if (classInfo.stageexamstate === "3") {
uni.$u.toast("您已经考试通过,无需再次考试!")
return;
}
const resData = await getExamExercises({
stageexampaperinputId,
classId,
})
if (resData.numberofexams <= 0) {
uni.$u.toast("您的考试次数已用尽,无法再次考试!")
return;
}
uni.$u.route({ uni.$u.route({
url: '/pages/train_management/face_authentication', url: '/pages/train_management/face_authentication',
params: { params: {

View File

@ -19,7 +19,8 @@
</template> </template>
<script> <script>
import { getSignInfo } from '@/api'
import {getSignInfo} from "../../api";
export default { export default {
data() { data() {
@ -93,6 +94,7 @@ export default {
classId classId
}); });
this.signInfo = resData.page.list[0] this.signInfo = resData.page.list[0]
console.log(this.signInfo);
}, },
} }
} }