From 90f120a995fca08f03ece3a30c5320a9c8ed4ebb Mon Sep 17 00:00:00 2001 From: kun <1422840143@qq.com> Date: Fri, 24 May 2024 19:01:30 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20BUG=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .hbuilderx/launch.json | 2 +- main.js | 30 ++++ manifest.json | 4 +- pages.json | 11 +- .../exam/beginexam/beginexam.vue | 136 ++++++++++++------ .../exam/examresult/examresult.vue | 21 ++- pages/personLocation/exam/index/index.vue | 2 + pages/personLocation/exam/rules/rules.vue | 16 +-- .../exam/studydetails/studydetails.vue | 7 +- pages/personLocation/index/index.vue | 8 +- pages/projectEnd/carManage/index.vue | 2 +- pages/projectEnd/trainPlan/details.vue | 4 +- pages/projectEnd/trainPlan/list.vue | 8 +- .../trainPlan/searchTeam/personList.vue | 38 ++++- pages/projectEnd/trainPlan/selectPerson.vue | 36 +++-- 15 files changed, 237 insertions(+), 88 deletions(-) diff --git a/.hbuilderx/launch.json b/.hbuilderx/launch.json index a7cf3e92..a461607e 100644 --- a/.hbuilderx/launch.json +++ b/.hbuilderx/launch.json @@ -19,7 +19,7 @@ "type" : "uniCloud" }, { - "playground" : "custom", + "playground" : "standard", "type" : "uni-app:app-android" }, { diff --git a/main.js b/main.js index 4788d853..c7d30d9f 100644 --- a/main.js +++ b/main.js @@ -306,6 +306,36 @@ Vue.prototype.sendRequest = function(param) { }); } +// 按钮权限控制指令 +Vue.directive('permission', { + inserted: (el, binding) => { + const { + value + } = binding; + // 判断当前用户是否拥有该按钮权限 + if (!Vue.prototype.checkPermission(value)) { + el.parentNode.removeChild(el); + } + } +}); +// 判断权限的函数 +Vue.prototype.checkPermission = function(permission) { + var permissions = JSON.parse(uni.getStorageSync("userInfo")).menuAuthority.menuList; + console.log(permission,'我的测试指令1') + console.log(permissions,'我的测试指令2') + // var permissions = store.state.userInfo.menuAuthority.menuList; + permissions = permissions.filter( + (x) => x.path == permission.menuPath + )[0]; + if (!permissions.actionList) { + return false; + } + let index = permissions.actionList.findIndex( + (x) => x.actionCode == permission.key + ) + console.log(index,'我的测试指令3') + return index != -1 ? true : false; +} const app = new Vue({ ...App }) diff --git a/manifest.json b/manifest.json index 03d8acc8..e971f119 100644 --- a/manifest.json +++ b/manifest.json @@ -2,8 +2,8 @@ "name" : "智慧安全", //中建四局 "appid" : "__UNI__4AA4101", "description" : "", - "versionName" : "1.5.6", - "versionCode" : 156, + "versionName" : "1.5.7", + "versionCode" : 157, "transformPx" : false, /* 5+App特有相关 */ "app-plus" : { diff --git a/pages.json b/pages.json index 0405b92f..8b85b4a9 100644 --- a/pages.json +++ b/pages.json @@ -2541,13 +2541,7 @@ { "path": "pages/personLocation/exam/examresult/examresult", "style": { - "app-plus": { - "titleNView": { - "titleColor": "#ffffff", - "autoBackButton": false - } - }, - "navigationBarTitleText": "考试结果" + "navigationBarTitleText": "" } }, { @@ -2586,7 +2580,6 @@ "path": "pages/personLocation/exam/rules/rules", "style": { "navigationBarTitleText": "规章", - "enablePullDownRefresh": true, "onReachBottomDistance": 100 } }, @@ -2716,7 +2709,7 @@ // }] // }], "globalStyle": { - "navigationBarBackgroundColor": "#F0AD4E", + // "navigationBarBackgroundColor": "#F0AD4E", "navigationStyle": "custom", "app-plus": { "bounce": "none" diff --git a/pages/personLocation/exam/beginexam/beginexam.vue b/pages/personLocation/exam/beginexam/beginexam.vue index 017f5f4f..1fa76899 100644 --- a/pages/personLocation/exam/beginexam/beginexam.vue +++ b/pages/personLocation/exam/beginexam/beginexam.vue @@ -5,37 +5,45 @@ 开始考试 - - - {{index + 1}}、{{item.questionName}}({{item.score||0}}分) - 剩余时间:{{ timeLeft }} + + 剩余时间:{{ timeLeft }} + + + {{index + 1}}、 + {{item.questionName}}({{item.score||0}}分) + + + + + + + + + - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - @@ -58,16 +66,20 @@ this.getDataFn(); }, onLoad(options) { + console.log(options, 123456) this.pageData = JSON.parse(options.transportData) console.log(this.pageData.examDuration) - this.totalTime = +this.pageData.examDuration * 60; }, onShow() { + this.totalTime = +this.pageData.examDuration * 60; this.startTimer(); }, onHide() { this.stopTimer(); }, + onUnload() { + this.stopTimer(); + }, computed: { timeLeft() { let hours = Math.floor(this.totalTime / 3600); @@ -132,6 +144,7 @@ }, 1000); }, stopTimer() { + console.log('我计时器已卸载') clearInterval(this.timer); this.timer = null; }, @@ -207,15 +220,15 @@ goFront(index) { let that = this; that.stIndex--; - var progressTip = document.querySelector('.uni-progress-info'); - progressTip.innerText = (((that.stIndex + 1) * 100) / that.stList.length).toFixed(0) + '%' + // var progressTip = document.querySelector('.uni-progress-info'); + // progressTip.innerText = (((that.stIndex + 1) * 100) / that.stList.length).toFixed(0) + '%' }, // 去下一题 goNext(index) { let that = this; that.stIndex++; - var progressTip = document.querySelector('.uni-progress-info'); - progressTip.innerText = (((that.stIndex + 1) * 100) / that.stList.length).toFixed(0) + '%' + // var progressTip = document.querySelector('.uni-progress-info'); + // progressTip.innerText = (((that.stIndex + 1) * 100) / that.stList.length).toFixed(0) + '%' // uni.hideLoading() }, goHiidden() { @@ -260,32 +273,63 @@ \ No newline at end of file diff --git a/pages/projectEnd/trainPlan/selectPerson.vue b/pages/projectEnd/trainPlan/selectPerson.vue index 90c650dd..0d3a3b82 100644 --- a/pages/projectEnd/trainPlan/selectPerson.vue +++ b/pages/projectEnd/trainPlan/selectPerson.vue @@ -13,6 +13,7 @@ {{item.workerType}} {{item.sex == 1?'男':'女'}}  {{item.age}} + @@ -47,13 +48,25 @@ uni.removeStorageSync("personInfo") }, onShow() { - if(uni.getStorageSync("personInfo")){ - this.personList = JSON.parse(uni.getStorageSync("personInfo")) + if (uni.getStorageSync("personInfo")) { + let storeArr = JSON.parse(uni.getStorageSync("personInfo")); + let newArr = []; + storeArr.map(item => { + let findIndex = this.personList.findIndex(item2 => item2.workerId == item.workerId) + if(findIndex == -1){ + newArr.push(item) + } + }) + this.personList = this.personList.concat(newArr) } }, methods: { - addForm(){ - if(!this.personList.length){ + deletePersonFn(index) { + this.personList.splice(index, 1) + uni.setStorageSync("personInfo", JSON.stringify(this.personList)) + }, + addForm() { + if (!this.personList.length) { uni.showToast({ title: '请选择人员', icon: 'none' @@ -71,20 +84,20 @@ header: {}, method: 'post', success(res) { - if(res.code == 200){ + if (res.code == 200) { uni.showToast({ title: "添加成功" }) - setTimeout(function(){ + setTimeout(function() { uni.redirectTo({ url: './list' }) - },500) + }, 500) } } }) }, - toSelectPerson(){ + toSelectPerson() { uni.navigateTo({ url: './searchTeam/teamList' }) @@ -118,11 +131,13 @@ .main-content { display: flex; flex-direction: column; + .index-boxs { height: calc(100vh - 200rpx); overflow-y: scroll; padding: 58rpx 35rpx; padding-bottom: 10rpx; + .index-box { width: 100%; background-color: white; @@ -144,6 +159,7 @@ flex-direction: column; justify-content: space-around; margin: 8rpx 20rpx 0rpx 20rpx; + margin-right: auto; text:nth-child(1) { color: #303030; @@ -173,6 +189,7 @@ align-items: center; box-sizing: border-box; z-index: 99; + .btn-select { width: 50%; line-height: 40px; @@ -181,7 +198,8 @@ text-align: center; border-radius: 10rpx; } - .btn-resubmit{ + + .btn-resubmit { width: 50%; line-height: 40px; background-color: #5382F6;