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
e180bbe4
Commit
e180bbe4
authored
Dec 29, 2025
by
刘斌
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 增加关闭缓存功能
parent
2f75ddd2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
1 deletion
+40
-1
App.vue
src/App.vue
+40
-1
No files found.
src/App.vue
View file @
e180bbe4
...
...
@@ -601,7 +601,7 @@
<
script
setup
lang=
"ts"
>
import
axios
from
'axios'
;
import
type
{
UploaderFileListItem
}
from
'vant'
;
import
{
reactive
,
ref
,
watch
,
nextTick
}
from
'vue'
;
import
{
reactive
,
ref
,
watch
,
nextTick
,
onMounted
,
onBeforeUnmount
}
from
'vue'
;
interface
FamilyMemberModel
{
relation
:
string
;
...
...
@@ -934,6 +934,44 @@ watch(
},
);
const
CACHE_KEY
=
'HR_VIEW_FORM_CACHE'
;
function
saveCache
()
{
if
(
!
submitSuccess
.
value
)
{
try
{
localStorage
.
setItem
(
CACHE_KEY
,
JSON
.
stringify
(
form
));
}
catch
(
e
)
{
console
.
error
(
'Save cache failed'
,
e
);
}
}
}
function
loadCache
()
{
try
{
const
cached
=
localStorage
.
getItem
(
CACHE_KEY
);
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
;
}
}
}
catch
(
e
)
{
console
.
error
(
'Load cache failed'
,
e
);
}
}
onMounted
(()
=>
{
loadCache
();
window
.
addEventListener
(
'beforeunload'
,
saveCache
);
});
onBeforeUnmount
(()
=>
{
window
.
removeEventListener
(
'beforeunload'
,
saveCache
);
saveCache
();
});
async
function
onSubmit
()
{
if
(
submitSuccess
.
value
)
{
showToast
(
'您已提交
\
n无需再次提交'
);
...
...
@@ -1014,6 +1052,7 @@ async function onSubmit() {
if
(
status
>=
200
&&
status
<
300
)
{
if
(
responseData
.
success
)
{
submitSuccess
.
value
=
true
;
localStorage
.
removeItem
(
CACHE_KEY
);
showSuccessToast
({
message
:
'提交成功'
,
duration
:
5000
});
}
else
{
showFailToast
(
responseData
.
errMessage
||
'提交失败'
);
...
...
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