Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
quantum-blocks-h5
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ui
quantum-blocks-h5
Commits
c7034aad
Commit
c7034aad
authored
Aug 09, 2021
by
郭志伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 调整vccChannel
parent
a05f3314
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
9 deletions
+18
-9
http.config.ts
app/web/config/http.config.ts
+16
-7
init.service.ts
app/web/service/init.service.ts
+1
-1
utils.service.ts
app/web/service/utils.service.ts
+1
-1
No files found.
app/web/config/http.config.ts
View file @
c7034aad
// tslint:disable
import
{
isAndroid
,
isIOS
,
isW
echat
}
from
'
@/service/utils.service
'
;
import
{
isAndroid
,
isIOS
,
isW
xMp
}
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
'
;
...
...
app/web/service/init.service.ts
View file @
c7034aad
...
...
@@ -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
{
...
...
app/web/service/utils.service.ts
View file @
c7034aad
...
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment