mirror of
http://112.124.100.131/GFRS/ebiz-h5.git
synced 2025-12-10 10:26: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
|
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(){
|
mounted(){
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<div class='pt30 pl30 flex align-items-c'>
|
<div class='pt30 pl30 flex align-items-c'>
|
||||||
<span class='mr10'>投保人签名 :</span>
|
<span class='mr10'>投保人签名 :</span>
|
||||||
<van-button type='danger' size='small' :disabled="signBtnDisable" @click="sign" v-no-more-click='1000'>
|
<van-button type='danger' size='small' :disabled="signBtnDisable" @click="sign" v-no-more-click='1000'>
|
||||||
{{signInfo.status == '0' ? '签名' : '已签名' }}
|
{{signInfo.status == '1' ? '签名' : '已签名' }}
|
||||||
</van-button>
|
</van-button>
|
||||||
</div>
|
</div>
|
||||||
<div class='bg-white bottom-btn'>
|
<div class='bg-white bottom-btn'>
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
isDisabledComplite:true,
|
isDisabledComplite:true,
|
||||||
isOver: false,
|
isOver: false,
|
||||||
signInfo: {
|
signInfo: {
|
||||||
status: '0'
|
status: '1'
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -64,9 +64,9 @@
|
|||||||
if(res.result == 0){
|
if(res.result == 0){
|
||||||
this.pdfUrl = config.assetsUpUrl + res.content.rgssUrl
|
this.pdfUrl = config.assetsUpUrl + res.content.rgssUrl
|
||||||
let signInfo = JSON.parse(localStorage.getItem('signInfo'))
|
let signInfo = JSON.parse(localStorage.getItem('signInfo'))
|
||||||
if (signInfo && signInfo.status == '0') {
|
if (signInfo && signInfo.status == '1') {
|
||||||
this.base64 = sessionStorage.getItem('twoimgBase64Data')
|
this.base64 = sessionStorage.getItem('twoimgBase64Data')
|
||||||
this.$set(this.signInfo, 'status', '1')
|
this.$set(this.signInfo, 'status', '2')
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
this.$toast(res.resultMessage)
|
this.$toast(res.resultMessage)
|
||||||
@@ -141,7 +141,7 @@
|
|||||||
} else {
|
} else {
|
||||||
that.signBtnDisable = true
|
that.signBtnDisable = true
|
||||||
}
|
}
|
||||||
if (that.radio == '1' && val.signInfo.status == '1') {
|
if (that.radio == '1' && val.signInfo.status == '2') {
|
||||||
that.isDisabledComplite = false
|
that.isDisabledComplite = false
|
||||||
} else {
|
} else {
|
||||||
that.isDisabledComplite = true
|
that.isDisabledComplite = true
|
||||||
|
|||||||
Reference in New Issue
Block a user