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

Merge branch 'feat/h5herf' into 'master'

Feat/h5herf

See merge request !29
parents 8b22e96b 19d2c91e
......@@ -7,6 +7,7 @@ import { release } from '@/.sentryclirc';
import '@/service/qg.service';
import SaDirective from '@qg/citrus-ui/src/helper/directives/saTrack.directive.js';
import config from '@qg/citrus-ui/src/config/index.js';
import { getParameterByName } from '../../../service/utils.service';
import lazyload from '@qg/cherry-ui/src/lazyload/index';
// 初始化sentry
......@@ -27,7 +28,8 @@ if (process.env.SENTRY_ENV !== 'test' && process.env.NODE_ENV === 'production')
if (EASY_ENV_IS_BROWSER) {
const isSafari = /^.*((iPhone)|(iPad)|(Safari))+.*$/;
if (isSafari.test(navigator.userAgent)) {
const fromHost = getParameterByName('fromHost', window.location.href);
if (isSafari.test(navigator.userAgent) && fromHost?.indexOf('xc.bmall') === -1 && fromHost?.indexOf('tob') === -1) {
window.onpageshow = function(e) {
if (e.persisted || (window.performance && window.performance.navigation.type == 2)) {
window.location.reload();
......
// 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 Toast from '@qg/cherry-ui/src/toast';
......@@ -12,12 +12,20 @@ function getURLSearchParams(json) {
return dataArray.filter(item => item !== undefined && item !== null).join('&');
}
function getVccChannel() {
let storageChannel = localStorage.get('vccChannel');
storageChannel = !isNaN(Number(storageChannel)) ? storageChannel : '';
return isWechat
? storageChannel || ''
: (isAndroid ? '159905' : isIOS ? '159904' : storageChannel || '');
function getVccChannel(channelKey = 'vccChannel') {
const localChannel = localStorage.get(channelKey) || '';
if (channelKey === 'sonVccChannel') {
return localChannel;
}
return localChannel
? localChannel
: isWxMp
? '159913'
: isAndroid
? '159905'
: isIOS
? '159904'
: '';
}
export default {
service: {
......@@ -59,6 +67,7 @@ export default {
}
if (!hideVccChannel) {
cfg.headers['vccChannel'] = getVccChannel();
cfg.headers['sonVccChannel'] = getVccChannel('sonVccChannel');
}
if (method === 'post' && cfg.emulateJSON) {
cfg.headers['Content-Type'] = 'application/x-www-form-urlencoded';
......
......@@ -3,7 +3,7 @@ import { isWechat, isApp, errorQueryValues } from './utils.service';
import Cookies from './cookieStorage.service';
import localStorage from './localStorage.service';
// formXcxPage:标识是从小程序跳转过来的;
const localStorageParams = ['creditToken', 'vccToken', 'vccChannel', 'formXcxPage'];
const localStorageParams = ['creditToken', 'vccToken', 'vccChannel', 'sonVccChannel', 'formXcxPage'];
const cookiesParams = ['h', 'vccToken'];
export default {
......
......@@ -21,6 +21,7 @@ export function initSa(router) {
use_app_track: true,
show_log: config.test,
app_js_bridge: true,
batch_send:true,
});
// 添加公共属性
sa.registerPage({
......
......@@ -140,7 +140,7 @@ export const isIOS = /iphone|ipad|ipod/.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) => {
let timer = null;
......
......@@ -23,6 +23,7 @@ export default (appInfo: EggAppConfig) => {
};
config.logger = {
outputJSON: true,
consoleLevel: 'DEBUG',
dir: path.join(appInfo.baseDir, 'logs')
};
......
......@@ -1658,9 +1658,9 @@
}
},
"@qg/citrus-ui": {
"version": "0.2.9",
"resolved": "http://npmprivate.quantgroups.com/@qg%2fcitrus-ui/-/citrus-ui-0.2.9.tgz",
"integrity": "sha512-jEWtFHN5MOIT0l9UMM4IZ+s5ohgP4ecAmctQi4Z5Gu98VcWEg5itP+skK7JPbLV4tLV/z3zdHW606WxUS2n8eA==",
"version": "0.2.18",
"resolved": "http://npmprivate.quantgroups.com/@qg%2fcitrus-ui/-/citrus-ui-0.2.18.tgz",
"integrity": "sha512-GMcMbG8SBR6ZFOOeP7Zp9nPbs4j2cN1YrtZgE/yFxeoaCVKA4Sm+llRRVD3ZpYp5J4nmMztOvHlu+upy24yF4A==",
"requires": {
"@better-scroll/core": "^2.1.1",
"@qg/cherry-ui": "^2.21.1",
......@@ -20877,9 +20877,9 @@
"integrity": "sha1-8z/pz7Urv9UgqhgyO8ZdsRCht2w="
},
"rollup": {
"version": "2.54.0",
"resolved": "http://npmprivate.quantgroups.com/rollup/-/rollup-2.54.0.tgz",
"integrity": "sha512-RHzvstAVwm9A751NxWIbGPFXs3zL4qe/eYg+N7WwGtIXVLy1cK64MiU37+hXeFm1jqipK6DGgMi6Z2hhPuCC3A==",
"version": "2.56.2",
"resolved": "http://npmprivate.quantgroups.com/rollup/-/rollup-2.56.2.tgz",
"integrity": "sha512-s8H00ZsRi29M2/lGdm1u8DJpJ9ML8SUOpVVBd33XNeEeL3NVaTiUcSBHzBdF3eAyR0l7VSpsuoVUGrRHq7aPwQ==",
"requires": {
"fsevents": "~2.3.2"
},
......@@ -20956,9 +20956,9 @@
}
},
"sa-sdk-javascript": {
"version": "1.18.8",
"resolved": "http://npmprivate.quantgroups.com/sa-sdk-javascript/-/sa-sdk-javascript-1.18.8.tgz",
"integrity": "sha512-7wBTX+IKqfWSfARJDW2hsABYkcByRwWFTwUzIMc3mxOGNQLP9IgAdc/BvEPrppKDp02pElzSVr+x3cqeLIDMgQ=="
"version": "1.18.12",
"resolved": "http://npmprivate.quantgroups.com/sa-sdk-javascript/-/sa-sdk-javascript-1.18.12.tgz",
"integrity": "sha512-D4ov1/fwhYKdUoG2bvX1gjSgMY2/5oIyGH3g1dH8pTLfJB1L3dHXXTSz18u1mJ1TfbGIcgCtgVCH3kd8B7FF2Q=="
},
"safe-buffer": {
"version": "5.2.1",
......
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