提交 9515b188 authored 作者: wangjialong209's avatar wangjialong209

文件上传优化

上级 a744c253
...@@ -18,14 +18,14 @@ export default { ...@@ -18,14 +18,14 @@ export default {
if (icon) { if (icon) {
if (icon.includes('el-icon')) { if (icon.includes('el-icon')) {
vnodes.push(<i class={[icon, 'sub-el-icon']} />) // vnodes.push(<i class={[icon, 'sub-el-icon']} />)
} else { } else {
// vnodes.push(<svg-icon icon-class={icon}/>) // vnodes.push(<svg-icon icon-class={icon}/>)
} }
} }
if (title) { if (title) {
vnodes.push(<span slot='title'>{(title)}</span>) // vnodes.push(<span slot='title'>{(title)}</span>)
} }
return vnodes return vnodes
} }
......
...@@ -87,6 +87,11 @@ export const asyncRoutes = [ ...@@ -87,6 +87,11 @@ export const asyncRoutes = [
component: Layout, component: Layout,
redirect: '/dashboard', redirect: '/dashboard',
children: [ children: [
{ {
path: 'dashboard', path: 'dashboard',
component: () => import('@/views/dashboard/index'), component: () => import('@/views/dashboard/index'),
...@@ -229,6 +234,10 @@ export const asyncRoutes = [ ...@@ -229,6 +234,10 @@ export const asyncRoutes = [
}, },
] ]
} }
] ]
}, },
......
/*
* @Author: czj
* @Date: 2023-02-24 16:50:23
* @Description:
* @FilePath: \AdministrationHome\src\router\modules\charts.js
*/
/** When your routing table is too long, you can split it into small modules**/ /** When your routing table is too long, you can split it into small modules**/
import Layout from '@/layout' // import Layout from '@/layout'
const chartsRouter = { // const chartsRouter = {
path: '/charts', // path: '/charts',
component: Layout, // component: Layout,
redirect: 'noRedirect', // redirect: 'noRedirect',
name: 'Charts', // name: 'Charts',
meta: { // meta: {
title: 'Charts', // title: 'Charts',
icon: 'chart' // icon: 'chart'
}, // },
children: [ // children: [
{ // {
path: 'keyboard', // path: 'keyboard',
component: () => import('@/views/charts/keyboard'), // component: () => import('@/views/charts/keyboard'),
name: 'KeyboardChart', // name: 'KeyboardChart',
meta: { title: 'Keyboard Chart', noCache: true } // meta: { title: 'Keyboard Chart', noCache: true }
}, // },
{ // {
path: 'line', // path: 'line',
component: () => import('@/views/charts/line'), // component: () => import('@/views/charts/line'),
name: 'LineChart', // name: 'LineChart',
meta: { title: 'Line Chart', noCache: true } // meta: { title: 'Line Chart', noCache: true }
}, // },
{ // {
path: 'mix-chart', // path: 'mix-chart',
component: () => import('@/views/charts/mix-chart'), // component: () => import('@/views/charts/mix-chart'),
name: 'MixChart', // name: 'MixChart',
meta: { title: 'Mix Chart', noCache: true } // meta: { title: 'Mix Chart', noCache: true }
} // }
] // ]
} // }
export default chartsRouter // export default chartsRouter
/** When your routing table is too long, you can split it into small modules **/ // /** When your routing table is too long, you can split it into small modules **/
import Layout from '@/layout' // import Layout from '@/layout'
const componentsRouter = { // const componentsRouter = {
path: '/components', // path: '/components',
component: Layout, // component: Layout,
redirect: 'noRedirect', // redirect: 'noRedirect',
name: 'ComponentDemo', // name: 'ComponentDemo',
meta: { // meta: {
title: 'Components', // title: 'Components',
icon: 'component' // icon: 'component'
}, // },
children: [ // children: [
{ // {
path: 'tinymce', // path: 'tinymce',
component: () => import('@/views/components-demo/tinymce'), // component: () => import('@/views/components-demo/tinymce'),
name: 'TinymceDemo', // name: 'TinymceDemo',
meta: { title: 'Tinymce' } // meta: { title: 'Tinymce' }
}, // },
{ // {
path: 'markdown', // path: 'markdown',
component: () => import('@/views/components-demo/markdown'), // component: () => import('@/views/components-demo/markdown'),
name: 'MarkdownDemo', // name: 'MarkdownDemo',
meta: { title: 'Markdown' } // meta: { title: 'Markdown' }
}, // },
{ // {
path: 'json-editor', // path: 'json-editor',
component: () => import('@/views/components-demo/json-editor'), // component: () => import('@/views/components-demo/json-editor'),
name: 'JsonEditorDemo', // name: 'JsonEditorDemo',
meta: { title: 'JSON Editor' } // meta: { title: 'JSON Editor' }
}, // },
{ // {
path: 'split-pane', // path: 'split-pane',
component: () => import('@/views/components-demo/split-pane'), // component: () => import('@/views/components-demo/split-pane'),
name: 'SplitpaneDemo', // name: 'SplitpaneDemo',
meta: { title: 'SplitPane' } // meta: { title: 'SplitPane' }
}, // },
{ // {
path: 'avatar-upload', // path: 'avatar-upload',
component: () => import('@/views/components-demo/avatar-upload'), // component: () => import('@/views/components-demo/avatar-upload'),
name: 'AvatarUploadDemo', // name: 'AvatarUploadDemo',
meta: { title: 'Upload' } // meta: { title: 'Upload' }
}, // },
{ // {
path: 'dropzone', // path: 'dropzone',
component: () => import('@/views/components-demo/dropzone'), // component: () => import('@/views/components-demo/dropzone'),
name: 'DropzoneDemo', // name: 'DropzoneDemo',
meta: { title: 'Dropzone' } // meta: { title: 'Dropzone' }
}, // },
{ // {
path: 'sticky', // path: 'sticky',
component: () => import('@/views/components-demo/sticky'), // component: () => import('@/views/components-demo/sticky'),
name: 'StickyDemo', // name: 'StickyDemo',
meta: { title: 'Sticky' } // meta: { title: 'Sticky' }
}, // },
{ // {
path: 'count-to', // path: 'count-to',
component: () => import('@/views/components-demo/count-to'), // component: () => import('@/views/components-demo/count-to'),
name: 'CountToDemo', // name: 'CountToDemo',
meta: { title: 'Count To' } // meta: { title: 'Count To' }
}, // },
{ // {
path: 'mixin', // path: 'mixin',
component: () => import('@/views/components-demo/mixin'), // component: () => import('@/views/components-demo/mixin'),
name: 'ComponentMixinDemo', // name: 'ComponentMixinDemo',
meta: { title: 'Component Mixin' } // meta: { title: 'Component Mixin' }
}, // },
{ // {
path: 'back-to-top', // path: 'back-to-top',
component: () => import('@/views/components-demo/back-to-top'), // component: () => import('@/views/components-demo/back-to-top'),
name: 'BackToTopDemo', // name: 'BackToTopDemo',
meta: { title: 'Back To Top' } // meta: { title: 'Back To Top' }
}, // },
{ // {
path: 'drag-dialog', // path: 'drag-dialog',
component: () => import('@/views/components-demo/drag-dialog'), // component: () => import('@/views/components-demo/drag-dialog'),
name: 'DragDialogDemo', // name: 'DragDialogDemo',
meta: { title: 'Drag Dialog' } // meta: { title: 'Drag Dialog' }
}, // },
{ // {
path: 'drag-select', // path: 'drag-select',
component: () => import('@/views/components-demo/drag-select'), // component: () => import('@/views/components-demo/drag-select'),
name: 'DragSelectDemo', // name: 'DragSelectDemo',
meta: { title: 'Drag Select' } // meta: { title: 'Drag Select' }
}, // },
{ // {
path: 'dnd-list', // path: 'dnd-list',
component: () => import('@/views/components-demo/dnd-list'), // component: () => import('@/views/components-demo/dnd-list'),
name: 'DndListDemo', // name: 'DndListDemo',
meta: { title: 'Dnd List' } // meta: { title: 'Dnd List' }
}, // },
{ // {
path: 'drag-kanban', // path: 'drag-kanban',
component: () => import('@/views/components-demo/drag-kanban'), // component: () => import('@/views/components-demo/drag-kanban'),
name: 'DragKanbanDemo', // name: 'DragKanbanDemo',
meta: { title: 'Drag Kanban' } // meta: { title: 'Drag Kanban' }
} // }
] // ]
} // }
export default componentsRouter // export default componentsRouter
/** When your routing table is too long, you can split it into small modules **/ /*
* @Author: czj
* @Date: 2023-02-24 16:50:23
* @Description:
* @FilePath: \AdministrationHome\src\router\modules\nested.js
*/
// /** When your routing table is too long, you can split it into small modules **/
import Layout from '@/layout' // import Layout from '@/layout'
const nestedRouter = { // const nestedRouter = {
path: '/nested', // path: '/nested',
component: Layout, // component: Layout,
redirect: '/nested/menu1/menu1-1', // redirect: '/nested/menu1/menu1-1',
name: 'Nested', // name: 'Nested',
meta: { // meta: {
title: 'Nested Routes', // title: 'Nested Routes',
icon: 'nested' // icon: 'nested'
}, // },
children: [ // children: [
{ // {
path: 'menu1', // path: 'menu1',
component: () => import('@/views/nested/menu1/index'), // Parent router-view // component: () => import('@/views/nested/menu1/index'), // Parent router-view
name: 'Menu1', // name: 'Menu1',
meta: { title: 'Menu 1' }, // meta: { title: 'Menu 1' },
redirect: '/nested/menu1/menu1-1', // redirect: '/nested/menu1/menu1-1',
children: [ // children: [
{ // {
path: 'menu1-1', // path: 'menu1-1',
component: () => import('@/views/nested/menu1/menu1-1'), // component: () => import('@/views/nested/menu1/menu1-1'),
name: 'Menu1-1', // name: 'Menu1-1',
meta: { title: 'Menu 1-1' } // meta: { title: 'Menu 1-1' }
}, // },
{ // {
path: 'menu1-2', // path: 'menu1-2',
component: () => import('@/views/nested/menu1/menu1-2'), // component: () => import('@/views/nested/menu1/menu1-2'),
name: 'Menu1-2', // name: 'Menu1-2',
redirect: '/nested/menu1/menu1-2/menu1-2-1', // redirect: '/nested/menu1/menu1-2/menu1-2-1',
meta: { title: 'Menu 1-2' }, // meta: { title: 'Menu 1-2' },
children: [ // children: [
{ // {
path: 'menu1-2-1', // path: 'menu1-2-1',
component: () => import('@/views/nested/menu1/menu1-2/menu1-2-1'), // component: () => import('@/views/nested/menu1/menu1-2/menu1-2-1'),
name: 'Menu1-2-1', // name: 'Menu1-2-1',
meta: { title: 'Menu 1-2-1' } // meta: { title: 'Menu 1-2-1' }
}, // },
{ // {
path: 'menu1-2-2', // path: 'menu1-2-2',
component: () => import('@/views/nested/menu1/menu1-2/menu1-2-2'), // component: () => import('@/views/nested/menu1/menu1-2/menu1-2-2'),
name: 'Menu1-2-2', // name: 'Menu1-2-2',
meta: { title: 'Menu 1-2-2' } // meta: { title: 'Menu 1-2-2' }
} // }
] // ]
}, // },
{ // {
path: 'menu1-3', // path: 'menu1-3',
component: () => import('@/views/nested/menu1/menu1-3'), // component: () => import('@/views/nested/menu1/menu1-3'),
name: 'Menu1-3', // name: 'Menu1-3',
meta: { title: 'Menu 1-3' } // meta: { title: 'Menu 1-3' }
} // }
] // ]
}, // },
{ // {
path: 'menu2', // path: 'menu2',
name: 'Menu2', // name: 'Menu2',
component: () => import('@/views/nested/menu2/index'), // component: () => import('@/views/nested/menu2/index'),
meta: { title: 'Menu 2' } // meta: { title: 'Menu 2' }
} // }
] // ]
} // }
export default nestedRouter // export default nestedRouter
/** When your routing table is too long, you can split it into small modules **/ /*
* @Author: czj
* @Date: 2023-02-24 16:50:23
* @Description:
* @FilePath: \AdministrationHome\src\router\modules\table.js
*/
// /** When your routing table is too long, you can split it into small modules **/
import Layout from '@/layout' // import Layout from '@/layout'
const tableRouter = { // const tableRouter = {
path: '/table', // path: '/table',
component: Layout, // component: Layout,
redirect: '/table/complex-table', // redirect: '/table/complex-table',
name: 'Table', // name: 'Table',
meta: { // meta: {
title: 'Table', // title: 'Table',
icon: 'table' // icon: 'table'
}, // },
children: [ // children: [
{ // {
path: 'dynamic-table', // path: 'dynamic-table',
component: () => import('@/views/table/dynamic-table/index'), // component: () => import('@/views/table/dynamic-table/index'),
name: 'DynamicTable', // name: 'DynamicTable',
meta: { title: 'Dynamic Table' } // meta: { title: 'Dynamic Table' }
}, // },
{ // {
path: 'drag-table', // path: 'drag-table',
component: () => import('@/views/table/drag-table'), // component: () => import('@/views/table/drag-table'),
name: 'DragTable', // name: 'DragTable',
meta: { title: 'Drag Table' } // meta: { title: 'Drag Table' }
}, // },
{ // {
path: 'inline-edit-table', // path: 'inline-edit-table',
component: () => import('@/views/table/inline-edit-table'), // component: () => import('@/views/table/inline-edit-table'),
name: 'InlineEditTable', // name: 'InlineEditTable',
meta: { title: 'Inline Edit' } // meta: { title: 'Inline Edit' }
}, // },
{ // {
path: 'complex-table', // path: 'complex-table',
component: () => import('@/views/table/complex-table'), // component: () => import('@/views/table/complex-table'),
name: 'ComplexTable', // name: 'ComplexTable',
meta: { title: 'Complex Table' } // meta: { title: 'Complex Table' }
} // }
] // ]
} // }
export default tableRouter // export default tableRouter
...@@ -47,12 +47,20 @@ const mutations = { ...@@ -47,12 +47,20 @@ const mutations = {
state.routes = constantRoutes.concat(routes) state.routes = constantRoutes.concat(routes)
} }
} }
/*
1. // component: (resolve) => require([`${element.component}`], resolve) // // 变量component: '@/pages/drawSvg/index.vue', // 会报错
2.// component: (resolve) => require([`@/pages/${element.component}/index.vue`], resolve)//变量 component: 'drawSvg',//ok
*/
//处理路由地址 不能用 import。使用require,异步 //处理路由地址 不能用 import。使用require,异步
function routerCom(view_path) { function routerCom(view_path) {//不支持全路径,支持拼接路径
return (resolve) => require([view_path], resolve); return (resolve) => require([`@/${view_path}`], resolve);
} }
//过滤数据 /转为树结构 //过滤数据 /转为树结构
function filterRouterData(list) { function filterRouterData(list) {
console.log('路由处理的原始数据@@@');
console.log(list);
let result = [] let result = []
let map = {} let map = {}
if (!Array.isArray(list)) return []; if (!Array.isArray(list)) return [];
...@@ -93,15 +101,17 @@ const actions = { ...@@ -93,15 +101,17 @@ const actions = {
return new Promise(async resolve => { return new Promise(async resolve => {
let response = await get_permission_btn_menu() let response = await get_permission_btn_menu()
/* route_tree_all(permission); //转为树结构 */ /* route_tree_all(permission); //转为树结构 */
let route_list = filterRouterData(response.permission); // let route_list = filterRouterData(response.permission);
// console.log('<<<<<<<<<<<<<<<<<<组装好的路由列表>>>>>>>>>>>>>>>>>>>>>>>>'); // console.log('<<<<<<<<<<<<<组装好的路由列表>>>>>>>>>>>>>');
// console.log(route_list); // console.log(route_list);
// console.log('权限菜单数据>>>>>>>>>>'); // console.log('权限菜单数据>>>>>>>>>>');
// console.log(response); // console.log(response);
// console.log('本地路由数据@@@@@@@@@@'); // console.log('本地路由数据@@@@@@@@@@');
// console.log(asyncRoutes); // console.log(asyncRoutes);
// asyncRoutes[0].children = route_list // asyncRoutes[0].children = route_list;
let accessedRoutes = asyncRoutes || []; let accessedRoutes = asyncRoutes || [];
console.log('处理好的路由数据');
console.log(accessedRoutes);
commit('SET_ROUTES', accessedRoutes) commit('SET_ROUTES', accessedRoutes)
resolve(accessedRoutes) resolve(accessedRoutes)
}) })
......
:export {
menuText: #bfcbd9;
menuActiveText: #409EFF;
subMenuActiveText: #f4f4f5;
menuBg: #304156;
menuHover: #263445;
subMenuBg: #1f2d3d;
subMenuHover: #001528;
sideBarWidth: 210px;
}
#app .main-container {
min-height: 100%;
transition: margin-left .28s;
margin-left: 210px;
position: relative;
}
#app .sidebar-container {
transition: width 0.28s;
width: 210px !important;
background-color: #304156;
height: 100%;
position: fixed;
font-size: 0px;
top: 0;
bottom: 0;
left: 0;
z-index: 1001;
overflow: hidden;
}
#app .sidebar-container .horizontal-collapse-transition {
transition: 0s width ease-in-out, 0s padding-left ease-in-out, 0s padding-right ease-in-out;
}
#app .sidebar-container .scrollbar-wrapper {
overflow-x: hidden !important;
}
#app .sidebar-container .el-scrollbar__bar.is-vertical {
right: 0px;
}
#app .sidebar-container .el-scrollbar {
height: 100%;
}
#app .sidebar-container.has-logo .el-scrollbar {
height: calc(100% - 50px);
}
#app .sidebar-container .is-horizontal {
display: none;
}
#app .sidebar-container a {
display: inline-block;
width: 100%;
overflow: hidden;
}
#app .sidebar-container .svg-icon {
margin-right: 16px;
}
#app .sidebar-container .sub-el-icon {
margin-right: 12px;
margin-left: -2px;
}
#app .sidebar-container .el-menu {
border: none;
height: 100%;
width: 100% !important;
}
#app .sidebar-container .submenu-title-noDropdown:hover,
#app .sidebar-container .el-submenu__title:hover {
background-color: #263445 !important;
}
#app .sidebar-container .is-active > .el-submenu__title {
color: #f4f4f5 !important;
}
#app .sidebar-container .nest-menu .el-submenu > .el-submenu__title,
#app .sidebar-container .el-submenu .el-menu-item {
min-width: 210px !important;
background-color: #1f2d3d !important;
}
#app .sidebar-container .nest-menu .el-submenu > .el-submenu__title:hover,
#app .sidebar-container .el-submenu .el-menu-item:hover {
background-color: #001528 !important;
}
#app .hideSidebar .sidebar-container {
width: 54px !important;
}
#app .hideSidebar .main-container {
margin-left: 54px;
}
#app .hideSidebar .submenu-title-noDropdown {
padding: 0 !important;
position: relative;
}
#app .hideSidebar .submenu-title-noDropdown .el-tooltip {
padding: 0 !important;
}
#app .hideSidebar .submenu-title-noDropdown .el-tooltip .svg-icon {
margin-left: 20px;
}
#app .hideSidebar .submenu-title-noDropdown .el-tooltip .sub-el-icon {
margin-left: 19px;
}
#app .hideSidebar .el-submenu {
overflow: hidden;
}
#app .hideSidebar .el-submenu > .el-submenu__title {
padding: 0 !important;
}
#app .hideSidebar .el-submenu > .el-submenu__title .svg-icon {
margin-left: 20px;
}
#app .hideSidebar .el-submenu > .el-submenu__title .sub-el-icon {
margin-left: 19px;
}
#app .hideSidebar .el-submenu > .el-submenu__title .el-submenu__icon-arrow {
display: none;
}
#app .hideSidebar .el-menu--collapse .el-submenu > .el-submenu__title > span {
height: 0;
width: 0;
overflow: hidden;
visibility: hidden;
display: inline-block;
}
#app .el-menu--collapse .el-menu .el-submenu {
min-width: 210px !important;
}
#app .mobile .main-container {
margin-left: 0px;
}
#app .mobile .sidebar-container {
transition: transform .28s;
width: 210px !important;
}
#app .mobile.hideSidebar .sidebar-container {
pointer-events: none;
transition-duration: 0.3s;
transform: translate3d(-210px, 0, 0);
}
#app .withoutAnimation .main-container,
#app .withoutAnimation .sidebar-container {
transition: none;
}
.el-menu--vertical > .el-menu .svg-icon {
margin-right: 16px;
}
.el-menu--vertical > .el-menu .sub-el-icon {
margin-right: 12px;
margin-left: -2px;
}
.el-menu--vertical .nest-menu .el-submenu > .el-submenu__title:hover,
.el-menu--vertical .el-menu-item:hover {
background-color: #263445 !important;
}
.el-menu--vertical > .el-menu--popup {
max-height: 100vh;
overflow-y: auto;
}
.el-menu--vertical > .el-menu--popup::-webkit-scrollbar-track-piece {
background: #d3dce6;
}
.el-menu--vertical > .el-menu--popup::-webkit-scrollbar {
width: 6px;
}
.el-menu--vertical > .el-menu--popup::-webkit-scrollbar-thumb {
background: #99a9bf;
border-radius: 20px;
}
:export{menuText:#bfcbd9;menuActiveText:#409EFF;subMenuActiveText:#f4f4f5;menuBg:#304156;menuHover:#263445;subMenuBg:#1f2d3d;subMenuHover:#001528;sideBarWidth:210px}#app .main-container{min-height:100%;transition:margin-left .28s;margin-left:210px;position:relative}#app .sidebar-container{transition:width 0.28s;width:210px !important;background-color:#304156;height:100%;position:fixed;font-size:0px;top:0;bottom:0;left:0;z-index:1001;overflow:hidden}#app .sidebar-container .horizontal-collapse-transition{transition:0s width ease-in-out, 0s padding-left ease-in-out, 0s padding-right ease-in-out}#app .sidebar-container .scrollbar-wrapper{overflow-x:hidden !important}#app .sidebar-container .el-scrollbar__bar.is-vertical{right:0px}#app .sidebar-container .el-scrollbar{height:100%}#app .sidebar-container.has-logo .el-scrollbar{height:calc(100% - 50px)}#app .sidebar-container .is-horizontal{display:none}#app .sidebar-container a{display:inline-block;width:100%;overflow:hidden}#app .sidebar-container .svg-icon{margin-right:16px}#app .sidebar-container .sub-el-icon{margin-right:12px;margin-left:-2px}#app .sidebar-container .el-menu{border:none;height:100%;width:100% !important}#app .sidebar-container .submenu-title-noDropdown:hover,#app .sidebar-container .el-submenu__title:hover{background-color:#263445 !important}#app .sidebar-container .is-active>.el-submenu__title{color:#f4f4f5 !important}#app .sidebar-container .nest-menu .el-submenu>.el-submenu__title,#app .sidebar-container .el-submenu .el-menu-item{min-width:210px !important;background-color:#1f2d3d !important}#app .sidebar-container .nest-menu .el-submenu>.el-submenu__title:hover,#app .sidebar-container .el-submenu .el-menu-item:hover{background-color:#001528 !important}#app .hideSidebar .sidebar-container{width:54px !important}#app .hideSidebar .main-container{margin-left:54px}#app .hideSidebar .submenu-title-noDropdown{padding:0 !important;position:relative}#app .hideSidebar .submenu-title-noDropdown .el-tooltip{padding:0 !important}#app .hideSidebar .submenu-title-noDropdown .el-tooltip .svg-icon{margin-left:20px}#app .hideSidebar .submenu-title-noDropdown .el-tooltip .sub-el-icon{margin-left:19px}#app .hideSidebar .el-submenu{overflow:hidden}#app .hideSidebar .el-submenu>.el-submenu__title{padding:0 !important}#app .hideSidebar .el-submenu>.el-submenu__title .svg-icon{margin-left:20px}#app .hideSidebar .el-submenu>.el-submenu__title .sub-el-icon{margin-left:19px}#app .hideSidebar .el-submenu>.el-submenu__title .el-submenu__icon-arrow{display:none}#app .hideSidebar .el-menu--collapse .el-submenu>.el-submenu__title>span{height:0;width:0;overflow:hidden;visibility:hidden;display:inline-block}#app .el-menu--collapse .el-menu .el-submenu{min-width:210px !important}#app .mobile .main-container{margin-left:0px}#app .mobile .sidebar-container{transition:transform .28s;width:210px !important}#app .mobile.hideSidebar .sidebar-container{pointer-events:none;transition-duration:0.3s;transform:translate3d(-210px, 0, 0)}#app .withoutAnimation .main-container,#app .withoutAnimation .sidebar-container{transition:none}.el-menu--vertical>.el-menu .svg-icon{margin-right:16px}.el-menu--vertical>.el-menu .sub-el-icon{margin-right:12px;margin-left:-2px}.el-menu--vertical .nest-menu .el-submenu>.el-submenu__title:hover,.el-menu--vertical .el-menu-item:hover{background-color:#263445 !important}.el-menu--vertical>.el-menu--popup{max-height:100vh;overflow-y:auto}.el-menu--vertical>.el-menu--popup::-webkit-scrollbar-track-piece{background:#d3dce6}.el-menu--vertical>.el-menu--popup::-webkit-scrollbar{width:6px}.el-menu--vertical>.el-menu--popup::-webkit-scrollbar-thumb{background:#99a9bf;border-radius:20px}
@import './variables.scss';
#app { #app {
.main-container { .main-container {
...@@ -191,6 +193,7 @@ ...@@ -191,6 +193,7 @@
.svg-icon { .svg-icon {
margin-right: 16px; margin-right: 16px;
} }
.sub-el-icon { .sub-el-icon {
margin-right: 12px; margin-right: 12px;
margin-left: -2px; margin-left: -2px;
......
...@@ -75,7 +75,7 @@ export default { ...@@ -75,7 +75,7 @@ export default {
}; };
return { return {
retrieve_params: { retrieve_params: {
email: '2664109446@qq.com',//手机号 email: '',//手机号
verification_key: '',//验证key verification_key: '',//验证key
verification_code: '',//短信验证码 verification_code: '',//短信验证码
new_password: '',//新密码 new_password: '',//新密码
...@@ -125,7 +125,7 @@ export default { ...@@ -125,7 +125,7 @@ export default {
}, },
//切换找回方式 //切换找回方式
retrieveType() { retrieveType() {
this.$emit('retrieveType', 'email'); this.$emit('retrieveType', 'phone');
}, },
//返回登录 //返回登录
toLogin() { toLogin() {
...@@ -175,8 +175,11 @@ export default { ...@@ -175,8 +175,11 @@ export default {
console.log('要提交的参数'); console.log('要提交的参数');
console.log(params); console.log(params);
email_updata_user_password(params).then(res => { email_updata_user_password(params).then(res => {
if (res.code == 200) { if (res.err_code == 200) {
this.$message.success('修改成功') this.$message.success('修改成功,即将放回登录页')
setTimeout(() => {
this.$router.push('/login');
}, 2000);
} }
console.log('邮箱修改密码'); console.log('邮箱修改密码');
console.log(res); console.log(res);
......
...@@ -27,24 +27,30 @@ ...@@ -27,24 +27,30 @@
</el-form-item> </el-form-item>
<el-form-item prop="new_password"> <el-form-item prop="new_password">
<span>新密码</span> <span>新密码</span>
<el-input v-model="retrieve_params.new_password"> <el-tooltip v-model="capsTooltip1" content="大写锁定打开" placement="right" manual>
<i slot="suffix" class="el-input__icon el-icon-view"></i> <el-input v-model="retrieve_params.new_password" type="password" @keyup.native="checkCapslock1"
@blur="capsTooltip1 = false">
<!-- <i slot="suffix" class="el-input__icon el-icon-view"></i> -->
</el-input> </el-input>
</el-tooltip>
</el-form-item> </el-form-item>
<el-form-item prop="affirm_password"> <el-form-item prop="affirm_password">
<span>确认密码</span> <span>确认密码</span>
<el-input v-model="retrieve_params.affirm_password"> <el-tooltip v-model="capsTooltip2" content="大写锁定打开" placement="right" manual>
<i slot="suffix" class="el-input__icon el-icon-view"></i> <el-input v-model="retrieve_params.affirm_password" type="password" @keyup.native="checkCapslock2"
@blur="capsTooltip2 = false">
<!-- <i slot="suffix" class="el-input__icon el-icon-view"></i> -->
</el-input> </el-input>
</el-tooltip>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div style="margin-top: 20px;"> <div style="margin-top: 20px;">
<el-button type="primary" style="width:100%;">重置密码</el-button> <el-button type="primary" style="width:100%;" @click="resettingSubmit">重置密码</el-button>
</div> </div>
<div> <div>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-button type="text" size="mini">邮箱找回</el-button> <el-button type="text" size="mini" @click="retrieveType">邮箱找回</el-button>
</el-col> </el-col>
<el-col :span="12" style="text-align: right;"> <el-col :span="12" style="text-align: right;">
<el-button type="text" size="mini" @click="toLogin">返回登陆</el-button> <el-button type="text" size="mini" @click="toLogin">返回登陆</el-button>
...@@ -55,11 +61,21 @@ ...@@ -55,11 +61,21 @@
</template> </template>
<script> <script>
import { get_short_message_code, short_message_updata_user_password } from '@/api/user';
export default { export default {
data() { data() {
let validatePass2 = (rule, value, callback) => {
if (value === '') {
callback(new Error('请再次输入密码'))
} else if (value !== this.retrieve_params.new_password) {
callback(new Error('两次输入密码不一致!'))
} else {
callback()
}
};
return { return {
retrieve_params: { retrieve_params: {
phone: '2664109446@qq.com',//手机号 phone: '',//手机号
verification_key: '',//验证key verification_key: '',//验证key
verification_code: '',//短信验证码 verification_code: '',//短信验证码
new_password: '',//新密码 new_password: '',//新密码
...@@ -77,7 +93,7 @@ export default { ...@@ -77,7 +93,7 @@ export default {
{ required: true, message: '请输入新密码', trigger: 'blur' }, { required: true, message: '请输入新密码', trigger: 'blur' },
], ],
affirm_password: [ affirm_password: [
{ required: true, message: '请确认密码', trigger: 'blur' }, { required: true, validator: validatePass2, trigger: 'blur' },
], ],
}, },
...@@ -86,6 +102,9 @@ export default { ...@@ -86,6 +102,9 @@ export default {
time: null, time: null,
timer: null, timer: null,
capsTooltip1: false,
capsTooltip2: false,
}; };
}, },
...@@ -96,6 +115,18 @@ export default { ...@@ -96,6 +115,18 @@ export default {
mounted() { }, mounted() { },
methods: { methods: {
checkCapslock1(e) {
const { key } = e
this.capsTooltip1 = key && key.length === 1 && (key >= 'A' && key <= 'Z')
},
checkCapslock2(e) {
const { key } = e
this.capsTooltip2 = key && key.length === 1 && (key >= 'A' && key <= 'Z')
},
//切换找回方式
retrieveType() {
this.$emit('retrieveType', 'email');
},
//返回登录 //返回登录
toLogin() { toLogin() {
// this.$router.go(-1); // this.$router.go(-1);
...@@ -107,10 +138,11 @@ export default { ...@@ -107,10 +138,11 @@ export default {
if (errMsg) { if (errMsg) {
console.log('手机号验证未通过'); console.log('手机号验证未通过');
} else { } else {
let email = this.$Aesencrypt(this.retrieve_params.phone); let phone = this.$Aesencrypt(this.retrieve_params.phone);
get_email_code({ email: email }).then(res => { get_short_message_code({ phone: phone }).then(res => {
console.log('获取验证码回调'); console.log('获取验证码回调');
console.log(res); console.log(res);
this.retrieve_params.verification_key = res.key;
const _that = this; const _that = this;
this.is_repeated_click = true; this.is_repeated_click = true;
// let time = 60, timer = null; // let time = 60, timer = null;
...@@ -126,11 +158,37 @@ export default { ...@@ -126,11 +158,37 @@ export default {
this.time--; this.time--;
} }
}, 1000); }, 1000);
}) })
} }
}) })
}, },
//重置提交
resettingSubmit() {
this.$refs.retrieveForm.validate((valid) => {
if (valid) {
let params = this.$removeProperty({
verification_key: this.retrieve_params.verification_key,
password: this.$Aesencrypt(this.retrieve_params.affirm_password),
verification_code: this.retrieve_params.verification_code,
})
console.log('要提交的参数');
console.log(params);
short_message_updata_user_password(params).then(res => {
if (res.err_code == 200) {
this.$message.success('修改成功,即将放回登录页')
setTimeout(() => {
this.$router.push('/login');
}, 2000);
}
console.log('邮箱修改密码');
console.log(res);
})
} else {
console.log('error submit!!');
return false;
}
});
},
} }
} }
......
...@@ -12,10 +12,10 @@ ...@@ -12,10 +12,10 @@
<div class="content_body"> <div class="content_body">
<h1 class="content_title">国家烟草质检中心系统</h1> <h1 class="content_title">国家烟草质检中心系统</h1>
<div> <div>
<el-card> <el-card v-if="retrieve_type == 'email'">
<email-retrieve @retrieveType="retrieveType"></email-retrieve> <email-retrieve @retrieveType="retrieveType"></email-retrieve>
</el-card> </el-card>
<el-card> <el-card v-if="retrieve_type == 'phone'">
<phone-retrieve @retrieveType="retrieveType"></phone-retrieve> <phone-retrieve @retrieveType="retrieveType"></phone-retrieve>
</el-card> </el-card>
...@@ -32,7 +32,7 @@ import PhoneRetrieve from './components/PhoneRetrieve.vue'; ...@@ -32,7 +32,7 @@ import PhoneRetrieve from './components/PhoneRetrieve.vue';
export default { export default {
data() { data() {
return { return {
retrieve_type: 'email', retrieve_type: 'phone',
}; };
}, },
...@@ -45,6 +45,7 @@ export default { ...@@ -45,6 +45,7 @@ export default {
methods: { methods: {
retrieveType(val) { retrieveType(val) {
console.log(val); console.log(val);
this.retrieve_type = val;
}, },
} }
} }
......
...@@ -252,8 +252,8 @@ export default { ...@@ -252,8 +252,8 @@ export default {
getExaminationQuestionsAll() { getExaminationQuestionsAll() {
this.examination_questions_all_list = []; this.examination_questions_all_list = [];
get_examination_questions_all().then(res => { get_examination_questions_all().then(res => {
console.log('获取全套试题'); // console.log('获取全套试题');
console.log(res); // console.log(res);
if (res.length) { if (res.length) {
res.forEach(element => { res.forEach(element => {
this.examination_questions_all_list.push({ value: element.id, label: element.title, children: [], }) this.examination_questions_all_list.push({ value: element.id, label: element.title, children: [], })
...@@ -280,8 +280,6 @@ export default { ...@@ -280,8 +280,6 @@ export default {
//获取方位 //获取方位
getTobaccoProvince() { getTobaccoProvince() {
get_tobacco_province().then(res => { get_tobacco_province().then(res => {
console.log('烟草区域信息');
console.log(res);
this.position_data = res || []; this.position_data = res || [];
for (let i in res) { for (let i in res) {
this.getProvinceList(res[i].name) this.getProvinceList(res[i].name)
...@@ -304,8 +302,6 @@ export default { ...@@ -304,8 +302,6 @@ export default {
} }
/* { name_is_value: true } 获取汉字值的列表 */ /* { name_is_value: true } 获取汉字值的列表 */
get_province_list({ area: val }).then(res => { get_province_list({ area: val }).then(res => {
console.log('获取省市区数据');
console.log(res);
if (res.length) { if (res.length) {
// this.province_list = removeNodeInTree(res); // this.province_list = removeNodeInTree(res);
this.province_data[val] = removeNodeInTree(res); this.province_data[val] = removeNodeInTree(res);
...@@ -318,16 +314,13 @@ export default { ...@@ -318,16 +314,13 @@ export default {
//获取全部烟草等级 //获取全部烟草等级
getTobaccoAll() { getTobaccoAll() {
get_tobacco_all_info().then(res => { get_tobacco_all_info().then(res => {
console.log('获取全部烟草品种');
console.log(res);
this.tobacco_all_lists = res || []; this.tobacco_all_lists = res || [];
}) })
}, },
//获取全部烟草等级 //获取全部烟草等级
getTobaccoGradesAll() { getTobaccoGradesAll() {
get_tobacco_grades_all().then(res => { get_tobacco_grades_all().then(res => {
console.log('全部烟草等级');
console.log(res);
this.tobacco_grades_all_lists = res || []; this.tobacco_grades_all_lists = res || [];
}) })
}, },
...@@ -396,7 +389,7 @@ export default { ...@@ -396,7 +389,7 @@ export default {
console.log('试题上传'); console.log('试题上传');
console.log(val); console.log(val);
const formData = new FormData(); const formData = new FormData();
formData.append('file', val) formData.append('file', val.file)
let id = this.examination_questions_id; let id = this.examination_questions_id;
examination_question_detail_upload(id, formData).then(res => { examination_question_detail_upload(id, formData).then(res => {
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论