Commit f61b334b by liimin

修改环境配置文件

1 parent e1190a42
......@@ -3,12 +3,8 @@
# 页面 title 前缀
VUE_APP_TITLE=tFIMS
# 网络请求开发地址
# VUE_APP_API=http://192.168.3.191:8944/router
# 网络请求mock测试地址
# VUE_APP_API=http://192.168.3.171:7300/mock/5d638b3b6fbe9a0ac59d872e/tFIMS
# 网络请求公用地址
VUE_APP_API=http://tfims.test.glsx.com.cn/router
VUE_APP_API=http://tfims.test.glsx.com.cn/router
# 仓库地址
VUE_APP_REPO=http://192.168.3.171:7300/mock/5d638b3b6fbe9a0ac59d872e/tFIMS
......@@ -18,4 +14,6 @@ VUE_APP_I18N_FALLBACK_LOCALE=en
VUE_APP_ELEMENT_COLOR=#409EFF
VUE_APP_MAIN_COLOR=#3D6FE4
\ No newline at end of file
VUE_APP_MAIN_COLOR=#3D6FE4
VUE_APP_STORAGE_PREFIX=tfims
\ No newline at end of file
......@@ -2,3 +2,5 @@
# 页面 title 前缀
VUE_APP_TITLE=TFims Dev
# 网络请求开发地址
VUE_APP_API=http://192.168.3.191:8944/router
\ No newline at end of file
import Cookies from 'js-cookie'
const cookies = {}
const COOKIE_NAME_PREFIX = `${process.env.VUE_APP_STORAGE_PREFIX}-${process.env.VUE_APP_VERSION}-`
/**
* @description 存储 cookie 值
* @param {String} name cookie name
......@@ -13,7 +13,7 @@ cookies.set = function(name = 'default', value = '', cookieSetting = {}) {
expires: 1
}
Object.assign(currentCookieSetting, cookieSetting)
Cookies.set(`tfims-${process.env.VUE_APP_VERSION}-${name}`, value, currentCookieSetting)
Cookies.set(`${COOKIE_NAME_PREFIX}${name}`, value, currentCookieSetting)
}
/**
......@@ -21,7 +21,7 @@ cookies.set = function(name = 'default', value = '', cookieSetting = {}) {
* @param {String} name cookie name
*/
cookies.get = function(name = 'default') {
return Cookies.get(`tfims-${process.env.VUE_APP_VERSION}-${name}`)
return Cookies.get(`${COOKIE_NAME_PREFIX}${name}`)
}
/**
......@@ -36,7 +36,7 @@ cookies.getAll = function() {
* @param {String} name cookie name
*/
cookies.remove = function(name = 'default') {
return Cookies.remove(`tfims-${process.env.VUE_APP_VERSION}-${name}`)
return Cookies.remove(`${COOKIE_NAME_PREFIX}${name}`)
}
export default cookies
......@@ -2,7 +2,7 @@ import low from 'lowdb'
import LocalStorage from 'lowdb/adapters/LocalStorage'
import util from '@/libs/util'
const adapter = new LocalStorage(`tfims-${process.env.VUE_APP_VERSION}`, {
const adapter = new LocalStorage(`${process.env.VUE_APP_STORAGE_PREFIX}-${process.env.VUE_APP_VERSION}`, {
serialize: (data) => escape(JSON.stringify(data)),
deserialize: (data) => JSON.parse(unescape(data))
})
......
const SESSION_NAME = `${process.env.VUE_APP_STORAGE_PREFIX}-${process.env.VUE_APP_VERSION}-user`
export default {
namespaced: true,
state: {
......@@ -21,7 +23,7 @@ export default {
// value: info,
// user: true
// }, { root: true })
sessionStorage.setItem('tfims-user', escape(JSON.stringify(info)))
sessionStorage.setItem(SESSION_NAME, escape(JSON.stringify(info)))
// end
resolve()
})
......@@ -39,7 +41,7 @@ export default {
// defaultValue: {},
// user: true
// }, { root: true })
state.info = JSON.parse(unescape(sessionStorage.getItem('tfims-user')))
state.info = JSON.parse(unescape(sessionStorage.getItem(SESSION_NAME)))
// end
resolve()
})
......@@ -54,7 +56,7 @@ export default {
// user: true
// }, { root: true })
state.info = null
sessionStorage.removeItem('tfims-user')
sessionStorage.removeItem(SESSION_NAME)
resolve()
})
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!