Commit c7034aad authored by 郭志伟's avatar 郭志伟

feat: 调整vccChannel

parent a05f3314
// tslint:disable // tslint:disable
import { isAndroid, isIOS, isWechat } from '@/service/utils.service'; import { isAndroid, isIOS, isWxMp } from '@/service/utils.service';
import localStorage from '@/service/localStorage.service'; import localStorage from '@/service/localStorage.service';
import Toast from '@qg/cherry-ui/src/toast'; import Toast from '@qg/cherry-ui/src/toast';
...@@ -12,12 +12,20 @@ function getURLSearchParams(json) { ...@@ -12,12 +12,20 @@ function getURLSearchParams(json) {
return dataArray.filter(item => item !== undefined && item !== null).join('&'); return dataArray.filter(item => item !== undefined && item !== null).join('&');
} }
function getVccChannel() { function getVccChannel(channelKey = 'vccChannel') {
let storageChannel = localStorage.get('vccChannel'); const localChannel = localStorage.get(channelKey) || '';
storageChannel = !isNaN(Number(storageChannel)) ? storageChannel : ''; if (channelKey === 'sonVccChannel') {
return isWechat return localChannel;
? storageChannel || '' }
: (isAndroid ? '159905' : isIOS ? '159904' : storageChannel || ''); return localChannel
? localChannel
: isWxMp
? '159913'
: isAndroid
? '159905'
: isIOS
? '159904'
: '';
} }
export default { export default {
service: { service: {
...@@ -59,6 +67,7 @@ export default { ...@@ -59,6 +67,7 @@ export default {
} }
if (!hideVccChannel) { if (!hideVccChannel) {
cfg.headers['vccChannel'] = getVccChannel(); cfg.headers['vccChannel'] = getVccChannel();
cfg.headers['sonVccChannel'] = getVccChannel('sonVccChannel');
} }
if (method === 'post' && cfg.emulateJSON) { if (method === 'post' && cfg.emulateJSON) {
cfg.headers['Content-Type'] = 'application/x-www-form-urlencoded'; cfg.headers['Content-Type'] = 'application/x-www-form-urlencoded';
......
...@@ -3,7 +3,7 @@ import { isWechat, isApp, errorQueryValues } from './utils.service'; ...@@ -3,7 +3,7 @@ import { isWechat, isApp, errorQueryValues } from './utils.service';
import Cookies from './cookieStorage.service'; import Cookies from './cookieStorage.service';
import localStorage from './localStorage.service'; import localStorage from './localStorage.service';
// formXcxPage:标识是从小程序跳转过来的; // formXcxPage:标识是从小程序跳转过来的;
const localStorageParams = ['creditToken', 'vccToken', 'vccChannel', 'formXcxPage']; const localStorageParams = ['creditToken', 'vccToken', 'vccChannel', 'sonvccChannel', 'formXcxPage'];
const cookiesParams = ['h', 'vccToken']; const cookiesParams = ['h', 'vccToken'];
export default { export default {
......
...@@ -140,7 +140,7 @@ export const isIOS = /iphone|ipad|ipod/.test(ua); ...@@ -140,7 +140,7 @@ export const isIOS = /iphone|ipad|ipod/.test(ua);
export const isAndroid = /android/.test(ua); export const isAndroid = /android/.test(ua);
// 异常字段 // 异常字段
export const errorQueryValues = ['{token}', '{vccToken}', '{registerFrom}', '{vccChannel}', '{h}', '{uuid}', '{}']; export const errorQueryValues = ['{token}', '{vccToken}', '{registerFrom}', '{vccChannel}', '{sonVccChannel}', '{h}', '{uuid}', '{}'];
export const debounce = (event, time) => { export const debounce = (event, time) => {
let timer = null; let timer = null;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment