Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx
/
gl_tape
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
3
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit b2777ea1
authored
Nov 04, 2024
by
liimin
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
适配服务器地址
1 parent
a74536a9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
11 deletions
config.js
ws/Ws.js
ws/workers/LogsWorker.js
config.js
View file @
b2777ea
...
...
@@ -12,10 +12,11 @@ module.exports = {
FOLDER
:
'quality/'
,
// 与后端约定的token字段名
TOKEN_NAME
:
'glsk-oss'
,
PROTOCAL
:
'http'
,
SERVER
:
'app-admin-server.test.glsx.com.cn'
,
SOCKET_PORT
:
'9081'
,
HTTP_PORT
:
'3000'
,
// PROTOCAL: 'http',
// SERVER: 'app-admin-server.test.glsx.com.cn',
// SOCKET_PORT: '9081',
// HTTP_PORT: '3000',
HTTP_SERVER
:
'app-admin-server.test.glsx.com.cn'
,
SOCKET_SERVER
:
'app-admin-server.test.glsx.com.cn'
,
FILE_UPLOAD_URL
:
'file/upload'
,
}
ws/Ws.js
View file @
b2777ea
...
...
@@ -13,10 +13,10 @@ export class Ws {
onMessage
ws
constructor
()
{
this
.
wsAddress
=
`
${
config
.
PROTOCAL
}
://
${
config
.
SERVER
}
`
this
.
loginAddress
=
`
${
config
.
PROTOCAL
}
://
${
config
.
SERVER
}
/login`
this
.
wsAddress
=
config
.
SOCKET_SERVER
this
.
loginAddress
=
`
${
config
.
HTTP_
SERVER
}
/login`
}
async
connect
()
{
async
connect
()
{
const
{
code
,
data
,
...
o
}
=
await
this
.
login
()
if
(
code
==
200
)
{
this
.
deviceId
=
data
.
id
...
...
@@ -24,7 +24,7 @@ export class Ws {
this
.
ws
=
io
(
this
.
wsAddress
,
{
path
:
'/websocket/'
,
auth
:
{
token
:
this
.
token
,
deviceId
:
this
.
deviceId
},
transports
:
[
'websocket'
],
transports
:
[
'websocket'
],
timeout
:
5000
})
this
.
subscribe
()
...
...
@@ -37,9 +37,11 @@ export class Ws {
// const userInfo = uni.$storage.get('userInfo')
// ;(userInfo.name = '胡悦'), (userInfo.phone = '18754575574')
if
(
!
sysInfo
?.
deviceId
)
return
uni
.
$logger
.
local
.
error
(
'未获取到系统设备信息'
)
// sysInfo.deviceId='4DF8801064461802495A2452CCD04EE4'
// sysInfo.deviceId='4DF8801064461802495A2452CCD04EE4'
// const { name: user, phone: mobile, merchantName } = userInfo
uni
.
$logger
.
local
.
info
(
`========WS,用户登录
${
JSON
.
stringify
({
deviceId
:
sysInfo
.
deviceId
})}
========`
)
console
.
log
(
this
.
loginAddress
)
return
new
Promise
((
resolve
,
reject
)
=>
{
uni
.
request
({
url
:
this
.
loginAddress
,
...
...
ws/workers/LogsWorker.js
View file @
b2777ea
...
...
@@ -39,7 +39,7 @@ export default class LogsWorker {
post
({
name
,
path
},
deviceId
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
uni
.
uploadFile
({
url
:
`
${
config
.
PROTOCAL
}
://
${
config
.
SERVER
}
:
${
config
.
HTTP_PORT
}
/
${
config
.
FILE_UPLOAD_URL
}
`
,
url
:
`
${
config
.
HTTP_SERVER
}
/
${
config
.
FILE_UPLOAD_URL
}
`
,
filePath
:
path
,
name
:
'file'
,
header
:
{
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment