瀏覽代碼

处理BUG

wangcz 7 年之前
父節點
當前提交
6a09159cbe
共有 2 個文件被更改,包括 20 次插入7 次删除
  1. 13 2
      pages/index.vue
  2. 7 5
      plugins/axios-nuxt.js

+ 13 - 2
pages/index.vue

@@ -15,8 +15,19 @@
     layout (context) {
       return context.store.state.option.isMobile ? 'mobile' : 'isCityFooter'
     },
-    fetch ({store, route}) {
-      return Promise.all([store.dispatch('GetLoginStyle', {appId: route.query.appId})])
+    created() {
+      // this.$http.get('/sso/login/page/style', { params: {appId: this.$route.query.appId} })
+      //   .then(response => {
+      //     console.log(response.data)
+      //     // commit('login/REQUEST_LOGIN_STYLE_SUCCESS', response.data)
+      //   }, err => {
+      //     // commit('login/REQUEST_LOGIN_STYLE_FAILURE', err)
+      //   })
+    },
+    asyncData ({store, route}) {
+      return Promise.all([
+        store.dispatch('GetLoginStyle', {appId: route.query.appId})
+      ])
     },
     components: {
       Login,

+ 7 - 5
plugins/axios-nuxt.js

@@ -9,13 +9,15 @@ const service = Axios.create({
 export function axiosHttp(store) {
 
   service.interceptors.request.use(config => {
-    if (typeof window === 'undefined') {
-      config.headers.cookie = store.state.option.cookies + '; ' + store.state.option.sessionId
-      config.headers['User-Agent'] = Vue.$store.state.option.userAgent
+    if (config.url.indexOf('.') === -1) {
       config.url = process.env.baseUrl + config.url
-    } else {
-      // console.log(store)
     }
+    // if (typeof window === 'undefined') {
+      // config.headers.cookie = store.state.option.cookies + '; ' + store.state.option.sessionId
+      // // config.headers['User-Agent'] = Vue.$store.state.option.userAgent
+    // } else {
+      // console.log(store)
+    // }
     return config
   }, error => {
     return Promise.reject(error)