import axios from '@/utils/request'
import signMd5Utils from '@/utils/encryption/signMd5Utils'

//post
export function postAction(url, parameter) {
  let sign = signMd5Utils.getSign(url, parameter)
  let signHeader = { 'X-Sign': sign, 'X-TIMESTAMP': signMd5Utils.getTimestamp() }

  return axios({
    url: url,
    method: 'post',
    data: parameter,
    headers: signHeader,
  })
}

//get
export function getAction(url, parameter) {
  let sign = signMd5Utils.getSign(url, parameter)
  let signHeader = { 'X-Sign': sign, 'X-TIMESTAMP': signMd5Utils.getTimestamp() }

  return axios({
    url: url,
    method: 'get',
    params: parameter,
    headers: signHeader,
  })
}
/**
 * 查看流图片 用于流图片查看
 * @param url
 * @param parameter
 * @returns {*}
 */
 export function imageFile(url,parameter){
  return axios({
    url: url,
    params: parameter,
    method:'get' ,
    responseType: 'blob',
    headers: {
      'Content-Type': 'blob',  // 图片转换流
    },
  })
}