diff --git a/mock/article.js b/mock/article.js
index bc236eb9..50218ae4 100644
--- a/mock/article.js
+++ b/mock/article.js
@@ -18,7 +18,7 @@ for (let i = 0; i < count; i++) {
forecast: '@float(0, 100, 2, 2)',
importance: '@integer(1, 3)',
'type|1': ['CN', 'US', 'JP', 'EU'],
- 'status|1': ['published', 'draft', 'deleted'],
+ 'status|1': ['published', 'draft'],
display_time: '@datetime',
comment_disabled: true,
pageviews: '@integer(300, 5000)',
@@ -29,7 +29,7 @@ for (let i = 0; i < count; i++) {
export default [
{
- url: '/article/list',
+ url: '/vue-element-admin/article/list',
type: 'get',
response: config => {
const { importance, type, title, page = 1, limit = 20, sort } = config.query
@@ -58,7 +58,7 @@ export default [
},
{
- url: '/article/detail',
+ url: '/vue-element-admin/article/detail',
type: 'get',
response: config => {
const { id } = config.query
@@ -74,7 +74,7 @@ export default [
},
{
- url: '/article/pv',
+ url: '/vue-element-admin/article/pv',
type: 'get',
response: _ => {
return {
@@ -92,7 +92,7 @@ export default [
},
{
- url: '/article/create',
+ url: '/vue-element-admin/article/create',
type: 'post',
response: _ => {
return {
@@ -103,7 +103,7 @@ export default [
},
{
- url: '/article/update',
+ url: '/vue-element-admin/article/update',
type: 'post',
response: _ => {
return {
diff --git a/mock/index.js b/mock/index.js
index 6907e861..217ee3d5 100644
--- a/mock/index.js
+++ b/mock/index.js
@@ -57,9 +57,10 @@ export function mockXHR() {
// for mock server
const responseFake = (url, type, respond) => {
return {
- url: new RegExp(`/mock${url}`),
+ url: new RegExp(`${process.env.VUE_APP_BASE_API}${url}`),
type: type || 'get',
response(req, res) {
+ console.log('request invoke:' + req.path)
res.json(Mock.mock(respond instanceof Function ? respond(req, res) : respond))
}
}
diff --git a/mock/remote-search.js b/mock/remote-search.js
index bb33c2f4..60809cb8 100644
--- a/mock/remote-search.js
+++ b/mock/remote-search.js
@@ -13,7 +13,7 @@ NameList.push({ name: 'mock-Pan' })
export default [
// username search
{
- url: '/search/user',
+ url: '/vue-element-admin/search/user',
type: 'get',
response: config => {
const { name } = config.query
@@ -30,7 +30,7 @@ export default [
// transaction list
{
- url: '/transaction/list',
+ url: '/vue-element-admin/transaction/list',
type: 'get',
response: _ => {
return {
diff --git a/mock/role/index.js b/mock/role/index.js
index 39148076..d957493b 100644
--- a/mock/role/index.js
+++ b/mock/role/index.js
@@ -38,7 +38,7 @@ const roles = [
export default [
// mock get all routes form server
{
- url: '/routes',
+ url: '/vue-element-admin/routes',
type: 'get',
response: _ => {
return {
@@ -50,7 +50,7 @@ export default [
// mock get all roles form server
{
- url: '/roles',
+ url: '/vue-element-admin/roles',
type: 'get',
response: _ => {
return {
@@ -62,7 +62,7 @@ export default [
// add role
{
- url: '/role',
+ url: '/vue-element-admin/role',
type: 'post',
response: {
code: 20000,
@@ -74,7 +74,7 @@ export default [
// update role
{
- url: '/role/[A-Za-z0-9]',
+ url: '/vue-element-admin/role/[A-Za-z0-9]',
type: 'put',
response: {
code: 20000,
@@ -86,7 +86,7 @@ export default [
// delete role
{
- url: '/role/[A-Za-z0-9]',
+ url: '/vue-element-admin/role/[A-Za-z0-9]',
type: 'delete',
response: {
code: 20000,
diff --git a/mock/user.js b/mock/user.js
index 43f93a04..859bd6f3 100644
--- a/mock/user.js
+++ b/mock/user.js
@@ -26,7 +26,7 @@ const users = {
export default [
// user login
{
- url: '/user/login',
+ url: '/vue-element-admin/user/login',
type: 'post',
response: config => {
const { username } = config.body
@@ -49,7 +49,7 @@ export default [
// get user info
{
- url: '/user/info\.*',
+ url: '/vue-element-admin/user/info\.*',
type: 'get',
response: config => {
const { token } = config.query
@@ -72,7 +72,7 @@ export default [
// user logout
{
- url: '/user/logout',
+ url: '/vue-element-admin/user/logout',
type: 'post',
response: _ => {
return {
diff --git a/package.json b/package.json
index 9d6c2c36..7ef29082 100644
--- a/package.json
+++ b/package.json
@@ -50,7 +50,7 @@
"driver.js": "0.9.5",
"dropzone": "5.5.1",
"echarts": "4.2.1",
- "element-ui": "2.7.0",
+ "element-ui": "2.13.0",
"file-saver": "2.0.1",
"fuse.js": "3.4.4",
"js-cookie": "2.2.0",
diff --git a/src/api/article.js b/src/api/article.js
index f54b8af6..407bda16 100644
--- a/src/api/article.js
+++ b/src/api/article.js
@@ -2,7 +2,7 @@ import request from '@/utils/request'
export function fetchList(query) {
return request({
- url: '/article/list',
+ url: '/vue-element-admin/article/list',
method: 'get',
params: query
})
@@ -10,7 +10,7 @@ export function fetchList(query) {
export function fetchArticle(id) {
return request({
- url: '/article/detail',
+ url: '/vue-element-admin/article/detail',
method: 'get',
params: { id }
})
@@ -18,7 +18,7 @@ export function fetchArticle(id) {
export function fetchPv(pv) {
return request({
- url: '/article/pv',
+ url: '/vue-element-admin/article/pv',
method: 'get',
params: { pv }
})
@@ -26,7 +26,7 @@ export function fetchPv(pv) {
export function createArticle(data) {
return request({
- url: '/article/create',
+ url: '/vue-element-admin/article/create',
method: 'post',
data
})
@@ -34,7 +34,7 @@ export function createArticle(data) {
export function updateArticle(data) {
return request({
- url: '/article/update',
+ url: '/vue-element-admin/article/update',
method: 'post',
data
})
diff --git a/src/api/remote-search.js b/src/api/remote-search.js
index c7e19117..02e42b46 100644
--- a/src/api/remote-search.js
+++ b/src/api/remote-search.js
@@ -2,7 +2,7 @@ import request from '@/utils/request'
export function searchUser(name) {
return request({
- url: '/search/user',
+ url: '/vue-element-admin/search/user',
method: 'get',
params: { name }
})
@@ -10,7 +10,7 @@ export function searchUser(name) {
export function transactionList(query) {
return request({
- url: '/transaction/list',
+ url: '/vue-element-admin/transaction/list',
method: 'get',
params: query
})
diff --git a/src/api/role.js b/src/api/role.js
index f6a983f1..959bbd21 100644
--- a/src/api/role.js
+++ b/src/api/role.js
@@ -2,21 +2,21 @@ import request from '@/utils/request'
export function getRoutes() {
return request({
- url: '/routes',
+ url: '/vue-element-admin/routes',
method: 'get'
})
}
export function getRoles() {
return request({
- url: '/roles',
+ url: '/vue-element-admin/roles',
method: 'get'
})
}
export function addRole(data) {
return request({
- url: '/role',
+ url: '/vue-element-admin/role',
method: 'post',
data
})
@@ -24,7 +24,7 @@ export function addRole(data) {
export function updateRole(id, data) {
return request({
- url: `/role/${id}`,
+ url: `/vue-element-admin/role/${id}`,
method: 'put',
data
})
@@ -32,7 +32,7 @@ export function updateRole(id, data) {
export function deleteRole(id) {
return request({
- url: `/role/${id}`,
+ url: `/vue-element-admin/role/${id}`,
method: 'delete'
})
}
diff --git a/src/api/user.js b/src/api/user.js
index de69f707..b8b8741c 100644
--- a/src/api/user.js
+++ b/src/api/user.js
@@ -2,7 +2,7 @@ import request from '@/utils/request'
export function login(data) {
return request({
- url: '/user/login',
+ url: '/vue-element-admin/user/login',
method: 'post',
data
})
@@ -10,7 +10,7 @@ export function login(data) {
export function getInfo(token) {
return request({
- url: '/user/info',
+ url: '/vue-element-admin/user/info',
method: 'get',
params: { token }
})
@@ -18,7 +18,7 @@ export function getInfo(token) {
export function logout() {
return request({
- url: '/user/logout',
+ url: '/vue-element-admin/user/logout',
method: 'post'
})
}
diff --git a/src/components/Charts/mixins/resize.js b/src/components/Charts/mixins/resize.js
index dccaf1a8..b1e76e94 100644
--- a/src/components/Charts/mixins/resize.js
+++ b/src/components/Charts/mixins/resize.js
@@ -3,32 +3,54 @@ import { debounce } from '@/utils'
export default {
data() {
return {
- $_sidebarElm: null
+ $_sidebarElm: null,
+ $_resizeHandler: null
}
},
mounted() {
- this.__resizeHandler = debounce(() => {
- if (this.chart) {
- this.chart.resize()
- }
- }, 100)
- window.addEventListener('resize', this.__resizeHandler)
+ this.initListener()
+ },
+ activated() {
+ if (!this.$_resizeHandler) {
+ // avoid duplication init
+ this.initListener()
+ }
- this.$_sidebarElm = document.getElementsByClassName('sidebar-container')[0]
- this.$_sidebarElm && this.$_sidebarElm.addEventListener('transitionend', this.$_sidebarResizeHandler)
+ // when keep-alive chart activated, auto resize
+ this.resize()
},
beforeDestroy() {
- window.removeEventListener('resize', this.__resizeHandler)
-
- this.$_sidebarElm && this.$_sidebarElm.removeEventListener('transitionend', this.$_sidebarResizeHandler)
+ this.destroyListener()
+ },
+ deactivated() {
+ this.destroyListener()
},
methods: {
// use $_ for mixins properties
// https://vuejs.org/v2/style-guide/index.html#Private-property-names-essential
$_sidebarResizeHandler(e) {
if (e.propertyName === 'width') {
- this.__resizeHandler()
+ this.$_resizeHandler()
}
+ },
+ initListener() {
+ this.$_resizeHandler = debounce(() => {
+ this.resize()
+ }, 100)
+ window.addEventListener('resize', this.$_resizeHandler)
+
+ this.$_sidebarElm = document.getElementsByClassName('sidebar-container')[0]
+ this.$_sidebarElm && this.$_sidebarElm.addEventListener('transitionend', this.$_sidebarResizeHandler)
+ },
+ destroyListener() {
+ window.removeEventListener('resize', this.$_resizeHandler)
+ this.$_resizeHandler = null
+
+ this.$_sidebarElm && this.$_sidebarElm.removeEventListener('transitionend', this.$_sidebarResizeHandler)
+ },
+ resize() {
+ const { chart } = this
+ chart && chart.resize()
}
}
}
diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue
index 9d5c6658..8beb27f8 100644
--- a/src/layout/components/Navbar.vue
+++ b/src/layout/components/Navbar.vue
@@ -44,8 +44,8 @@
Docs
-
- {{ $t('navbar.logOut') }}
+
+ {{ $t('navbar.logOut') }}
diff --git a/src/layout/components/Sidebar/SidebarItem.vue b/src/layout/components/Sidebar/SidebarItem.vue
index b4422cf8..f87b70b1 100644
--- a/src/layout/components/Sidebar/SidebarItem.vue
+++ b/src/layout/components/Sidebar/SidebarItem.vue
@@ -1,5 +1,5 @@
-