Commit b2777ea1 by liimin

适配服务器地址

1 parent a74536a9
...@@ -12,10 +12,11 @@ module.exports = { ...@@ -12,10 +12,11 @@ module.exports = {
FOLDER: 'quality/', FOLDER: 'quality/',
// 与后端约定的token字段名 // 与后端约定的token字段名
TOKEN_NAME: 'glsk-oss', TOKEN_NAME: 'glsk-oss',
// PROTOCAL: 'http',
PROTOCAL: 'http', // SERVER: 'app-admin-server.test.glsx.com.cn',
SERVER: 'app-admin-server.test.glsx.com.cn', // SOCKET_PORT: '9081',
SOCKET_PORT: '9081', // HTTP_PORT: '3000',
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', FILE_UPLOAD_URL: 'file/upload',
} }
...@@ -13,10 +13,10 @@ export class Ws { ...@@ -13,10 +13,10 @@ export class Ws {
onMessage onMessage
ws ws
constructor() { constructor() {
this.wsAddress = `${config.PROTOCAL}://${config.SERVER}` this.wsAddress = config.SOCKET_SERVER
this.loginAddress = `${config.PROTOCAL}://${config.SERVER}/login` this.loginAddress =`${config.HTTP_SERVER}/login`
} }
async connect() { async connect() {
const { code, data, ...o } = await this.login() const { code, data, ...o } = await this.login()
if (code == 200) { if (code == 200) {
this.deviceId = data.id this.deviceId = data.id
...@@ -24,7 +24,7 @@ export class Ws { ...@@ -24,7 +24,7 @@ export class Ws {
this.ws = io(this.wsAddress, { this.ws = io(this.wsAddress, {
path:'/websocket/', path:'/websocket/',
auth: { token: this.token, deviceId: this.deviceId }, auth: { token: this.token, deviceId: this.deviceId },
transports: ['websocket'], transports: ['websocket'],
timeout: 5000 timeout: 5000
}) })
this.subscribe() this.subscribe()
...@@ -37,9 +37,11 @@ export class Ws { ...@@ -37,9 +37,11 @@ export class Ws {
// const userInfo = uni.$storage.get('userInfo') // const userInfo = uni.$storage.get('userInfo')
// ;(userInfo.name = '胡悦'), (userInfo.phone = '18754575574') // ;(userInfo.name = '胡悦'), (userInfo.phone = '18754575574')
if (!sysInfo?.deviceId) return uni.$logger.local.error('未获取到系统设备信息') if (!sysInfo?.deviceId) return uni.$logger.local.error('未获取到系统设备信息')
// sysInfo.deviceId='4DF8801064461802495A2452CCD04EE4' // sysInfo.deviceId='4DF8801064461802495A2452CCD04EE4'
// const { name: user, phone: mobile, merchantName } = userInfo // const { name: user, phone: mobile, merchantName } = userInfo
uni.$logger.local.info(`========WS,用户登录 ${JSON.stringify({deviceId:sysInfo.deviceId})}========`) uni.$logger.local.info(`========WS,用户登录 ${JSON.stringify({deviceId:sysInfo.deviceId})}========`)
console.log(this.loginAddress)
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
uni.request({ uni.request({
url: this.loginAddress, url: this.loginAddress,
......
...@@ -39,7 +39,7 @@ export default class LogsWorker { ...@@ -39,7 +39,7 @@ export default class LogsWorker {
post({ name, path }, deviceId) { post({ name, path }, deviceId) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
uni.uploadFile({ uni.uploadFile({
url: `${config.PROTOCAL}://${config.SERVER}:${config.HTTP_PORT}/${config.FILE_UPLOAD_URL}`, url: `${config.HTTP_SERVER}/${config.FILE_UPLOAD_URL}`,
filePath: path, filePath: path,
name: 'file', name: 'file',
header: { header: {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!