Commit b2777ea1 by liimin

适配服务器地址

1 parent a74536a9
......@@ -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',
}
......@@ -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,
......
......@@ -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: {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!