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/> <RightBottom/>
<!--网络提示--> <!--网络提示-->
<NetworkException/> <NetworkException v-if="windowLarge"/>
<!--图片预览--> <!--图片预览-->
<PreviewImageState/> <PreviewImageState/>

View File

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

View File

@ -1,10 +1,13 @@
<template> <template>
<div class="common-network-exception">
<Alert v-if="type==='alert' && show" type="error" show-icon closable>{{$L('网络连接失败,请检查网络设置。')}}</Alert>
<Modal <Modal
v-else
v-model="show" v-model="show"
:width="416" :width="416"
:closable="false" :closable="false"
:footer-hide="true" :footer-hide="true"
class-name="common-network-exception"> class-name="common-network-exception-modal">
<div class="ivu-modal-confirm"> <div class="ivu-modal-confirm">
<div class="ivu-modal-confirm-head"> <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="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>
@ -17,6 +20,7 @@
</div> </div>
</div> </div>
</Modal> </Modal>
</div>
</template> </template>
<script> <script>
@ -24,12 +28,22 @@ import {mapState} from "vuex";
export default { export default {
name: 'NetworkException', name: 'NetworkException',
props: {
type: {
type: String,
default: 'modal'
},
},
data() { data() {
return { return {
show: false, show: false,
} }
}, },
beforeDestroy() {
this.show = false
},
computed: { computed: {
...mapState([ 'ajaxNetworkException' ]), ...mapState([ 'ajaxNetworkException' ]),
}, },

View File

@ -9,6 +9,24 @@
z-index: 99; z-index: 99;
user-select: none; 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 { .tabbar-box {
position: relative; position: relative;
z-index: 3; z-index: 3;