提交 0d2250b8 authored 作者: lhh's avatar lhh

埋点添加

上级 bf845e1e
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
} }
}); });
} }
}, },
onShow: function() { onShow: function() {
console.log('App Show') console.log('App Show')
......
...@@ -4,6 +4,9 @@ export function addCartItem(data) { ...@@ -4,6 +4,9 @@ export function addCartItem(data) {
return request({ return request({
method: 'POST', method: 'POST',
url: '/cart/add', url: '/cart/add',
// header: {
// 'content-type': 'application/json;charset=utf-8'
// },
data: data data: data
}) })
} }
......
function jsonToQueryString(json) {
return Object.keys(json)
.map(key => encodeURIComponent(key) + '=' + encodeURIComponent(json[key]))
.join('&');
}
export function eventSite(params) {
var p = jsonToQueryString(Object.assign({
experiment_id: '7028276368903241728',
experiment_connection_id: '7201846824305426432',
}, params))
var xhr = new XMLHttpRequest();
xhr.open('GET', `https://saas-dml-pro.ezijing.com/api/lab/v1/experiment/member/event-create-by-shop?${p}`, true);
xhr.withCredentials = true;
xhr.send();
}
export function getCurrentTime() {
var currentTime = new Date();
var year = currentTime.getFullYear();
var month = currentTime.getMonth() + 1; // 月份从0开始,因此需要1
var day = currentTime.getDate();
var hours = currentTime.getHours();
var minutes = currentTime.getMinutes();
var seconds = currentTime.getSeconds();
return `${year}-${toDo(month)}-${toDo(day)} ${toDo(hours)}:${toDo(minutes)}:${toDo(seconds)}`
}
function toDo(n) {
return n < 10 ? '0' + n : n
}
\ No newline at end of file
...@@ -37,3 +37,11 @@ export function fetchHotProductList(params) { ...@@ -37,3 +37,11 @@ export function fetchHotProductList(params) {
params:params params:params
}) })
} }
export function setEventSite(params) {
return request({
method: 'GET',
url: '/api/lab/v1/experiment/member/event-create-by-shop',
params:params
})
}
\ No newline at end of file
...@@ -11,7 +11,7 @@ export default class Request { ...@@ -11,7 +11,7 @@ export default class Request {
config = { config = {
baseUrl: '', baseUrl: '',
header: { header: {
'content-type': 'application/json;charset=UTF-8' 'content-type': 'application/json;charset=utf-8'
}, },
method: 'GET', method: 'GET',
dataType: 'json', dataType: 'json',
......
...@@ -63,10 +63,11 @@ ...@@ -63,10 +63,11 @@
}, },
"h5" : { "h5" : {
"devServer" : { "devServer" : {
"https" : false, "https" : true,
"port" : 8060 "port" : 8060,
"host" : "dev.ezijing.com"
}, },
"domain" : "localhost", // "domain" : "dev.ezijing.com",
"router" : { "router" : {
"base" : "" "base" : ""
} }
......
{
"name": "mall-app-web",
"lockfileVersion": 2,
"requires": true,
"packages": {}
}
...@@ -145,7 +145,7 @@ ...@@ -145,7 +145,7 @@
<view class="f-header m-t"> <view class="f-header m-t">
<image src="/static/icon_recommend_product.png"></image> <image src="/static/icon_recommend_product.png"></image>
<view class="tit-box"> <view class="tit-box">
<text class="tit">猜你喜欢</text> <text class="tit" @click="handleEventSite()">猜你喜欢</text>
<text class="tit2">你喜欢的都在这里了</text> <text class="tit2">你喜欢的都在这里了</text>
</view> </view>
<text class="yticon icon-you" v-show="false"></text> <text class="yticon icon-you" v-show="false"></text>
...@@ -168,12 +168,14 @@ ...@@ -168,12 +168,14 @@
<script> <script>
import { import {
fetchContent, fetchContent,
fetchRecommendProductList fetchRecommendProductList,
setEventSite
} from '@/api/home.js'; } from '@/api/home.js';
import { import {
formatDate formatDate
} from '@/utils/date'; } from '@/utils/date';
import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue'; import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
import { eventSite, getCurrentTime } from '../../api/event';
export default { export default {
components: { components: {
uniLoadMore uniLoadMore
...@@ -199,6 +201,9 @@ ...@@ -199,6 +201,9 @@
loadingType:'more' loadingType:'more'
}; };
}, },
onShow() {
this.handleEventSite()
},
onLoad() { onLoad() {
this.loadData(); this.loadData();
}, },
...@@ -254,6 +259,14 @@ ...@@ -254,6 +259,14 @@
}, },
}, },
methods: { methods: {
handleEventSite(name) {
eventSite({
event_english_name: 'enter_brand_homepage',
event_name: '进入品牌首页',
action_type: '首页',
entry_time: getCurrentTime(),
})
},
/** /**
* 加载数据 * 加载数据
*/ */
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
</template> </template>
<script> <script>
import { eventSite, getCurrentTime } from '../../api/event';
import { import {
fetchOrderDetail, fetchOrderDetail,
payOrderSuccess payOrderSuccess
...@@ -60,6 +61,16 @@ ...@@ -60,6 +61,16 @@
}, },
//确认支付 //确认支付
confirm: async function() { confirm: async function() {
eventSite({
event_english_name: 'payment',
event_name: '付款',
action_type: '付款',
product_name: this.orderInfo.orderItemList[0].productBrand,
product_id: this.orderInfo.orderItemList[0].id,
operation_time: getCurrentTime(),
payment_channel: this.payType != 1 ? '微信' : '支付宝',
payment_amount: this.orderInfo.payAmount
})
if(USE_ALIPAY){ if(USE_ALIPAY){
if(this.payType!=1){ if(this.payType!=1){
uni.showToast({ uni.showToast({
......
...@@ -124,6 +124,7 @@ ...@@ -124,6 +124,7 @@
</template> </template>
<script> <script>
import { eventSite, getCurrentTime } from '../../api/event';
import { import {
generateConfirmOrder, generateConfirmOrder,
generateOrder generateOrder
...@@ -229,6 +230,16 @@ ...@@ -229,6 +230,16 @@
} }
generateOrder(orderParam).then(response => { generateOrder(orderParam).then(response => {
let orderId = response.data.order.id; let orderId = response.data.order.id;
eventSite({
event_english_name: 'place_order',
event_name: '提交订单',
product_name: this.cartPromotionItemList[0].productBrand,
product_id: this.cartPromotionItemList[0].id,
action_type: '提交订单',
operation_time: getCurrentTime(),
order_number: orderId,
order_amount: response.data.order.payAmount
})
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: '订单创建成功,是否要立即支付?', content: '订单创建成功,是否要立即支付?',
......
...@@ -37,15 +37,15 @@ ...@@ -37,15 +37,15 @@
<text class="price">{{item.payAmount}}</text> <text class="price">{{item.payAmount}}</text>
</view> </view>
<view class="action-box b-t" v-if="item.status == 0"> <view class="action-box b-t" v-if="item.status == 0">
<button class="action-btn" @click="cancelOrder(item.id)">取消订单</button> <button class="action-btn" @click="cancelOrder(item)">取消订单</button>
<button class="action-btn recom" @click="payOrder(item.id)">立即付款</button> <button class="action-btn recom" @click="payOrder(item.id)">立即付款</button>
</view> </view>
<view class="action-box b-t" v-if="item.status == 2"> <view class="action-box b-t" v-if="item.status == 2">
<button class="action-btn" >查看物流</button> <button class="action-btn" >查看物流</button>
<button class="action-btn recom" @click="receiveOrder(item.id)">确认收货</button> <button class="action-btn recom" @click="receiveOrder(item)">确认收货</button>
</view> </view>
<view class="action-box b-t" v-if="item.status == 3"> <view class="action-box b-t" v-if="item.status == 3">
<button class="action-btn recom" >评价商品</button> <button class="action-btn recom" @click="pjsp(item)">评价商品</button>
</view> </view>
</view> </view>
...@@ -58,6 +58,7 @@ ...@@ -58,6 +58,7 @@
</template> </template>
<script> <script>
import { eventSite, getCurrentTime } from '../../api/event';
import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue'; import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
import empty from "@/components/empty"; import empty from "@/components/empty";
import { import {
...@@ -165,6 +166,17 @@ ...@@ -165,6 +166,17 @@
}, },
}, },
methods: { methods: {
pjsp(item) {
eventSite({
event_english_name: 'rate_the_product',
event_name: '评价商品',
action_type: '评价商品',
product_name: item.orderItemList[0].productBrand,
product_id: item.orderItemList[0].id,
operation_time: getCurrentTime(),
order_number: item.id,
})
},
//获取订单列表 //获取订单列表
loadData(type='refresh') { loadData(type='refresh') {
if(type=='refresh'){ if(type=='refresh'){
...@@ -229,17 +241,26 @@ ...@@ -229,17 +241,26 @@
}); });
}, },
//取消订单 //取消订单
cancelOrder(orderId) { cancelOrder(order) {
let superThis = this; let superThis = this;
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: '是否要取消该订单?', content: '是否要取消该订单?',
success: function (res) { success: function (res) {
if (res.confirm) { if (res.confirm) {
eventSite({
event_english_name: 'cancel_order',
event_name: '取消订单',
action_type: '取消订单',
product_name: order.orderItemList[0].productBrand,
product_id: order.orderItemList[0].id,
operation_time: getCurrentTime(),
order_number: order.id,
})
uni.showLoading({ uni.showLoading({
title: '请稍后' title: '请稍后'
}) })
cancelUserOrder({orderId:orderId}).then(response=>{ cancelUserOrder({orderId:order.id}).then(response=>{
uni.hideLoading(); uni.hideLoading();
superThis.loadData(); superThis.loadData();
}); });
...@@ -256,17 +277,26 @@ ...@@ -256,17 +277,26 @@
}); });
}, },
//确认收货 //确认收货
receiveOrder(orderId){ receiveOrder(order){
let superThis = this; let superThis = this;
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: '是否要确认收货?', content: '是否要确认收货?',
success: function (res) { success: function (res) {
if (res.confirm) { if (res.confirm) {
eventSite({
event_english_name: 'confirm_receipt',
event_name: '确认收货',
action_type: '确认收货',
product_name: order.orderItemList[0].productBrand,
product_id: order.orderItemList[0].id,
operation_time: getCurrentTime(),
order_number: order.id,
})
uni.showLoading({ uni.showLoading({
title: '请稍后' title: '请稍后'
}) })
confirmReceiveOrder({orderId:orderId}).then(response=>{ confirmReceiveOrder({orderId:order.id}).then(response=>{
uni.hideLoading(); uni.hideLoading();
superThis.loadData(); superThis.loadData();
}); });
......
...@@ -216,6 +216,7 @@ ...@@ -216,6 +216,7 @@
</template> </template>
<script> <script>
import { eventSite, getCurrentTime } from '../../api/event';
import share from '@/components/share'; import share from '@/components/share';
import { import {
fetchProductDetail fetchProductDetail
...@@ -297,6 +298,8 @@ ...@@ -297,6 +298,8 @@
couponList: [] couponList: []
}; };
}, },
onShow() {
},
async onLoad(options) { async onLoad(options) {
let id = options.id; let id = options.id;
this.shareList = defaultShareList; this.shareList = defaultShareList;
...@@ -338,6 +341,14 @@ ...@@ -338,6 +341,14 @@
this.initProductDesc(); this.initProductDesc();
this.handleReadHistory(); this.handleReadHistory();
this.initProductCollection(); this.initProductCollection();
eventSite({
event_english_name: 'open_product_details',
product_name: this.product.brandName,
product_id: this.product.id,
event_name: '打开商品详情',
action_type: '打开商品详情',
operation_time: getCurrentTime(),
})
}); });
}, },
//规格弹窗开关 //规格弹窗开关
...@@ -452,6 +463,14 @@ ...@@ -452,6 +463,14 @@
}); });
this.favorite = !this.favorite; this.favorite = !this.favorite;
}); });
eventSite({
event_english_name: 'favorite',
event_name: '收藏',
product_name: this.product.brandName,
product_id: this.product.id,
action_type: '收藏',
operation_time: getCurrentTime(),
})
} }
}, },
buy() { buy() {
...@@ -641,6 +660,14 @@ ...@@ -641,6 +660,14 @@
if (!this.checkForLogin()) { if (!this.checkForLogin()) {
return; return;
} }
eventSite({
event_english_name: 'add_to_cart',
product_name: this.product.brandName,
product_id: this.product.id,
event_name: '加入购物车',
action_type: '加入购物车',
operation_time: getCurrentTime(),
})
let productSkuStock = this.getSkuStock(); let productSkuStock = this.getSkuStock();
let cartItem = { let cartItem = {
price: this.product.price, price: this.product.price,
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
</template> </template>
<script> <script>
import { eventSite, getCurrentTime } from '../../api/event';
import { import {
mapMutations mapMutations
} from 'vuex'; } from 'vuex';
...@@ -53,14 +54,30 @@ ...@@ -53,14 +54,30 @@
this.password = uni.getStorageSync('password') || ''; this.password = uni.getStorageSync('password') || '';
}, },
methods: { methods: {
handleEventSite(type) {
window.localStorage.user_name = this.username
eventSite({
event_english_name: 'login_logout_register',
event_name: '登录退出注册',
user_id: new Date().getTime(),
user_name: this.username,
mobile_number: this.username,
action_type: type === 1 ? '登录' : '注册',
timestamp: getCurrentTime(),
})
},
...mapMutations(['login']), ...mapMutations(['login']),
navBack() { navBack() {
uni.navigateBack(); uni.navigateBack();
}, },
toRegist() { toRegist() {
this.handleEventSite(2)
uni.navigateTo({url:'/pages/public/register'}); uni.navigateTo({url:'/pages/public/register'});
}, },
async toLogin() { async toLogin() {
if (this.username !== '') {
this.handleEventSite(1)
}
this.logining = true; this.logining = true;
memberLogin({ memberLogin({
username: this.username, username: this.username,
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
</template> </template>
<script> <script>
import { eventSite, getCurrentTime } from '../../api/event';
import { import {
mapMutations mapMutations
} from 'vuex'; } from 'vuex';
...@@ -47,6 +48,17 @@ ...@@ -47,6 +48,17 @@
}; };
}, },
methods:{ methods:{
handleEventSite() {
eventSite({
event_english_name: 'login_logout_register',
event_name: '登录退出注册',
user_id: new Date().getTime(),
user_name: window.localStorage.user_name,
mobile_number: window.localStorage.user_name,
action_type: '退出登录',
timestamp: getCurrentTime(),
})
},
...mapMutations(['logout']), ...mapMutations(['logout']),
navTo(url){ navTo(url){
...@@ -62,6 +74,7 @@ ...@@ -62,6 +74,7 @@
}, },
//退出登录 //退出登录
toLogout(){ toLogout(){
this.handleEventSite()
uni.showModal({ uni.showModal({
content: '确定要退出登录么', content: '确定要退出登录么',
success: (e)=>{ success: (e)=>{
......
// appConfig.js // appConfig.js
//配置API请求的基础路径 //配置API请求的基础路径
export const API_BASE_URL = 'https://portal-api.macrozheng.com' export const API_BASE_URL = 'https://mall-portal.ezijing.com'
// export const API_BASE_URL = 'https://saas-dml-pro.ezijing.com'
// https://project-api.ezijing.com/api/passport/account/get-user-info
//是否启用支付宝支付 //是否启用支付宝支付
export const USE_ALIPAY = false export const USE_ALIPAY = false
...@@ -6,8 +6,9 @@ const http = new Request() ...@@ -6,8 +6,9 @@ const http = new Request()
http.setConfig((config) => { /* 设置全局配置 */ http.setConfig((config) => { /* 设置全局配置 */
config.baseUrl = API_BASE_URL /* 根域名不同 */ config.baseUrl = API_BASE_URL /* 根域名不同 */
config.header = { config.header = {
...config.header ...config.header,
} },
config.withCredentials = true
return config return config
}) })
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论