linwenxin 1 ヶ月 前
コミット
f55bd01367

+ 2 - 0
src/common/utils/navPag.js

@@ -167,6 +167,7 @@ export function webViewHref(url, pam = {}, crossPagePam = {}) {
   var defaultPam = {
     ...pam,
     ...crossPagePam,
+    code2: store.state.user.code2 || '',
     'x-token': store.state.user.token,
     openId: store.state.user.openId,
     userId: store.state.user.userId,
@@ -219,6 +220,7 @@ export function webHref(url, pam = {}, crossPagePam = {}) {
   var defaultPam = {
     ...pam,
     ...crossPagePam,
+    code2: store.state.user.code2 || '',
     'x-token': store.state.user.token,
     openId: store.state.user.openId,
     userId: store.state.user.userId,

+ 5 - 5
src/store/getters.js

@@ -1,6 +1,7 @@
 const getters = {
-  token: (state) => state.user.token,
-  appId: (state) => state.user.appId,
+  token: state => state.user.token,
+  code2: state => state.user.code2,
+  appId: state => state.user.appId,
   openId: state => state.user.openId,
   name: state => state.user.name,
   avatar: state => state.user.avatar,
@@ -10,8 +11,7 @@ const getters = {
   province: state => state.user.province,
   crossPagePam: state => state.user.crossPagePam,
   miniOpenId: state => state.user.miniOpenId,
-  sharerOpenId: state => state.user.sharerOpenId,
+  sharerOpenId: state => state.user.sharerOpenId
 }
 
-
-export default getters
+export default getters

+ 4 - 4
src/store/index.js

@@ -1,5 +1,5 @@
-import Vue from "vue";
-import Vuex from 'vuex';
+import Vue from 'vue'
+import Vuex from 'vuex'
 import user from './modules/user/index.js'
 import getters from './getters.js'
 
@@ -9,5 +9,5 @@ export default new Vuex.Store({
   modules: {
     user
   },
-  getters,
-})
+  getters
+})

+ 13 - 30
src/store/modules/user/actions.js

@@ -1,45 +1,28 @@
 import api from '@/common/http/'
 
-
 export default {
   //自动登录
-  async autoLogin({
-    commit
-  }, params) {
-
-  },
+  async autoLogin({ commit }, params) {},
 
   // 登录
-  async login({
-    commit
-  }, params) {
-
-  },
+  async login({ commit }, params) {},
 
   // 获取用户信息
-  async getInfo({
-    commit,
-    state
-  }) {
-
-  },
+  async getInfo({ commit, state }) {},
 
   // 清除登录信息
-  resetToken({
-    commit
-  }) {
+  resetToken({ commit }) {
     return new Promise(resolve => {
-      commit("set_token", "")
-      commit("set_openId", "")
-      commit("set_name", "")
-      commit("set_avatar", "")
-      commit("set_userId", "")
-      commit("set_mobile", "")
+      commit('set_token', '')
+      commit('set_openId', '')
+      commit('set_name', '')
+      commit('set_avatar', '')
+      commit('set_userId', '')
+      commit('set_mobile', '')
       // commit("set_city", "")
       // commit("set_province", "")
-      commit("setcrossPagePam", 0)
+      commit('setcrossPagePam', 0)
       resolve()
     })
-  },
-
-}
+  }
+}

+ 1 - 0
src/store/modules/user/index.js

@@ -33,6 +33,7 @@ const state = {
   appId: getQueryVariable('appid') || getQueryVariable('appId') || '',
   miniOpenId: getQueryVariable('miniOpenId') || getStorage('miniOpenId') || '',
   sharerOpenId: getQueryVariable('sharerOpenId') || getStorage('sharerOpenId') || '',
+  code2: getQueryVariable('code') || getStorage('code') || '',
   crossPagePam: ''
 }
 export default {

+ 12 - 16
src/store/modules/user/mutations.js

@@ -1,18 +1,14 @@
-import {
-  setStorage,
-  getStorage,
-  removeStorage
-} from "@/common/utils/storage.js"
+import { setStorage, getStorage, removeStorage } from '@/common/utils/storage.js'
 
 export default {
   //
   set_token: (state, token) => {
     state.token = token
-    state.crossPagePam = (new Date().getTime())
+    state.crossPagePam = new Date().getTime()
     if (token) {
       setStorage('token', token)
     } else {
-      removeStorage("token")
+      removeStorage('token')
     }
   },
 
@@ -21,7 +17,7 @@ export default {
     if (userId) {
       setStorage('userId', userId)
     } else {
-      removeStorage("userId")
+      removeStorage('userId')
     }
   },
 
@@ -30,7 +26,7 @@ export default {
     if (mobile) {
       setStorage('mobile', mobile)
     } else {
-      removeStorage("mobile")
+      removeStorage('mobile')
     }
   },
 
@@ -39,7 +35,7 @@ export default {
     if (openId) {
       setStorage('openId', openId)
     } else {
-      removeStorage("openId")
+      removeStorage('openId')
     }
   },
 
@@ -48,7 +44,7 @@ export default {
     if (name) {
       setStorage('name', name)
     } else {
-      removeStorage("name")
+      removeStorage('name')
     }
   },
 
@@ -57,7 +53,7 @@ export default {
     if (avatar) {
       setStorage('avatar', avatar)
     } else {
-      removeStorage("avatar")
+      removeStorage('avatar')
     }
   },
 
@@ -66,7 +62,7 @@ export default {
     if (city) {
       setStorage('city', city)
     } else {
-      removeStorage("city")
+      removeStorage('city')
     }
   },
 
@@ -75,11 +71,11 @@ export default {
     if (province) {
       setStorage('province', province)
     } else {
-      removeStorage("province")
+      removeStorage('province')
     }
   },
 
-  setcrossPagePam:(state, crossPagePam) => {
+  setcrossPagePam: (state, crossPagePam) => {
     state.crossPagePam = crossPagePam
-  },
+  }
 }