Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cmb_auth
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
wildfirecode13
cmb_auth
Commits
db60117a
Commit
db60117a
authored
Oct 12, 2021
by
wildfirecode13
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
11
parent
aba60b44
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
39 deletions
+28
-39
sparkrc.js
sparkrc.js
+2
-2
apicfg.js
src/api/apicfg.js
+1
-0
app.jsx
src/app.jsx
+25
-37
No files found.
sparkrc.js
View file @
db60117a
...
@@ -9,6 +9,6 @@ module.exports ={
...
@@ -9,6 +9,6 @@ module.exports ={
"IMAGE_Q1"
:
0.6
,
"IMAGE_Q1"
:
0.6
,
"IMAGE_Q2"
:
0.8
,
"IMAGE_Q2"
:
0.8
,
"RES_PATH"
:
"/src/assets/"
,
"RES_PATH"
:
"/src/assets/"
,
"RES_PATH_PROD"
:
"//yun.duiba.com.cn/spark/v2/temp_base/163
3933001451
"
,
"RES_PATH_PROD"
:
"//yun.duiba.com.cn/spark/v2/temp_base/163
4022939646
"
,
"JS_PATH_PROD"
:
"https://yun.duiba.com.cn/spark/v2/temp_base/163
3933004136
/js"
"JS_PATH_PROD"
:
"https://yun.duiba.com.cn/spark/v2/temp_base/163
4022941783
/js"
}
}
\ No newline at end of file
src/api/apicfg.js
View file @
db60117a
const
apiCfg
=
{
const
apiCfg
=
{
getRule
:
`projectRule.query`
,
getRule
:
`projectRule.query`
,
getLoginUser
:
`/customActivity/getLoginUser`
,
generateApproval
:
`/chw/cmbautologin/generateApproval`
,
generateApproval
:
`/chw/cmbautologin/generateApproval`
,
generateLoginUrl
:
`/chw/cmbautologin/generateLoginUrl`
,
generateLoginUrl
:
`/chw/cmbautologin/generateLoginUrl`
,
doJoin
:
{
doJoin
:
{
...
...
src/app.jsx
View file @
db60117a
...
@@ -15,49 +15,41 @@ MD();
...
@@ -15,49 +15,41 @@ MD();
class
App
extends
Component
{
class
App
extends
Component
{
async
componentDidMount
()
{
async
componentDidMount
()
{
const
url
=
'https://activity.m.duibatest.com.cn/projectx/p19dcfe16/index.html'
;
const
callBackUrl
=
'http%3A%2F%2Factivity.m.duibatest.com.cn%2Fprojectx%2Fp19dcfe16%2Findex.html'
;
const
callBackUrl
=
url
+
'?iscallback=1'
;
const
redirectUrl
=
url
+
'?isredirect=1'
;
let
activityId
=
CFG
.
projectId
;
let
activityId
=
CFG
.
projectId
;
let
{
code
,
testact
,
iscallback
,
cmbdata
}
=
queryParams
;
let
{
testact
,
iscallback
,
cmbdata
,
isredirect
}
=
queryParams
;
if
(
testact
==
1
)
activityId
=
'p19dcfe16'
;
if
(
testact
==
1
)
activityId
=
'p19dcfe16'
;
cmbdata
=
'%7B%22respMsg%22%3A%22%E6%93%8D%E4%BD%9C%E6%88%90%E5%8A%9F%EF%BC%81%22%2C%22mid%22%3A%221611e17549f83f6d83c77822d0bf7bef%22%2C%22state%22%3A%22state%22%2C%22cmbKeyAlias%22%3A%22SM2_CMBLIFE%22%2C%22iscallback%22%3A%221%22%2C%22respCode%22%3A%221000%22%2C%22scope%22%3A%22defaultScope%22%2C%22code%22%3A%225394c93d48144ab8806e203%22%2C%22date%22%3A%2220211008174532%22%2C%22aid%22%3A%226b9a76cce8b54060a3a31867c4c9281d%22%2C%22sign%22%3A%22MEUCIFL%2BScttTBRCZTOYcC5IhFHJ5B%5C%2FwF6oykB7LyliFpqdnAiEA5Z%5C%2FT3HyYLk2XnSWNkHgNDbpD2Fq6r5FJ9tTR3MwEBXw%3D%22%7D'
;
setTimeout
(()
=>
{
setTimeout
(()
=>
{
console
.
error
(
'queryParams'
,
JSON
.
stringify
(
queryParams
));
console
.
error
(
'queryParams'
,
JSON
.
stringify
(
queryParams
));
console
.
error
(
'cmbdata'
,
decodeURIComponent
(
cmbdata
));
console
.
error
(
'cmbdata'
,
decodeURIComponent
(
cmbdata
));
},
1000
);
},
1000
);
if
(
iscallback
)
{
//获取到code
if
(
isredirect
)
{
// const generateLoginUrlResult = await API.generateLoginUrl({
API
.
getLoginUser
({}).
then
(
data
=>
{
// redirectUrl: "https://activity.m.duibatest.com.cn/projectx/p19dcfe16/index.html",
console
.
error
(
'getLoginUser'
,
data
)
// cmbData: {"respMsg":"操作成功!","mid":"1611e17549f83f6d83c77822d0bf7bef","state":"state","cmbKeyAlias":"SM2_CMBLIFE","iscallback":"1","respCode":"1000","scope":"defaultScope","code":"90a3949b9be8475cb6c6477","date":"20211009165946","aid":"6b9a76cce8b54060a3a31867c4c9281d","sign":"MEUCIDK9SphQlaB0rbpEl39bowbdsElr2NTMz1d\/VrvU+GuLAiEAn5STY+mz\/PuRQ991cCp63dPkNVR7OIaasbGSlJztFq0="},
});
// // cmbData: decodeURIComponent(cmbdata),
}
// activityId: activityId
else
if
(
iscallback
)
{
//行方返回
// });
const
data
=
{
const
data
=
{
redirectUrl
:
"https://activity.m.duibatest.com.cn/projectx/p19dcfe16/index.html"
,
redirectUrl
:
redirectUrl
,
cmbData
:{
"respMsg"
:
"操作成功!"
,
"mid"
:
"1611e17549f83f6d83c77822d0bf7bef"
,
"state"
:
"state"
,
"cmbKeyAlias"
:
"SM2_CMBLIFE"
,
"iscallback"
:
"1"
,
"respCode"
:
"1000"
,
"scope"
:
"defaultScope"
,
"code"
:
"42593e323f4c416db7ba658"
,
"date"
:
"20211011141335"
,
"aid"
:
"6b9a76cce8b54060a3a31867c4c9281d"
,
"sign"
:
"MEUCIFXNWTdsXXGi
\
/eRn1YNpiQu
\
/aMzJ8dJRPdHkQdWbZ5xDAiEAlx3oa2we1DsBSVo8aNVMQb1WUtGQ
\
/hzYrjzU9OCQyU4="
},
cmbData
:
JSON
.
parse
(
decodeURIComponent
(
cmbdata
)),
// cmbData: decodeURIComponent(cmbdata),
activityId
:
activityId
activityId
:
activityId
};
};
ajaxImg
(
const
generateLoginUrlResult
=
await
ajaxImg
(
'/chw/cmbautologin/generateLoginUrl'
,
'/chw/cmbautologin/generateLoginUrl'
,
JSON
.
stringify
(
data
)
JSON
.
stringify
(
data
)
)
)
// location.href = generateLoginUrlResult.data;
}
else
{
//没有获取到code
const
protocol
=
'cmblife://approval?aid=6b9a76cce8b54060a3a31867c4c9281d&callback=https%3A%2F%2Factivity.m.duibatest.com.cn%2Fprojectx%2Fp19dcfe16%2Findex.html%3Fiscallback%3D1&clientType=h5&date=20211011141215&keyAlias=CO_PUB_KEY_SM2&mid=1611e17549f83f6d83c77822d0bf7bef&random=2e3dd8420301435caf8e42c87c7a0058&responseType=code&scope=defaultScope&sign=MEUCIQDZ7LkU98LwvlCb40UlgBWS%2ByAugW7kSlZn5F2%2FAJE%2B3QIgKKZ4ZR9d5i4ma5IF8il6VsDMuzhvD5%2BShG87L6ymlYM%3D&state=state'
;
setTimeout
(()
=>
{
setTimeout
(()
=>
{
window
.
location
.
href
=
protocol
;
console
.
error
(
'generateLoginUrlResult'
,
generateLoginUrlResult
)
},
100
);
},
1000
);
location
.
href
=
generateLoginUrlResult
.
data
;
}
else
{
//没有获取到code
//请求授权协议,需要如果是同一活动需求区分是起始页还是授权回调页,注意开头要https
//请求授权协议
//请求授权协议
// const result = await API.generateApproval({
// const result = await API.generateApproval({
...
@@ -65,16 +57,12 @@ class App extends Component {
...
@@ -65,16 +57,12 @@ class App extends Component {
// callBackUrl: callBackUrl
// callBackUrl: callBackUrl
// });
// });
// const protocol = result.data;
// const protocol = result.data;
// setTimeout(() => {
// console.error('protocol', protocol)
// }, 1000);
// console.error(202)
// const protocol = 'cmblife://approval?aid=9dad6d3900ec3ffabd80e46522a10ead&callback=https%3A%2F%2Ftest.com%2Fmerchant%2FapprovalCallback.html&clientType=h5&date=20210930134315&keyAlias=CO_PUB_KEY_SM2&mid=f806c259d86e3b9aa956c98d475b6af7&random=6d5e7923308d489b969376cdb448072c&responseType=code&scope=defaultScope&sign=MEUCICIfC6OJFUUHYAIKlswzWvy2H%2BCPSyebZLb48OoTdqRaAiEA6UlFWD2Qd6OHBC0Cd69kFuu8%2FplOiddP%2FCcdokhPPoE%3D&state=state';
// var redirectUrl = "https://open.cmbchina.com/DevEnv/redirect/auth"
// + "?protocol=" + encodeURIComponent(protocol)
// + "&merchantApprovalUrl=" + encodeURIComponent(window.location.href);
// window.location.href = protocol;
const
protocol
=
'cmblife://approval?aid=6b9a76cce8b54060a3a31867c4c9281d&callback=https%3A%2F%2Factivity.m.duibatest.com.cn%2Fprojectx%2Fp19dcfe16%2Findex.html%3Fiscallback%3D1&clientType=h5&date=20211012150848&keyAlias=CO_PUB_KEY_SM2&mid=1611e17549f83f6d83c77822d0bf7bef&random=975fc466216e4ccc8f37668a7928cc64&responseType=code&scope=defaultScope&sign=MEUCIF5YBj%2Brgp%2FSqBN%2BBRwvR7evMVLs41d6mXgHzOw3cFQfAiEAkEo0j0AEeeWBYNFPIi7e6LiQvZ5m54aMei22Y7i91Kw%3D&state=state'
setTimeout
(()
=>
{
console
.
error
(
'protocol'
,
protocol
)
},
1000
);
window
.
location
.
href
=
protocol
;
}
}
}
}
...
...
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