用工小程序前端代码
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.

99 lines
2.1 KiB

11 months ago
11 months ago
11 months ago
  1. export default {
  2. state: {
  3. token:"",
  4. userInfo : {}, //用户信息
  5. },
  6. mutations: {
  7. onAuth(state){
  8. },
  9. setUserInfo(state,obj){
  10. state.userInfo = obj.userInfo
  11. state.token = obj.token
  12. },
  13. logout(state){
  14. uni.showModal({
  15. title: '确认退出登录吗',
  16. success(r) {
  17. if(r.confirm){
  18. state.userInfo = {}
  19. state.token = ""
  20. uni.removeStorageSync('token')
  21. uni.redirectTo({
  22. url: '/pages/index/index'
  23. })
  24. }
  25. }
  26. })
  27. },
  28. },
  29. actions: {
  30. // 企业身份认证检查
  31. async onEnterpriseAuth({ commit }, config = {
  32. success: () => {},
  33. fail: () => {},
  34. }) {
  35. try {
  36. const { getAuthenticationCompany } = await import('@/common/api.js')
  37. const response = await getAuthenticationCompany({})
  38. const company = response.result
  39. if (company && company.status == 1) {
  40. // 认证审核通过
  41. config.success(company)
  42. } else {
  43. // 认证未通过或未认证
  44. config.fail(company)
  45. }
  46. } catch (error) {
  47. console.error('企业认证检查失败:', error)
  48. }
  49. },
  50. // 个人身份认证检查
  51. async onPersonalAuth({ commit }, config = {
  52. success: () => {},
  53. fail: () => {},
  54. }) {
  55. try {
  56. const { getAuthenticationPerson } = await import('@/common/api.js')
  57. const response = await getAuthenticationPerson({})
  58. const person = response.result
  59. if (person && person.status == 1) {
  60. // 认证审核通过
  61. config.success(person)
  62. } else {
  63. // 认证未通过或未认证
  64. config.fail(person)
  65. }
  66. } catch (error) {
  67. console.error('个人认证检查失败:', error)
  68. }
  69. },
  70. // 简历完成状态检查
  71. async onResumeComplete({ commit }, config = {
  72. success: () => {},
  73. fail: () => {},
  74. }) {
  75. try {
  76. const { queryResumeById } = await import('@/common/api.js')
  77. const response = await queryResumeById({})
  78. const resume = response.result
  79. if (resume && resume.id) {
  80. // 简历已完成
  81. config.success(resume)
  82. } else {
  83. // 简历未完成
  84. config.fail(resume)
  85. }
  86. } catch (error) {
  87. console.error('简历状态检查失败:', error)
  88. }
  89. }
  90. }
  91. }