123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190 |
- /*
- * queryStringify
- * 将k-v的对象序列化转成 url?k=v&k1=v1;
- */
- const queryStringify = function (search = {}) {
- return Object.entries(search)
- .reduce(
- (t, v) => `${t}${v[0]}=${encodeURIComponent(v[1])}&`,
- Object.keys(search).length ? '?' : ''
- )
- .replace(/&$/, '')
- }
- export default ($axios) => {
- // 订阅号用户登录
- const customLogin = (data) =>
- $axios.post('/wx/user/login/subscribe/verify/code', data)
- // 订阅号用户绑定邀请码登录
- const customLoginWithCode = (data) =>
- $axios.post('/wx/user/login/subscribe/invitation/code', data)
- // 服务号微信授权登录
- const wechatLogin = (data) =>
- $axios.post('/wx/user/login/authorization', data)
- // 服务号微信授权绑定邀请码登录
- const wechatLoginWithCode = (data) =>
- $axios.post('/wx/user/login/service/invitation/code', data)
- // 获取jssdk配置参数
- const initWxConfig = (params = {}) =>
- $axios.get('/wx/sdk/config/data', { params })
- // 发送验证码
- const sendVerifyCode = (data = {}) =>
- $axios.post('/wx/user/login/verify/code/send', data)
- // 获取文章列表
- const getArticleList = (params = {}) =>
- $axios.get('/wx/data/article/list', { params })
- // 获取图片列表
- const getImageList = (params = {}) =>
- $axios.get('/wx/data/image/list', { params })
- // 获取视频列表
- const getVideoList = (params = {}) =>
- $axios.get('/wx/data/video/list', { params })
- // 获取文件列表
- const getFileList = (params = {}) =>
- $axios.get('/wx/data/file/list', { params })
- // 获取文章详情
- const getArticleDetail = (params = {}) =>
- $axios.get('/wx/data/article/form/data', { params })
- // 用户反馈
- const feedback = (data = {}) => $axios.post('/wx/data/feedback/submit', data)
- // 获取已认证机构列表
- const getAuthClubList = (params = {}) =>
- $axios.get('/wx/auth/club/list', { params })
- // 获取已认证机构列表
- const getAuthClubStarList = (params = {}) =>
- $axios.get('/wx/auth/club/star/list', { params })
- // 获取已认证机构详情
- const getAuthClubDetail = (params = {}) =>
- $axios.get('/wx/auth/club/details', { params })
- // 获取已认证商品分类
- const getAuthProductCateList = (params = {}) =>
- $axios.get('/wx/auth/product/type/list', { params })
- // 获取已认证商品列表
- const getAuthProductList = (params = {}) =>
- $axios.get('/wx/auth/product/list', { params })
- // 验证token是否到期
- const checkToken = (data = {}) =>
- $axios.post('/wx/user/login/token/check', data)
- // 下载文件
- const downFile = (params = {}) => $axios.get('/wx/download/file', { params })
- // 获取城市列表
- const fetchCityList = (params = {}) =>
- $axios.get('/wx/address/select', { params })
- // 获取城市列表
- const fetchAllCityList = () => $axios.get('/wx/address/select/all')
- // 获取供应商信息
- const fetchSupplierInfo = (params = {}) =>
- $axios.get('/wx/auth/shop/info', { params })
- // 获取医师列表
- const fetchDoctorList = (params = {}) =>
- $axios.get('/wx/auth/doctor/list', { params })
- // 获取医师详情
- const fetchDoctorDetail = (params = {}) =>
- $axios.get('/wx/auth/doctor/details', { params })
- // 公众号类型
- const checkAccountType = (params = {}) =>
- $axios.get('/wx/sdk/account/type', { params })
- // 判断用户手机号是否绑定了机构信息
- const fetchClubAuthInfo = (params = {}) =>
- $axios.get('/wx/user/info', { params })
- // 获取品牌列表
- const fetchBrandList = (params = {}) =>
- $axios.get('/wx/auth/shop/info/list', { params })
- // 获取设备分类列表
- const fetchProductSelectList = (params = {}) =>
- $axios.get('/wx/auth/product/type/select', { params })
- // 机构注册(全部信息注册)
- const clubUserRegisterAll = (data = {}) =>
- $axios.post('/wx/user/register/all', data)
- // 机构账号注册
- const clubUserRegister = (data = {}) =>
- $axios.post('/wx/user/register/simple', data)
- // 机构账号密码找回
- const clubUserReset = (data = {}) =>
- $axios.post('/wx/user/password/update', data)
- // 机构账号登录
- const clubUserLogin = (data = {}) =>
- $axios.post('/wx/user/login/password', data)
- // 机构账号验证码
- const clubUserCodeSend = (data = {}) =>
- $axios.post('/wx/user/login/code/send', data)
- // 查询机构认证信息
- const fetchClubAuthInfoData = (params = {}) =>
- $axios.get('/wx/auth/form/data', { params })
- // 查询机构认证信息
- const authClubSave = (data = {}) => $axios.post('/wx/auth/save', data)
- // 查询授权商品列表
- const getClubAuthProductList = (params = {}) =>
- $axios.get('/wx/auth/product/list', { params })
- // 查询授权商品列表
- const getProductDetails = (params = {}) =>
- $axios.get('/wx/auth/product/form/data', { params })
- // 编辑保存授权商品
- const authProducSave = (data = {}) =>
- $axios.post('/wx/auth/product/save', data)
- // 高德地图api : 将坐标转化为高德地图坐标
- const assistant = (params = {}) =>
- fetch(
- 'https://restapi.amap.com/v3/assistant/coordinate/convert' +
- queryStringify(params)
- )
- const assistantBaidu = (params = {}) =>
- fetch('https://api.map.baidu.com/geoconv/v1' + queryStringify(params))
- // 查询授权商品列表
- const fetchProductDetails = (params = {}) =>
- $axios.get('/wx/auth/product/details', { params })
- // 查询授权商品列表
- const fetchDetialBySnCode = (params = {}) =>
- $axios.get('/wx/auth/product/info', { params })
-
- // 查询授权商品列表
- const fetchDocsList = (params = {}) =>
- $axios.get('/wx/data/path/file', { params })
- return {
- customLogin,
- customLoginWithCode,
- wechatLogin,
- wechatLoginWithCode,
- initWxConfig,
- sendVerifyCode,
- getArticleList,
- getImageList,
- getVideoList,
- getFileList,
- getArticleDetail,
- feedback,
- getAuthClubList,
- getAuthClubStarList,
- getAuthProductCateList,
- getAuthProductList,
- checkToken,
- downFile,
- fetchCityList,
- fetchAllCityList,
- fetchSupplierInfo,
- getAuthClubDetail,
- fetchDoctorList,
- fetchDoctorDetail,
- checkAccountType,
- assistant,
- fetchClubAuthInfo,
- fetchBrandList,
- fetchProductSelectList,
- clubUserRegisterAll,
- clubUserRegister,
- clubUserReset,
- clubUserLogin,
- clubUserCodeSend,
- fetchClubAuthInfoData,
- authClubSave,
- getClubAuthProductList,
- getProductDetails,
- authProducSave,
- fetchProductDetails,
- assistantBaidu,
- fetchDetialBySnCode,
- fetchDocsList
- }
- }
|