3f535f30
杨鑫
'初始'
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
import Vue from 'vue'
import Vuex from 'vuex'
import {doPointRequest} from '../config/requestApi'
Vue.use(Vuex);//vue的插件机制
const state = {
globalLoading: {
showLoading: false,
showInfo: ''
}
}
const getters = {
loadingFlag: (state) => state.globalLoading.showLoading,
loadingInfo: (state) => state.globalLoading.showInfo
}
const mutations = {
["SET_SHOW_LOADING"](state, obj) {
state.globalLoading.showLoading = obj.flag
state.globalLoading.showInfo = obj.info
}
}
const actions = {
/**
*
* @param context
* @param data {{eventType:1-浏览商品 2-添加购物车 3-提交订单,productIds:字符串逗号分割}}
* @returns {Promise<void>}
*/
async doPointer(context, data) {
//判断是否登录
let item = {}
if (uni.getStorageSync('storage_key')) {
item = uni.getStorageSync('storage_key');
}
if (JSON.stringify(item) === '{}') {
return
}
const res = await doPointRequest(data)
// const res = await NET.request(API.doPointer, data, 'post')
console.log("埋点----------------------------------", res)
}
}
//Vuex.Store 构造器选项
const store = new Vuex.Store({
state,
getters,
mutations,
actions,
})
export default store
|