Browse Source

解决冲突

master
wen 2 years ago
parent
commit
adfede2097
  1. 2
      package.json
  2. 4
      public/index.html
  3. 33
      public/loadhead.css
  4. 85
      src/api/user.js
  5. BIN
      src/common/img/file.png
  6. BIN
      src/common/img/jialuoma.png
  7. BIN
      src/common/img/jialuoma2.png
  8. 7
      src/components/Breadcrumb/index.vue
  9. 3
      src/layout/components/AppMain.vue
  10. 6
      src/layout/components/Navbar.vue
  11. 1
      src/layout/components/Sidebar/Link.vue
  12. 4
      src/layout/components/Sidebar/Logo.vue
  13. 42
      src/layout/components/Sidebar/SidebarItem.vue
  14. 93
      src/layout/components/Sidebar/index.vue
  15. 74
      src/layout/components/Sidebar/leftMenusData.js
  16. 22
      src/layout/index.vue
  17. 12
      src/main.js
  18. 5
      src/peizhi.js
  19. 75
      src/permission.js
  20. 169
      src/router/index.js
  21. 3
      src/settings.js
  22. 2
      src/styles/element-ui.scss
  23. 14
      src/styles/index.scss
  24. 49
      src/styles/publics.scss
  25. 21
      src/styles/sidebar.scss
  26. 2
      src/styles/variables.scss
  27. 5
      src/utils/EventBus.js
  28. 2
      src/utils/auth.js
  29. 2
      src/utils/get-page-title.js
  30. 4
      src/utils/index.js
  31. 146
      src/utils/request.js
  32. 28
      src/views/dashboard/index.vue
  33. 87
      src/views/form/index.vue
  34. 56
      src/views/homepage/index.vue
  35. 173
      src/views/login/index.vue
  36. 7
      src/views/nested/menu1/index.vue
  37. 7
      src/views/nested/menu1/menu1-1/index.vue
  38. 7
      src/views/nested/menu1/menu1-2/index.vue
  39. 5
      src/views/nested/menu1/menu1-2/menu1-2-1/index.vue
  40. 5
      src/views/nested/menu1/menu1-2/menu1-2-2/index.vue
  41. 5
      src/views/nested/menu1/menu1-3/index.vue
  42. 5
      src/views/nested/menu2/index.vue
  43. 517
      src/views/subfile/index.js
  44. 745
      src/views/subfile/index.vue
  45. 90
      src/views/systme/switchtheme.vue
  46. 79
      src/views/table/index.vue
  47. 78
      src/views/tree/index.vue
  48. 12
      src/views/usermanage/index.vue
  49. 4
      vue.config.js

2
package.json

@ -14,7 +14,7 @@
"test:ci": "npm run lint && npm run test:unit" "test:ci": "npm run lint && npm run test:unit"
}, },
"dependencies": { "dependencies": {
"axios": "0.18.1", "axios": "^1.1.2",
"core-js": "3.6.5", "core-js": "3.6.5",
"element-ui": "2.13.2", "element-ui": "2.13.2",
"js-cookie": "2.2.0", "js-cookie": "2.2.0",

4
public/index.html

@ -5,7 +5,9 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<link rel="icon" href="<%= BASE_URL %>jialuoma2.ico"> <link rel="icon" href="<%= BASE_URL %>jialuoma2.ico">
<title><%= webpackConfig.name %></title> <!-- <title><%= webpackConfig.name %></title> -->
<title>嘉洛马</title>
<link rel="stylesheet" type="text/css" href="loadhead.css">
</head> </head>
<body> <body>
<noscript> <noscript>

33
public/loadhead.css

@ -0,0 +1,33 @@
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,select,p,blockquote,th,td{margin:0;padding:0;font-weight:inherit;}
.clearfix{zoom:1;}
.clearfix:after{content:'.';display:block;visibility:hidden;clear:both;overflow:hidden;height:0px;}
body{font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, SimSun, sans-serif;margin:0 auto;font-size:14px;min-height:100%;}
ul,li{list-style:none;margin:0;padding:0;}
a,img,span{display:inline-block;max-width:100%;}
a{color:#464c5c;text-decoration:none;}
.img-responsive{max-width:100%;display:block;}
.elementBlock{display:block !important;}
.elementNone{display:none !important;}
.elementhidden{visibility:hidden !important;}
.verMiddle{vertical-align:middle !important;}
.vercenter{text-align:center !important;}
.textright{text-align:right !important;}
.verbold{font-weight:bold !important;}
.qcmargin{margin:0 !important;}
.qcpadding{padding:0 !important;}
.qcbdbt{border-bottom:0 !important;}
.qcbdtop{border-top:0 !important;}
.qcbdlt{border-left:0 !important;}
.qcbdrt{border-right:0 !important;}
.bjcolor{background-color:#FFF !important;}
.minheight{min-height:537px;}
a:hover{text-decoration:none;}
a:active{text-decoration:none;}
a:visited{text-decoration:none;}
*{
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}

85
src/api/user.js

@ -1,24 +1,89 @@
import request from '@/utils/request' import request from '@/utils/request'
export function login(data) { export function captcha(datas) {
return request({ return request({
url: '/vue-admin-template/user/login', url: '/api/captcha',
method: 'post', method: 'post',
data data: datas
}) })
} }
export function getInfo(token) { export function login(datas) {
return request({ return request({
url: '/vue-admin-template/user/info', url: '/api/login',
method: 'get', method: 'post',
params: { token } data: datas
})
}
// 获取目录和文件数据
export function mirlist(datas) {
return request({
url: '/api/ls',
method: 'post',
data: datas
}) })
} }
export function logout() { // 创建目录
export function mkdir(datas) {
return request({ return request({
url: '/vue-admin-template/user/logout', url: '/api/mkdir',
method: 'post' method: 'post',
data: datas
})
}
// 上传文件
export function uploadrequest(datas) {
return request({
url: '/api/uploadbase64',
method: 'post',
data: datas
})
}
// 删除目录
export function rmdirs(datas) {
return request({
url: '/api/rmdir',
method: 'post',
data: datas
})
}
// 删除文件
export function deletefile(datas) {
return request({
url: '/api/delete',
method: 'post',
data: datas
})
}
// 重命名文件
export function renamefile(datas) {
return request({
url: '/api/rename',
method: 'post',
data: datas
})
}
// 移动目录
export function movefiledir(datas) {
return request({
url: '/api/move',
method: 'post',
data: datas
})
}
// 更换皮肤
export function switchthemeApi(datas) {
return request({
url: '/api/switchtheme/',
method: 'post',
data: datas
}) })
} }

BIN
src/common/img/file.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

BIN
src/common/img/jialuoma.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
src/common/img/jialuoma2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

7
src/components/Breadcrumb/index.vue

@ -1,5 +1,5 @@
<template> <template>
<el-breadcrumb class="app-breadcrumb" separator=">"> <el-breadcrumb class="app-breadcrumb" separator-class="el-icon-arrow-right">
<transition-group name="breadcrumb"> <transition-group name="breadcrumb">
<el-breadcrumb-item v-for="(item,index) in levelList" :key="item.path"> <el-breadcrumb-item v-for="(item,index) in levelList" :key="item.path">
<span v-if="item.redirect==='noRedirect'||index==levelList.length-1" class="no-redirect">{{ item.meta.title }}</span> <span v-if="item.redirect==='noRedirect'||index==levelList.length-1" class="no-redirect">{{ item.meta.title }}</span>
@ -21,6 +21,7 @@ export default {
watch: { watch: {
$route() { $route() {
this.getBreadcrumb() this.getBreadcrumb()
} }
}, },
created() { created() {
@ -29,11 +30,13 @@ export default {
methods: { methods: {
getBreadcrumb() { getBreadcrumb() {
// only show routes with meta.title // only show routes with meta.title
let matched = this.$route.matched.filter(item => item.meta && item.meta.title) let matched = this.$route.matched.filter(item => item.meta && item.meta.title)
//console.log(this.$route);
const first = matched[0] const first = matched[0]
if (!this.isDashboard(first)) { if (!this.isDashboard(first)) {
// matched = [{ path: '/dashboard', meta: { title: 'Dashboard' }}].concat(matched) //matched = [{ path: '/homepage', meta: { title: 'Dashboard' }}].concat(matched)
matched = [{ path: '/dashboard', meta: { title: '' }}].concat(matched) matched = [{ path: '/dashboard', meta: { title: '' }}].concat(matched)
} }

3
src/layout/components/AppMain.vue

@ -20,7 +20,8 @@ export default {
<style scoped> <style scoped>
.app-main { .app-main {
/*50 = navbar */ /*50 = navbar */
min-height: calc(100vh - 50px); /* min-height: calc(100vh - 50px); */
min-height:100%;
width: 100%; width: 100%;
position: relative; position: relative;
overflow: hidden; overflow: hidden;

6
src/layout/components/Navbar.vue

@ -4,7 +4,7 @@
<breadcrumb class="breadcrumb-container" /> <breadcrumb class="breadcrumb-container" />
<div class="right-menu"> <!-- <div class="right-menu">
<el-dropdown class="avatar-container" trigger="click"> <el-dropdown class="avatar-container" trigger="click">
<div class="avatar-wrapper"> <div class="avatar-wrapper">
<img :src="avatar+'?imageView2/1/w/80/h/80'" class="user-avatar"> <img :src="avatar+'?imageView2/1/w/80/h/80'" class="user-avatar">
@ -21,7 +21,7 @@
</el-dropdown-item> </el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
</div> </div> -->
</div> </div>
</template> </template>
@ -46,7 +46,7 @@ export default {
this.$store.dispatch('app/toggleSideBar') this.$store.dispatch('app/toggleSideBar')
}, },
async logout() { async logout() {
await this.$store.dispatch('user/logout') //await this.$store.dispatch('user/logout')
this.$router.push(`/login?redirect=${this.$route.fullPath}`) this.$router.push(`/login?redirect=${this.$route.fullPath}`)
} }
} }

1
src/layout/components/Sidebar/Link.vue

@ -20,6 +20,7 @@ export default {
}, },
type() { type() {
if (this.isExternal) { if (this.isExternal) {
//console.log(this.isExternal);
return 'a' return 'a'
} }
return 'router-link' return 'router-link'

4
src/layout/components/Sidebar/Logo.vue

@ -24,8 +24,8 @@ export default {
}, },
data() { data() {
return { return {
title: 'Vue Admin Template', title: '嘉洛马',
logo: 'https://wpimg.wallstcn.com/69a1c46c-eb1c-4b46-8bd4-e9e686ef5251.png' logo: 'https://static.jialuoma.cn/img/logo_jialuoma.png'
} }
} }
} }

42
src/layout/components/Sidebar/SidebarItem.vue

@ -1,5 +1,6 @@
<template> <template>
<div v-if="!item.hidden"> <div v-if="!item.hidden">
<!-- <template v-if="hasOneShowingChild(item.children,item) && (!onlyOneChild.children||onlyOneChild.noShowingChildren)&&!item.alwaysShow"> -->
<template v-if="hasOneShowingChild(item.children,item) && (!onlyOneChild.children||onlyOneChild.noShowingChildren)&&!item.alwaysShow"> <template v-if="hasOneShowingChild(item.children,item) && (!onlyOneChild.children||onlyOneChild.noShowingChildren)&&!item.alwaysShow">
<app-link v-if="onlyOneChild.meta" :to="resolvePath(onlyOneChild.path)"> <app-link v-if="onlyOneChild.meta" :to="resolvePath(onlyOneChild.path)">
<el-menu-item :index="resolvePath(onlyOneChild.path)" :class="{'submenu-title-noDropdown':!isNest}"> <el-menu-item :index="resolvePath(onlyOneChild.path)" :class="{'submenu-title-noDropdown':!isNest}">
@ -8,7 +9,9 @@
</app-link> </app-link>
</template> </template>
<el-submenu v-else ref="subMenu" :index="resolvePath(item.path)" popper-append-to-body> <template v-else>
<a class="el_submenu_link" :index="resolvePath(item.path)" v-if="item.class && item.class == 'file'" :href="'#'+resolvePath(item.path)"></a>
<el-submenu ref="subMenu" :index="resolvePath(item.path)" popper-append-to-body>
<template slot="title"> <template slot="title">
<item v-if="item.meta" :icon="item.meta && item.meta.icon" :title="item.meta.title" /> <item v-if="item.meta" :icon="item.meta && item.meta.icon" :title="item.meta.title" />
</template> </template>
@ -21,6 +24,35 @@
class="nest-menu" class="nest-menu"
/> />
</el-submenu> </el-submenu>
<!-- <a v-if="item.class && item.class == 'file'" :href="'#'+resolvePath(item.path)" >
<el-submenu ref="subMenu" :index="resolvePath(item.path)" popper-append-to-body>
<template slot="title">
<item v-if="item.meta" :icon="item.meta && item.meta.icon" :title="item.meta.title" />
</template>
<sidebar-item
v-for="child in item.children"
:key="child.path"
:is-nest="true"
:item="child"
:base-path="resolvePath(child.path)"
class="nest-menu"
/>
</el-submenu>
</a>
<el-submenu v-else ref="subMenu" :index="resolvePath(item.path)" popper-append-to-body>
<template slot="title">
<item v-if="item.meta" :icon="item.meta && item.meta.icon" :title="item.meta.title" />
</template>
<sidebar-item
v-for="child in item.children"
:key="child.path"
:is-nest="true"
:item="child"
:base-path="resolvePath(child.path)"
class="nest-menu"
/>
</el-submenu> -->
</template >
</div> </div>
</template> </template>
@ -30,7 +62,6 @@ import { isExternal } from '@/utils/validate'
import Item from './Item' import Item from './Item'
import AppLink from './Link' import AppLink from './Link'
import FixiOSBug from './FixiOSBug' import FixiOSBug from './FixiOSBug'
export default { export default {
name: 'SidebarItem', name: 'SidebarItem',
components: { Item, AppLink }, components: { Item, AppLink },
@ -50,6 +81,8 @@ export default {
default: '' default: ''
} }
}, },
// mounted: function () {
// },
data() { data() {
// To fix https://github.com/PanJiaChen/vue-admin-template/issues/237 // To fix https://github.com/PanJiaChen/vue-admin-template/issues/237
// TODO: refactor with render function // TODO: refactor with render function
@ -82,12 +115,17 @@ export default {
return false return false
}, },
resolvePath(routePath) { resolvePath(routePath) {
if (isExternal(routePath)) { if (isExternal(routePath)) {
return routePath return routePath
} }
//console.log(this.basePath);
//console.log(routePath);
if (isExternal(this.basePath)) { if (isExternal(this.basePath)) {
//console.log(this.basePath);
return this.basePath return this.basePath
} }
return path.resolve(this.basePath, routePath) return path.resolve(this.basePath, routePath)
} }
} }

93
src/layout/components/Sidebar/index.vue

@ -15,30 +15,61 @@
<sidebar-item v-for="route in routes" :key="route.path" :item="route" :base-path="route.path" /> <sidebar-item v-for="route in routes" :key="route.path" :item="route" :base-path="route.path" />
</el-menu> </el-menu>
</el-scrollbar> </el-scrollbar>
</div> </div>
</template> </template>
<script> <script>
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import EventBus from '@/utils/EventBus.js'
import Logo from './Logo' import Logo from './Logo'
import SidebarItem from './SidebarItem' import SidebarItem from './SidebarItem'
import variables from '@/styles/variables.scss' import variables from '@/styles/variables.scss'
import menusdata from './leftMenusData.js'
import { mirlist } from '@/api/user'
//console.log(menusdata);
export default { export default {
components: { SidebarItem, Logo }, components: { SidebarItem, Logo },
created: function () {
this.getmunusdata();
},
mounted() {
EventBus.$on('mkdirSuccess', this.getmunusdata)
//console.log(this.$root);
},
data() {
return {
routes:menusdata
}
},
computed: { computed: {
...mapGetters([ ...mapGetters([
'sidebar' 'sidebar'
]), ]),
routes() { // routes() {
return this.$router.options.routes // return this.$router.options.routes
}, // },
// index
activeMenu() { activeMenu() {
const route = this.$route const route = this.$route
const { meta, path } = route const { meta, path } = route
const menusindex = window.location.href
//console.log(1);
// path
if (menusindex.indexOf('?id') != -1) {
return menusindex.split('/#')[1]
}
// if set path, the sidebar will highlight the path you set // if set path, the sidebar will highlight the path you set
if (meta.activeMenu) { if (meta.activeMenu) {
return meta.activeMenu return meta.activeMenu //
} }
return path return path
}, },
@ -51,6 +82,60 @@ export default {
isCollapse() { isCollapse() {
return !this.sidebar.opened return !this.sidebar.opened
} }
},
methods: {
SplicingMenuTree(menus) {
let newMenu = null, arrMenus = [];
menus.forEach(item => {
//console.log(menusdata[0]);
// if (!this.menusdata.children) {
// this.$set(this.menusdata,'children', [])
// //menusdata[0].children = []
// }
newMenu = {
path: '/filemange/subfile?id='+item.id,
meta: { title: item.directory },
class: 'file',
children:[]
}
if (item.directories && item.directories.length > 0) {
newMenu.children = this.SplicingMenuTree(item.directories)
}
arrMenus.push(newMenu);
});
return arrMenus;
},
getmunusdata() {
let thiss = this;
//console.log(1);
// console.log(this.$store);
mirlist().then(response => {
let datamain = response.data;
this.routes[1].children = this.SplicingMenuTree(datamain.data.menus);
//console.log();
let dirTree = datamain.data.dirTree;
if (dirTree.id) {
//this.$router.push({path: '/filemange/subfile?id='+dirTree.id});
}
}).catch(function (error) {
if (error.response) {
if (error.response.status == 401) {
thiss.$message({showClose: true,message: error.response.data.err,type: 'error'});
thiss.$router.push({path: '/login'});
return;
}
thiss.$message({showClose: true,message: error.response.data.err,type: 'error'});
} else if (error.request) {
thiss.$message({showClose: true,message: error.response.data.err,type: 'error'});
} else {
thiss.$message({showClose: true,message: error.response.data.err,type: 'error'});
}
});
}
} }
} }
</script> </script>

74
src/layout/components/Sidebar/leftMenusData.js

@ -0,0 +1,74 @@
// 菜单栏生成
var menusdata = [
// {
// id: '0',
// path: '/filemange',
// meta: { title: '文件管理', icon: 'dashboard' },
// children: [
// {
// path: '/filemange/subfile?id=0',
// meta: { title: 'Menu1-1' }
// },
// {
// path: '/filemange/subfile',
// meta: { title: 'Menu1-2' },
// children: [
// {
// path: '/filemange/subfile?id=1',
// meta: { title: 'Menu1-2-1' }
// },
// {
// path: '/filemange/subfile',
// meta: { title: 'Menu1-2-2' }
// }
// ]
// }
// ]
// },
{
id: '0',
path: '/homepage',
meta: { title: '首页', icon: 'dashboard' },
children:[]
},
{
id: '1',
path: '/filemange/index',
class: 'file',
meta: { title: '文件管理', icon: 'el-icon-s-help' },
children:[]
},
{
path: '/usermange/index',
meta: { title: '用户管理', icon: 'form' }
},
{
path: '/systme',
meta: { title: '系统管理', icon: 'dashboard' },
children: [
{
path: 'changepass',
meta: { title: '修改密码', icon: 'table' }
},
{
path: 'userrelated',
meta: { title: '用户相关', icon: 'tree' }
},
{
path: 'switchtheme',
meta: { title: '皮肤更换', icon: 'tree' }
}
]
},
{
path: 'https://dev.filesite.io',
meta: { title: '前端展示页面', icon: 'link' }
}
]
export default menusdata

22
src/layout/index.vue

@ -1,5 +1,22 @@
<template> <template>
<div :class="classObj" class="app-wrapper"> <div :class="classObj" class="app-wrapper">
<div class="toptitle clearfix">
<a class="leftk" href="javascript:;">
<img src="../common/img/jialuoma.png" alt="图片">
<em class="erectline"></em>
<span>后台管理系统</span>
</a>
<div class="rightk tpriht">
<a id="dLabel" href="javascript:;" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
<img class="mailtp verMiddle" src="../common/img/jialuoma.png" alt="图片">
<span class="verMiddle glyphicon glyphicon-menu-down"></span>
</a>
<em class="erectline"></em>
<!-- <a class="Cache tuichu" href="/admin.php/Cache/index.html">清除缓存</a> -->
<!-- <el-button class="quit" @click="dengchu" id="tuichu" size="mini" round>退出</el-button> -->
</div>
</div>
<div class="content_main">
<div v-if="device==='mobile'&&sidebar.opened" class="drawer-bg" @click="handleClickOutside" /> <div v-if="device==='mobile'&&sidebar.opened" class="drawer-bg" @click="handleClickOutside" />
<sidebar class="sidebar-container" /> <sidebar class="sidebar-container" />
<div class="main-container"> <div class="main-container">
@ -9,6 +26,7 @@
<app-main /> <app-main />
</div> </div>
</div> </div>
</div>
</template> </template>
<script> <script>
@ -42,6 +60,7 @@ export default {
} }
} }
}, },
methods: { methods: {
handleClickOutside() { handleClickOutside() {
this.$store.dispatch('app/closeSideBar', { withoutAnimation: false }) this.$store.dispatch('app/closeSideBar', { withoutAnimation: false })
@ -53,6 +72,7 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
@import "~@/styles/mixin.scss"; @import "~@/styles/mixin.scss";
@import "~@/styles/variables.scss"; @import "~@/styles/variables.scss";
@import "~@/styles/publics.scss";
.app-wrapper { .app-wrapper {
@include clearfix; @include clearfix;
@ -90,4 +110,6 @@ export default {
.mobile .fixed-header { .mobile .fixed-header {
width: 100%; width: 100%;
} }
.content_main{padding-top:91px;}
</style> </style>

12
src/main.js

@ -1,6 +1,6 @@
import Vue from 'vue' import Vue from 'vue'
import 'normalize.css/normalize.css' // A modern alternative to CSS resets //import 'normalize.css/normalize.css' // A modern alternative to CSS resets
import ElementUI from 'element-ui' import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css' import 'element-ui/lib/theme-chalk/index.css'
@ -13,7 +13,7 @@ import store from './store'
import router from './router' import router from './router'
import '@/icons' // icon import '@/icons' // icon
import '@/permission' // permission control如果 import '@/permission' // 权限处理
/** /**
* If you don't want to use mock-server * If you don't want to use mock-server
@ -23,10 +23,10 @@ import '@/permission' // permission control如果
* Currently MockJs will be used in the production environment, * Currently MockJs will be used in the production environment,
* please remove it before going online ! ! ! * please remove it before going online ! ! !
*/ */
if (process.env.NODE_ENV === 'production') { // if (process.env.NODE_ENV === 'production') {
const { mockXHR } = require('../mock') // const { mockXHR } = require('../mock')
mockXHR() // mockXHR()
} // }
// set ElementUI lang to EN // set ElementUI lang to EN
//Vue.use(ElementUI, { locale }) //Vue.use(ElementUI, { locale })

5
src/peizhi.js

@ -0,0 +1,5 @@
let peizhi = {
dizhi: 'http://192.168.0.100'
}
export default peizhi

75
src/permission.js

@ -10,55 +10,56 @@ NProgress.configure({ showSpinner: false }) // NProgress Configuration
const whiteList = ['/login'] // no redirect whitelist const whiteList = ['/login'] // no redirect whitelist
router.beforeEach(async(to, from, next) => { router.beforeEach(async(to, from, next) => {
// start progress bar // start progress bar
NProgress.start() NProgress.start()
// set page title // set page title
document.title = getPageTitle(to.meta.title) document.title = getPageTitle(to.meta.title)
next()
// determine whether the user has logged in // determine whether the user has logged in
const hasToken = getToken() // const hasToken = getToken()
if (hasToken) { // if (hasToken) {
if (to.path === '/login') { // if (to.path === '/login') {
// if is logged in, redirect to the home page // // if is logged in, redirect to the home page
next({ path: '/' }) // next({ path: '/' })
NProgress.done() // NProgress.done()
} else { // } else {
const hasGetUserInfo = store.getters.name // const hasGetUserInfo = store.getters.name
if (hasGetUserInfo) { // if (hasGetUserInfo) {
next() // next()
} else { // } else {
try { // try {
// get user info // // get user info
await store.dispatch('user/getInfo') // await store.dispatch('user/getInfo')
next() // next()
} catch (error) { // } catch (error) {
// remove token and go to login page to re-login // // remove token and go to login page to re-login
await store.dispatch('user/resetToken') // await store.dispatch('user/resetToken')
Message.error(error || 'Has Error') // Message.error(error || 'Has Error')
next(`/login?redirect=${to.path}`) // next(`/login?redirect=${to.path}`)
NProgress.done() // NProgress.done()
} // }
} // }
} // }
} else { // } else {
/* has no token*/ // /* has no token*/
if (whiteList.indexOf(to.path) !== -1) { // if (whiteList.indexOf(to.path) !== -1) {
// in the free login whitelist, go directly // // in the free login whitelist, go directly
next() // next()
} else { // } else {
// other pages that do not have permission to access are redirected to the login page. // // other pages that do not have permission to access are redirected to the login page.
next(`/login?redirect=${to.path}`) // next(`/login?redirect=${to.path}`)
NProgress.done() // NProgress.done()
} // }
} // }
}) })
router.afterEach(() => { router.afterEach(() => {
// finish progress bar // finish progress bar
NProgress.done() NProgress.done() // 释放钩子
}) })

169
src/router/index.js

@ -30,6 +30,7 @@ import Layout from '@/layout'
* all roles can be accessed * all roles can be accessed
*/ */
export const constantRoutes = [ export const constantRoutes = [
{ {
path: '/login', path: '/login',
@ -45,50 +46,47 @@ export const constantRoutes = [
{ {
path: '/', path: '/',
component: Layout, component: Layout,
redirect: '/filemange', redirect: '/homepage',
children: [{ children: [{
path: 'filemange', path: 'homepage',
name: 'Homepage',
component: () => import('@/views/homepage/index'),
meta: { title: '首页', icon: 'dashboard' }
}]
},
{
path: '/filemange',
component: Layout,
redirect: '/filemange/index',
meta: { title: '文件管理', icon: 'el-icon-s-help' },
children: [
{
path: 'index',
name: 'Filemange', name: 'Filemange',
component: () => import('@/views/filemange/index'), component: () => import('@/views/filemange/index'),
meta: { title: '文件管理', icon: 'dashboard' } meta: { title: '', icon: 'dashboard' }
}]
}, },
{ {
path: '', path: 'subfile',
name: 'Subfile',
component: () => import('@/views/subfile/index'),
meta: { title: '子文件', icon: 'dashboard' }
}
]
},
{
path: '/usermange',
component: Layout, component: Layout,
redirect: '/usermange', name: 'usermange',
children: [{ children: [
path: 'usermange', {
path: 'index',
name: 'Usermange', name: 'Usermange',
component: () => import('@/views/usermanage/index'), component: () => import('@/views/usermanage/index'),
meta: { title: '用户管理', icon: 'dashboard' } meta: { title: '用户管理', icon: 'form' }
}] }
]
}, },
// {
// path: '/',
// component: Layout,
// redirect: '/filemange', // 重定向地址
// children: [{
// path: 'filemange',
// name: 'filemange',
// component: () => import('@/views/dashboard/index?a=1'),
// meta: { title: '文件管理', icon: 'dashboard' }
// }]
// },
// {
// path: '/',
// component: Layout,
// redirect: '/usermange',
// children: [{
// path: 'usermange',
// name: 'usermange',
// component: () => import('@/views/dashboard/index?a=2'),
// meta: { title: '用户管理', icon: 'dashboard' }
// }]
// },
{ {
path: '/systme', path: '/systme',
component: Layout, component: Layout,
@ -107,106 +105,23 @@ export const constantRoutes = [
name: 'userrelated', name: 'userrelated',
component: () => import('@/views/systme/userrelated'), component: () => import('@/views/systme/userrelated'),
meta: { title: '用户相关', icon: 'tree' } meta: { title: '用户相关', icon: 'tree' }
},
{
path: 'switchtheme',
name: 'Switchtheme',
component: () => import('@/views/systme/switchtheme'),
meta: { title: '皮肤更换', icon: 'tree' }
} }
] ]
}, },
// {
// path: '/form',
// component: Layout,
// children: [
// {
// path: 'index',
// name: 'Form',
// component: () => import('@/views/form/index'),
// meta: { title: 'Form', icon: 'form' }
// }
// ]
// },
// {
// path: '/nested',
// component: Layout,
// redirect: '/nested/menu1',
// name: 'Nested',
// meta: {
// title: 'Nested',
// icon: 'nested'
// },
// children: [
// {
// path: 'menu1',
// component: () => import('@/views/nested/menu1/index'), // Parent router-view
// name: 'Menu1',
// meta: { title: 'Menu1' },
// children: [
// {
// path: 'menu1-1',
// component: () => import('@/views/nested/menu1/menu1-1'),
// name: 'Menu1-1',
// meta: { title: 'Menu1-1' }
// },
// {
// path: 'menu1-2',
// component: () => import('@/views/nested/menu1/menu1-2'),
// name: 'Menu1-2',
// meta: { title: 'Menu1-2' },
// children: [
// {
// path: 'menu1-2-1',
// component: () => import('@/views/nested/menu1/menu1-2/menu1-2-1'),
// name: 'Menu1-2-1',
// meta: { title: 'Menu1-2-1' }
// },
// {
// path: 'menu1-2-2',
// component: () => import('@/views/nested/menu1/menu1-2/menu1-2-2'),
// name: 'Menu1-2-2',
// meta: { title: 'Menu1-2-2' }
// },
// {
// path: 'menu1-2-3',
// component: () => import('@/views/nested/menu1/menu1-2/menu1-2-2'),
// name: 'jiamaluo',
// meta: { title: 'jialmal' }
// }
// ]
// },
// {
// path: 'menu1-3',
// component: () => import('@/views/nested/menu1/menu1-3'),
// name: 'Menu1-3',
// meta: { title: 'Menu1-3' }
// }
// ]
// },
// {
// path: 'menu2',
// component: () => import('@/views/nested/menu2/index'),
// name: 'Menu2',
// meta: { title: 'menu2' }
// }
// ]
// },
// {
// path: 'external-link',
// component: Layout,
// children: [
// {
// path: 'https://panjiachen.github.io/vue-element-admin-site/#/',
// meta: { title: 'External Link', icon: 'link' }
// }
// ]
// },
// 404 page must be placed at the end !!!
{ path: '*', redirect: '/404', hidden: true } { path: '*', redirect: '/404', hidden: true }
// 404 page must be placed at the end !!!
] ]
const createRouter = () => new Router({ const createRouter = () => new Router({
// mode: 'history', // require service support //mode: 'history', // require service supportmode: 'history',
scrollBehavior: () => ({ y: 0 }), scrollBehavior: () => ({ y: 0 }),
routes: constantRoutes routes: constantRoutes
}) })

3
src/settings.js

@ -1,6 +1,7 @@
module.exports = { module.exports = {
title: 'Vue Admin Template', title: '嘉洛马',
address: 'http://192.168.0.100',
/** /**
* @type {boolean} true | false * @type {boolean} true | false

2
src/styles/element-ui.scss

@ -47,3 +47,5 @@
.el-range-separator { .el-range-separator {
box-sizing: content-box; box-sizing: content-box;
} }
.el-submenu__title i{color:#FFF;}

14
src/styles/index.scss

@ -4,13 +4,13 @@
@import './element-ui.scss'; @import './element-ui.scss';
@import './sidebar.scss'; @import './sidebar.scss';
body { // body {
height: 100%; // height: 100%;
-moz-osx-font-smoothing: grayscale; // -moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased; // -webkit-font-smoothing: antialiased;
text-rendering: optimizeLegibility; // text-rendering: optimizeLegibility;
font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif; // font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif;
} // }
label { label {
font-weight: 700; font-weight: 700;

49
src/styles/publics.scss

@ -0,0 +1,49 @@
.toptitle {
color: #FFF;
height: 91px;
padding: 0 6% 0 36px;
z-index: 1002;
background-color: #2b3245;
position: fixed;
top: 0;
left: 0;
right: 0;
overflow:hidden;
}
.toptitle .leftk {
float: left;
margin-top: 16px;
height:60px;
}
.toptitle .leftk>img {
vertical-align: middle;
display:inline-block;
max-width: 100%;
height:100%;
background-color:#FFF;
border-radius:50%;
}
.toptitle .leftk>i {
vertical-align: middle;
color: #FFF;
font-size: 30px;
margin: 6px 0 0 15px;
}
.toptitle .rightk {
float: right;
margin-top: 24px;
position: relative;
}
.toptitle .erectline {
margin: 0 18px;
display: inline-block;
vertical-align: middle;
height: 40px;
width: 1px;
background-color: #414758;
}

21
src/styles/sidebar.scss

@ -14,12 +14,16 @@
height: 100%; height: 100%;
position: fixed; position: fixed;
font-size: 0px; font-size: 0px;
top: 0; top: 91px;
bottom: 0; bottom: 0;
left: 0; left: 0;
z-index: 1001; z-index: 1888;
overflow: hidden; overflow: hidden;
.el_submenu_link{width:76%;height:56px;z-index:100;position:absolute;left:0;top:0;bottom:0;right:10%;}
.el_submenu_link:hover{background-color:rgba(0, 0, 0, 0.3);}
// reset element-ui css // reset element-ui css
.horizontal-collapse-transition { .horizontal-collapse-transition {
transition: 0s width ease-in-out, 0s padding-left ease-in-out, 0s padding-right ease-in-out; transition: 0s width ease-in-out, 0s padding-left ease-in-out, 0s padding-right ease-in-out;
@ -67,14 +71,15 @@
height: 100%; height: 100%;
width: 100% !important; width: 100% !important;
} }
.el-menu>div{position:relative;}
// menu hover // menu hover
.submenu-title-noDropdown, // .submenu-title-noDropdown,
.el-submenu__title { // .el-submenu__title {
&:hover { // &:hover {
background-color: $menuHover !important; // background-color: $menuHover !important;
} // }
} // }
.is-active>.el-submenu__title { .is-active>.el-submenu__title {
color: $subMenuActiveText !important; color: $subMenuActiveText !important;

2
src/styles/variables.scss

@ -3,7 +3,7 @@ $menuText:#bfcbd9;
$menuActiveText:#409EFF; $menuActiveText:#409EFF;
$subMenuActiveText:#f4f4f5; //https://github.com/ElemeFE/element/issues/12951 $subMenuActiveText:#f4f4f5; //https://github.com/ElemeFE/element/issues/12951
$menuBg:#304156; $menuBg:#2b3245;
$menuHover:#263445; $menuHover:#263445;
$subMenuBg:#1f2d3d; $subMenuBg:#1f2d3d;

5
src/utils/EventBus.js

@ -0,0 +1,5 @@
import Vue from 'vue' // 引入vue
const EventBus = new Vue() // 创建实例
export default EventBus // 导出

2
src/utils/auth.js

@ -1,6 +1,6 @@
import Cookies from 'js-cookie' import Cookies from 'js-cookie'
const TokenKey = 'vue_admin_template_token' const TokenKey = 'jialuoma_token'
export function getToken() { export function getToken() {
return Cookies.get(TokenKey) return Cookies.get(TokenKey)

2
src/utils/get-page-title.js

@ -1,6 +1,6 @@
import defaultSettings from '@/settings' import defaultSettings from '@/settings'
const title = defaultSettings.title || 'Vue Admin Template' const title = defaultSettings.title || '嘉洛马'
export default function getPageTitle(pageTitle) { export default function getPageTitle(pageTitle) {
if (pageTitle) { if (pageTitle) {

4
src/utils/index.js

@ -1,6 +1,4 @@
/**
* Created by PanJiaChen on 16/11/18.
*/
/** /**
* Parse the time to string * Parse the time to string

146
src/utils/request.js

@ -1,85 +1,91 @@
import axios from 'axios' import axios from 'axios'
import { MessageBox, Message } from 'element-ui' //import { MessageBox, Message } from 'element-ui'
import store from '@/store' //import store from '@/store'
import { getToken } from '@/utils/auth' //import { getToken } from '@/utils/auth'
// create an axios instance // create an axios instance
const service = axios.create({ const service = axios.create({
baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url //baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url
// withCredentials: true, // send cookies when cross-domain requests // withCredentials: true, // send cookies when cross-domain requests
timeout: 5000 // request timeout headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
// headers: { 'Content-Type': 'multipart/form-data' },
// headers: {
// 'Content-Type': 'application/x-www-form-urlencoded'
// },
timeout: 0 // request timeout
}) })
//service.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
// request interceptor // request interceptor
service.interceptors.request.use( // service.interceptors.request.use(
config => { // config => {
// do something before request is sent // // do something before request is sent
if (store.getters.token) { // if (store.getters.token) {
// let each request carry token // // let each request carry token
// ['X-Token'] is a custom headers key // // ['X-Token'] is a custom headers key
// please modify it according to the actual situation // // please modify it according to the actual situation
config.headers['X-Token'] = getToken() // config.headers['X-Token'] = getToken()
} // }
return config // return config
}, // },
error => { // error => {
// do something with request error // // do something with request error
console.log(error) // for debug // console.log(error) // for debug
return Promise.reject(error) // return Promise.reject(error)
} // }
) // )
// response interceptor // // response interceptor
service.interceptors.response.use( // service.interceptors.response.use(
/** // /**
* If you want to get http information such as headers or status // * If you want to get http information such as headers or status
* Please return response => response // * Please return response => response
*/ // */
/** // /**
* Determine the request status by custom code // * Determine the request status by custom code
* Here is just an example // * Here is just an example
* You can also judge the status by HTTP Status Code // * You can also judge the status by HTTP Status Code
*/ // */
response => { // response => {
const res = response.data // const res = response.data
// if the custom code is not 20000, it is judged as an error. // // if the custom code is not 20000, it is judged as an error.
if (res.code !== 20000) { // if (res.code !== 20000) {
Message({ // Message({
message: res.message || 'Error', // message: res.message || 'Error',
type: 'error', // type: 'error',
duration: 5 * 1000 // duration: 5 * 1000
}) // })
// 50008: Illegal token; 50012: Other clients logged in; 50014: Token expired; // // 50008: Illegal token; 50012: Other clients logged in; 50014: Token expired;
if (res.code === 50008 || res.code === 50012 || res.code === 50014) { // if (res.code === 50008 || res.code === 50012 || res.code === 50014) {
// to re-login // // to re-login
MessageBox.confirm('You have been logged out, you can cancel to stay on this page, or log in again', 'Confirm logout', { // MessageBox.confirm('You have been logged out, you can cancel to stay on this page, or log in again', 'Confirm logout', {
confirmButtonText: 'Re-Login', // confirmButtonText: 'Re-Login',
cancelButtonText: 'Cancel', // cancelButtonText: 'Cancel',
type: 'warning' // type: 'warning'
}).then(() => { // }).then(() => {
store.dispatch('user/resetToken').then(() => { // store.dispatch('user/resetToken').then(() => {
location.reload() // location.reload()
}) // })
}) // })
} // }
return Promise.reject(new Error(res.message || 'Error')) // return Promise.reject(new Error(res.message || 'Error'))
} else { // } else {
return res // return res
} // }
}, // },
error => { // error => {
console.log('err' + error) // for debug // console.log('err' + error) // for debug
Message({ // Message({
message: error.message, // message: error.message,
type: 'error', // type: 'error',
duration: 5 * 1000 // duration: 5 * 1000
}) // })
return Promise.reject(error) // return Promise.reject(error)
} // }
) // )
export default service export default service

28
src/views/dashboard/index.vue

@ -1,28 +0,0 @@
<template>
<div class="dashboard-container">
<div class="dashboard-text">
<el-button type="primary">创建目录</el-button>
</div>
</div>
</template>
<script>
//import { mapGetters } from 'vuex'
export default {
}
</script>
<style lang="scss" scoped>
.dashboard {
&-container {
margin: 30px;
}
&-text {
font-size: 30px;
line-height: 46px;
}
}
</style>

87
src/views/form/index.vue

@ -1,87 +0,0 @@
<template>
<div class="app-container">
<el-form ref="form" :model="form" label-width="120px">
<el-form-item label="Activity name">
<el-input v-model="form.name" />
</el-form-item>
<el-form-item label="Activity zone">
<el-select v-model="form.region" placeholder="please select your zone">
<el-option label="Zone one" value="shanghai" />
<el-option label="Zone two" value="beijing" />
</el-select>
</el-form-item>
<el-form-item label="Activity time">
<el-col :span="11">
<el-date-picker v-model="form.date1" type="date" placeholder="Pick a date" style="width: 100%;" />
</el-col>
<el-col :span="2" class="line">-</el-col>
<el-col :span="11">
<el-time-picker v-model="form.date2" type="fixed-time" placeholder="Pick a time" style="width: 100%;" />
</el-col>
</el-form-item>
<el-form-item label="Instant delivery">
<el-switch v-model="form.delivery" />
</el-form-item>
<el-form-item label="Activity type">
<el-checkbox-group v-model="form.type">
<el-checkbox label="Online activities" name="type" />
<el-checkbox label="Promotion activities" name="type" />
<el-checkbox label="Offline activities" name="type" />
<el-checkbox label="Simple brand exposure" name="type" />
</el-checkbox-group>
</el-form-item>
<el-form-item label="Resources">
<el-radio-group v-model="form.resource">
<el-radio label="Sponsor" />
<el-radio label="Venue" />
</el-radio-group>
</el-form-item>
<el-form-item label="Activity form">
<el-input v-model="form.desc" type="textarea" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit">Create</el-button>
<el-button @click="onCancel">Cancel</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
export default {
data() {
return {
form: {
name: '',
region: '',
date1: '',
date2: '',
delivery: false,
type: [],
resource: '',
desc: ''
}
}
},
methods: {
onSubmit() {
this.$message('submit!')
},
onCancel() {
this.$message({
message: 'cancel!',
type: 'warning'
})
}
}
}
</script>
<style scoped>
.line{
text-align: center;
}
</style>

56
src/views/homepage/index.vue

@ -0,0 +1,56 @@
<template>
<div class="filemange_container">
<div class="mkdirm">
<el-button type="primary" @click="dirbox = true">创建目录</el-button>
</div>
<el-dialog title="创建目录" :visible.sync="dirbox">
<el-form :model="form">
<el-form-item label="目录名称" :label-width="formLabelWidth">
<el-input v-model="form.name" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="父级目录" :label-width="formLabelWidth">
<el-select v-model="form.region" placeholder="请选择父级目录">
<el-option label="区域一" value="shanghai"></el-option>
<el-option label="区域二" value="beijing"></el-option>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dirbox = false"> </el-button>
<el-button type="primary" @click="dirbox = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
//import { mapGetters } from 'vuex'
export default {
data() {
return {
dirbox: false,
form: {
name: '',
region: '',
date1: '',
date2: '',
delivery: false,
type: [],
resource: '',
desc: ''
},
formLabelWidth: '120px'
}
},
methods: {
}
}
</script>
<style lang="scss" scoped>
.mkdirm{text-align:center;margin:20% 0 0 0;}
</style>

173
src/views/login/index.vue

@ -1,5 +1,12 @@
<template> <template>
<div class="login-container"> <div class="login-container">
<div class="toptitle clearfix">
<a class="leftk" href="javascript:;">
<img src="../../common/img/jialuoma.png" alt="图片">
<em class="erectline"></em>
<span>后台管理系统</span>
</a>
</div>
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form" auto-complete="on" label-position="left"> <el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form" auto-complete="on" label-position="left">
<div class="title-container"> <div class="title-container">
@ -40,6 +47,25 @@
<svg-icon :icon-class="passwordType === 'password' ? 'eye' : 'eye-open'" /> <svg-icon :icon-class="passwordType === 'password' ? 'eye' : 'eye-open'" />
</span> </span>
</el-form-item> </el-form-item>
<div class="captcha_k">
<el-form-item prop="captcha">
<span class="svg-container">
<svg-icon icon-class="example" />
</span>
<el-input
ref="captcha"
v-model="loginForm.captcha"
placeholder="验证码"
name="用户名"
type="text"
tabindex="3"
auto-complete="on"
/>
</el-form-item>
<div class="captcha_main" @click="getcaptcha" v-loading="captcha_loading">
<img v-if="!captcha_loading" class="captcha_img" :src="captchaimg" alt="验证码"/>
</div>
</div>
<el-button class="bt_login" :loading="loading" type="primary" @click.native.prevent="handleLogin">登入</el-button> <el-button class="bt_login" :loading="loading" type="primary" @click.native.prevent="handleLogin">登入</el-button>
<el-button class="bt_rest bt_login" @click="resetForm('loginForm')">重置</el-button> <el-button class="bt_rest bt_login" @click="resetForm('loginForm')">重置</el-button>
@ -53,19 +79,141 @@
</template> </template>
<script>
//import { validUsername } from '@/utils/validate'
//import axios from 'axios'
//import { setToken } from '@/utils/auth' // set token from cookie
import { captcha, login } from '@/api/user'
export default {
created: function () {
this.getcaptcha();
},
data() {
const validateUsername = (rule, value, callback) => {
if (value.length < 3) {
callback(new Error('请输入正确的用户名'))
} else {
callback()
}
}
const validatePassword = (rule, value, callback) => {
if (value.length < 6) {
callback(new Error('请输入正确的密码'))
} else {
callback()
}
}
const validateCaptcha = (rule, value, callback) => {
if (value.length < 5) {
callback(new Error('请输入正确的验证码'))
} else {
callback()
}
}
return {
loading: false,
captcha_loading: true, //
passwordType: 'password',
redirect: undefined,
loginForm: {
username: '',
password: '',
captcha: ''
},
captchaimg: '', //
loginRules: {
username: [
{ required: true, trigger: 'blur', validator: validateUsername }
],
password: [{ required: true, trigger: 'blur', validator: validatePassword }],
captcha: [{ required: true, trigger: 'blur', validator: validateCaptcha }]
}
}
},
watch: {
$route: {
handler: function(route) {
this.redirect = route.query && route.query.redirect
},
immediate: true
}
},
methods: {
//
getcaptcha() {
//let thiss = this;
this.captcha_loading = true;
captcha().then(response => {
let datamain = response.data;
this.captchaimg = datamain.data;
this.captcha_loading = false;
//console.log(response);
})
},
showPwd() {
if (this.passwordType === 'password') {
this.passwordType = 'text'
} else {
this.passwordType = 'password'
}
this.$nextTick(() => {
this.$refs.password.focus()
})
},
handleLogin() {
this.$refs.loginForm.validate(valid => {
// console.log(valid);
if (valid) {
this.loading = true
let thiss = this;
login(this.loginForm).then(response => {
let datamain = response.data;
console.log(1111);
if (datamain.code == 0) {
this.loading = false;
this.$message({
showClose: true,
message: datamain.err,
type: 'error'
});
return false;
}
//console.log(response)
this.$router.push({path: '/filemange/index'})
//console.log('6666');
}).catch(function (error) {
thiss.$message({
showClose: true,
message: error,
type: 'error'
});
this.loading = false
});
} else {
console.log('error submit!!')
return false
}
})
},
resetForm(formName) {
this.$refs[formName].resetFields();
}
}
}
</script>
<style lang="scss"> <style lang="scss">
@import "~@/styles/publics.scss";
$bg:#283443; $bg:#283443;
$light_gray:#fff; $light_gray:#fff;
$cursor: #3c3535; $cursor: #3c3535;
// @supports (-webkit-mask: none) and (not (cater-color: $cursor)) {
// .login-container .el-input input {
// color: $cursor;
// }
// }
/* reset element-ui css */ /* reset element-ui css */
//input::placeholder{color:#5a5252 !important;}
.login-container { .login-container {
.el-input { .el-input {
display: inline-block; display: inline-block;
@ -98,7 +246,7 @@ $cursor: #3c3535;
} }
</style> </style>
<style lang="scss" scoped> <style lang="scss">
.login-container { .login-container {
min-height: 100%; min-height: 100%;
@ -112,7 +260,7 @@ $cursor: #3c3535;
position: relative; position: relative;
width: 520px; width: 520px;
max-width: 100%; max-width: 100%;
padding:0 35px 0 35px; padding:0 32px 0 32px;
margin: 160px auto 0 auto; margin: 160px auto 0 auto;
overflow: hidden; overflow: hidden;
} }
@ -158,8 +306,13 @@ $cursor: #3c3535;
cursor: pointer; cursor: pointer;
user-select: none; user-select: none;
} }
.captcha_k{display:flex;}
.captcha_k .captcha_main{width:100px;height:54px;margin: 0 0 0 15px;}
.captcha_k .captcha_img{border-radius:6px;display:block;max-width:100%;height:100%;cursor:pointer;}
.captcha_k>.el-form-item{flex:1;}
} }
</style> </style>
<<<<<<< HEAD
<script> <script>
//import { validUsername } from '@/utils/validate' //import { validUsername } from '@/utils/validate'
@ -261,3 +414,5 @@ export default {
} }
</script> </script>
=======
>>>>>>> b9f48174581e5575baa49552e095a17d28ecf1a8

7
src/views/nested/menu1/index.vue

@ -1,7 +0,0 @@
<template>
<div style="padding:30px;">
<el-alert :closable="false" title="menu 1">
<router-view />
</el-alert>
</div>
</template>

7
src/views/nested/menu1/menu1-1/index.vue

@ -1,7 +0,0 @@
<template>
<div style="padding:30px;">
<el-alert :closable="false" title="menu 1-1" type="success">
<router-view />
</el-alert>
</div>
</template>

7
src/views/nested/menu1/menu1-2/index.vue

@ -1,7 +0,0 @@
<template>
<div style="padding:30px;">
<el-alert :closable="false" title="menu 1-2" type="success">
<router-view />
</el-alert>
</div>
</template>

5
src/views/nested/menu1/menu1-2/menu1-2-1/index.vue

@ -1,5 +0,0 @@
<template functional>
<div style="padding:30px;">
<el-alert :closable="false" title="menu 1-2-1" type="warning" />
</div>
</template>

5
src/views/nested/menu1/menu1-2/menu1-2-2/index.vue

@ -1,5 +0,0 @@
<template functional>
<div style="padding:30px;">
<el-alert :closable="false" title="menu 1-2-2" type="warning" />
</div>
</template>

5
src/views/nested/menu1/menu1-3/index.vue

@ -1,5 +0,0 @@
<template functional>
<div style="padding:30px;">
<el-alert :closable="false" title="menu 1-3" type="success" />
</div>
</template>

5
src/views/nested/menu2/index.vue

@ -1,5 +0,0 @@
<template>
<div style="padding:30px;">
<el-alert :closable="false" title="menu 2" />
</div>
</template>

517
src/views/subfile/index.js

@ -0,0 +1,517 @@
import { mirlist, mkdir, uploadrequest, rmdirs, deletefile, renamefile, movefiledir } from '@/api/user'
export default {
watch: {
// 点击不同目录请求不同接口
$route(to, from) {
this.getFileData();
}
},
// beforeRouteUpdate(to, from, next) {
// alert(0);
// next();
// },
// 实例还没挂载
created() {
this.getFileData();
},
// 实例已经挂载
filters: {
},
data() {
return {
// 按日期查询
// pickerOptions: {
// shortcuts: [{
// text: '最近一周',
// onClick(picker) {
// const end = new Date();
// const start = new Date();
// start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
// picker.$emit('pick', [start, end]);
// }
// }, {
// text: '最近一个月',
// onClick(picker) {
// const end = new Date();
// const start = new Date();
// start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
// picker.$emit('pick', [start, end]);
// }
// }, {
// text: '最近三个月',
// onClick(picker) {
// const end = new Date();
// const start = new Date();
// start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
// picker.$emit('pick', [start, end]);
// }
// }]
// },
// value2: '',
//haveRealpath: 0,
// 当前目录文件数据
tableData: [],
// 当前目录子目录数据
dirdata: [],
// 创建目录弹出框数据
dirbox: false,
dirform: {
dir: '',
parent: ''
},
formLabelWidth: '',
//删除目录数据
rmdirform: {
dir: '',
parent: ''
},
// 删除文件数据
rmfileform: {
file: '',
parent: ''
},
// 重命名文件数据
renamebox: false,
renamefileform: {
from: '',
to: '',
parent: ''
},
// 移动目录或者文件数据
movebox: false,
movefileform: {
from: '',
to: ''
},
subloading: false, //切换目录loading
mkdirloadings: false, //创建目录loading
// 图片上传弹出框数据
uploadDrawer: false,
direction: 'ttb',
// 图片上传相关数据
dialogImageUrl: '',
dialogVisible: false,
disabled: false,
imgUploadData: {
name: '',
file: '',
parent: ''
},
uploadLoad: false
};
},
methods: {
// 图片上传相关函数
handleRemove(file, fileList) {
console.log(fileList);
//this.$refs.upload.clearFiles;
},
handlePictureCardPreview(file) {
this.dialogImageUrl = file.url;
this.dialogVisible = true;
},
handleDownload(file) {
this.$message({
showClose: true,
message: '右键点击或者长按图片自行下载'
});
},
// 超出上传文件个数限制处理函数
fileexceed(files, fileList) {
//this.$message({showClose:true, message:`当前版本限制选择 1 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`, type:'warning'});
this.$message({ showClose: true, message: `当前版本限制上传一个文件`, type: 'warning' });
//this.$message.warning(``);
},
filechange(files, fileList) {
//console.log(files);
const isLt2M = files.size / 1024 / 1024 < 5;
if (!isLt2M) {
this.$message.error('文件大小不能超过 5MB!' + files.name + '已超过,重新选择');
fileList.splice(-1, 1); // 移除错误文件
//window.setTimeout(() => {fileList.splice(-1, 1);}, 3000);
//console.log(fileList);
return;
}
// 获取传给后台的图片参数
this.imgUploadData.name = files.name;
this.getBase64(files.raw).then(res => {
//this.dialogImageUrl = 1;
this.imgUploadData.file = res;
//console.log(res)
})
},
// 获取图片base64
getBase64(file) {
let thiss = this;
return new Promise(function (resolve, reject) {
if (window.FileReader && file) {
let reader = new FileReader();
let imgResult = "";
reader.readAsDataURL(file);
reader.onload = function () {
imgResult = reader.result;
};
reader.onerror = function (error) {
reject(error);
};
reader.onloadend = function () {
resolve(imgResult);
};
} else {
thiss.$message({ showClose: true, message: '获取base64出错', type: 'error' });
}
});
// if (window.FileReader && file) {
// //调用图片读取方法
// var reader = new FileReader();
// //读取图片
// reader.readAsDataURL(file);
// //监听图片读取进度
// reader.onloadend = function(e) {
// //读取成功,拿到base64编码
// let imgBase64 = e.target.result;
// console.log(imgBase64);
// }
// }
},
// 确认上传文件
UploadRequest() {
let thiss = this;
//console.log(file);
this.uploadLoad = true;
uploadrequest(this.imgUploadData).then(response => {
let datamain = response.data;
if (datamain.code == 1) {
console.log(datamain);
this.$message({ showClose: true, message: datamain.msg, type: 'success' });
this.uploadDrawer = false;
this.getFileData();
}
this.uploadLoad = false;
}).catch(error => {
if (error.response) {
thiss.$message({ showClose: true, message: error.response.data.err, type: 'error' });
this.uploadLoad = false;
} else if (error.request) {
thiss.$message({ showClose: true, message: error.response.data.err, type: 'error' });
} else {
thiss.$message({ showClose: true, message: error.response.data.err, type: 'error' });
}
});
},
getFileData() {
let can = {};
const menusindex = window.location.href
if (menusindex.indexOf('?id') != -1) {
//console.log(menusindex.split('?id=')[1]);
can.id = menusindex.split('?id=')[1]
}
let thiss = this;
this.subloading = true;
mirlist(can).then(response => {
let datamain = response.data;
let maindata = datamain.data.dirTree;
if (datamain.code == 1) {
//console.log(maindata.directories.length);
this.dirdata = []
this.tableData = []
if (maindata.directories) {
this.dirdata = this.forObjectData(maindata.directories);
}
if (maindata.files) {
this.tableData = this.forObjectData(maindata.files);
}
//this.haveRealpath = maindata.realpath;
//console.log(this.haveRealpath);
this.dirform.parent = maindata.realpath; //获取当前目录的位置
this.rmdirform.parent = maindata.realpath; //获取当前目录的位置 删除目录
this.rmfileform.parent = maindata.realpath; //获取当前目录的位置 删除文件
this.renamefileform.parent = maindata.realpath; //获取当前目录的位置 删除文件
this.imgUploadData.parent = maindata.realpath; // 上传图片
this.movefileform.from = maindata.realpath; // 移动目录
//console.log(this.movefileform.from);
this.subloading = false;
}
}).catch(error => {
if (error.response) {
thiss.$message({ showClose: true, message: error.response.data.err, type: 'error' });
} else if (error.request) {
thiss.$message({ showClose: true, message: error, type: 'error' });
} else {
thiss.$message({ showClose: true, message: error.message, type: 'error' });
}
this.subloading = false;
});
},
forObjectData(objectd) {
let newObject = null, arrObjs = [];
Object.keys(objectd).forEach(item => {
let names = null;
if (objectd[item].filename) {
names = objectd[item].filename + '.' + objectd[item].extension;
}
newObject = {
date: '2016-05-03',
image: objectd[item].path,
name: names || objectd[item].directory,
id: objectd[item].id,
frealpath: objectd[item].realpath
}
arrObjs.push(newObject);
});
return arrObjs;
//console.log(arrObjs);
},
// 创建目录
mkdirs() {
let thiss = this;
if (!this.dirform.dir) {
thiss.$message({ showClose: true, message: '目录名不能为空', type: 'error' });
return;
}
//console.log(this.dirform);
this.mkdirloadings = true;
mkdir(this.dirform).then(response => {
let datamain = response.data;
if (datamain.code == 1) {
EventBus.$emit('mkdirSuccess'); //触发菜单栏刷新
this.getFileData();
this.dirform.dir = '';
thiss.$message({ showClose: true, message: datamain.msg, type: 'success' });
//this.subloading = false;
}
this.mkdirloadings = false;
this.dirbox = false;
}).catch(error => {
if (error.response) {
thiss.mkdirloadings = false;
thiss.$message({ showClose: true, message: error.response.data.err, type: 'error' });
} else if (error.request) {
thiss.$message({ showClose: true, message: error.response.data.err, type: 'error' });
} else {
thiss.$message({ showClose: true, message: error.response.data.err, type: 'error' });
}
});
},
// 删除目录
rmdirm() {
let thiss = this;
this.subloading = true;
//console.log(this.rmdirform);
rmdirs(this.rmdirform).then(response => {
let datamain = response.data;
let maindata = datamain.data.dirTree;
if (datamain.code == 1) {
EventBus.$emit('mkdirSuccess'); //触发菜单栏刷新
this.getFileData();
thiss.$message({ showClose: true, message: datamain.msg, type: 'success' });
//this.subloading = false;
} else {
thiss.$message({ showClose: true, message: datamain.err, type: 'error' });
}
this.subloading = false;
//this.dirbox = false;
}).catch(error => {
if (error.response) {
thiss.$message({ showClose: true, message: error.response.data.err, type: 'error' });
} else if (error.request) {
thiss.$message({ showClose: true, message: error.response.data.err, type: 'error' });
} else {
thiss.$message({ showClose: true, message: error.response.data.err, type: 'error' });
}
this.subloading = false;
});
},
// 删除文件
rmfile() {
let thiss = this;
this.subloading = true;
//console.log(this.rmfileform);
deletefile(this.rmfileform).then(response => {
let datamain = response.data;
if (datamain.code == 1) {
this.getFileData();
thiss.$message({ showClose: true, message: datamain.msg, type: 'success' });
//this.subloading = false;
} else {
thiss.$message({ showClose: true, message: datamain.err, type: 'error' });
}
this.subloading = false;
//this.dirbox = false;
}).catch(error => {
this.subloading = false;
if (error.response) {
thiss.$message({ showClose: true, message: error.response.data.err, type: 'error' });
} else if (error.request) {
thiss.$message({ showClose: true, message: error.response.data.err, type: 'error' });
} else {
thiss.$message({ showClose: true, message: error.response.data.err, type: 'error' });
}
});
},
// 重命名文件和目录
renameFileDir() {
if (!this.renamefileform.to) {
this.$message({ showClose: true, message: '新名称不能为空', type: 'error' });
return;
}
let thiss = this;
this.subloading = true;
//console.log(this.rmfileform);
renamefile(this.renamefileform).then(response => {
let datamain = response.data;
if (datamain.code == 1) {
this.getFileData();
thiss.$message({ showClose: true, message: datamain.msg, type: 'success' });
//this.subloading = false;
} else {
thiss.$message({ showClose: true, message: datamain.err, type: 'error' });
}
this.subloading = false;
this.renamebox = false;
}).catch(error => {
this.subloading = false;
if (error.response) {
thiss.$message({ showClose: true, message: error.response.data.err, type: 'error' });
} else if (error.request) {
thiss.$message({ showClose: true, message: error.response.data.err, type: 'error' });
} else {
thiss.$message({ showClose: true, message: error.response.data.err, type: 'error' });
}
});
},
// 移动目录或者文件
moveFileDir() {
if (!this.movefileform.to || !this.movefileform.from) {
this.$message({ showClose: true, message: '不能为空', type: 'error' });
return;
}
let thiss = this;
this.subloading = true;
//console.log(this.rmfileform);
movefiledir(this.movefileform).then(response => {
let datamain = response.data;
if (datamain.code == 1) {
this.getFileData();
thiss.$message({ showClose: true, message: datamain.msg, type: 'success' });
//this.subloading = false;
} else {
thiss.$message({ showClose: true, message: datamain.err, type: 'error' });
}
this.subloading = false;
this.movebox = false;
}).catch(error => {
this.subloading = false;
if (error.response) {
thiss.$message({ showClose: true, message: error.response.data.err, type: 'error' });
} else if (error.request) {
thiss.$message({ showClose: true, message: error.response.data.err, type: 'error' });
} else {
thiss.$message({ showClose: true, message: error.response.data.err, type: 'error' });
}
});
},
// table块事件监听
fileTableMClick(e) {
let dangQian = e.target, labelname = dangQian.tagName.toLowerCase(), chufazhe = e.currentTarget; //currentTarget得到调用当前函数的元素
let getbutton = dangQian, objmark = null;
if (labelname == 'span') {
//console.log(dangQian.parentNode);
getbutton = dangQian.parentNode;
}
objmark = getbutton.getAttribute('mark');
// 点击删除目录
if (objmark == 'dirdelete') {
this.rmdirform.dir = getbutton.getAttribute('filenames');
this.rmdirm();
return;
}
// 点击删除文件
if (objmark == 'filedelete') {
this.rmfileform.file = getbutton.getAttribute('filenames');
this.rmfile();
return;
}
// 点击重命名文件和目录
if (objmark == 'rename') {
this.renamefileform.from = getbutton.getAttribute('filenames');
this.renamefileform.to = '';
this.renamebox = true;
//this.renameFileDir();
return;
}
// 点击移动目录或文件
if (objmark == 'movefiledir') {
//this.movefileform.from = getbutton.getAttribute('filenames');
this.movefileform.to = '';
this.movebox = true;
//this.renameFileDir();
return;
}
//console.log(dangQian);
}
}
}

745
src/views/subfile/index.vue

@ -0,0 +1,745 @@
<template>
<div class="subfile_main" v-loading="subloading" element-loading-text="数据加载中...">
<!-- <div class="block">
<el-date-picker
v-model="value2"
type="daterange"
align="right"
unlink-panels
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
:picker-options="pickerOptions">
</el-date-picker>
<el-button class="sou_bottom" type="primary" icon="el-icon-search">搜索</el-button>
</div> -->
<div>
<!-- 目录数据列表 -->
<!-- <div class="folder_bottom">
<a v-for="data in dirdata" :key="data.id" :href="'#/filemange/subfile?id='+data.id"><el-button type="warning" icon="el-icon-notebook-1">{{data.directory}}</el-button></a>
</div> -->
<div class="use_button textright">
<el-button type="primary" icon="el-icon-edit" @click="dirbox = true">创建目录</el-button>
<!-- <el-button type="primary" icon="el-icon-edit" @click="rmdirm">删除目录</el-button>
<el-button type="primary" icon="el-icon-edit">重命名</el-button> -->
<el-button type="primary" @click="uploadDrawer = true">上传<i class="el-icon-upload el-icon--right"></i></el-button>
</div>
<div v-on:click="fileTableMClick">
<!-- 子目录数据列表 如果不需要显示空数据提示可以用css隐藏-->
<el-table
:data="dirdata"
empty-text="暂无子目录数据"
border
style="width: 100%" class="filesmd">
<!-- <el-table-column
align="center"
prop="date"
label="时间"
width="auto">
</el-table-column> -->
<el-table-column
align="center"
prop="name"
label="名称">
</el-table-column>
<el-table-column
align="center"
label="类型"
width="auto">
<template slot-scope="scope">
<div class="type_file_click">
<a :href="'#/filemange/subfile?id='+scope.row.id">
<!-- <el-button type="warning" icon="el-icon-notebook-1">{{scope.row.name}}</el-button> -->
<img src="../../common/img/file.png" alt="图片"/>
</a>
</div>
</template>
</el-table-column>
<el-table-column
align="center"
label="操作"
width="auto">
<template slot-scope="scope">
<div class="file_caozuo">
<el-button size="mini" :filenames="scope.row.name" mark="rename">重命名</el-button>
<!-- <el-button size="mini">下载</el-button> -->
</div>
<div class="file_caozuo2">
<el-button size="mini" :realpath="scope.row.frealpath" mark="movefiledir">移动</el-button>
<el-button size="mini" mark="dirdelete" :filenames="scope.row.name" type="danger">删除</el-button>
</div>
</template>
</el-table-column>
</el-table>
<!-- 文件数据列表 -->
<el-table
:show-header="false"
empty-text="暂无文件数据"
:data="tableData"
border
style="width: 100%;">
<!-- <el-table-column
align="center"
prop="date"
label="时间"
width="auto">
</el-table-column> -->
<el-table-column
align="center"
prop="name"
label="名称">
</el-table-column>
<el-table-column
align="center"
label="图片"
width="auto">
<template slot-scope="scope">
<img :src="'http://192.168.0.100/'+scope.row.image" alt="图片"/>
</template>
</el-table-column>
<el-table-column
align="center"
label="操作">
<template slot-scope="scope">
<div class="file_caozuo">
<el-button size="mini" :filenames="scope.row.name" mark="rename">重命名</el-button>
<!-- <el-button size="mini">下载</el-button> -->
</div>
<div class="file_caozuo2">
<el-button size="mini" :realpath="scope.row.frealpath" mark="movefiledir">移动</el-button>
<el-button size="mini" mark="filedelete" :filenames="scope.row.name" type="danger">删除</el-button>
</div>
</template>
</el-table-column>
</el-table>
</div>
</div>
<!-- 创建目录弹框 -->
<el-dialog title="创建目录" :visible.sync="dirbox">
<el-form :model="dirform">
<el-form-item label="目录名称" :label-width="formLabelWidth">
<el-input v-model="dirform.dir" autocomplete="off"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dirbox = false"> </el-button>
<el-button type="primary" @click="mkdirs" :loading="mkdirloadings"> </el-button>
</div>
</el-dialog>
<!-- 重新命名弹框 -->
<el-dialog title="重命名" :visible.sync="renamebox">
<el-form :model="renamefileform">
<el-form-item label="新名称" :label-width="formLabelWidth">
<el-input v-model="renamefileform.to" autocomplete="off"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="renamebox = false"> </el-button>
<el-button type="primary" @click="renameFileDir" :loading="mkdirloadings"> </el-button>
</div>
</el-dialog>
<!-- 移动目录弹框 -->
<el-dialog title="目录移动弹出框" :visible.sync="movebox">
<el-form :model="movefileform">
<el-form-item label="当前位置" :label-width="formLabelWidth">
<el-input v-model="movefileform.from" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="目标位置" :label-width="formLabelWidth">
<el-input v-model="movefileform.to" autocomplete="off"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="movebox = false"> </el-button>
<el-button type="primary" @click="moveFileDir" :loading="mkdirloadings"> </el-button>
</div>
</el-dialog>
<el-drawer
title="上传图片"
:visible.sync="uploadDrawer"
:direction="direction"
size="100%"
>
<el-upload
action=""
:limit="1"
list-type="picture-card"
:on-remove="handleRemove"
:on-exceed="fileexceed"
:multiple="true"
:on-change="filechange"
:on-preview="handlePictureCardPreview"
:disabled="false"
accept=".jpg, .jpeg, .png, .gif"
:auto-upload="false">
<i slot="default" class="el-icon-plus"></i>
<span class="addimgtext">添加照片</span>
</el-upload>
<div class="request_main">
<el-button type="success" :loading="uploadLoad" @click="UploadRequest()">开始上传<i class="el-icon-upload el-icon--right"></i></el-button>
</div>
<div class="el-upload__tip">只能上传.jpg, .jpeg, .png, .gif文件且不超过5MB</div>
<el-dialog :modal="false" :visible.sync="dialogVisible">
<img width="100%" :src="dialogImageUrl" alt="图片">
</el-dialog>
</el-drawer>
</div>
</template>
<script>
import EventBus from '@/utils/EventBus.js'
import { mirlist, mkdir, uploadrequest, rmdirs, deletefile, renamefile, movefiledir} from '@/api/user'
//import defaultSettings from '@/settings.js'
export default {
watch: {
//
$route(to, from) {
this.getFileData();
}
},
// beforeRouteUpdate(to, from, next) {
// alert(0);
// next();
// },
//
created() {
this.getFileData();
},
//
filters: {
},
data() {
return {
//
// pickerOptions: {
// shortcuts: [{
// text: '',
// onClick(picker) {
// const end = new Date();
// const start = new Date();
// start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
// picker.$emit('pick', [start, end]);
// }
// }, {
// text: '',
// onClick(picker) {
// const end = new Date();
// const start = new Date();
// start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
// picker.$emit('pick', [start, end]);
// }
// }, {
// text: '',
// onClick(picker) {
// const end = new Date();
// const start = new Date();
// start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
// picker.$emit('pick', [start, end]);
// }
// }]
// },
// value2: '',
//haveRealpath: 0,
//
tableData: [],
//
dirdata: [],
//
dirbox: false,
dirform: {
dir: '',
parent: ''
},
formLabelWidth: '',
//
rmdirform: {
dir: '',
parent: ''
},
//
rmfileform: {
file: '',
parent: ''
},
//
renamebox: false,
renamefileform: {
from: '',
to: '',
parent: ''
},
//
movebox: false,
movefileform: {
from: '',
to: ''
},
subloading: false, //loading
mkdirloadings: false, //loading
//
uploadDrawer: false,
direction: 'ttb',
//
dialogImageUrl: '',
dialogVisible: false,
disabled: false,
imgUploadData: {
name: '',
file: '',
parent: ''
},
uploadLoad: false
};
},
methods: {
//
handleRemove(file, fileList) {
console.log(fileList);
//this.$refs.upload.clearFiles;
},
handlePictureCardPreview(file) {
this.dialogImageUrl = file.url;
this.dialogVisible = true;
},
handleDownload(file) {
this.$message({
showClose: true,
message: '右键点击或者长按图片自行下载'
});
},
//
fileexceed(files, fileList) {
//this.$message({showClose:true, message:` 1 ${files.length} ${files.length + fileList.length} `, type:'warning'});
this.$message({showClose:true, message:`当前版本限制上传一个文件`, type:'warning'});
//this.$message.warning(``);
},
filechange(files, fileList) {
//console.log(files);
const isLt2M = files.size / 1024 / 1024 < 5;
if (!isLt2M) {
this.$message.error('文件大小不能超过 5MB!'+files.name+'已超过,重新选择');
fileList.splice(-1, 1); //
//window.setTimeout(() => {fileList.splice(-1, 1);}, 3000);
//console.log(fileList);
return;
}
//
this.imgUploadData.name = files.name;
this.getBase64(files.raw).then(res => {
//this.dialogImageUrl = 1;
this.imgUploadData.file = res;
//console.log(res)
})
},
// base64
getBase64(file) {
let thiss = this;
return new Promise(function(resolve, reject) {
if (window.FileReader && file) {
let reader = new FileReader();
let imgResult = "";
reader.readAsDataURL(file);
reader.onload = function() {
imgResult = reader.result;
};
reader.onerror = function(error) {
reject(error);
};
reader.onloadend = function() {
resolve(imgResult);
};
} else {
thiss.$message({showClose: true,message: '获取base64出错',type: 'error'});
}
});
// if (window.FileReader && file) {
// //
// var reader = new FileReader();
// //
// reader.readAsDataURL(file);
// //
// reader.onloadend = function(e) {
// //base64
// let imgBase64 = e.target.result;
// console.log(imgBase64);
// }
// }
},
//
UploadRequest() {
let thiss = this;
//console.log(file);
this.uploadLoad = true;
uploadrequest(this.imgUploadData).then(response => {
let datamain = response.data;
if (datamain.code == 1) {
console.log(datamain);
this.$message({showClose: true,message: datamain.msg, type:'success'});
this.uploadDrawer = false;
this.getFileData();
}
this.uploadLoad = false;
}).catch(error => {
if (error.response) {
thiss.$message({showClose: true,message: error.response.data.err,type: 'error'});
this.uploadLoad = false;
} else if (error.request) {
thiss.$message({showClose: true,message: error.response.data.err,type: 'error'});
} else {
thiss.$message({showClose: true,message: error.response.data.err,type: 'error'});
}
});
},
getFileData() {
let can = {};
const menusindex = window.location.href
if (menusindex.indexOf('?id') != -1) {
//console.log(menusindex.split('?id=')[1]);
can.id = menusindex.split('?id=')[1]
}
let thiss = this;
this.subloading = true;
mirlist(can).then(response => {
let datamain = response.data;
let maindata = datamain.data.dirTree;
if (datamain.code == 1) {
//console.log(maindata.directories.length);
this.dirdata = []
this.tableData = []
if (maindata.directories) {
this.dirdata = this.forObjectData(maindata.directories);
}
if (maindata.files) {
this.tableData = this.forObjectData(maindata.files);
}
//this.haveRealpath = maindata.realpath;
//console.log(this.haveRealpath);
this.dirform.parent = maindata.realpath; //
this.rmdirform.parent = maindata.realpath; //
this.rmfileform.parent = maindata.realpath; //
this.renamefileform.parent = maindata.realpath; //
this.imgUploadData.parent = maindata.realpath; //
this.movefileform.from = maindata.realpath; //
//console.log(this.movefileform.from);
this.subloading = false;
}
}).catch(error => {
if (error.response) {
thiss.$message({showClose: true,message: error.response.data.err,type: 'error'});
} else if (error.request) {
thiss.$message({showClose: true,message: error,type: 'error'});
} else {
thiss.$message({showClose: true,message: error.message,type: 'error'});
}
this.subloading = false;
});
},
forObjectData(objectd) {
let newObject = null, arrObjs = [];
Object.keys(objectd).forEach(item => {
let names = null;
if (objectd[item].filename) {
names = objectd[item].filename+'.'+objectd[item].extension;
}
newObject = {
date: '2016-05-03',
image: objectd[item].path,
name: names || objectd[item].directory,
id: objectd[item].id,
frealpath: objectd[item].realpath
}
arrObjs.push(newObject);
});
return arrObjs;
//console.log(arrObjs);
},
//
mkdirs() {
let thiss = this;
if (!this.dirform.dir) {
thiss.$message({showClose: true,message: '目录名不能为空',type: 'error'});
return;
}
//console.log(this.dirform);
this.mkdirloadings = true;
mkdir(this.dirform).then(response => {
let datamain = response.data;
if (datamain.code == 1) {
EventBus.$emit('mkdirSuccess'); //
this.getFileData();
this.dirform.dir = '';
thiss.$message({showClose: true,message: datamain.msg,type: 'success'});
//this.subloading = false;
}
this.mkdirloadings = false;
this.dirbox = false;
}).catch(error => {
if (error.response) {
thiss.mkdirloadings = false;
thiss.$message({showClose: true,message: error.response.data.err,type: 'error'});
} else if (error.request) {
thiss.$message({showClose: true,message: error.response.data.err,type: 'error'});
} else {
thiss.$message({showClose: true,message: error.response.data.err,type: 'error'});
}
});
},
//
rmdirm() {
let thiss = this;
this.subloading = true;
//console.log(this.rmdirform);
rmdirs(this.rmdirform).then(response => {
let datamain = response.data;
let maindata = datamain.data.dirTree;
if (datamain.code == 1) {
EventBus.$emit('mkdirSuccess'); //
this.getFileData();
thiss.$message({showClose: true,message: datamain.msg,type: 'success'});
//this.subloading = false;
} else {
thiss.$message({showClose: true,message: datamain.err,type: 'error'});
}
this.subloading = false;
//this.dirbox = false;
}).catch(error => {
if (error.response) {
thiss.$message({showClose: true,message: error.response.data.err,type: 'error'});
} else if (error.request) {
thiss.$message({showClose: true,message: error.response.data.err,type: 'error'});
} else {
thiss.$message({showClose: true,message: error.response.data.err,type: 'error'});
}
this.subloading = false;
});
},
//
rmfile() {
let thiss = this;
this.subloading = true;
//console.log(this.rmfileform);
deletefile(this.rmfileform).then(response => {
let datamain = response.data;
if (datamain.code == 1) {
this.getFileData();
thiss.$message({showClose: true,message: datamain.msg,type: 'success'});
//this.subloading = false;
} else {
thiss.$message({showClose: true,message: datamain.err,type: 'error'});
}
this.subloading = false;
//this.dirbox = false;
}).catch(error => {
this.subloading = false;
if (error.response) {
thiss.$message({showClose: true,message: error.response.data.err,type: 'error'});
} else if (error.request) {
thiss.$message({showClose: true,message: error.response.data.err,type: 'error'});
} else {
thiss.$message({showClose: true,message: error.response.data.err,type: 'error'});
}
});
},
//
renameFileDir() {
if (!this.renamefileform.to) {
this.$message({showClose: true,message: '新名称不能为空',type: 'error'});
return;
}
let thiss = this;
this.subloading = true;
//console.log(this.rmfileform);
renamefile(this.renamefileform).then(response => {
let datamain = response.data;
if (datamain.code == 1) {
EventBus.$emit('mkdirSuccess'); //
this.getFileData();
thiss.$message({showClose: true,message: datamain.msg,type: 'success'});
//this.subloading = false;
} else {
thiss.$message({showClose: true,message: datamain.err,type: 'error'});
}
this.subloading = false;
this.renamebox = false;
}).catch(error => {
this.subloading = false;
if (error.response) {
thiss.$message({showClose: true,message: error.response.data.err,type: 'error'});
} else if (error.request) {
thiss.$message({showClose: true,message: error.response.data.err,type: 'error'});
} else {
thiss.$message({showClose: true,message: error.response.data.err,type: 'error'});
}
});
},
//
moveFileDir() {
if (!this.movefileform.to || !this.movefileform.from) {
this.$message({showClose: true,message: '不能为空',type: 'error'});
return;
}
let thiss = this;
this.subloading = true;
//console.log(this.rmfileform);
movefiledir(this.movefileform).then(response => {
let datamain = response.data;
if (datamain.code == 1) {
this.getFileData();
thiss.$message({showClose: true,message: datamain.msg,type: 'success'});
//this.subloading = false;
} else {
thiss.$message({showClose: true,message: datamain.err,type: 'error'});
}
this.subloading = false;
this.movebox = false;
}).catch(error => {
this.subloading = false;
if (error.response) {
thiss.$message({showClose: true,message: error.response.data.err,type: 'error'});
} else if (error.request) {
thiss.$message({showClose: true,message: error.response.data.err,type: 'error'});
} else {
thiss.$message({showClose: true,message: error.response.data.err,type: 'error'});
}
});
},
// table
fileTableMClick(e) {
let dangQian = e.target, labelname = dangQian.tagName.toLowerCase(), chufazhe = e.currentTarget; //currentTarget
let getbutton = dangQian, objmark = null;
if (labelname == 'span') {
//console.log(dangQian.parentNode);
getbutton = dangQian.parentNode;
}
objmark = getbutton.getAttribute('mark');
//
if (objmark == 'dirdelete') {
this.rmdirform.dir = getbutton.getAttribute('filenames');
this.rmdirm();
return;
}
//
if (objmark == 'filedelete') {
this.rmfileform.file = getbutton.getAttribute('filenames');
this.rmfile();
return;
}
//
if (objmark == 'rename') {
this.renamefileform.from = getbutton.getAttribute('filenames');
this.renamefileform.to = '';
this.renamebox = true;
//this.renameFileDir();
return;
}
//
if (objmark == 'movefiledir') {
//this.movefileform.from = getbutton.getAttribute('filenames');
this.movefileform.from = getbutton.getAttribute('realpath');
this.movefileform.to = '';
this.movebox = true;
//this.renameFileDir();
return;
}
//console.log(dangQian);
}
}
}
</script>
<style lang="scss">
.subfile_main{
padding:26px 5% 47px 5%;
.block{margin:0 0 28px 0;}
.sou_bottom{margin-left:10px;}
.use_button{margin:15px 0 16px 0;}
// .use_button>button{margin:0 10px 10px 0;}
.file_caozuo2>button{margin-top:6px;}
.el-table td{padding:9px 0}
.folder_bottom a{margin:0 6px;}
.el-table__body-wrapper img{width:100px;height:71px;}
.el-drawer__body{text-align:center;padding:0 10% 20px 10%;}
.request_main{text-align:center;margin:12px 0;}
.addimgtext{line-height:25px;display:inline-block;color:#8c939d;vertical-align: middle;}
.el-upload--picture-card i{vertical-align:middle;}
.type_file_click img{width:64px;height:48px;}
}
</style>

90
src/views/systme/switchtheme.vue

@ -0,0 +1,90 @@
<template>
<div class="seitchtheme_m">
<div>
<span>更换皮肤</span>
<el-select v-model="skinvalue" placeholder="请选择皮肤">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
<div class="Submit1">
<el-button @click="skinSubmit" :loading="skinloading" type="primary">提交</el-button>
</div>
</div>
</div>
</template>
<script>
import { switchthemeApi} from '@/api/user'
export default {
data() {
return {
options: [{
value: 'manual',
label: 'manual'
}, {
value: 'webdirectory',
label: 'webdirectory'
}, {
value: 'googleimage',
label: 'googleimage'
}, {
value: 'videoblog',
label: 'videoblog'
}],
skinvalue: '',
skinloading:false,
themes:{
theme:''
}
}
},
methods: {
skinSubmit() {
let thiss = this;
this.skinloading = true;
this.themes.theme = this.skinvalue;
switchthemeApi(this.themes).then(response => {
let datamain = response.data;
if (datamain.code == 1) {
this.getFileData();
thiss.$message({showClose: true,message: datamain.msg,type: 'success'});
//this.subloading = false;
} else {
thiss.$message({showClose: true,message: datamain.err,type: 'error'});
}
this.skinloading = false;
}).catch(error => {
this.skinloading = false;
if (error.response) {
thiss.$message({showClose: true,message: error.response.data.err,type: 'error'});
} else if (error.request) {
thiss.$message({showClose: true,message: error.response.data.err,type: 'error'});
} else {
thiss.$message({showClose: true,message: error.response.data.err,type: 'error'});
}
});
}
}
}
</script>
<style lang="scss">
.seitchtheme_m{
padding:26px 5% 47px 5%;
.el-select{width:88%}
.Submit1{margin:20px 0;text-align:center;}
}
</style>

79
src/views/table/index.vue

@ -1,79 +0,0 @@
<template>
<div class="app-container">
<el-table
v-loading="listLoading"
:data="list"
element-loading-text="Loading"
border
fit
highlight-current-row
>
<el-table-column align="center" label="ID" width="95">
<template slot-scope="scope">
{{ scope.$index }}
</template>
</el-table-column>
<el-table-column label="Title">
<template slot-scope="scope">
{{ scope.row.title }}
</template>
</el-table-column>
<el-table-column label="Author" width="110" align="center">
<template slot-scope="scope">
<span>{{ scope.row.author }}</span>
</template>
</el-table-column>
<el-table-column label="Pageviews" width="110" align="center">
<template slot-scope="scope">
{{ scope.row.pageviews }}
</template>
</el-table-column>
<el-table-column class-name="status-col" label="Status" width="110" align="center">
<template slot-scope="scope">
<el-tag :type="scope.row.status | statusFilter">{{ scope.row.status }}</el-tag>
</template>
</el-table-column>
<el-table-column align="center" prop="created_at" label="Display_time" width="200">
<template slot-scope="scope">
<i class="el-icon-time" />
<span>{{ scope.row.display_time }}</span>
</template>
</el-table-column>
</el-table>
</div>
</template>
<script>
import { getList } from '@/api/table'
export default {
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'gray',
deleted: 'danger'
}
return statusMap[status]
}
},
data() {
return {
list: null,
listLoading: true
}
},
created() {
this.fetchData()
},
methods: {
fetchData() {
this.listLoading = true
getList().then(response => {
this.list = response.data.items
this.listLoading = false
})
}
}
}
</script>

78
src/views/tree/index.vue

@ -1,78 +0,0 @@
<template>
<div class="app-container">
<el-input v-model="filterText" placeholder="Filter keyword" style="margin-bottom:30px;" />
<el-tree
ref="tree2"
:data="data2"
:props="defaultProps"
:filter-node-method="filterNode"
class="filter-tree"
default-expand-all
/>
</div>
</template>
<script>
export default {
data() {
return {
filterText: '',
data2: [{
id: 1,
label: 'Level one 1',
children: [{
id: 4,
label: 'Level two 1-1',
children: [{
id: 9,
label: 'Level three 1-1-1'
}, {
id: 10,
label: 'Level three 1-1-2'
}]
}]
}, {
id: 2,
label: 'Level one 2',
children: [{
id: 5,
label: 'Level two 2-1'
}, {
id: 6,
label: 'Level two 2-2'
}]
}, {
id: 3,
label: 'Level one 3',
children: [{
id: 7,
label: 'Level two 3-1'
}, {
id: 8,
label: 'Level two 3-2'
}]
}],
defaultProps: {
children: 'children',
label: 'label'
}
}
},
watch: {
filterText(val) {
this.$refs.tree2.filter(val)
}
},
methods: {
filterNode(value, data) {
if (!value) return true
return data.label.indexOf(value) !== -1
}
}
}
</script>

12
src/views/usermanage/index.vue

@ -44,9 +44,11 @@
</template> </template>
<script> <script>
import { getList } from '@/api/table' import { getList } from '@/api/table'
export default { export default {
filters: { filters: {
statusFilter(status) { statusFilter(status) {
const statusMap = { const statusMap = {
@ -64,16 +66,10 @@ export default {
} }
}, },
created() { created() {
this.fetchData()
}, },
methods: { methods: {
fetchData() {
this.listLoading = true
getList().then(response => {
this.list = response.data.items
this.listLoading = false
})
}
} }
} }
</script> </script>

4
vue.config.js

@ -31,17 +31,17 @@ module.exports = {
lintOnSave: false, lintOnSave: false,
productionSourceMap: false, productionSourceMap: false,
devServer: { devServer: {
inline: false,
port: port, port: port,
open: true, open: true,
overlay: { overlay: {
warnings: false, warnings: false,
errors: true errors: true
}, },
inline: false,
//before: require('./mock/mock-server.js'), //before: require('./mock/mock-server.js'),
proxy: { proxy: {
'/api': { '/api': {
target: 'http://192.168.0.100:1080',// 你要请求的后端接口ip+port target: defaultSettings.address,// 你要请求的后端接口ip+port
changeOrigin: true,// 允许跨域,在本地会创建一个虚拟服务端,然后发送请求的数据,并同时接收请求的数据,这样服务端和服务端进行数据的交互就不会有跨域问题 changeOrigin: true,// 允许跨域,在本地会创建一个虚拟服务端,然后发送请求的数据,并同时接收请求的数据,这样服务端和服务端进行数据的交互就不会有跨域问题
ws: true,// 开启webSocket ws: true,// 开启webSocket
pathRewrite: { pathRewrite: {

Loading…
Cancel
Save