Merge branch 'hotfix/han-feng-pr'
Former-commit-id: 5c20d81d51958e2274390202a42b6a8dd783fb93 [formerly 5c20d81d51958e2274390202a42b6a8dd783fb93 [formerly 5c20d81d51958e2274390202a42b6a8dd783fb93 [formerly 5c20d81d51958e2274390202a42b6a8dd783fb93 [formerly 44c2ca09ca4c4d727232ab1ad61846befbd0914d [formerly c045973ca3a02cf737d05b3638124f1f41250e7f]]]]] Former-commit-id: b1127ab5263372d44094ce7a4269a5fb3dade870 Former-commit-id: a31ba5b857b49185eb8a7e8b2784ee590c703c57 Former-commit-id: 22838f4d43f5154ea40d4f139e0ee9dca1142c3c [formerly 6db91fabb060ed43228a045a7e50dce45fdb9eb1] Former-commit-id: 6b3fbb715ba7b575f085ac9e82c1057b72ca7ef0 Former-commit-id: 6b8a067ec9d763525ad2adaf2a6f00d7203aa761 Former-commit-id: 89ebf924439f2a8a318415f5458f2ff776edf96c Former-commit-id: f244a33fa4ada04f78bb712d733e1391304854ca Former-commit-id: 2909c7ca2f09e4439284fc0a12172ac5b52d2bd8
This commit is contained in:
7
.env.nomock
Normal file
7
.env.nomock
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
# No Mock 构建
|
||||||
|
|
||||||
|
# 指定构建模式
|
||||||
|
NODE_ENV=production
|
||||||
|
|
||||||
|
# 标记当前是 No Mock 构建
|
||||||
|
VUE_APP_BUILD_MODE=nomock
|
||||||
@@ -1,12 +1,13 @@
|
|||||||
{
|
{
|
||||||
"name": "d2-admin",
|
"name": "d2-admin",
|
||||||
"version": "1.5.9",
|
"version": "1.6.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"serve": "vue-cli-service serve --open",
|
"serve": "vue-cli-service serve --open",
|
||||||
"start": "npm run serve",
|
"start": "npm run serve",
|
||||||
"dev": "npm run serve",
|
"dev": "npm run serve",
|
||||||
"build": "vue-cli-service build",
|
"build": "vue-cli-service build",
|
||||||
|
"build:nomock": "vue-cli-service build --mode nomock",
|
||||||
"build:travis": "vue-cli-service build --mode travis",
|
"build:travis": "vue-cli-service build --mode travis",
|
||||||
"lint": "vue-cli-service lint --fix",
|
"lint": "vue-cli-service lint --fix",
|
||||||
"test:unit": "vue-cli-service test:unit"
|
"test:unit": "vue-cli-service test:unit"
|
||||||
|
|||||||
@@ -55,12 +55,12 @@ export default {
|
|||||||
}, 500)
|
}, 500)
|
||||||
},
|
},
|
||||||
// 监听路由 控制侧边栏激活状态
|
// 监听路由 控制侧边栏激活状态
|
||||||
'$route.matched': {
|
'$route': {
|
||||||
handler (val) {
|
handler ({ fullPath }) {
|
||||||
this.active = val[val.length - 1].path
|
this.active = fullPath
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
if (this.aside.length > 0 && this.$refs.menu) {
|
if (this.aside.length > 0 && this.$refs.menu) {
|
||||||
this.$refs.menu.activeIndex = this.active
|
this.$refs.menu.activeIndex = fullPath
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
:x="contentmenuX"
|
:x="contentmenuX"
|
||||||
:y="contentmenuY">
|
:y="contentmenuY">
|
||||||
<d2-contextmenu-list
|
<d2-contextmenu-list
|
||||||
:menulist="tagName === 'index' ? contextmenuListIndex : contextmenuList"
|
:menulist="tagName === '/index' ? contextmenuListIndex : contextmenuList"
|
||||||
@rowClick="contextmenuClick"/>
|
@rowClick="contextmenuClick"/>
|
||||||
</d2-contextmenu>
|
</d2-contextmenu>
|
||||||
<el-tabs
|
<el-tabs
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
v-for="(page, index) in opened"
|
v-for="(page, index) in opened"
|
||||||
:key="index"
|
:key="index"
|
||||||
:label="page.meta.title || '未命名'"
|
:label="page.meta.title || '未命名'"
|
||||||
:name="page.name"/>
|
:name="page.fullPath"/>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -79,7 +79,7 @@ export default {
|
|||||||
{ icon: 'times', title: '关闭其它', value: 'other' },
|
{ icon: 'times', title: '关闭其它', value: 'other' },
|
||||||
{ icon: 'times-circle', title: '关闭全部', value: 'all' }
|
{ icon: 'times-circle', title: '关闭全部', value: 'all' }
|
||||||
],
|
],
|
||||||
tagName: 'index'
|
tagName: '/index'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -163,7 +163,7 @@ export default {
|
|||||||
*/
|
*/
|
||||||
handleClick (tab, event) {
|
handleClick (tab, event) {
|
||||||
// 找到点击的页面在 tag 列表里是哪个
|
// 找到点击的页面在 tag 列表里是哪个
|
||||||
const page = this.opened.find(page => page.name === tab.name)
|
const page = this.opened.find(page => page.fullPath === tab.name)
|
||||||
const { name, params, query } = page
|
const { name, params, query } = page
|
||||||
if (page) {
|
if (page) {
|
||||||
this.$router.push({ name, params, query })
|
this.$router.push({ name, params, query })
|
||||||
|
|||||||
@@ -5,8 +5,6 @@ import Vue from 'vue'
|
|||||||
import App from './App'
|
import App from './App'
|
||||||
// store
|
// store
|
||||||
import store from '@/store/index'
|
import store from '@/store/index'
|
||||||
// 模拟数据
|
|
||||||
import '@/mock'
|
|
||||||
// 多国语
|
// 多国语
|
||||||
import i18n from './i18n'
|
import i18n from './i18n'
|
||||||
// 核心插件
|
// 核心插件
|
||||||
|
|||||||
@@ -58,7 +58,9 @@ export default {
|
|||||||
icon: 'hdd-o',
|
icon: 'hdd-o',
|
||||||
children: [
|
children: [
|
||||||
{ path: `${pre}page-cache/on`, title: '开启缓存' },
|
{ path: `${pre}page-cache/on`, title: '开启缓存' },
|
||||||
{ path: `${pre}page-cache/off`, title: '关闭缓存' }
|
{ path: `${pre}page-cache/off`, title: '关闭缓存' },
|
||||||
|
{ path: `${pre}page-cache/params/1`, title: '带参路由缓存 1' },
|
||||||
|
{ path: `${pre}page-cache/params/2`, title: '带参路由缓存 2' }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
22
src/pages/demo/playground/page-cache/params.vue
Normal file
22
src/pages/demo/playground/page-cache/params.vue
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<template>
|
||||||
|
<d2-container type="card">
|
||||||
|
<template slot="header">这个页面会被 keep-alive</template>
|
||||||
|
<h2 class="d2-mt-0">编号:{{id}}</h2>
|
||||||
|
<p class="d2-mt-0">在下面的输入框输入任意字符后,切换到其它页面,再回到此页时输入框文字保留,证明被缓存</p>
|
||||||
|
<el-input v-model="value" placeholder="input here"></el-input>
|
||||||
|
</d2-container>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'demo-playground-page-cache-params',
|
||||||
|
props: {
|
||||||
|
id: String
|
||||||
|
},
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
value: ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -55,9 +55,9 @@ router.afterEach(to => {
|
|||||||
NProgress.done()
|
NProgress.done()
|
||||||
// 需要的信息
|
// 需要的信息
|
||||||
const app = router.app
|
const app = router.app
|
||||||
const { name, params, query } = to
|
const { name, params, query, fullPath } = to
|
||||||
// 多页控制 打开新的页面
|
// 多页控制 打开新的页面
|
||||||
app.$store.dispatch('d2admin/page/open', { name, params, query })
|
app.$store.dispatch('d2admin/page/open', { name, params, query, fullPath })
|
||||||
// 更改标题
|
// 更改标题
|
||||||
util.title(to.meta.title)
|
util.title(to.meta.title)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ export default {
|
|||||||
{ path: 'store/transition', name: `${pre}store-transition`, component: () => import('@/pages/demo/playground/store/transition'), meta: { ...meta, title: '页面过渡开关' } },
|
{ path: 'store/transition', name: `${pre}store-transition`, component: () => import('@/pages/demo/playground/store/transition'), meta: { ...meta, title: '页面过渡开关' } },
|
||||||
{ path: 'page-cache/on', name: `${pre}page-cache-on`, component: () => import('@/pages/demo/playground/page-cache/on.vue'), meta: { ...meta, cache: true, title: '开启缓存' } },
|
{ path: 'page-cache/on', name: `${pre}page-cache-on`, component: () => import('@/pages/demo/playground/page-cache/on.vue'), meta: { ...meta, cache: true, title: '开启缓存' } },
|
||||||
{ path: 'page-cache/off', name: `${pre}page-cache-off`, component: () => import('@/pages/demo/playground/page-cache/off.vue'), meta: { ...meta, title: '关闭缓存' } },
|
{ path: 'page-cache/off', name: `${pre}page-cache-off`, component: () => import('@/pages/demo/playground/page-cache/off.vue'), meta: { ...meta, title: '关闭缓存' } },
|
||||||
|
{ path: 'page-cache/params/:id', name: `${pre}page-cache-params`, component: () => import('@/pages/demo/playground/page-cache/params.vue'), meta: { ...meta, cache: true, title: '带参路由缓存' }, props: true },
|
||||||
{ path: 'page-argu/send', name: `${pre}page-argu-send`, component: () => import('@/pages/demo/playground/page-argu/send.vue'), meta: { ...meta, title: '参数传递 发送' } },
|
{ path: 'page-argu/send', name: `${pre}page-argu-send`, component: () => import('@/pages/demo/playground/page-argu/send.vue'), meta: { ...meta, title: '参数传递 发送' } },
|
||||||
{ path: 'page-argu/get/:username', name: `${pre}page-argu-get`, component: () => import('@/pages/demo/playground/page-argu/get.vue'), meta: { ...meta, title: '参数传递 接收' } },
|
{ path: 'page-argu/get/:username', name: `${pre}page-argu-get`, component: () => import('@/pages/demo/playground/page-argu/get.vue'), meta: { ...meta, title: '参数传递 接收' } },
|
||||||
{ path: 'db/all', name: `${pre}db-all`, component: () => import('@/pages/demo/playground/db/all'), meta: { ...meta, title: '总览' } },
|
{ path: 'db/all', name: `${pre}db-all`, component: () => import('@/pages/demo/playground/db/all'), meta: { ...meta, title: '总览' } },
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ export default {
|
|||||||
opened: [
|
opened: [
|
||||||
{
|
{
|
||||||
name: 'index',
|
name: 'index',
|
||||||
|
fullPath: '/index',
|
||||||
meta: {
|
meta: {
|
||||||
title: '首页',
|
title: '首页',
|
||||||
requiresAuth: false
|
requiresAuth: false
|
||||||
|
|||||||
@@ -10,14 +10,14 @@ export default {
|
|||||||
* @param {Object} param vm {Object} vue 实例
|
* @param {Object} param vm {Object} vue 实例
|
||||||
* @param {Object} param username {String} 用户账号
|
* @param {Object} param username {String} 用户账号
|
||||||
* @param {Object} param password {String} 密码
|
* @param {Object} param password {String} 密码
|
||||||
* @param {Object} param route {Object} 登录成功后定向的路由对象
|
* @param {Object} param route {Object} 登录成功后定向的路由对象 任何 vue-router 支持的格式
|
||||||
*/
|
*/
|
||||||
login ({ dispatch }, {
|
login ({ dispatch }, {
|
||||||
vm,
|
vm,
|
||||||
username,
|
username,
|
||||||
password,
|
password,
|
||||||
route = {
|
route = {
|
||||||
name: 'index'
|
path: '/'
|
||||||
}
|
}
|
||||||
}) {
|
}) {
|
||||||
// 开始请求登录接口
|
// 开始请求登录接口
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
b640559cb03d106f8ed74403b61a7af0561e5015
|
033fcecc7eeff02cfda00a5ded8a23cb359855f1
|
||||||
@@ -57,5 +57,11 @@ module.exports = {
|
|||||||
entry
|
entry
|
||||||
.add('babel-polyfill')
|
.add('babel-polyfill')
|
||||||
.end()
|
.end()
|
||||||
|
// 判断环境加入模拟数据
|
||||||
|
if (process.env.VUE_APP_BUILD_MODE !== 'nomock') {
|
||||||
|
entry
|
||||||
|
.add('@/mock')
|
||||||
|
.end()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user