提交 a35e9deb 编写于 作者: guangjun.yang's avatar guangjun.yang

如果在浏览器或微信里couponToken

上级 d17fa9d2
...@@ -9,7 +9,7 @@ wxInfo = wxInfo ? JSON.parse(wxInfo) : {}; ...@@ -9,7 +9,7 @@ wxInfo = wxInfo ? JSON.parse(wxInfo) : {};
const user = { const user = {
state: { state: {
token: localStorage.getItem('token') || getCookie('token') || '', token: localStorage.getItem('couponToken') || getCookie('couponToken') || '',
info: {}, // 用户信息 info: {}, // 用户信息
wxInfo, // 微信信息,openid等 wxInfo, // 微信信息,openid等
wxCode: '', // 微信code wxCode: '', // 微信code
...@@ -32,8 +32,8 @@ const user = { ...@@ -32,8 +32,8 @@ const user = {
// 外部登陆返回设置token // 外部登陆返回设置token
setToken({ commit, dispatch }, params) { setToken({ commit, dispatch }, params) {
commit('SET_TOKEN', params); commit('SET_TOKEN', params);
localStorage.setItem('token', params); localStorage.setItem('couponToken', params);
setCookie('token', params) setCookie('couponToken', params)
dispatch('getUserInfo'); dispatch('getUserInfo');
}, },
// 获取用户信息 // 获取用户信息
......
...@@ -94,8 +94,8 @@ export default { ...@@ -94,8 +94,8 @@ export default {
// 如果在浏览器或微信里 // 如果在浏览器或微信里
if (this.isWeb) { if (this.isWeb) {
let { token, info } = this.$store.state.user; let { token, info } = this.$store.state.user;
token = token || localStorage.getItem("token") || getCookie("token"); token = token || localStorage.getItem("couponToken") || getCookie("couponToken");
this.token = token;
console.log("token && !info.id", !info.id, "wef", token); console.log("token && !info.id", !info.id, "wef", token);
if (!token) { if (!token) {
this.goLogin(); this.goLogin();
...@@ -267,7 +267,7 @@ export default { ...@@ -267,7 +267,7 @@ export default {
let good = (res.data && res.data[0]) || { id: '', name: "职称考精讲课程卡" }; let good = (res.data && res.data[0]) || { id: '', name: "职称考精讲课程卡" };
if(good.id) { if(good.id) {
let pageUrl = getWebPageUrl( let pageUrl = getWebPageUrl(
`profexam/#/goods-detail?goodsId=${good.id}` `profexam/#/goods-detail?goodsId=${good.id}&couponArea=${this.provinceId}`
); );
this.jumpForCoupon(pageUrl); this.jumpForCoupon(pageUrl);
} else { } else {
......
...@@ -264,7 +264,8 @@ export default { ...@@ -264,7 +264,8 @@ export default {
if (this.isWeb) { if (this.isWeb) {
let { token, info } = this.$store.state.user; let { token, info } = this.$store.state.user;
token = token || localStorage.getItem("token") || getCookie("token"); token = token || localStorage.getItem("couponToken") || getCookie("couponToken");
this.token = token;
console.log("token && !info.id", !info.id, token); console.log("token && !info.id", !info.id, token);
if (!token) { if (!token) {
......
...@@ -355,7 +355,7 @@ export default { ...@@ -355,7 +355,7 @@ export default {
} }
localStorage.setItem('returnUrl', this.shareUrl); localStorage.setItem('returnUrl', this.shareUrl);
const { token, info } = this.$store.state.user; const { token, info } = this.$store.state.user;
this.token = getCookie("token") || token; this.token = getCookie("couponToken") || token;
// 如果有token,但没有用户信息,则获取用户信息 // 如果有token,但没有用户信息,则获取用户信息
if (this.token && !info.id) { if (this.token && !info.id) {
this.$store.dispatch("setToken", this.token); this.$store.dispatch("setToken", this.token);
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册