mall-applet1/jsFile/public-api.js

47 lines
1.2 KiB
JavaScript

import requst from './requst.js';
import store from '@/store/index.js'
// 查询轮播位置
export function slidePosition(data) {
return requst.get("/api/common/slide-positions");
}
//查询主题色,图标配置
export function themeEv(){
return requst.get('/api/index/mini-program-setting').then(res=>{
if(res.code==0){
let list = [];
if(res.data.footBar.length){//底部导航
res.data.footBar.forEach(item=>{
let obj = {
iconPath: item.icon,
selectedIconPath: item.icon,
title:item.name
}
list.push(obj);
})
store.commit('updateState', {list})
}
let geList = [];
if(res.data.recommend.length){//底部导航
res.data.recommend.forEach((item,index)=>{
let obj = {
url:item.link,
iconsrc:item.icon,
iconWidth:[48,56,64,48,56,58,48,44,54,52][index],
iconHeight:[50,54,46,48,58,52,54,56,50,52][index],
title:item.name
}
geList.push(obj);
})
store.commit('setGe', {geList})
}
}
})
}
// 查询购物车数量
export function getCartNum(){
return requst.get('/api/order/shopping-cart-count').then(res=>{
if(res.code==0){
store.commit('setNum', res.data.count)
}
})
}