Browse Source

登录验证提示box

yangc 8 years ago
parent
commit
cde6336629

+ 7 - 3
components/mobile/Home.vue

@@ -77,11 +77,13 @@
       </div>
     </div>
     <main-search v-else @cancelSearchAction="onCancelSearch"></main-search>
+    <login-box @onLoginBoxClose="showLoginBox = false" v-if="showLoginBox"></login-box>
   </div>
 </template>
 
 <script>
   import MainSearch from '~/components/mobile/search/MainSearch.vue'
+  import {LoginBox} from '~components/mobile/common'
   export default {
     name: 'home',
     data () {
@@ -92,11 +94,13 @@
         isMore: false,
         isShow: false,
         len: 0,
-        bgUrl: '/images/mobile/@2x/home/background@2x.png'
+        bgUrl: '/images/mobile/@2x/home/background@2x.png',
+        showLoginBox: false
       }
     },
     components: {
-      MainSearch
+      MainSearch,
+      LoginBox
     },
     methods: {
       onHomeSearchClick () {
@@ -140,7 +144,7 @@
         if (this.user.logged) {
           this.$router.push('/mobile/user')
         } else {
-          this.$router.push('/auth/login')
+          this.showLoginBox = true
         }
       }
     },

+ 8 - 2
components/mobile/MobileFooter.vue

@@ -16,17 +16,23 @@
       </a>
     </span>
     <a @click="toTop" v-show="!hideToTop"><i class="iconfont icon-arrow-up icon-xlg"></i></a>
+    <login-box @onLoginBoxClose="showLoginBox = false" v-if="showLoginBox"></login-box>
   </div>
 </template>
 <script>
   import { scrollTo } from '~utils/scroll'
+  import {LoginBox} from '~components/mobile/common'
   export default{
     name: 'MobileFooter',
     data () {
       return {
-        hideToTop: true
+        hideToTop: true,
+        showLoginBox: false
       }
     },
+    components: {
+      LoginBox
+    },
     computed: {
       activeType () {
         return this.$route.path === '/' ? 'home' : this.$route.path === '/mobile/shop' ? 'shops' : this.$route.path === '/mobile/user' ? 'user' : ''
@@ -56,7 +62,7 @@
         if (this.user.logged) {
           this.$router.push('/mobile/user')
         } else {
-          this.$router.push('/auth/login')
+          this.showLoginBox = true
         }
       }
     }

+ 7 - 4
components/mobile/brand/BrandDetail.vue

@@ -62,10 +62,11 @@
       </div>
     </div>
     <loading v-show="isSearchingMore"></loading>
+    <login-box @onLoginBoxClose="showLoginBox = false" v-if="showLoginBox"></login-box>
   </div>
 </template>
 <script>
-  import { Loading } from '~components/mobile/common'
+  import { Loading, LoginBox } from '~components/mobile/common'
   export default {
     name: 'MobileBrandsDetail',
     data () {
@@ -87,11 +88,13 @@
         isSearchingMore: false,
         searchLists: [],
         isChange: false,
-        isFilter: false
+        isFilter: false,
+        showLoginBox: false
       }
     },
     components: {
-      Loading
+      Loading,
+      LoginBox
     },
     filters: {
       wordFilter: function (str) {
@@ -280,7 +283,7 @@
             window.location.href = url
           }
         } else {
-          this.$router.push('/auth/login')
+          this.showLoginBox = true
         }
       },
       setActiveType: function (type) {

+ 8 - 5
components/mobile/brand/ComponentDetail.vue

@@ -90,10 +90,11 @@
     </div>
     <remind-box :title="collectResult" :timeoutCount="timeoutCount"></remind-box>
     <loading v-show="isSearchingMore"></loading>
+    <login-box @onLoginBoxClose="showLoginBox = false" v-if="showLoginBox"></login-box>
   </div>
 </template>
 <script>
-  import {RemindBox, Loading} from '~components/mobile/common'
+  import {RemindBox, Loading, LoginBox} from '~components/mobile/common'
   export default {
     data () {
       return {
@@ -115,12 +116,14 @@
           }
         },
         isSearchingMore: false,
-        searchLists: []
+        searchLists: [],
+        showLoginBox: false
       }
     },
     components: {
       RemindBox,
-      Loading
+      Loading,
+      LoginBox
     },
     mounted: function () {
       let _this = this
@@ -249,7 +252,7 @@
             window.location.href = url
           }
         } else {
-          this.$router.push('/auth/login')
+          this.showLoginBox = true
         }
       },
       collectComponent: function () {
@@ -266,7 +269,7 @@
             })
           }
         } else {
-          this.$router.push('/auth/login')
+          this.showLoginBox = true
         }
       }
     }

+ 41 - 0
components/mobile/common/LoginBox.vue

@@ -0,0 +1,41 @@
+<template>
+  <div class="mobile-modal">
+    <div class="mobile-modal-box">
+      <div class="mobile-modal-header">请登录后再操作<i @click="close" class="icon-guanbi iconfont"></i></div>
+      <div class="mobile-modal-content">
+        <span @click="close">暂不登录</span><span @click="goLogin">马上登录</span>
+      </div>
+    </div>
+  </div>
+</template>
+<script>
+  export default {
+    methods: {
+      close: function () {
+        this.$emit('onLoginBoxClose')
+      },
+      goLogin: function () {
+        this.$router.push('/auth/login')
+      }
+    }
+  }
+</script>
+<style lang="scss" scoped>
+  .mobile-modal-content {
+    padding: .54rem !important;
+    text-align: center;
+    span {
+      display: inline-block;
+      width: 1.5rem;
+      height: .6rem;
+      line-height: .6rem;
+      text-align: center;
+      background: #418df6;
+      color: #fff;
+      border-radius: .1rem;
+      &:first-child {
+        margin-right: .5rem;
+      }
+    }
+  }
+</style>

+ 2 - 1
components/mobile/common/index.js

@@ -1,4 +1,5 @@
 import Loading from './Loading.vue'
 import RemindBox from './RemindBox.vue'
+import LoginBox from './LoginBox.vue'
 
-export { Loading, RemindBox }
+export { Loading, RemindBox, LoginBox }

+ 7 - 4
components/mobile/store/StoreDetail.vue

@@ -72,10 +72,11 @@
     </div>
     <remind-box :title="collectResult" :timeoutCount="timeoutCount"></remind-box>
     <loading v-show="isSearchingMore"></loading>
+    <login-box @onLoginBoxClose="showLoginBox = false" v-if="showLoginBox"></login-box>
   </div>
 </template>
 <script>
-  import {RemindBox, Loading} from '~components/mobile/common'
+  import {RemindBox, Loading, LoginBox} from '~components/mobile/common'
   export default {
     data () {
       return {
@@ -84,12 +85,14 @@
         timeoutCount: 0,
         isSearchingMore: false,
         searchLists: [],
-        page: 1
+        page: 1,
+        showLoginBox: false
       }
     },
     components: {
       RemindBox,
-      Loading
+      Loading,
+      LoginBox
     },
     mounted: function () {
       let _this = this
@@ -192,7 +195,7 @@
               })
           }
         } else {
-          this.$router.push('/auth/login')
+          this.showLoginBox = true
         }
       }
     }

+ 7 - 4
pages/mobile/search/_keycode.vue

@@ -46,11 +46,12 @@
     </div>
     <remind-box :title="collectResult" :timeoutCount="timeoutCount"></remind-box>
     <loading v-show="isSearchingMore"></loading>
+    <login-box @onLoginBoxClose="showLoginBox = false" v-if="showLoginBox"></login-box>
   </div>
 </template>
 
 <script>
-  import {RemindBox, Loading} from '~components/mobile/common'
+  import {RemindBox, Loading, LoginBox} from '~components/mobile/common'
   export default {
     layout: 'mobile',
     data () {
@@ -67,12 +68,14 @@
         collectResult: '收藏成功',
         timeoutCount: 0,
         searchLists: [],
-        isSearchingMore: false
+        isSearchingMore: false,
+        showLoginBox: false
       }
     },
     components: {
       RemindBox,
-      Loading
+      Loading,
+      LoginBox
     },
     mounted: function () {
       let _this = this
@@ -159,7 +162,7 @@
             })
           }
         } else {
-          this.$router.push('/auth/login')
+          this.showLoginBox = true
         }
       },
       goComponent: function (uuid) {

+ 7 - 4
pages/mobile/shop/index.vue

@@ -39,11 +39,12 @@
         </div>
       </div>
     </div>
+    <login-box @onLoginBoxClose="showLoginBox = false" v-if="showLoginBox"></login-box>
   </div>
 </template>
 
 <script>
-  import {RemindBox, Loading} from '~components/mobile/common'
+  import {RemindBox, Loading, LoginBox} from '~components/mobile/common'
   export default {
     layout: 'mobile',
     data () {
@@ -60,12 +61,14 @@
         searchLists: [],
         isChange: false,
         showStoreInfo: false,
-        enterpriseInfo: {}
+        enterpriseInfo: {},
+        showLoginBox: false
       }
     },
     components: {
       RemindBox,
-      Loading
+      Loading,
+      LoginBox
     },
     fetch ({ store }) {
       return Promise.all([
@@ -165,7 +168,7 @@
               })
           }
         } else {
-          this.$router.push('/auth/login')
+          this.showLoginBox = true
         }
       },
       goStoreDetail: function (uuid) {

+ 9 - 9
store/provider.js

@@ -9,12 +9,7 @@ function countStoreOrderCount (store) {
   return axios.get('/api/provider/order/storeid/' + store.uuid + '/count')
 }
 function findStoreFocusInMobil (store) {
-  axios.get('/trade/storeFocus/ifFocus?storeid=' + store.id).then(response => {
-    return response.data
-  }, err => {
-    console.log(err)
-    return false
-  })
+  return axios.get('/trade/storeFocus/ifFocus?storeid=' + store.id)
 }
 export const actions = {
   // 获取销售排行榜信息
@@ -118,19 +113,24 @@ export const actions = {
         let listData = response.data
         let focusData = []
         for (let i = 0; i < listData.content.length; i++) {
-          focusData.push(findStoreFocusInMobil({id: listData.content[i].id}))
+          let str = findStoreFocusInMobil({id: listData.content[i].id})
+          focusData.push(str)
         }
         // 合并请求,获取店铺关注信息
         return Promise.all(focusData)
           .then(result => {
             if (result) {
               for (let i = 0; i < result.length; i++) {
-                listData.content[i].isFocus = result[i] ? result[i].data : false
+                listData.content[i].isFocus = result[i] ? result[i].data : 'false'
               }
             }
             commit('stores/GET_STORE_LIST_SUCCESS', listData)
           }, err => {
-            commit('stores/GET_STORE_LIST_FAILURE', err)
+            console.log(err)
+            for (let i = 0; i < listData.content.length; i++) {
+              listData.content[i].isFocus = 'false'
+            }
+            commit('stores/GET_STORE_LIST_SUCCESS', listData)
           })
       }, err => {
         commit('stores/GET_STORE_LIST_FAILURE', err)