提交 77d360d4 authored 作者: hexi's avatar hexi

增加数据埋点

上级 5bfac678
// pages/learnSystem/courseContent/courseContent.js
const CourseApi = require('../../../apiService/CourseApi.js')
const util = require('../../../utils/util.js')
Page({
/**
......@@ -277,5 +278,11 @@ Page({
/* 跳转 */
wx.showToast({ title: '请上PC使用该功能', icon: 'none' })
}
},
// 发送formid
formSubmit: function(e) {
util.sendformid(e.detail.formId);
console.log('form发生了submit事件,携带数据为:', e.detail.formId)
}
})
\ No newline at end of file
......@@ -2,10 +2,12 @@
<view class='course-list'>
<block wx:for='{{item.chapterList.course}}' wx:key='{{index}}' wx:for-item='_item'>
<view class='content-group {{!_item.chapters.length ? "no-child" : ""}} {{_item.isUp ? "up" : ""}}'>
<view class='title' bindtap='clickJumpOrStatus' data-index='{{index}}' data-status='{{!!_item.chapters.length}}'>{{_item.title}}
<image class='side' style='{{!_item.chapters.length ? "display: none;" : ""}} {{_item.isUp ? "display: none;" : ""}}' mode='aspectFill' src='../icons/courseContent/up.png'></image>
<image class='side' style='{{!_item.chapters.length ? "display: none;" : ""}} {{_item.isUp ? "" : "display: none;"}}' mode='aspectFill' src='../icons/courseContent/down.png'></image>
</view>
<form report-submit='true' bindsubmit="formSubmit" >
<button form-type="submit" class='title' bindtap='clickJumpOrStatus' data-index='{{index}}' data-status='{{!!_item.chapters.length}}'>{{_item.title}}
<image class='side' style='{{!_item.chapters.length ? "display: none;" : ""}} {{_item.isUp ? "display: none;" : ""}}' mode='aspectFill' src='../icons/courseContent/up.png'></image>
<image class='side' style='{{!_item.chapters.length ? "display: none;" : ""}} {{_item.isUp ? "" : "display: none;"}}' mode='aspectFill' src='../icons/courseContent/down.png'></image>
</button>
</form>
<block wx:for='{{_item.chapters}}' wx:key='{{index1}}' wx:for-item='item1' wx:for-index='index1'>
<view class='body {{item1.id === item.chapterList.currentChapterId && "on"}}'>
<view class='name' data-vid='{{item1.vid}}' data-cid='{{item1.cid}}' data-sid='{{item1.sid}}' data-hasVA='{{item1.time}}' data-name='{{item1.name}}' bindtap='jumpToOtherVA' data-index='{{index}}' data-index1='{{index1}}' data-type='{{item1.videoType}}'>
......
......@@ -3,7 +3,7 @@
.course-list .content-group.no-child { margin-bottom: 20rpx; }
.course-list .content-group.up { margin-bottom: 20rpx; }
.course-list .content-group.up .body { display: none; }
.course-list .content-group .title { position: relative; padding: 20rpx 54rpx 20rpx 24rpx; color: #313131; font-size: 30rpx; line-height: 40rpx; background: #e5e5e5; }
.course-list .content-group .title { position: relative; padding: 20rpx 54rpx 20rpx 24rpx; color: #313131; font-size: 30rpx; line-height: 40rpx; background: #e5e5e5; text-align: left;}
.course-list .content-group .title .side { position: absolute; top: 32rpx; right: 24rpx; width: 30rpx; height: 17rpx; }
.course-list .content-group .body { position: relative; padding: 0 24rpx; font-size: 30rpx; line-height: 42rpx; color: #505050; }
.course-list .content-group .body.on .name { color: #b2183e; }
......
......@@ -133,6 +133,7 @@ const loginApi = (obj, callback) => {
success: res => {
if (res.statusCode == 200) {
wx.setStorageSync('union_id', res.data.union_id);
wx.setStorageSync('openId', res.data.open_id);
wx.request({
url: config.URL_PATH2 + '/user_center/wechat_login',
data: { wechat_unionid: res.data.union_id, service: 'applet.ezijing.com' }, method: 'POST', header: {
......@@ -205,6 +206,30 @@ const LoginAgainAndJumpPage = (callback) => {
miniGetInfo((res, obj) => { callback(res, obj); })
};
// 上报formid
const sendformid = (formId) => {
let _token = wx.getStorageSync('userSession').sessionKey;
if (!_token) {
wx.reLaunch({ url: '/pages/index/index' })
return ;
}
wx.request({
url: config.URL_PATH1 + '/v2/education/formid',
data:{
openid: wx.getStorageSync('openId'),
formid: formId
},
header:{
'token': _token,
'tenant': config.tenant,
'content-type': 'application/x-www-form-urlencoded',
'apikey': 'pP5ECUqRDLDzuh4qRuJro0L1LPgjLP0N',
'version': config.version
},
method:'POST'
})
}
/**
* localStorage 中存放的 各种值
* userSession - 调用 login 获取对应的 sessionKey openId等值
......@@ -218,5 +243,6 @@ module.exports = {
'config': config,
requestApi: requestApi,
durationToTimeString: durationToTimeString,
sendformid: sendformid,
LoginAgainAndJumpPage: LoginAgainAndJumpPage
};
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论