Browse Source

头部信息及标题等问题处理

yangc 8 years ago
parent
commit
f51b707d94

+ 0 - 1
components/mobile/Home.vue

@@ -148,7 +148,6 @@
 </script>
 
 <style lang="scss" scoped>
-  @import '~assets/scss/mobileCommon';
   .home{
     font-size:.28rem;
     background: #f7fbff;

+ 29 - 15
components/mobile/MobileHeader.vue

@@ -78,7 +78,9 @@
 //        url: '',
 //        clipboard: {},
         showMainSearch: false,
-        title: '优软商城'
+        title: '优软商城',
+        showHeader: false,
+        showSearch: false
       }
     },
     components: {
@@ -102,13 +104,13 @@
       },
       component () {
         return this.$store.state.componentDetail.detail.data
-      },
-      showHeader () {
-        return this.$route.path !== '/' || !this.$route.path || this.$route.path === ''
-      },
-      showSearch () {
-        return this.$route.path !== '/' && !this.$route.path.startsWith('/mobile/search')
       }
+//      showHeader () {
+//        return this.$route.path !== '/' || !this.$route.path || this.$route.path === ''
+//      },
+//      showSearch () {
+//        return this.$route.path !== '/' && !this.$route.path.startsWith('/mobile/search')
+//      }
     },
 //    mounted () {
 //      let _this = this
@@ -128,14 +130,23 @@
         window.history.back(-1)
       },
       initHeader: function (val) {
+//        if (val !== '/' || !val || val === '') {
+//          this.showHeader = true
+//          this.showSearch = !val.startsWith('/mobile/search')
+//        } else {
+//          this.showHeader = false
+//          this.showSearch = false
+//        }
+        this.showHeader = val !== '/' || !val || val === ''
+        this.showSearch = val !== '/' && !this.startWith(val, '/mobile/search')
         let title = '优软商城'
-        if (val.startsWith('/mobile/brand/componentDetail/')) {
+        if (this.startWith(val, '/mobile/brand/componentDetail/')) {
           title = this.component.code
 //          this.rightIcon = 'share'
-        } else if (val.startsWith('/mobile/brand/brandCenter')) {
+        } else if (this.startWith(val, '/mobile/brand/brandCenter')) {
           title = '品牌墙'
 //          this.rightIcon = 'share'
-        } else if (val.startsWith('/mobile/brand/')) {
+        } else if (this.startWith(val, '/mobile/brand/')) {
           if (this.brandDetail.nameCn) {
             if (this.brandDetail.nameCn !== this.brandDetail.nameEn) {
               title = this.brandDetail.nameEn + '(' + this.brandDetail.nameCn + ')'
@@ -150,16 +161,16 @@
             }
           }
 //          this.rightIcon = 'share'
-        } else if (val.startsWith('/mobile/shop/')) {
+        } else if (this.startWith(val, '/mobile/shop/')) {
           title = this.store.storeName
 //          this.rightIcon = 'phone'
-        } else if (val.startsWith('/mobile/shop')) {
+        } else if (this.startWith(val, '/mobile/shop')) {
           title = '店铺列表'
 //          this.rightIcon = 'phone'
-        } else if (val.startsWith('/mobile/user')) {
+        } else if (this.startWith(val, '/mobile/user')) {
           title = '我的收藏'
 //          this.rightIcon = 'phone'
-        } else if (val.startsWith('/mobile/search')) {
+        } else if (this.startWith(val, '/mobile/search')) {
           title = '搜索结果'
 //          this.rightIcon = 'share'
         } else if (val === '' || val === '/' || !val) {
@@ -240,12 +251,15 @@
       goMainSearch: function () {
         this.showMainSearch = true
         this.$store.dispatch('searchData/getSearchHistory')
+      },
+      startWith: function (str, s) {
+        let reg = new RegExp('^' + s)
+        return reg.test(str)
       }
     }
   }
 </script>
 <style lang="scss" scoped>
-  @import '~assets/scss/mobileCommon';
   .mobile-header{
     width:100%;
     height:.88rem;

+ 5 - 1
components/mobile/brand/BrandCenter.vue

@@ -86,10 +86,14 @@
     },
     methods: {
       onScroll () {
-        if (this.$route.path.startsWith('/mobile/brand/brandCenter')) {
+        if (this.startWith(this.$route.path, '/mobile/brand/brandCenter')) {
           let scrolled = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop
           this.isScrolled = scrolled > 0
         }
+      },
+      startWith: function (str, s) {
+        let reg = new RegExp('^' + s)
+        return reg.test(str)
       }
     }
   }

+ 1 - 1
components/mobile/store/StoreDetail.vue

@@ -2,7 +2,7 @@
   <div class="store-detail">
     <div class="store-logo">
       <div class="store-logo-box">
-        <img :src="'/images/component/default.png'"/>
+        <img :src="store.logoUrl || '/images/component/default.png'"/>
         <i class="iconfont icon-shoucang" :style="isFocus === 'true'?'color:#ff7800':'color: #ddd'" @click="collectStore"></i>
       </div>
     </div>

+ 5 - 1
layouts/mobile.vue

@@ -20,9 +20,13 @@
           { name: 'MobileOptimized', content: '320' },
           { name: 'HandheldFriendly', content: 'true' },
           { name: 'viewport', content: 'width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no' },
-          { 'http-equiv': 'Cache-Control', content: 'no-siteapp' }
+          { 'http-equiv': 'Cache-Control', content: 'no-siteapp' },
+          { name: 'format-detection', content: 'telephone=no, email=no' }
         ]
       }
     }
   }
 </script>
+<style lang="scss">
+  @import '~assets/scss/mobileCommon';
+</style>

+ 2 - 3
pages/mobile/shop/index.vue

@@ -10,7 +10,7 @@
         <li @click="onDown('DISTRIBUTION')" v-show="downName !== '经销'">经销</li>
       </ul>
     </div>
-    <div class="shop-list" v-for="item in searchLists" @click="goStoreDetail(item.uuid)">
+    <div class="shop-list" v-for="item in searchLists" @click="goStoreDetail(item.uuid)" v-if="item">
       <h3>{{item.storeName}}</h3>
       <div class="list-item">
         <div class="item-img">
@@ -32,7 +32,7 @@
       <div class="mobile-modal-box">
         <div class="mobile-modal-header">联系方式<i @click="showStoreInfo = false" class="icon-guanbi iconfont"></i></div>
         <div class="mobile-modal-content">
-          <div v-if="checkInfo(enterpriseInfo.address || enterpriseInfo.enAddress)">商家地址:{{enterpriseInfo.address || enterpriseInfo.enAddress}}</div>
+          <div v-if="checkInfo(enterpriseInfo.enAddress || enterpriseInfo.address)">商家地址:{{enterpriseInfo.enAddress || enterpriseInfo.address}}</div>
           <div class="content-line link-url">在线咨询</div>
           <div v-if="checkInfo(enterpriseInfo.enTel)">致电:<a href="tel:0755-96586323" class="content-line link-url">{{enterpriseInfo.enTel}}</a></div>
           <div v-if="checkInfo(enterpriseInfo.enEmail)">邮件:<a href="mailto:yrsc@usoftchina.com" class="content-line link-url">{{enterpriseInfo.enEmail}}</a></div>
@@ -177,7 +177,6 @@
 </script>
 
 <style scoped lang="scss">
-  @import '~assets/scss/mobileCommon';
   .shop{
     margin-bottom: .98rem;
     min-height: 10rem;

+ 19 - 11
pages/mobile/user/index.vue

@@ -3,8 +3,8 @@
     <div class="user-name">
       <img src="/images/component/default.png"/>
       <div class="user-info">
-        <p>{{loadUserInfo.userName}}</p>
-        <p>{{enterprise.enName}}</p>
+        <p v-text="userInfo.data.userName"></p>
+        <p v-text="enterpriseInfo.enName"></p>
       </div>
       <span @click="onclick()">{{listName}}<i class="iconfont icon-arrow-down"></i></span>
       <ul class="supdown" v-if="down">
@@ -153,16 +153,24 @@
       collectSave () {
         return this.$store.state.product.common.collectList.data
       },
-      loadUserInfo () {
-        return this.$store.state.option.user.data
+      userInfo () {
+        return this.$store.state.option.user
       },
-      enterprise () {
-        let ens = this.loadUserInfo.enterprises
+      enterpriseInfo () {
+        let ens = this.userInfo.data.enterprises
+//        if (ens && ens.length) {
+//          return ens.find(item => item.current) || {enName: this.userInfo.data.userName + '(个人账户)'}
+//        } else {
+//          return {enName: this.userInfo.data.userName + '(个人账户)'}
+//        }
         if (ens && ens.length) {
-          return ens.find(item => item.current) || {enName: this.user.data.userName + '(个人账户)'}
-        } else {
-          return {enName: this.user.data.userName + '(个人账户)'}
+          for (let i = 0; i < ens.length; i++) {
+            if (ens[i].current) {
+              return ens[i]
+            }
+          }
         }
+        return {enName: this.userInfo.data.userName + '(个人账户)'}
       },
       focusPage () {
         return this.$store.state.shop.storeInfo.focusPage.data
@@ -290,7 +298,7 @@
           img{
             width:2.4rem;
             height:1.69rem;
-            border:.02rem solid #eee;
+            border: .04rem solid #eee;
           }
         }
         .list-item-phone{
@@ -363,7 +371,7 @@
     }
     .collect-list-type {
       background: #fff;
-      border-bottom: .02rem solid #acacac;
+      border-bottom: .04rem solid #acacac;
       p {
         font-size: .32rem;
         margin: 0 0 0 .13rem;