Browse Source

处理BUG

wangcz 6 years ago
parent
commit
8e4d6b5485
3 changed files with 21 additions and 15 deletions
  1. 4 1
      .eslintrc.js
  2. 12 12
      pages/index.vue
  3. 5 2
      plugins/axios-nuxt.js

+ 4 - 1
.eslintrc.js

@@ -11,6 +11,9 @@ module.exports = {
     'html'
   ],
   // add your custom rules here
-  rules: {},
+  rules: {
+    "space-before-function-paren": [0, "ignore"],
+    "indent": 'off'
+  },
   globals: {}
 }

+ 12 - 12
pages/index.vue

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

+ 5 - 2
plugins/axios-nuxt.js

@@ -9,9 +9,12 @@ const service = Axios.create({
 export function axiosHttp(store) {
 
   service.interceptors.request.use(config => {
-    if (config.url.indexOf('.') === -1) {
-      config.url = process.env.baseUrl + config.url
+    if (process.server) {
+      config.url = process.env.baseUrl + (config.url ? config.url : '/')
     }
+    // if (config.url.indexOf('.') === -1) {
+    //
+    // }
     // if (typeof window === 'undefined') {
       // config.headers.cookie = store.state.option.cookies + '; ' + store.state.option.sessionId
       // // config.headers['User-Agent'] = Vue.$store.state.option.userAgent