import { SET_SHOW_LOADING } from './type' import { doPointRequest } from '../../config/requestApi' import { J_STORAGE_KEY } from '../../config/constant' export default { namespaced: true, state() { return { globalLoading: { showLoading: false, showInfo: '' } } }, mutations: { [SET_SHOW_LOADING](state, obj) { state.globalLoading.showLoading = obj.flag state.globalLoading.showInfo = obj.info } }, actions: { /** * * @param context * @param data {{eventType:1-浏览商品 2-添加购物车 3-提交订单,productIds:字符串逗号分割}} * @returns {Promise} */ async doPointer(context, data) { // 判断是否登录 let item = {} if (uni.getStorageSync(J_STORAGE_KEY)) { item = uni.getStorageSync(J_STORAGE_KEY) } if (JSON.stringify(item) === '{}') { return } const res = await doPointRequest(data) // const res = await NET.request(API.doPointer, data, 'post') console.log('埋点---------------------------------->', res) } } }