diff --git a/api/index.js b/api/index.js index 1808746..ba9a434 100644 --- a/api/index.js +++ b/api/index.js @@ -68,3 +68,7 @@ export const setSecurityMeasuresSave = (params) => post("/app/Task/setQues", par export const setOtherSecurityMeasuresSave = (params) => post("/app/Task/setOtherQues", params) //其它安全措施提交 export const getHistoricalApprovalRecords = (params) => post("/app/Task/getHis", params); // 历史审批记录 // 结束 + +// 以下接口培训管理流程使用 +export const getClassList = (params) => post("/app/stagestudentrelation/pageTaskByUser", params); // 历史审批记录 +// 结束 diff --git a/pages/train_management/index.vue b/pages/train_management/index.vue index 57d4d9b..f37bb0b 100644 --- a/pages/train_management/index.vue +++ b/pages/train_management/index.vue @@ -1,217 +1,220 @@ <template> - <view class="content"> - <u-list @scrolltolower="scrolltolower"> - <u-list-item v-for="(item, index) in trainList" :key="index"> - <view class="container_item"> - <view class="container_item_name"> - <text>{{ item.className }}</text> - </view> + <view class="content"> + <u-list @scrolltolower="scrolltolower"> + <u-list-item v-for="(item, index) in trainList" :key="index"> + <view class="container_item"> + <view class="container_item_name"> + <text>{{ item.className }}</text> + </view> - <view class="container_item_content"> - <view class="content_text"> - <view> - <text class="content_label">所属单位: </text> - <text class="content_value">{{ item.unit }}</text> - </view> - </view> - <view class="content_text"> - <view> - <text class="content_label">培训开始时间: </text> - <text class="content_value">{{ item.trainStartTime }}</text> - </view> - </view> - <view class="content_text"> - <view> - <text class="content_label">培训结束时间: </text> - <text class="content_value">{{ item.trainEndTime }}</text> - </view> - </view> - <view class="content_text"> - <view class="content_bottom"> - <view> - <text class="content_label">任务状态: </text>{{ handleCalcTaskStatus(item.taskStatus) }} - </view> - <view class="action-row"> - <u-button size="mini" type="primary" text="签到信息" @click="signInInformation(item.classId)" /> - <u-button size="mini" type="primary" text="考试记录" @click="ExamRecord(item.classId)" /> - </view> - </view> - </view> - </view> - </view> - </u-list-item> - </u-list> - </view> + <view class="container_item_content"> + <view class="content_text"> + <view> + <text class="content_label">所属单位: </text> + <text class="content_value">{{ item.unit }}</text> + </view> + </view> + <view class="content_text"> + <view> + <text class="content_label">培训开始时间: </text> + <text class="content_value">{{ item.trainStartTime }}</text> + </view> + </view> + <view class="content_text"> + <view> + <text class="content_label">培训结束时间: </text> + <text class="content_value">{{ item.trainEndTime }}</text> + </view> + </view> + <view class="content_text"> + <view class="content_bottom"> + <view> + <text class="content_label">任务状态: </text>{{ handleCalcTaskStatus(item.taskStatus) }} + </view> + <view class="action-row"> + <u-button size="mini" type="primary" text="签到信息" + @click="signInInformation(item.classId)" /> + <u-button size="mini" type="primary" text="考试记录" + @click="ExamRecord(item.classId)" /> + </view> + </view> + </view> + </view> + </view> + </u-list-item> + </u-list> + </view> </template> <script> -export default { - data() { - return { - pageSize: 10, - currentPage: 1, - totalPage: 0, - trainList: [], - taskStatusMap: { - 0: '未开始', - 1: '进行中' - } - } - }, + import { getClassList } from '../../api'; + export default { + data() { + return { + pageSize: 10, + currentPage: 1, + totalPage: 0, + trainList: [], + taskStatusMap: { + 0: '未开始', + 1: '进行中' + } + } + }, - /* 监听页面显示,页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面 */ - onShow() { - this.resetList() - }, + /* 监听页面显示,页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面 */ + onShow() { + this.resetList() + }, - methods: { - async getData() { - // let resData = await getCertificateInformationList({ - // showCount: this.pageSize, - // currentPage: this.currentPage, - // }); - this.trainList = [ - { - classId: 'f34dzfgerg', - className: '班级名称1', - unit: '所属单位1所属单位1所属单位1所属单位1所属单位1', - trainStartTime: '2025-02-14 09: 40', - trainEndTime: '2025-02-14 18: 00', - taskStatus: 0 // 未开始 - }, - { - classId: 'f34dzfger6', - className: '班级名称2', - unit: '所属单位2', - trainStartTime: '2025-02-12 09: 40', - trainEndTime: '2025-02-12 18: 00', - taskStatus: 1 // 进行中 - } - ] - this.totalPage = 2 - }, - resetList() { - this.pageSize = 10 - this.currentPage = 1 - this.trainList = [] - this.getData() - }, - scrolltolower() { - this.currentPage++ - if (this.totalPage >= this.currentPage) this.getData() - }, - /** - * 右上角自定义扫码图标触发事件 - */ - onNavigationBarButtonTap(e) { - // 只允许通过手机相机扫码 - uni.scanCode({ - // scanType: ['qrCode'], // 仅支持二维码扫码 - onlyFromCamera: false, // 是否只能从相机扫码,不允许从相册选择图片 - hideAlbum: false, // 隐藏相册,不允许从相册选择图片,只能从相机扫码 - success: function (res) { - if (res.result === '0') { - // 签到二维码方式进入 - uni.$u.route({ - url: '/pages/train_management/realname_info_auth', - params: { - type: 'scan_face', - } - }) - } else if (res.result === '1') { - // 考试二维码方式进入 - uni.$u.route({ - url: '/pages/train_management/face_authentication', - params: { - type: 'learning_certification' - } - }) - } - }, - fail: function (error) { - console.log("error :>> ", error) - }, - complete: function (result) { - console.log("扫码完成,正在跳转功能页!") - } - }); - }, - handleCalcTaskStatus(type) { - return this.taskStatusMap[type] - }, - /** - * 签到信息 - */ - signInInformation(classId) { - uni.$u.route({ - url: '/pages/train_management/sign_information', - params: { - classId - } - }) - }, - /** - * 考试记录 - */ - ExamRecord(classId) { - uni.$u.route({ - url: '/pages/train_management/exam_record', - params: { - classId - } - }) - } - } -} + methods: { + async getData() { + let resData = await getClassList({ + showCount: this.pageSize, + currentPage: this.currentPage, + }); + console.log(resData); + // this.trainList = [{ + // classId: 'f34dzfgerg', + // className: '班级名称1', + // unit: '所属单位1所属单位1所属单位1所属单位1所属单位1', + // trainStartTime: '2025-02-14 09: 40', + // trainEndTime: '2025-02-14 18: 00', + // taskStatus: 0 // 未开始 + // }, + // { + // classId: 'f34dzfger6', + // className: '班级名称2', + // unit: '所属单位2', + // trainStartTime: '2025-02-12 09: 40', + // trainEndTime: '2025-02-12 18: 00', + // taskStatus: 1 // 进行中 + // } + // ] + // this.totalPage = 2 + }, + resetList() { + this.pageSize = 10 + this.currentPage = 1 + this.trainList = [] + this.getData() + }, + scrolltolower() { + this.currentPage++ + if (this.totalPage >= this.currentPage) this.getData() + }, + /** + * 右上角自定义扫码图标触发事件 + */ + onNavigationBarButtonTap(e) { + // 只允许通过手机相机扫码 + uni.scanCode({ + // scanType: ['qrCode'], // 仅支持二维码扫码 + onlyFromCamera: false, // 是否只能从相机扫码,不允许从相册选择图片 + hideAlbum: false, // 隐藏相册,不允许从相册选择图片,只能从相机扫码 + success: function(res) { + if (res.result === '0') { + // 签到二维码方式进入 + uni.$u.route({ + url: '/pages/train_management/realname_info_auth', + params: { + type: 'scan_face', + } + }) + } else if (res.result === '1') { + // 考试二维码方式进入 + uni.$u.route({ + url: '/pages/train_management/face_authentication', + params: { + type: 'learning_certification' + } + }) + } + }, + fail: function(error) { + console.log("error :>> ", error) + }, + complete: function(result) { + console.log("扫码完成,正在跳转功能页!") + } + }); + }, + handleCalcTaskStatus(type) { + return this.taskStatusMap[type] + }, + /** + * 签到信息 + */ + signInInformation(classId) { + uni.$u.route({ + url: '/pages/train_management/sign_information', + params: { + classId + } + }) + }, + /** + * 考试记录 + */ + ExamRecord(classId) { + uni.$u.route({ + url: '/pages/train_management/exam_record', + params: { + classId + } + }) + } + } + } </script> <style scoped lang="scss"> -.container_item { - padding-left: 16rpx; + .container_item { + padding-left: 16rpx; - .container_item_name { - font-size: 32rpx; - font-weight: 500; - margin-bottom: 20rpx; - } + .container_item_name { + font-size: 32rpx; + font-weight: 500; + margin-bottom: 20rpx; + } - .container_item_content { - display: flex; - flex-direction: column; - gap: 8rpx; + .container_item_content { + display: flex; + flex-direction: column; + gap: 8rpx; - .content_text { - color: #acafb3; - font-size: 30rpx; + .content_text { + color: #acafb3; + font-size: 30rpx; - .content_label { - display: inline-block; - width: 220rpx; - } + .content_label { + display: inline-block; + width: 220rpx; + } - .content_value { - display: inline-block; - transform: translateY(8rpx); - padding: 0; - width: 452rpx; - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; - } + .content_value { + display: inline-block; + transform: translateY(8rpx); + padding: 0; + width: 452rpx; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + } - .content_bottom { - display: flex; - align-items: center; - justify-content: space-between; - } + .content_bottom { + display: flex; + align-items: center; + justify-content: space-between; + } - .action-row { - display: flex; - align-items: center; - justify-content: center; - gap: 16rpx; - } - } - } -} + .action-row { + display: flex; + align-items: center; + justify-content: center; + gap: 16rpx; + } + } + } + } </style> \ No newline at end of file