• axios二次封装


    import axios from 'axios'
    import { Indicator, MessageBox } from 'mint-ui'

    const ajax = axios.create({
    // baseURL: isDev ? 'http://rap2api.taobao.org/app/mock/25656' : '其他地址',
    })

    ajax.interceptors.request.use((config) => {
    Indicator.open({
    text: '加载中...',
    spinnerType: 'fading-circle'
    })
    return config
    })

    ajax.interceptors.response.use((resp) => {
    let ret = null
    if (resp.status === 200) {
    ret = Promise.resolve(resp.data)
    } else {
    const errMessage = resp.status.errMessage || '未知'
    MessageBox({
    title: '出错了',
    message: errMessage,
    confirmButtonText: 'ok',
    showCancelButton: true
    })
    }
    Indicator.close()
    return ret
    })

    export default ajax

    export const getJpHome = () => ajax.get('/jp/api/getIndexNavSkip?page=1&zy_ids=p8_c4_l4&app_name=zhe&catname=newest_zhe')
    export const getJXZC = () => ajax.get('/jp/api/getGoods?page=1&zy_ids=p8_c4_l4&app_name=zhe&catname=tab_hpzc&flag=tab_hpzc')
    export const getJXDP = () => ajax.get('/jp/api/getGoods?page=1&zy_ids=p8_c4_l4&app_name=zhe&catname=tab_hpdp&flag=tab_hpdp')

    export const getCategory = () => {
    const now = new Date().getTime()
    return ajax.get(`http://rap2api.taobao.org/app/mock/25656/v2/jp/sort?_t=${now}`)
    }
  • 相关阅读:
    工作流程在线编辑
    利用IIS导出,导入快速部署 web站点
    调用CRM自己的Dialogue
    简单粗爆的解决同时布CRM引起的死锁问题
    CRM 2013 自动发送报表
    CRM 2013 中业务流程的
    调试CRM JS开发
    CRM ribbon按钮上引用JS库
    CRM Look Up 解决方案
    Windows Azure 上传 VM
  • 原文地址:https://www.cnblogs.com/binglove/p/10460220.html
Copyright © 2020-2023  润新知