dubbo文档UI初始化
This commit is contained in:
297
zyplayer-doc-ui/dubbo-ui/src/App.vue
Normal file
297
zyplayer-doc-ui/dubbo-ui/src/App.vue
Normal file
@@ -0,0 +1,297 @@
|
||||
<template>
|
||||
<div id="app">
|
||||
<template v-if="fullscreen">
|
||||
<router-view></router-view>
|
||||
</template>
|
||||
<el-container v-else>
|
||||
<el-aside style="background: #fafafa;">
|
||||
<div style="padding: 10px;height: 100%;box-sizing: border-box;">
|
||||
<div style="margin-bottom: 10px;">
|
||||
<el-select v-model="choiceDatasourceGroup" @change="sourceGroupChangeEvents" size="small" filterable placeholder="请先选择分组" style="width: 100%;">
|
||||
<el-option value="" label="全部分组"></el-option>
|
||||
<el-option v-for="item in datasourceGroupList" :key="item" :value="item"></el-option>
|
||||
</el-select>
|
||||
<el-select v-model="choiceDatasourceId" @change="datasourceChangeEvents" size="small" filterable placeholder="请先选择数据源" style="width: 100%;margin-top: 10px;">
|
||||
<el-option v-for="item in datasourceOptions" :key="item.value" :label="item.label" :value="item.value"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<el-menu :router="true" class="el-menu-vertical" style="height: auto;">
|
||||
<el-menu-item index="/data/datasourceManage"><i class="el-icon-coin"></i>数据源管理</el-menu-item>
|
||||
<el-menu-item index="/data/executor"><i class="el-icon-video-play"></i>SQL执行器</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="/data/export"><i class="el-icon-finished"></i>数据库表导出</el-menu-item>
|
||||
<el-menu-item index="/data/transferData"><i class="el-icon-document-copy"></i>数据互导工具</el-menu-item>
|
||||
</el-submenu>
|
||||
</el-menu>
|
||||
<div style="overflow: auto;padding-bottom: 30px;">
|
||||
<el-tree :props="defaultProps" :data="databaseList" @node-click="handleNodeClick"
|
||||
ref="databaseTree" highlight-current empty-text=""
|
||||
:default-expanded-keys="databaseExpandedKeys"
|
||||
node-key="id" @node-expand="handleNodeExpand"
|
||||
class="database-list-tree">
|
||||
<span slot-scope="{node, data}">
|
||||
<span v-if="data.needLoad"><i class="el-icon-loading"></i></span>
|
||||
<span v-else>
|
||||
{{node.label}}
|
||||
<el-tooltip v-if="!!data.comment" effect="dark" :content="data.comment" placement="top-start" :open-delay="600">
|
||||
<span style="color: #aaa;">-{{data.comment}}</span>
|
||||
</el-tooltip>
|
||||
</span>
|
||||
</span>
|
||||
</el-tree>
|
||||
</div>
|
||||
</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 @initLoadDataList="initLoadDataList"
|
||||
@loadDatasourceList="loadDatasourceList">
|
||||
</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 userApi from './common/api/user'
|
||||
import datasourceApi from './common/api/datasource'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
isCollapse: false,
|
||||
aboutDialogVisible: false,
|
||||
userSelfInfo: {},
|
||||
// 数据源相关
|
||||
datasourceOptions: [],
|
||||
datasourceList: [],
|
||||
datasourceGroupList: [],
|
||||
choiceDatasourceId: "",
|
||||
choiceDatasourceGroup: "",
|
||||
defaultProps: {children: 'children', label: 'name'},
|
||||
// 页面展示相关
|
||||
nowDatasourceShow: {},
|
||||
databaseList: [],
|
||||
databaseExpandedKeys: [],
|
||||
// 升级信息
|
||||
upgradeInfo: {},
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
fullscreen () {
|
||||
return this.$store.state.global.fullscreen;
|
||||
}
|
||||
},
|
||||
mounted: function () {
|
||||
this.getSelfUserInfo();
|
||||
this.checkSystemUpgrade();
|
||||
this.loadDatasourceList();
|
||||
},
|
||||
methods: {
|
||||
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.warning("功能暂未开放");
|
||||
}
|
||||
},
|
||||
userSignOut() {
|
||||
userApi.userLogout().then(() => {
|
||||
location.reload();
|
||||
});
|
||||
},
|
||||
getSelfUserInfo() {
|
||||
userApi.getSelfUserInfo().then(json=>{
|
||||
this.userSelfInfo = json.data;
|
||||
});
|
||||
},
|
||||
sourceGroupChangeEvents() {
|
||||
let datasourceOptions = [];
|
||||
for (let i = 0; i < this.datasourceList.length; i++) {
|
||||
let item = this.datasourceList[i];
|
||||
if (!this.choiceDatasourceGroup || this.choiceDatasourceGroup == item.groupName) {
|
||||
datasourceOptions.push({label: item.name, value: item.id});
|
||||
}
|
||||
}
|
||||
this.datasourceOptions = datasourceOptions;
|
||||
},
|
||||
datasourceChangeEvents() {
|
||||
this.nowDatasourceShow = this.choiceDatasourceId;
|
||||
var host = "";
|
||||
for (var i = 0; i < this.datasourceList.length; i++) {
|
||||
if (this.datasourceList[i].id == this.choiceDatasourceId) {
|
||||
host = this.datasourceList[i].name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.loadDatabaseList(this.choiceDatasourceId, host);
|
||||
},
|
||||
handleNodeClick(node) {
|
||||
console.log("点击节点:", node);
|
||||
// 执行器里面点击库表不跳转页面
|
||||
// if (this.$router.currentRoute.path == "/data/executor") {
|
||||
// return;
|
||||
// }
|
||||
if (node.type == 1) {
|
||||
this.nowClickPath = {sourceId: this.choiceDatasourceId, host: node.host, dbName: node.dbName, tableName: node.tableName};
|
||||
this.$router.push({path: '/table/database', query: this.nowClickPath});
|
||||
} else if (node.type == 2) {
|
||||
this.nowClickPath = {sourceId: this.choiceDatasourceId, host: node.host, dbName: node.dbName, tableName: node.tableName};
|
||||
this.$router.push({path: '/table/info', query: this.nowClickPath});
|
||||
}
|
||||
},
|
||||
handleNodeExpand(node) {
|
||||
if (node.children.length > 0 && node.children[0].needLoad) {
|
||||
console.log("加载节点:", node);
|
||||
if (node.type == 1) {
|
||||
this.loadGetTableList(node);
|
||||
}
|
||||
}
|
||||
},
|
||||
loadGetTableList(node, callback) {
|
||||
datasourceApi.tableList({sourceId: this.choiceDatasourceId, dbName: node.dbName}).then(json => {
|
||||
let pathIndex = [];
|
||||
let result = json.data || [];
|
||||
for (let i = 0; i < result.length; i++) {
|
||||
let item = {
|
||||
id: node.host + "_" + node.dbName + "_" + result[i].tableName, host: node.host,
|
||||
dbName: node.dbName, tableName: result[i].tableName, name: result[i].tableName, type: 2,
|
||||
comment: result[i].tableComment
|
||||
};
|
||||
// item.children = [{label: '', needLoad: true}];// 初始化一个对象,点击展开时重新查询加载
|
||||
pathIndex.push(item);
|
||||
}
|
||||
node.children = pathIndex;
|
||||
if (typeof callback == 'function') {
|
||||
callback(pathIndex);
|
||||
}
|
||||
});
|
||||
},
|
||||
loadDatasourceList() {
|
||||
datasourceApi.datasourceList({}).then(json => {
|
||||
this.datasourceList = json.data || [];
|
||||
let datasourceOptions = [];
|
||||
for (let i = 0; i < this.datasourceList.length; i++) {
|
||||
let item = this.datasourceList[i];
|
||||
datasourceOptions.push({label: item.name, value: item.id});
|
||||
}
|
||||
this.datasourceOptions = datasourceOptions;
|
||||
let datasourceGroupList = [];
|
||||
this.datasourceList.filter(item => !!item.groupName).forEach(item => datasourceGroupList.push(item.groupName || ''));
|
||||
this.datasourceGroupList = Array.from(new Set(datasourceGroupList));
|
||||
});
|
||||
},
|
||||
loadDatabaseList(sourceId, host) {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.databaseList = [];
|
||||
datasourceApi.databaseList({sourceId: sourceId}).then(json => {
|
||||
let result = json.data || [];
|
||||
let pathIndex = [];
|
||||
let children = [];
|
||||
for (let i = 0; i < result.length; i++) {
|
||||
let item = {
|
||||
id: host + "_" + result[i].dbName, host: host, dbName: result[i].dbName,
|
||||
name: result[i].dbName, type: 1
|
||||
};
|
||||
item.children = [{label: '', needLoad: true}];// 初始化一个对象,点击展开时重新查询加载
|
||||
children.push(item);
|
||||
}
|
||||
pathIndex.push({id: host, host: host, name: host, children: children});
|
||||
this.databaseList = pathIndex;
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
},
|
||||
initLoadDataList(param) {
|
||||
if (this.databaseList.length > 0) {
|
||||
return;
|
||||
}
|
||||
this.choiceDatasourceId = parseInt(param.sourceId);
|
||||
this.loadDatabaseList(param.sourceId, param.host).then(() => {
|
||||
this.databaseExpandedKeys = [param.host];
|
||||
});
|
||||
},
|
||||
checkSystemUpgrade() {
|
||||
datasourceApi.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%;
|
||||
}
|
||||
.el-header {
|
||||
background-color: #1D4E89 !important;
|
||||
}
|
||||
.database-list-tree{background-color: #fafafa;}
|
||||
.database-list-tree .el-tree-node>.el-tree-node__children {
|
||||
overflow: unset;
|
||||
}
|
||||
.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>
|
||||
BIN
zyplayer-doc-ui/dubbo-ui/src/assets/img/dubbo.png
Normal file
BIN
zyplayer-doc-ui/dubbo-ui/src/assets/img/dubbo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
86
zyplayer-doc-ui/dubbo-ui/src/common/api/datasource.js
Normal file
86
zyplayer-doc-ui/dubbo-ui/src/common/api/datasource.js
Normal file
@@ -0,0 +1,86 @@
|
||||
import Qs from 'qs'
|
||||
import request from './request'
|
||||
|
||||
export default {
|
||||
queryTestDatasource: data => {
|
||||
return request({url: '/zyplayer-doc-db/datasource/test', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
queryTableDdl: data => {
|
||||
return request({url: '/zyplayer-doc-db/doc-db/getTableDdl', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
getEditorData: data => {
|
||||
return request({url: '/zyplayer-doc-db/doc-db/getEditorData', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
datasourceList: data => {
|
||||
return request({url: '/zyplayer-doc-db/doc-db/getDataSourceList', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
databaseList: data => {
|
||||
return request({url: '/zyplayer-doc-db/doc-db/getDatabaseList', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
tableList: data => {
|
||||
return request({url: '/zyplayer-doc-db/doc-db/getTableList', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
tableColumnList: data => {
|
||||
return request({url: '/zyplayer-doc-db/doc-db/getTableColumnList', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
tableStatus: data => {
|
||||
return request({url: '/zyplayer-doc-db/doc-db/getTableStatus', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
tableAndColumnBySearch: data => {
|
||||
return request({url: '/zyplayer-doc-db/doc-db/getTableAndColumnBySearch', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
updateTableDesc: data => {
|
||||
return request({url: '/zyplayer-doc-db/doc-db/updateTableDesc', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
updateTableColumnDesc: data => {
|
||||
return request({url: '/zyplayer-doc-db/doc-db/updateTableColumnDesc', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
manageDatasourceList: data => {
|
||||
return request({url: '/zyplayer-doc-db/datasource/list', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
manageUpdateDatasource: data => {
|
||||
return request({url: '/zyplayer-doc-db/datasource/update', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
queryExecuteSql: data => {
|
||||
return request({url: '/zyplayer-doc-db/executor/execute', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
executeSqlCancel: data => {
|
||||
return request({url: '/zyplayer-doc-db/executor/cancel', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
updateFavorite: data => {
|
||||
return request({url: '/zyplayer-doc-db/executor/favorite/add', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
favoriteList: data => {
|
||||
return request({url: '/zyplayer-doc-db/executor/favorite/list', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
historyList: data => {
|
||||
return request({url: '/zyplayer-doc-db/executor/history/list', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
transferStart: data => {
|
||||
return request({url: '/zyplayer-doc-db/transfer/start', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
transferCancel: data => {
|
||||
return request({url: '/zyplayer-doc-db/transfer/cancel', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
transferList: data => {
|
||||
return request({url: '/zyplayer-doc-db/transfer/list', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
transferDetail: data => {
|
||||
return request({url: '/zyplayer-doc-db/transfer/detail', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
transferUpdate: data => {
|
||||
return request({url: '/zyplayer-doc-db/transfer/update', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
transferSqlColumns: data => {
|
||||
return request({url: '/zyplayer-doc-db/transfer/sqlColumns', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
assignDbUserAuth: data => {
|
||||
return request({url: '/zyplayer-doc-db/auth/assign', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
dbUserAuthList: data => {
|
||||
return request({url: '/zyplayer-doc-db/auth/list', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
systemUpgradeInfo: data => {
|
||||
return request({url: '/system/info/upgrade', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
};
|
||||
56
zyplayer-doc-ui/dubbo-ui/src/common/api/request.js
Normal file
56
zyplayer-doc-ui/dubbo-ui/src/common/api/request.js
Normal file
@@ -0,0 +1,56 @@
|
||||
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('请先登录');
|
||||
var href = encodeURIComponent(window.location.href);
|
||||
window.location = process.env.VUE_APP_BASE_API + "#/user/login?redirect=" + href;
|
||||
} 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;
|
||||
22
zyplayer-doc-ui/dubbo-ui/src/common/api/user.js
Normal file
22
zyplayer-doc-ui/dubbo-ui/src/common/api/user.js
Normal file
@@ -0,0 +1,22 @@
|
||||
import Qs from 'qs'
|
||||
import request from './request'
|
||||
|
||||
export default {
|
||||
userLogin: data => {
|
||||
return request({url: '/login', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
userLogout: () => {
|
||||
return request({url: '/logout', method: 'post', data: Qs.stringify({})});
|
||||
},
|
||||
getSelfUserInfo: () => {
|
||||
return request({url: '/user/info/selfInfo', method: 'post', data: Qs.stringify({})});
|
||||
},
|
||||
getUserBaseInfo: data => {
|
||||
return request({url: '/zyplayer-doc-wiki/common/user/base', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
};
|
||||
|
||||
// userLogin: '/login',
|
||||
// userLogout: '/logout',
|
||||
// getSelfUserInfo: '/user/info/selfInfo',
|
||||
// getUserBaseInfo: '/zyplayer-doc-wiki/common/user/base',
|
||||
@@ -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>
|
||||
43
zyplayer-doc-ui/dubbo-ui/src/main.js
Normal file
43
zyplayer-doc-ui/dubbo-ui/src/main.js
Normal file
@@ -0,0 +1,43 @@
|
||||
import Vue from 'vue'
|
||||
import ElementUI from 'element-ui'
|
||||
import 'element-ui/lib/theme-chalk/index.css'
|
||||
import App from './App.vue'
|
||||
|
||||
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.$store = store;
|
||||
|
||||
const router = new VueRouter({routes});
|
||||
// 路由跳转时判断处理
|
||||
router.beforeEach((to, from, next) => {
|
||||
if (to.meta.title) {
|
||||
document.title = to.meta.title;
|
||||
}
|
||||
store.commit('global/setFullscreen', !!to.meta.fullscreen);
|
||||
next();
|
||||
});
|
||||
|
||||
let vue = new Vue({
|
||||
el: '#app',
|
||||
router,
|
||||
render(h) {
|
||||
return h(App);
|
||||
}
|
||||
});
|
||||
export default vue;
|
||||
|
||||
|
||||
|
||||
46
zyplayer-doc-ui/dubbo-ui/src/routes.js
Normal file
46
zyplayer-doc-ui/dubbo-ui/src/routes.js
Normal file
@@ -0,0 +1,46 @@
|
||||
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 PageTableView from './components/layouts/PageTableView'
|
||||
|
||||
import CommonNoAuth from './views/common/NoAuth.vue'
|
||||
|
||||
let routes = [
|
||||
{
|
||||
path: '/home',
|
||||
component: Home,
|
||||
name: '主页',
|
||||
meta: {
|
||||
requireAuth: true,
|
||||
}
|
||||
}, {
|
||||
path: '/',
|
||||
redirect: '/home'
|
||||
}, {
|
||||
path: '/',
|
||||
name: 'Tab标签页',
|
||||
component: PageTableView,
|
||||
children: [
|
||||
{path: '/user/myInfo', name: '我的信息',component: UserMyInfo},
|
||||
]
|
||||
}, {
|
||||
path: '/user',
|
||||
name: '用户管理',
|
||||
component: UserRouterView,
|
||||
children: [
|
||||
{path: 'login', name: '系统登录',component: UserLogin, meta: {fullscreen: true}},
|
||||
]
|
||||
}, {
|
||||
path: '/common',
|
||||
name: '',
|
||||
component: UserRouterView,
|
||||
children: [
|
||||
{path: 'noAuth', name: '没有权限',component: CommonNoAuth},
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
export default routes;
|
||||
11
zyplayer-doc-ui/dubbo-ui/src/store/index.js
Normal file
11
zyplayer-doc-ui/dubbo-ui/src/store/index.js
Normal 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,
|
||||
}
|
||||
});
|
||||
22
zyplayer-doc-ui/dubbo-ui/src/store/modules/global.js
Normal file
22
zyplayer-doc-ui/dubbo-ui/src/store/modules/global.js
Normal 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;
|
||||
},
|
||||
}
|
||||
}
|
||||
18
zyplayer-doc-ui/dubbo-ui/src/views/common/NoAuth.vue
Normal file
18
zyplayer-doc-ui/dubbo-ui/src/views/common/NoAuth.vue
Normal file
@@ -0,0 +1,18 @@
|
||||
<template>
|
||||
<div>没有权限访问该模块</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
mounted: function () {
|
||||
},
|
||||
methods: {}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
|
||||
</style>
|
||||
|
||||
27
zyplayer-doc-ui/dubbo-ui/src/views/home/Home.vue
Normal file
27
zyplayer-doc-ui/dubbo-ui/src/views/home/Home.vue
Normal file
@@ -0,0 +1,27 @@
|
||||
<template>
|
||||
<div style="padding: 10px;">
|
||||
<div style="max-width: 1200px;margin: 20px auto;">
|
||||
<div style="text-align: center;">欢迎使用ヾ(๑╹◡╹)ノ" - 在左上角选择一个数据源吧~</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
var app;
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
};
|
||||
},
|
||||
mounted: function () {
|
||||
app = this;
|
||||
},
|
||||
methods: {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
|
||||
</style>
|
||||
|
||||
87
zyplayer-doc-ui/dubbo-ui/src/views/user/Login.vue
Normal file
87
zyplayer-doc-ui/dubbo-ui/src/views/user/Login.vue
Normal file
@@ -0,0 +1,87 @@
|
||||
<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>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import userApi from '../../common/api/user'
|
||||
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() {
|
||||
this.$refs.loginParam.validate((valid) => {
|
||||
if (!valid) return;
|
||||
userApi.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;
|
||||
}
|
||||
|
||||
.title {
|
||||
margin: 0px auto 40px auto;
|
||||
text-align: center;
|
||||
color: #505458;
|
||||
}
|
||||
|
||||
.remember {
|
||||
margin: 0px 0px 35px 0px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
44
zyplayer-doc-ui/dubbo-ui/src/views/user/MyInfo.vue
Normal file
44
zyplayer-doc-ui/dubbo-ui/src/views/user/MyInfo.vue
Normal file
@@ -0,0 +1,44 @@
|
||||
<template>
|
||||
<div class="my-info-vue">
|
||||
<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>
|
||||
import userApi from '../../common/api/user'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
userInfo: {}
|
||||
};
|
||||
},
|
||||
mounted: function () {
|
||||
this.getUserInfo();
|
||||
},
|
||||
methods: {
|
||||
getUserInfo() {
|
||||
userApi.getSelfUserInfo().then(json => {
|
||||
this.userInfo = json.data;
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<style>
|
||||
.my-info-vue{}
|
||||
.my-info-vue .box-card{margin: 10px;}
|
||||
</style>
|
||||
|
||||
4
zyplayer-doc-ui/dubbo-ui/src/views/user/RouterView.vue
Normal file
4
zyplayer-doc-ui/dubbo-ui/src/views/user/RouterView.vue
Normal file
@@ -0,0 +1,4 @@
|
||||
<template>
|
||||
<router-view></router-view>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user