Selaa lähdekoodia

新增移动端我的界面

shenjj 7 vuotta sitten
vanhempi
commit
b7dcbd4297
2 muutettua tiedostoa jossa 56 lisäystä ja 21 poistoa
  1. 1 1
      nuxt.config.js
  2. 55 20
      pages/mobile/user/index.vue

+ 1 - 1
nuxt.config.js

@@ -1,6 +1,6 @@
 const path = require('path')
 const isProdMode = Object.is(process.env.NODE_ENV, 'production')
-const baseUrl = process.env.BASE_URL || (isProdMode ? 'http://api.usoftmall.com/' : 'http://10.1.51.77:8080/platform-b2c')
+const baseUrl = process.env.BASE_URL || (isProdMode ? 'http://api.usoftmall.com/' : 'http://192.168.253.121:9090/platform-b2c')
 const commonUrl = process.env.COMMON_URL || (isProdMode ? 'https://api-inquiry.usoftmall.com/' : 'http://10.1.51.77:7070/')
 const materialUrl = process.env.MATERIAL_URL || (isProdMode ? 'https://api-product.usoftmall.com/' : 'http://218.17.158.219:24000/')
 

+ 55 - 20
pages/mobile/user/index.vue

@@ -116,16 +116,16 @@
 
     <!-- 账户管理 -->
     <template v-else>
-      <div class="topinfo clearfix">
+      <div class="topinfo clearfix" v-show="enterpriseInfo.enName">
         <div class="pull-left">
           企业信息
         </div>
-        <div class="pull-right" @click="updateInfo()" v-show="storeState === 'look' && enterpriseInfo.enName">
+        <div class="pull-right" @click="updateInfo()" v-show="storeState === 'look'">
           <img src="/images/vendor/updateinfo.png"/>
           编辑
         </div>
       </div>
-      <ul class="infoul infoul2">
+      <ul class="infoul infoul2" v-show="enterpriseInfo.enName">
         <li class="clearfix" :class="{noupdate:  storeState !== 'look'}">
           <div class="name pull-left" :class="{update: storeState !== 'look'}" >企业名称:</div>
           <div class="text pull-left" :class="{update: storeState !== 'look'}">
@@ -166,7 +166,7 @@
             {{enterpriseInfo.enIndustry || '-'}}
           </div>
           <div v-else class="text pull-left clearfix">
-            <input v-model="enterpriseInfo.enIndustry" type="text" style="width: 4.5rem"/>
+            <input v-model="enterpriseInfo.enIndustry" type="text" style="width: 4.5rem" readonly/>
             <div class="moreIcon pull-right" @click="isShowTypeAlert = true">
               <img src="/images/store/default/moreicon.png" @click="isShowTypeAlert = true"/>
             </div>
@@ -199,7 +199,7 @@
         </li>
       </ul>
       <template v-if="storeState === 'look'">
-        <div class="topinfo clearfix" style="color: #999;border-top: 1px solid #d9d9d9;background: #fafafa">
+        <div class="topinfo clearfix" style="color: #999;background: #fafafa" :class="{noborder: enterpriseInfo.enName}">
             个人信息
         </div>
         <ul class="infoul infoul2" style="color: #999;background: #fafafa">
@@ -223,10 +223,10 @@
           </li>
         </ul>
 
-        <div class="topinfo clearfix" style="color: #999;border-top: 1px solid #d9d9d9;background: #fafafa">
+        <div class="topinfo clearfix" style="color: #999;border-top: 1px solid #d9d9d9;background: #fafafa" v-show="admininfo.userName">
           管理员信息
         </div>
-        <ul class="infoul infoul2" style="color: #999;background: #fafafa">
+        <ul class="infoul infoul2" style="color: #999;background: #fafafa" v-show="admininfo.userName">
           <li class="clearfix">
             <div class="name pull-left">姓名:</div>
             <div class="text pull-left">
@@ -464,11 +464,17 @@
         this.AddBtnShow = false
       },
       saveLabel() {
-        this.AddBtnShow = true
         if (this.labelText === '') {
+          this.AddBtnShow = true
           return false
         }
-        if (this.IsChange !== '') {
+        if (this.labelText.length > 10) {
+          this.collectResult = '标签文字不能超过10个字'
+          this.timeoutCount++
+          return false
+        }
+        this.AddBtnShow = true
+        if (this.IsChange !== '' && this.IsChange !== undefined) {
           let ms = this.enterpriseInfo.enBusinessScope.split(',')
           for (let j = 0; j < ms.length; j++) {
             if (ms[j].trim() === this.IsChange) {
@@ -477,8 +483,8 @@
           }
           this.enterpriseInfo.enBusinessScope = ms.join(',')
         } else {
-          if (this.enterpriseInfo.enBusinessScope.trim() === '') {
-            this.enterpriseInfo.enBusinessScope += this.labelText
+          if (!this.enterpriseInfo.enBusinessScope) {
+            this.enterpriseInfo.enBusinessScope = this.labelText
           } else {
             this.enterpriseInfo.enBusinessScope += ',' + this.labelText
           }
@@ -495,16 +501,29 @@
         this.updateEnterpriseInfo()
       },
       updateEnterpriseInfo() {
+        this.enterpriseInfo = {}
         this.hidelook = true
         this.Islook = true
         this.admininfo = {}
-        this.$store.dispatch('supplier/loadEnUser', {enUU: this.storeInfo.enUU, filter: 'enUU'}).then(() => {
-          this.scopeLabel = this.enterpriseInfo.enBusinessScope ? this.enterpriseInfo.enBusinessScope.split(',') : []
-          this.$http.get(`/basic/user/getUserByUU?uu=${this.enterpriseInfo.enAdminuu}`).then(res => {
-            this.admininfo = res.data
-            this.isSearchSearchingMore = false
+        this.labelText = ''
+        this.normalText = ''
+        this.clearInfo()
+        // let str = JSON.stringify(this.$store.state.supplier.material.enUser.data)
+        // this.enterpriseInfo = JSON.parse(str)
+        console.log(this.enterpriseInfo)
+        if (this.storeInfo.enUU) {
+          this.$store.dispatch('supplier/loadEnUser', {enUU: this.storeInfo.enUU, filter: 'enUU'}).then(() => {
+            this.scopeLabel = this.enterpriseInfo.enBusinessScope ? this.enterpriseInfo.enBusinessScope.split(',') : []
+            if (!this.enterpriseInfo.enAdminuu) {
+              this.isSearchSearchingMore = false
+              return false
+            }
+            this.$http.get(`/basic/user/getUserByUU?uu=${this.enterpriseInfo.enAdminuu}`).then(res => {
+              this.admininfo = res.data
+              this.isSearchSearchingMore = false
+            })
           })
-        })
+        }
       },
       updateInfo() {
         this.storeState = 'update'
@@ -519,7 +538,7 @@
         }
       },
       dealWithText(_T) {
-        if (_T) {
+        if (_T !== undefined) {
           // 文本处理
           this.normalText = _T
           if (_T.length < 140) {
@@ -552,7 +571,13 @@
       },
       storeInfosave(_tp) {
         if (_tp === 'cancel') {
-          this.storeState = 'look'
+          this.clearInfo()
+          this.scopeLabel = []
+          let str = JSON.stringify(this.$store.state.supplier.material.enUser.data)
+          this.enterpriseInfo = JSON.parse(str)
+          if (this.enterpriseInfo.enBusinessScope) {
+            this.scopeLabel = this.enterpriseInfo.enBusinessScope.split(',')
+          }
           return
         }
         if (this.activeType === 'store') {
@@ -579,6 +604,12 @@
             this.enterpriseInfo = JSON.parse(str)
           })
         }
+      },
+      clearInfo() {
+        this.storeState = 'look'
+        this.labelText = ''
+        this.IsChange = ''
+        this.AddBtnShow = true
       }
     }
   }
@@ -726,7 +757,7 @@
         border-radius: 5px;
       }
       .label {
-        width: auto;
+        max-width: 3rem;
         padding: 2px 4px;
         margin: 0.08rem 3px 0 3px;
         background: #5078cb;
@@ -756,6 +787,7 @@
         height: 100%;
         display: inline-block;
         vertical-align: top;
+        max-width: 3rem;
       }
       .updatespan {
         background: #353535;
@@ -820,6 +852,9 @@
         }
       }
     }
+    .noborder {
+      border-top: 1px solid #d9d9d9;
+    }
     .modal-content {
       position: absolute;
       height: 10rem;