user.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. import {
  2. CHNAGE_ELECTRONIC_CARD_INFO,
  3. CHNAGE_ELECTRONIC_LABEL_INFO
  4. } from './type'
  5. import { getStorageKeyToken, getStorageUserId } from '../../utils'
  6. import { getIdEnterpriseUserApi, getUserIdEnterpriseUserLabelApi } from '../../api/anotherTFInterface'
  7. export default {
  8. namespaced: true,
  9. state() {
  10. return {
  11. electronicCardInfo: {
  12. enterpriseUserId: 1, // 名片ID
  13. buyerId: 999, // 用户ID
  14. name: '昵称', // 昵称
  15. sex: '1', // 1男2女
  16. birthday: '2024-09-03', // 生日
  17. phone: '13288888888', // 注册手机号
  18. headImage: 'https://jufeng-shop-1317254189.cos.ap-guangzhou.myqcloud.com/微信图片_20231102095245.jpg', // 头像图片
  19. state: 1, // 是否启用1-是,0-否
  20. ifBlack: 1, // 是否加入黑名单 1-是0-否
  21. isEnterprise: 1, // 是否企业 1-是 0-否
  22. enterpriseName: '企业名称', // 企业名称
  23. enterpriseDuties: '职务', // 职务
  24. enterpriseDepartment: '部门', // 部门
  25. address: '地址地址地址地址地址地址地址地址地址地址地址地址地址地址地址地址地址地址地址地址地址地址地址地址地址地址地址地址地址地址', // 地址
  26. enterpriseHeadImage: 'https://jufeng-shop-1317254189.cos.ap-guangzhou.myqcloud.com/微信图片_20231102095245.jpg', // 企业头像
  27. mailbox: '邮箱', // 邮箱
  28. weChatSignal: '微信号', // 微信号
  29. landline: '座机', // 座机
  30. personalProfile: '个人简介', // 个人简介
  31. label: '1,2,3,4,5,6', // 用户标签ID (1,2,3,4,5,6)
  32. pictureIntroduction: 'https://jufeng-shop-1317254189.cos.ap-guangzhou.myqcloud.com/1705998424162-22(1)(1).png,https://jufeng-shop-1317254189.cos.ap-guangzhou.myqcloud.com/1704700771949-79b9dbdacaa2a34efa5d1f62f02b614.png,https://jufeng-shop-1317254189.cos.ap-guangzhou.myqcloud.com/1705540309535-124.jpg', // 图片介绍
  33. styleId: 1, // 样式ID
  34. createTime: '创建时间',
  35. updateTime: '更新时间'
  36. },
  37. electronicLabelInfo: [
  38. {
  39. labelId: '标签Id',
  40. labelName: '标签名称',
  41. enterpriseUserId: '关联名片ID',
  42. createTime: '创建时间',
  43. updateTime: '更新时间'
  44. },
  45. {
  46. labelId: '标签Id',
  47. labelName: '标签名称',
  48. enterpriseUserId: '关联名片ID',
  49. createTime: '创建时间',
  50. updateTime: '更新时间'
  51. },
  52. {
  53. labelId: '标签Id',
  54. labelName: '标签名称',
  55. enterpriseUserId: '关联名片ID',
  56. createTime: '创建时间',
  57. updateTime: '更新时间'
  58. },
  59. {
  60. labelId: '标签Id',
  61. labelName: '标签名称',
  62. enterpriseUserId: '关联名片ID',
  63. createTime: '创建时间',
  64. updateTime: '更新时间'
  65. },
  66. {
  67. labelId: '标签Id',
  68. labelName: '标签名称',
  69. enterpriseUserId: '关联名片ID',
  70. createTime: '创建时间',
  71. updateTime: '更新时间'
  72. }
  73. ]
  74. }
  75. },
  76. mutations: {
  77. [CHNAGE_ELECTRONIC_CARD_INFO](state, electronicCardInfo) {
  78. state.electronicCardInfo = electronicCardInfo
  79. },
  80. [CHNAGE_ELECTRONIC_LABEL_INFO](state, electronicLabelInfo) {
  81. state.electronicLabelInfo = electronicLabelInfo
  82. }
  83. },
  84. actions: {
  85. getElectronicCardAction({ state, dispatch, commit }) {
  86. return new Promise((resolve, reject) => {
  87. if (!getStorageKeyToken()) return reject('缺少个人信息')
  88. getIdEnterpriseUserApi({ id: getStorageUserId() })
  89. .then((res) => {
  90. commit(CHNAGE_ELECTRONIC_CARD_INFO, res.data)
  91. resolve(res.data)
  92. })
  93. .catch((err) => {
  94. reject(err)
  95. })
  96. })
  97. },
  98. getElectronicLabelAction({ state, dispatch, commit }, { id }) {
  99. return new Promise((resolve, reject) => {
  100. if (!getStorageKeyToken()) return reject('缺少个人信息')
  101. getUserIdEnterpriseUserLabelApi({ enterpriseUserId: id })
  102. .then((res) => {
  103. commit(CHNAGE_ELECTRONIC_LABEL_INFO, res.data || [])
  104. resolve(res.data || [])
  105. })
  106. .catch((err) => {
  107. reject(err)
  108. })
  109. })
  110. }
  111. }
  112. }