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
51632fdb
authored
Jun 22, 2020
by
xiaolanchong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sentry
parent
455eca3b
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
22 additions
and
65 deletions
+22
-65
config.js
+1
-1
layouts/default.vue
+8
-1
pages/_id.vue
+1
-6
plugins/API/request.js
+3
-14
plugins/arms.js
+0
-37
store/getters.js
+9
-6
No files found.
config.js
View file @
51632fdb
const
packageEnv
=
require
(
'./package.json'
);
export
const
BASE_URL
=
'/live'
;
export
const
BASE_URL
=
'/live
/
'
;
export
const
X_CA_STAGE
=
process
.
env
.
X_CA_STAGE
||
''
;
// TEST PRE ''
export
const
BUILD_DIST
=
process
.
env
.
X_CA_STAGE
||
'PROD'
;
// TEST PRE PROD
...
...
layouts/default.vue
View file @
51632fdb
...
...
@@ -2,7 +2,14 @@
<nuxt
/>
</
template
>
<
script
>
export
default
{};
import
REPORT
from
'@/plugins/report'
;
export
default
{
async
mounted
()
{
let
uin
=
this
.
$route
.
query
.
uin
;
let
id
=
this
.
$route
.
params
.
id
;
REPORT
(
this
.
$sentry
,
{
AppId
:
id
,
Uin
:
uin
});
}
};
</
script
>
<
style
lang=
"less"
>
#__nuxt
,
...
...
pages/_id.vue
View file @
51632fdb
...
...
@@ -3,7 +3,7 @@
<state
v-else
/>
</
template
>
<
script
>
import
{
mapGetters
,
mapMutations
,
mapActions
}
from
'vuex'
;
import
{
mapGetters
,
mapMutations
}
from
'vuex'
;
import
REPORT
from
'@/plugins/report'
;
import
DMS
from
'@/plugins/Mixin/dms'
;
import
UserAgent
from
'@/plugins/UserAgent/index'
;
...
...
@@ -55,8 +55,6 @@ export default {
},
mixins
:
[
DMS
],
async
mounted
()
{
let
{
id
,
uin
}
=
this
.
channelInfo
;
REPORT
(
this
.
$sentry
,
{
AppId
:
id
,
Uin
:
uin
});
let
mobile
=
Number
(
this
.
$route
.
query
.
mobile
);
this
.
isMobile
=
mobile
||
UserAgent
.
isMobile
();
this
.
set_corpId
(
Number
(
this
.
$route
.
query
.
corpId
));
...
...
@@ -64,9 +62,6 @@ export default {
methods
:
{
...
mapMutations
({
set_corpId
:
'set_corpId'
}),
...
mapActions
({
get_control
:
'get_control'
})
}
};
...
...
plugins/API/request.js
View file @
51632fdb
...
...
@@ -2,7 +2,6 @@ import qs from 'qs';
import
axios
from
'axios'
;
import
Layer
from
'@/plugins/Layer/index'
;
const
Cookie
=
process
.
client
?
require
(
'js-cookie'
)
:
{};
const
arms
=
process
.
client
?
require
(
'@/plugins/arms'
)
:
false
;
const
service
=
axios
.
create
({
timeout
:
1000
*
10
,
...
...
@@ -24,7 +23,7 @@ service.interceptors.request.use(
if
(
config
.
headers
.
hasOwnProperty
(
'noMsg'
))
{
delete
config
.
headers
[
'noMsg'
];
}
config
.
metadata
=
{
startTime
:
new
Date
(),
noMsg
};
config
.
metadata
=
{
noMsg
};
return
config
;
},
error
=>
{
...
...
@@ -34,12 +33,10 @@ service.interceptors.request.use(
// response拦截器
service
.
interceptors
.
response
.
use
(
res
=>
{
const
{
status
,
statusText
,
data
,
config
}
=
res
;
const
duration
=
new
Date
()
-
config
.
metadata
.
startTime
;
const
{
status
,
data
,
config
}
=
res
;
if
(
status
===
200
)
{
const
{
code
,
errorCode
,
errorMessage
}
=
data
;
if
((
code
!==
200
||
errorCode
!==
0
)
&&
code
!==
0
)
{
arms
&&
arms
.
api
(
config
.
url
,
true
,
duration
,
errorCode
,
errorMessage
);
if
(
errorMessage
&&
!
config
.
metadata
.
noMsg
)
{
if
(
process
.
client
)
{
Layer
.
msg
(
errorMessage
);
...
...
@@ -48,22 +45,14 @@ service.interceptors.response.use(
}
return
Promise
.
resolve
(
data
);
}
else
{
arms
&&
arms
.
api
(
config
.
url
,
false
,
duration
,
status
,
statusText
);
return
Promise
.
reject
(
res
);
}
},
err
=>
{
const
{
message
,
config
}
=
err
;
const
duration
=
new
Date
()
-
config
.
metadata
.
startTime
;
if
(
message
.
includes
(
'timeout'
))
{
arms
&&
arms
.
api
(
config
.
url
,
false
,
duration
,
'NetworkTimeout'
,
message
);
}
else
{
arms
&&
arms
.
api
(
config
.
url
,
false
,
duration
,
'NetworkError'
,
message
);
}
return
{
code
:
500
,
errorCode
:
500
,
errorMessage
:
'网络错误'
errorMessage
:
`网络错误 -
${
err
}
`
};
}
);
...
...
plugins/arms.js
deleted
100644 → 0
View file @
455eca3b
/**
* @file aliyun arms report method of commonJS
* @since 1.0.7
* @author whzcorcd <whzcorcd@gmail.com>
*
* 阿里前端监控
* 配置文档 https://www.npmjs.com/package/alife-logger
*
* 使用示例:logger && logger.api(url, true, time, res.data.Flag, res.data.FlagString)
* 示例解析:api(请求地址,请求成功与否,请求耗时,请求状态码,请求返回 Msg)
*/
const
BrowerLogger
=
require
(
"alife-logger"
);
// huh7k89btk@e7efa8f1e6c4d16
const
__bl
=
pid
=>
{
try
{
return
BrowerLogger
.
singleton
({
pid
:
pid
,
appType
:
"web"
,
imgUrl
:
"https://arms-retcode.aliyuncs.com/r.png?"
,
sendResource
:
true
,
enableLinkTrace
:
true
,
behavior
:
true
,
disableHook
:
true
,
useFmp
:
true
,
enableSPA
:
false
});
}
catch
(
e
)
{
// eslint-disable-next-line no-console
console
.
error
(
"init logger fail"
,
e
);
return
false
;
}
};
const
logger
=
process
.
env
.
NODE_ENV
===
"production"
?
__bl
(
"huh7k89btk@e7efa8f1e6c4d16"
)
:
false
;
module
.
exports
=
logger
;
store/getters.js
View file @
51632fdb
const
defaultHead
=
require
(
`@/assets/img/default-head.jpg`
);
const
phoneHead
=
require
(
`@/assets/img/phone-head.png`
);
const
getters
=
{
nowDate
(
state
)
{
return
state
.
nowDate
;
...
...
@@ -15,14 +18,14 @@ const getters = {
return
state
.
welcomeInfo
;
},
channelInfo
(
state
)
{
let
info
=
state
.
channelInfo
||
{}
;
let
info
=
JSON
.
parse
(
JSON
.
stringify
(
state
.
channelInfo
||
{}))
;
if
(
!
info
.
defaultUserAva
)
{
info
.
defaultUserAva
=
require
(
`@/assets/img/default-head.jpg`
)
;
info
.
defaultUserAva
=
defaultHead
;
}
if
(
!
info
.
chatAdminAvaUrl
)
{
info
.
chatAdminAvaUrl
=
require
(
`@/assets/img/default-head.jpg`
)
;
info
.
chatAdminAvaUrl
=
defaultHead
;
}
info
.
defaultPhoneHeadAva
=
require
(
`@/assets/img/phone-head.png`
)
;
info
.
defaultPhoneHeadAva
=
phoneHead
;
return
info
;
},
channelConfig
(
state
)
{
...
...
@@ -60,9 +63,9 @@ const getters = {
return
state
.
playerInfo
;
},
userInfo
(
state
)
{
let
info
=
state
.
userInfo
||
{}
;
let
info
=
JSON
.
parse
(
JSON
.
stringify
(
state
.
userInfo
||
{}))
;
if
(
info
.
id
&&
!
info
.
userHeadImg
)
{
info
.
userHeadImg
=
require
(
'@/assets/img/phone-head.png'
)
;
info
.
userHeadImg
=
phoneHead
;
}
return
info
;
},
...
...
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