diff --git a/src/views/accessToLibrary/index.vue b/src/views/accessToLibrary/index.vue index 27763e1..59bf6ed 100644 --- a/src/views/accessToLibrary/index.vue +++ b/src/views/accessToLibrary/index.vue @@ -66,26 +66,31 @@ export default { getInitIntoNum() { // 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 + console.log(currentURL) + if (currentURL.indexOf('?') !== -1) { + 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] } - // 去除 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] + this.otherDoorOther = null } const startTime = this.$route.query.startTime @@ -96,6 +101,7 @@ export default { } else { this.otherDoorOther = null } + let params if (!this.isSelfService) { params = {