Commit 2022ba44 by 匡雅琴

Merge branch 'kuangyq_v2.10.0' of http://192.168.3.233:8090/saas/mini-program/ai…

…-card into kuangyq_v2.10.0
2 parents 11718ce2 8d35ac73
import api from './request' import api from './request'
import ssoApi from './ssoApi' import ssoApi from './ssoApi'
import wechantApi from './wechantApi'
import entmicroApi from './entmicroApi' import entmicroApi from './entmicroApi'
const common = 'scrm.api.carlife.common.' const common = 'scrm.api.carlife.common.'
module.exports = { module.exports = {
ssoApi, ssoApi,
entmicroApi, entmicroApi,
wechantApi,
commonApi: { commonApi: {
/**上传图片 /**上传图片
*/ */
......
...@@ -37,10 +37,10 @@ const domain = { ...@@ -37,10 +37,10 @@ const domain = {
}[target[index]]; }[target[index]];
const pathEnum = { const pathEnum = {
sso: "/rop-scrm-sso/", sso: '/rop-scrm-sso/',
wechant: "rop-scrm-wechant", wechat: '/rop-scrm-sso/',
business: "/rop-scrm-entmicro/", business: '/rop-scrm-entmicro/'
}; }
module.exports = { module.exports = {
index, index,
domain, domain,
......
...@@ -23,9 +23,9 @@ class Request { ...@@ -23,9 +23,9 @@ class Request {
wx.showNavigationBarLoading() wx.showNavigationBarLoading()
let header = RequestMethods === 'POST' ? { let header = RequestMethods === 'POST' ? {
'content-type': 'application/x-www-form-urlencoded' 'content-type': 'application/x-www-form-urlencoded'
} : {} } : {'Cache-Control': 'no-cache'}
const merchantId = wx.$util.getStorageSync('srcm_shopmall_merchant_id') // const merchantId = wx.$util.getStorageSync('srcm_shopmall_merchant_id')
if (merchantId) header.merchantId = merchantId // if (merchantId) header.merchantId = merchantId
let projectName = this.getRopProject(params.method) let projectName = this.getRopProject(params.method)
if (!projectName) projectName = this.getRopProject(params.method) if (!projectName) projectName = this.getRopProject(params.method)
const path = pathEnum[projectName] const path = pathEnum[projectName]
......
...@@ -4,7 +4,7 @@ module.exports = { ...@@ -4,7 +4,7 @@ module.exports = {
/**wx.login登录 */ /**wx.login登录 */
jsCodeLogin(data) { jsCodeLogin(data) {
return api.post({ return api.post({
method: `${path}jscode.login`, method: `${path}jscode.getOpenId`,
...data ...data
}, true) }, true)
}, },
......
...@@ -4,7 +4,7 @@ module.exports = { ...@@ -4,7 +4,7 @@ module.exports = {
/**根据openId获取用户信息 */ /**根据openId获取用户信息 */
getUserInfo(data) { getUserInfo(data) {
return api.post({ return api.post({
method: `${path}auth.userProfile.getUserInfo`, method: `${path}weapp.userProfile.getUserInfo`,
...data ...data
}, true) }, true)
}, },
......
...@@ -7,7 +7,7 @@ import { ...@@ -7,7 +7,7 @@ import {
wechantApi wechantApi
} from './api/api' } from './api/api'
App({ App({
onLaunch: function () { onLaunch: function (options) {
/**挂载到wx对象 */ /**挂载到wx对象 */
wx.$util = util wx.$util = util
wx.$router = router wx.$router = router
...@@ -20,6 +20,7 @@ App({ ...@@ -20,6 +20,7 @@ App({
util.setStorageSync('srcm_shopmall_system_info', res) util.setStorageSync('srcm_shopmall_system_info', res)
} }
}) })
console.log(options)
this.login() this.login()
}, },
login(returnResponse) { login(returnResponse) {
...@@ -33,28 +34,31 @@ App({ ...@@ -33,28 +34,31 @@ App({
code, code,
appId: _this.globalData.appId appId: _this.globalData.appId
}).then(res => { }).then(res => {
console.log(res)
wx.$authStatus = res.code != 0 wx.$authStatus = res.code != 0
util.setSessionId(res.data.sessionId) util.setSessionId(res.data.sessionId)
const openId = res.data.openId const openId = res.data.openId
wechantApi.getUserInfo({ wechantApi.getUserInfo({
openId openId
}).then(result => { }).then(result => {
console.log(result)
if (returnResponse) { if (returnResponse) {
console.log(res,' ====') console.log(result,' ====')
resolve(res) resolve(result)
} else { } else {
if (res.code != -1) { if (result.code != -1) {
if (res.code == 0) { if (result.code == 0) {
util.setUserInfo(res.data) util.setUserInfo(result.data)
// util.setSessionId(res.data.sessionId) if (result.data.nickName) {
wx.$nickName = result.data.nickName
}
} else { } else {
util.showToast(res.message || '网络异常') util.showToast(result.message || '网络异常')
} }
} }
resolve(res) resolve(result)
} }
}) })
}).catch(() => { }).catch(() => {
wx.$authStatus = true wx.$authStatus = true
reject() reject()
......
...@@ -10,6 +10,7 @@ import { menuMixin } from "../../../mixins/index"; ...@@ -10,6 +10,7 @@ import { menuMixin } from "../../../mixins/index";
import Draw from "../../../utils/Draw"; import Draw from "../../../utils/Draw";
import { ssoApi, entmicroApi } from "../../../api/api"; import { ssoApi, entmicroApi } from "../../../api/api";
import util from "../../../utils/util"; import util from "../../../utils/util";
import {trackData} from '../../../utils/data'
Page({ Page({
behaviors: [menuMixin], behaviors: [menuMixin],
/** /**
...@@ -39,13 +40,17 @@ Page({ ...@@ -39,13 +40,17 @@ Page({
// icon1: "icon-cooperation", // icon1: "icon-cooperation",
// }, // },
], ],
curTabIndex: 1, curTabIndex: 0,
// 0-员工,1-代理商 // 0-员工,1-代理商
customerType: 0, customerType: 0,
// 是否授权昵称 // 是否授权昵称
hasUserInfo: false, hasUserInfo: false,
<<<<<<< HEAD
// 是否授权手机号 // 是否授权手机号
hasPhoneNumber: false hasPhoneNumber: false
=======
curTab: [trackData.COMPANY, trackData.CUBE]
>>>>>>> 8d35ac732b4e690c36b92f97d7f3262c98e54c4a
}, },
introduce(e) { introduce(e) {
const curTabIndex = e.currentTarget.dataset.index; const curTabIndex = e.currentTarget.dataset.index;
...@@ -53,16 +58,15 @@ Page({ ...@@ -53,16 +58,15 @@ Page({
// 0-公司介绍 1-方案介绍 2-视频直播 3-合作申请 // 0-公司介绍 1-方案介绍 2-视频直播 3-合作申请
console.log(this.data.curTabIndex); console.log(this.data.curTabIndex);
switch (curTabIndex) { switch (curTabIndex) {
case 3:
wx.$router.go("applicationPartener");
break;
case 2: case 2:
console.log("跳转直播"); console.log("跳转直播");
wx.$Track.sendTrack(trackData.VIDEO)
break; break;
default: default:
this.setData({ this.setData({
curTabIndex: curTabIndex, curTabIndex: curTabIndex,
}); });
wx.$Track.sendTrack(this.data.curTab[this.data.curTabIndex])
} }
}, },
...@@ -97,13 +101,16 @@ Page({ ...@@ -97,13 +101,16 @@ Page({
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
onReady() {}, onReady() {
},
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow() { onShow() {
this.setShareInfo(); this.setShareInfo();
console.log(wx.$util.getUserInfo())
wx.$Track.sendTrack(this.data.curTab[this.data.curTabIndex])
}, },
/** /**
...@@ -257,34 +264,33 @@ Page({ ...@@ -257,34 +264,33 @@ Page({
}, },
// 获取用户昵称 // 获取用户昵称
getUserProfile(e) { getUserProfile(e) {
console.log(e); console.log(e)
this.setData({
hasUserInfo: true
})
// 推荐使用 wx.getUserProfile 获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认 // 推荐使用 wx.getUserProfile 获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认
// 开发者妥善保管用户快速填写的头像昵称,避免重复弹窗 // 开发者妥善保管用户快速填写的头像昵称,避免重复弹窗
wx.getUserProfile({ wx.getUserProfile({
desc: "用于完善资料", // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写 desc: "用于完善资料", // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
success: (res) => { success: (res) => {
console.log(res); console.log(this.data.hasUserInfo)
console.log(this.data.hasUserInfo); ssoApi.authUserInfo({
this.setData({ ...res
hasUserInfo: true, }).then(({
}); code
ssoApi }) => {
.authUserInfo({ if (code == '0') {
...res, getApp().login().then(({
}) data
.then(({ code }) => { }) => {
if (code == "0") { this.setData({
getApp() userInfo: data,
.login() // hasUserInfo: true
.then(({ data }) => { })
this.setData({ })
userInfo: data, }
// hasUserInfo: true })
}); }
}); })
} }
}); })
},
});
},
});
...@@ -39,6 +39,13 @@ ...@@ -39,6 +39,13 @@
"query": "", "query": "",
"launchMode": "default", "launchMode": "default",
"scene": null "scene": null
},
{
"name": "",
"pathName": "pages/tab/index/index",
"query": "scene=sceneId%3D563",
"launchMode": "default",
"scene": null
} }
] ]
} }
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
* } * }
*/ */
import api from '../api/request' import api from '../api/request'
import {trackData} from '../utils/data'
let TRACK_TIME = null, let TRACK_TIME = null,
ADDRESS_INFO = null ADDRESS_INFO = null
const track_interval_time = 60 * 1e3 const track_interval_time = 60 * 1e3
...@@ -24,7 +25,7 @@ class TRACK { ...@@ -24,7 +25,7 @@ class TRACK {
constructor() { constructor() {
console.log('---------------- 埋点初始化 ----------------') console.log('---------------- 埋点初始化 ----------------')
this.initPageProxy() this.initPageProxy()
this.sendTrack() // this.sendTrack()
// this.getAddressInfo().then(res => ADDRESS_INFO = res) // this.getAddressInfo().then(res => ADDRESS_INFO = res)
this.appHide() this.appHide()
} }
...@@ -122,24 +123,47 @@ class TRACK { ...@@ -122,24 +123,47 @@ class TRACK {
return guest_no return guest_no
} }
/**定时发送埋点数据 */ /**定时发送埋点数据 */
sendTrack() { sendTrack(p) {
TRACK_TIME = setInterval(() => { let params = {
let prepare_data = wx.getStorageSync('prepare_data') method: 'entmicro.api.business.card.cardRecord'
let data = { }
method: 'entmicro.api.customercollect.reportCustomerList', const userInfo = {
jsonList: prepare_data nickName: '萌萌哒西瓜',
} type: 1,
if (prepare_data && prepare_data.length) api.reportTrack(data).then(({ openId: '123445',
code, unionId: '',
phone: '18873336682',
merchant: '12121',
cardId: '1'
}
params = Object.assign(params, userInfo, p)
console.log(params)
api.reportTrack(params).then(({
code,
data,
message
}) => {
console.log(code,
data, data,
message message)
}) => { })
if (code == 0 && data) { // TRACK_TIME = setInterval(() => {
wx.setStorageSync('prepare_data', []) // let prepare_data = wx.getStorageSync('prepare_data')
console.log('---------------- 埋点定时推送成功 ----------------', new Date().format('yyyy-MM-dd hh:mm:ss'), ':', prepare_data) // let data = {
} else console.log('---------------- 埋点定时推送失败 ----------------', new Date().format('yyyy-MM-dd hh:mm:ss'), ':', message) // method: 'entmicro.api.business.card.cardRecord',
}) // // jsonList: prepare_data
}, track_interval_time) // }
// if (prepare_data && prepare_data.length) api.reportTrack(data).then(({
// code,
// data,
// message
// }) => {
// if (code == 0 && data) {
// wx.setStorageSync('prepare_data', [])
// console.log('---------------- 埋点定时推送成功 ----------------', new Date().format('yyyy-MM-dd hh:mm:ss'), ':', prepare_data)
// } else console.log('---------------- 埋点定时推送失败 ----------------', new Date().format('yyyy-MM-dd hh:mm:ss'), ':', message)
// })
// }, track_interval_time)
} }
/**获取页面对象实例 */ /**获取页面对象实例 */
getPageInstance = (size = 1) => { getPageInstance = (size = 1) => {
......
const trackData = {
COMPANY: {
pageKey: 0,
pageName: '公司介绍'
},
VIDEO: {
pageKey: 1,
pageName: '视频直播'
},
CUBE: {
pageKey: 2,
pageName: '企微魔方'
},
EQUITY: {
pageKey: 3,
pageName: '数字化权益'
},
CLUE: {
pageKey: 4,
pageName: '智能线索'
}
}
export {
trackData
}
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!