| | |
| | | import { |
| | | getPlat |
| | | } from 'common/util.js'; |
| | | |
| | | module.exports = (vm) => { |
| | | uni.$u.http.setConfig((x) => { |
| | | return x = { |
| | |
| | | if (TOKEN) { |
| | | x.header[ACCESSTOKEN] = 'Bearer ' + TOKEN; |
| | | } |
| | | const plat = getPlat() |
| | | if (plat == 2) { //微信 |
| | | const OPENID = uni.getStorageSync('OPENID' + plat) || null |
| | | const UNIONID = uni.getStorageSync('UNIONID' + plat) || null |
| | | if (OPENID) { |
| | | x.header['Openid'] = OPENID; |
| | | } |
| | | if (UNIONID) { |
| | | x.header['Unionid'] = UNIONID; |
| | | } |
| | | } |
| | | if (plat == 5) { //支付宝 |
| | | const ALIUSERID = uni.getStorageSync('ALIUSERID' + plat) || null |
| | | if (ALIUSERID) { |
| | | x.header['Aliuserid'] = ALIUSERID; |
| | | } |
| | | } |
| | | if (plat == 15) { //云闪付 |
| | | const UNIONPAYID = uni.getStorageSync('UNIONPAYID ' + plat) || null |
| | | if (UNIONPAYID) { |
| | | x.header['Unionpayid '] = UNIONPAYID; |
| | | } |
| | | } |
| | | return x; |
| | | }, x => { |
| | | return Promise.reject(x) |