const axios = require('@/common/axios').default
import qs from 'qs'
// import axios from '@/common/axios'
const api = '/api-teacher'
import request from '@/helpers/request'
// 发送登录短信验证码
const sendSmsRequest = (data) => {
  return request({
      url: '/code/sendSms',
      method: 'post',
      requestType: 'form',
      data
  })
}
// 校验登录图形验证码
const verifyLoginImage = (data) => {
  return request({
      url: '/code/verifyLoginImage',
      method: 'post',
      requestType: 'form',
      data
  })
}

// 手机号密码方式登录
const usernameLogin = (data) => {
  return axios({
      url: '/api-auth/usernameLogin',
      method: 'post',
      data: qs.stringify(data)
  })
}

// 发送登录短信验证码
const sendSms = (data) => {
  return axios({
      url: '/api-student/code/sendSms',
      method: 'post',
      data: qs.stringify(data)
  })
}

// 短信验证码的方式登录
const smsLogin = (data) => {
  return axios({
      url: '/api-auth/smsLogin',
      method: 'post',
      data: qs.stringify(data)
  })
}

// 注册登录
const registerAdd = (data) => {
  return axios({
      url: '/api-student/register/add',
      method: 'post',
      data: qs.stringify(data)
  })
}

// 设置密码
const userSetPassword = (data) => {
  return axios({
      url: '/api-auth/user/setPassword',
      method: 'post',
      data: qs.stringify(data)
  })
}

// 检查手机号
const queryUserByPhone = (data) => {
  return axios({
      url: '/api-auth/user/noAuth/queryUserByPhone',
      method: 'get',
      params: data
  })
}

// 获取课程组详情
const getGroupDetail = (data) => {
  return axios({
      url: '/api-student/courseGroup/getGroupDetail',
      method: 'get',
      params: data
  })
}

// 购买课程组
const buyCourseGroup = (data) => {
  return axios({
      url: '/api-student/courseGroup/buyCourseGroup',
      method: 'post',
      data: qs.stringify(data)
  })
}

// 创建课程
const createCourseGroup = (data) => {
  return axios({
    url: api + '/courseGroup/createCourseGroup',
    method: 'post',
    data: data
  })
}

const sysTenantAccountGet = (data) => {
  return axios({
    url: api + '/sysTenantAccount/get',
    method: 'get',
    params: data
  })
}

const queryTenantAccountDetail = (data) => {
  return axios({
    url: api + '/sysTenantAccount/queryTenantAccountDetail',
    method: 'get',
    params: data
  })
}

// 课时使用记录列表
const teacherCourseMinutes = (data) => {
  return axios({
    url: api + '/teacherCourseSchedule/teacherCourseMinutes',
    method: 'get',
    params: data
  })
}

// 分页查询活动列表
const tenantEntryActivitesList = (data) => {
  return axios({
    url: api + '/tenantEntryActivities/queryPage',
    method: 'get',
    params: data
  })
}

// 分页查询活动列表
const createOrder = (data) => {
  return axios({
    url: api + '/tenantPaymentOrder/createOrder',
    method: 'post',
    data: qs.stringify(data)
  })
}

// 订单号查询信息
const queryByOrderNo = (data) => {
  return axios({
    url: api + '/tenantPaymentOrder/queryByOrderNo',
    method: 'get',
    params: data
  })
}

// 分页查询活动列表
const queryByOrderNoAuth = (data) => {
  return axios({
    url: api + '/teacherOrder/queryByOrderNo',
    method: 'get',
    params: data
  })
}

// 帮助中心分类
const helpCenterCatalogList = (data) => {
  return axios({
    url: '/api-cms/helpCenterCatalog/list',
    method: 'get',
    params: data
  })
}

// 帮助中心
const helpCenterContentList = (data) => {
  return axios({
    url: '/api-cms/helpCenterContent/list',
    method: 'get',
    params: data
  })
}

// 获取用户基本信息
const queryUserInfo = (data) => {
  return axios({
    url: '/api-auth/queryUserInfo',
    method: 'get',
    params: data
  })
}

// 获取老师评价和学生评价
const getStuAndTeaReview = (data) => {
  return axios({
    url: api + '/courseReview/getStuAndTeaReview',
    method: 'get',
    params: data
  })
}

// 批量添加评价
const batchAdd = (data) => {
  return axios({
    url: api + '/courseReview/batchAdd',
    method: 'post',
    data: data
  })
}


export {
  sendSmsRequest,
  verifyLoginImage,
  usernameLogin,
  sendSms,
  smsLogin,
  registerAdd,
  userSetPassword,
  getGroupDetail,
  buyCourseGroup,
  createCourseGroup,
  sysTenantAccountGet,
  queryTenantAccountDetail,
  helpCenterCatalogList,
  helpCenterContentList,
  teacherCourseMinutes,
  tenantEntryActivitesList,
  queryUserInfo,
  createOrder,
  queryByOrderNo,
  queryByOrderNoAuth,
  getStuAndTeaReview,
  batchAdd,
  queryUserByPhone
}