diff --git a/components/yk-authpup/yk-authpup.vue b/components/yk-authpup/yk-authpup.vue index c686dc7..7c8d0dc 100644 --- a/components/yk-authpup/yk-authpup.vue +++ b/components/yk-authpup/yk-authpup.vue @@ -87,138 +87,136 @@ //权限检测 requestPermissions(permissionID) { let _this = this; - _this.$emit('changeAuth'); - // - // // #ifdef APP-PLUS - // //判断安卓与ios设备 - // if (plus.os.name == 'Android') { - // let _permissionID = 'android.permission.' + permissionID; - // plus.android.checkPermission(_permissionID, - // granted => { - // if (granted.checkResult == -1) { - // //还未授权当前查询的权限,打开权限申请目的自定义弹框 - // _this.showPopup = true; - // _this.$nextTick(() => { - // setTimeout(() => { - // _this.ani = 'uni-' + _this.type - // },30) - // }) - // } - // }, - // error => { - // console.log(error.message); - // } - // ); - // plus.android.requestPermissions([_permissionID], - // (e) => { - // //关闭权限申请目的自定义弹框 - // _this.ani = ''; - // _this.$nextTick(() => { - // setTimeout(() => { - // _this.showPopup = false - // }, 0) - // }) - // console.log(e,'kkkkk') - // if (e.granted.length > 0) { - // //当前查询权限已授权,此时可以通知页面执行接下来的操作 - // _this.$emit('changeAuth'); - // } - // if (e.deniedAlways.length > 0) { - // //当前查询权限已被永久禁用,此时需要引导用户跳转手机系统设置去开启 - // uni.showModal({ - // title: '温馨提示', - // content: '还没有该权限,立即去设置开启?', - // cancelText: "取消", - // confirmText: "去设置", - // showCancel: true, - // confirmColor: '#000', - // cancelColor: '#666', - // success: (res) => { - // if (res.confirm) { - // _this.goSetting(); - // } - // } - // }) - // } - // }) - // } else { - // //IOS不需要添加自定义弹框来描述权限目的,因为在配置文件的隐私信息访问的许可描述里可添加 - // //正常可以直接调用uni的API调起权限询问弹框使用各种权限,下面的判断使用场景主要是在IOS禁用某权限后,这个可以判断有无权限,进而引导用户跳转设置开启,仅列出了位置、相册、通讯录、相机、录音等权限,其他IOS权限可具体参考 https://ext.dcloud.net.cn/plugin?id=15787 - // let result = 0; - // if (permissionID == 'ACCESS_FINE_LOCATION') { - // //IOS检测位置权限 - // let cLLocationManager = plus.ios.importClass("CLLocationManager"), - // authStatus = cLLocationManager.authorizationStatus(), - // enable = cLLocationManager.locationServicesEnabled(); - // if (enable && authStatus != 2) { - // result = 1; - // } else { - // result = 0; - // } - // plus.ios.deleteObject(cLLocationManager); - // } else if (permissionID == 'WRITE_EXTERNAL_STORAGE') { - // //IOS检测相册权限 - // let PHPhotoLibrary = plus.ios.importClass("PHPhotoLibrary"), - // authStatus = PHPhotoLibrary.authorizationStatus(); - // if (authStatus === 3) { - // result = 1; - // } else { - // result = 0; - // } - // plus.ios.deleteObject(PHPhotoLibrary); - // } else if (permissionID == 'CAMERA') { - // //IOS检测相机/摄像头权限 - // let avCaptureDevice = plus.ios.importClass("AVCaptureDevice"), - // authStatus = avCaptureDevice.authorizationStatusForMediaType("vide"); - // if (authStatus === 3) { - // result = 1; - // } else { - // result = 0; - // } - // plus.ios.deleteObject(avCaptureDevice); - // } else if (permissionID == 'CALL_PHONE') { - // //IOS检测通讯录权限 - // let contactStore = plus.ios.importClass("CNContactStore"), - // authStatus = contactStore.authorizationStatusForEntityType(0); - // if (authStatus === 3) { - // result = 1; - // } else { - // result = 0; - // } - // plus.ios.deleteObject(contactStore); - // }else if(permissionID == 'RECORD_AUDIO'){ - // //IOS检测麦克风权限 - // let aVAudioSession = plus.ios.importClass("AVAudioSession"), - // aVAudio = aVAudioSession.sharedInstance(), - // authStatus = aVAudio.recordPermission(); - // if ([1684369017, 1970168948].includes(authStatus)) { - // result = 0; - // } else { - // result = 1; - // } - // plus.ios.deleteObject(aVAudioSession); - // } - // if (result) { - // //当前查询权限已授权,此时可以通知页面执行接下来的操作 - // that.$emit('changeAuth') - // } else { - // //当前查询的权限已禁用,引导用户跳转手机系统设置去开启 - // uni.showModal({ - // title: '温馨提示', - // content: '还没有该权限,立即去设置开启?', - // cancelText: "取消", - // confirmText: "去设置", - // showCancel: true, - // confirmColor: '#000', - // cancelColor: '#666', - // success: (res) => { - // if (res.confirm) { - // _this.goSetting(); - // } - // } - // }) - // } - // } + // #ifdef APP-PLUS + //判断安卓与ios设备 + if (plus.os.name == 'Android') { + let _permissionID = 'android.permission.' + permissionID; + plus.android.checkPermission(_permissionID, + granted => { + if (granted.checkResult == -1) { + //还未授权当前查询的权限,打开权限申请目的自定义弹框 + _this.showPopup = true; + _this.$nextTick(() => { + setTimeout(() => { + _this.ani = 'uni-' + _this.type + },30) + }) + } + }, + error => { + console.log(error.message); + } + ); + plus.android.requestPermissions([_permissionID], + (e) => { + //关闭权限申请目的自定义弹框 + _this.ani = ''; + _this.$nextTick(() => { + setTimeout(() => { + _this.showPopup = false + }, 0) + }) + console.log(e,'kkkkk') + if (e.granted.length > 0) { + //当前查询权限已授权,此时可以通知页面执行接下来的操作 + _this.$emit('changeAuth'); + } + if (e.deniedAlways.length > 0) { + //当前查询权限已被永久禁用,此时需要引导用户跳转手机系统设置去开启 + uni.showModal({ + title: '温馨提示', + content: '还没有该权限,立即去设置开启?', + cancelText: "取消", + confirmText: "去设置", + showCancel: true, + confirmColor: '#000', + cancelColor: '#666', + success: (res) => { + if (res.confirm) { + _this.goSetting(); + } + } + }) + } + }) + } else { + //IOS不需要添加自定义弹框来描述权限目的,因为在配置文件的隐私信息访问的许可描述里可添加 + //正常可以直接调用uni的API调起权限询问弹框使用各种权限,下面的判断使用场景主要是在IOS禁用某权限后,这个可以判断有无权限,进而引导用户跳转设置开启,仅列出了位置、相册、通讯录、相机、录音等权限,其他IOS权限可具体参考 https://ext.dcloud.net.cn/plugin?id=15787 + let result = 0; + if (permissionID == 'ACCESS_FINE_LOCATION') { + //IOS检测位置权限 + let cLLocationManager = plus.ios.importClass("CLLocationManager"), + authStatus = cLLocationManager.authorizationStatus(), + enable = cLLocationManager.locationServicesEnabled(); + if (enable && authStatus != 2) { + result = 1; + } else { + result = 0; + } + plus.ios.deleteObject(cLLocationManager); + } else if (permissionID == 'WRITE_EXTERNAL_STORAGE') { + //IOS检测相册权限 + let PHPhotoLibrary = plus.ios.importClass("PHPhotoLibrary"), + authStatus = PHPhotoLibrary.authorizationStatus(); + if (authStatus === 3) { + result = 1; + } else { + result = 0; + } + plus.ios.deleteObject(PHPhotoLibrary); + } else if (permissionID == 'CAMERA') { + //IOS检测相机/摄像头权限 + let avCaptureDevice = plus.ios.importClass("AVCaptureDevice"), + authStatus = avCaptureDevice.authorizationStatusForMediaType("vide"); + if (authStatus === 3) { + result = 1; + } else { + result = 0; + } + plus.ios.deleteObject(avCaptureDevice); + } else if (permissionID == 'CALL_PHONE') { + //IOS检测通讯录权限 + let contactStore = plus.ios.importClass("CNContactStore"), + authStatus = contactStore.authorizationStatusForEntityType(0); + if (authStatus === 3) { + result = 1; + } else { + result = 0; + } + plus.ios.deleteObject(contactStore); + }else if(permissionID == 'RECORD_AUDIO'){ + //IOS检测麦克风权限 + let aVAudioSession = plus.ios.importClass("AVAudioSession"), + aVAudio = aVAudioSession.sharedInstance(), + authStatus = aVAudio.recordPermission(); + if ([1684369017, 1970168948].includes(authStatus)) { + result = 0; + } else { + result = 1; + } + plus.ios.deleteObject(aVAudioSession); + } + if (result) { + //当前查询权限已授权,此时可以通知页面执行接下来的操作 + that.$emit('changeAuth') + } else { + //当前查询的权限已禁用,引导用户跳转手机系统设置去开启 + uni.showModal({ + title: '温馨提示', + content: '还没有该权限,立即去设置开启?', + cancelText: "取消", + confirmText: "去设置", + showCancel: true, + confirmColor: '#000', + cancelColor: '#666', + success: (res) => { + if (res.confirm) { + _this.goSetting(); + } + } + }) + } + } // #endif }, //跳转手机系统设置 diff --git a/pages/application/confinedspace/confinedspace-list/index.vue b/pages/application/confinedspace/confinedspace-list/index.vue index 064b9e8..9fe6a7f 100644 --- a/pages/application/confinedspace/confinedspace-list/index.vue +++ b/pages/application/confinedspace/confinedspace-list/index.vue @@ -93,7 +93,7 @@ {{item.STEP_NAME}} - {{item.ACT_USER_NAME || item.SIGN_USER}} + {{item.SIGN_USER || item.FINISHED_SIGN_USER || item.ACT_USER_NAME }} {{item.ACT_TIME}} diff --git a/pages/application/eight-assignments.vue b/pages/application/eight-assignments.vue index 8e0d6f5..12a16a0 100644 --- a/pages/application/eight-assignments.vue +++ b/pages/application/eight-assignments.vue @@ -12,7 +12,7 @@ 八项作业 --> - + {{eight_work_count.CONFINEDSPACE_COUNT}} @@ -30,7 +30,7 @@ - + {{eight_work_count.BLIND_BOARD_COUNT}} @@ -39,7 +39,7 @@ 盲板抽堵作业 - + {{eight_work_count.BREAK_GROUND_COUNT}} @@ -48,7 +48,7 @@ 动土作业 - + {{eight_work_count.HIGHWORK_COUNT}} @@ -59,7 +59,7 @@ - + {{eight_work_count.HOISTING_COUNT}} @@ -68,7 +68,6 @@ 吊装作业 - @@ -78,7 +77,7 @@ 临时用电作业 - + {{eight_work_count.HOTWORK_COUNT}} @@ -87,7 +86,7 @@ 动火作业 - + {{eight_work_count.OPEN_CIRCUIT_COUNT}} diff --git a/pages/application/hidden-danger-management/hidden-danger-no-change/hidden-danger-no-change-detail.vue b/pages/application/hidden-danger-management/hidden-danger-no-change/hidden-danger-no-change-detail.vue index 9fa39f2..e47ac43 100644 --- a/pages/application/hidden-danger-management/hidden-danger-no-change/hidden-danger-no-change-detail.vue +++ b/pages/application/hidden-danger-management/hidden-danger-no-change/hidden-danger-no-change-detail.vue @@ -624,30 +624,21 @@ }, //图片上传 - ChooseImage() { + ChooseImage() { var _this = this; - var ss = 4 - this.hiddenForm.hiddenImgs.length; uni.chooseImage({ - count: ss, //默认9 + count: 4, //默认9 sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 sourceType: ['camera', 'album'], //从相册选择 success: (res) => { - for (let i = 0; i < res.tempFilePaths.length; i++) { - if (e == 0) { - let img = {}; - img.IMGFILES_ID = ''; - img.FILEPATH = res.tempFilePaths[i]; - this.hiddenForm.hiddenImgs.push(img) - } else { - let img = {}; - img.IMGFILES_ID = ''; - img.FILEPATH = res.tempFilePaths[i]; - this.imgList1.push(img) - } + if (this.imgList.length != 0) { + this.imgList = this.imgList.concat(res.tempFilePaths) + } else { + this.imgList = res.tempFilePaths } } }); - }, + }, ViewImage(e) { uni.previewImage({ urls: this.imgList, @@ -672,13 +663,15 @@ ChooseImage_fa() { var _this = this; uni.chooseImage({ - count: 4 - _this.imgList.length, // +++ 确保总数不超过4张 - sizeType: ['original', 'compressed'], - sourceType: ['camera', 'album'], + count: 4, //默认9 + sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 + sourceType: ['camera', 'album'], //从相册选择 success: (res) => { - // 将选择的图片路径添加到 imgList 数组 - _this.imgList = _this.imgList.concat(res.tempFilePaths); - _this.$forceUpdate(); // +++ 强制更新视图以显示新图片 + if (this.imgList_fa.length != 0) { + this.imgList_fa = this.imgList_fa.concat(res.tempFilePaths) + } else { + this.imgList_fa = res.tempFilePaths + } } }); }, @@ -762,14 +755,14 @@ }); return; } - // if (_this.imgList.length <= 0) { - // uni.showToast({ - // icon: 'none', - // title: '请上传整改后照片', - // duration: 1500 - // }); - // return; - // } + if (_this.imgList.length <= 0) { + uni.showToast({ + icon: 'none', + title: '请上传整改后照片', + duration: 1500 + }); + return; + } if (this.HAVESCHEME == 1) { if (this.pd.GOVERNSTANDARDS == '' || this.pd.GOVERNSTANDARDS == undefined) { diff --git a/pages/application/highwork/highwork-list/index.vue b/pages/application/highwork/highwork-list/index.vue index 3023d3d..dcb7172 100644 --- a/pages/application/highwork/highwork-list/index.vue +++ b/pages/application/highwork/highwork-list/index.vue @@ -100,7 +100,7 @@ {{item.STEP_NAME}} - {{item.ACT_USER_NAME || item.SIGN_USER}} + {{item.SIGN_USER || item.FINISHED_SIGN_USER || item.ACT_USER_NAME }} {{item.ACT_TIME}} diff --git a/pages/basics/home.vue b/pages/basics/home.vue index 2052fbd..f140c99 100644 --- a/pages/basics/home.vue +++ b/pages/basics/home.vue @@ -104,7 +104,7 @@ + > {{ eight_work_count }} @@ -125,7 +125,7 @@ {{ keyProjectManagement }} + > @@ -134,7 +134,7 @@ + > @@ -180,7 +180,7 @@ + > @@ -657,12 +657,8 @@ loginSession() this.getSafetyEnvironmentalInspectionCount(); this.getUpdateInfo() - this.premission = Object.assign({}, premission) let now = new Date(); var today = formatDate(now, 'yyyy-MM-dd'); - if (!this.premission || JSON.stringify(this.premission) === '{}') { - this.getMenu(); - } this.getIsRest(); this.getData(); this.getSurveyData(); @@ -765,118 +761,6 @@ }) }, - getMenu() { - var _this = this; - uni.showLoading({ - title: '请稍候' - }) - uni.request({ - url: basePath + '/app/main/index', - method: 'POST', - dataType: 'json', - header: { - 'Content-type': 'application/x-www-form-urlencoded' - }, - data: { - USER_ID: loginUser.USER_ID, - }, - success: (res) => { - console.log(res.data.result) - if ("success" == res.data.result) { - - var menuList = res.data.menuList - var premissionList = new Map() - - menuList.map(item => { - if (item.menu_NAME == '安全承诺' && item.hasMenu) { - premissionList.set('commitment', true) - if (item.subMenu && item.subMenu.length > 0) { - item.subMenu.map(child => { - if (child.menu_NAME == '公司级承诺公告' && child - .hasMenu) { - premissionList.set('commitment-company', true) - } - if (child.menu_NAME == '车间级承诺公告' && child - .hasMenu) { - premissionList.set('commitment-workshop', true) - } - if (child.menu_NAME == '班组级承诺公告' && child - .hasMenu) { - premissionList.set('commitment-team', true) - } - }) - } - } - - if (item.menu_NAME == '受限空间作业管理' && item.hasMenu) { - premissionList.set('eightWork', true) - premissionList.set('confinedspace', true) - } - if (item.menu_NAME == '动火作业管理' && item.hasMenu) { - premissionList.set('eightWork', true) - premissionList.set('hotwork', true) - } - if (item.menu_NAME == '高处作业管理' && item.hasMenu) { - premissionList.set('eightWork', true) - premissionList.set('high-work', true) - } - if (item.menu_NAME == '吊装作业管理' && item.hasMenu) { - premissionList.set('eightWork', true) - premissionList.set('hoisting', true) - } - if (item.menu_NAME == '盲板抽堵作业管理' && item.hasMenu) { - premissionList.set('eightWork', true) - premissionList.set('blind-board', true) - } - if (item.menu_NAME == '动土作业管理' && item.hasMenu) { - premissionList.set('eightWork', true) - premissionList.set('break-ground', true) - } - if (item.menu_NAME == '临时用电作业管理' && item.hasMenu) { - premissionList.set('eightWork', true) - premissionList.set('electricity', true) - } - if (item.menu_NAME == '断路作业管理' && item.hasMenu) { - premissionList.set('eightWork', true) - premissionList.set('open-circuit', true) - } - if (item.menu_NAME == '在线学习与考试' && item.hasMenu) { - premissionList.set('education', true) - } - // console.info(premissionList) - if (item.menu_NAME == '设备设施管理' && item.hasMenu) { - premissionList.set('speEquip', true) - } - }) - this.premission = (Object.fromEntries(premissionList)); - setPremission(Object.fromEntries(premissionList)); - uni.hideLoading(); - } else { - setloginUserId(null); - setCorpinfoId(null); - setDeptId(null); - setloginUser(null); - uni.removeStorage({ - key: 'USER' - }); - uni.reLaunch({ - url: '/pages/login/home' - }); - // uni.showToast({ - // title: res.data.message, - // duration: 2000 - // }); - } - }, - fail: (res) => { - uni.showToast({ - icon: 'none', - title: "服务器正在升级,请稍后再试。", - duration: 2000 - }); - } - }); - }, async downCallback(page) { await this.getWork(); await this.getUserData(); diff --git a/pages/login/home.vue b/pages/login/home.vue index ccffa5f..15514f1 100644 --- a/pages/login/home.vue +++ b/pages/login/home.vue @@ -89,26 +89,12 @@ noClick: true, userName: '', userPwd: '', - push_clientid: '', radio: '' } }, async onLoad() { this.getRemember() - uni.getPushClientId({ - success: (res) => { - this.push_clientid = res.cid - this.getLoginUser() - console.log('客户端推送标识:', res.cid) - }, - fail(err) { - uni.showToast({ - icon: 'none', - title: "获取用户标识失败,请重新登录", - duration: 2000 - }); - } - }); + this.getLoginUser() // this.getLoginUser() //this.getUrlVersion(); }, @@ -160,7 +146,6 @@ USER_ID: loginUser.USER_ID, }, success: (res1) => { - this.updatePushCid(USER_ID, this.push_clientid) if ("success" == res1.data.result) { if (res1.data.ISREST != null) { setIsRest(res1.data.ISREST); @@ -292,8 +277,14 @@ key: 'remember', data: remember }); - this.getMenu() - this.updatePushCid(res.data.USER_ID, this.push_clientid) + uni.hideLoading(); + uni.showToast({ + title: "登录成功", + duration: 1000 + }); + uni.redirectTo({ + url: '/pages/index/index' + }); } else if ("usererror" == result) { uni.showToast({ icon: 'none', @@ -346,114 +337,6 @@ duration: 2000 }); } - }) - }, - getMenu() { - var _this = this; - uni.showLoading({ - title: '请稍候' - }) - uni.request({ - url: basePath + '/app/main/index', - method: 'POST', - dataType: 'json', - header: { - 'Content-type': 'application/x-www-form-urlencoded' - }, - data: { - USER_ID: loginUser.USER_ID, - }, - success: (res) => { - - if ("success" == res.data.result) { - - var menuList = res.data.menuList - var premissionList = new Map() - - menuList.map(item => { - if (item.menu_NAME == '安全承诺' && item.hasMenu) { - premissionList.set('commitment', true) - if (item.subMenu && item.subMenu.length > 0) { - item.subMenu.map(child => { - if (child.menu_NAME == '公司级承诺公告' && child - .hasMenu) { - premissionList.set('commitment-company', true) - } - if (child.menu_NAME == '车间级承诺公告' && child - .hasMenu) { - premissionList.set('commitment-workshop', true) - } - if (child.menu_NAME == '班组级承诺公告' && child - .hasMenu) { - premissionList.set('commitment-team', true) - } - }) - } - } - - if (item.menu_NAME == '受限空间作业管理' && item.hasMenu) { - premissionList.set('eightWork', true) - premissionList.set('confinedspace', true) - } - if (item.menu_NAME == '动火作业管理' && item.hasMenu) { - premissionList.set('eightWork', true) - premissionList.set('hotwork', true) - } - if (item.menu_NAME == '高处作业管理' && item.hasMenu) { - premissionList.set('eightWork', true) - premissionList.set('high-work', true) - } - if (item.menu_NAME == '吊装作业管理' && item.hasMenu) { - premissionList.set('eightWork', true) - premissionList.set('hoisting', true) - } - if (item.menu_NAME == '盲板抽堵作业管理' && item.hasMenu) { - premissionList.set('eightWork', true) - premissionList.set('blind-board', true) - } - if (item.menu_NAME == '动土作业管理' && item.hasMenu) { - premissionList.set('eightWork', true) - premissionList.set('break-ground', true) - } - if (item.menu_NAME == '临时用电作业管理' && item.hasMenu) { - premissionList.set('eightWork', true) - premissionList.set('electricity', true) - } - if (item.menu_NAME == '断路作业管理' && item.hasMenu) { - premissionList.set('eightWork', true) - premissionList.set('open-circuit', true) - } - if (item.menu_NAME == '在线学习与考试' && item.hasMenu) { - premissionList.set('education', true) - } - - if (item.menu_NAME == '设备设施管理' && item.hasMenu) { - premissionList.set('speEquip', true) - } - }) - setPremission(Object.fromEntries(premissionList)); - uni.hideLoading(); - uni.showToast({ - title: "登录成功", - duration: 1000 - }); - uni.redirectTo({ - url: '/pages/index/index' - }); - } else { - uni.showToast({ - title: res.data.message, - duration: 2000 - }); - } - }, - fail: (res) => { - uni.showToast({ - icon: 'none', - title: "服务器正在升级,请稍后再试。", - duration: 2000 - }); - } }); }, getUrlVersion() { @@ -486,20 +369,6 @@ }); }); }, - updatePushCid(userId, pushCid) { - uni.request({ - url: basePath + '/app/user/updatePushCid', - method: 'POST', - dataType: 'json', - header: { - 'Content-type': 'application/x-www-form-urlencoded' - }, - data: { - USER_ID: userId, - PUSH_CID: pushCid - }, - }); - } } }