增加表数据查看功能,tab标签页优化
This commit is contained in:
7
zyplayer-doc-ui/db-ui/src/common/api/datasource.js
Normal file
7
zyplayer-doc-ui/db-ui/src/common/api/datasource.js
Normal file
@@ -0,0 +1,7 @@
|
||||
import Qs from 'qs'
|
||||
import request from '../lib/common/request'
|
||||
|
||||
export function queryExecuteSql(data) {
|
||||
return request({url: '/zyplayer-doc-db/executor/execute', method: 'post', data: Qs.stringify(data)});
|
||||
}
|
||||
|
||||
@@ -5,14 +5,14 @@ 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://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: './',
|
||||
HOST: './',
|
||||
HOST1: './',
|
||||
|
||||
mixUrl: function (host, url) {
|
||||
var p;
|
||||
@@ -47,6 +47,6 @@ var apilist1 = _fn.mixUrl(_fn.HOST, apilist.URL);
|
||||
var apilist2 = _fn.mixUrl(_fn.HOST1, apilist.URL1);
|
||||
|
||||
export default {
|
||||
apilist1, apilist2
|
||||
apilist1, apilist2, host: _fn.HOST
|
||||
};
|
||||
|
||||
|
||||
56
zyplayer-doc-ui/db-ui/src/common/lib/common/request.js
Normal file
56
zyplayer-doc-ui/db-ui/src/common/lib/common/request.js
Normal file
@@ -0,0 +1,56 @@
|
||||
import axios from 'axios'
|
||||
import global from '../../config/global'
|
||||
import apimix from '../../config/apimix'
|
||||
|
||||
const service = axios.create({
|
||||
baseURL: apimix.host, // 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,
|
||||
};
|
||||
|
||||
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) {
|
||||
global.vue.$message('请求错误:' + response.message);
|
||||
}else {
|
||||
if (!response.config.needValidateResult || response.data.errCode == 200) {
|
||||
return response.data;
|
||||
} else if (response.data.errCode == 400) {
|
||||
global.vue.$message('请先登录');
|
||||
var href = encodeURIComponent(window.location.href);
|
||||
window.location = apimix.apilist1.HOST + "#/user/login?redirect=" + href;
|
||||
} else if (response.data.errCode == 402) {
|
||||
global.vue.$router.push("/common/noAuth");
|
||||
} else if (response.data.errCode !== 200) {
|
||||
global.vue.$message(response.data.errMsg || "未知错误");
|
||||
}
|
||||
}
|
||||
return Promise.reject('请求错误');
|
||||
},
|
||||
error => {
|
||||
console.log('err' + error);
|
||||
global.vue.$message.info('请求错误:' + error.message);
|
||||
return Promise.reject(error)
|
||||
}
|
||||
);
|
||||
export default service;
|
||||
Reference in New Issue
Block a user