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, {
NODE_ENV: '"development"',
BASE_API: '"/proxyApi"'
BASE_API: '"/api"'
})

View File

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

View File

@ -7,9 +7,16 @@ if (process.env.NODE_ENV === 'development') {
axios.defaults.baseURL = '/'
}
//获取token
export const getToken = (params) => {
return axios.get('api/blade-auth/oauth/token', {
params
export const getToken = (data) => {
return axios.post('api/blade-auth/oauth/token'+'?grant_type='+data.grant_type+'&scope='+data.scope
+'&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) {

View File

@ -49,6 +49,7 @@ import mdScreenPie from "@/components/common/mdScreenPie";
import Swiper from "@/components/common/carousel";
import Resize from '../utils/Resize.vue'
import {getToken} from "../api/api";
// import
export default {
name: "report",
components: {
@ -82,9 +83,6 @@ export default {
},
methods: {
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 = {
grant_type:'password',
scope:'all',
@ -92,25 +90,52 @@ export default {
username:'dlgc_pic',
password:'e19d5cd5af0378da05f63f891c7467af',
type:"account"}
axios({
method: "get",
url: `${baseUrl}file/local/files`,
data: data,
headers: {
Authorization: "Bearer " + token,
},
getToken(data).then(res => {
console.log("res",res.data)
})
.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() {