commit ed61ba820b944c9fbab54454de6b2e0323637193 Author: zhangyanli Date: Fri Apr 17 16:22:56 2026 +0800 first commit diff --git a/api/index.js b/api/index.js new file mode 100644 index 0000000..1973cae --- /dev/null +++ b/api/index.js @@ -0,0 +1,32 @@ +import {post, upload} from "../utils/request"; +export const login = (params) => post('/admin/check', params) //登录 +export const setChangePassword = (params) => post('/app/user/editUserPwd', params) //修改密码 +export const getExamListTaskByUser = (params) => post('/App/wx/getExamListTaskByUser', params) //应考试的班级列表 +export const getPaperListByCidAndUser = (params) => post('/App/wx/getPaperListByCidAndUser', params) //班级学员试卷信息 +export const submitExamByUser = (params) => post('/App/wx/submitExamByUser', params) //班级学员试卷信息 +export const updateUserIdFile = (params) => upload('/App/wx/headPhoto', params) //上传头像 +export const updStuStartTime = (params) => post('/App/wx/updStuStartTime', params) //考试前更新学员的学习时间 +export const updStuSign = (params) => upload('/App/wx/updStuSign', params) //考试前更新学员的签字 +export const updUserSign = (params) => upload('/App/wx/updUserSign', params) //考试前更新学员的签字 +export const faceRecognition = (params) => upload('/App/wx/faceRecognition', params) //人脸识别 +export const getHeadPhoto = (params) => post('/App/wx/getHeadPhoto', params) //获取基础信息 +// 单次考试成绩 +export const getExamRecordByUser = (params) => post('/App/wx/getExamRecordByUser', params) +// 所有考试记录 +export const getExamRecordListByUser = (params) => post('/App/wx/getExamRecordListByUser', params) +// 所有调查问卷 +export const getUserSurveyListPage = (params) => post('/App/wx/getUserSurveyListPage', params) +// 单个调查问卷 +export const getUserSurveyInfo = (params) => post('/App/wx/getUserSurveyInfo', params) +// 提交调查问卷 +export const surveySubmit = (params) => post('/App/wx/surveySubmit', params) +// 获取用户所在的企业列表 +export const getUserEnterprisePage = (params) => post('/App/wx/getUserEnterprisePage', params) +// 获取信息填报详情 +export const getUserEnterpriseInfo = (params) => post('/App/wx/getUserEnterpriseInfo', params) +// 修改信息填报 +export const updateUserInfo = (params) => post('/App/wx/updateUserInfo', params) +// 上传信息填报头像 +export const updateUserPhoto = (params) => upload('/App/wx/updateUserPhoto', params) +// 获取字典 +export const getDictionaries = (params) => post('/App/wx/getDictionaries', params) diff --git a/app.js b/app.js new file mode 100644 index 0000000..e26f537 --- /dev/null +++ b/app.js @@ -0,0 +1,16 @@ +App({ + onLaunch() { + if (!this.globalData.userInfo.USER_ID) { + wx.reLaunch({ + url: 'pages/login/login' + }) + } else { + wx.switchTab({ + url: '/pages/index/index' + }) + } + }, + globalData: { + userInfo: {}, // 用户信息 + } +}) diff --git a/app.json b/app.json new file mode 100644 index 0000000..8f3c379 --- /dev/null +++ b/app.json @@ -0,0 +1,48 @@ +{ + "pages": [ + "pages/login/login", + "pages/index/index", + "pages/exam/online/online", + "pages/exam/examination/examination", + "pages/exam/imitate/imitate", + "pages/exam/record/record", + "pages/exam/results/results", + "pages/photo/collection", + "pages/mine/index/index", + "pages/mine/aboutus/aboutus", + "pages/mine/survey/survey", + "pages/mine/survey/question", + "pages/mine/changePassword/changePassword", + "pages/sign/sign", + "pages/mine/information/information", + "pages/mine/information/filling" + ], + "usingComponents": { + "line": "/components/line/line" + }, + "tabBar": { + "color": "#898993", + "selectedColor": "#3676f2", + "list": [ + { + "pagePath": "pages/index/index", + "text": "首页", + "iconPath": "/assets/images/tabbar/i1.png", + "selectedIconPath": "/assets/images/tabbar/i1_on.png" + }, + { + "pagePath": "pages/mine/index/index", + "text": "我的", + "iconPath": "/assets/images/tabbar/i4.png", + "selectedIconPath": "/assets/images/tabbar/i4_on.png" + } + ] + }, + "window": { + "backgroundTextStyle": "light", + "navigationBarBackgroundColor": "#0189fa", + "navigationBarTitleText": "金安铸云", + "navigationBarTextStyle": "white" + }, + "sitemapLocation": "sitemap.json" +} \ No newline at end of file diff --git a/app.wxss b/app.wxss new file mode 100644 index 0000000..65b661f --- /dev/null +++ b/app.wxss @@ -0,0 +1,7 @@ +@import "/assets/styles/common.wxss"; +page{ + background-color: #eee !important; + min-height: 100vh; +} + + diff --git a/assets/images/exam/examination/bgimg1.png b/assets/images/exam/examination/bgimg1.png new file mode 100644 index 0000000..004c26a Binary files /dev/null and b/assets/images/exam/examination/bgimg1.png differ diff --git a/assets/images/exam/online/time.png b/assets/images/exam/online/time.png new file mode 100644 index 0000000..9510c6b Binary files /dev/null and b/assets/images/exam/online/time.png differ diff --git a/assets/images/exam/online/write.png b/assets/images/exam/online/write.png new file mode 100644 index 0000000..da81272 Binary files /dev/null and b/assets/images/exam/online/write.png differ diff --git a/assets/images/exam/results/OK.png b/assets/images/exam/results/OK.png new file mode 100644 index 0000000..88179aa Binary files /dev/null and b/assets/images/exam/results/OK.png differ diff --git a/assets/images/exam/results/showbg.png b/assets/images/exam/results/showbg.png new file mode 100644 index 0000000..88972ae Binary files /dev/null and b/assets/images/exam/results/showbg.png differ diff --git a/assets/images/exam/results/wrong.png b/assets/images/exam/results/wrong.png new file mode 100644 index 0000000..a10217c Binary files /dev/null and b/assets/images/exam/results/wrong.png differ diff --git a/assets/images/fenlei.png b/assets/images/fenlei.png new file mode 100644 index 0000000..1968899 Binary files /dev/null and b/assets/images/fenlei.png differ diff --git a/assets/images/index/banner.png b/assets/images/index/banner.png new file mode 100644 index 0000000..6e303f2 Binary files /dev/null and b/assets/images/index/banner.png differ diff --git a/assets/images/index/jilu.png b/assets/images/index/jilu.png new file mode 100644 index 0000000..d1e2b85 Binary files /dev/null and b/assets/images/index/jilu.png differ diff --git a/assets/images/index/kaoshi.png b/assets/images/index/kaoshi.png new file mode 100644 index 0000000..eea3928 Binary files /dev/null and b/assets/images/index/kaoshi.png differ diff --git a/assets/images/index/lianxi.png b/assets/images/index/lianxi.png new file mode 100644 index 0000000..91d1030 Binary files /dev/null and b/assets/images/index/lianxi.png differ diff --git a/assets/images/index/sign.png b/assets/images/index/sign.png new file mode 100644 index 0000000..59a32c4 Binary files /dev/null and b/assets/images/index/sign.png differ diff --git a/assets/images/index/tupian.png b/assets/images/index/tupian.png new file mode 100644 index 0000000..800c820 Binary files /dev/null and b/assets/images/index/tupian.png differ diff --git a/assets/images/login/loginbg.png b/assets/images/login/loginbg.png new file mode 100644 index 0000000..ef3a938 Binary files /dev/null and b/assets/images/login/loginbg.png differ diff --git a/assets/images/login/loginbg.rar b/assets/images/login/loginbg.rar new file mode 100644 index 0000000..a758946 Binary files /dev/null and b/assets/images/login/loginbg.rar differ diff --git a/assets/images/login/paswordico.png b/assets/images/login/paswordico.png new file mode 100644 index 0000000..9aa6a4b Binary files /dev/null and b/assets/images/login/paswordico.png differ diff --git a/assets/images/login/userico.png b/assets/images/login/userico.png new file mode 100644 index 0000000..e56b319 Binary files /dev/null and b/assets/images/login/userico.png differ diff --git a/assets/images/mine/ico1.png b/assets/images/mine/ico1.png new file mode 100644 index 0000000..025acaa Binary files /dev/null and b/assets/images/mine/ico1.png differ diff --git a/assets/images/mine/ico2.png b/assets/images/mine/ico2.png new file mode 100644 index 0000000..639a1e4 Binary files /dev/null and b/assets/images/mine/ico2.png differ diff --git a/assets/images/mine/ico3.png b/assets/images/mine/ico3.png new file mode 100644 index 0000000..0bdba74 Binary files /dev/null and b/assets/images/mine/ico3.png differ diff --git a/assets/images/mine/ico5.png b/assets/images/mine/ico5.png new file mode 100644 index 0000000..e4fbebe Binary files /dev/null and b/assets/images/mine/ico5.png differ diff --git a/assets/images/mine/mybg.png b/assets/images/mine/mybg.png new file mode 100644 index 0000000..ca03507 Binary files /dev/null and b/assets/images/mine/mybg.png differ diff --git a/assets/images/photo/rx.png b/assets/images/photo/rx.png new file mode 100644 index 0000000..db5f7cb Binary files /dev/null and b/assets/images/photo/rx.png differ diff --git a/assets/images/tabbar/i1.png b/assets/images/tabbar/i1.png new file mode 100644 index 0000000..ba6bf29 Binary files /dev/null and b/assets/images/tabbar/i1.png differ diff --git a/assets/images/tabbar/i1_on.png b/assets/images/tabbar/i1_on.png new file mode 100644 index 0000000..df9d432 Binary files /dev/null and b/assets/images/tabbar/i1_on.png differ diff --git a/assets/images/tabbar/i4.png b/assets/images/tabbar/i4.png new file mode 100644 index 0000000..3042f30 Binary files /dev/null and b/assets/images/tabbar/i4.png differ diff --git a/assets/images/tabbar/i4_on.png b/assets/images/tabbar/i4_on.png new file mode 100644 index 0000000..c71400c Binary files /dev/null and b/assets/images/tabbar/i4_on.png differ diff --git a/assets/styles/common.wxss b/assets/styles/common.wxss new file mode 100644 index 0000000..374c5e5 --- /dev/null +++ b/assets/styles/common.wxss @@ -0,0 +1,70 @@ +.line-1 { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.line-2 { + -webkit-line-clamp: 2; +} + +.line-2, +.line-3 { + -webkit-box-orient: vertical; + display: -webkit-box; + overflow: hidden; + text-overflow: ellipsis; +} + +.line-3 { + -webkit-line-clamp: 3; +} + +.placeholder { + height: 100rpx; +} + +.text-blue { + color: #3676f2; +} + +.text-red { + color: #cb4238; +} + +.text-white { + color: #fff; +} + +.text-grey { + color: #979799; +} + +.text-green { + color: #23b576; +} + +.text-yellow { + color: #ffae00; +} + +.mt-10 { + margin-top: 20rpx; +} + +.ml-10 { + margin-left: 20rpx; +} + +.flex-end { + display: flex; + justify-content: flex-end; +} + +.flex-space .van-cell { + justify-content: space-between; +} + +.flex-space .van-cell__title, .flex-space .van-cell__value { + flex: unset !important; +} diff --git a/components/line/line.js b/components/line/line.js new file mode 100644 index 0000000..276f6c8 --- /dev/null +++ b/components/line/line.js @@ -0,0 +1,23 @@ +// components/line/line.js +Component({ + /** + * 组件的属性列表 + */ + properties: { + + }, + + /** + * 组件的初始数据 + */ + data: { + + }, + + /** + * 组件的方法列表 + */ + methods: { + + } +}) diff --git a/components/line/line.json b/components/line/line.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/components/line/line.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/line/line.wxml b/components/line/line.wxml new file mode 100644 index 0000000..a32e289 --- /dev/null +++ b/components/line/line.wxml @@ -0,0 +1 @@ + diff --git a/components/line/line.wxss b/components/line/line.wxss new file mode 100644 index 0000000..28f1420 --- /dev/null +++ b/components/line/line.wxss @@ -0,0 +1,4 @@ +.line { + background-color: #f4f4f4; + height: 10rpx; +} diff --git a/components/sign/sign.js b/components/sign/sign.js new file mode 100644 index 0000000..3a489d5 --- /dev/null +++ b/components/sign/sign.js @@ -0,0 +1,475 @@ +import Toast from '@vant/weapp/toast/toast'; +Component({ + /** + * 组件的属性列表 + */ + properties: { + show: false + }, + + /** + * 组件的初始数据 + */ + data: { + imgList: [], + //签名 + canvasName: 'handWriting', + ctx: '', + canvasWidth: 0, + canvasHeight: 0, + transparent: 1, // 透明度 + selectColor: '#fff', + lineColor: '#1A1A1A', // 颜色 + lineSize: 1.5, // 笔记倍数 + lineMin: 0.5, // 最小笔画半径 + lineMax: 4, // 最大笔画半径 + pressure: 1, // 默认压力 + smoothness: 60, //顺滑度,用60的距离来计算速度 + currentPoint: {}, + currentLine: [], // 当前线条 + firstTouch: true, // 第一次触发 + radius: 1, //画圆的半径 + cutArea: { + top: 0, + right: 0, + bottom: 0, + left: 0 + }, //裁剪区域 + bethelPoint: [], //保存所有线条 生成的贝塞尔点; + lastPoint: 0, + chirography: [], //笔迹 + currentChirography: {}, //当前笔迹 + linePrack: [] //划线轨迹 , 生成线条的实际点 + }, + + attached() { + let canvasName = this.data.canvasName + let ctx = wx.createCanvasContext(canvasName, this) + this.setData({ + ctx: ctx + }) + var query = this.createSelectorQuery(); + query.select('.container').boundingClientRect(rect => { + this.setData({ + canvasWidth: rect.width, + canvasHeight: rect.height + }) + }).exec(); + }, + + /** + * 组件的方法列表 + */ + methods: { + ViewImage(e) { + let files = []; + files.push(e.currentTarget.dataset.url) + wx.previewImage({ + urls: files, + current: e.currentTarget.dataset.url + }); + }, + + // 笔迹开始 + uploadScaleStart(e) { + if (e.type != 'touchstart') return false; + let ctx = this.data.ctx; + ctx.setFillStyle(this.data.lineColor); // 初始线条设置颜色 + ctx.setGlobalAlpha(this.data.transparent); // 设置半透明 + let currentPoint = { + x: e.touches[0].x, + y: e.touches[0].y + } + let currentLine = this.data.currentLine; + currentLine.unshift({ + time: new Date().getTime(), + dis: 0, + x: currentPoint.x, + y: currentPoint.y + }) + this.setData({ + currentPoint, + // currentLine + }) + if (this.data.firstTouch) { + this.setData({ + cutArea: { + top: currentPoint.y, + right: currentPoint.x, + bottom: currentPoint.y, + left: currentPoint.x + }, + firstTouch: false + }) + } + this.pointToLine(currentLine); + }, + // 笔迹移动 + uploadScaleMove(e) { + if (e.type != 'touchmove') return false; + if (e.cancelable) { + // 判断默认行为是否已经被禁用 + if (!e.defaultPrevented) { + e.preventDefault(); + } + } + let point = { + x: e.touches[0].x, + y: e.touches[0].y + } + + //测试裁剪 + if (point.y < this.data.cutArea.top) { + this.data.cutArea.top = point.y; + } + if (point.y < 0) this.data.cutArea.top = 0; + + if (point.x > this.data.cutArea.right) { + this.data.cutArea.right = point.x; + } + if (this.data.canvasWidth - point.x <= 0) { + this.data.cutArea.right = this.data.canvasWidth; + } + if (point.y > this.data.cutArea.bottom) { + this.data.cutArea.bottom = point.y; + } + if (this.data.canvasHeight - point.y <= 0) { + this.data.cutArea.bottom = this.data.canvasHeight; + } + if (point.x < this.data.cutArea.left) { + this.data.cutArea.left = point.x; + } + if (point.x < 0) this.data.cutArea.left = 0; + + this.setData({ + lastPoint: this.data.currentPoint, + currentPoint: point + }) + let currentLine = this.data.currentLine + currentLine.unshift({ + time: new Date().getTime(), + dis: this.distance(this.data.currentPoint, this.data.lastPoint), + x: point.x, + y: point.y + }) + // this.setData({ + // currentLine + // }) + this.pointToLine(currentLine); + }, + // 笔迹结束 + uploadScaleEnd(e) { + if (e.type != 'touchend') return 0; + let point = { + x: e.changedTouches[0].x, + y: e.changedTouches[0].y + } + this.setData({ + lastPoint: this.data.currentPoint, + currentPoint: point + }) + let currentLine = this.data.currentLine + currentLine.unshift({ + time: new Date().getTime(), + dis: this.distance(this.data.currentPoint, this.data.lastPoint), + x: point.x, + y: point.y + }) + // this.setData({ + // currentLine + // }) + if (currentLine.length > 2) { + var info = (currentLine[0].time - currentLine[currentLine.length - 1].time) / currentLine.length; + //$("#info").text(info.toFixed(2)); + } + //一笔结束,保存笔迹的坐标点,清空,当前笔迹 + //增加判断是否在手写区域; + this.pointToLine(currentLine); + var currentChirography = { + lineSize: this.data.lineSize, + lineColor: this.data.lineColor + }; + var chirography = this.data.chirography + chirography.unshift(currentChirography); + this.setData({ + chirography + }) + var linePrack = this.data.linePrack + linePrack.unshift(this.data.currentLine); + this.setData({ + linePrack, + currentLine: [] + }) + }, + retDraw() { + this.data.linePrack = [] + this.data.chirography = [] + this.data.ctx.clearRect(0, 0, 680, 300) + this.data.ctx.draw() + this.hideModal() + }, + + //画两点之间的线条;参数为:line,会绘制最近的开始的两个点; + pointToLine(line) { + this.calcBethelLine(line); + return; + }, + //计算插值的方式; + calcBethelLine(line) { + if (line.length <= 1) { + line[0].r = this.data.radius; + return; + } + let x0, x1, x2, y0, y1, y2, r0, r1, r2, len, lastRadius, dis = 0, + time = 0, + curveValue = 0.5; + if (line.length <= 2) { + x0 = line[1].x + y0 = line[1].y + x2 = line[1].x + (line[0].x - line[1].x) * curveValue; + y2 = line[1].y + (line[0].y - line[1].y) * curveValue; + //x2 = line[1].x; + //y2 = line[1].y; + x1 = x0 + (x2 - x0) * curveValue; + y1 = y0 + (y2 - y0) * curveValue;; + + } else { + x0 = line[2].x + (line[1].x - line[2].x) * curveValue; + y0 = line[2].y + (line[1].y - line[2].y) * curveValue; + x1 = line[1].x; + y1 = line[1].y; + x2 = x1 + (line[0].x - x1) * curveValue; + y2 = y1 + (line[0].y - y1) * curveValue; + } + //从计算公式看,三个点分别是(x0,y0),(x1,y1),(x2,y2) ;(x1,y1)这个是控制点,控制点不会落在曲线上;实际上,这个点还会手写获取的实际点,却落在曲线上 + len = this.distance({ + x: x2, + y: y2 + }, { + x: x0, + y: y0 + }); + lastRadius = this.data.radius; + for (let n = 0; n < line.length - 1; n++) { + dis += line[n].dis; + time += line[n].time - line[n + 1].time; + if (dis > this.data.smoothness) break; + } + this.setData({ + radius: Math.min(time / len * this.data.pressure + this.data.lineMin, this.data.lineMax) * this.data.lineSize + }); + line[0].r = this.data.radius; + //计算笔迹半径; + if (line.length <= 2) { + r0 = (lastRadius + this.data.radius) / 2; + r1 = r0; + r2 = r1; + //return; + } else { + r0 = (line[2].r + line[1].r) / 2; + r1 = line[1].r; + r2 = (line[1].r + line[0].r) / 2; + } + let n = 5; + let point = []; + for (let i = 0; i < n; i++) { + let t = i / (n - 1); + let x = (1 - t) * (1 - t) * x0 + 2 * t * (1 - t) * x1 + t * t * x2; + let y = (1 - t) * (1 - t) * y0 + 2 * t * (1 - t) * y1 + t * t * y2; + let r = lastRadius + (this.data.radius - lastRadius) / n * i; + point.push({ + x: x, + y: y, + r: r + }); + if (point.length == 3) { + let a = this.ctaCalc(point[0].x, point[0].y, point[0].r, point[1].x, point[1].y, point[1].r, point[2].x, point[2].y, point[2].r); + a[0].color = this.data.lineColor; + // let bethelPoint = this.data.bethelPoint; + // bethelPoint = bethelPoint.push(a); + this.bethelDraw(a, 1); + point = [{ + x: x, + y: y, + r: r + }]; + } + } + this.setData({ + currentLine: line + }) + }, + //求两点之间距离 + distance(a, b) { + let x = b.x - a.x; + let y = b.y - a.y; + return Math.sqrt(x * x + y * y); + }, + ctaCalc(x0, y0, r0, x1, y1, r1, x2, y2, r2) { + let a = [], + vx01, vy01, norm, n_x0, n_y0, vx21, vy21, n_x2, n_y2; + vx01 = x1 - x0; + vy01 = y1 - y0; + norm = Math.sqrt(vx01 * vx01 + vy01 * vy01 + 0.0001) * 2; + vx01 = vx01 / norm * r0; + vy01 = vy01 / norm * r0; + n_x0 = vy01; + n_y0 = -vx01; + vx21 = x1 - x2; + vy21 = y1 - y2; + norm = Math.sqrt(vx21 * vx21 + vy21 * vy21 + 0.0001) * 2; + vx21 = vx21 / norm * r2; + vy21 = vy21 / norm * r2; + n_x2 = -vy21; + n_y2 = vx21; + a.push({ + mx: x0 + n_x0, + my: y0 + n_y0, + color: "#1A1A1A" + }); + a.push({ + c1x: x1 + n_x0, + c1y: y1 + n_y0, + c2x: x1 + n_x2, + c2y: y1 + n_y2, + ex: x2 + n_x2, + ey: y2 + n_y2 + }); + a.push({ + c1x: x2 + n_x2 - vx21, + c1y: y2 + n_y2 - vy21, + c2x: x2 - n_x2 - vx21, + c2y: y2 - n_y2 - vy21, + ex: x2 - n_x2, + ey: y2 - n_y2 + }); + a.push({ + c1x: x1 - n_x2, + c1y: y1 - n_y2, + c2x: x1 - n_x0, + c2y: y1 - n_y0, + ex: x0 - n_x0, + ey: y0 - n_y0 + }); + a.push({ + c1x: x0 - n_x0 - vx01, + c1y: y0 - n_y0 - vy01, + c2x: x0 + n_x0 - vx01, + c2y: y0 + n_y0 - vy01, + ex: x0 + n_x0, + ey: y0 + n_y0 + }); + a[0].mx = a[0].mx.toFixed(1); + a[0].mx = parseFloat(a[0].mx); + a[0].my = a[0].my.toFixed(1); + a[0].my = parseFloat(a[0].my); + for (let i = 1; i < a.length; i++) { + a[i].c1x = a[i].c1x.toFixed(1); + a[i].c1x = parseFloat(a[i].c1x); + a[i].c1y = a[i].c1y.toFixed(1); + a[i].c1y = parseFloat(a[i].c1y); + a[i].c2x = a[i].c2x.toFixed(1); + a[i].c2x = parseFloat(a[i].c2x); + a[i].c2y = a[i].c2y.toFixed(1); + a[i].c2y = parseFloat(a[i].c2y); + a[i].ex = a[i].ex.toFixed(1); + a[i].ex = parseFloat(a[i].ex); + a[i].ey = a[i].ey.toFixed(1); + a[i].ey = parseFloat(a[i].ey); + } + return a; + }, + bethelDraw(point, is_fill, color) { + let ctx = this.data.ctx; + ctx.beginPath(); + ctx.moveTo(point[0].mx, point[0].my); + if (undefined != color) { + ctx.setFillStyle(color); + ctx.setStrokeStyle(color); + } else { + ctx.setFillStyle(point[0].color); + ctx.setStrokeStyle(point[0].color); + } + for (let i = 1; i < point.length; i++) { + ctx.bezierCurveTo(point[i].c1x, point[i].c1y, point[i].c2x, point[i].c2y, point[i].ex, point[i].ey); + } + ctx.stroke(); + if (undefined != is_fill) { + ctx.fill(); //填充图形 ( 后绘制的图形会覆盖前面的图形, 绘制时注意先后顺序 ) + } + ctx.draw(true) + }, + selectColorEvent(event) { + var color = event.currentTarget.dataset.colorValue; + var colorSelected = event.currentTarget.dataset.color; + this.setData({ + selectColor: colorSelected, + lineColor: color + }) + }, + + subCanvas() { + var _this = this; + // let ctx = this.data.ctx; + // ctx.fillStyle='#FFFFFF'; + // ctx.fillRect(0, 0, 680, 300) + // this.data.ctx.draw(true, function () { + wx.canvasToTempFilePath({ + canvasId: 'handWriting', + fileType: 'png', + quality: 1, + destWidth: this.data.canvasHeight, + destHeight: this.data.canvasWidth, + success(res) { + if (_this.data.linePrack.length == 0) { + Toast.loading({ + type: 'fail', + message: '签名无效', + selector: '#van-toast', + zIndex: 99999999, + }); + return + } + wx.getImageInfo({ + src: res.tempFilePath, + success: (msg) => { + let height = msg.height / 2 + let width = msg.width / 2 + let canvas = wx.createCanvasContext('handWriting1', _this); + canvas.translate(height / 2, width / 2) + canvas.rotate(270 * Math.PI / 180) + canvas.drawImage(res.tempFilePath, -width / 2, -height / 2, width, height); + canvas.draw(false, () => { + wx.canvasToTempFilePath({ + canvasId: 'handWriting1', + fileType: 'png', + quality: 1, + destWidth: _this.data.canvasWidth, + destHeight: _this.data.canvasHeight, + success(vas) { + let imgList = _this.data.imgList; + imgList.splice(0, _this.data.imgList.length); + let img = {}; + img.id = ''; + img.filePath = vas.tempFilePath; + imgList.push(img) + _this.setData({ + imgList: [...imgList] + }) + _this.triggerEvent('subCanvas', imgList[0].filePath) + _this.retDraw(); + } + }, _this) + }) + } + }) + } + }, _this); + // }); + }, + + hideModal(e) { + this.triggerEvent('hideModal') + }, + } +}) \ No newline at end of file diff --git a/components/sign/sign.json b/components/sign/sign.json new file mode 100644 index 0000000..0061ebf --- /dev/null +++ b/components/sign/sign.json @@ -0,0 +1,8 @@ +{ + "component": true, + "usingComponents": { + "van-dialog": "@vant/weapp/dialog/index", + "van-button": "@vant/weapp/button/index", + "van-icon": "@vant/weapp/icon/index" + } +} diff --git a/components/sign/sign.wxml b/components/sign/sign.wxml new file mode 100644 index 0000000..c71abe1 --- /dev/null +++ b/components/sign/sign.wxml @@ -0,0 +1,31 @@ + + + + + + {{item}} + + + + + {{item}} + + + + + + + + + + + + + {{item}} + + + + + + + diff --git a/components/sign/sign.wxss b/components/sign/sign.wxss new file mode 100644 index 0000000..958521c --- /dev/null +++ b/components/sign/sign.wxss @@ -0,0 +1,52 @@ +.sign_dialog { + width: 100vw !important; + max-width: 100vw; + height: 100vh; + max-height: 100vh !important; + border-radius: 0 !important; +} + +.content { + display: flex; + height: 100vh; +} + +.header { + padding: 50rpx 0; + width: 80rpx; + display: flex; + flex-direction: column; + justify-content: space-between; + align-items: center; + text-align: center; + font-size: 40rpx; + color: #000; +} + +.header .title { + margin-top: 10rpx; + transform: rotate(90deg); +} + +.container { + flex: 1; + display: flex; + align-items: center; + justify-content: center; +} + +.handWriting { + border: 1px dashed #ccc; + height: 98%; + width: auto; + flex: 1; +} + +.footer { + display: flex; + flex-direction: column; +} + +.footer .title { + transform: rotate(90deg); +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..79e2c4f --- /dev/null +++ b/package-lock.json @@ -0,0 +1,24 @@ +{ + "name": "qa-education-exam-weapp", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "dependencies": { + "@vant/weapp": "^1.10.20" + } + }, + "node_modules/@vant/weapp": { + "version": "1.10.20", + "resolved": "https://registry.npmjs.org/@vant/weapp/-/weapp-1.10.20.tgz", + "integrity": "sha512-smztfdwNhS9i8+QrEzD293LJCHy6q+WlDcy1dZCrfW09gf5dY5XGMHK3UsPJ+hNahZh0KPQ/jkN0NiXb5v+HjA==" + } + }, + "dependencies": { + "@vant/weapp": { + "version": "1.10.20", + "resolved": "https://registry.npmjs.org/@vant/weapp/-/weapp-1.10.20.tgz", + "integrity": "sha512-smztfdwNhS9i8+QrEzD293LJCHy6q+WlDcy1dZCrfW09gf5dY5XGMHK3UsPJ+hNahZh0KPQ/jkN0NiXb5v+HjA==" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..f73b6f0 --- /dev/null +++ b/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "@vant/weapp": "^1.10.20" + } +} diff --git a/pages/exam/examination/examination.js b/pages/exam/examination/examination.js new file mode 100644 index 0000000..e7fd04e --- /dev/null +++ b/pages/exam/examination/examination.js @@ -0,0 +1,268 @@ +// pages/exam/examination/examination.js +import debounce from '../../../utils/debounce' +import Dialog from '@vant/weapp/dialog/dialog' +import { + formatTime, + getNowDate +} from "../../../utils/util"; +import { + getPaperListByCidAndUser, + submitExamByUser +} from "../../../api/index"; + +Page({ + + /** + * 页面的初始数据 + */ + data: { + EXAMNAME: '', + time: 0, + EXAMSCORE: '', + count: 0, + // 当前题数 + current: 0, + CLASS_ID: '', + STUDENT_ID: '', + SIMULATION: '', + STAGEEXAMPAPERINPUT_ID: '', + timeData: {}, + type: '', + current: 0, + topic: [], + testStartTime: formatTime(new Date()), + }, + chooseTopic(e) { + const { + type, + check + } = e.currentTarget.dataset + let topic = this.data.topic + let current = this.data.current + if (type === 'judge' || type === 'radio') { + if (topic[current].CHECK === check) { + topic[current].CHECK = '' + } else { + topic[current].CHECK = check + } + this.setData({ + topic: [...topic] + }) + } + if (type === 'multiple') { + if (topic[current].CHECK) { + let checkedArr = topic[current].CHECK.split(',') + if (checkedArr.includes(check)) { + checkedArr.splice(checkedArr.indexOf(check), 1) + topic[current].CHECK = checkedArr.join(',') + } else { + checkedArr.push(check) + checkedArr.sort() + topic[current].CHECK = checkedArr.join(',') + } + } else { + topic[current].CHECK = check + } + this.setData({ + topic: [...topic] + }) + } + }, + viewAnswers() { + let topic = this.data.topic + let current = this.data.current + topic[current].ANSWER = topic[current].CHECK || '没有作答' + this.setData({ + topic: [...topic] + }) + }, + countDownChange(e) { + this.setData({ + timeData: e.detail, + }); + }, + previousQuestion() { + this.setData({ + current: --this.data.current + }) + }, + nextQuestion() { + this.setData({ + current: ++this.data.current + }) + }, + async getData() { + let resData = {} + resData = await getPaperListByCidAndUser({ + CLASS_ID: this.data.CLASS_ID, + SIMULATION: this.data.SIMULATION, + STUDENT_ID: this.data.STUDENT_ID, + STAGEEXAMPAPERINPUT_ID: this.data.STAGEEXAMPAPERINPUT_ID + }) + for (let i = 0; i < resData.varList.length; i++) { + resData.varList[i].CHECK = '' + resData.varList[i].ANSWERRIGHT = resData.varList[i].ANSWER + resData.varList[i].ANSWER = '' + } + this.setData({ + topic: resData.varList + }) + }, + submitPapers() { + Dialog.confirm({ + title: '确定要交卷吗?', + selector: '#nation', + }) + .then(() => { + debounce(async () => { + let varList = this.data.topic + for (let i = 0; i < varList.length; i++) { + varList[i].ANSWER = varList[i].CHECK + } + let resData = await submitExamByUser({ + options: JSON.stringify(varList), + CLASS_ID: this.data.CLASS_ID, + STUDENT_ID: this.data.STUDENT_ID, + PASSSCORE: this.data.PASSSCORE, + EXAMSCORE: this.data.EXAMSCORE, + NUMBEROFEXAMS:this.data.NUMBEROFEXAMS, + EXAMTIMEBEGIN: this.data.EXAMTIMEBEGIN, + STAGEEXAMPAPERINPUT_ID: this.data.STAGEEXAMPAPERINPUT_ID + }) + wx.showToast({ + title: '交卷成功', + mask: true + }) + setTimeout(() => { + wx.redirectTo({ + url: '/pages/exam/results/results?STAGEEXAM_ID=' + resData.STAGEEXAM_ID + + '&EXAMRESULT=' + resData.examResult + + '&EXAMSCORE=' + resData.examScore + + '&PASSSCORE=' + resData.PASSSCORE + + '&PAPER_EXAMSCORE=' + resData.PAPER_EXAMSCORE, + }) + }, 1500) + }) + }).catch((e) =>{ + + }) + }, + fnCountDownFinish() { + Dialog.alert({ + title: '考试时间到了', + selector: '#nation', + }) + .then(() => { + debounce(async () => { + let varList = this.data.topic + for (let i = 0; i < varList.length; i++) { + varList[i].ANSWER = varList[i].CHECK + } + let resData = await submitExamByUser({ + options: JSON.stringify(varList), + CLASS_ID: this.data.CLASS_ID, + STUDENT_ID: this.data.STUDENT_ID, + PASSSCORE: this.data.PASSSCORE, + EXAMSCORE: this.data.EXAMSCORE, + EXAMTIMEBEGIN: this.data.EXAMTIMEBEGIN, + STAGEEXAMPAPERINPUT_ID: this.data.STAGEEXAMPAPERINPUT_ID + }) + wx.showToast({ + title: '交卷成功', + mask: true + }) + setTimeout(() => { + wx.redirectTo({ + url: '/pages/exam/results/results?STAGEEXAM_ID=' + resData.STAGEEXAM_ID + + '&EXAMRESULT=' + resData.examResult + + '&EXAMSCORE=' + resData.examScore + + '&PASSSCORE=' + resData.PASSSCORE + + '&PAPER_EXAMSCORE=' + resData.PAPER_EXAMSCORE, + }) + }, 1500) + }) + }); + }, + /** + * 生命周期函数--监听页面加载 + */ + onChange(event) { + let topic = this.data.topic + let current = this.data.current + topic[current].CHECK = event.detail + this.setData({ + topic: [...topic] + }) + }, + onLoad(options) { + this.setData({ + CLASS_ID: options.CLASS_ID, + SIMULATION: options.SIMULATION, + STAGEEXAMPAPERINPUT_ID: options.STAGEEXAMPAPERINPUT_ID, + EXAMNAME: options.EXAMNAME, + STUDENT_ID: options.STUDENT_ID, + PASSSCORE: options.PASSSCORE, + NUMBEROFEXAMS: options.NUMBEROFEXAMS, + EXAMSCORE: options.EXAMSCORE, + EXAMTIMEBEGIN: getNowDate(), + type: options.type, + time: options.ANSWERSHEETTIME * 60 * 1000 + }) + // 模拟考 + if (this.data.SIMULATION == 1) { + this.setData({ + time: 60 * 60 * 24 * 1000 + }) + } + this.getData() + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/exam/examination/examination.json b/pages/exam/examination/examination.json new file mode 100644 index 0000000..15420ba --- /dev/null +++ b/pages/exam/examination/examination.json @@ -0,0 +1,13 @@ +{ + "usingComponents": { + "van-tag": "@vant/weapp/tag/index", + "van-image": "@vant/weapp/image/index", + "van-count-down": "@vant/weapp/count-down/index", + "van-dialog": "@vant/weapp/dialog/index", + "van-icon": "@vant/weapp/icon/index", + "van-field": "@vant/weapp/field/index", + "van-sticky": "@vant/weapp/sticky/index", + "van-button": "@vant/weapp/button/index", + "van-empty": "@vant/weapp/empty/index" + } +} \ No newline at end of file diff --git a/pages/exam/examination/examination.wxml b/pages/exam/examination/examination.wxml new file mode 100644 index 0000000..86a33e3 --- /dev/null +++ b/pages/exam/examination/examination.wxml @@ -0,0 +1,121 @@ + + + + + + + 考试科目:{{ EXAMNAME }} + + + 当前试题{{ current+1 }}/{{ topic.length }} + + + + 剩余考试时间: + + + + + + + + + + 单选题 + 多选题 + 判断题 + 填空题 + + {{current + 1}}. + {{topic[current].QUESTIONDRY}} + + + A + {{topic[current].OPTIONA}} + + + B + {{topic[current].OPTIONB}} + + + C + {{topic[current].OPTIONC}} + + + D + {{topic[current].OPTIOND}} + + + + + A + {{topic[current].OPTIONA}} + + + B + {{topic[current].OPTIONB}} + + + C + {{topic[current].OPTIONC}} + + + D + {{topic[current].OPTIOND}} + + + + + A + {{topic[current].OPTIONA}} + + + B + {{topic[current].OPTIONB}} + + + + + + + + + 正确答案:{{topic[current].ANSWERRIGHT}} + + + 答案解析:{{topic[current].DESCR}} + + + + + 上一题 + + + 下一题 + + + + + + 交卷 + + + 查看答案 + + + + + {{current + 1}} + / {{topic.length}} + + + + + + + + \ No newline at end of file diff --git a/pages/exam/examination/examination.wxss b/pages/exam/examination/examination.wxss new file mode 100644 index 0000000..5b723f3 --- /dev/null +++ b/pages/exam/examination/examination.wxss @@ -0,0 +1,159 @@ +.content{ + padding: 20rpx; +} +.top { + border-radius: 20px; + text-align: center; + display: flex; + align-items: center; + justify-content: space-evenly; +} + +.van-count-down{ + color: #eeecec !important; + font-size: 30rpx !important; +} + +.head-text { + position: relative; + z-index: 99; + text-align: center; + font-size: 36rpx; + /* color: whitesmoke; */ + bottom: 285rpx; + color: #fff; + font-weight: bold; +} +.question-info { + background-color: white; + padding: 20rpx; + border-radius: 20rpx; +} +.questions { + position: relative; + z-index: 99; + text-align: center; + font-size: 30rpx; + /* color: whitesmoke; */ + bottom: 250rpx; + color: #eeecec; +} + +.time { + position: relative; + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; + z-index: 99; + text-align: center; + font-size: 25rpx; + /* color: whitesmoke; */ + bottom: 220rpx; + color: #eeecec; +} + +.van-count-down { + color: #eeecec; + font-size: 30rpx; + line-height: normal; +} + +.question { + width: 100%; + padding: 20rpx 20rpx; + background: #ffffff; + border-radius: 10rpx; + box-sizing: border-box; +} + + + +.count-down { + display: flex; + align-items: center; + justify-content: center; + background-color: #3676f2; + padding: 20rpx; + border-top: 1px solid rgba(248, 248, 248, 0.2); + text-align: center; +} + +.container { + padding: 20rpx 20rpx; +} + +.container .index { + padding-left: 10rpx; +} + +.container .stem { + padding-left: 10rpx; + line-height: 55rpx; +} + +.container .options .option { + margin-top: 50rpx; +} + +.container .options .option .choice { + display: inline-block; + border-radius: 50%; + border: 1px solid #f1f1f1; + width: 50rpx; + height: 50rpx; + line-height: 50rpx; + text-align: center; + box-shadow: #f1f1f1; +} + +.container .options .option .choice.check { + background-color: #cbcbcd; + color: #fff; +} + +.container .options .option .choice.error { + background-color: #f65a4b; + color: #fff; +} + +.container .options .option .choice.success { + background-color: #3676f2; + color: #fff; +} + +.container .options .option .title { + margin-left: 20rpx; +} + +.container .answer { + background-color: #ecf2fe; + padding: 20rpx; + margin-top: 50rpx; + border-radius: 10rpx; +} + +.button { + padding: 40rpx 20rpx; + display: flex; + justify-content: space-between; +} + +.footer { + display: flex; + align-items: center; + justify-content: space-between; + position: fixed; + left: 0; + right: 0; + bottom: 0; + box-shadow: 0 -2px 0 0 #f4f4f4; + background-color: #fff; + padding: 15rpx 30rpx; +} + +.footer .surplus { + display: flex; + align-items: center; + color: #d5d5d5; +} diff --git a/pages/exam/examination/func.wxs b/pages/exam/examination/func.wxs new file mode 100644 index 0000000..c47604f --- /dev/null +++ b/pages/exam/examination/func.wxs @@ -0,0 +1,13 @@ +// 支持es4语法 +var filter = { + totranType: function(value){ + if(value == '1') return '单选' + if(value == '1') return '多选' + if(value == '1') return '判断' + if(value == '1') return '填空' + } +} +// 导出对外暴露的属性 +module.exports = { + totranType: filter.totranType +} \ No newline at end of file diff --git a/pages/exam/imitate/imitate.js b/pages/exam/imitate/imitate.js new file mode 100644 index 0000000..40d50ee --- /dev/null +++ b/pages/exam/imitate/imitate.js @@ -0,0 +1,77 @@ +// pages/exam/online/online.js +import Dialog from '@vant/weapp/dialog/dialog'; +import Toast from '@vant/weapp/toast/toast'; +import { + getExamListTaskByUser +} from "../../../api/index"; + +Page({ + /** + * 页面的初始数据 + */ + data: { + showCount: 10, + timesOfexamination: 0, + currentPage: 1, + totalPage: 0, + varList: [], + }, + goExam(item) { + let dataInfo = item.currentTarget.dataset.item + wx.navigateTo({ + url: '/pages/exam/examination/examination' + + '?STAGEEXAMPAPERINPUT_ID=' + dataInfo.PAPER_ID + + '&CLASS_ID=' + dataInfo.CLASS_ID + + '&EXAMNAME=' + dataInfo.EXAMNAME + + '&STUDENT_ID=' + dataInfo.STUDENT_ID + + '&PASSSCORE=' + dataInfo.PASSSCORE + + '&EXAMSCORE=' + dataInfo.EXAMSCORE + + '&NUMBEROFEXAMS=' + this.data.timesOfexamination + + '&SIMULATION=1' + + '&ANSWERSHEETTIME=' + dataInfo.ANSWERSHEETTIME+ + '&type=practice' + }) + }, + async getData() { + let resData = await getExamListTaskByUser({ + showCount: this.data.showCount, + currentPage: this.data.currentPage, + simulation: 1 + }) + this.setData({ + varList: [...this.data.varList, ...resData.varList], + totalPage: resData.page.totalPage + }) + }, + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + this.setData({ + showCount: 10, + currentPage: 1, + totalPage: 0, + varList: [], + }) + this.getData() + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + this.setData({ + currentPage: ++this.data.currentPage + }) + if (this.data.totalPage >= this.data.currentPage) { + this.getData() + } + }, +}) \ No newline at end of file diff --git a/pages/exam/imitate/imitate.json b/pages/exam/imitate/imitate.json new file mode 100644 index 0000000..b621ffb --- /dev/null +++ b/pages/exam/imitate/imitate.json @@ -0,0 +1,11 @@ +{ + "usingComponents": { + "van-image": "@vant/weapp/image/index", + "van-count-down": "@vant/weapp/count-down/index", + "van-button": "@vant/weapp/button/index", + "van-dialog": "@vant/weapp/dialog/index", + "van-toast": "@vant/weapp/toast/index", + "van-empty": "@vant/weapp/empty/index" + }, + "navigationBarTitleText": "模拟考试" +} \ No newline at end of file diff --git a/pages/exam/imitate/imitate.wxml b/pages/exam/imitate/imitate.wxml new file mode 100644 index 0000000..2203c3b --- /dev/null +++ b/pages/exam/imitate/imitate.wxml @@ -0,0 +1,38 @@ + + + + + + 班级名称: {{ item.CLASS_NAME }} + + 待考试 + 考试中 + + + + 行业类型:{{ item.TYPENAME }} + + 培训开始时间:{{ item.START_TIME }} + + + 培训结束时间:{{ item.END_TIME }} + + + + + + 距离可考试时间 + + + + 模拟考试 + + + + + + + + + + \ No newline at end of file diff --git a/pages/exam/imitate/imitate.wxss b/pages/exam/imitate/imitate.wxss new file mode 100644 index 0000000..ad5abaf --- /dev/null +++ b/pages/exam/imitate/imitate.wxss @@ -0,0 +1,77 @@ +.co { + min-height: 100vh; +} + +.my-studies-main { + box-sizing: border-box; + padding: 20rpx; +} + +.studies_wrap-top { + width: 100%; + display: flex; + justify-content: space-between; + padding: 20rpx 0; +} + +.studies_wrap { + width: 100%; + padding: 0 20rpx; + background: #ffffff; + border-radius: 10rpx; + box-sizing: border-box; + margin-bottom: 20rpx; +} + +.studies_wrap_title { + font-weight: bold; + font-size: 30rpx; +} + +.studies_wrap_state { + font-size: 30rpx; + flex-basis: 130rpx; + margin-left: 20rpx; +} + +.studies_wrap-main { + border-top: 1px solid #eee; + line-height: 50rpx; + margin-top: 10rpx; + font-size: 28rpx; + color: #666; +} + +.fcb { + margin-top: 2rpx; + margin-left: 15rpx; + color: #3377ff; +} + +.fcd { + margin-top: 2rpx; + margin-left: 15rpx; + color: #666; +} + +.studies_wrap-bottom { + width: 100%; + display: flex; + border-top: 1px solid #eee; + padding: 20rpx 0; + margin-top: 10rpx; + font-size: 28rpx; + color: #999; + justify-content: space-between; + align-items: center; +} + +.van-count-down{ + color: #999 !important; + font-size: 28rpx !important; +} + +.flex { + display: flex; + align-items: center; +} \ No newline at end of file diff --git a/pages/exam/online/online.js b/pages/exam/online/online.js new file mode 100644 index 0000000..481c934 --- /dev/null +++ b/pages/exam/online/online.js @@ -0,0 +1,343 @@ +// pages/exam/online/online.js +import Dialog from '@vant/weapp/dialog/dialog'; +import Toast from '@vant/weapp/toast/toast'; +import { + getExamListTaskByUser, + updStuStartTime, + updStuSign +} from "../../../api/index"; + +Page({ + /** + * 页面的初始数据 + */ + data: { + showCount: 10, + userSignShow: false, + timesOfexamination: 0, + currentPage: 1, + totalPage: 0, + STUDENT_ID: '', + varList: [], + dataInfo: {}, + }, + fnInput1(event) { + // 签字图片 event.detail + updStuSign({ + filePath: event.detail, + formData:{ + STUDENT_ID: this.data.STUDENT_ID + } + }).then((resData) => { + if(resData.code != 0) { + wx.showToast({ + title: '请重签', + mask: false, + icon:error + }) + }else { + wx.showToast({ + title: '签字已经更新', + mask: false + }) + this.setData({ + varList: [] + }) + this.getData() + + // if (!this.data.dataInfo.EXAM_FACE_PATH) { + // // 去人脸识别 + // wx.navigateTo({ + // url: '/pages/photo/collection?STUDENT_ID='+this.data.STUDENT_ID, + // }) + // return + // } + } + }).catch((e) =>{ + console.log(e); + }) + }, + userSignShowChange(){ + this.setData({ + userSignShow:!this.data.userSignShow + }) + }, + goExam(item) { + let dataInfo = item.currentTarget.dataset.item + this.setData({ + STUDENT_ID: dataInfo.STUDENT_ID, + dataInfo: dataInfo + }) + let that = this + // 是否签字 + if (!dataInfo.SIGNATURE_PATH) { + this.userSignShowChange() + return + } + // if (!that.data.dataInfo.EXAM_FACE_PATH) { + // // 去人脸识别 + // wx.navigateTo({ + // url: '/pages/photo/collection?STUDENT_ID='+that.data.STUDENT_ID, + // }) + // return + // } + this.setData({ + timesOfexamination: dataInfo.NUMBEROFEXAMS - dataInfo.KSCOUNT + }) + if (this.data.timesOfexamination === 0) { + Toast.loading({ + type: 'fail', + message: '您无考试机会', + selector: '#van-toast', + }); + } else { + Dialog.confirm({ + message: '你还有' + that.data.timesOfexamination + '次考试机会', + context: this + }) + .then(() => { + updStuStartTime({ + STUDENT_ID: dataInfo.STUDENT_ID + }) + wx.navigateTo({ + url: '/pages/exam/examination/examination' + + '?STAGEEXAMPAPERINPUT_ID=' + dataInfo.PAPER_ID + + '&CLASS_ID=' + dataInfo.CLASS_ID + + '&EXAMNAME=' + dataInfo.EXAMNAME + + '&STUDENT_ID=' + dataInfo.STUDENT_ID + + '&PASSSCORE=' + dataInfo.PASSSCORE + + '&EXAMSCORE=' + dataInfo.EXAMSCORE + + '&NUMBEROFEXAMS=' + this.data.timesOfexamination + + '&SIMULATION=0' + + '&ANSWERSHEETTIME=' + dataInfo.ANSWERSHEETTIME, + }) + }) + .catch(() => {}); + Dialog.confirm({ + message: '你还有' + that.data.timesOfexamination + '次考试机会', + selector: '#myDialog', + }) + .then(() => { + updStuStartTime({ + STUDENT_ID: dataInfo.STUDENT_ID + }) + wx.navigateTo({ + url: '/pages/exam/examination/examination' + + '?STAGEEXAMPAPERINPUT_ID=' + dataInfo.PAPER_ID + + '&CLASS_ID=' + dataInfo.CLASS_ID + + '&EXAMNAME=' + dataInfo.EXAMNAME + + '&STUDENT_ID=' + dataInfo.STUDENT_ID + + '&PASSSCORE=' + dataInfo.PASSSCORE + + '&EXAMSCORE=' + dataInfo.EXAMSCORE + + '&NUMBEROFEXAMS=' + this.data.timesOfexamination + + '&SIMULATION=0' + + '&ANSWERSHEETTIME=' + dataInfo.ANSWERSHEETTIME, + }) + }) + .catch(() => {}); + // wx.showModal({ + // content: '你还有'+ that.data.timesOfexamination +'次考试机会', + // success: function(res) { + // if(res.confirm) { + // updStuStartTime({ + // STUDENT_ID: dataInfo.STUDENT_ID + // }) + // wx.navigateTo({ + // url: '/pages/exam/examination/examination' + + // '?STAGEEXAMPAPERINPUT_ID=' + dataInfo.PAPER_ID + + // '&CLASS_ID=' + dataInfo.CLASS_ID + + // '&EXAMNAME=' + dataInfo.EXAMNAME + + // '&STUDENT_ID=' + dataInfo.STUDENT_ID + + // '&PASSSCORE=' + dataInfo.PASSSCORE + + // '&EXAMSCORE=' + dataInfo.EXAMSCORE + + // '&NUMBEROFEXAMS=' + that.data.timesOfexamination + + // '&SIMULATION=0' + + // '&ANSWERSHEETTIME=' + dataInfo.ANSWERSHEETTIME, + // }) + // } else if (res.cancel) { + // console.log('用户点击了取消') + // } + // } + // }) + // Dialog.confirm({ + // message: '你还有' + that.data.timesOfexamination + '次考试机会', + // selector: '#myDialog', + // }) + // .then(() => { + // updStuStartTime({ + // STUDENT_ID: dataInfo.STUDENT_ID + // }) + // wx.navigateTo({ + // url: '/pages/exam/examination/examination' + + // '?STAGEEXAMPAPERINPUT_ID=' + dataInfo.PAPER_ID + + // '&CLASS_ID=' + dataInfo.CLASS_ID + + // '&EXAMNAME=' + dataInfo.EXAMNAME + + // '&STUDENT_ID=' + dataInfo.STUDENT_ID + + // '&PASSSCORE=' + dataInfo.PASSSCORE + + // '&EXAMSCORE=' + dataInfo.EXAMSCORE + + // '&NUMBEROFEXAMS=' + this.data.timesOfexamination + + // '&SIMULATION=0' + + // '&ANSWERSHEETTIME=' + dataInfo.ANSWERSHEETTIME, + // }) + // }) + // .catch(() => {}); + } + }, + /** + * 倒计时结束 + */ + finished() { + this.setData({ + varList: [] + }) + this.getData() + }, + /** + * 人脸验证成功回调 + */ + photoResult(dataInfo) { + let that = this + this.setData({ + timesOfexamination: dataInfo.NUMBEROFEXAMS - dataInfo.KSCOUNT + }) + if (this.data.timesOfexamination === 0) { + Toast.loading({ + type: 'fail', + message: '您无考试机会', + selector: '#van-toast', + }); + } else { + Dialog.confirm({ + message: '你还有' + that.data.timesOfexamination + '次考试机会', + context: this + }) + .then(() => { + updStuStartTime({ + STUDENT_ID: dataInfo.STUDENT_ID + }) + wx.navigateTo({ + url: '/pages/exam/examination/examination' + + '?STAGEEXAMPAPERINPUT_ID=' + dataInfo.PAPER_ID + + '&CLASS_ID=' + dataInfo.CLASS_ID + + '&EXAMNAME=' + dataInfo.EXAMNAME + + '&STUDENT_ID=' + dataInfo.STUDENT_ID + + '&PASSSCORE=' + dataInfo.PASSSCORE + + '&EXAMSCORE=' + dataInfo.EXAMSCORE + + '&NUMBEROFEXAMS=' + this.data.timesOfexamination + + '&SIMULATION=0' + + '&ANSWERSHEETTIME=' + dataInfo.ANSWERSHEETTIME, + }) + }) + .catch(() => {}); + Dialog.confirm({ + message: '你还有' + that.data.timesOfexamination + '次考试机会', + selector: '#myDialog', + }) + .then(() => { + updStuStartTime({ + STUDENT_ID: dataInfo.STUDENT_ID + }) + wx.navigateTo({ + url: '/pages/exam/examination/examination' + + '?STAGEEXAMPAPERINPUT_ID=' + dataInfo.PAPER_ID + + '&CLASS_ID=' + dataInfo.CLASS_ID + + '&EXAMNAME=' + dataInfo.EXAMNAME + + '&STUDENT_ID=' + dataInfo.STUDENT_ID + + '&PASSSCORE=' + dataInfo.PASSSCORE + + '&EXAMSCORE=' + dataInfo.EXAMSCORE + + '&NUMBEROFEXAMS=' + this.data.timesOfexamination + + '&SIMULATION=0' + + '&ANSWERSHEETTIME=' + dataInfo.ANSWERSHEETTIME, + }) + }) + .catch(() => {}); + // wx.showModal({ + // content: '你还有'+ that.data.timesOfexamination+'次考试机会', + // success: function(res) { + // if(res.confirm) { + // updStuStartTime({ + // STUDENT_ID: dataInfo.STUDENT_ID + // }) + // wx.navigateTo({ + // url: '/pages/exam/examination/examination' + + // '?STAGEEXAMPAPERINPUT_ID=' + dataInfo.PAPER_ID + + // '&CLASS_ID=' + dataInfo.CLASS_ID + + // '&EXAMNAME=' + dataInfo.EXAMNAME + + // '&STUDENT_ID=' + dataInfo.STUDENT_ID + + // '&PASSSCORE=' + dataInfo.PASSSCORE + + // '&EXAMSCORE=' + dataInfo.EXAMSCORE + + // '&NUMBEROFEXAMS=' + that.data.timesOfexamination + + // '&SIMULATION=0' + + // '&ANSWERSHEETTIME=' + dataInfo.ANSWERSHEETTIME, + // }) + // } else if (res.cancel) { + // console.log('用户点击了取消') + // } + // } + // }) + // Dialog.alert({ + // message: '你还有'+ that.data.timesOfexamination+'次考试机会', + // selector: '#myDialog', + // }) + // .then(() => { + // updStuStartTime({ + // STUDENT_ID: dataInfo.STUDENT_ID + // }) + // wx.navigateTo({ + // url: '/pages/exam/examination/examination' + + // '?STAGEEXAMPAPERINPUT_ID=' + dataInfo.PAPER_ID + + // '&CLASS_ID=' + dataInfo.CLASS_ID + + // '&EXAMNAME=' + dataInfo.EXAMNAME + + // '&STUDENT_ID=' + dataInfo.STUDENT_ID + + // '&PASSSCORE=' + dataInfo.PASSSCORE + + // '&EXAMSCORE=' + dataInfo.EXAMSCORE + + // '&NUMBEROFEXAMS=' + this.data.timesOfexamination + + // '&SIMULATION=0' + + // '&ANSWERSHEETTIME=' + dataInfo.ANSWERSHEETTIME, + // }) + // }) + // .catch(() => {}); + } + }, + async getData() { + let resData = await getExamListTaskByUser({ + showCount: this.data.showCount, + currentPage: this.data.currentPage + }) + this.setData({ + varList: [...this.data.varList, ...resData.varList], + totalPage: resData.page.totalPage + }) + }, + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + this.setData({ + showCount: 10, + currentPage: 1, + totalPage: 0, + varList: [], + }) + this.getData() + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + this.setData({ + currentPage: ++this.data.currentPage + }) + if (this.data.totalPage >= this.data.currentPage) { + this.getData() + } + }, +}) diff --git a/pages/exam/online/online.json b/pages/exam/online/online.json new file mode 100644 index 0000000..8a07fcb --- /dev/null +++ b/pages/exam/online/online.json @@ -0,0 +1,12 @@ +{ + "usingComponents": { + "van-image": "@vant/weapp/image/index", + "van-count-down": "@vant/weapp/count-down/index", + "van-button": "@vant/weapp/button/index", + "van-dialog": "@vant/weapp/dialog/index", + "van-toast": "@vant/weapp/toast/index", + "van-empty": "@vant/weapp/empty/index", + "sign": "/components/sign/sign" + }, + "navigationBarTitleText": "在线考试" +} \ No newline at end of file diff --git a/pages/exam/online/online.wxml b/pages/exam/online/online.wxml new file mode 100644 index 0000000..8c43582 --- /dev/null +++ b/pages/exam/online/online.wxml @@ -0,0 +1,42 @@ + + + + + + 班级名称: {{ item.CLASS_NAME }} + + 待考试 + 未通过 + + + + 行业类型:{{ item.TYPENAME }} + + 培训开始时间:{{ item.START_TIME }} + + + 培训结束时间:{{ item.END_TIME }} + + + + + + + + 距离可考试时间: + + + + 立即考试 + 您无考试机会 + + + + + + + + + + + \ No newline at end of file diff --git a/pages/exam/online/online.wxss b/pages/exam/online/online.wxss new file mode 100644 index 0000000..92b008a --- /dev/null +++ b/pages/exam/online/online.wxss @@ -0,0 +1,80 @@ +.co { + min-height: 100vh; +} + +.my-studies-main { + box-sizing: border-box; + padding: 20rpx; +} + +.studies_wrap-top { + width: 100%; + display: flex; + justify-content: space-between; + padding: 20rpx 0; +} + +.studies_wrap { + width: 100%; + padding: 0 20rpx; + background: #ffffff; + border-radius: 10rpx; + box-sizing: border-box; + margin-bottom: 20rpx; +} + +.studies_wrap_title { + font-weight: bold; + font-size: 30rpx; +} + +.studies_wrap_state { + font-size: 30rpx; + flex-basis: 130rpx; + margin-left: 20rpx; +} + +.studies_wrap-main { + border-top: 1px solid #eee; + line-height: 50rpx; + margin-top: 10rpx; + font-size: 28rpx; + color: #666; +} + +.fcb { + margin-top: 2rpx; + margin-left: 15rpx; + color: #3377ff; +} +.fcr { + margin-top: 2rpx; + margin-left: 15rpx; + color: red; +} +.fcd { + margin-top: 2rpx; + margin-left: 15rpx; + color: #666; +} + +.studies_wrap-bottom { + width: 100%; + display: flex; + border-top: 1px solid #eee; + padding: 20rpx 0; + margin-top: 10rpx; + font-size: 28rpx; + color: #999; + justify-content: space-between; + align-items: center; +} + +.van-count-down{ + color: #999 !important; + font-size: 28rpx !important; +} + +.flex { + display: flex; +} \ No newline at end of file diff --git a/pages/exam/record/record.js b/pages/exam/record/record.js new file mode 100644 index 0000000..212fcdc --- /dev/null +++ b/pages/exam/record/record.js @@ -0,0 +1,101 @@ +// pages/exam/record/record.js +import { + getExamRecordListByUser +} from "../../../api/index"; +Page({ + + /** + * 页面的初始数据 + */ + data: { + PASSEDNUM: 0, + showCount: 10, + currentPage: 1, + totalPage: 0, + varList: [], + }, + async getData() { + const resData = await getExamRecordListByUser({ + showCount: this.data.showCount, + currentPage: this.data.currentPage + }) + this.setData({ + varList: [...this.data.varList, ...resData.varList], + totalPage: resData.page.totalPage, + ALLEXAMTIMES: resData.page.totalResult, + PASSEDNUM: resData.baseInfo.PASSEDNUM + }) + + }, + goResult(e) { + let resData = e.currentTarget.dataset.item + wx.navigateTo({ + url: '/pages/exam/results/results?STAGEEXAM_ID=' + + resData.STAGEEXAM_ID + + '&EXAMRESULT=' + resData.RESULT + + '&EXAMSCORE=' + resData.EXAMSCORE + + '&PASSSCORE=' + resData.PASSSCORE + + '&PAPER_EXAMSCORE=' + resData.ALL_EXAMSCORE, + }) + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + this.getData() + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + this.setData({ + currentPage: ++this.data.currentPage + }) + if (this.data.totalPage >= this.data.currentPage) { + this.getData() + } + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/exam/record/record.json b/pages/exam/record/record.json new file mode 100644 index 0000000..65de460 --- /dev/null +++ b/pages/exam/record/record.json @@ -0,0 +1,14 @@ +{ + "usingComponents": { + "van-tag": "@vant/weapp/tag/index", + "van-image": "@vant/weapp/image/index", + "van-count-down": "@vant/weapp/count-down/index", + "van-dialog": "@vant/weapp/dialog/index", + "van-icon": "@vant/weapp/icon/index", + "van-sticky": "@vant/weapp/sticky/index", + "van-button": "@vant/weapp/button/index", + "van-empty": "@vant/weapp/empty/index" + }, + "navigationBarTitleText": "考试记录" + +} \ No newline at end of file diff --git a/pages/exam/record/record.wxml b/pages/exam/record/record.wxml new file mode 100644 index 0000000..4c30fbb --- /dev/null +++ b/pages/exam/record/record.wxml @@ -0,0 +1,61 @@ + + + + + + 我的成绩 + + + + + {{ ALLEXAMTIMES }} + + + 参加考试次数 + + + + + {{ PASSEDNUM }} + + + 合格次数 + + + + + {{ ALLEXAMTIMES - PASSEDNUM }} + + + 不合格次数 + + + + + + + + + + 考试成绩: {{ item.EXAMSCORE }} + + 未通过 + 已通过 + + + + 班级名称:{{ item.CLASS_NAME }} + + 考试开始时间:{{item.EXAMTIMEBEGIN}} + + + 考试结束时间:{{item.EXAMTIMEEND}} + + + + + + + + + \ No newline at end of file diff --git a/pages/exam/record/record.wxss b/pages/exam/record/record.wxss new file mode 100644 index 0000000..18b6c7a --- /dev/null +++ b/pages/exam/record/record.wxss @@ -0,0 +1,80 @@ +.content { + padding: 20rpx; +} + +.top { + border-radius: 20px; + text-align: center; + display: flex; + align-items: center; + justify-content: space-evenly; +} + +.option{ + height:230rpx; +} + +.head-text { + position: relative; + z-index: 99; + text-align: center; + font-size: 40rpx; + bottom: 220rpx; + color: #fff; + font-weight: bold; +} +.scoremain { + position: relative; + z-index: 99; + text-align: center; + font-size: 30rpx; + bottom: 180rpx; + color: #fff; + font-weight: bold; + display: flex; + flex-direction: row; + justify-content: space-between; + color: #fff; + padding: 0 30rpx; +} +.studies_wrap-top { + width: 100%; + display: flex; + justify-content: space-between; + padding: 20rpx 0; +} +.studies_wrap { + width: 100%; + padding: 0 20rpx; + margin-top: 20rpx; + background: #ffffff; + border-radius: 10rpx; + box-sizing: border-box; +} +.studies_wrap_title { + font-weight: bold; + font-size: 30rpx; +} +.fcb { + margin-top: 2rpx; + margin-left: 15rpx; + color: green; +} +.fcd { + margin-top: 2rpx; + margin-left: 15rpx; + color: red; +} +.studies_wrap_state { + font-size: 30rpx; + flex-basis: 130rpx; + margin-left: 20rpx; +} +.studies_wrap-main { +border-top: 1px solid #eee; +line-height: 50rpx; +font-size: 28rpx; +padding: 15rpx 0; +color: #666; +} + diff --git a/pages/exam/results/results.js b/pages/exam/results/results.js new file mode 100644 index 0000000..ae5b9b4 --- /dev/null +++ b/pages/exam/results/results.js @@ -0,0 +1,53 @@ +import { + getExamRecordByUser +} from "../../../api/index"; +Page({ + data: { + type: '', + STAGEEXAM_ID: '', + STUDYTASK_ID: '', + CURRICULUM_ID: '', + topic: [], + stageExam: { + EXAMRESULT: '1', + PAPERSCORE: "100", + EXAMSCORE: "60" + } + }, + onLoad(options) { + let info = {} + info.EXAMRESULT = options.EXAMRESULT + info.PAPERSCORE = options.PAPER_EXAMSCORE + info.EXAMSCORE = options.EXAMSCORE + // STAGEEXAM_ID + this.setData({ + stageExam: info, + STAGEEXAM_ID: options.STAGEEXAM_ID + }) + this.getData() + // if (options.type === 'learned') { + // this.getData() + // } else { + // this.setData({ + // topic: app.globalData.mockTestResult.topic, + // stageExam: app.globalData.mockTestResult.stageExam, + // }) + // } + }, + async getData() { + let resData = await getExamRecordByUser({ + STAGEEXAM_ID: this.data.STAGEEXAM_ID + }) + this.setData({ + topic: resData.varList + }) + }, + onUnload() { + // app.globalData.mockTestResult = {} + // if (this.data.type !== 'learned') { + // wx.switchTab({ + // url: '/pages/index/index' + // }) + // } + } +}) \ No newline at end of file diff --git a/pages/exam/results/results.json b/pages/exam/results/results.json new file mode 100644 index 0000000..57bbb54 --- /dev/null +++ b/pages/exam/results/results.json @@ -0,0 +1,6 @@ +{ + "usingComponents": { + "van-image": "@vant/weapp/image/index", + "van-tag": "@vant/weapp/tag/index" + } +} \ No newline at end of file diff --git a/pages/exam/results/results.wxml b/pages/exam/results/results.wxml new file mode 100644 index 0000000..7b8382b --- /dev/null +++ b/pages/exam/results/results.wxml @@ -0,0 +1,98 @@ + + + + + + + + + + 恭喜您,考试合格! + + + + + + 很遗憾,考试不合格! + + + + {{stageExam.PAPERSCORE}} + 总分 + + + {{stageExam.EXAMSCORE}} + 本次得分 + + + + 此次考试为模拟考试,不计入成绩,退出之后无法再次查看 + + + 答案详情 + + + + 单选题 + 多选题 + 判断题 + 填空题 + + {{index + 1}}. + {{item.QUESTIONDRY}} + + + A + {{item.OPTIONA}} + + + B + {{item.OPTIONB}} + + + C + {{item.OPTIONC}} + + + D + {{item.OPTIOND}} + + + + + A + {{item.OPTIONA}} + + + B + {{item.OPTIONB}} + + + C + {{item.OPTIONC}} + + + D + {{item.OPTIOND}} + + + + + A + {{item.OPTIONA}} + + + B + {{item.OPTIONB}} + + + + 学员答案:{{item.ANSWER}} + + + 正确答案:{{item.ANSWERRIGHT}} + + + + + \ No newline at end of file diff --git a/pages/exam/results/results.wxss b/pages/exam/results/results.wxss new file mode 100644 index 0000000..b7a62d1 --- /dev/null +++ b/pages/exam/results/results.wxss @@ -0,0 +1,162 @@ +.content { + background-color: #fff; +} + +.results { + width: 90%; + height: 300rpx; + background-color: #fff; + position: absolute; + top: 100rpx; + left: 5%; + border-radius: 20rpx; + box-shadow: 6rpx 6rpx 40rpx 0 rgba(27, 87, 178, 0.3), -6rpx 0 40rpx 0 rgba(27, 87, 178, 0.3); +} + +.results .image { + background-color: #fff; + border-radius: 50%; + box-shadow: 6rpx 0 40rpx 0 rgba(27, 87, 178, 0.3); + width: 180rpx; + height: 180rpx; + display: flex; + justify-content: center; + align-items: center; + position: absolute; + top: -90rpx; + left: 50%; + transform: translateX(-50%); +} + +.results .title { + text-align: center; + width: 100%; + font-weight: bold; + font-size: 36rpx; + position: absolute; + top: 40%; + transform: translateY(-50%); +} + +.results .title.success { + color: #5ea908; +} + +.results .title.error { + color: #ff3c02; +} + +.results .score { + width: 100%; + display: flex; + justify-content: space-around; + text-align: center; + position: absolute; + bottom: 30rpx; + font-size: 24rpx; +} + +.results .score .value { + font-weight: bold; + font-size: 36rpx; +} + +.results .score .value.total-score { + color: #247bff; +} + +.results .score .value.this-score { + color: #60a808; +} + +.results .score .value.earn-points { + color: #f65a4b; +} + +.results .score .label { + color: #b6b6b6; +} + +.tip { + width: 90%; + background-color: #ecf2fd; + margin: 150rpx 5% 40rpx; + font-size: 24rpx; + padding: 10rpx 0; + text-align: center; + border-radius: 10rpx; + color: #db8b84; +} + +.placeholder { + margin-top: 160rpx; + height: 0; +} + +.exercises>.title { + font-weight: bold; + position: relative; + padding-left: 20rpx; + margin-left: 5%; +} + +.exercises>.title::before { + content: ''; + position: absolute; + top: 10rpx; + left: 0; + width: 8rpx; + height: 30rpx; + background-color: #257cff; + border-radius: 10rpx; +} + +.exercises .container .item { + padding: 20rpx 5%; + border-bottom: 10rpx solid #f0f0f0; +} + +.exercises .container .index { + padding-left: 10rpx; +} + +.exercises .container .stem { + padding-left: 10rpx; + line-height: 55rpx; +} + +.exercises .container .options .option { + margin-top: 50rpx; +} + +.exercises .container .options .option .choice { + display: inline-block; + border-radius: 50%; + border: 1px solid #f1f1f1; + width: 50rpx; + height: 50rpx; + line-height: 50rpx; + text-align: center; + box-shadow: #f1f1f1; +} + +.exercises .container .options .option .choice.error { + background-color: #f65a4b; + color: #fff; +} + +.exercises .container .options .option .choice.success { + background-color: #3676f2; + color: #fff; +} + +.exercises .container .options .option .title { + margin-left: 20rpx; +} + +.exercises .container .answer { + background-color: #ecf2fe; + padding: 20rpx; + margin-top: 50rpx; + border-radius: 10rpx; +} \ No newline at end of file diff --git a/pages/index/index.js b/pages/index/index.js new file mode 100644 index 0000000..d2d30bd --- /dev/null +++ b/pages/index/index.js @@ -0,0 +1,63 @@ +const app = getApp() +import Dialog from '@vant/weapp/dialog/dialog'; +Page({ + data: { + userSignShow: false + }, + toOnline: function (events) { + this.isAuthentication('/pages/exam/online/online') + }, + toPhoto: function (events) { + wx.navigateTo({ + url: '/pages/photo/collection', + }) + }, + toSign: function (events) { + wx.navigateTo({ + url: '/pages/sign/sign', + }) + }, + + toImitate: function (events) { + this.isAuthentication('/pages/exam/imitate/imitate') + // wx.navigateTo({ + // url: '/pages/exam/imitate/imitate', + // // events: events, + // // success: (result) => {}, + // // fail: (res) => {}, + // // complete: (res) => {}, + // }) + }, + isAuthentication: function (url) { + wx.navigateTo({ + url: url, + }) + // 首次照片采集 + // let user = app.globalData.userInfo + // if (user.AUTHENTICATION == '1') { + // wx.navigateTo({ + // url: url, + // }) + // } else { + // Dialog.confirm({ + // message: '需要先进行照片采集', + // selector: '#myDialog', + // }) + // .then(() => { + // wx.navigateTo({ + // url: '/pages/photo/collection', + // }) + // }) + // .catch(() => { + + // }); + // } + }, + toRecord: function (events) { + this.isAuthentication('/pages/exam/record/record') + // wx.navigateTo({ + // url: '/pages/exam/record/record', + // }) + } + +}) \ No newline at end of file diff --git a/pages/index/index.json b/pages/index/index.json new file mode 100644 index 0000000..858dab8 --- /dev/null +++ b/pages/index/index.json @@ -0,0 +1,9 @@ +{ + "usingComponents": { + "van-image": "@vant/weapp/image/index", + "van-dialog": "@vant/weapp/dialog/index", + "van-toast": "@vant/weapp/toast/index", + "sign": "/components/sign/sign" + }, + "navigationBarTitleText": "金安铸云" +} diff --git a/pages/index/index.wxml b/pages/index/index.wxml new file mode 100644 index 0000000..093d808 --- /dev/null +++ b/pages/index/index.wxml @@ -0,0 +1,45 @@ + + + + + + + + 在线考试 + 随机抽题/自动评分 + + + + + + 模拟练习 + 随机抽题模拟测试 + + + + + + 考试记录 + 记录考试状态成绩 + + + + + + 签字采集 + 采集考试签字信息 + + + + + + + diff --git a/pages/index/index.wxss b/pages/index/index.wxss new file mode 100644 index 0000000..8953a52 --- /dev/null +++ b/pages/index/index.wxss @@ -0,0 +1,43 @@ +.content{ + background-color: #fff; + min-height: 100vh; +} +.banner { + width: 692rpx; + height: 202rpx; + padding-top: 15rpx; + margin: auto; +} + +.options { + width: 692rpx; + margin: 10rpx auto 0 auto; + display: flex; + flex-wrap: wrap; + justify-content: space-between; +} + +.options .option { + width: calc((692rpx - 15rpx) / 2); + padding: 26rpx 0; + margin-top: 15rpx; + margin-left: 15rpx; + border-radius: 20rpx; + color: #fff; + display: flex; + align-items: center; + justify-content: space-evenly; +} + +.options .option:nth-child(2n+1) { + margin-left: 0; +} + +.options .option .title { + font-size: 30rpx; +} + +.options .option .describe { + font-size: 22rpx; + padding-top: 10rpx; +} \ No newline at end of file diff --git a/pages/login/login.js b/pages/login/login.js new file mode 100644 index 0000000..227c956 --- /dev/null +++ b/pages/login/login.js @@ -0,0 +1,46 @@ +import {login} from "../../api/index"; +import debounce from '../../utils/debounce' + +const app = getApp() +Page({ + data: { + userName: '', + password: '', + }, + onLoad() { + if (!app.globalData.userInfo.USER_ID) { + wx.reLaunch({ + url: 'pages/login/login' + }) + } else { + wx.switchTab({ + url: '/pages/index/index' + }) + } + }, + submitLogin() { + debounce(async () => { + if (!this.data.userName) { + wx.showToast({ + title: '请输入用户名', + icon: 'none' + }) + return + } + if (!this.data.password) { + wx.showToast({ + title: '请输入密码', + icon: 'none' + }) + return + } + let KEYDATA = `qdkjchina${this.data.userName},qd,${this.data.password}` + app.globalData.userInfo = await login({ + KEYDATA + }) + wx.switchTab({ + url: '/pages/index/index' + }) + }) + } +}) diff --git a/pages/login/login.json b/pages/login/login.json new file mode 100644 index 0000000..115f447 --- /dev/null +++ b/pages/login/login.json @@ -0,0 +1,9 @@ +{ + "usingComponents": { + "van-image": "@vant/weapp/image/index", + "van-field": "@vant/weapp/field/index", + "van-cell-group": "@vant/weapp/cell-group/index", + "van-button": "@vant/weapp/button/index" + }, + "navigationStyle": "custom" +} diff --git a/pages/login/login.wxml b/pages/login/login.wxml new file mode 100644 index 0000000..72718ea --- /dev/null +++ b/pages/login/login.wxml @@ -0,0 +1,22 @@ + + + + + \ No newline at end of file diff --git a/pages/login/login.wxss b/pages/login/login.wxss new file mode 100644 index 0000000..ca71633 --- /dev/null +++ b/pages/login/login.wxss @@ -0,0 +1,37 @@ +.container{ + background-color: #fff; + min-height: 100vh; +} +.banner { + position: relative; +} + +.banner .title { + position: absolute; + top: 150rpx; + left: 50rpx; +} + +.banner .title .hello { + font-weight: bold; + font-size: 40rpx; +} + +.banner .title .welcome { + padding-top: 8rpx; + font-size: 38rpx; +} + +.login { + background-color: #fff; + border-radius: 40rpx 40rpx 0 0; + padding: 50rpx 50rpx; + margin-top: -50rpx; + position: relative; + z-index: 99; +} + +.login .title { + font-weight: bold; + font-size: 46rpx; +} diff --git a/pages/mine/aboutus/aboutus.js b/pages/mine/aboutus/aboutus.js new file mode 100644 index 0000000..803d30d --- /dev/null +++ b/pages/mine/aboutus/aboutus.js @@ -0,0 +1,66 @@ +// pages/mine/aboutus/aboutus.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/mine/aboutus/aboutus.json b/pages/mine/aboutus/aboutus.json new file mode 100644 index 0000000..a6df3e7 --- /dev/null +++ b/pages/mine/aboutus/aboutus.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "关于我们" +} diff --git a/pages/mine/aboutus/aboutus.wxml b/pages/mine/aboutus/aboutus.wxml new file mode 100644 index 0000000..045d24f --- /dev/null +++ b/pages/mine/aboutus/aboutus.wxml @@ -0,0 +1,4 @@ + + + 河北秦安安全科技股份有限公司是以“大数据”为载体为企业提供精准风险管理的综合技术服务提供商。公司于2017年8月3日在全国中小企业股转中心新三板挂牌上市,是河北省内一家以提供安全生产技术服务上市的公司,股票代码:871771。 + diff --git a/pages/mine/aboutus/aboutus.wxss b/pages/mine/aboutus/aboutus.wxss new file mode 100644 index 0000000..85cbf4d --- /dev/null +++ b/pages/mine/aboutus/aboutus.wxss @@ -0,0 +1,10 @@ +.container { + background-color: #fff; + min-height: 100vh; + padding: 20rpx; + box-sizing: border-box; + line-height: 1.8; + font-size:32rpx; + text-indent: 2rem; + color: #333333; +} diff --git a/pages/mine/changePassword/changePassword.js b/pages/mine/changePassword/changePassword.js new file mode 100644 index 0000000..e35e36f --- /dev/null +++ b/pages/mine/changePassword/changePassword.js @@ -0,0 +1,69 @@ +import debounce from "../../../utils/debounce"; +import {setChangePassword} from "../../../api/index"; + +const app = getApp() +Page({ + data: { + form: { + password: '', + newPassword: '', + againNewPassword: '', + }, + rules: { + "password": "请输入旧密码", + "newPassword": "请输入新密码", + "againNewPassword": "请再次输入新密码", + } + }, + bindInput(event) { + this.setData({ + form: { + ...this.data.form, + [event.currentTarget.dataset.key]: event.detail, + } + }) + }, + submitPassword() { + debounce(async () => { + for (const rulesKey in this.data.rules) { + if (!this.data.form[rulesKey]) { + wx.showToast({ + title: this.data.rules[rulesKey], + icon: "none" + }) + return; + } + } + if (this.data.form.newPassword !== this.data.form.againNewPassword) { + wx.showToast({ + title: '两次密码不一致', + icon: "none" + }) + return + } + const resData = await setChangePassword({ + USERNAME: app.globalData.userInfo.USERNAME, + USER_ID: app.globalData.userInfo.USER_ID, + PASSWORD: this.data.form.password, + NOWPASSWORD: this.data.form.newPassword, + }) + if(resData.code != "0") { + wx.showToast({ + title: '旧密码有误', + icon:'error' + }) + return + } + wx.showToast({ + title: '修改成功', + mask: true + }) + app.globalData.userInfo = {} + setTimeout(() => { + wx.reLaunch({ + url: '/pages/login/login' + }) + }, 1500) + }) + } +}) diff --git a/pages/mine/changePassword/changePassword.json b/pages/mine/changePassword/changePassword.json new file mode 100644 index 0000000..3201cf2 --- /dev/null +++ b/pages/mine/changePassword/changePassword.json @@ -0,0 +1,8 @@ +{ + "usingComponents": { + "van-field": "@vant/weapp/field/index", + "van-button": "@vant/weapp/button/index", + "van-cell-group": "@vant/weapp/cell-group/index" + }, + "navigationBarTitleText": "修改密码" +} diff --git a/pages/mine/changePassword/changePassword.wxml b/pages/mine/changePassword/changePassword.wxml new file mode 100644 index 0000000..74710af --- /dev/null +++ b/pages/mine/changePassword/changePassword.wxml @@ -0,0 +1,37 @@ + + + + + + + + + 确定 + + + diff --git a/pages/mine/changePassword/changePassword.wxss b/pages/mine/changePassword/changePassword.wxss new file mode 100644 index 0000000..17de1f5 --- /dev/null +++ b/pages/mine/changePassword/changePassword.wxss @@ -0,0 +1,10 @@ +.container { + background-color: #f7f8fa; + min-height: 100vh; + padding: 30rpx 0; +} + +.button { + width: 90%; + margin-left: 5%; +} diff --git a/pages/mine/index/index.js b/pages/mine/index/index.js new file mode 100644 index 0000000..ab679da --- /dev/null +++ b/pages/mine/index/index.js @@ -0,0 +1,35 @@ +import Dialog from '@vant/weapp/dialog/dialog'; +import {getUserScoreSum} from "../../../api/index"; + +const app = getApp() +Page({ + data: { + totalScore: 0, + userInfo: {} + }, + onShow(options) { + this.setData({ + userInfo: app.globalData.userInfo, + }) + this.getUserScoreSum() + }, + async getUserScoreSum() { + let resData = await getUserScoreSum({USER_ID: app.globalData.userInfo.USER_ID}) + this.setData({ + totalScore: resData.totalScore + }) + }, + logOut() { + Dialog.confirm({ + title: '提示', + message: '确认退出登陆吗?', + }).then(() => { + app.globalData.userInfo = {} + wx.reLaunch({ + url: '/pages/login/login' + }) + }).catch(() => { + }) + } +}) + diff --git a/pages/mine/index/index.json b/pages/mine/index/index.json new file mode 100644 index 0000000..6edf889 --- /dev/null +++ b/pages/mine/index/index.json @@ -0,0 +1,9 @@ +{ + "usingComponents": { + "van-image": "@vant/weapp/image/index", + "van-icon": "@vant/weapp/icon/index", + "van-dialog": "@vant/weapp/dialog/index" + }, + "navigationBarTitleText": "我的", + "navigationBarBackgroundColor": "#257cff" +} diff --git a/pages/mine/index/index.wxml b/pages/mine/index/index.wxml new file mode 100644 index 0000000..a380640 --- /dev/null +++ b/pages/mine/index/index.wxml @@ -0,0 +1,78 @@ + + + + + + + + {{userInfo.USERNAME}} + + + + + + + + + + 信息登记 + + + + + + + + + + + + + 关于我们 + + + + + + + + + + + + + 调查问卷 + + + + + + + + + + + + + 修改密码 + + + + + + + + + + + + 退出登录 + + + + + + + + + diff --git a/pages/mine/index/index.wxss b/pages/mine/index/index.wxss new file mode 100644 index 0000000..389551e --- /dev/null +++ b/pages/mine/index/index.wxss @@ -0,0 +1,67 @@ +.bgclore { + width: 100%; + height: 100%; + background: #f9f9f9; + position: absolute; + z-index: -2; +} + +.my-banner { + width: 100%; + height: 100rpx; + position: relative; + padding: 40rpx; + box-sizing: border-box; +} + +.my-banner .image { + position: absolute; + top: 0; + left: 0; + right: 0; + z-index: -1; +} + +.my-banner .username { + font-size: 36rpx; + color: #ffffff; + display: block; + font-weight: bold; + margin-bottom: 10rpx; + text-align: center; +} + +.my-container { + width: 100%; + background: #ffffff; + padding: 20rpx 40rpx; + margin-top: 120rpx; + box-sizing: border-box; +} + +.list-wrap { + width: 100%; + display: flex; + justify-content: space-between; + align-items: center; + padding: 40rpx 0rpx; + /* border-bottom: 1px solid #eeeeee; */ +} + +.list-wrap .list-wrap-img { + width: 40rpx; + height: 40rpx; + margin-right: 20rpx; + vertical-align: middle; +} + +.list-wrap-info { + flex: 1; + display: flex; + justify-content: space-between; + font-weight: 500; +} + +.fc9 { + color: #999999 +} diff --git a/pages/mine/information/filling.js b/pages/mine/information/filling.js new file mode 100644 index 0000000..eba1c7f --- /dev/null +++ b/pages/mine/information/filling.js @@ -0,0 +1,387 @@ +import { + getUserEnterpriseInfo, + updateUserInfo, + updateUserPhoto, + getDictionaries +} from "../../../api/index"; +import { + FILEPATHPRE +} from "../../../utils/util" +import Dialog from '@vant/weapp/dialog/dialog'; +Page({ + data: { + FILEPATHPRE: FILEPATHPRE, + degreeOfEducationList: [], + dutiesList: [], + nationList: [], + politicalList: [], + degreeName: '', + politicaName: '', + nationName: '', + dutiesName: '', + fileList: [], + form: {}, + rules: { + "NAME": "请输入姓名", + // "PHONE": "请输入手机号", + "NATION": "请输入民族", + "POLITICAL_OUTLOOK": "请输入政治面貌", + "DEGREE_OF_EDUCATION": "请选择文化程度", + "HEALTH_CONDITION": "请选择健康状况", + "GRADUATION_INSTITUTION": "请输入毕业院校", + // "DUTIES": "请输入专业", + "TITLE": "请输入职务/职称", + "DOMICILE": "请输入职户籍所在地", + "WORKING_DATE": "请输入参加工作日期", + "WORK_HOURS": "请输入之前从事时间", + "WORK_EXPERIENCE": "请输入工作经历", + "CERTIFICATES": "请输入证书等情况", + "PUNISH": "请输入处罚等情况", + "ENTRY_DATE": "请输入进入本单位时间", + }, + CORPINFO_ID: '', + currentDate: Date.now(), + entryDate: Date.now(), + show: false, + showEntry: false, + showDegree: false, + showPolitica: false, + showNation: false, + showDuties: false, + formatter(type, value) { + if (type === 'year') { + return `${value}年`; + } + if (type === 'month') { + return `${value}月`; + } + if (type === 'day') { + return `${value}日`; + } + return value; + }, + minDate: new Date('1900-01-01').getTime(), + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + // this.getDuties() + this.getDegree() + this.getNation() + this.getPolitical() + this.setData({ + CORPINFO_ID: options.CORPINFO_ID + }) + this.getData() + }, + /** + * 专业 + */ + // async getDuties() { + // let resData = await getDictionaries({ + // DICTIONARIES_ID: '95530fecbcb3421ca600b58c206b99d6' + // }) + // this.setData({ + // dutiesList: resData.list + // }) + // }, + /** + * 文化程度 + */ + async getDegree() { + let resData = await getDictionaries({ + DICTIONARIES_ID: 'd7d80f08d73a4accbccf4fd3d8d1d867' + }) + this.setData({ + degreeOfEducationList: resData.list + }) + }, + /** + * 民族 + */ + async getNation() { + let resData = await getDictionaries({ + DICTIONARIES_ID: '0a0e406f27f74ee698fe9979d25f62dd' + }) + this.setData({ + nationList: resData.list + }) + }, + /** + * 政治面貌 + */ + async getPolitical() { + let resData = await getDictionaries({ + DICTIONARIES_ID: '6351efdd12dc4730952e5d195718e252' + }) + this.setData({ + politicalList: resData.list + }) + }, + /** + * 初始数据 + */ + async getData() { + let resData = await getUserEnterpriseInfo({ + CORPINFO_ID: this.data.CORPINFO_ID + }) + this.setData({ + form: resData.userInfo + }) + if(resData.userInfo.PORTRAIT){ + let url = FILEPATHPRE + resData.userInfo.PORTRAIT + const { fileList = [] } = this.data; + fileList.push({ url: url}); + this.setData({ fileList }); + } + if (resData.userInfo.DEGREE_OF_EDUCATION_NAME) { + this.setData({ + degreeName: resData.userInfo.DEGREE_OF_EDUCATION_NAME + }) + } + if (resData.userInfo.NATION_EDUCATION_NAME) { + this.setData({ + nationName: resData.userInfo.NATION_EDUCATION_NAME + }) + } + if (resData.userInfo.POLITICAL_OUTLOOK_EDUCATION_NAME) { + this.setData({ + politicaName: resData.userInfo.POLITICAL_OUTLOOK_EDUCATION_NAME + }) + } + // if (resData.userInfo.DUTIES_EDUCATION_NAME) { + // this.setData({ + // dutiesName: resData.userInfo.DUTIES_EDUCATION_NAME + // }) + // } + }, + /** + * 时间选择器 + */ + showPopFn() { + this.setData({ show: true }); + }, + showEntryFn() { + this.setData({ showEntry: true }); + }, + showDegreeFn() { + this.setData({ showDegree: true }); + }, + showPoliticalFn() { + this.setData({ showPolitica: true }); + }, + showNationFn() { + this.setData({ showNation: true }); + }, + showDutiesFn() { + this.setData({ showDuties: true }); + }, + /** + * 时间选择器 - 关闭 + */ + onClose() { + this.setData({ show: false }); + }, + onCloseEntry() { + this.setData({ showEntry: false }); + }, + onCloseDegree() { + this.setData({ showDegree: false }); + }, + onClosePolitica() { + this.setData({ showPolitica: false }); + }, + onCloseNation() { + this.setData({ showNation: false }); + }, + onCloseDuties() { + this.setData({ showDuties: false }); + }, + /** + * 时间选择器 - 确定按钮 + */ + confirmFn() { + var time = new Date(this.data.currentDate); + var timeStr = this.timeFormat(time) + var form = this.data.form + form.WORKING_DATE = timeStr + this.setData({ show: false,form: form }); + }, + conEntryFn() { + var time = new Date(this.data.entryDate); + var timeStr = this.timeFormat(time) + var form = this.data.form + form.ENTRY_DATE = timeStr + this.setData({ showEntry: false,form: form }); + }, + onConfirmDegree(event) { + var form = this.data.form + form.DEGREE_OF_EDUCATION = event.detail.value.DICTIONARIES_ID + this.setData({ + degreeName: event.detail.value.NAME, + form: form, + showDegree: false + }); + }, + onConfirmPolitica(event) { + var form = this.data.form + form.POLITICAL_OUTLOOK = event.detail.value.DICTIONARIES_ID + this.setData({ + politicaName: event.detail.value.NAME, + form: form, + showPolitica: false + }); + }, + onConfirmNation(event) { + var form = this.data.form + form.NATION = event.detail.value.DICTIONARIES_ID + this.setData({ + nationName: event.detail.value.NAME, + form: form, + showNation: false + }); + }, + onConfirmDuties(event) { + var form = this.data.form + form.DUTIES = event.detail.value.DICTIONARIES_ID + this.setData({ + dutiesName: event.detail.value.NAME, + form: form, + showDuties: false + }); + }, + /** + * 获取时间 + */ + onInput(event) { + this.setData({ + currentDate: event.detail, + }); + }, + onEntryInput(event) { + this.setData({ + entryDate: event.detail, + }); + }, + /** + * 日期格式化 + */ + timeFormat(time) { + let year = time.getFullYear(); + let month = time.getMonth() + 1; + let day = time.getDate(); + return year + '-' + month + '-' + day + }, + /** + * 底部确定按钮 + */ + async submitUpdate(){ + if(this.data.fileList.length === 0){ + wx.showToast({ + title: '请上传头像', + icon: "none" + }) + return; + } + for (const rulesKey in this.data.rules) { + if (!this.data.form[rulesKey]) { + wx.showToast({ + title: this.data.rules[rulesKey], + icon: "none" + }) + return; + } + } + // let PHONE = this.data.form.PHONE + // if (!(/^1[34578]\d{9}$/.test(PHONE))) { + // wx.showToast({ + // title: '手机号有误', + // icon: 'none', + // }) + // return; + // } + const resData = await updateUserInfo({ + NAME: this.data.form.NAME, + SEX: this.data.form.SEX, + USERNAME: this.data.form.USERNAME, + NATION: this.data.form.NATION, + POLITICAL_OUTLOOK: this.data.form.POLITICAL_OUTLOOK, + DEGREE_OF_EDUCATION: this.data.form.DEGREE_OF_EDUCATION, + HEALTH_CONDITION: this.data.form.HEALTH_CONDITION, + GRADUATION_INSTITUTION: this.data.form.GRADUATION_INSTITUTION, + TITLE: this.data.form.TITLE, + DOMICILE: this.data.form.DOMICILE, + WORKING_DATE: this.data.form.WORKING_DATE, + STUDENT_DEPARTMENT: this.data.form.STUDENT_DEPARTMENT, + TYPE_OF_WORK: this.data.form.TYPE_OF_WORK, + WORK_EXPERIENCE: this.data.form.WORK_EXPERIENCE, + CERTIFICATES: this.data.form.CERTIFICATES, + PUNISH: this.data.form.PUNISH, + WORK_HOURS: this.data.form.WORK_HOURS, + PHONE: this.data.form.PHONE, + DUTIES: this.data.form.DUTIES, + PERSONNEL_TYPE: this.data.form.PERSONNEL_TYPE, + PORTRAIT: this.data.form.PORTRAIT, + ENTRY_DATE: this.data.form.ENTRY_DATE, + CORPINFO_ID: this.data.CORPINFO_ID, + }) + wx.showToast({ + title: '修改成功', + mask: true + }) + setTimeout(() => { + wx.navigateBack() + }, 1500) + }, + bindInput(event) { + this.setData({ + form: { + ...this.data.form, + [event.currentTarget.dataset.key]: event.detail, + } + }) + }, + deleteFile(){ + Dialog.confirm({ + title: '提示', + message: '确定删除头像吗?', + }) + .then(() => { + // on confirm + this.setData({ + fileList: [], + form:{ + ...this.data.form, + PORTRAIT:'' + } + }) + }) + .catch(() => { + // on cancel + }); + }, + afterRead(event) { + const { file } = event.detail; + updateUserPhoto({ + filePath: file.url, + }).then((res) => { + // 上传完成需要更新 fileList + const { fileList = [] } = this.data; + fileList.push({ ...file, url: res.data }); + this.setData({ fileList }); + this.setData({ + form: { + ...this.data.form, + PORTRAIT: res.pd.PORTRAIT, + } + }) + }).catch((e) => { + wx.showToast({ + title: '上传头像失败,请稍后再试', + mask: false, + icon: error + }) + }) + }, +}) diff --git a/pages/mine/information/filling.json b/pages/mine/information/filling.json new file mode 100644 index 0000000..53a2a3c --- /dev/null +++ b/pages/mine/information/filling.json @@ -0,0 +1,14 @@ +{ + "usingComponents": { + "van-field": "@vant/weapp/field/index", + "van-button": "@vant/weapp/button/index", + "van-cell-group": "@vant/weapp/cell-group/index", + "van-cell": "@vant/weapp/cell/index", + "van-datetime-picker": "@vant/weapp/datetime-picker/index", + "van-popup": "@vant/weapp/popup/index", + "van-dialog": "@vant/weapp/dialog/index", + "van-uploader": "@vant/weapp/uploader/index", + "van-picker": "@vant/weapp/picker/index" + }, + "navigationBarTitleText": "信息填报" +} diff --git a/pages/mine/information/filling.wxml b/pages/mine/information/filling.wxml new file mode 100644 index 0000000..f254473 --- /dev/null +++ b/pages/mine/information/filling.wxml @@ -0,0 +1,245 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 确定 + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pages/mine/information/filling.wxss b/pages/mine/information/filling.wxss new file mode 100644 index 0000000..0b39de8 --- /dev/null +++ b/pages/mine/information/filling.wxss @@ -0,0 +1,10 @@ +.container { + background-color: #f7f8fa; + min-height: 100vh; + padding: 30rpx 0; +} + +.button { + width: 90%; + margin-left: 5%; +} diff --git a/pages/mine/information/information.js b/pages/mine/information/information.js new file mode 100644 index 0000000..bf53a1b --- /dev/null +++ b/pages/mine/information/information.js @@ -0,0 +1,66 @@ +// pages/exam/online/online.js +import Dialog from '@vant/weapp/dialog/dialog'; +import Toast from '@vant/weapp/toast/toast'; +import { + getUserEnterprisePage +} from "../../../api/index"; + +Page({ + /** + * 页面的初始数据 + */ + data: { + showCount: 10, + timesOfexamination: 0, + currentPage: 1, + totalPage: 0, + varList: [], + }, + goExam(item) { + let info = item.currentTarget.dataset.item + wx.navigateTo({ + url: '/pages/mine/information/filling?CORPINFO_ID='+info.CORPINFO_ID + }) + }, + async getData() { + let resData = await getUserEnterprisePage({ + showCount: this.data.showCount, + currentPage: this.data.currentPage + }) + this.setData({ + varList: [...this.data.varList, ...resData.varList], + totalPage: resData.page.totalPage + }) + }, + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + this.setData({ + showCount: 10, + currentPage: 1, + totalPage: 0, + varList: [], + }) + this.getData() + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + this.setData({ + currentPage: ++this.data.currentPage + }) + if (this.data.totalPage >= this.data.currentPage) { + this.getData() + } + }, +}) \ No newline at end of file diff --git a/pages/mine/information/information.json b/pages/mine/information/information.json new file mode 100644 index 0000000..ac75599 --- /dev/null +++ b/pages/mine/information/information.json @@ -0,0 +1,11 @@ +{ + "usingComponents": { + "van-image": "@vant/weapp/image/index", + "van-count-down": "@vant/weapp/count-down/index", + "van-button": "@vant/weapp/button/index", + "van-dialog": "@vant/weapp/dialog/index", + "van-toast": "@vant/weapp/toast/index", + "van-empty": "@vant/weapp/empty/index" + }, + "navigationBarTitleText": "信息填报" +} \ No newline at end of file diff --git a/pages/mine/information/information.wxml b/pages/mine/information/information.wxml new file mode 100644 index 0000000..b94fe95 --- /dev/null +++ b/pages/mine/information/information.wxml @@ -0,0 +1,29 @@ + + + + + + 企业名称: {{ item.NAME }} + + + + 部门: {{ item.STUDENT_DEPARTMENT }} + + + + + + + 立即填写 + + + + + + + + + + \ No newline at end of file diff --git a/pages/mine/information/information.wxss b/pages/mine/information/information.wxss new file mode 100644 index 0000000..428a0fa --- /dev/null +++ b/pages/mine/information/information.wxss @@ -0,0 +1,62 @@ +.co { + min-height: 100vh; +} +.my-studies-main { + box-sizing: border-box; + padding: 20rpx; +} +.studies_wrap-top { + width: 100%; + display: flex; + justify-content: space-between; + padding: 20rpx 0; +} +.studies_wrap { + width: 100%; + padding: 0 20rpx; + background: #ffffff; + border-radius: 10rpx; + box-sizing: border-box; + margin-bottom: 20rpx; +} +.studies_wrap_title { + font-weight: bold; + font-size: 30rpx; +} +.studies_wrap_state { + font-size: 30rpx; + flex-basis: 130rpx; + margin-left: 20rpx; +} +.studies_wrap-main { +border-top: 1px solid #eee; +line-height: 50rpx; +margin-top: 10rpx; +font-size: 28rpx; +color: #666; +} +.fcb { + margin-top: 2rpx; + margin-left: 15rpx; + color: #3377ff; +} +.fcd { + margin-top: 2rpx; + margin-left: 15rpx; + color: #666; +} +.studies_wrap-bottom { + width: 100%; + display: flex; + border-top: 1px solid #eee; + padding: 20rpx 0; + margin-top: 10rpx; + font-size: 28rpx; + color: #999; + justify-content: space-between; + align-items: center; +} +.flex { + display: flex; + align-items: center; +} \ No newline at end of file diff --git a/pages/mine/survey/question.js b/pages/mine/survey/question.js new file mode 100644 index 0000000..bfc6b6c --- /dev/null +++ b/pages/mine/survey/question.js @@ -0,0 +1,133 @@ +import { + getUserSurveyInfo, + surveySubmit +} from "../../../api/index"; + +import Dialog from '@vant/weapp/dialog/dialog' +import debounce from '../../../utils/debounce' +Page({ + data: { + time: 0, + count: 0, + current: 0, + CLASS_ID: '', + SURVEY_ID: '', + CORPINFO_ID: '', + topic: [], + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + this.setData({ + CLASS_ID: options.CLASS_ID, + SURVEY_ID: options.SURVEY_ID, + CORPINFO_ID: options.CORPINFO_ID, + }) + this.getData() + }, + onChange(e) { + const index = e.currentTarget.dataset.index + + let detail = e.detail + let varList = this.data.topic + varList[index].ANSWER = detail + this.setData({ + topic: [...varList] + }) + }, + submitPapers() { + Dialog.confirm({ + title: '确定要交问卷吗?', + selector: '#nation', + }) + .then(() => { + debounce(async () => { + let varList = this.data.topic + await surveySubmit({ + questionList: JSON.stringify(varList), + CLASS_ID: this.data.CLASS_ID, + CORPINFO_ID: this.data.CORPINFO_ID, + }) + wx.showToast({ + title: '问卷提交成功', + mask: true + }) + setTimeout(() => { + wx.navigateBack() + }, 1500) + }) + }).catch((e) => { + + }) + + }, + async getData() { + const resData = await getUserSurveyInfo({ + SURVEY_ID: this.data.SURVEY_ID + }) + for (let i = 0; i < resData.questionList.length; i++) { + resData.questionList[i].ANSWER = '' + resData.questionList[i].CHECK = '' + } + this.setData({ + topic: resData.questionList + }) + }, + chooseTopic(e) { + const { + type, + check, + itemid + } = e.currentTarget.dataset + let topic = this.data.topic + let current = this.data.current + if (type === 'radio') { + if (topic[current].CHECK === check) { + topic[current].CHECK = '' + } else { + topic[current].CHECK = check + topic[current].ANSWER = itemid + } + this.setData({ + topic: [...topic] + }) + } + if (type === 'multiple') { + if (topic[current].CHECK) { + let checkedArr = topic[current].CHECK.split(',') + let checkedANSWER = topic[current].ANSWER.split(',') + if (checkedArr.includes(check)) { + checkedArr.splice(checkedArr.indexOf(check), 1) + checkedANSWER.splice(checkedANSWER.indexOf(itemid), 1) + topic[current].CHECK = checkedArr.join(',') + topic[current].ANSWER = checkedANSWER.join(',') + } else { + checkedArr.push(check) + checkedANSWER.push(itemid) + checkedArr.sort() + checkedANSWER.sort() + topic[current].CHECK = checkedArr.join(',') + topic[current].ANSWER = checkedANSWER.join(',') + } + } else { + topic[current].CHECK = check + topic[current].ANSWER = itemid + } + this.setData({ + topic: [...topic] + }) + } + }, + previousQuestion() { + this.setData({ + current: --this.data.current + }) + }, + nextQuestion() { + this.setData({ + current: ++this.data.current + }) + } +}) \ No newline at end of file diff --git a/pages/mine/survey/question.json b/pages/mine/survey/question.json new file mode 100644 index 0000000..799aa33 --- /dev/null +++ b/pages/mine/survey/question.json @@ -0,0 +1,14 @@ +{ + "usingComponents": { + "van-tag": "@vant/weapp/tag/index", + "van-image": "@vant/weapp/image/index", + "van-count-down": "@vant/weapp/count-down/index", + "van-dialog": "@vant/weapp/dialog/index", + "van-icon": "@vant/weapp/icon/index", + "van-field": "@vant/weapp/field/index", + "van-sticky": "@vant/weapp/sticky/index", + "van-button": "@vant/weapp/button/index", + "van-empty": "@vant/weapp/empty/index" + }, + "navigationBarTitleText": "调查问卷" +} \ No newline at end of file diff --git a/pages/mine/survey/question.wxml b/pages/mine/survey/question.wxml new file mode 100644 index 0000000..76a2119 --- /dev/null +++ b/pages/mine/survey/question.wxml @@ -0,0 +1,54 @@ + + + + + + 单选题 + 多选题 + 问答题 + + {{current + 1}}. + {{topic[current].QUESTIONDRY}} + + + + {{index + 1}} + {{item.OPTIONDES}} + + + + + + {{index + 1}} + {{item.OPTIONDES}} + + + + + + + + + + + 上一题 + + + 下一题 + + + + + + 提交问卷 + + + + + {{current + 1}} + / {{topic.length}} + + + + + \ No newline at end of file diff --git a/pages/mine/survey/question.wxss b/pages/mine/survey/question.wxss new file mode 100644 index 0000000..068f600 --- /dev/null +++ b/pages/mine/survey/question.wxss @@ -0,0 +1,149 @@ +.content{ + padding: 20rpx; +} +.top { + border-radius: 20px; + text-align: center; + display: flex; + align-items: center; + justify-content: space-evenly; +} + +.van-count-down{ + color: #eeecec !important; + font-size: 30rpx !important; +} + +.head-text { + position: relative; + z-index: 99; + text-align: center; + font-size: 36rpx; + /* color: whitesmoke; */ + bottom: 285rpx; + color: #fff; + font-weight: bold; +} +.question-info { + background-color: white; + padding: 20rpx; + border-radius: 20rpx; +} +.questions { + position: relative; + z-index: 99; + text-align: center; + font-size: 30rpx; + /* color: whitesmoke; */ + bottom: 250rpx; + color: #eeecec; +} + +.time { + position: relative; + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; + z-index: 99; + text-align: center; + font-size: 25rpx; + /* color: whitesmoke; */ + bottom: 220rpx; + color: #eeecec; +} + +.van-count-down { + color: #eeecec; + font-size: 30rpx; + line-height: normal; +} + +.question { + width: 100%; + padding: 20rpx 20rpx; + background: #ffffff; + border-radius: 10rpx; + box-sizing: border-box; +} + + + +.count-down { + display: flex; + align-items: center; + justify-content: center; + background-color: #3676f2; + padding: 20rpx; + border-top: 1px solid rgba(248, 248, 248, 0.2); + text-align: center; +} + +.container { + padding: 20rpx 20rpx; +} + +.container .index { + padding-left: 10rpx; +} + +.container .stem { + padding-left: 10rpx; + line-height: 55rpx; +} + +.container .options .option { + margin-top: 50rpx; +} + +.container .options .option .choice { + display: inline-block; + border-radius: 50%; + border: 1px solid #f1f1f1; + width: 50rpx; + height: 50rpx; + line-height: 50rpx; + text-align: center; + box-shadow: #f1f1f1; +} + +.container .options .option .choice.check { + background-color: #cbcbcd; + color: #fff; +} + +.container .options .option .title { + margin-left: 20rpx; +} + +.container .answer { + background-color: #ecf2fe; + padding: 20rpx; + margin-top: 50rpx; + border-radius: 10rpx; +} + +.button { + padding: 40rpx 20rpx; + display: flex; + justify-content: space-between; +} + +.footer { + display: flex; + align-items: center; + justify-content: space-between; + position: fixed; + left: 0; + right: 0; + bottom: 0; + box-shadow: 0 -2px 0 0 #f4f4f4; + background-color: #fff; + padding: 15rpx 30rpx; +} + +.footer .surplus { + display: flex; + align-items: center; + color: #d5d5d5; +} diff --git a/pages/mine/survey/survey.js b/pages/mine/survey/survey.js new file mode 100644 index 0000000..44cd5e2 --- /dev/null +++ b/pages/mine/survey/survey.js @@ -0,0 +1,69 @@ +// pages/exam/online/online.js +import Dialog from '@vant/weapp/dialog/dialog'; +import Toast from '@vant/weapp/toast/toast'; +import { + getUserSurveyListPage +} from "../../../api/index"; + +Page({ + /** + * 页面的初始数据 + */ + data: { + showCount: 10, + timesOfexamination: 0, + currentPage: 1, + totalPage: 0, + varList: [], + }, + goExam(item) { + let info = item.currentTarget.dataset.item + wx.navigateTo({ + url: '/pages/mine/survey/question?SURVEY_ID='+info.SURVEY_ID + +'&CLASS_ID='+info.CLASS_ID + +'&CORPINFO_ID='+info.CORPINFO_ID + , + }) + }, + async getData() { + let resData = await getUserSurveyListPage({ + showCount: this.data.showCount, + currentPage: this.data.currentPage + }) + this.setData({ + varList: [...this.data.varList, ...resData.varList], + totalPage: resData.page.totalPage + }) + }, + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + this.setData({ + showCount: 10, + currentPage: 1, + totalPage: 0, + varList: [], + }) + this.getData() + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + this.setData({ + currentPage: ++this.data.currentPage + }) + if (this.data.totalPage >= this.data.currentPage) { + this.getData() + } + }, +}) \ No newline at end of file diff --git a/pages/mine/survey/survey.json b/pages/mine/survey/survey.json new file mode 100644 index 0000000..8126644 --- /dev/null +++ b/pages/mine/survey/survey.json @@ -0,0 +1,11 @@ +{ + "usingComponents": { + "van-image": "@vant/weapp/image/index", + "van-count-down": "@vant/weapp/count-down/index", + "van-button": "@vant/weapp/button/index", + "van-dialog": "@vant/weapp/dialog/index", + "van-toast": "@vant/weapp/toast/index", + "van-empty": "@vant/weapp/empty/index" + }, + "navigationBarTitleText": "调查问卷" +} \ No newline at end of file diff --git a/pages/mine/survey/survey.wxml b/pages/mine/survey/survey.wxml new file mode 100644 index 0000000..f953999 --- /dev/null +++ b/pages/mine/survey/survey.wxml @@ -0,0 +1,30 @@ + + + + + + 班级名称: {{ item.NAME }} + + + 行业类型:{{ item.TRAININGTYPE_NAME }}-{{ item.INDUSTRY_END_NAME }}-{{ item.POSTTYPE_NAME }} + + 培训开始时间:{{ item.START_TIME }} + + + 培训结束时间:{{ item.END_TIME }} + + + + + + 立即填写 + + + + + + + + + + \ No newline at end of file diff --git a/pages/mine/survey/survey.wxss b/pages/mine/survey/survey.wxss new file mode 100644 index 0000000..428a0fa --- /dev/null +++ b/pages/mine/survey/survey.wxss @@ -0,0 +1,62 @@ +.co { + min-height: 100vh; +} +.my-studies-main { + box-sizing: border-box; + padding: 20rpx; +} +.studies_wrap-top { + width: 100%; + display: flex; + justify-content: space-between; + padding: 20rpx 0; +} +.studies_wrap { + width: 100%; + padding: 0 20rpx; + background: #ffffff; + border-radius: 10rpx; + box-sizing: border-box; + margin-bottom: 20rpx; +} +.studies_wrap_title { + font-weight: bold; + font-size: 30rpx; +} +.studies_wrap_state { + font-size: 30rpx; + flex-basis: 130rpx; + margin-left: 20rpx; +} +.studies_wrap-main { +border-top: 1px solid #eee; +line-height: 50rpx; +margin-top: 10rpx; +font-size: 28rpx; +color: #666; +} +.fcb { + margin-top: 2rpx; + margin-left: 15rpx; + color: #3377ff; +} +.fcd { + margin-top: 2rpx; + margin-left: 15rpx; + color: #666; +} +.studies_wrap-bottom { + width: 100%; + display: flex; + border-top: 1px solid #eee; + padding: 20rpx 0; + margin-top: 10rpx; + font-size: 28rpx; + color: #999; + justify-content: space-between; + align-items: center; +} +.flex { + display: flex; + align-items: center; +} \ No newline at end of file diff --git a/pages/photo/collection.js b/pages/photo/collection.js new file mode 100644 index 0000000..18192fa --- /dev/null +++ b/pages/photo/collection.js @@ -0,0 +1,164 @@ +import { + getHeadPhoto, + updateUserIdFile, + faceRecognition +} from "../../api/index"; +import { + FILEPATHPRE +} from "../../utils/util" +import Dialog from '@vant/weapp/dialog/dialog'; +const app = getApp() +Page({ + data: { + capture: ['camera'], + uploadMsg: '上传图片', + FILEPATHPRE: FILEPATHPRE, + filePath: '', + EXAMFACE: false, + message: '照片要求人像清晰,神态自然,无明显畸变。头部占照片尺寸2/3,纯色背景无边框,照片尺寸为二寸(35*49毫米,413*578像素)' + }, + afterRead(event) { + const { + file + } = event.detail; + // 正常的头像上传 + if (!this.data.EXAMFACE) { + updateUserIdFile({ + filePath: file.url, + }).then((resData) => { + if (resData.code == 0) { + app.globalData.userInfo.AUTHENTICATION = '1' + this.getData() + Dialog.alert({ + message: '您已成功认证', + selector: '#myDialog', + }) + .then(() => { + wx.navigateBack() + }); + } + }).catch((e) => { + wx.showToast({ + title: '人像比对不通过,请重新提交审核', + mask: false, + icon: error + }) + }) + } else { + // 考试前人脸识别 + faceRecognition({ + filePath: file.url, + formData:{ + STUDENT_ID: this.data.STUDENT_ID + } + }).then((resData)=>{ + if (resData.code == 0) { + Dialog.alert({ + message: '您已成功认证,返回立即考试', + selector: '#myDialog', + }) + .then(() => { + //当前页面 + let pages = getCurrentPages(); + //上一页面 + let prevPage = pages[pages.length-2]; + wx.navigateBack({ + delta: 1, + success: function () { + if(prevPage != null && prevPage.route == 'pages/exam/online/online'){ + let dataInfo = prevPage.data.dataInfo + dataInfo.EXAM_FACE_PATH = true + prevPage.photoResult(dataInfo); + } + } + }) + }); + } else { + Dialog.alert({ + message: '比对失败,请重新比对', + selector: '#myDialog', + }) + .then(() => { + + }); + } + }) + } + + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + console.log(options); + if (!options.STUDENT_ID) { + this.getData() + } else { + this.setData({ + STUDENT_ID: options.STUDENT_ID, + EXAMFACE: true, + uploadMsg: '人脸认证', + message: '点击“人脸认证”按钮进行人脸识别核验,务必本人进行人脸识别。' + }) + } + }, + async getData() { + const resData = await getHeadPhoto({}); + if (resData.pd.AUTHENTICATION == '1') { + this.setData({ + filePath: FILEPATHPRE + resData.pd.PORTRAIT + }) + this.setData({ + uploadMsg: '已认证,重新上传' + }) + } + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/photo/collection.json b/pages/photo/collection.json new file mode 100644 index 0000000..d98850e --- /dev/null +++ b/pages/photo/collection.json @@ -0,0 +1,10 @@ +{ + "usingComponents": { + "van-uploader": "@vant/weapp/uploader/index", + "van-button": "@vant/weapp/button/index", + "van-image": "@vant/weapp/image/index", + "van-dialog": "@vant/weapp/dialog/index", + "van-toast": "@vant/weapp/toast/index" + }, + "navigationBarTitleText": "人像采集" +} \ No newline at end of file diff --git a/pages/photo/collection.wxml b/pages/photo/collection.wxml new file mode 100644 index 0000000..1d5c96e --- /dev/null +++ b/pages/photo/collection.wxml @@ -0,0 +1,17 @@ + + + {{ message }} + + + + + + + + + + {{uploadMsg}} + + + + \ No newline at end of file diff --git a/pages/photo/collection.wxss b/pages/photo/collection.wxss new file mode 100644 index 0000000..4597a0e --- /dev/null +++ b/pages/photo/collection.wxss @@ -0,0 +1,26 @@ +.content{ + background-color: #fff; + min-height: 100vh; +} +.te-info { + padding: 20rpx; + position: relative; +} +.img-stu { + margin-top: 50rpx; + position: absolute; + left: 50%; + transform: translateX(-50%); +} +.img-face{ + margin-top: 120rpx; + position: absolute; + left: 50%; + transform: translateX(-50%); +} +.img-btn { + position: absolute; + margin-top: 950rpx; + left: 50%; + transform: translateX(-50%); +} \ No newline at end of file diff --git a/pages/sign/sign.js b/pages/sign/sign.js new file mode 100644 index 0000000..f62bcf7 --- /dev/null +++ b/pages/sign/sign.js @@ -0,0 +1,199 @@ +import { + getHeadPhoto, + updateUserIdFile, + faceRecognition, + updUserSign +} from "../../api/index"; +import { + FILEPATHPRE +} from "../../utils/util" +import Dialog from '@vant/weapp/dialog/dialog'; +const app = getApp() +Page({ + data: { + capture: ['camera'], + uploadMsg: '上传签字', + FILEPATHPRE: FILEPATHPRE, + filePath: '', + EXAMFACE: false, + }, + afterRead(event) { + const { + file + } = event.detail; + // 正常的头像上传 + if (!this.data.EXAMFACE) { + updateUserIdFile({ + filePath: file.url, + }).then((resData) => { + if (resData.code == 0) { + app.globalData.userInfo.AUTHENTICATION = '1' + this.getData() + Dialog.alert({ + message: '您已成功认证', + selector: '#myDialog', + }) + .then(() => { + wx.navigateBack() + }); + } + }).catch((e) => { + wx.showToast({ + title: '人像比对不通过,请重新提交审核', + mask: false, + icon: error + }) + }) + } else { + // 考试前人脸识别 + faceRecognition({ + filePath: file.url, + formData:{ + STUDENT_ID: this.data.STUDENT_ID + } + }).then((resData)=>{ + if (resData.code == 0) { + Dialog.alert({ + message: '您已成功认证,返回立即考试', + selector: '#myDialog', + }) + .then(() => { + //当前页面 + let pages = getCurrentPages(); + //上一页面 + let prevPage = pages[pages.length-2]; + wx.navigateBack({ + delta: 1, + success: function () { + if(prevPage != null && prevPage.route == 'pages/exam/online/online'){ + let dataInfo = prevPage.data.dataInfo + dataInfo.EXAM_FACE_PATH = true + prevPage.photoResult(dataInfo); + } + } + }) + }); + } else { + Dialog.alert({ + message: '比对失败,请重新比对', + selector: '#myDialog', + }) + .then(() => { + + }); + } + }) + } + + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + console.log(options); + if (!options.STUDENT_ID) { + this.getData() + } else { + this.setData({ + STUDENT_ID: options.STUDENT_ID, + EXAMFACE: true, + uploadMsg: '上传签字' + }) + } + }, + userSignShowChange(){ + this.setData({ + userSignShow:!this.data.userSignShow + }) + }, + async getData() { + const resData = await getHeadPhoto({}); + if (resData.pd.SIGNATURE_FILE_PATH != null) { + this.setData({ + filePath: FILEPATHPRE + resData.pd.SIGNATURE_FILE_PATH + }) + this.setData({ + uploadMsg: '已签字,重新上传' + }) + } + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + }, + openSign() { + this.setData({ + userSignShow: true + }) + }, + + fnInput1(event) { + // 签字图片 event.detail + updUserSign({ + filePath: event.detail, + formData:{ + USER_ID: app.globalData.userInfo.USER_ID + } + }).then((resData) => { + if(resData.code != 0) { + wx.showToast({ + title: '请重签', + mask: false, + icon:error + }) + }else { + wx.showToast({ + title: '签字已经更新', + mask: false + }) + this.getData(); + } + }).catch((e) =>{ + console.log(e); + }) + }, +}) \ No newline at end of file diff --git a/pages/sign/sign.json b/pages/sign/sign.json new file mode 100644 index 0000000..0e97a73 --- /dev/null +++ b/pages/sign/sign.json @@ -0,0 +1,11 @@ +{ + "usingComponents": { + "van-uploader": "@vant/weapp/uploader/index", + "van-button": "@vant/weapp/button/index", + "van-image": "@vant/weapp/image/index", + "van-dialog": "@vant/weapp/dialog/index", + "van-toast": "@vant/weapp/toast/index", + "sign": "/components/sign/sign" + }, + "navigationBarTitleText": "签字采集" +} \ No newline at end of file diff --git a/pages/sign/sign.wxml b/pages/sign/sign.wxml new file mode 100644 index 0000000..80a3a11 --- /dev/null +++ b/pages/sign/sign.wxml @@ -0,0 +1,17 @@ + + + 签字要求字体清晰,横向排版,在画布中心签字。勿乱涂乱画、大小不一、签字不全等。此签字仅在档案中使用。 + + + + + + + + + {{uploadMsg}} + + + + + \ No newline at end of file diff --git a/pages/sign/sign.wxss b/pages/sign/sign.wxss new file mode 100644 index 0000000..bc7dfbb --- /dev/null +++ b/pages/sign/sign.wxss @@ -0,0 +1,26 @@ +.content{ + background-color: #fff; + min-height: 100vh; +} +.te-info { + padding: 20rpx; + position: relative; +} +.img-stu { + margin-top: 350rpx; + position: absolute; + left: 50%; + transform: translateX(-50%); +} +.img-face{ + margin-top: 120rpx; + position: absolute; + left: 50%; + transform: translateX(-50%); +} +.img-btn { + position: absolute; + margin-top: 950rpx; + left: 50%; + transform: translateX(-50%); +} \ No newline at end of file diff --git a/project.config.json b/project.config.json new file mode 100644 index 0000000..4418d16 --- /dev/null +++ b/project.config.json @@ -0,0 +1,62 @@ +{ + "description": "项目配置文件,详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", + "packOptions": { + "ignore": [], + "include": [] + }, + "setting": { + "bundle": false, + "userConfirmedBundleSwitch": false, + "urlCheck": true, + "scopeDataCheck": false, + "coverView": true, + "es6": true, + "postcss": true, + "compileHotReLoad": false, + "lazyloadPlaceholderEnable": false, + "preloadBackgroundData": false, + "minified": true, + "autoAudits": false, + "newFeature": false, + "uglifyFileName": false, + "uploadWithSourceMap": true, + "useIsolateContext": true, + "nodeModules": false, + "enhance": true, + "useMultiFrameRuntime": true, + "useApiHook": true, + "useApiHostProcess": true, + "showShadowRootInWxmlPanel": true, + "enableEngineNative": false, + "minifyWXSS": true, + "showES6CompileOption": false, + "minifyWXML": true, + "babelSetting": { + "ignore": [], + "disablePlugins": [], + "outputPath": "" + }, + "packNpmManually": true, + "packNpmRelationList": [ + { + "packageJsonPath": "./package.json", + "miniprogramNpmDistDir": "./" + } + ], + "ignoreDevUnusedFiles": false, + "useStaticServer": true, + "checkInvalidKey": true, + "disableUseStrict": false, + "useCompilerPlugins": false, + "condition": false + }, + "compileType": "miniprogram", + "libVersion": "2.26.1", + "appid": "wx0c79c2adb6ae5f04", + "projectname": "miniprogram-92", + "condition": {}, + "editorSetting": { + "tabIndent": "insertSpaces", + "tabSize": 2 + } +} \ No newline at end of file diff --git a/project.private.config.json b/project.private.config.json new file mode 100644 index 0000000..27b6d29 --- /dev/null +++ b/project.private.config.json @@ -0,0 +1,10 @@ +{ + "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", + "projectname": "%E4%BC%81%E4%B8%9A%E7%AB%AF", + "setting": { + "compileHotReLoad": true, + "urlCheck": false + }, + "libVersion": "2.32.3", + "condition": {} +} \ No newline at end of file diff --git a/sitemap.json b/sitemap.json new file mode 100644 index 0000000..ca02add --- /dev/null +++ b/sitemap.json @@ -0,0 +1,7 @@ +{ + "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html", + "rules": [{ + "action": "allow", + "page": "*" + }] +} \ No newline at end of file diff --git a/utils/debounce.js b/utils/debounce.js new file mode 100644 index 0000000..42ab706 --- /dev/null +++ b/utils/debounce.js @@ -0,0 +1,29 @@ +let timeout = null + +/** + * 防抖 + * + * @param {Function} func 要执行的回调函数 + * @param {Number} wait 延时的时间 + * @param {Boolean} immediate 是否立即执行 + * @return null + */ +function debounce(func, wait = 1000, immediate = true) { + // 清除定时器 + if (timeout !== null) clearTimeout(timeout) + // 立即执行 + if (immediate) { + const callNow = !timeout + timeout = setTimeout(() => { + timeout = null + }, wait) + if (callNow) typeof func === 'function' && func() + } else { + // 设置定时器,当最后一次操作后,timeout不会再被清除,所以在延时wait毫秒后执行func回调方法 + timeout = setTimeout(() => { + typeof func === 'function' && func() + }, wait) + } +} + +export default debounce diff --git a/utils/request.js b/utils/request.js new file mode 100644 index 0000000..b53ec79 --- /dev/null +++ b/utils/request.js @@ -0,0 +1,93 @@ +// let requestPath = 'https://qynx.qhdsafety.com/qa-education/'; // 后台请求地址 +// let requestPath = 'http://192.168.0.30:7451/'; // 后台请求地址 +let requestPath = 'http://192.168.0.31:7452/qa-education-exam-ent'; // 测试请求地址 +const app = getApp() + +function post(url, data) { + return new Promise((resolve, reject) => { + if (data && data.loading !== false) { + wx.showLoading({ + title: '加载中', + mask: true + }); + } + wx.request({ + url: requestPath + url, + data: { + USER_ID:app.globalData?.userInfo?.USER_ID, + ...data + }, + method: 'POST', + header: { + 'Content-type': 'application/x-www-form-urlencoded' + }, + success: (res) => { + if (data && data.loading !== false) { + wx.hideLoading(); + } + if (res.data.result === 'success') { + resolve(res.data) + } else { + wx.showToast({ + title: res.data.msg || '系统开小差了', + icon: 'error', + }); + reject(res.data) + } + }, + fail: (err) => { + if (data && data.loading !== false) { + wx.hideLoading(); + } + wx.showToast({ + title: '网络错误请重试', + icon: 'error', + }); + reject(err) + } + }); + }) +} + +function upload(url, data) { + return new Promise((resolve, reject) => { + if (data && data.loading !== false) { + wx.showLoading({ + title: '加载中', + mask: true + }); + } + wx.uploadFile({ + url: requestPath + url, + filePath: data.filePath, + name: data.name || 'FFILE', + formData: { + USER_ID:app.globalData?.userInfo?.USER_ID, + ...data.formData} || {}, + success: (res) => { + if (data && data.loading !== false) { + wx.hideLoading(); + } + if (JSON.parse(res.data).result === 'success') { + resolve(JSON.parse(res.data)) + } else { + wx.showToast({ + title: JSON.parse(res.data).msg || '系统开小差了', + icon: 'error', + }); + reject(JSON.parse(res.data)) + } + }, + fail: (err) => { + wx.hideLoading(); + wx.showToast({ + title: '网络错误请重试', + icon: 'error', + }); + reject(err) + } + }); + }) +} + +export {post, upload} diff --git a/utils/util.js b/utils/util.js new file mode 100644 index 0000000..b3978ac --- /dev/null +++ b/utils/util.js @@ -0,0 +1,95 @@ +const FILEPATHPRE = 'https://file.zcloudchina.com/JYPXFile' + +// 格式化日期为YYYY-MM-DD HH:mm +const formatTime = time => { + const date = new Date(time) + const year = date.getFullYear() + const month = date.getMonth() + 1 + const day = date.getDate() + const hour = date.getHours() + const minute = date.getMinutes() + + return `${[year, month, day].map(formatNumber).join('-')} ${[hour, minute].map(formatNumber).join(':')}` +} + +// 格式化日期为YYYY-MM-DD +const formatDay = time => { + const date = new Date(time) + const year = date.getFullYear() + const month = date.getMonth() + 1 + const day = date.getDate() + + return `${[year, month, day].map(formatNumber).join('-')}` +} +const getNowDate = () => { + var date = new Date(); + var sign2 = ":"; + var year = date.getFullYear() // 年 + var month = date.getMonth() + 1; // 月 + var day = date.getDate(); // 日 + var hour = date.getHours(); // 时 + var minutes = date.getMinutes(); // 分 + var seconds = date.getSeconds() //秒 + // 给一位数的数据前面加 “0” + if (month >= 1 && month <= 9) { + month = "0" + month; + } + if (day >= 0 && day <= 9) { + day = "0" + day; + } + if (hour >= 0 && hour <= 9) { + hour = "0" + hour; + } + if (minutes >= 0 && minutes <= 9) { + minutes = "0" + minutes; + } + if (seconds >= 0 && seconds <= 9) { + seconds = "0" + seconds; + } + return year + "-" + month + "-" + day + " " + hour + sign2 + minutes + sign2 + seconds; +} + +// 格式化日期为YYYY-MM +const formatMonth = time => { + const date = new Date(time) + const year = date.getFullYear() + const month = date.getMonth() + 1 + + return `${[year, month].map(formatNumber).join('-')}` +} + +const formatNumber = n => { + n = n.toString() + return n[1] ? n : `0${n}` +} + +// 将秒转成时分秒 +const formatSeconds = value => { + let secondTime = parseInt(value);// 秒 + let minuteTime = 0;// 分 + let hourTime = 0;// 小时 + if (secondTime > 60) {//如果秒数大于60,将秒数转换成整数 + //获取分钟,除以60取整数,得到整数分钟 + minuteTime = parseInt(secondTime / 60); + //获取秒数,秒数取佘,得到整数秒数 + secondTime = parseInt(secondTime % 60); + //如果分钟大于60,将分钟转换成小时 + if (minuteTime > 60) { + //获取小时,获取分钟除以60,得到整数小时 + hourTime = parseInt(minuteTime / 60); + //获取小时后取佘的分,获取分钟除以60取佘的分 + minuteTime = parseInt(minuteTime % 60); + } + } + let result = "" + parseInt(secondTime) + "秒"; + + if (minuteTime > 0) { + result = "" + parseInt(minuteTime) + "分" + result; + } + if (hourTime > 0) { + result = "" + parseInt(hourTime) + "小时" + result; + } + return result; +} + +export {formatTime, formatDay, formatMonth,getNowDate ,formatSeconds, FILEPATHPRE} diff --git a/utils/util.wxs b/utils/util.wxs new file mode 100644 index 0000000..85c5570 --- /dev/null +++ b/utils/util.wxs @@ -0,0 +1,6 @@ +function indexOf(str, value) { + return str.indexOf(value) +} +module.exports = { + indexOf: indexOf +}; \ No newline at end of file