import http from './http.js' const config = { // 微信登录 wxLogin : {url : '/api/wxLogin', method : 'POST', auth : false}, // 授权隐私信息 getConfig : {url : '/api/getConfig', method : 'GET', auth : false}, // 获取轮播图 getBanner : {url : '/api/getBanner', method : 'GET', auth : false}, // 获取项目列表 getProjectList : {url : '/api/getProjectList', method : 'GET', auth : false}, // 获取技师列表 getTechnicianList : {url : '/api/getTechnicianList', method : 'GET', auth : false}, // 获取技师详情 getTechnicianDetail : {url : '/api/getTechnicianDetail', method : 'GET', auth : false}, // 获取项目详情 getProjectDetail : {url : '/api/getProjectDetail', method : 'GET', auth : false}, // 获取订单列表 getOrderList : {url : '/api/getOrderList', method : 'GET', auth : true}, // 获取订单详情 getOrderDetail : {url : '/api/getOrderDetail', method : 'GET', auth : true}, // 获取评论列表 getCommentList : {url : '/api/getCommentList', method : 'GET', auth : true}, // 获取登录用户信息 getUserInfo : {url : '/api/getUserInfo', method : 'GET', auth : true}, // 微信支付 createOrderWXPay : {url : '/post/create', method : 'POST', auth : true}, // 获取地址列表 getAddressList : {url : '/api/getAddressList', method : 'GET', auth : true}, // 获取地址详情 getAddressDetail : {url : '/api/getAddressDetail', method : 'GET', auth : true}, // 添加或修改地址 addOrUpdateAddress : {url : '/post/addOrUpdateAddress', method : 'POST', auth : true}, // 删除地址 deleteAddress : {url : '/post/deleteAddress', method : 'POST', auth : true}, // 获取优惠券列表 getCouponList : {url : '/api/getCouponList', method : 'GET', auth : true}, // 获取粉丝列表 getFans : {url : '/post/fans', method : 'GET', auth : true}, // 获取粉丝列表 getRechargeList : {url : '/api/getRechargeList', method : 'GET', auth : true}, // 获取交易列表 getAgentFlow : {url : '/api/getAgentFlow', method : 'GET', auth : true}, // 获取二维码 showQrcode : {url : '/post/showQrcode', method : 'GET', auth : true}, // 增加或修改技师入驻信息 addOrUpdateTechnician : {url : '/post/addOrUpdateTechnician', method : 'POST', auth : true}, //获取收藏列表 getCollectList : { url : '/order/getVipCollectList' , method : 'GET' , auth : true }, //新增收藏 addCollect : { url : '/order/collectVipTechnician' , method : 'POST' , auth : true }, //修改用户信息 editUserInfo : { url : '/post/updateUser' , method : 'POST' , auth : true }, //取消收藏 calcelCollect : { url : '/order/cancelVipCollect' , method : 'POST' , auth : true}, //新增或修改技师入驻 addOrUpdateMsgTer : { url : '/post/addOrUpdateMsgTer' , method : 'POST' , auth : true }, //根据用户手机号码验证码更换手机号码绑定信息 ChangePhone : { url : '/order/changePhone' , method : 'POST' , auth : true }, // 1 用户下单 createVipOrder : {url : '/order/createVipOrder', method : 'POST', auth : true}, // 2 用户支付 payVipOrder : {url : '/order/payVipOrder', method : 'POST', auth : true}, // 8 用户评价 evaluateVipOrder : {url : '/order/evaluateVipOrder', method : 'POST', auth : true}, // 获取手机验证码 getVipCode : {url : '/order/getVipCode', method : 'GET', auth : false}, // 获取当前技师的排期 getVipTenOrderList : {url : '/order/getVipTenOrderList', method : 'GET', auth : true}, //用户充值 recharge : {url : '/order/giveWithdrawal' , method : 'POST' , auth : true }, //获取分享签名 getVipShareSign : { url : '/order/getVipShareSign' , method : 'GET' , auth : false }, //修改用户信息-获取手机验证码 changePhone : { url : '/order/changePhone' , method : 'POST' , auth : true }, //取消订单 cancelVipOrder : { url : '/order/cancelVipOrder' , method : 'POST' , auth : true }, //获取当前开放区域 getCurrentArea : { url : '/api/getCurrentArea' , method : 'GET' , auth : false}, //获取技师实名认证 getTenRealName : { url : '/order/getTenRealName' , method : 'GET' , auth : true}, //获取我推荐的技师记录 getTenFans : { url : '/order/getTenFans' , method : 'GET' , auth : true }, //立即支付 immediatelyPay : { url : '/order/immediatelyPay' , method : 'POST' , auth : true }, // 3 技师确认订单 confirmVipOrder : {url : '/order/confirmVipOrder', method : 'POST', auth : true}, // 4 技师出发 startVipOrder : {url : '/order/startVipOrder', method : 'POST', auth : true}, // 5 技师到达 arriveVipOrder : {url : '/order/arriveVipOrder', method : 'POST', auth : true}, // 6 开始服务 startVipService : {url : '/order/startVipService', method : 'POST', auth : true}, // 7 结束服务 endVipService : {url : '/order/endVipService', method : 'POST', auth : true}, // 根据订单标识查询订单详情 getOrderVipDetail : {url : '/order/getOrderVipDetail', method : 'GET', auth : true}, // 技师根据标识查询自己的订单 getVipOrderList : {url : '/order/getVipOrderList', method : 'GET', auth : true}, // 技师登录 wxTechnicianLogin : {url : '/order/wxTechnicianLogin', method : 'POST', auth : false}, } export function api(key, data, callback, ...args){ if (!config[key]) { return console.error('无效key' + key); } if (config[key].auth) { if (!localStorage.getItem('token')) { uni.navigateTo({ url: '/pages/login/login' }) console.error('需要登录') return { then() {} }; } // //用户未绑定手机就跳转板顶手机页面 // if(localStorage.getItem("userInfo_1")){ // let userInfo = JSON.parse(localStorage.getItem("userInfo")) // if(!userInfo.phone){ // uni.navigateTo({ // url: '/pages/mine/phoneDetail' // }) // } // } } http.http(config[key].url, data, callback, config[key].method, ...args) } export default api