From 0d105feb0b108f8f2a4db16f0c3ba5f6970b4370 Mon Sep 17 00:00:00 2001 From: xuhuajiao <13476289682@163.com> Date: Fri, 8 Sep 2023 17:33:28 +0800 Subject: [PATCH] 0908 --- src/views/accessToLibrary/index.vue | 37 +++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/src/views/accessToLibrary/index.vue b/src/views/accessToLibrary/index.vue index 7e09ea7..27763e1 100644 --- a/src/views/accessToLibrary/index.vue +++ b/src/views/accessToLibrary/index.vue @@ -64,8 +64,33 @@ export default { }, methods: { getInitIntoNum() { - this.otherDoorOther = window.location.href.split('?')[1]?.split('=')[1] - console.log(this.otherDoorOther) + // this.otherDoorOther = window.location.href.split('?')[1]?.split('=')[1] + const currentURL = window.location.href + const query = currentURL.split('?')[1] + console.log(query) + console.log(query.indexOf('startTime')) + if (query.indexOf('startTime') !== -1 || query.indexOf('endTime') !== -1) { + const paramsUrl = query.split('&') + console.log(paramsUrl) + let startTimeIndex = -1 + for (let i = 0; i < paramsUrl.length; i++) { + const [key] = paramsUrl[i].split('=') + if (key === 'startTime' || key === 'endTime') { + startTimeIndex = i + break + } + } + // 去除 startTime 参数及其后面的参数 + const filteredParams = startTimeIndex >= 0 ? paramsUrl.slice(0, startTimeIndex) : params + const newQueryString = filteredParams.join('&') + this.otherDoorOther = newQueryString.split('=')[1] + } else { + this.otherDoorOther = query.split('=')[1] + } + + const startTime = this.$route.query.startTime + const endTime = this.$route.query.endTime + if (this.otherDoorOther && this.otherDoorOther !== '' && this.otherDoorOther.indexOf('&')) { this.otherDoorOther = this.otherDoorOther.replace(/\&/g, '、') } else { @@ -74,11 +99,15 @@ export default { let params if (!this.isSelfService) { params = { - doorCodes: this.otherDoorOther + doorCodes: this.otherDoorOther, + startTime: startTime, + endTime: endTime } } else { params = { - doorCodes: 'D001' + doorCodes: 'D001', + startTime: startTime, + endTime: endTime } } FetchInitIntoNum(params).then((res) => {