| | |
| | | } |
| | | if (taskInfo) { |
| | | router.replace({ |
| | | path: '/transmission' |
| | | path: '/home' |
| | | }) |
| | | window.electronAPI.newDownloadTask(taskInfo) |
| | | } |
| | |
| | | .catch(() => {}) |
| | | }) |
| | | } |
| | | const getUrlParam = (paraName) => { |
| | | var url = window.location.toString() |
| | | var arrObj = url.split('?') |
| | | if (arrObj.length > 1) { |
| | | var arrPara = arrObj[1].split('&') |
| | | var arr |
| | | for (var i = 0; i < arrPara.length; i++) { |
| | | arr = arrPara[i].split('=') |
| | | if (arr != null && arr[0] == paraName) { |
| | | return arr[1] |
| | | } |
| | | } |
| | | return '' |
| | | } else { |
| | | return '' |
| | | } |
| | | } |
| | | |
| | | const token = localStorage.getItem('token') |
| | | if (token) { |
| | | let tokens = getUrlParam('token') |
| | | let bookId = getUrlParam('bookId') |
| | | let tryPageCount = getUrlParam('tryPageCount') |
| | | localStorage.setItem('bookId', bookId) |
| | | localStorage.setItem('tryPageCount', tryPageCount) |
| | | const token = localStorage.getItem('token') || tokens |
| | | localStorage.setItem('token', token) |
| | | if (tokens && bookId) { |
| | | router.replace({ |
| | | path: '/home' |
| | | path: '/home', |
| | | query: { bookId: bookId } |
| | | }) |
| | | // request({ |
| | | // url: '/identity/User/GetCurrentUser', |
| | | // method: 'post' |
| | | // }).then((res) => { |
| | | // // console.log(res) |
| | | // }) |
| | | } else { |
| | | router.replace({ |
| | | path: '/login' |