Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
monorepo
/
venus
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
1
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 4b2b59e7
authored
Apr 10, 2026
by
zhangxw
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix(venus-usedcar-livecode): 扫码加群修改
1 parent
13cd7140
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
1 deletions
apps/web/venus-usedcar-livecode/src/views/scan-livecode/index.vue
apps/web/venus-usedcar-livecode/src/views/scan-livecode/index.vue
View file @
4b2b59e
...
@@ -14,6 +14,9 @@
...
@@ -14,6 +14,9 @@
长按识别二维码加入群
{{
groupName
}}
长按识别二维码加入群
{{
groupName
}}
</div>
</div>
</div>
</div>
<div
v-else
class=
"scan-message"
>
{{
message
||
"加载失败"
}}
</div>
</div>
</div>
</div>
</div>
</
template
>
</
template
>
...
@@ -73,6 +76,16 @@ function removeQueryKeys(urlText: string, keys: string[]) {
...
@@ -73,6 +76,16 @@ function removeQueryKeys(urlText: string, keys: string[]) {
return
url
.
toString
();
return
url
.
toString
();
}
}
function
replaceUrlQuery
(
next
:
(
url
:
URL
)
=>
void
)
{
try
{
const
url
=
new
URL
(
window
.
location
.
href
);
next
(
url
);
window
.
history
.
replaceState
({},
document
.
title
,
url
.
toString
());
}
catch
{
// ignore
}
}
function
resolveWeChatAppId
()
{
function
resolveWeChatAppId
()
{
const
cfg
=
getConfig
()
as
Record
<
string
,
unknown
>
;
const
cfg
=
getConfig
()
as
Record
<
string
,
unknown
>
;
const
candidates
=
((
cfg
.
ssoApiEnv
as
undefined
|
{
codeWechatAppId
?:
string
})?.
codeWechatAppId
??
""
)
as
string
;
const
candidates
=
((
cfg
.
ssoApiEnv
as
undefined
|
{
codeWechatAppId
?:
string
})?.
codeWechatAppId
??
""
)
as
string
;
...
@@ -170,6 +183,26 @@ async function loadQr() {
...
@@ -170,6 +183,26 @@ async function loadQr() {
const
saUserId
=
getFirstQueryValue
([
"saUserId"
,
"sa_user_id"
]);
const
saUserId
=
getFirstQueryValue
([
"saUserId"
,
"sa_user_id"
]);
const
carConditionCode
=
getFirstQueryValue
([
"carConditionCode"
,
"car_condition_code"
]);
const
carConditionCode
=
getFirstQueryValue
([
"carConditionCode"
,
"car_condition_code"
]);
const
code
=
getFirstQueryValue
([
"code"
]);
const
code
=
getFirstQueryValue
([
"code"
]);
const
openIdFromUrl
=
getFirstQueryValue
([
"openId"
,
"openid"
]);
if
(
!
liveCode
||
!
signature
||
!
exp
||
!
nonce
||
!
saUserId
||
!
carConditionCode
)
{
phase
.
value
=
"error"
;
message
.
value
=
"链接参数不完整,请重新扫码进入"
;
return
;
}
if
(
openIdFromUrl
)
{
await
fetchQrByOpenId
({
openId
:
openIdFromUrl
,
liveCode
,
signature
,
exp
,
nonce
,
saUserId
,
carConditionCode
,
});
return
;
}
if
(
!
code
)
{
if
(
!
code
)
{
const
backUrl
=
removeQueryKeys
(
window
.
location
.
href
,
[
"openId"
,
"openid"
,
"code"
,
"state"
]);
const
backUrl
=
removeQueryKeys
(
window
.
location
.
href
,
[
"openId"
,
"openid"
,
"code"
,
"state"
]);
...
@@ -190,9 +223,14 @@ async function loadQr() {
...
@@ -190,9 +223,14 @@ async function loadQr() {
const
openId
=
await
exchangeCodeToOpenId
(
code
);
const
openId
=
await
exchangeCodeToOpenId
(
code
);
if
(
!
openId
)
{
if
(
!
openId
)
{
phase
.
value
=
"error"
;
phase
.
value
=
"error"
;
message
.
value
=
"获取 openid 失败"
;
message
.
value
=
"获取 openid 失败
,请重新扫码进入
"
;
return
;
return
;
}
}
replaceUrlQuery
((
url
)
=>
{
url
.
searchParams
.
delete
(
"code"
);
url
.
searchParams
.
delete
(
"state"
);
url
.
searchParams
.
set
(
"openId"
,
openId
);
});
await
fetchQrByOpenId
({
await
fetchQrByOpenId
({
openId
,
openId
,
liveCode
,
liveCode
,
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment