Browse Source

修改公众号无法关联用户的问题

zyh
Gaoxs 4 years ago
parent
commit
549ae41097
  1. 2
      libs/wechat.js
  2. 11
      main.js
  3. 16
      pages/Loading/index.vue
  4. 14
      pages/shop/GoodsCon/index.vue

2
libs/wechat.js

@ -152,7 +152,7 @@ export async function auth(code) {
console.log('获取微信授权')
return new Promise((resolve, reject) => {
let loginType = cookie.get(LOGINTYPE);
let spread = cookie.get(spread);
let spread = cookie.get('spread');
wechatAuth(code, spread, loginType)
.then(({ data }) => {
console.log(data)

11
main.js

@ -125,16 +125,7 @@ if (!cookie.has(CACHE_KEY)) {
}
var urlSpread = parseQuery()["spread"];
if (urlSpread !== undefined) {
var spread = cookie.get("spread");
urlSpread = parseInt(urlSpread);
if (!Number.isNaN(urlSpread) && spread !== urlSpread) {
cookie.set("spread", urlSpread || 0);
} else if (spread === 0 || typeof spread !== "number") {
cookie.set("spread", urlSpread || 0);
}
}
cookie.set("spread", urlSpread || 0);
// #endif

16
pages/Loading/index.vue

@ -25,7 +25,8 @@
login,
handleQrCode,
getCurrentPageUrl,
handleUrlParam
handleUrlParam,
getCurrentPageUrlWithArgs
} from "@/utils";
export default {
@ -37,17 +38,12 @@
var url = handleQrCode();
if (!url) {
url = handleUrlParam(getCurrentPageUrl())
url = handleUrlParam(getCurrentPageUrlWithArgs())
}
//
if (url) {
var spread = cookie.get("spread");
let urlSpread = parseInt(url.spread);
if (!Number.isNaN(urlSpread) && spread !== urlSpread) {
cookie.set("spread", urlSpread || 0);
} else if (spread === 0 || typeof spread !== "number") {
cookie.set("spread", urlSpread || 0);
}
cookie.set("spread", urlSpread || 0);
}
// if (this.$deviceType == "app" || this.$deviceType == "weixinh5") {
// this.$yrouter.switchTab({
@ -81,8 +77,8 @@
});
cookie.remove('redirect');
} else {
this.$yrouter.replace({
path: '/pages/home/index',
this.$yrouter.switchTab({
path: "/pages/home/index"
});
}
}

14
pages/shop/GoodsCon/index.vue

@ -220,7 +220,9 @@
import {
isWeixin,
PosterCanvas,
handleQrCode
handleQrCode,
handleUrlParam,
getCurrentPageUrlWithArgs
} from "@/utils";
import {
wechatEvevt
@ -303,15 +305,13 @@
computed: mapGetters(["isLogin", "location"]),
mounted: function () {
let url = handleQrCode();
if (!url) {
url = handleUrlParam(getCurrentPageUrlWithArgs())
}
if (url && url.id) {
this.id = url.id;
var spread = cookie.get("spread");
let urlSpread = parseInt(url.spread);
if (!Number.isNaN(urlSpread) && spread !== urlSpread) {
cookie.set("spread", urlSpread || 0);
} else if (spread === 0 || typeof spread !== "number") {
cookie.set("spread", urlSpread || 0);
}
cookie.set("spread", urlSpread || 0);
} else {
this.id = this._route.query.id;
}

Loading…
Cancel
Save