控制台前端页面升级

This commit is contained in:
暮光:城中城
2020-12-20 21:59:09 +08:00
parent dfb1e62074
commit a5fcdea2fa
78 changed files with 7664 additions and 8025 deletions

View File

@@ -1,145 +1,156 @@
<template>
<div id="app">
<template v-if="global.fullscreen">
<router-view></router-view>
</template>
<el-container v-else>
<el-aside>
<div style="padding: 10px;height: 100%;box-sizing: border-box;background: #fafafa;">
<el-menu default-active="1-4-1" :router="true" class="el-menu-vertical" @open="handleOpen" @close="handleClose" :collapse="isCollapse">
<el-menu-item index="/"><i class="el-icon-s-home"></i>控制台</el-menu-item>
<el-submenu index="1">
<template slot="title">
<i class="el-icon-s-platform"></i>
<span slot="title">系统管理</span>
</template>
<el-menu-item index="/console/userList"><i class="el-icon-user-solid"></i>用户管理</el-menu-item>
<!-- <el-menu-item index="/console/roleList"><i class="el-icon-s-custom"></i>角色管理</el-menu-item>-->
<!-- <el-menu-item index="/console/authList"><i class="el-icon-s-claim"></i>权限列表</el-menu-item>-->
</el-submenu>
</el-menu>
</div>
</el-aside>
<el-container>
<el-header>
<span class="header-right-user-name">{{userSelfInfo.userName}}</span>
<el-dropdown @command="userSettingDropdown" trigger="click">
<i class="el-icon-setting" style="margin-right: 15px; font-size: 16px;cursor: pointer;color: #fff;"> </i>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="aboutDoc">关于</el-dropdown-item>
<el-dropdown-item command="myInfo" divided>我的资料</el-dropdown-item>
<el-dropdown-item command="userSignOut">退出登录</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-header>
<el-main style="padding: 0;">
<router-view></router-view>
</el-main>
</el-container>
</el-container>
<!--关于弹窗-->
<el-dialog title="关于zyplayer-doc" :visible.sync="aboutDialogVisible" width="600px">
<el-form>
<el-form-item label="项目地址:">
<a target="_blank" href="https://gitee.com/zyplayer/zyplayer-doc">zyplayer-doc</a>
</el-form-item>
<el-form-item label="开发人员:">
<a target="_blank" href="http://zyplayer.com">暮光城中城</a>
</el-form-item>
<template v-if="upgradeInfo.lastVersion">
<el-form-item label="当前版本:">{{upgradeInfo.nowVersion}}</el-form-item>
<el-form-item label="最新版本:">{{upgradeInfo.lastVersion}}</el-form-item>
<el-form-item label="升级地址">
<a target="_blank" :href="upgradeInfo.upgradeUrl">{{upgradeInfo.upgradeUrl}}</a>
</el-form-item>
<el-form-item label="升级内容:">{{upgradeInfo.upgradeContent}}</el-form-item>
</template>
<el-form-item label="">
欢迎加群讨论QQ群号466363173欢迎提交需求欢迎使用和加入开发
</el-form-item>
</el-form>
</el-dialog>
</div>
<div id="app">
<template v-if="fullscreen">
<router-view></router-view>
</template>
<el-container v-else>
<el-aside>
<div style="padding: 10px;height: 100%;box-sizing: border-box;background: #fafafa;">
<el-menu default-active="1-4-1" :router="true" class="el-menu-vertical" @open="handleOpen" @close="handleClose" :collapse="isCollapse">
<el-menu-item index="/"><i class="el-icon-s-home"></i>控制台</el-menu-item>
<el-submenu index="1">
<template slot="title">
<i class="el-icon-s-platform"></i>
<span slot="title">系统管理</span>
</template>
<el-menu-item index="/console/userList"><i class="el-icon-user-solid"></i>用户管理</el-menu-item>
<!-- <el-menu-item index="/console/roleList"><i class="el-icon-s-custom"></i>角色管理</el-menu-item>-->
<!-- <el-menu-item index="/console/authList"><i class="el-icon-s-claim"></i>权限列表</el-menu-item>-->
</el-submenu>
</el-menu>
</div>
</el-aside>
<el-container>
<el-header>
<span class="header-right-user-name">{{userSelfInfo.userName}}</span>
<el-dropdown @command="userSettingDropdown" trigger="click">
<i class="el-icon-setting" style="margin-right: 15px; font-size: 16px;cursor: pointer;color: #fff;"> </i>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="console">控制台</el-dropdown-item>
<el-dropdown-item command="aboutDoc" divided>关于</el-dropdown-item>
<el-dropdown-item command="myInfo">我的资料</el-dropdown-item>
<el-dropdown-item command="userSignOut">退出登录</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-header>
<el-main style="padding: 0;">
<router-view></router-view>
</el-main>
</el-container>
</el-container>
<!--关于弹窗-->
<el-dialog title="关于zyplayer-doc" :visible.sync="aboutDialogVisible" width="600px">
<el-form>
<el-form-item label="项目地址:">
<a target="_blank" href="https://gitee.com/zyplayer/zyplayer-doc">zyplayer-doc</a>
</el-form-item>
<el-form-item label="开发人员:">
<a target="_blank" href="http://zyplayer.com">暮光城中城</a>
</el-form-item>
<template v-if="upgradeInfo.lastVersion">
<el-form-item label="当前版本:">{{upgradeInfo.nowVersion}}</el-form-item>
<el-form-item label="最新版本">{{upgradeInfo.lastVersion}}</el-form-item>
<el-form-item label="升级地址:">
<a target="_blank" :href="upgradeInfo.upgradeUrl">{{upgradeInfo.upgradeUrl}}</a>
</el-form-item>
<el-form-item label="升级内容:">{{upgradeInfo.upgradeContent}}</el-form-item>
</template>
<el-form-item label="">
欢迎加群讨论QQ群号466363173欢迎提交需求欢迎使用和加入开发
</el-form-item>
</el-form>
</el-dialog>
</div>
</template>
<script>
import global from './common/config/global'
import toast from './common/lib/common/toast'
import consoleApi from './common/api/console'
var app;
export default {
data() {
return {
isCollapse: false,
aboutDialogVisible: false,
userSelfInfo: {},
// 升级信息
upgradeInfo: {},
}
},
mounted: function () {
app = this;
global.vue.$app = this;
this.getSelfUserInfo();
this.checkSystemUpgrade();
},
methods: {
handleOpen(key, keyPath) {
console.log(key, keyPath);
},
handleClose(key, keyPath) {
console.log(key, keyPath);
},
userSettingDropdown(command) {
console.log("command:" + command);
if (command == 'userSignOut') {
this.userSignOut();
} else if (command == 'aboutDoc') {
app.aboutDialogVisible = true;
} else if (command == 'myInfo') {
this.$router.push({path: '/user/myInfo'});
} else {
toast.notOpen();
}
},
userSignOut() {
this.common.post(this.apilist1.userLogout, {}, function (json) {
location.reload();
});
},
getSelfUserInfo() {
this.common.post(this.apilist1.getSelfUserInfo, {}, function (json) {
app.userSelfInfo = json.data;
});
},
checkSystemUpgrade() {
this.common.post(this.apilist1.systemUpgradeInfo, {}, function (json) {
if (!!json.data) {
app.upgradeInfo = json.data;
console.log("zyplayer-doc发现新版本"
+ "\n升级地址" + json.data.upgradeUrl
+ "\n当前版本" + json.data.nowVersion
+ "\n最新版本" + json.data.lastVersion
+ "\n升级内容" + json.data.upgradeContent
);
}
});
},
}
}
export default {
data() {
return {
isCollapse: false,
aboutDialogVisible: false,
userSelfInfo: {},
// 升级信息
upgradeInfo: {},
}
},
computed: {
fullscreen () {
return this.$store.state.global.fullscreen;
}
},
mounted: function () {
this.getSelfUserInfo();
this.checkSystemUpgrade();
},
methods: {
handleOpen(key, keyPath) {
console.log(key, keyPath);
},
handleClose(key, keyPath) {
console.log(key, keyPath);
},
userSettingDropdown(command) {
console.log("command:" + command);
if (command == 'userSignOut') {
this.userSignOut();
} else if (command == 'aboutDoc') {
this.aboutDialogVisible = true;
} else if (command == 'myInfo') {
this.$router.push({path: '/user/myInfo'});
} else if (command == 'console') {
window.location = process.env.VUE_APP_BASE_API;
} else {
this.$message.warn("功能暂未开放");
}
},
userSignOut() {
consoleApi.userLogout().then(() => {
location.reload();
}).catch(e => {
console.log("退出登录失败", e);
});
},
getSelfUserInfo() {
consoleApi.getSelfUserInfo().then(json => {
this.userSelfInfo = json.data;
}).catch(e => {
console.log("获取用户信息失败", e);
});
},
checkSystemUpgrade() {
consoleApi.systemUpgradeInfo({}).then(json => {
if (!!json.data) {
this.upgradeInfo = json.data;
console.log("zyplayer-doc发现新版本"
+ "\n升级地址" + json.data.upgradeUrl
+ "\n当前版本" + json.data.nowVersion
+ "\n最新版本" + json.data.lastVersion
+ "\n升级内容" + json.data.upgradeContent
);
}
});
},
}
}
</script>
<style>
html, body {
margin: 0;
padding: 0;
height: 100%;
}
#app, .el-container, .el-menu {
height: 100%;
}
.header-right-user-name{color: #fff;padding-right: 5px;}
.el-menu-vertical{border-right: 0;background: #fafafa;}
.el-menu-vertical .el-menu{background: #fafafa;}
.el-header {background-color: #409EFF; color: #333; line-height: 40px; text-align: right;height: 40px !important;}
html, body {
margin: 0;
padding: 0;
height: 100%;
}
#app, .el-container, .el-menu {
height: 100%;
}
.el-header {
background-color: #1D4E89 !important;
}
.header-right-user-name{color: #fff;padding-right: 5px;}
.el-menu-vertical{border-right: 0;background: #fafafa;}
.el-menu-vertical .el-menu{background: #fafafa;}
.el-header {background-color: #409EFF; color: #333; line-height: 40px; text-align: right;height: 40px !important;}
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 294 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 309 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 KiB

View File

@@ -0,0 +1,35 @@
import Qs from 'qs'
import request from './request'
export default {
systemUpgradeInfo: data => {
return request({url: '/system/info/upgrade', method: 'post', data: Qs.stringify(data)});
},
userLogin: data => {
return request({url: '/login', method: 'post', data: Qs.stringify(data)});
},
userLogout: data => {
return request({url: '/logout', method: 'post', data: Qs.stringify(data)});
},
getSelfUserInfo: data => {
return request({url: '/user/info/selfInfo', method: 'post', data: Qs.stringify(data)});
},
getUserInfoList: data => {
return request({url: '/user/info/list', method: 'post', data: Qs.stringify(data)});
},
updateUserInfo: data => {
return request({url: '/user/info/update', method: 'post', data: Qs.stringify(data)});
},
deleteUserInfo: data => {
return request({url: '/user/info/delete', method: 'post', data: Qs.stringify(data)});
},
userAuthList: data => {
return request({url: '/user/info/auth/list', method: 'post', data: Qs.stringify(data)});
},
updateUserAuth: data => {
return request({url: '/user/info/auth/update', method: 'post', data: Qs.stringify(data)});
},
resetPassword: data => {
return request({url: '/user/info/resetPassword', method: 'post', data: Qs.stringify(data)});
},
};

View File

@@ -0,0 +1,65 @@
import axios from 'axios'
import vue from '../../main'
const service = axios.create({
baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url process.env.APP_BASE_API
timeout: 10000,
headers: {'Content-type': 'application/x-www-form-urlencoded'},
withCredentials: true
});
// 增加不需要验证结果的标记
const noValidate = {
"/zyplayer-doc-db/executor/execute": true,
"/zyplayer-doc-db/datasource/test": true,
};
service.interceptors.request.use(
config => {
config.needValidateResult = true;
// 增加不需要验证结果的标记
if (noValidate[config.url]) {
config.needValidateResult = false;
}
return config
},
error => {
console.log(error);
return Promise.reject(error);
}
);
service.interceptors.response.use(
response => {
if (!!response.message) {
vue.$message.error('请求错误:' + response.message);
}else {
if (!response.config.needValidateResult || response.data.errCode == 200) {
return response.data;
} else if (response.data.errCode == 400) {
vue.$message.error('请先登录');
let redirectUrl = '';
let locationHref = window.location.href;
if (locationHref.indexOf("?") >= 0) {
let reg = new RegExp("(^|&)redirect=([^&]*)(&|$)", "i");
let r = locationHref.substring(locationHref.indexOf("?") + 1).match(reg);
if (r != null) {
redirectUrl = unescape(r[2]);
}
}
redirectUrl = redirectUrl || encodeURIComponent(window.location.href);
vue.$router.push({path: '/user/login', query: {redirect: redirectUrl}});
} else if (response.data.errCode == 402) {
vue.$router.push("/common/noAuth");
} else if (response.data.errCode !== 200) {
vue.$message.error(response.data.errMsg || "未知错误");
}
}
return Promise.reject('请求错误');
},
error => {
console.log('err' + error);
vue.$message.info('请求错误:' + error.message);
return Promise.reject(error)
}
);
export default service;

View File

@@ -1,23 +0,0 @@
var URL = {
userLogin: '/login',
userLogout: '/logout',
getSelfUserInfo: '/user/info/selfInfo',
getUserInfoList: '/user/info/list',
updateUserInfo: '/user/info/update',
deleteUserInfo: '/user/info/delete',
userAuthList: '/user/info/auth/list',
updateUserAuth: '/user/info/auth/update',
resetPassword: '/user/info/resetPassword',
systemUpgradeInfo: '/system/info/upgrade',
};
var URL1 = {};
export default {
URL, URL1
};

View File

@@ -1,52 +0,0 @@
import apilist from './apilist'
var href = window.location.href;
var _fn = {
href: href,
// 本地启动时使用本地接口调试
// HOST: 'http://local.zyplayer.com:8083/zyplayer-doc-manage',
// HOST1: 'http://local.zyplayer.com:8083/zyplayer-doc-manage',
// 也可以直接使用线上的服务调试
// HOST: 'http://doc.zyplayer.com/zyplayer-doc-manage',
// HOST1: 'http://doc.zyplayer.com/zyplayer-doc-manage',
// 打包时使用下面这两行,文件就放在根目录下,所以当前路劲就好
HOST: './',
HOST1: './',
mixUrl: function (host, url) {
var p;
if (!host || !url || _fn.isEmptyObject(url)) {
return;
}
url.HOST = host;
for (p in url) {
if (url[p].indexOf('http') == -1) {
url[p] = host + url[p];
}
}
return url;
},
//判断是否空对象
isEmptyObject: function (obj) { //判断空对象
if (typeof obj === "object" && !(obj instanceof Array)) {
var hasProp = false;
for (var prop in obj) {
hasProp = true;
break;
}
if (hasProp) {
return false;
}
return true;
}
}
};
var apilist1 = _fn.mixUrl(_fn.HOST, apilist.URL);
var apilist2 = _fn.mixUrl(_fn.HOST1, apilist.URL1);
export default {
apilist1, apilist2
};

View File

@@ -1,12 +0,0 @@
const user = {
isLogin: true,
};
const vue = {};
const fullscreen = false;
export default {
vue,
user,
fullscreen,
}

View File

@@ -1,112 +0,0 @@
import Qs from 'qs'
import global from '../../config/global'
import apimix from '../../config/apimix'
export default {
data: {
accessToken: '',
},
setAccessToken: function (token) {
this.data.accessToken = token;
},
getAccessToken: function () {
if (!this.data.accessToken) {
var arr, reg = new RegExp("(^| )accessToken=([^;]*)(;|$)");
if (arr = document.cookie.match(reg)) {
this.data.accessToken = unescape(arr[2]);
}
}
return this.data.accessToken;
},
validateResult: function (res, callback) {
if (!!res.message) {
global.vue.$message('请求错误:' + res.message);
} else if (res.data.errCode == 400) {
var href = encodeURIComponent(window.location.href);
if (global.vue.$router.currentRoute.path != '/user/login') {
global.vue.$message('请先登录');
global.vue.$router.push({path: '/user/login', query: {redirect: href}});
}
} else if (res.data.errCode == 402) {
global.vue.$router.push("/common/noAuth");
} else if (res.data.errCode !== 200) {
global.vue.$message(res.data.errMsg || "未知错误");
} else {
if (typeof callback == 'function') {
callback(res.data);
}
}
},
post: function (url, param, callback) {
param = param || {};
param.accessToken = this.getAccessToken();
global.vue.axios({
method: "post",
url: url,
headers: {'Content-type': 'application/x-www-form-urlencoded'},
data: Qs.stringify(param),
withCredentials: true,
}).then((res) => {
console.log("ok", res);
this.validateResult(res, callback);
}).catch((res) => {
console.log("error", res);
this.validateResult(res);
});
},
postNonCheck: function (url, param, callback) {
param = param || {};
param.accessToken = this.getAccessToken();
global.vue.axios({
method: "post",
url: url,
headers: {'Content-type': 'application/x-www-form-urlencoded'},
data: Qs.stringify(param),
withCredentials: true,
}).then((res) => {
console.log("ok", res);
if (typeof callback == 'function') {
callback(res.data);
}
}).catch((res) => {
console.log("error", res);
if (typeof callback == 'function') {
callback(res.data);
}
});
},
/**
* 返回不为空的字符串为空返回def
*/
getNotEmptyStr(str, def) {
if (isEmpty(str)) {
return isEmpty(def) ? "" : def;
}
return str;
},
/**
* 是否是空对象
* @param obj
* @returns
*/
isEmptyObject(obj) {
return isEmpty(obj) || $.isEmptyObject(obj);
},
/**
* 是否是空字符串
* @param str
* @returns
*/
isEmpty(str) {
return (str == "" || str == null || str == undefined);
},
/**
* 是否不是空字符串
* @param str
* @returns
*/
isNotEmpty(str) {
return !isEmpty(str);
},
}

View File

@@ -1,40 +0,0 @@
import global from '../../config/global'
/**
* 提示工具类
* @author
* @since 2017年5月7日
*/
export default {
notOpen: function () {
global.vue.$message({
message: '该功能暂未开放,敬请期待!',
type: 'warning',
showClose: true
});
},
success: function (msg, time) {
global.vue.$message({
message: msg,
duration: time || 3000,
type: 'success',
showClose: true
});
},
warn: function (msg, time) {
global.vue.$message({
message: msg,
duration: time || 3000,
type: 'warning',
showClose: true
});
},
error: function (msg, time) {
global.vue.$message({
message: msg,
duration: time || 3000,
type: 'error',
showClose: true
});
},
};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,76 @@
<template>
<div>
<el-tabs v-model="activePage" type="card" closable @tab-click="changePage" @tab-remove="removePageTab" style="padding: 5px 10px 0;">
<el-tab-pane :label="pageTabNameMap[item.fullPath]||item.name" :name="item.fullPath" v-for="item in pageList"/>
</el-tabs>
<keep-alive>
<router-view :key="$route.fullPath" @initLoadDataList="initLoadDataList" @loadDatasourceList="loadDatasourceList"/>
</keep-alive>
</div>
</template>
<script>
export default {
name: 'PageTableView',
components: {},
data() {
return {
pageList: [],
linkList: [],
activePage: '',
multiPage: true,
}
},
computed: {
pageTabNameMap () {
return this.$store.state.global.pageTabNameMap;
}
},
created() {
this.pageList.push(this.$route);
this.linkList.push(this.$route.fullPath);
this.activePage = this.$route.fullPath;
},
watch: {
'$route': function (newRoute, oldRoute) {
this.activePage = newRoute.fullPath;
if (this.linkList.indexOf(newRoute.fullPath) < 0) {
this.linkList.push(newRoute.fullPath);
this.pageList.push(newRoute);
}
},
'activePage': function (key) {
this.$router.push(key)
},
},
methods: {
initLoadDataList(param) {
this.$emit('initLoadDataList', param);
},
loadDatasourceList() {
this.$emit('loadDatasourceList');
},
changePage(key) {
this.activePage = key.name;
},
editPage(key, action) {
this[action](key);
},
removePageTab(key) {
if (this.pageList.length === 1) {
this.$message.warning('这是最后一页,不能再关闭了啦');
return
}
this.pageList = this.pageList.filter(item => item.fullPath !== key);
let index = this.linkList.indexOf(key);
this.linkList = this.linkList.filter(item => item !== key);
index = index >= this.linkList.length ? this.linkList.length - 1 : index;
this.activePage = this.linkList[index];
},
}
}
</script>
<style scoped>
</style>

View File

@@ -1,14 +0,0 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>文档管理系统</title>
</head>
<body>
<div id="app"></div>
</body>
</html>

View File

@@ -1,14 +0,0 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>文档管理系统</title>
</head>
<body>
<div id="app"></div>
</body>
</html>

View File

@@ -3,57 +3,41 @@ import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import App from './App.vue'
import global from './common/config/global'
import apimix from './common/config/apimix'
import common from './common/lib/common/common'
import toast from './common/lib/common/toast'
import VueRouter from 'vue-router'
import routes from './routes'
import store from './store/index'
import axios from 'axios'
import VueAxios from 'vue-axios'
import vueHljs from "vue-hljs";
import "vue-hljs/dist/vue-hljs.min.css";
Vue.use(ElementUI);
Vue.use(VueRouter);
Vue.use(VueAxios, axios);
Vue.use(vueHljs);
// 全局参数
Vue.prototype.global = global;
// 接口列表
Vue.prototype.apilist1 = apimix.apilist1;
Vue.prototype.apilist2 = apimix.apilist1;
// 公用方法
Vue.prototype.common = common;
Vue.prototype.toast = toast;
Vue.prototype.$store = store;
const router = new VueRouter({routes});
// 路由跳转时判断处理
router.beforeEach((to, from, next) => {
if (to.meta.title) {
document.title = to.meta.title
}
global.fullscreen = !!to.meta.fullscreen;
/* 判断该路由是否需要登录权限 */
if (to.matched.some(record => record.meta.requireAuth)) {
if (global.user.isLogin) {
next();
} else {
next({path: '/login'});
}
} else {
next();
}
if (to.meta.title) {
document.title = to.meta.title;
}
store.commit('global/setFullscreen', !!to.meta.fullscreen);
next();
});
new Vue({
let vue = new Vue({
el: '#app',
router,
render(h) {
var app = h(App);
global.vue = app.context;
return app;
return h(App);
}
});
export default vue;

View File

@@ -1,52 +1,43 @@
import Home from './views/home/Home.vue'
import UserLogin from './views/user/Login.vue'
import UserMyInfo from './views/user/MyInfo.vue'
import UserRouterView from './views/user/RouterView.vue'
import ConsoleRoleList from './views/console/RoleList.vue'
import ConsoleUserList from './views/console/UserList.vue'
import ConsoleAuthList from './views/console/AuthList.vue'
import ConsoleRouterView from './views/console/RouterView.vue'
import CommonNoAuth from './views/common/NoAuth.vue'
import PageTableView from './components/layouts/PageTableView'
let routes = [
{
path: '/home',
component: Home,
name: '主页',
meta: {
requireAuth: true,
}
}, {
path: '/user',
name: '用户管理',
component: UserRouterView,
children: [
{path: 'login', name: '系统登录',component: UserLogin, meta: {fullscreen: true}},
{path: 'myInfo', name: '我的信息',component: UserMyInfo},
]
}, {
path: '/console',
name: '系统管理',
component: ConsoleRouterView,
children: [
{path: 'userList', name: '用户管理',component: ConsoleUserList},
{path: 'roleList', name: '权限管理',component: ConsoleRoleList},
{path: 'authList', name: '角色列表',component: ConsoleAuthList},
]
}, {
path: '/common',
name: '',
component: UserRouterView,
children: [
{path: 'noAuth', name: '没有权限',component: CommonNoAuth},
]
}, {
path: '/',
redirect: '/home'
}
{path: '/', redirect: '/home'},
{
path: '/user/login',
name: '系统登录',
component: () => import('@/views/user/Login.vue'),
meta: {fullscreen: true}
}, {
path: '/',
name: '页面管理',
component: PageTableView,
children: [
{path: '/home', name: '控制台', component: () => import('@/views/home/Home')},
]
}, {
path: '/user',
name: '用户管理',
component: PageTableView,
children: [
{path: 'myInfo', name: '我的信息', component: () => import('@/views/user/MyInfo.vue')},
]
}, {
path: '/console',
name: '系统管理',
component: PageTableView,
children: [
{path: 'userList', name: '用户管理', component: () => import('@/views/console/UserList.vue')},
{path: 'roleList', name: '权限管理', component: () => import('@/views/console/AuthList.vue')},
{path: 'authList', name: '角色列表', component: () => import('@/views/console/RoleList.vue')},
]
}, {
path: '/common',
name: '',
component: PageTableView,
children: [
{path: 'noAuth', name: '没有权限', component: () => import('@/views/common/NoAuth.vue')},
]
},
];
export default routes;

View File

@@ -0,0 +1,11 @@
import Vue from 'vue'
import Vuex from 'vuex'
import global from './modules/global'
Vue.use(Vuex);
export default new Vuex.Store({
modules: {
global,
}
});

View File

@@ -0,0 +1,22 @@
export default {
namespaced: true,
state: {
pageTabNameMap: {},
fullscreen: false,
},
getters: {
getPageTabNameMap(state) {
return state.pageTabNameMap;
},
},
mutations: {
addTableName(state, item) {
let sameObj = Object.assign({}, state.pageTabNameMap);
sameObj[item.key] = item.val;
state.pageTabNameMap = sameObj;
},
setFullscreen(state, val) {
state.fullscreen = val;
},
}
}

View File

@@ -1,2 +0,0 @@
import Vue from 'vue'
import ElementUI from 'element-ui'

View File

@@ -25,7 +25,6 @@
</template>
<script>
var app;
export default {
data() {
@@ -48,7 +47,6 @@
};
},
mounted: function () {
app = this;
},
methods: {
handleSizeChange(val) {

View File

@@ -77,7 +77,6 @@
</template>
<script>
var app;
export default {
data() {
@@ -100,7 +99,6 @@
};
},
mounted: function () {
app = this;
},
methods: {
handleSizeChange(val) {

View File

@@ -1,4 +0,0 @@
<template>
<router-view></router-view>
</template>

View File

@@ -124,9 +124,7 @@
</template>
<script>
import toast from '../../common/lib/common/toast'
var app;
import consoleApi from '../../common/api/console'
export default {
data() {
return {
@@ -150,7 +148,6 @@
};
},
mounted: function () {
app = this;
this.getUserList();
},
methods: {
@@ -163,34 +160,34 @@
this.getUserList();
},
editUserAuthFun(row) {
app.allUserAuth = [];
app.editUserAuth = [];
this.allUserAuth = [];
this.editUserAuth = [];
var param = {userIds: row.id};
this.common.post(this.apilist1.userAuthList, param, function (json) {
app.editUserAuth = [];
app.allUserAuth = json.data;
app.editUserAuthDialogVisible = true;
app.editUserForm = JSON.parse(JSON.stringify(row));
for (var i = 0; i < app.allUserAuth.length; i++) {
if (app.allUserAuth[i].checked == 1) {
app.editUserAuth.push(app.allUserAuth[i].id);
}
}
});
consoleApi.userAuthList(param).then(json => {
this.editUserAuth = [];
this.allUserAuth = json.data;
this.editUserAuthDialogVisible = true;
this.editUserForm = JSON.parse(JSON.stringify(row));
for (var i = 0; i < this.allUserAuth.length; i++) {
if (this.allUserAuth[i].checked == 1) {
this.editUserAuth.push(this.allUserAuth[i].id);
}
}
});
},
editUserAuthSave() {
var param = {
userIds: this.editUserForm.id,
authIds: this.editUserAuth.join(","),
};
this.common.post(this.apilist1.updateUserAuth, param, function (json) {
toast.success("保存成功!");
app.editUserAuthDialogVisible = false;
consoleApi.updateUserAuth(param).then(json => {
this.$message.success("保存成功!");
this.editUserAuthDialogVisible = false;
});
},
editUserInfo(row) {
app.editUserDialogVisible = true;
app.editUserForm = JSON.parse(JSON.stringify(row));
this.editUserDialogVisible = true;
this.editUserForm = JSON.parse(JSON.stringify(row));
},
addUserInfo() {
this.editUserDialogVisible = true;
@@ -203,11 +200,10 @@
type: 'warning'
}).then(() => {
this.editUserForm = JSON.parse(JSON.stringify(row));
this.common.post(this.apilist1.resetPassword, this.editUserForm, function (json) {
app.$confirm("重置成功!新的密码为:" + json.data).then(()=> {
done();
}).catch(()=> {});
});
consoleApi.resetPassword(this.editUserForm).then(json => {
app.$confirm("重置成功!新的密码为:" + json.data).then(()=> {
}).catch(()=> {});
});
}).catch(()=>{});
},
deleteUser(row) {
@@ -216,28 +212,28 @@
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.editUserForm = JSON.parse(JSON.stringify(row));
this.common.post(this.apilist1.deleteUserInfo, this.editUserForm, function (json) {
toast.success("删除成功!");
app.getUserList();
});
this.editUserForm = JSON.parse(JSON.stringify(row));
consoleApi.deleteUserInfo(this.editUserForm).then(json => {
this.$message.success("删除成功!");
this.getUserList();
});
}).catch(()=>{});
},
updateEditUser() {
this.common.post(this.apilist1.updateUserInfo, this.editUserForm, function (json) {
toast.success("保存成功!");
app.editUserDialogVisible = false;
app.getUserList();
});
consoleApi.updateUserInfo(this.editUserForm).then(json => {
this.$message.success("保存成功!");
this.editUserDialogVisible = false;
this.getUserList();
});
},
getUserList() {
this.searchLoading = true;
this.common.post(this.apilist1.getUserInfoList, this.searchParam, function (json) {
// 让加载动画停留一会
setTimeout(()=>{app.searchLoading = false;}, 500);
app.totalCount = json.total;
app.searchResultList = json.data;
});
consoleApi.getUserInfoList(this.searchParam).then(json => {
// 让加载动画停留一会
setTimeout(()=>{this.searchLoading = false;}, 500);
this.totalCount = json.total;
this.searchResultList = json.data;
});
},
}
}

View File

@@ -64,18 +64,12 @@
</template>
<script>
import toast from '../../common/lib/common/toast'
import global from '../../common/config/global'
var app;
export default {
data() {
return {
};
},
mounted: function () {
app = this;
},
methods: {
jumpToDocPage(val) {

View File

@@ -1,88 +1,99 @@
<template>
<div style="padding-top: 50px;">
<el-form :model="loginParam" :rules="loginRules" ref="loginParam" label-position="left" label-width="0px"
class="demo-ruleForm login-container">
<h3 class="title">系统登录</h3>
<el-form-item prop="username">
<el-input type="text" v-model="loginParam.username" auto-complete="off" placeholder="账号" @keyup.enter="loginSubmit"></el-input>
</el-form-item>
<el-form-item prop="password">
<el-input type="password" v-model="loginParam.password" auto-complete="off" placeholder="密码" @keyup.enter="loginSubmit"></el-input>
</el-form-item>
<el-form-item style="width:100%;">
<el-button type="primary" style="width:100%;" @click.native.prevent="loginSubmit" :loading="logining">登录
</el-button>
<!--<el-button @click.native.prevent="handleReset2">重置</el-button>-->
</el-form-item>
</el-form>
</div>
<div>
<div style="padding-top: 50px;">
<el-form :model="loginParam" :rules="loginRules" ref="loginParam" label-position="left" label-width="0px" class="demo-ruleForm login-container">
<h3 class="title">文档管理-系统登录</h3>
<el-form-item prop="username">
<el-input type="text" v-model="loginParam.username" auto-complete="off" placeholder="账号" @keyup.enter.native="loginSubmit"></el-input>
</el-form-item>
<el-form-item prop="password">
<el-input type="password" v-model="loginParam.password" auto-complete="off" placeholder="密码" @keyup.enter.native="loginSubmit"></el-input>
</el-form-item>
<el-form-item style="width:100%;">
<el-button type="primary" style="width:100%;" @click.native.prevent="loginSubmit" :loading="logining">登录</el-button>
<!--<el-button @click.native.prevent="handleReset2">重置</el-button>-->
</el-form-item>
</el-form>
</div>
<!--随机背景图-->
<img v-if="bgImgRandom == 1" src="../../assets/img/bg1.jpeg" class="login-background-img">
<img v-else-if="bgImgRandom == 2" src="../../assets/img/bg2.jpeg" class="login-background-img">
<img v-else-if="bgImgRandom == 3" src="../../assets/img/bg3.jpeg" class="login-background-img">
<img v-else-if="bgImgRandom == 4" src="../../assets/img/bg4.jpeg" class="login-background-img">
<img v-else-if="bgImgRandom == 5" src="../../assets/img/bg5.jpeg" class="login-background-img">
<img v-else src="../../assets/img/bg5.jpeg" class="login-background-img">
</div>
</template>
<script>
export default {
data() {
return {
logining: false,
redirect: '',
loginParam: {
username: '',
password: ''
},
loginRules: {
username: [
{required: true, message: '请输入账号', trigger: 'blur'},
],
password: [
{required: true, message: '请输入密码', trigger: 'blur'},
]
},
checked: true
};
},
mounted: function () {
this.redirect = this.$route.query.redirect;
},
methods: {
loginSubmit() {
var that = this;
this.$refs.loginParam.validate((valid) => {
if (!valid) return;
that.common.post(that.apilist1.userLogin, that.loginParam, function (json) {
if(!!that.redirect) {
location.href = decodeURIComponent(that.redirect);
} else {
that.$router.back();
}
});
});
}
}
}
import consoleApi from '../../common/api/console'
export default {
data() {
return {
logining: false,
redirect: '',
loginParam: {
username: '',
password: ''
},
loginRules: {
username: [
{required: true, message: '请输入账号', trigger: 'blur'},
],
password: [
{required: true, message: '请输入密码', trigger: 'blur'},
]
},
checked: true,
bgImgRandom: Math.ceil(Math.random() * 4) + 1,
};
},
mounted: function () {
this.redirect = this.$route.query.redirect;
},
methods: {
loginSubmit() {
this.$refs.loginParam.validate((valid) => {
if (!valid) return;
consoleApi.userLogin(this.loginParam).then(() => {
if (!!this.redirect) {
location.href = decodeURIComponent(this.redirect);
} else {
this.$router.back();
}
});
});
}
}
}
</script>
<style>
.login-container {
-webkit-border-radius: 5px;
border-radius: 5px;
-moz-border-radius: 5px;
background-clip: padding-box;
margin: 0 auto;
width: 350px;
padding: 35px 35px 15px 35px;
background: #fff;
border: 1px solid #eaeaea;
box-shadow: 0 0 25px #cac6c6;
}
.login-container {
-webkit-border-radius: 5px;
border-radius: 5px;
-moz-border-radius: 5px;
background-clip: padding-box;
margin: 0 auto;
width: 350px;
padding: 35px 35px 15px 35px;
background: #fff;
border: 1px solid #eaeaea;
box-shadow: 0 0 25px #cac6c6;
}
.title {
margin: 0px auto 40px auto;
text-align: center;
color: #505458;
}
.title {
margin: 0px auto 40px auto;
text-align: center;
color: #505458;
}
.remember {
margin: 0px 0px 35px 0px;
}
.remember {
margin: 0px 0px 35px 0px;
}
.login-background-img{
width: 100%; height: 100%; position: absolute;z-index: -1;top:0;left:0;
}
</style>

View File

@@ -1,49 +1,48 @@
<template>
<div class="my-info-vue">
<el-breadcrumb separator-class="el-icon-arrow-right" style="padding: 20px 10px;">
<el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
<el-breadcrumb-item>我的信息</el-breadcrumb-item>
</el-breadcrumb>
<div style="margin: 0 auto;max-width: 1000px;">
<el-card class="box-card">
<div slot="header" class="clearfix">我的信息</div>
<el-form class="search-form-box" label-width="100px">
<el-form-item label="账号:">{{userInfo.userNo}}</el-form-item>
<el-form-item label="用户名:">{{userInfo.userName}}</el-form-item>
<el-form-item label="手机号:">{{userInfo.phone}}</el-form-item>
<el-form-item label="邮箱:">{{userInfo.email}}</el-form-item>
<el-form-item label="状态:">{{userInfo.delFlag==0?'正常':'停用'}}</el-form-item>
<el-form-item label="性别:">{{userInfo.sex==0?'女':'男'}}</el-form-item>
</el-form>
</el-card>
</div>
</div>
<div class="my-info-vue">
<el-breadcrumb separator-class="el-icon-arrow-right" style="padding: 20px 10px;">
<el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
<el-breadcrumb-item>我的信息</el-breadcrumb-item>
</el-breadcrumb>
<div style="margin: 0 auto;max-width: 1000px;">
<el-card class="box-card">
<div slot="header" class="clearfix">我的信息</div>
<el-form class="search-form-box" label-width="100px">
<el-form-item label="账号:">{{userInfo.userNo}}</el-form-item>
<el-form-item label="用户名:">{{userInfo.userName}}</el-form-item>
<el-form-item label="手机号:">{{userInfo.phone}}</el-form-item>
<el-form-item label="邮箱:">{{userInfo.email}}</el-form-item>
<el-form-item label="状态:">{{userInfo.delFlag==0?'正常':'停用'}}</el-form-item>
<el-form-item label="性别:">{{userInfo.sex==0?'女':'男'}}</el-form-item>
</el-form>
</el-card>
</div>
</div>
</template>
<script>
var app;
export default {
data() {
return {
userInfo: {}
};
},
mounted: function () {
app = this;
this.getUserInfo();
},
methods: {
getUserInfo() {
this.common.post(this.apilist1.getSelfUserInfo, this.searchParam, function (json) {
app.userInfo = json.data;
});
},
}
}
import consoleApi from '../../common/api/console'
export default {
data() {
return {
userInfo: {}
};
},
mounted: function () {
this.getUserInfo();
},
methods: {
getUserInfo() {
consoleApi.getSelfUserInfo().then(json => {
this.userInfo = json.data;
});
},
}
}
</script>
<style>
.my-info-vue{}
.my-info-vue .box-card{margin: 10px;}
.my-info-vue{}
.my-info-vue .box-card{margin: 10px;}
</style>

View File

@@ -1,4 +0,0 @@
<template>
<router-view></router-view>
</template>