Commit ea512588 by 胡悦

修改unionId

1 parent 6d037212
...@@ -4,7 +4,8 @@ const target = ["ip", "dev", "uat", "beta", "prod"]; ...@@ -4,7 +4,8 @@ const target = ["ip", "dev", "uat", "beta", "prod"];
0本地 0本地
1开发 1开发
2测试 2测试
3生产 3预发布
4生产
*/ */
const index = 3; const index = 3;
const secretKey = { const secretKey = {
......
...@@ -30,6 +30,7 @@ App({ ...@@ -30,6 +30,7 @@ App({
login(returnResponse) { login(returnResponse) {
let _this = this let _this = this
let openId = null let openId = null
let wechatInfo = null
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
wx.login({ wx.login({
success({ success({
...@@ -39,10 +40,12 @@ App({ ...@@ -39,10 +40,12 @@ App({
code, code,
appId: wx.$appId appId: wx.$appId
}).then(res => { }).then(res => {
wechatInfo = res.data
util.setStorageSync('aicard_info', wechatInfo)
wx.$authStatus = res.code != 0 wx.$authStatus = res.code != 0
util.setSessionId(res.data.sessionId) util.setSessionId(wechatInfo.sessionId)
openId = res.data.openId openId = wechatInfo.openId
util.setStorageSync('openId', openId) // util.setStorageSync('openId', openId)
console.log(wx.$trackData) console.log(wx.$trackData)
if (wx.$trackData.scene) { if (wx.$trackData.scene) {
// 初次进入小程序默认埋首页 // 初次进入小程序默认埋首页
...@@ -53,7 +56,7 @@ App({ ...@@ -53,7 +56,7 @@ App({
util.setStorageSync('scene', res) util.setStorageSync('scene', res)
const systemInfo = JSON.parse(wx.getStorageSync('aicard_system_info')) const systemInfo = JSON.parse(wx.getStorageSync('aicard_system_info'))
wx.$trackData.type = systemInfo.environment ? 2 : 1 wx.$trackData.type = systemInfo.environment ? 2 : 1
wx.$Track.sendTrack(trackData.COMPANY, openId) wx.$Track.sendTrack(trackData.COMPANY, wechatInfo)
}) })
} else if(wx.$trackData.detailShare) { } else if(wx.$trackData.detailShare) {
// d+产品分享在这里设置埋点 // d+产品分享在这里设置埋点
...@@ -63,7 +66,7 @@ App({ ...@@ -63,7 +66,7 @@ App({
console.log(i) console.log(i)
if (trackData[i].pageName == detailShare) { if (trackData[i].pageName == detailShare) {
console.log(trackData[i]) console.log(trackData[i])
wx.$Track.sendTrack(trackData[i], openId) wx.$Track.sendTrack(trackData[i], wechatInfo)
break break
} }
} }
...@@ -72,7 +75,7 @@ App({ ...@@ -72,7 +75,7 @@ App({
util.setStorageSync('scene', wx.$trackData) util.setStorageSync('scene', wx.$trackData)
const systemInfo = JSON.parse(wx.getStorageSync('aicard_system_info')) const systemInfo = JSON.parse(wx.getStorageSync('aicard_system_info'))
wx.$trackData.type = systemInfo.environment ? 2 : 1 wx.$trackData.type = systemInfo.environment ? 2 : 1
wx.$Track.sendTrack(trackData.COMPANY, openId) wx.$Track.sendTrack(trackData.COMPANY, wechatInfo)
} }
ssoApi.getUserInfo({ ssoApi.getUserInfo({
openId openId
......
...@@ -281,7 +281,7 @@ Page({ ...@@ -281,7 +281,7 @@ Page({
{ {
text: data.staffName, text: data.staffName,
x: 18, x: 18,
y: 36, y: 40,
color: "#2D2D33", color: "#2D2D33",
fontWeight: 600, fontWeight: 600,
fontSize: 14, fontSize: 14,
...@@ -289,7 +289,7 @@ Page({ ...@@ -289,7 +289,7 @@ Page({
{ {
text: data.operation, text: data.operation,
x: 22 + draw_function.getTextWidth(data.staffName, 14), x: 22 + draw_function.getTextWidth(data.staffName, 14),
y: 40, y: 44,
color: "#6E6E7A", color: "#6E6E7A",
fontWeight: 400, fontWeight: 400,
fontSize: 8, fontSize: 8,
......
...@@ -120,7 +120,8 @@ class TRACK { ...@@ -120,7 +120,8 @@ class TRACK {
return guest_no return guest_no
} }
/**定时发送埋点数据 */ /**定时发送埋点数据 */
sendTrack(p, openId) { sendTrack(p, info) {
console.log(info)
let params = { let params = {
method: 'entmicro.api.business.card.cardRecord', method: 'entmicro.api.business.card.cardRecord',
cardId: wx.$trackData.cardId, cardId: wx.$trackData.cardId,
...@@ -130,19 +131,22 @@ class TRACK { ...@@ -130,19 +131,22 @@ class TRACK {
let userInfo = { } let userInfo = { }
if (wx.$util.getUserInfo()) { if (wx.$util.getUserInfo()) {
const {nickName,openId, unionId, phone} = wx.$util.getUserInfo() || {} const {nickName, openId, phone} = wx.$util.getUserInfo() || {}
userInfo = { userInfo = {
nickName, nickName,
unionId: wx.$util.getStorageSync('aicard_info').unionId,
openId, openId,
unionId,
phone, phone,
} }
} else { } else {
if (openId) { // if (info.openId) {
userInfo.openId = openId // userInfo.openId = info.openId
} else { // } else {
userInfo.openId = wx.$util.getStorageSync('openId') // // userInfo.openId = wx.$util.getStorageSync('openId')
} // userInfo.openId = wx.$util.getStorageSync('aicard_info').openId
// }
userInfo.openId = info && info.openId ? info.openId : wx.$util.getStorageSync('aicard_info').openId
userInfo.unionId = info && info.unionId ? info.unionId : wx.$util.getStorageSync('aicard_info').unionId
} }
params = Object.assign(params, userInfo, p) params = Object.assign(params, userInfo, p)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!