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
1d26a621
Commit
1d26a621
authored
Jun 06, 2025
by
张九刚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 添加首页数据模拟,更新webview组件逻辑,优化跳转方法
parent
e065dcd9
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
662 additions
and
577 deletions
+662
-577
home.js
mock/home.js
+192
-0
webview.vue
pages/webview/webview.vue
+3
-3
index.js
utils/index.js
+49
-0
Home.vue
views/Home.vue
+418
-574
No files found.
mock/home.js
0 → 100644
View file @
1d26a621
export
const
homeObj
=
{
swiperList
:
[{
url
:
'homepage/banner1.jpg'
,
link
:
{
type
:
1
,
url
:
'/pages/product/product?id:1-1'
}
},
{
url
:
'homepage/banner2.jpg'
,
link
:
{
type
:
2
,
url
:
'pages/product/product?id:1-1'
,
extra
:
{
appId
:
'wx1234567890abcdef'
,
envVersion
:
'release'
}
}
},
{
url
:
'homepage/banner3.jpg'
,
link
:
{
type
:
3
,
url
:
'https://www.baidu.com'
,
extra
:
{
}
}
},
],
vipCardList
:
[{
level
:
"钻石会员"
,
subTitle
:
"育儿课程权益"
,
btnTitle
:
"12类系列课程"
,
btnSubTitle
:
"立即领取"
,
showCornerTxt
:
"待领取"
,
link
:
"www.baidu.com"
,
bgUrl
:
"homepage/cardbg1.png"
},
{
level
:
"北纬47°系列"
,
subTitle
:
"来自万年黑土的健康食品"
,
btnTitle
:
""
,
btnSubTitle
:
""
,
showCornerTxt
:
""
,
link
:
""
,
bgUrl
:
"homepage/cardbg2.png"
},
{
level
:
"育儿宝典"
,
subTitle
:
"专家文章、育儿知识、饮食知识"
,
btnTitle
:
""
,
btnSubTitle
:
""
,
showCornerTxt
:
""
,
link
:
""
,
bgUrl
:
"homepage/cardbg3.png"
},
],
contentImgList
:
[{
bgUrl
:
'homepage/content_1.png'
,
link
:
'www.baidu.com'
,
_style
:
'width:311rpx;height: 324rpx;left: 40rpx;top: 0;'
},
{
bgUrl
:
'homepage/content_2.png'
,
link
:
'www.baidu.com'
,
_style
:
'width:263rpx;height: 324rpx;right: 40rpx;top: 400rpx;'
},
{
bgUrl
:
'homepage/content_3.png'
,
link
:
'www.baidu.com'
,
_style
:
'width:418rpx;height: 345rpx;left: 40rpx;top: 750rpx;'
},
{
bgUrl
:
'homepage/content_4.png'
,
link
:
'www.baidu.com'
,
_style
:
'width:263rpx;height: 324rpx;right: 40rpx;top: 1120rpx;'
}
],
channelTabList
:
[
"凯叔讲故事"
,
"哄睡故事"
,
"知识科普"
,
"安全意识"
,
"社交能力"
],
changelInfoList
:
[
[{
bgUrl
:
"homepage/channel_0_1.png"
,
title
:
"凯叔·金子美铃童诗:【星星和蒲公英】"
,
link
:
"www.baidu.com"
},
{
bgUrl
:
"homepage/channel_0_1.png"
,
title
:
"凯叔·金子美铃童诗:【天空和海】"
,
link
:
"www.baidu.com"
}
],
[{
bgUrl
:
"homepage/channel_1_1.png"
,
title
:
"凯叔-小睡仙:【睡吧睡吧,香香的】"
,
link
:
"www.baidu.com"
},
{
bgUrl
:
"homepage/channel_1_1.png"
,
title
:
"凯叔-小睡仙:【睡觉仙气,3,2,1,】"
,
link
:
"www.baidu.com"
}
],
[{
bgUrl
:
"homepage/channel_2_1.png"
,
title
:
"教宝宝认识人体:【守护眼睛的睫毛】"
,
link
:
"www.baidu.com"
},
{
bgUrl
:
"homepage/channel_2_1.png"
,
title
:
"教宝宝认识人体:【为什么肚子会咕咕叫?】"
,
link
:
"www.baidu.com"
}
],
[{
bgUrl
:
"homepage/channel_3_1.png"
,
title
:
"教宝宝不乱吃东西:【这个不能吃】"
,
link
:
"www.baidu.com"
},
{
bgUrl
:
"homepage/channel_3_1.png"
,
title
:
"培养宝宝不摸插座的安全意识:【电线插座不好玩】"
,
link
:
"www.baidu.com"
}
],
[{
bgUrl
:
"homepage/channel_4_1.png"
,
title
:
"教会宝宝不嘲笑别人:【鹤鸟】"
,
link
:
"www.baidu.com"
},
{
bgUrl
:
"homepage/channel_4_1.png"
,
title
:
"培养宝宝尊重别人的习惯:【爱嘲笑人的斑斑】"
,
link
:
"www.baidu.com"
}
]
],
childrenInfoList
:
[{
bgUrl
:
"homepage/children_0.png"
,
title
:
"1+3 育儿妙招大揭秘,带娃从此不“蕉绿”"
,
link
:
"www.baidu.com"
},
{
bgUrl
:
"homepage/children_1.png"
,
title
:
"已有儿童中招,严重可瘫痪夏季防蜱虫最全指南速看"
,
link
:
"www.baidu.com"
},
{
bgUrl
:
"homepage/children_2.png"
,
title
:
"99% 家长忽略的脑发育关键动作"
,
link
:
"www.baidu.com"
}
]
,
bottomLinkList
:
[{
bgUrl
:
"homepage/iconwx.png"
,
link
:
"www.baidu.com"
,
_style
:
"width:70rpx;height:109rpx;"
},
{
bgUrl
:
"homepage/iconqw.png"
,
link
:
"www.baidu.com"
,
_style
:
"width:95rpx;height:109rpx;"
},
{
bgUrl
:
"homepage/iconsph.png"
,
link
:
"www.baidu.com"
,
_style
:
"width:70rpx;height:109rpx;"
},
{
bgUrl
:
"homepage/iconxhs.png"
,
link
:
"www.baidu.com"
,
_style
:
"width:88rpx;height:99rpx;"
}
],
qrInfoList
:
[{
title
:
"公众号"
,
desc
:
"扫码关注<span style:'color:#D3A358;'>星妈会</span>公众号,了解更多专业育儿资讯"
,
qrUrl
:
"homepage/qrcode_gzh.png"
},
{
title
:
"企业微信"
,
desc
:
"扫码添加<span style:'color:#D3A358;'>星妈管家</span>企微,了解更多专业育儿资讯"
,
qrUrl
:
"homepage/qrcode_qw.png"
},
{
title
:
"视频号"
,
desc
:
"扫码关注<span style:'color:#D3A358;'>星妈会</span>视频号,了解更多专业育儿资讯"
,
qrUrl
:
"homepage/qrcode_sph.png"
},
]
}
\ No newline at end of file
pages/webview/webview.vue
View file @
1d26a621
...
@@ -7,7 +7,7 @@ import { ref } from "vue";
...
@@ -7,7 +7,7 @@ import { ref } from "vue";
import
{
onLoad
}
from
"@dcloudio/uni-app"
;
import
{
onLoad
}
from
"@dcloudio/uni-app"
;
import
*
as
CFG
from
"@/cfg"
;
import
*
as
CFG
from
"@/cfg"
;
cons
t
src
=
ref
(
""
);
le
t
src
=
ref
(
""
);
onLoad
((
options
)
=>
{
onLoad
((
options
)
=>
{
let
url
=
""
;
let
url
=
""
;
...
@@ -16,9 +16,9 @@ onLoad((options) => {
...
@@ -16,9 +16,9 @@ onLoad((options) => {
const
type
=
options
.
type
;
const
type
=
options
.
type
;
url
=
CFG
[
type
];
url
=
CFG
[
type
];
}
else
{
}
else
{
url
=
options
.
url
||
""
;
url
=
decodeURIComponent
(
options
.
url
)
||
""
;
}
}
src
.
value
=
url
;
src
.
value
=
url
;
});
});
</
script
>
</
script
>
\ No newline at end of file
utils/index.js
0 → 100644
View file @
1d26a621
// 跳转类型枚举
export
const
JumpType
=
{
INNER
:
1
,
// 内部小程序页面跳转
MINI
:
2
,
// 其他小程序页面跳转
H5
:
3
// https 网络连接跳转
}
/**
* 通用跳转方法
* @param {Object} options
* @param {number} options.type 跳转类型(1-内部,2-小程序,3-H5)
* @param {string} options.url 跳转地址(页面路径/小程序路径/https链接)
* @param {Object} [options.extra] 额外参数(如 appId、extraData 等)
*/
export
function
jump
({
type
,
url
,
extra
=
{}
})
{
switch
(
type
)
{
case
JumpType
.
INNER
:
// 内部小程序页面跳转
uni
.
navigateTo
({
url
,
...
extra
})
break
;
case
JumpType
.
MINI
:
// 跳转到其他小程序页面
uni
.
navigateToMiniProgram
({
appId
:
extra
.
appId
||
''
,
path
:
url
,
extraData
:
extra
.
extraData
||
{},
envVersion
:
extra
.
envVersion
||
'release'
,
success
:
extra
.
success
,
fail
:
extra
.
fail
})
break
;
case
JumpType
.
H5
:
// 跳转到 https 网络链接
if
(
/^https
?
:
\/\/
/
.
test
(
url
))
{
// uni-app 推荐用 webview 页面承载 H5
uni
.
navigateTo
({
url
:
`/pages/webview/webview?url=
${
encodeURIComponent
(
url
)}
`
})
}
else
{
console
.
error
(
'H5 跳转地址必须为 https 链接'
)
}
break
;
default
:
console
.
error
(
'不支持的跳转类型'
)
}
}
views/Home.vue
View file @
1d26a621
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