94d39cb8 by 杨威

新增全局loading显隐方法

1 parent 68b05121
1 <template> 1 <template>
2 <div id="app"> 2 <div id="app">
3 <router-view v-if="isRouterAlive" /> 3 <router-view v-if="isRouterAlive" />
4 <div class="loading" v-show="isShow">
5 <div class="content">
6 <i class="fa fa-spinner fa-pulse fa-3x fa-fw" style="color:#0081FF"></i>
7 <span>{{tips}}</span>
8 </div>
9 </div>
4 </div> 10 </div>
5 </template> 11 </template>
6 12
...@@ -14,10 +20,13 @@ export default { ...@@ -14,10 +20,13 @@ export default {
14 data(){ 20 data(){
15 return{ 21 return{
16 isRouterAlive:true, 22 isRouterAlive:true,
23 isShow:false,
24 tips:'正在努力加载中...'
17 } 25 }
18 }, 26 },
19 mounted() { 27 mounted() {
20 window.addEventListener("unload", this.saveState); 28 window.addEventListener("unload", this.saveState);
29 window.vm = this;
21 }, 30 },
22 methods: { 31 methods: {
23 saveState() { 32 saveState() {
...@@ -29,11 +38,56 @@ export default { ...@@ -29,11 +38,56 @@ export default {
29 this.isRouterAlive = true; 38 this.isRouterAlive = true;
30 }) 39 })
31 }, 40 },
41 loadingShow(tips){
42 this.isShow = true;
43 this.tips = tips+'...';
44 },
45 loadingHide(tips){
46 this.isShow = false;
47 }
32 }, 48 },
33 }; 49 };
34 </script> 50 </script>
35 51
36 <style lang="less"> 52 <style lang="less">
53 #app{
54 position: relative;
55
56 .loading{
57 width: 100%;
58 height: 100%;
59 // background-color: rgba(255, 255, 255, .3);
60 position: absolute;
61 top: 0;
62 left: 0;
63 z-index: 1;
64 .content{
65 width: 240px;
66 height: 160px;
67 background: #FFFFFF;
68 box-shadow: 0px 4px 28px 0px rgba(0, 0, 0, 0.24);
69 border-radius: 4px;
70 border: 1px solid #E6E6E6;
71 box-sizing: border-box;
72 padding: 32px;
73 position: absolute;
74 top: 50%;
75 left: 50%;
76 margin-left: -80px;
77 margin-top: -120px;
78 i,span{
79 display: block;
80 margin: 0 auto;
81 text-align: center;
82 }
83 span{
84 margin-top: 26px;
85 color: #6D7278;
86 font-size: 14px;
87 }
88 }
89 }
90 }
37 .popper-zxx{ 91 .popper-zxx{
38 padding: 0!important; 92 padding: 0!important;
39 /deep/ .el-tabs__header{ 93 /deep/ .el-tabs__header{
......
1 <template> 1 <template>
2 <div>
3 <el-tabs v-model="activeName" type="border-card" @tab-click="handleClick"> 2 <el-tabs v-model="activeName" type="border-card" @tab-click="handleClick">
4 <el-tab-pane label="日志管理" name="log"><log></log></el-tab-pane> 3 <el-tab-pane label="日志管理" name="log"><log></log></el-tab-pane>
5 <el-tab-pane label="字典管理" name="dictionary"><dictionary></dictionary></el-tab-pane> 4 <el-tab-pane label="字典管理" name="dictionary"><dictionary></dictionary></el-tab-pane>
6 </el-tabs> 5 </el-tabs>
7 </div>
8 </template> 6 </template>
9 7
10 <script> 8 <script>
......
...@@ -372,14 +372,10 @@ export default { ...@@ -372,14 +372,10 @@ export default {
372 .tj{ 372 .tj{
373 flex: 1; 373 flex: 1;
374 width: 100%; 374 width: 100%;
375 display: -webkit-box; 375 display: flex;
376 display: -moz-box;
377 display: box;
378 >div{ 376 >div{
379 flex: 1; 377 flex: 1;
380 -webkit-box-orient: vertical; /*属性值:[horizontal]横向/[vertical]纵向*/ 378 // flex-grow:1;
381 -moz-box-orient: horizontal;
382 box-orient: horizontal;
383 height: 100%; 379 height: 100%;
384 margin-right: 20px; 380 margin-right: 20px;
385 background: #fff; 381 background: #fff;
......
...@@ -768,8 +768,10 @@ ...@@ -768,8 +768,10 @@
768 if (this.$refs.qlrxxModule.getQlgyfsData() == 'PSHGSBDCQJDC000000000000DC340020' && this.$refs.qlrxxModule.getQlrxxData().length < 2 ) { 768 if (this.$refs.qlrxxModule.getQlgyfsData() == 'PSHGSBDCQJDC000000000000DC340020' && this.$refs.qlrxxModule.getQlrxxData().length < 2 ) {
769 Message.error('当前权利人共有方式至少需要添加两名权利人') 769 Message.error('当前权利人共有方式至少需要添加两名权利人')
770 }else{ 770 }else{
771 vm.loadingShow('请求发送中');
771 updateQjZdjbxx(this.formData) 772 updateQjZdjbxx(this.formData)
772 .then((res) => { 773 .then((res) => {
774 vm.loadingHide();
773 if (res.code == 200) { 775 if (res.code == 200) {
774 this.$message({ 776 this.$message({
775 message: '保存成功', 777 message: '保存成功',
...@@ -785,6 +787,7 @@ ...@@ -785,6 +787,7 @@
785 } 787 }
786 }) 788 })
787 .catch((error) => { 789 .catch((error) => {
790 vm.loadingHide();
788 this.$message({ 791 this.$message({
789 message: error.message+",查看日志,联系管理员", 792 message: error.message+",查看日志,联系管理员",
790 type: "error", 793 type: "error",
......