Эх сурвалжийг харах

修改手机userHeader enInfo

yangc 7 жил өмнө
parent
commit
e5c0e477f2

+ 17 - 24
components/mobile/common/userHeader.vue

@@ -5,7 +5,7 @@
       <div class="user-info">
         <p v-text="userInfo.data.userName"></p>
         <p :class="{'long': !isShow}">
-          <span class="en-name">{{enterpriseInfo.enName}}</span>
+          <span class="en-name">{{enData.enName}}</span>
         </p>
         <div class="switch" v-if="isShow">
           <a @click="setShowEnterpriseToggle(!showEnterpriseToggle, $event)">切换</a>
@@ -14,11 +14,11 @@
         <ul class="en-list" v-show="showEnterpriseToggle">
           <li class="menu-item"
               v-for="en in sortEnterprises"
-              v-if="en.uu != enterpriseInfo2.uu"
+              v-if="en.uu != enData.uu"
               v-bind:key="en.uu">
             <a @click="switchEnterprise(en)">{{ en.enName }}</a>
           </li>
-          <li class="menu-item"  v-if="enterpriseInfo2.uu">
+          <li class="menu-item"  v-if="enData.uu">
             <a @click="switchEnterprise({uu: 0})"><span v-text="userInfo.data.userName"></span>(个人账户)</a>
           </li>
         </ul>
@@ -92,20 +92,8 @@
       userInfo () {
         return this.$store.state.option.user
       },
-      enterpriseInfo2 () {
-        if (this.userInfo.data.enterprises) {
-          let ens = this.userInfo.data.enterprises.slice()
-          if (ens && ens.length) {
-            for (let i = 0; i < ens.length; i++) {
-              if (ens[i].current) {
-                return ens[i]
-              }
-            }
-          }
-          return {enName: this.userInfo.data.userName + '(个人账户)'}
-        } else {
-          return ''
-        }
+      enData () {
+        return this.user.data.enterprise
       },
       sortEnterprises () {
         if (this.user.data.enterprises) {
@@ -159,6 +147,12 @@
             padding-right: .7rem;
             overflow: unset;
             max-width: unset;
+            &.long {
+              padding-right: 0;
+              span {
+                max-width: 5rem;
+              }
+            }
             .en-name {
               overflow: hidden;
               text-overflow: ellipsis;
@@ -170,13 +164,6 @@
               position: absolute;
               right: 0;
             }
-            .exit {
-              right: -.8rem;
-            }
-            .vir {
-              position: absolute;
-              right: -.14rem;
-            }
           }
         }
         .switch {
@@ -209,6 +196,12 @@
             }
 
           }
+          .exit {
+            right: -.8rem;
+          }
+          .vir {
+            margin: 0 .1rem;
+          }
         }
       }
       > a {