index token问题
This commit is contained in:
parent
6306c5e606
commit
cbb90940bd
|
@ -33,7 +33,7 @@ const useStore = useUserStore()
|
||||||
let code = 'activity'
|
let code = 'activity'
|
||||||
let timer = null
|
let timer = null
|
||||||
const codeType = {
|
const codeType = {
|
||||||
interface: 'api_code',
|
Interface: 'api_code',
|
||||||
lottery: 'lottery_code',
|
lottery: 'lottery_code',
|
||||||
activity: 'activity_code',
|
activity: 'activity_code',
|
||||||
}
|
}
|
||||||
|
@ -128,11 +128,8 @@ const initData = (res) => {
|
||||||
login_content_template: loginValid,
|
login_content_template: loginValid,
|
||||||
login_content_templates: login,
|
login_content_templates: login,
|
||||||
content_templates: baseUrl,
|
content_templates: baseUrl,
|
||||||
// eslint-disable-next-line camelcase
|
|
||||||
activity_code,
|
|
||||||
} = res.data
|
} = res.data
|
||||||
// eslint-disable-next-line camelcase
|
query.value = res.data.activity_code
|
||||||
query.value = activity_code
|
|
||||||
Object.assign(contentData, res.data)
|
Object.assign(contentData, res.data)
|
||||||
if (loginValid.validate_login === 1) {
|
if (loginValid.validate_login === 1) {
|
||||||
// activity_code 方式
|
// activity_code 方式
|
||||||
|
@ -152,7 +149,7 @@ const initData = (res) => {
|
||||||
uni.setNavigationBarTitle({
|
uni.setNavigationBarTitle({
|
||||||
title: srcList.title,
|
title: srcList.title,
|
||||||
})
|
})
|
||||||
useStore.setUserInfo({ srcList, contentData, query: query.value })
|
useStore.setUserInfo({ srcList, contentData, query: query.value, token: loginValid.token })
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: res.message,
|
title: res.message,
|
||||||
|
@ -166,8 +163,7 @@ function getTimesTamp(url) {
|
||||||
return url + (url.includes('?') ? '×tamp=' : '?timestamp=') + timestamp
|
return url + (url.includes('?') ? '×tamp=' : '?timestamp=') + timestamp
|
||||||
}
|
}
|
||||||
|
|
||||||
onLoad(() => {
|
const intervalData = () => {
|
||||||
activityCode.value = getUrlPathName()
|
|
||||||
timer = setInterval(async () => {
|
timer = setInterval(async () => {
|
||||||
const params = {}
|
const params = {}
|
||||||
params[codeType[code]] = activityCode.value || ''
|
params[codeType[code]] = activityCode.value || ''
|
||||||
|
@ -180,16 +176,16 @@ onLoad(() => {
|
||||||
initData(res)
|
initData(res)
|
||||||
}
|
}
|
||||||
}, 60000)
|
}, 60000)
|
||||||
|
}
|
||||||
|
|
||||||
|
onLoad(() => {
|
||||||
|
activityCode.value = getUrlPathName()
|
||||||
|
intervalData()
|
||||||
if (!useStore.userInfo.srcList.url || useStore.userInfo.query !== query.value) {
|
if (!useStore.userInfo.srcList.url || useStore.userInfo.query !== query.value) {
|
||||||
initContent()
|
initContent()
|
||||||
} else {
|
} else {
|
||||||
const timestamp = new Date().getTime()
|
|
||||||
const url =
|
|
||||||
useStore.userInfo.srcList.url +
|
|
||||||
(useStore.userInfo.srcList.url.includes('?') ? '×tamp=' : '?timestamp=') +
|
|
||||||
timestamp
|
|
||||||
Object.assign(srcList, useStore.userInfo.srcList, {
|
Object.assign(srcList, useStore.userInfo.srcList, {
|
||||||
url,
|
url: getTimesTamp(useStore.userInfo.srcList.url),
|
||||||
})
|
})
|
||||||
Object.assign(contentData, useStore.userInfo.contentData)
|
Object.assign(contentData, useStore.userInfo.contentData)
|
||||||
uni.setNavigationBarTitle({
|
uni.setNavigationBarTitle({
|
||||||
|
|
Loading…
Reference in New Issue