Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
H
hr-mobile-view
Project
Project
Details
Activity
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
anjia-hr
hr-mobile-view
Commits
24a983d0
Commit
24a983d0
authored
Dec 29, 2025
by
刘斌
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 增加关闭未提交时的暂存功能
parent
e180bbe4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
72 additions
and
2 deletions
+72
-2
App.vue
src/App.vue
+72
-2
No files found.
src/App.vue
View file @
24a983d0
...
...
@@ -939,7 +939,60 @@ const CACHE_KEY = 'HR_VIEW_FORM_CACHE';
function
saveCache
()
{
if
(
!
submitSuccess
.
value
)
{
try
{
localStorage
.
setItem
(
CACHE_KEY
,
JSON
.
stringify
(
form
));
const
photoList
=
Array
.
isArray
(
form
.
photoList
)
?
form
.
photoList
.
map
((
x
:
any
)
=>
({
url
:
x
?.
url
,
name
:
x
?.
name
}))
:
[];
const
data
=
{
name
:
form
.
name
,
phoneNumber
:
form
.
phoneNumber
,
gender
:
form
.
gender
,
genderText
:
form
.
genderText
,
photoList
,
ossId
:
form
.
ossId
,
idCardNumber
:
form
.
idCardNumber
,
birthDate
:
form
.
birthDate
,
age
:
form
.
age
,
homeAddress
:
form
.
homeAddress
,
ethnicity
:
form
.
ethnicity
,
nativePlace
:
form
.
nativePlace
,
maritalStatus
:
form
.
maritalStatus
,
maritalText
:
form
.
maritalText
,
politicalStatus
:
form
.
politicalStatus
,
politicalText
:
form
.
politicalText
,
emergencyContact
:
form
.
emergencyContact
,
emergencyContactPhone
:
form
.
emergencyContactPhone
,
householdRegistrationAddress
:
form
.
householdRegistrationAddress
,
workStartDisplay
:
form
.
workStartDisplay
,
professionalTitle
:
form
.
professionalTitle
,
certificateStatus
:
form
.
certificateStatus
,
fulltimeEducation
:
form
.
fulltimeEducation
,
fulltimeSchool
:
form
.
fulltimeSchool
,
fulltimeMajor
:
form
.
fulltimeMajor
,
fulltimeGraduationDate
:
form
.
fulltimeGraduationDate
,
fulltimeDegree
:
form
.
fulltimeDegree
,
nonFulltimeEducation
:
form
.
nonFulltimeEducation
,
nonFulltimeSchool
:
form
.
nonFulltimeSchool
,
nonFulltimeMajor
:
form
.
nonFulltimeMajor
,
nonFulltimeGraduationDate
:
form
.
nonFulltimeGraduationDate
,
nonFulltimeDegree
:
form
.
nonFulltimeDegree
,
externalResumeItems
:
form
.
externalResumeItems
.
map
((
o
)
=>
({
startDate
:
o
.
startDate
,
endDate
:
o
.
endDate
,
company
:
o
.
company
,
position
:
o
.
position
,
})),
familyMembers
:
form
.
familyMembers
.
map
((
o
)
=>
({
relation
:
o
.
relation
,
name
:
o
.
name
,
birthDate
:
o
.
birthDate
,
companyAndJob
:
o
.
companyAndJob
,
contact
:
o
.
contact
,
})),
familyEmergencyIndex
:
form
.
familyEmergencyIndex
,
tid
:
form
.
tid
,
};
localStorage
.
setItem
(
CACHE_KEY
,
JSON
.
stringify
(
data
));
}
catch
(
e
)
{
console
.
error
(
'Save cache failed'
,
e
);
}
...
...
@@ -952,7 +1005,6 @@ function loadCache() {
if
(
cached
)
{
const
data
=
JSON
.
parse
(
cached
);
Object
.
assign
(
form
,
data
);
// Restore tid from URL if present, ensuring it takes precedence over cache
if
(
_tid
)
{
form
.
tid
=
_tid
;
}
...
...
@@ -964,10 +1016,28 @@ function loadCache() {
onMounted
(()
=>
{
loadCache
();
const
onVisibilityChange
=
()
=>
{
if
(
document
.
visibilityState
===
'hidden'
)
saveCache
();
};
const
onPageHide
=
()
=>
{
saveCache
();
};
(
window
as
any
).
__onVisibilityChange__
=
onVisibilityChange
;
(
window
as
any
).
__onPageHide__
=
onPageHide
;
document
.
addEventListener
(
'visibilitychange'
,
onVisibilityChange
);
window
.
addEventListener
(
'pagehide'
,
onPageHide
);
window
.
addEventListener
(
'beforeunload'
,
saveCache
);
});
onBeforeUnmount
(()
=>
{
const
onVisibilityChange
=
(
window
as
any
).
__onVisibilityChange__
;
const
onPageHide
=
(
window
as
any
).
__onPageHide__
;
if
(
onVisibilityChange
)
{
document
.
removeEventListener
(
'visibilitychange'
,
onVisibilityChange
);
}
if
(
onPageHide
)
{
window
.
removeEventListener
(
'pagehide'
,
onPageHide
);
}
window
.
removeEventListener
(
'beforeunload'
,
saveCache
);
saveCache
();
});
...
...
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