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
03b014b8
Commit
03b014b8
authored
May 28, 2025
by
tao.huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复动态组件不支持问题
parent
db0f2a3e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
331 additions
and
10 deletions
+331
-10
.gitignore
.gitignore
+1
-0
My.vue
components/My.vue
+326
-8
index.vue
pages/index/index.vue
+4
-2
No files found.
.gitignore
0 → 100644
View file @
03b014b8
unpackage
components/My.vue
View file @
03b014b8
<
template
>
<
template
>
<view
class=
"my-container"
>
<view
class=
"my-container"
>
<view
class=
"content"
>
<!-- 用户信息区域 -->
<!-- 我的页面内容 -->
<view
class=
"user-info"
>
<text>
我的页面内容
</text>
<view
class=
"user-header"
>
<image
class=
"avatar"
:src=
"userInfo.avatar || '/static/my/avatar.png'"
mode=
"aspectFill"
/>
<view
class=
"user-detail"
>
<text
class=
"nickname"
>
{{
userInfo
.
nickname
||
'未登录'
}}
</text>
<view
class=
"user-level"
>
<image
class=
"level-icon"
src=
"/static/my/level.png"
mode=
"aspectFit"
/>
<text
class=
"level-text"
>
Lv.
{{
userInfo
.
level
||
1
}}
</text>
</view>
</view>
<view
class=
"edit-btn"
@
tap=
"handleEditProfile"
>
<image
src=
"/static/my/edit.png"
mode=
"aspectFit"
/>
</view>
</view>
</view>
</view>
</view>
</view>
</
template
>
</
template
>
<
script
setup
>
<
script
setup
>
// 我的页面组件逻辑
import
{
ref
,
onMounted
}
from
'vue'
// 用户信息
const
userInfo
=
ref
({
avatar
:
''
,
nickname
:
''
,
level
:
1
,
points
:
0
,
coupons
:
0
,
collects
:
0
})
// 订单数量统计
const
orderCounts
=
ref
({
pending
:
0
,
shipping
:
0
,
receiving
:
0
,
comment
:
0
,
after
:
0
})
// 页面跳转
const
navigateTo
=
(
url
)
=>
{
uni
.
navigateTo
({
url
,
fail
:
(
err
)
=>
{
console
.
error
(
'页面跳转失败:'
,
err
)
uni
.
showToast
({
title
:
'页面跳转失败'
,
icon
:
'none'
})
}
})
}
// 编辑个人资料
const
handleEditProfile
=
()
=>
{
navigateTo
(
'/pages/user/profile'
)
}
// 联系客服
const
handleContactService
=
()
=>
{
// #ifdef MP-WEIXIN
uni
.
openCustomerServiceChat
({
extInfo
:
{
url
:
'YOUR_CUSTOMER_SERVICE_URL'
},
corpId
:
'YOUR_CORP_ID'
,
success
(
res
)
{
console
.
log
(
'打开客服会话成功'
)
},
fail
(
err
)
{
console
.
error
(
'打开客服会话失败:'
,
err
)
uni
.
showToast
({
title
:
'打开客服会话失败'
,
icon
:
'none'
})
}
})
// #endif
// #ifdef H5
window
.
open
(
'YOUR_CUSTOMER_SERVICE_URL'
,
'_blank'
)
// #endif
}
// 获取用户信息
const
getUserInfo
=
async
()
=>
{
try
{
// TODO: 调用获取用户信息接口
const
res
=
await
uni
.
request
({
url
:
'/api/user/info'
,
method
:
'GET'
})
if
(
res
.
data
.
code
===
0
)
{
userInfo
.
value
=
res
.
data
.
data
}
}
catch
(
error
)
{
console
.
error
(
'获取用户信息失败:'
,
error
)
uni
.
showToast
({
title
:
'获取用户信息失败'
,
icon
:
'none'
})
}
}
// 获取订单数量
const
getOrderCounts
=
async
()
=>
{
try
{
// TODO: 调用获取订单数量接口
const
res
=
await
uni
.
request
({
url
:
'/api/order/counts'
,
method
:
'GET'
})
if
(
res
.
data
.
code
===
0
)
{
orderCounts
.
value
=
res
.
data
.
data
}
}
catch
(
error
)
{
console
.
error
(
'获取订单数量失败:'
,
error
)
}
}
// 下拉刷新
const
onPullDownRefresh
=
async
()
=>
{
return
try
{
await
Promise
.
all
([
getUserInfo
(),
getOrderCounts
()
])
uni
.
stopPullDownRefresh
()
}
catch
(
error
)
{
console
.
error
(
'刷新数据失败:'
,
error
)
uni
.
stopPullDownRefresh
()
}
}
// 页面加载
onMounted
(()
=>
{
// getUserInfo()
// getOrderCounts()
})
// 定义页面配置
defineExpose
({
onPullDownRefresh
})
</
script
>
</
script
>
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
.my-container
{
.my-container
{
padding
:
20rpx
;
min-height
:
100vh
;
background-color
:
#f5f5f5
;
.content
{
padding-bottom
:
100rpx
;
padding-bottom
:
100rpx
;
.user-info
{
background-color
:
#fff
;
padding
:
40rpx
30rpx
;
margin-bottom
:
20rpx
;
.user-header
{
display
:
flex
;
align-items
:
center
;
margin-bottom
:
40rpx
;
.avatar
{
width
:
120rpx
;
height
:
120rpx
;
border-radius
:
60rpx
;
margin-right
:
20rpx
;
}
.user-detail
{
flex
:
1
;
.nickname
{
font-size
:
32rpx
;
font-weight
:
500
;
color
:
#333
;
margin-bottom
:
10rpx
;
}
.user-level
{
display
:
flex
;
align-items
:
center
;
.level-icon
{
width
:
32rpx
;
height
:
32rpx
;
margin-right
:
8rpx
;
}
.level-text
{
font-size
:
24rpx
;
color
:
#666
;
}
}
}
.edit-btn
{
image
{
width
:
40rpx
;
height
:
40rpx
;
}
}
}
.user-stats
{
display
:
flex
;
justify-content
:
space-around
;
.stat-item
{
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
.num
{
font-size
:
36rpx
;
font-weight
:
500
;
color
:
#333
;
margin-bottom
:
8rpx
;
}
.label
{
font-size
:
24rpx
;
color
:
#666
;
}
}
}
}
.order-section
{
background-color
:
#fff
;
padding
:
30rpx
;
margin-bottom
:
20rpx
;
.section-header
{
display
:
flex
;
justify-content
:
space-between
;
align-items
:
center
;
margin-bottom
:
30rpx
;
.title
{
font-size
:
32rpx
;
font-weight
:
500
;
color
:
#333
;
}
.more
{
display
:
flex
;
align-items
:
center
;
text
{
font-size
:
24rpx
;
color
:
#666
;
margin-right
:
8rpx
;
}
image
{
width
:
32rpx
;
height
:
32rpx
;
}
}
}
.order-types
{
display
:
flex
;
justify-content
:
space-between
;
.type-item
{
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
image
{
width
:
48rpx
;
height
:
48rpx
;
margin-bottom
:
12rpx
;
}
text
{
font-size
:
24rpx
;
color
:
#666
;
}
}
}
}
}
.function-list
{
background-color
:
#fff
;
padding
:
0
30rpx
;
.function-item
{
display
:
flex
;
align-items
:
center
;
height
:
100rpx
;
border-bottom
:
1rpx
solid
#f5f5f5
;
&
:last-child
{
border-bottom
:
none
;
}
image
{
width
:
40rpx
;
height
:
40rpx
;
margin-right
:
20rpx
;
&
.arrow
{
width
:
32rpx
;
height
:
32rpx
;
margin-right
:
0
;
margin-left
:
auto
;
}
}
text
{
font-size
:
28rpx
;
color
:
#333
;
}
}
}
}
.badge
{
position
:
absolute
;
top
:
-8rpx
;
right
:
-8rpx
;
background-color
:
#ff4d4f
;
color
:
#fff
;
font-size
:
20rpx
;
padding
:
2rpx
8rpx
;
border-radius
:
16rpx
;
min-width
:
32rpx
;
text-align
:
center
;
}
.type-item
{
position
:
relative
;
}
}
</
style
>
</
style
>
pages/index/index.vue
View file @
03b014b8
<
template
>
<
template
>
<view
class=
"container"
>
<view
class=
"container"
>
<component
:is=
"tabComponents[curTabIndex]"
/>
<Home
v-if=
"curTabIndex == 0"
></Home>
<Brand
v-if=
"curTabIndex == 1"
></Brand>
<Integral
v-if=
"curTabIndex == 2"
></Integral>
<My
v-if=
"curTabIndex == 3"
></My>
<TabBar
@
tabClick=
"handleTabClick"
/>
<TabBar
@
tabClick=
"handleTabClick"
/>
</view>
</view>
</
template
>
</
template
>
...
@@ -16,7 +19,6 @@
...
@@ -16,7 +19,6 @@
data
()
{
data
()
{
return
{
return
{
curTabIndex
:
0
,
curTabIndex
:
0
,
tabComponents
:
[
Home
,
Brand
,
Integral
,
My
]
};
};
},
},
onLoad
()
{},
onLoad
()
{},
...
...
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