提交 cd803667 authored 作者: 方慧敏's avatar 方慧敏

测试接口

上级 6ba358dc
......@@ -4233,7 +4233,8 @@
"ansi-regex": {
"version": "2.1.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"aproba": {
"version": "1.2.0",
......@@ -4254,12 +4255,14 @@
"balanced-match": {
"version": "1.0.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
......@@ -4274,17 +4277,20 @@
"code-point-at": {
"version": "1.1.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"core-util-is": {
"version": "1.0.2",
......@@ -4401,7 +4407,8 @@
"inherits": {
"version": "2.0.4",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"ini": {
"version": "1.3.5",
......@@ -4413,6 +4420,7 @@
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
......@@ -4427,6 +4435,7 @@
"version": "3.0.4",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
......@@ -4434,12 +4443,14 @@
"minimist": {
"version": "1.2.5",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"minipass": {
"version": "2.9.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
......@@ -4458,6 +4469,7 @@
"version": "0.5.3",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"minimist": "^1.2.5"
}
......@@ -4519,7 +4531,8 @@
"npm-normalize-package-bin": {
"version": "1.0.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"npm-packlist": {
"version": "1.4.8",
......@@ -4547,7 +4560,8 @@
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"object-assign": {
"version": "4.1.1",
......@@ -4559,6 +4573,7 @@
"version": "1.4.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"wrappy": "1"
}
......@@ -4636,7 +4651,8 @@
"safe-buffer": {
"version": "5.1.2",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"safer-buffer": {
"version": "2.1.2",
......@@ -4672,6 +4688,7 @@
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
......@@ -4691,6 +4708,7 @@
"version": "3.0.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
......@@ -4734,12 +4752,14 @@
"wrappy": {
"version": "1.0.2",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"yallist": {
"version": "3.1.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
}
}
},
......
......@@ -2,7 +2,7 @@ import axios from 'axios';
// import Qs from 'qs';
import baseUrl from '../../config';
import store from '../store';
// axios.defaults.withCredentials = true;
axios.defaults.withCredentials = true;
// 添加请求拦截器
axios.interceptors.request.use(function (config) {
// console.log(store.getters.getSession.session)
......@@ -11,7 +11,7 @@ axios.interceptors.request.use(function (config) {
if (config.method === 'post' || config.method === 'put' || config.method === 'delete') {
// POST传参序列化
}
config.headers.token = 'eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsInJvbGVzIjoiYWRtaW4iLCJleHAiOjE1ODkzNjMyMjgsImlhdCI6MTU4ODc2MzIyOH0.tykIIEXUu-klqp-oyVXE8J2UqSBlBch_g75Injk2-R8LluLUpaicaffWBqqa05kdlWj5BSGiEhMzA9nbE6HLaA';
// config.headers.token = 'eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsInJvbGVzIjoiYWRtaW4iLCJleHAiOjE1ODkzNjMyMjgsImlhdCI6MTU4ODc2MzIyOH0.tykIIEXUu-klqp-oyVXE8J2UqSBlBch_g75Injk2-R8LluLUpaicaffWBqqa05kdlWj5BSGiEhMzA9nbE6HLaA';
return config;
}, function (error) {
// 预处理请求错误(error)
......@@ -44,8 +44,8 @@ export default function(url, {
timeout = 60000,
data = {},
headers = {'Content-Type': 'application/json'}, // application/x-www-form-urlencoded;charset=UTF-8;
dataType = 'json',
responseType = 'blob'
dataType = 'json'
// responseType = 'blob'
}) {
const config = {
method: method,
......@@ -54,8 +54,8 @@ export default function(url, {
baseURL: baseUrl.URL_CNODEJS, // 域名,在最外层的config.js当中可以修改,请求目标服务器域名配置,结合我们自己的项目,在项目放置到服务器上时,就是将域名替换成192.168.1.3
data: data,
headers: headers,
dataType: dataType,
responseType: responseType
dataType: dataType
// responseType: responseType
};
return axios(config);
}
......@@ -28,5 +28,11 @@ const server = {
responseType: 'blob'
});
},
postLogin(data) {
return axios('http://223.4.69.30:8088/user/login', {
method: 'post',
data: data
});
}
}
export default server;
......@@ -5,6 +5,7 @@
<button @click="upSocket">启动socket</button>
<textarea>{{ this.skD }}</textarea>
<button @click="downWxj">下载文件</button>
<button @click="login">登录</button>
</div>
</template>
<script>
......@@ -69,7 +70,21 @@
}).catch(err => {
console.log(err);
})
},
login(){
console.log('你好数据');
let data = {
userName: 'admin',
password: 'admin'
}
this.$server.postLogin(data).then(res => {
console.log(res);
}).catch(err => {
console.log(err);
this.$message.error('数据请求失败');
})
}
},
components: {
},
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论