|
@@ -1,18 +1,17 @@
|
|
|
-import { axiosHttp } from '~plugins/axios-nuxt'
|
|
|
+import axios from '~plugins/axios-nuxt'
|
|
|
import cityService from '~plugins/city-service'
|
|
|
-var axios = null
|
|
|
+
|
|
|
export const actions = {
|
|
|
|
|
|
nuxtServerInit (store, context) {
|
|
|
-
|
|
|
|
|
|
- axios = axiosHttp(store, context.req)
|
|
|
+
|
|
|
const route = context.route
|
|
|
const isServer = context.isServer
|
|
|
const isDev = context.isDev
|
|
|
- const userAgent = isServer ? req.headers['user-agent'] :context.req.headers['user-agent']
|
|
|
+ const userAgent = isServer ? context.req.headers['user-agent'] :context.req.headers['user-agent']
|
|
|
const isMobile = /(iPhone|iPad|Opera Mini|Android.*Mobile|NetFront|PSP|BlackBerry|Windows Phone)/ig.test(userAgent)
|
|
|
- const cookie = isServer ? req.headers['cookie'] : null
|
|
|
+ const cookie = process.server ? context.req.headers['cookie'] : null
|
|
|
store.commit('option/SET_MOBILE_LAYOUT', isMobile)
|
|
|
store.commit('option/SET_USER_AGENT', userAgent)
|
|
|
store.commit('option/SET_COOKIES', cookie)
|
|
@@ -34,6 +33,21 @@ export const actions = {
|
|
|
store.commit('option/SET_INVITEUSERUU', inviteUserUU)
|
|
|
store.commit('option/SET_INVITATIONTIME', invitationTime)
|
|
|
}
|
|
|
+ if (cookie && cookie.length) {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ axios.defaults.headers['cookie'] = store.state.option.cookies
|
|
|
+ axios.defaults.headers['User-Agent'] = store.state.option.userAgent
|
|
|
+ } else {
|
|
|
+ axios.defaults.headers['cookie'] = ''
|
|
|
+ axios.defaults.headers['User-Agent'] = ''
|
|
|
+ }
|
|
|
|
|
|
if (!isDev) {
|
|
|
store.commit('option/UPDATE_URL', 'http://192.168.253.66:8081/')
|
|
@@ -70,6 +84,7 @@ export const actions = {
|
|
|
|
|
|
loadMemberList ({ commit }, params = {}) {
|
|
|
commit('cloudCenter/REQUEST_MEMBER')
|
|
|
+
|
|
|
return axios.get('/sso/center/member/info', {params})
|
|
|
.then(res => {
|
|
|
commit('cloudCenter/REQUEST_MEMBER_SUCCESS', res.data)
|