mirror of
http://112.124.100.131/GFRS/ebiz-h5.git
synced 2025-12-09 07:36:44 +08:00
【GFRS-3645】解决当点击页面刷新时,vue的store数据丢失问题
This commit is contained in:
10
src/App.vue
10
src/App.vue
@@ -26,6 +26,16 @@ export default {
|
||||
reload: this.reload
|
||||
}
|
||||
},
|
||||
created () {
|
||||
// 在页面加载时读取sessionStorage
|
||||
if (sessionStorage.getItem('store')) {
|
||||
this.$store.replaceState(Object.assign({}, this.$store.state, JSON.parse(sessionStorage.getItem('store'))))
|
||||
}
|
||||
// 在页面刷新时将store保存到sessionStorage里
|
||||
window.addEventListener('beforeunload', () => {
|
||||
sessionStorage.setItem('store', JSON.stringify(this.$store.state))
|
||||
})
|
||||
},
|
||||
mounted(){
|
||||
},
|
||||
methods: {
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<div class='pt30 pl30 flex align-items-c'>
|
||||
<span class='mr10'>投保人签名 :</span>
|
||||
<van-button type='danger' size='small' :disabled="signBtnDisable" @click="sign" v-no-more-click='1000'>
|
||||
{{signInfo.status == '0' ? '签名' : '已签名' }}
|
||||
{{signInfo.status == '1' ? '签名' : '已签名' }}
|
||||
</van-button>
|
||||
</div>
|
||||
<div class='bg-white bottom-btn'>
|
||||
@@ -40,7 +40,7 @@
|
||||
isDisabledComplite:true,
|
||||
isOver: false,
|
||||
signInfo: {
|
||||
status: '0'
|
||||
status: '1'
|
||||
},
|
||||
}
|
||||
},
|
||||
@@ -64,9 +64,9 @@
|
||||
if(res.result == 0){
|
||||
this.pdfUrl = config.assetsUpUrl + res.content.rgssUrl
|
||||
let signInfo = JSON.parse(localStorage.getItem('signInfo'))
|
||||
if (signInfo && signInfo.status == '0') {
|
||||
if (signInfo && signInfo.status == '1') {
|
||||
this.base64 = sessionStorage.getItem('twoimgBase64Data')
|
||||
this.$set(this.signInfo, 'status', '1')
|
||||
this.$set(this.signInfo, 'status', '2')
|
||||
}
|
||||
}else{
|
||||
this.$toast(res.resultMessage)
|
||||
@@ -141,7 +141,7 @@
|
||||
} else {
|
||||
that.signBtnDisable = true
|
||||
}
|
||||
if (that.radio == '1' && val.signInfo.status == '1') {
|
||||
if (that.radio == '1' && val.signInfo.status == '2') {
|
||||
that.isDisabledComplite = false
|
||||
} else {
|
||||
that.isDisabledComplite = true
|
||||
|
||||
Reference in New Issue
Block a user