63 lines
1.8 KiB
JavaScript
63 lines
1.8 KiB
JavaScript
|
import requst from './requst.js';
|
||
|
import toolAll from './tools.js';
|
||
|
|
||
|
export function collectionEV(data){//收藏事件
|
||
|
return requst.post('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('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 buriedPoint(){//查询埋点类型事件
|
||
|
return requst.post('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('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 checkSwip(){//查询主题色
|
||
|
return requst.post('common/slide-positions').then(res=>{
|
||
|
if(res.code==0){
|
||
|
console.log(res);
|
||
|
}
|
||
|
},error=>{})
|
||
|
}
|
||
|
export function checkBanner(data){//查询主题色
|
||
|
return requst.post('common/slides',data)
|
||
|
}
|
||
|
|