增加登录后定时器,修改socket链接
This commit is contained in:
parent
f0de39f135
commit
3589d6a3f0
2
dist/index.html
vendored
2
dist/index.html
vendored
File diff suppressed because one or more lines are too long
1
dist/js/app~42f9d7e6.8fbf3e55.js
vendored
Normal file
1
dist/js/app~42f9d7e6.8fbf3e55.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
dist/js/app~42f9d7e6.eaa8d909.js
vendored
1
dist/js/app~42f9d7e6.eaa8d909.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -65,7 +65,7 @@ export default {
|
|||||||
// 开启socket
|
// 开启socket
|
||||||
useSocket() {
|
useSocket() {
|
||||||
let token = this.getMiucmsSessionCookie() || ""
|
let token = this.getMiucmsSessionCookie() || ""
|
||||||
this.socketTask = new WebSocket(`wss://app.gter.net/socket?token=${token}`)
|
this.socketTask = new WebSocket(`wss://socket.gter.net?token=${token}`)
|
||||||
this.socketTask.onopen = () => {
|
this.socketTask.onopen = () => {
|
||||||
let user = this.$store.state.user || {}
|
let user = this.$store.state.user || {}
|
||||||
if (user && token) {
|
if (user && token) {
|
||||||
|
@ -91,6 +91,9 @@ export default new Vuex.Store({
|
|||||||
let data = res.data
|
let data = res.data
|
||||||
let { config, favorite, hotSearchkeywords, recommend, user, menu } = data
|
let { config, favorite, hotSearchkeywords, recommend, user, menu } = data
|
||||||
|
|
||||||
|
console.log("user",user.uid > 0);
|
||||||
|
const islogin = user.uid > 0 ? true : false;
|
||||||
|
console.log("islogin",islogin);
|
||||||
commit('setHomeRequestState', true)
|
commit('setHomeRequestState', true)
|
||||||
commit('setUser', user)
|
commit('setUser', user)
|
||||||
commit('setFavoriteList', favorite)
|
commit('setFavoriteList', favorite)
|
||||||
@ -98,6 +101,18 @@ export default new Vuex.Store({
|
|||||||
commit('setHotSearchkeywords', hotSearchkeywords)
|
commit('setHotSearchkeywords', hotSearchkeywords)
|
||||||
commit('setMenu', menu)
|
commit('setMenu', menu)
|
||||||
|
|
||||||
|
if (user.uid > 0) { // 这个是顶部用户数据的 这样不用监听是否请求成功
|
||||||
|
setTimeout(() => {
|
||||||
|
if (typeof xstat !== "undefined") {
|
||||||
|
xstat.identify({
|
||||||
|
uid: user.uid,
|
||||||
|
uin: user.uin,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, 600)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (that.userInfo) { // 这个是顶部用户数据的 这样不用监听是否请求成功
|
if (that.userInfo) { // 这个是顶部用户数据的 这样不用监听是否请求成功
|
||||||
that.userInfo = user
|
that.userInfo = user
|
||||||
that.islogin = user.uid > 0 ? true : false;
|
that.islogin = user.uid > 0 ? true : false;
|
||||||
@ -117,6 +132,6 @@ export default new Vuex.Store({
|
|||||||
},
|
},
|
||||||
modules: {
|
modules: {
|
||||||
|
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ service.interceptors.request.use(
|
|||||||
// config['headers']['authorization'] = "661aiz52k5e6vqgmkxnz0wvbv8nciz8h"
|
// config['headers']['authorization'] = "661aiz52k5e6vqgmkxnz0wvbv8nciz8h"
|
||||||
|
|
||||||
// if (process.env.NODE_ENV == "development") config['headers']['authorization'] = "0h870ovk2xckoqfsh8a3t3sg4sg5z7eg"
|
// if (process.env.NODE_ENV == "development") config['headers']['authorization'] = "0h870ovk2xckoqfsh8a3t3sg4sg5z7eg"
|
||||||
if (process.env.NODE_ENV == "development") config["headers"]["authorization"] = "d515090446191e8cc90d98f9a216af1c"
|
if (process.env.NODE_ENV == "development") config["headers"]["authorization"] = "5f8215f2105d8b2162d0cc210cdbf1a3"
|
||||||
|
|
||||||
return config
|
return config
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user