perf: 优化移动端网络错误提示

This commit is contained in:
kuaifan 2022-12-02 13:33:14 +08:00
parent bebeb49ae4
commit 3a3ecd920f
4 changed files with 53 additions and 19 deletions

View File

@ -14,7 +14,7 @@
<RightBottom/>
<!--网络提示-->
<NetworkException/>
<NetworkException v-if="windowLarge"/>
<!--图片预览-->
<PreviewImageState/>

View File

@ -16,6 +16,7 @@
</ul>
</div>
</transition>
<NetworkException v-if="windowSmall" type="alert"/>
<ul class="tabbar-box">
<li v-for="item in navList" @click="toggleRoute(item.name)" :class="{active: activeName === item.name}">
<i class="taskfont" v-html="item.icon"></i>
@ -36,10 +37,11 @@
<script>
import {mapGetters, mapState} from "vuex";
import {Store} from "le5le-store";
import NetworkException from "../NetworkException";
export default {
name: "MobileTabbar",
components: {NetworkException},
data() {
return {
isMore: false,

View File

@ -1,22 +1,26 @@
<template>
<Modal
v-model="show"
:width="416"
:closable="false"
:footer-hide="true"
class-name="common-network-exception">
<div class="ivu-modal-confirm">
<div class="ivu-modal-confirm-head">
<div class="ivu-modal-confirm-head-icon ivu-modal-confirm-head-icon-error"><Icon type="ios-close-circle"/></div><div class="ivu-modal-confirm-head-title">{{$L('温馨提示')}}</div>
<div class="common-network-exception">
<Alert v-if="type==='alert' && show" type="error" show-icon closable>{{$L('网络连接失败,请检查网络设置。')}}</Alert>
<Modal
v-else
v-model="show"
:width="416"
:closable="false"
:footer-hide="true"
class-name="common-network-exception-modal">
<div class="ivu-modal-confirm">
<div class="ivu-modal-confirm-head">
<div class="ivu-modal-confirm-head-icon ivu-modal-confirm-head-icon-error"><Icon type="ios-close-circle"/></div><div class="ivu-modal-confirm-head-title">{{$L('温馨提示')}}</div>
</div>
<div class="ivu-modal-confirm-body">
<div>{{$L('网络连接失败,请检查网络设置。')}}</div>
</div>
<div class="ivu-modal-confirm-footer">
<Button type="primary" @click="show = false">{{$L('确定')}}</Button>
</div>
</div>
<div class="ivu-modal-confirm-body">
<div>{{$L('网络连接失败,请检查网络设置。')}}</div>
</div>
<div class="ivu-modal-confirm-footer">
<Button type="primary" @click="show = false">{{$L('确定')}}</Button>
</div>
</div>
</Modal>
</Modal>
</div>
</template>
<script>
@ -24,12 +28,22 @@ import {mapState} from "vuex";
export default {
name: 'NetworkException',
props: {
type: {
type: String,
default: 'modal'
},
},
data() {
return {
show: false,
}
},
beforeDestroy() {
this.show = false
},
computed: {
...mapState([ 'ajaxNetworkException' ]),
},

View File

@ -9,6 +9,24 @@
z-index: 99;
user-select: none;
.common-network-exception {
position: fixed;
bottom: 72px;
width: 100%;
.ivu-alert {
margin: 0 12px;
&.ivu-alert-with-icon {
.ivu-alert-icon {
top: 50%;
transform: translateY(-50%);
}
}
&.ivu-alert-error {
background-color: rgba(255, 240, 231, 0.95);
}
}
}
.tabbar-box {
position: relative;
z-index: 3;