// 督查问题模块

import request from '../utils/gw_ajax_request.js';

const baseurl = '';
// const baseurl = 'http://10.8.4.135:8872'
// const baseurl = 'http://36.250.234.48:8105'

export function getTokenByMobile(data) {
  return request({
    url: baseurl + '/bis/insp/getTokenByTel',
    method: 'POST',
    data: data,
  });
}
export function getPriv(data) {
  return request({
    url: baseurl + '/sys/privs/getPrivByUserId',
    method: 'POST',
    data: data,
  });
}

// 督查问题
// /bis/insp/sendMessage
export function sendMessage(phoneNumber, imgCodeId, code) {
  return request({
    url: baseurl + '/bis/insp/sendMessage',
    method: 'POST',
    data: {
      phone: phoneNumber,
      imgCodeId: imgCodeId,
      code: code,
    },
    params: {
      phone: phoneNumber,
      imgCodeId: imgCodeId,
      code: code,
    },
  });
}
//获取指定用户的角色列表
export function requestUserRole(data) {
  return request({
    url: '/sys/roles/findRoleListByUserId',
    method: 'POST',
    data: data,
  });
}
export function loginWithMessage(loginname, password) {
  return request({
    url: baseurl + '/bis/insp/loginByPass',
    method: 'POST',
    data: {
      password: password,
      loginname: loginname,
    },
    params: {
      password: password,
      loginname: loginname,
    },
  });
}
export function loginWithDingTalkToken(dingTalkToken) {
  return request({
    url: baseurl + '/bis/insp/loginByDD',
    method: 'POST',
    data: {
      token: dingTalkToken,
    },
    params: {
      token: dingTalkToken,
    },
  });
}

//二维码登录 uuid登记
export function qrCodeSubmit(uuid) {
  return request({
    url: baseurl + '/qrcode/login',
    method: 'POST',
    data: {
      uuid: uuid,
    },
    params: {
      uuid: uuid,
    },
  });
}

export function qrCodeLogin(id) {
  return request({
    url: baseurl + '/qrcode/login/' + id,
    method: 'GET',
  });
}
