diff --git a/config/dev.env.js b/config/dev.env.js index 20ae3f7..43cd253 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -4,5 +4,5 @@ const prodEnv = require('./prod.env') module.exports = merge(prodEnv, { NODE_ENV: '"development"', - BASE_API: '"/proxyApi"' + BASE_API: '"/api"' }) diff --git a/config/index.js b/config/index.js index 1e38bc5..bdee421 100644 --- a/config/index.js +++ b/config/index.js @@ -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': '' diff --git a/src/api/api.js b/src/api/api.js index 3c7c533..9ff50ce 100644 --- a/src/api/api.js +++ b/src/api/api.js @@ -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) { diff --git a/src/views/login.vue b/src/views/login.vue index 11aa041..7fb2c18 100644 --- a/src/views/login.vue +++ b/src/views/login.vue @@ -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,35 +83,59 @@ 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 = { + var data = { grant_type:'password', scope:'all', tenantId:'748495', username:'dlgc_pic', password:'e19d5cd5af0378da05f63f891c7467af', type:"account"} - axios({ - method: "get", - 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("请求失败"); - }); - + getToken(data).then(res => { + console.log("res",res.data) + }) + + // 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() {