import requst from './requst.js'; import toolAll from './tools.js'; export function collectionEV(data){//收藏事件 return requst.post('/api/archives/record',data).then(res=>{ if(res.code==0) { let newMsg = '点赞成功' let num = 2 if(data.action=='collect'){ num = 3 newMsg = '收藏成功' } let maiOjb = { e:num,//内容收藏 c:data.archive_id*1, t:new Date().getTime()//当前时间戳 } toolAll.tools.maiDian(maiOjb) toolAll.tools.showToast(newMsg,'none',1500) } },error=>{}) } export function cancleCollectionEV(data){//取消收藏事件 return requst.post('/api/archives/un-record',data).then(res=>{ if(res.code==0) { let newMsg = '已取消点赞' if(data.action=='collect'){ newMsg = '已取消收藏' } toolAll.tools.showToast(newMsg,'none',1500) } },error=>{}) } // 商品收藏、积分收藏 export function collectionShopEV(data){//收藏事件 console.log(data); return requst.post('/api/spu/record',data).then(res=>{ if(res.code==0) { let newMsg = '' let num = 0 if(data.action=='collect'){ num = 3 newMsg = '收藏成功' } let maiOjb = { e:num,//内容收藏 c:data.id*1, t:new Date().getTime()//当前时间戳 } toolAll.tools.maiDian(maiOjb) toolAll.tools.showToast(newMsg,'none',1500) } },error=>{}) } export function cancleCollectionShopEV(data){//取消收藏事件 return requst.post('/api/spu/un-record',data).then(res=>{ if(res.code==0) { let newMsg = '' if(data.action=='collect'){ newMsg = '已取消收藏' } toolAll.tools.showToast(newMsg,'none',1500) } },error=>{}) } export function buriedPoint(){//查询埋点类型事件 return requst.post('/api/statistics/event').then(res=>{ // console.log('查询所有需要埋点的类型:',res); if(res.code==0) uni.setStorageSync('buriedPoint',res.data) },error=>{}) } export function reportBuriedPoint(data){//上报埋点事件 // console.log('埋点的数据:',data); return requst.post('/api/statistics/report',data).then(res=>{},error=>{}) } // export function zhuColor(){//查询主题色 // return requst.post('index/mini-program-setting').then(res=>{ // if(res.code==0){ // uni.setStorageSync('publicColor', res.data.mainColor) //#3875F6 #2E8B57 // // uni.setStorageSync('publicColor', '#2E8B57') //#3875F6 #2E8B57 // } // },error=>{}) // } // 查询轮播图位置 export function checkCarouselLocation(){ return requst.post('/api/common/slide-positions').then(res=>{ if(res.code==0){ console.log(res); } },error=>{}) } // 查询轮播图列表 export function checkBanner(data){ return requst.post('/api/common/slides',data) }