Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
飞
飞鹤小程序
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
FH
飞鹤小程序
Commits
9c7f07b8
Commit
9c7f07b8
authored
Sep 25, 2025
by
lg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: activity/index支持传入url打开
parent
6465f253
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
415 additions
and
368 deletions
+415
-368
index.vue
pages/activity/index.vue
+49
-16
gen-webview-urls.js
scripts/gen-webview-urls.js
+16
-10
user.js
stores/user.js
+350
-342
No files found.
pages/activity/index.vue
View file @
9c7f07b8
...
...
@@ -7,16 +7,18 @@ import {ref, watch, nextTick} from "vue";
import
{
onLoad
,
onShow
,
onShareAppMessage
,
onShareTimeline
}
from
"@dcloudio/uni-app"
;
import
{
useGlobalStore
}
from
"../../stores/global"
;
import
{
useUserStore
}
from
"../../stores/user"
;
import
{
jump
,
JumpType
}
from
"../../utils"
;
const
userStore
=
useUserStore
();
const
globalStore
=
useGlobalStore
()
function
getRegistered
()
{
return
userStore
?.
userInfo
?.
memberId
!
=
"not_login"
return
userStore
.
userInfo
?.
memberId
!=
=
"not_login"
}
const
pageOptions
=
ref
({})
const
src
=
ref
(
""
);
const
registered
=
ref
(
getRegistered
()
)
const
registered
=
ref
(
false
)
const
urlMap
=
{
//'main': 'http://192.168.0.5:8001/#/page',
...
...
@@ -29,8 +31,8 @@ onShow(() => {
registered
.
value
=
getRegistered
()
})
watch
(()
=>
registered
.
value
,
(
newVal
)
=>
{
if
(
newVal
)
{
watch
(()
=>
registered
.
value
,
(
newVal
,
oldVal
)
=>
{
if
(
newVal
!==
oldVal
)
{
const
oldSrc
=
src
.
value
src
.
value
=
''
...
...
@@ -40,39 +42,70 @@ watch(() => registered.value, (newVal) => {
}
})
onLoad
((
options
)
=>
{
console
.
log
(
'页面参数:'
,
options
)
function
joinUrlAndQs
(
url
,
qs
)
{
return
qs
?
url
+
(
url
.
includes
(
'?'
)
?
(
url
.
endsWith
(
'?'
)
?
''
:
'&'
)
:
'?'
)
+
qs
:
url
}
wx
.
showShareMenu
(
{
withShareTicket
:
true
,
menus
:
[
'shareAppMessage'
,
'shareTimeline'
]
}
)
function
initOk
()
{
console
.
log
(
userStore
.
userInfo
)
registered
.
value
=
getRegistered
(
)
let
url
=
""
;
const
options
=
pageOptions
.
value
if
(
options
.
type
)
{
const
type
=
options
.
type
;
url
=
urlMap
[
type
];
}
else
if
(
options
.
url
)
{
url
=
decodeURIComponent
(
options
.
url
)
}
const
params
=
{...(
options
||
{})}
delete
params
.
type
delete
params
.
params
const
params
=
{}
const
{
unionId
,
cuk
}
=
globalStore
if
(
unionId
&&
!
params
.
unionId
)
params
.
unionId
=
unionId
if
(
cuk
&&
!
params
.
cuk
)
params
.
cuk
=
cuk
const
{
memberId
}
=
userStore
.
userInfo
if
(
memberId
)
params
.
crmId
=
memberId
const
paramStr
=
Object
.
keys
(
params
)
.
filter
(
key
=>
params
[
key
]
!==
undefined
&&
params
[
key
]
!==
null
&&
params
[
key
]
!==
''
)
.
map
(
key
=>
`
${
key
}
=
${
encodeURIComponent
(
params
[
key
])}
`
)
.
join
(
'&'
)
url
=
paramStr
?
url
+
(
url
.
includes
(
'?'
)
?
'&'
:
'?'
)
+
paramStr
+
(
options
.
params
?
'&'
+
decodeURIComponent
(
options
.
params
)
:
''
)
:
url
url
=
joinUrlAndQs
(
url
,
paramStr
)
if
(
options
.
params
){
url
=
joinUrlAndQs
(
url
,
decodeURIComponent
(
options
.
params
))
}
src
.
value
=
url
console
.
log
(
'webview url:'
,
url
)
}
onLoad
(
async
(
options
)
=>
{
pageOptions
.
value
=
options
console
.
log
(
'页面参数:'
,
options
)
wx
.
showShareMenu
({
withShareTicket
:
true
,
menus
:
[
'shareAppMessage'
,
'shareTimeline'
]
})
await
userStore
.
normalAutoLogin
()
await
userStore
.
loadUserInfo
()
if
(
!
registered
.
value
)
{
jump
({
type
:
JumpType
.
INNER
,
url
:
'/pages/activity/register'
,
})
}
else
{
initOk
()
}
});
function
onMessage
(
e
)
{
...
...
scripts/gen-webview-urls.js
View file @
9c7f07b8
const
hosts
=
[
{
value
:
'https://guide-api.feihe.com'
,
alias
:
'生产环境'
},
{
value
:
'https://guide-api-test.feihe.com'
,
alias
:
'test环境'
},
{
value
:
'https://guide-api-uat.feihe.com'
,
alias
:
'uat环境'
},
{
value
:
'https://guide-api.feihe.com'
,
alias
:
'生产环境'
},
{
value
:
'https://guide-api-test.feihe.com'
,
alias
:
'test环境'
},
{
value
:
'https://guide-api-uat.feihe.com'
,
alias
:
'uat环境'
},
]
const
pages
=
[
{
value
:
'/mini/#/page/momHome/index'
,
alias
:
'妈妈爱活动'
},
{
value
:
'/mini/#/page/home/index
'
,
alias
:
'路演活动'
},
{
value
:
'/mini/#/page/momHome/index'
,
alias
:
'妈妈爱活动'
},
{
value
:
'/mini/#/page/home/index?page_source=3
'
,
alias
:
'路演活动'
},
]
const
mpPage
=
'/pages/webview/webview'
const
mpPage
=
'pages/activity/index'
function
joinUrlAndQs
(
url
,
qs
)
{
return
qs
?
url
+
(
url
.
includes
(
'?'
)
?
(
url
.
endsWith
(
'?'
)
?
''
:
'&'
)
:
'?'
)
+
qs
:
url
}
for
(
const
page
of
pages
)
{
for
(
const
host
of
hosts
)
{
const
url
=
`
${
mpPage
}
?url=
${
encodeURIComponent
(
host
.
value
+
page
.
value
)}
`
console
.
log
(
`
${
page
.
alias
}
-
${
host
.
alias
}
:
${
url
}
`
)
}
for
(
const
host
of
hosts
)
{
const
url
=
joinUrlAndQs
(
mpPage
,
`url=
${
encodeURIComponent
(
host
.
value
+
page
.
value
)}
`
)
console
.
log
(
`
${
page
.
alias
}
-
${
host
.
alias
}
:
${
url
}
`
)
}
}
stores/user.js
View file @
9c7f07b8
This diff is collapsed.
Click to expand it.
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