star7th 6 years ago
parent
commit
5bfc1fcd07

+ 4 - 0
web_src/src/components/team/Index.vue

@@ -161,6 +161,10 @@ export default {
 
   mounted(){
     this.geList();
+    this.set_bg_grey();
+  },
+  beforeDestroy(){
+    this.unset_bg_grey();
   }
 }
 </script>

+ 2 - 3
web_src/src/components/user/Login.vue

@@ -105,7 +105,7 @@ export default {
   mounted() {
     var that = this ;
     /*给body添加类,设置背景色*/
-    document.getElementsByTagName("body")[0].className="grey-bg";
+    this.set_bg_grey();
     this.get_user_info(function(response){
       if (response.data.error_code === 0 ) {
         let redirect = decodeURIComponent(that.$route.query.redirect || '/item/index');
@@ -118,8 +118,7 @@ export default {
     this.script_cron();
   },
   beforeDestroy(){
-    /*去掉添加的背景色*/
-    document.body.removeAttribute("class","grey-bg");
+    this.unset_bg_grey();
   }
 }
 </script>

+ 2 - 4
web_src/src/components/user/Register.vue

@@ -90,12 +90,10 @@ export default {
       }
   },
   mounted() {
-    /*给body添加类,设置背景色*/
-    document.getElementsByTagName("body")[0].className="grey-bg";
+    this.set_bg_grey();
   },
   beforeDestroy(){
-    /*去掉添加的背景色*/
-    document.body.removeAttribute("class","grey-bg");
+    this.unset_bg_grey();
   }
 }
 </script>

+ 2 - 4
web_src/src/components/user/ResetPassword.vue

@@ -75,12 +75,10 @@ export default {
       }
   },
   mounted() {
-    /*给body添加类,设置背景色*/
-    document.getElementsByTagName("body")[0].className="grey-bg";
+    this.set_bg_grey();
   },
   beforeDestroy(){
-    /*去掉添加的背景色*/
-    document.body.removeAttribute("class","grey-bg");
+    this.unset_bg_grey();
   }
 }
 </script>

+ 2 - 4
web_src/src/components/user/ResetPasswordByUrl.vue

@@ -69,12 +69,10 @@ export default {
       }
   },
   mounted() {
-    /*给body添加类,设置背景色*/
-    document.getElementsByTagName("body")[0].className="grey-bg";
+    this.set_bg_grey();
   },
   beforeDestroy(){
-    /*去掉添加的背景色*/
-    document.body.removeAttribute("class","grey-bg");
+    this.unset_bg_grey();
   }
 }
 </script>

+ 3 - 5
web_src/src/components/user/Setting.vue

@@ -194,13 +194,11 @@ export default {
   mounted(){
     
     this.get_user_info();
-    /*给body添加类,设置背景色*/
-    document.getElementsByTagName("body")[0].className="grey-bg";
+    this.set_bg_grey();
   },
 
   beforeDestroy(){
-    /*去掉添加的背景色*/
-    document.body.removeAttribute("class","grey-bg");
+    this.unset_bg_grey();
   }
   
 }
@@ -216,7 +214,7 @@ export default {
 .center-card{
   text-align: center;
   width: 600px;
-  height: 500px;
+  height: 400px;
 }
 
 .goback-btn{

+ 10 - 0
web_src/src/util.js

@@ -46,5 +46,15 @@ export default{
           });
     }
 
+    Vue.prototype.set_bg_grey = function(){
+        /*给body添加类,设置背景色*/
+        document.getElementsByTagName("body")[0].className="grey-bg";
+    }
+
+    Vue.prototype.unset_bg_grey = function(){
+      /*去掉添加的背景色*/
+      document.body.removeAttribute("class","grey-bg");
+    }
+
   }
 }