Skip to content

Commit

Permalink
update resources-front-end
Browse files Browse the repository at this point in the history
  • Loading branch information
caigaga committed Aug 27, 2021
1 parent 751fd4f commit 8191641
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 13 deletions.
3 changes: 2 additions & 1 deletion resources-front-end/build/webpack.dev.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const devWebpackConfig = merge(baseWebpackConfig, {
clientLogLevel: 'warning',
historyApiFallback: true,
hot: true,
https: !!config.dev.httpsProxy,
compress: true,
host: HOST || config.dev.host,
port: PORT || config.dev.port,
Expand Down Expand Up @@ -79,7 +80,7 @@ module.exports = new Promise((resolve, reject) => {
compilationSuccessInfo: {
messages: [
`Your application is running here: http://${
devWebpackConfig.devServer.host
devWebpackConfig.devServer.host
}:${port}`
]
},
Expand Down
7 changes: 2 additions & 5 deletions resources-front-end/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@ const path = require('path')
module.exports = {
dev: {
// Paths
httpsProxy: false,
assetsSubDirectory: 'static',
assetsPublicPath: '/',
proxyTable: {
'/': {
changeOrigin: true
}
},
proxyTable: {},

// Various Dev Server settings
host: 'localhost', // can be overwritten by process.env.HOST
Expand Down
6 changes: 3 additions & 3 deletions resources-front-end/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
"svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml"
},
"dependencies": {
"axios": "0.21.1",
"axios": "^0.21.1",
"babel-polyfill": "^6.26.0",
"clipboard": "^2.0.6",
"clipboard": "^2.0.8",
"echarts": "^4.2.1",
"element-ui": "2.8.2",
"file-saver": "^2.0.1",
"js-cookie": "2.2.0",
"jszip": "^3.5.0",
"jszip": "^3.7.1",
"lodash": "^4.17.15",
"mockjs": "1.0.1-beta3",
"normalize.css": "7.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const dataFormat = {
val[key] = nearBy(val[key], this.range)
}
const toNum = parseFloat(val[key])
if (typeof val[key] === 'number' && val[key].toString().match(/[0-9]+e/)) {
if (typeof val[key] === 'number' || val[key].toString().match(/[0-9]+e/)) {
continue
}
if (toNum && toNum.toString() === val[key].toString()) {
Expand Down
8 changes: 6 additions & 2 deletions resources-front-end/src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,17 @@ router.beforeEach((to, from, next) => {
next()
}
} else if (to.name !== 'login') {
preUrl = Object.assign({}, to)
if (!preUrl) {
preUrl = Object.assign({}, to)
}
next({
name: 'login'
})
} else {
if (from.name !== 'login') {
preUrl = Object.assign({}, from)
if (!preUrl) {
preUrl = Object.assign({}, from)
}
}
next()
}
Expand Down
7 changes: 6 additions & 1 deletion resources-front-end/src/utils/ReconnectingWebSocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,17 @@ function getHeartCheckObj(ws) {
}
}

function isHttps() {
return window.location.protocol === 'https:'
}

export default class ReconnectingWebSocket {
static CONNECTING = WebSocket.CONNECTING
static OPEN = WebSocket.OPEN
static CLOSING = WebSocket.CLOSING
static CLOSE = WebSocket.CLOSE
static baseUrl = `ws://${location.host}`
static PROTOCOL = isHttps() ? 'wss://' : 'ws://'
static baseUrl = `${ReconnectingWebSocket.PROTOCOL}${location.host}`
constructor(url, protocols, options = {}) {
this.url = url
this.protocols = protocols
Expand Down

0 comments on commit 8191641

Please sign in to comment.