import axios from '@/common/services/axios-instance'
class AuditCpmProjectUserService {
  // 根据projectId获取项目成员信息
  getProjectUser(projectId) {
    return axios({
      method: 'get',
      url: `api/xcoa-mobile/v1/cpm-project-member/getGroupMember?projectId=${projectId}`,
    }).then((res) => {
      return res.data
    })
  }

  // 获取用户项目成员角色  是否为组长  是：true 不是：false
  getProjectUserRole(projectId) {
    return axios({
      method: 'get',
      url: `api/xcoa-mobile/v1/cpm-project-member/isProjectLeader?projectId=${projectId}`,
    }).then((res) => {
      return res.data
    })
  }

  // 保存用户项目成员
  setProjectUser(projectId, data) {
    return axios({
      method: 'POST',
      url: `api/xcoa-mobile/v1/cpm-project-member/saveProjectMember?projectId=${projectId}`,
      data,
    }).then((res) => {
      return res.data
    })
  }
}

export default new AuditCpmProjectUserService()
