Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
mlaj
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2025-06-15 20:09:12 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
87997197825ef23dbca0babdfc6c56ba74425f65
87997197
1 parent
e8b148d2
feat(认证): 合并用户打卡数据并更新首页统计显示
在认证上下文中合并用户基本信息和打卡数据,同时在首页展示累计打卡、连续打卡和最长连续打卡天数
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
11 deletions
src/components.d.ts
src/contexts/auth.js
src/views/HomePage.vue
src/components.d.ts
View file @
8799719
...
...
@@ -29,14 +29,38 @@ declare module 'vue' {
TermsPopup
:
typeof
import
(
'./components/ui/TermsPopup.vue'
)[
'default'
]
UploadVideoPopup
:
typeof
import
(
'./components/ui/UploadVideoPopup.vue'
)[
'default'
]
UserAgreement
:
typeof
import
(
'./components/ui/UserAgreement.vue'
)[
'default'
]
VanActionSheet
:
typeof
import
(
'vant/es'
)[
'ActionSheet'
]
VanButton
:
typeof
import
(
'vant/es'
)[
'Button'
]
VanCalendar
:
typeof
import
(
'vant/es'
)[
'Calendar'
]
VanCellGroup
:
typeof
import
(
'vant/es'
)[
'CellGroup'
]
VanCheckbox
:
typeof
import
(
'vant/es'
)[
'Checkbox'
]
VanCol
:
typeof
import
(
'vant/es'
)[
'Col'
]
VanConfigProvider
:
typeof
import
(
'vant/es'
)[
'ConfigProvider'
]
VanDatePicker
:
typeof
import
(
'vant/es'
)[
'DatePicker'
]
VanDialog
:
typeof
import
(
'vant/es'
)[
'Dialog'
]
VanDivider
:
typeof
import
(
'vant/es'
)[
'Divider'
]
VanEmpty
:
typeof
import
(
'vant/es'
)[
'Empty'
]
VanField
:
typeof
import
(
'vant/es'
)[
'Field'
]
VanForm
:
typeof
import
(
'vant/es'
)[
'Form'
]
VanIcon
:
typeof
import
(
'vant/es'
)[
'Icon'
]
VanImage
:
typeof
import
(
'vant/es'
)[
'Image'
]
VanImagePreview
:
typeof
import
(
'vant/es'
)[
'ImagePreview'
]
VanList
:
typeof
import
(
'vant/es'
)[
'List'
]
VanLoading
:
typeof
import
(
'vant/es'
)[
'Loading'
]
VanNavBar
:
typeof
import
(
'vant/es'
)[
'NavBar'
]
VanOverlay
:
typeof
import
(
'vant/es'
)[
'Overlay'
]
VanPicker
:
typeof
import
(
'vant/es'
)[
'Picker'
]
VanPickerGroup
:
typeof
import
(
'vant/es'
)[
'PickerGroup'
]
VanPopup
:
typeof
import
(
'vant/es'
)[
'Popup'
]
VanProgress
:
typeof
import
(
'vant/es'
)[
'Progress'
]
VanRate
:
typeof
import
(
'vant/es'
)[
'Rate'
]
VanRow
:
typeof
import
(
'vant/es'
)[
'Row'
]
VanSwipe
:
typeof
import
(
'vant/es'
)[
'Swipe'
]
VanSwipeItem
:
typeof
import
(
'vant/es'
)[
'SwipeItem'
]
VanTab
:
typeof
import
(
'vant/es'
)[
'Tab'
]
VanTabs
:
typeof
import
(
'vant/es'
)[
'Tabs'
]
VanTag
:
typeof
import
(
'vant/es'
)[
'Tag'
]
VanUploader
:
typeof
import
(
'vant/es'
)[
'Uploader'
]
VideoPlayer
:
typeof
import
(
'./components/ui/VideoPlayer.vue'
)[
'default'
]
WechatPayment
:
typeof
import
(
'./components/payment/WechatPayment.vue'
)[
'default'
]
}
...
...
src/contexts/auth.js
View file @
8799719
/*
* @Date: 2025-03-20 21:11:31
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-06-1
3 11:09:37
* @LastEditTime: 2025-06-1
5 20:06:25
* @FilePath: /mlaj/src/contexts/auth.js
* @Description: 认证上下文管理模块,提供用户认证状态管理、登录登出功能
*/
...
...
@@ -64,7 +64,7 @@ export function provideAuth() {
// 从服务器获取用户信息并更新本地存储
const
{
code
,
data
}
=
await
getUserInfoAPI
();
if
(
code
)
{
currentUser
.
value
=
data
.
user
currentUser
.
value
=
{
...
data
.
user
,
...
data
.
checkin
}
localStorage
.
setItem
(
'currentUser'
,
JSON
.
stringify
(
currentUser
.
value
))
}
else
{
logout
()
...
...
@@ -74,7 +74,7 @@ export function provideAuth() {
const
{
code
,
data
}
=
await
getAuthInfoAPI
();
if
(
code
)
{
if
(
data
.
openid_has
)
{
currentUser
.
value
=
data
.
user
currentUser
.
value
=
{
...
data
.
user
,
...
data
.
checkin
}
localStorage
.
setItem
(
'currentUser'
,
JSON
.
stringify
(
currentUser
.
value
))
}
}
...
...
src/views/HomePage.vue
View file @
8799719
<!--
* @Date: 2025-03-20 19:55:21
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-06-1
3 16:26:25
* @LastEditTime: 2025-06-1
5 20:07:21
* @FilePath: /mlaj/src/views/HomePage.vue
* @Description: 美乐爱觉教育首页组件
*
...
...
@@ -59,17 +59,17 @@
<!-- User Stats -->
<div class="flex justify-between text-center py-2">
<div class="border-r border-gray-200 flex-1">
<div class="text-lg font-bold">3</div>
<div class="text-lg font-bold">{{ currentUser?.total_days || 0 }}</div>
<div class="text-xs text-gray-500">累计打卡</div>
</div>
<div class="border-gray-200 flex-1">
<div class="text-lg font-bold">{{ currentUser?.consecutive_days || 0 }}</div>
<div class="text-xs text-gray-500">连续打卡</div>
</div>
<div class="border-gray-200 flex-1">
<div class="text-lg font-bold">
12
</div>
<div class="text-xs text-gray-500">
已学课程
</div>
<div class="text-lg font-bold">
{{ currentUser?.longest_consecutive_days || 0 }}
</div>
<div class="text-xs text-gray-500">
最长连续
</div>
</div>
<!-- <div class="flex-1">
<div class="text-lg font-bold">25</div>
<div class="text-xs text-gray-500">积分</div>
</div> -->
</div>
</FrostedGlass>
...
...
Please
register
or
login
to post a comment