From 08ca74600f3a552549f3a08f59a34dfd5030e5e5 Mon Sep 17 00:00:00 2001 From: yxq Date: Fri, 11 Aug 2023 17:27:55 +0800 Subject: [PATCH] =?UTF-8?q?app=20=E8=80=83=E5=8B=A4=E6=89=93=E5=8D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LearunApp-2.2.0/common/custompage.js | 41 ++++ .../LearunApp-2.2.0/common/wxFn.js | 8 +- .../components/learun-app/upload-file.vue | 7 +- .../components/uploadImage.vue | 226 ++++++++++++++++++ .../LearunApp-2.2.0/manifest.json | 6 +- .../LearunApp-2.2.0/pages.json | 6 + .../pages/AttendanceCard/list.vue | 95 ++++++-- .../pages/AttendanceCard/single.vue | 162 +++++++++++++ 8 files changed, 526 insertions(+), 25 deletions(-) create mode 100644 Learun.Framework.Ultimate V7/LearunApp-2.2.0/components/uploadImage.vue create mode 100644 Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/AttendanceCard/single.vue diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/common/custompage.js b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/common/custompage.js index 151baa403..f0660da50 100644 --- a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/common/custompage.js +++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/common/custompage.js @@ -105,6 +105,8 @@ export default { } uni.setStorageSync('folderIds',JSON.stringify(folderIds)); return [] + case 'upload_old': + return [] case 'guid': return this.GUID('-') @@ -252,6 +254,27 @@ export default { } return uploadUid; + case 'upload_old': + const valArray = val.map(item=>{ + return { + uid:item.uid, + path:item.path===undefined?item:item.path + } + }) + const uploadUid_ = [] + for (const { path, uid } of valArray) { + if (uid) { + uploadUid_.push(uid) + continue + } + + const fileId = await this.HTTP_UPLOAD(path) + if (fileId) { + uploadUid_.push(fileId) + } + } + + return uploadUid_.join(',') default: return val || '' @@ -347,6 +370,24 @@ export default { }) } return fileList + case 'upload_old': + if (!val) { return [] } + const uidList_ = val.split(',') + const fileList_ = [] + + for (const uid of uidList_ || []) { + const fileInfo = await this.FETCH_FILEINFO(uid) + if (!fileInfo) { continue } + + const fileType = fileInfo.F_FileType + const fileSize = fileInfo.F_FileSize + const fileName = fileInfo.F_FileName + + const path = this.API + 'learun/adms/annexes/wxdown?' + this.URL_QUERY(uid, true) + + fileList_.push({ path, type: fileType, uid, size: fileSize, name:fileName }) + } + return fileList_ case 'radio': case 'select': diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/common/wxFn.js b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/common/wxFn.js index 31b9d6dc7..e04c7e77a 100644 --- a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/common/wxFn.js +++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/common/wxFn.js @@ -1,4 +1,5 @@ import wx from '@/common/js/weixin-js-sdk.js'; +// 参考文档 https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html export default { methods: { data(){ @@ -29,7 +30,7 @@ export default { }); wx.ready(() => { this.wxInit = true - this.TOAST("wx初始化成功") + // this.TOAST("wx初始化成功") resolve(true) }) wx.error(() => { @@ -51,7 +52,7 @@ export default { } } if(!wx.getLocation){ - this.TOAST("无效方法") + this.TOAST("获取定位失败") resolve(false) } wx.getLocation({ @@ -67,7 +68,7 @@ export default { }) }, fail: function(error) { - this.TOAST("定位失败") + this.TOAST("获取定位失败!") resolve(false) } }); @@ -93,6 +94,7 @@ export default { sourceType: ['camera'], // 可以指定来源是相册还是相机,默认二者都有 success: function(res) { var localIds = res.localIds;// 返回选定照片的本地ID列表,localId可以作为img标签的src属性显示图片 + resolve(localIds) }, fail: function(error) { this.TOAST("定位失败") diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/components/learun-app/upload-file.vue b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/components/learun-app/upload-file.vue index eab555db1..aefbdc5f5 100644 --- a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/components/learun-app/upload-file.vue +++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/components/learun-app/upload-file.vue @@ -53,7 +53,10 @@ export default { readonly: {}, value: { default: () => [] }, title: {}, - required: {} + required: {}, + accept:{ + default:()=>['album', 'camera'] + } }, methods: { @@ -104,7 +107,7 @@ export default { uni.chooseFile({ count: Number(this.number), sizeType: ['original', 'compressed'], - sourceType: ['album', 'camera'], + sourceType: this.accept, success: ({ tempFilePaths,tempFiles }) => { const newList = JSON.parse(JSON.stringify(this.value || [])).concat( // tempFilePaths//.map(t => ({ path: t, type: this.getFileExt(t) })) diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/components/uploadImage.vue b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/components/uploadImage.vue new file mode 100644 index 000000000..c558933a0 --- /dev/null +++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/components/uploadImage.vue @@ -0,0 +1,226 @@ + + + + + diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/manifest.json b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/manifest.json index 784d2098b..5534f33ab 100644 --- a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/manifest.json +++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/manifest.json @@ -191,11 +191,7 @@ }, "domain" : "testapp.bjquanjiang.com", "sdkConfigs" : { - "maps" : { - "qqmap" : { - "key" : "EZCBZ-IDUCZ-G3UXY-ZMP3T-5XNQE-AXBZS" - } - } + "maps" : {} } }, "mp-qq" : { diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages.json b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages.json index d82e8cb8e..2abbc69f3 100644 --- a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages.json +++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages.json @@ -407,6 +407,12 @@ "navigationBarTitleText": "考勤打卡" } }, + { + "path": "pages/AttendanceCard/single", + "style": { + "navigationBarTitleText": "外勤打卡" + } + }, //班级自诊打卡 { "path": "pages/EducationalAdministration/Thermography/list", diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/AttendanceCard/list.vue b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/AttendanceCard/list.vue index 0bbde14c4..24da7cd02 100644 --- a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/AttendanceCard/list.vue +++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/AttendanceCard/list.vue @@ -7,7 +7,7 @@ 上班 {{info.WorkTime}} - {{info.UserWorkTime?info.UserWorkTime.substring(8)+' 打卡':'未打卡'}} + {{info.UserWorkTime?info.UserWorkTime.split(' ')[1]+' 打卡':'未打卡'}} @@ -15,7 +15,7 @@ 下班 {{info.CloseTime}} - {{info.UserCloseTime?info.UserCloseTime.substring(8)+' 打卡':'未打卡'}} + {{info.UserCloseTime?info.UserCloseTime.split(' ')[1]+' 打卡':'未打卡'}} @@ -25,7 +25,12 @@ - {{info.AttendanceTypeString}} + + {{resInfo.AttendanceTypeString}} + {{postData.AIsOut== 1 ? ' | ' + info.AttendanceTypeString:''}} + + {{postData.ClockPlace}} + @@ -73,11 +78,15 @@ return { // 页面相关参数 info: {}, + resInfo:{}, now: null, imgsrc: dk, ready: false, timer: '', + timer1:'', map: null, + postData: {}, + isGetingLocal:false, } }, @@ -92,9 +101,9 @@ this.now = this.getCurrentTime() this.timer = setInterval(this.getCurrentTime, 1000) - await this.judgeIsDK() + let res = await this.judgeIsDK() - this.ready = true + this.ready = res ? true : false this.HIDE_LOADING() }, @@ -102,7 +111,11 @@ async action(type) { switch (type) { case 'dk': - if (this.imgsrc == dkred) { + if ([5].includes(this.info.AttendanceType)) { + return + } + if ([4].includes(this.info.AttendanceType)) { + this.NAV_TO(`./single`, this.postData,true) return } this.LOADING() @@ -126,7 +139,7 @@ async judgeIsDK() { let success = await this.HTTP_GET('learun/adms/attendance/IsAttendance', {}, '判断当前时间是否可以打卡失败') if (!success) { - return + return false } this.info = success.data this.imgsrc = dk; @@ -138,10 +151,28 @@ // this.imgsrc=dkred; // } if (![5].includes(this.info.AttendanceType)) { + // 保存原打卡状态,改为外勤 + this.resInfo = { + AttendanceType:this.info.AttendanceType, + AttendanceTypeString:this.info.AttendanceTypeString, + } + this.$set(this.info, 'AttendanceType', 4) + this.$set(this.info, 'AttendanceTypeString', '外勤打卡') + this.$set(this.postData, 'AIsOut', 1) + // 获取定位,不是外勤时候改变状态 if (!window.BMapGL) await this.loadJScript() this.map = new BMapGL.Map('container'); + await this.isFieldPersonnel() + this.timer1 = setInterval(async ()=>{ + if(this.isGetingLocal)return + this.isGetingLocal = true + await this.isFieldPersonnel() + // console.log(this.postData) + this.isGetingLocal = false + },3000) } + return true }, //返回 back() { @@ -181,37 +212,71 @@ // new BMapGL.Point(116.404, 39.915) let myP2 = await this.local(); if (!myP2) { - this.TOAST('获取定位失败!') + // this.TOAST('获取定位失败!') + this.$set(this.info, 'AttendanceType', 4) + this.$set(this.info, 'AttendanceTypeString', '外勤打卡') + this.$set(this.postData, 'AIsOut', 1) return } let distance = this.map.getDistance(myP1, myP2).toFixed(2) - console.log('距离', distance, '打卡坐标:', myP1, '当前坐标:', myP2) + // alert('距离'+ distance) + // console.log('距离', distance, '打卡坐标:', myP1, '当前坐标:', myP2) if (Number(distance) > Number(this.info.GPSRange)) { this.$set(this.info, 'AttendanceType', 4) this.$set(this.info, 'AttendanceTypeString', '外勤打卡') + this.$set(this.postData, 'AIsOut', 1) + } else { + this.$set(this.info, 'AttendanceType', this.resInfo.AttendanceType) + this.$set(this.info, 'AttendanceTypeString', this.resInfo.AttendanceTypeString) + this.$set(this.postData, 'AIsOut', 0) } }, // 获取当前位置 local() { return new Promise(async (resolve) => { let res = await this.getLocation() + // let res = { + // lng: 112.57205562051, + // lat: 37.742374280962 + // } if (!res) { + this.$set(this.postData, 'ALon', '') + this.$set(this.postData, 'ALat', '') + this.$set(this.postData, 'ClockPlace', '') resolve(false) } new BMapGL.Convertor().translate([res], 3, 5, data => { - if(res.status == 0){ - alert(res.points[0].lng + '' + res.points[0].lat) - resolve(res.points[0]) - }else{ + if (data.status == 0) { + // alert(data.points[0].lng + '' + data.points[0].lat) + this.$set(this.postData, 'ALon', data.points[0].lng) + this.$set(this.postData, 'ALat', data.points[0].lat) + let geoc = new BMapGL.Geocoder(); + geoc.getLocation(data.points[0], (rs) => { + let addComp = rs.addressComponents; + let address = + addComp.province + + addComp.city + + addComp.district + + addComp.street + + addComp.streetNumber + this.$set(this.postData, 'ClockPlace', address) + resolve(data.points[0]) + }); + } else { + this.$set(this.postData, 'ALon', '') + this.$set(this.postData, 'ALat', '') + this.$set(this.postData, 'ClockPlace', '') + this.TOAST('获取定位失败!') resolve(false) } - + }) }); - }, + } }, destroyed() { clearInterval(this.timer) + clearInterval(this.timer1) } } diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/AttendanceCard/single.vue b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/AttendanceCard/single.vue new file mode 100644 index 000000000..30da66a3a --- /dev/null +++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/AttendanceCard/single.vue @@ -0,0 +1,162 @@ + + + + \ No newline at end of file