This commit is contained in:
chengdandan 2023-03-21 14:02:18 +08:00
parent adfd80734c
commit 80e623b701
4 changed files with 60 additions and 28 deletions

View File

@ -4,5 +4,5 @@ const prodEnv = require('./prod.env')
module.exports = merge(prodEnv, { module.exports = merge(prodEnv, {
NODE_ENV: '"development"', NODE_ENV: '"development"',
BASE_API: '"/proxyApi"' BASE_API: '"/api"'
}) })

View File

@ -20,7 +20,7 @@ module.exports = {
// }, // },
'/api': { '/api': {
// target: 'http://10.6.0.26:81', // target: 'http://10.6.0.26:81',
target: 'http://175.27.191.156:11000/', target: 'http://175.27.191.156:11000/api/',
changeOrigin: true, changeOrigin: true,
pathRewrite: { pathRewrite: {
'^/api': '' '^/api': ''

View File

@ -7,9 +7,16 @@ if (process.env.NODE_ENV === 'development') {
axios.defaults.baseURL = '/' axios.defaults.baseURL = '/'
} }
//获取token //获取token
export const getToken = (params) => { export const getToken = (data) => {
return axios.get('api/blade-auth/oauth/token', { return axios.post('api/blade-auth/oauth/token'+'?grant_type='+data.grant_type+'&scope='+data.scope
params +'&tenantId='+data.tenantId+'&username='+data.username+'&password='+data.password+'&type='+data.type,data, {
dataType: "JSON",
headers:{
'Content-Type': 'application/json',
'Accept':'application/json',
'Authorization':'Basic c2FiZXI6c2FiZXJfc2VjcmV0',
'Tenant-Id': '748495'
}
}) })
}; };
export function filterCompanyAPI (params) { export function filterCompanyAPI (params) {

View File

@ -49,6 +49,7 @@ import mdScreenPie from "@/components/common/mdScreenPie";
import Swiper from "@/components/common/carousel"; import Swiper from "@/components/common/carousel";
import Resize from '../utils/Resize.vue' import Resize from '../utils/Resize.vue'
import {getToken} from "../api/api"; import {getToken} from "../api/api";
// import
export default { export default {
name: "report", name: "report",
components: { components: {
@ -82,9 +83,6 @@ export default {
}, },
methods: { methods: {
getTokenData(){ getTokenData(){
// getToken({grant_type:'password',scope:'all',tenantId:'748495',username:'dlgc_pic',password:'e19d5cd5af0378da05f63f891c7467af',type:"account"}).then(res => {
// console.log("res",res.data)
// })
var data = { var data = {
grant_type:'password', grant_type:'password',
scope:'all', scope:'all',
@ -92,25 +90,52 @@ export default {
username:'dlgc_pic', username:'dlgc_pic',
password:'e19d5cd5af0378da05f63f891c7467af', password:'e19d5cd5af0378da05f63f891c7467af',
type:"account"} type:"account"}
axios({ getToken(data).then(res => {
method: "get", console.log("res",res.data)
url: `${baseUrl}file/local/files`,
data: data,
headers: {
Authorization: "Bearer " + token,
},
}) })
.then(function(res) {
console.log(e.file.name);
z.modelshowdata.fileList = [
{ fileName: e.file.name, filePath: v.data.fileName },
];
z.$message.success("上传成功");
})
.catch(function(err) {
z.$message.error("请求失败");
});
// this.$axios.post({
// // method: "post",
// url: `http://175.27.191.156:11000/blade-auth/oauth/token`,
// data: data,
// headers: {
// Authorization: "Basic c2FiZXI6c2FiZXJfc2VjcmV0 ",
// tenantId:'748495'
// },
// })
// .then(function(res) {
// console.log("res11111",res);
// })
// .catch(function(err) {
// console.log("err",err);
// });
// var resUrl = `http://175.27.191.156:11000/blade-auth/oauth/token`
// this.$axios.post({
// type: "post", //
// url: resUrl,
// data: JSON.stringify({
// "grant_type":'password',
// "scope":'all',
// "tenantId":'748495',
// "username":'dlgc_pic',
// "password":'e19d5cd5af0378da05f63f891c7467af',
// "type":"account"
// }),
// dataType: "JSON",
// headers: {
// 'Content-Type': 'application/json',
// 'Accept':'application/json',
// 'Authorization': "Basic c2FiZXI6c2FiZXJfc2VjcmV0 ",
// 'tenantId':'748495'
// },
// success: function(data, textStatus, request) {
// console.log("data",data)
// // const tokennew =JSON.parse(JSON.stringify(request.getResponseHeader('Access-Token')))
// // setStorage("token",tokennew);
// },
// });
}, },
getType() { getType() {