|
|
- export default {
- state: {
- token:"",
- userInfo : {}, //用户信息
- },
-
- mutations: {
- onAuth(state){
-
- },
-
- setUserInfo(state,obj){
- state.userInfo = obj.userInfo
- state.token = obj.token
- },
- logout(state){
- uni.showModal({
- title: '确认退出登录吗',
- success(r) {
- if(r.confirm){
- state.userInfo = {}
- state.token = ""
- uni.removeStorageSync('token')
- uni.redirectTo({
- url: '/pages/index/index'
- })
- }
- }
- })
- },
- },
-
- actions: {
- // 企业身份认证检查
- async onEnterpriseAuth({ commit }, config = {
- success: () => {},
- fail: () => {},
- }) {
- try {
- const { getAuthenticationCompany } = await import('@/common/api.js')
- const response = await getAuthenticationCompany({})
- const company = response.result
-
- if (company && company.status == 1) {
- // 认证审核通过
- config.success(company)
- } else {
- // 认证未通过或未认证
- config.fail(company)
- }
- } catch (error) {
- console.error('企业认证检查失败:', error)
- config.fail(null)
- }
- },
-
- // 个人身份认证检查
- async onPersonalAuth({ commit }, config = {
- success: () => {},
- fail: () => {},
- }) {
- try {
- const { getAuthenticationPerson } = await import('@/common/api.js')
- const response = await getAuthenticationPerson({})
- const person = response.result
-
- if (person && person.status == 1) {
- // 认证审核通过
- config.success(person)
- } else {
- // 认证未通过或未认证
- config.fail(person)
- }
- } catch (error) {
- console.error('个人认证检查失败:', error)
- config.fail(null)
- }
- },
-
- // 简历完成状态检查
- async onResumeComplete({ commit }, config = {
- success: () => {},
- fail: () => {},
- }) {
- try {
- const { queryResumeById } = await import('@/common/api.js')
- const response = await queryResumeById({})
- const resume = response.result
-
- if (resume && resume.id) {
- // 简历已完成
- config.success(resume)
- } else {
- // 简历未完成
- config.fail(resume)
- }
- } catch (error) {
- console.error('简历状态检查失败:', error)
- config.fail(null)
- }
- }
- }
- }
|