多租户商城-商户小程序端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.4 KiB

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