Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
broadcast_cloud
/
web-live
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
2
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
c644c507
authored
Apr 14, 2021
by
MichaelJier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
1. 修复因为store经典模式造成的页面404问题
parent
875e989e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
56 deletions
+21
-56
components/view/index.vue
+1
-1
plugins/API/request.js
+15
-22
plugins/userActions/login.js
+1
-1
plugins/websocketHeartbeat.js
+4
-4
store/index.js
+0
-28
No files found.
components/view/index.vue
View file @
c644c507
...
@@ -75,7 +75,7 @@ export default {
...
@@ -75,7 +75,7 @@ export default {
await
this
.
get_userInfo
({
refererId
:
this
.
$route
.
query
.
refererId
});
await
this
.
get_userInfo
({
refererId
:
this
.
$route
.
query
.
refererId
});
this
.
set_nowDate
();
this
.
set_nowDate
();
if
(
!
process
.
env
.
private
)
{
if
(
!
process
.
env
.
private
)
{
this
.
timer
=
websocketHeartbeat
(
)
this
.
timer
=
websocketHeartbeat
.
call
(
this
)
this
.
set_uuid
(
this
.
timer
.
uuid
)
this
.
set_uuid
(
this
.
timer
.
uuid
)
// bus注册ws暂停和开始事件
// bus注册ws暂停和开始事件
this
.
$Bus
.
$on
(
'ws-start'
,
()
=>
{
this
.
$Bus
.
$on
(
'ws-start'
,
()
=>
{
...
...
plugins/API/request.js
View file @
c644c507
...
@@ -9,16 +9,16 @@
...
@@ -9,16 +9,16 @@
import
qs
from
'qs'
;
import
qs
from
'qs'
;
import
axios
from
'axios'
;
import
axios
from
'axios'
;
import
Layer
from
'@/plugins/Layer/index'
;
import
Layer
from
'@/plugins/Layer/index'
;
// import md5 from 'js-md5';
import
md5
from
'js-md5'
;
//
import LRU from 'lru-cache'
import
LRU
from
'lru-cache'
const
Cookie
=
process
.
client
?
require
(
'js-cookie'
)
:
{};
const
Cookie
=
process
.
client
?
require
(
'js-cookie'
)
:
{};
const
Sentry
=
process
.
client
?
require
(
'@sentry/browser'
)
:
require
(
'@sentry/node'
);
const
Sentry
=
process
.
client
?
require
(
'@sentry/browser'
)
:
require
(
'@sentry/node'
);
// 给api加200ms缓存
// 给api加200ms缓存
//
const CACHED = new LRU({
const
CACHED
=
new
LRU
({
//
max: 1000,
max
:
1000
,
//
maxAge: 200
maxAge
:
200
//
})
})
const
DEF_DOMAIM
=
process
.
client
const
DEF_DOMAIM
=
process
.
client
?
process
.
env
.
DEF_DOMAIM
+
(
window
.
location
.
protocol
.
split
(
':'
)[
0
]
===
'https'
?
process
.
env
.
HTTPS_PORT
:
process
.
env
.
HTTP_PORT
)
?
process
.
env
.
DEF_DOMAIM
+
(
window
.
location
.
protocol
.
split
(
':'
)[
0
]
===
'https'
?
process
.
env
.
HTTPS_PORT
:
process
.
env
.
HTTP_PORT
)
...
@@ -41,17 +41,13 @@ service.interceptors.request.use(
...
@@ -41,17 +41,13 @@ service.interceptors.request.use(
config
.
headers
[
'token'
]
=
config
.
headers
[
'token'
]
=
Cookie
.
get
(
'token'
)
||
Cookie
.
get
(
'BCC_PROGRAM_USER_LOGIN_TOKEN'
)
||
''
;
Cookie
.
get
(
'token'
)
||
Cookie
.
get
(
'BCC_PROGRAM_USER_LOGIN_TOKEN'
)
||
''
;
}
else
{
}
else
{
const
{
params
=
{},
headers
=
{}
}
=
config
Sentry
.
captureException
(
new
Error
(
`
${
config
.
url
}
;
${
JSON
.
stringify
(
params
)}
;
${
JSON
.
stringify
(
headers
)}
`
)
)
// 服务端api缓存
// 服务端api缓存
//
const { params = {}, headers = {} } = config
const
{
params
=
{},
headers
=
{}
}
=
config
//
const key = md5(config.url + JSON.stringify(params) + JSON.stringify(headers))
const
key
=
md5
(
config
.
url
+
JSON
.
stringify
(
params
)
+
JSON
.
stringify
(
headers
))
//
//
缓存命中
// 缓存命中
//
if (CACHED.has(key)) {
if
(
CACHED
.
has
(
key
))
{
//
return Promise.resolve(CACHED.get(key))
return
Promise
.
resolve
(
CACHED
.
get
(
key
))
//
}
}
}
}
const
noMsg
=
config
.
headers
[
'noMsg'
]
||
''
;
const
noMsg
=
config
.
headers
[
'noMsg'
]
||
''
;
if
(
config
.
headers
.
hasOwnProperty
(
'noMsg'
))
{
if
(
config
.
headers
.
hasOwnProperty
(
'noMsg'
))
{
...
@@ -71,12 +67,9 @@ service.interceptors.response.use(
...
@@ -71,12 +67,9 @@ service.interceptors.response.use(
if
(
status
===
200
)
{
if
(
status
===
200
)
{
const
{
code
,
errorCode
,
errorMessage
}
=
data
;
const
{
code
,
errorCode
,
errorMessage
}
=
data
;
if
(
!
process
.
client
)
{
if
(
!
process
.
client
)
{
// const { params = {}, headers = {} } = config
const
{
params
=
{},
headers
=
{}
}
=
config
// const key = md5(config.url + JSON.stringify(params) + JSON.stringify(headers))
const
key
=
md5
(
config
.
url
+
JSON
.
stringify
(
params
)
+
JSON
.
stringify
(
headers
))
// CACHED.set(key, data)
CACHED
.
set
(
key
,
data
)
Sentry
.
captureException
(
new
Error
(
`
${
status
}
;
${
JSON
.
stringify
(
data
)}
;
${
JSON
.
stringify
(
config
)}
`
)
);
}
}
if
((
code
!==
200
||
errorCode
!==
0
)
&&
code
!==
0
)
{
if
((
code
!==
200
||
errorCode
!==
0
)
&&
code
!==
0
)
{
Sentry
.
captureException
(
Sentry
.
captureException
(
...
...
plugins/userActions/login.js
View file @
c644c507
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
import
Cookie
from
'js-cookie'
import
Cookie
from
'js-cookie'
import
{
getQueryVariable
}
from
'../Utils/index'
import
{
getQueryVariable
}
from
'../Utils/index'
export
const
login
=
async
({
token
}
=
{
token
:
''
})
=>
{
export
const
login
=
async
function
({
token
}
=
{
token
:
''
})
{
Cookie
.
set
(
'token'
,
token
,
{
expires
:
10
});
Cookie
.
set
(
'token'
,
token
,
{
expires
:
10
});
const
{
id
,
uin
,
liveNowStatus
}
=
store
().
getters
[
'channelInfo'
]
const
{
id
,
uin
,
liveNowStatus
}
=
store
().
getters
[
'channelInfo'
]
const
res
=
await
getWatchLoginInfo
({
const
res
=
await
getWatchLoginInfo
({
...
...
plugins/websocketHeartbeat.js
View file @
c644c507
import
store
from
'@/store/index'
import
{
watchTime
}
from
'./API/apiWS'
;
import
{
watchTime
}
from
'./API/apiWS'
;
export
default
()
=>
{
export
default
function
()
{
const
userInfo
=
store
().
getters
[
'userInfo'
]
const
store
=
this
.
$store
const
channelInfo
=
store
().
getters
[
'channelInfo'
]
const
userInfo
=
store
.
getters
[
'userInfo'
]
const
channelInfo
=
store
.
getters
[
'channelInfo'
]
const
websocketHeartbeat
=
require
(
'./timer'
).
default
;
const
websocketHeartbeat
=
require
(
'./timer'
).
default
;
const
info
=
{
const
info
=
{
"userId"
:
userInfo
.
id
||
0
,
"userId"
:
userInfo
.
id
||
0
,
...
...
store/index.js
deleted
100644 → 0
View file @
875e989e
import
Vue
from
'vue'
import
Vuex
from
'vuex'
import
state
from
'./state'
import
actions
from
'./actions'
import
mutations
from
'./mutations'
import
getters
from
'./getters'
Vue
.
use
(
Vuex
)
let
store
const
initStore
=
()
=>
{
return
store
||
(
store
=
new
Vuex
.
Store
({
// 存放公用数据
state
,
// 异步操作要通过actions,否则通过cimmit直接操作mutations
actions
,
// 同步放数据
mutations
,
getters
,
modules
:
{
// store 模块....
}
}))
}
export
default
initStore
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment