微信小程式 請求的兩個方法
//請求介面除錯:獲取開戶入口
netrequest0: function () {
var that = this
wx.request({
//獲取開戶入口url地址:
url: 'xx(域名)-brac/ia/oase/entrance',
header: {
// 'content-type': 'application/x-www-form-urlencoded',
'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8',
},
data:{
channel:'C0012'
},
method: 'POST',
success: function (res) {
console.log(res.data)
//請求成功,在請求銀行卡查詢api
//wx.setStorageSync('entrance', res.data)
// that.setData({
// oa_sessionid: res.header['Set-Cookie'] && res.header['Set-Cookie'][0] || '',
// });
// that.jsessionid();
// console.log(res.data)
// ``
var cookies = res.header['Set-Cookie'] && res.header['Set-Cookie'][0] || '';
var cookie = cookies.split(',')[0];
that.setData({
oa_sessionid:cookie
});
that.netrequestbandcard();
},
fail:function (){
console.log('網路請求失敗')
}
})
//測試請求jSessoinId
// this.jSessoinId();
//在除錯銀行卡查詢api
// this.netrequestbandcard();
},
// //請求獲取sessoninID:
// jSessoinId: function(){
// wx.request({
// url: 'xx(域名)-/brac/ia/portal/register/jSessoinId?',
// data: {
// channel:'C0012'
// },
// method: 'GET',
// header: {
// 'Content-Type': 'application/x-www-form-urlencoded',
// 'Cookie': that.data.oa_sessionid
// },
// complete : function (res) {
// console.log('jsessionid complete');
// console.log(res, 'jsessionid-complete');
// },
// success: function(res){
// //success
// console.log(res.data,'jsessionid-success')
// that.setData({
// oa_sessionid: res.data.object
// })
// },
// })
// },