|
|
- import http from './http.js'
-
- const config = {
- // 示例
- // wxLogin : {url : '/api/wxLogin', method : 'POST',
- // auth : false, showLoading : true, loadingTitle : '加载中...',
- // limit : 1000
- // },
-
- getConfig: {
- url: '/api/getConfig',
- method: 'GET',
- limit: 500
- },
-
- //获取banner列表
- indexGetBanner: {
- url: '/api/index/getBanner',
- method: 'GET'
- },
- //获取演员集详情接口
- indexGetActorDetail: {
- url: '/api/index/getActorDetail',
- method: 'GET'
- },
- //获取认证演员
- indexGetActorList: {
- url: '/api/index/getActorList',
- method: 'GET'
- },
- //获取动态列表带分页
- indexGetTrendsPage: {
- url: '/api/index/getTrendsPage',
- method: 'GET'
- },
- //获取动态列表带分页
- indexGetActorSetPage: {
- url: '/api/index/getActorSetPage',
- method: 'GET'
- },
- //获取动态详情
- indexGetTrendsDetail: {
- url: '/api/index/getTrendsDetail',
- method: 'GET'
- },
- //获取投诉原因
- indexGetComplaintReason: {
- url: '/api/index/getComplaintReason',
- method: 'GET'
- },
- //获取投诉原因
- indexGetGetWorkPage: {
- url: '/api/index/getWorkPage',
- method: 'GET'
- },
-
-
-
- // 小程序-个人中心接口
-
- //添加银行卡
- infoAddBankCard: {
- url: '/api/info/addBankCard',
- method: 'GET',
- auth: true
- },
- //获取用户平台数据
- infoGetInfoMoney: {
- url: '/api/info/getInfoMoney',
- method: 'GET',
- auth: true
- },
- //获取银行卡列表带分页
- infoGetBankCardPage: {
- url: '/api/info/getBankCardPage',
- method: 'GET',
- auth: true
- },
- // 获取个人认证信息
- infoGetCertification: {
- url: '/api/info/getCertification',
- method: 'GET',
- auth: true
- },
- //获取企业认证信息
- infoGetCompanyCertification: {
- url: '/api/info/getCompanyCertification',
- method: 'GET',
- auth: true
- },
- // 获取收益记录带分页
- infoGetIncomePage: {
- url: '/api/info/getIncomePage',
- method: 'GET',
- auth: true
- },
- // 获取个人信息接口
- infoGetInfo: {
- url: '/api/info/getInfo',
- method: 'GET',
- auth: true
- },
- // 获取我的发布详情
- infoGetMyReleaseDetail: {
- url: '/api/info/getMyReleaseDetail',
- method: 'GET',
- auth: true
- },
- // 获取我的发布列表
- infoGetMyReleasePage: {
- url: '/api/info/getMyReleasePage',
- method: 'GET',
- auth: true
- },
- // 获取推广记录详情
- infoGetPromotionDetail: {
- url: '/api/info/getPromotionDetail',
- method: 'GET',
- auth: true
- },
- // 获取推广记录列表
- infoGetPromotionPage: {
- url: '/api/info/getPromotionPage',
- method: 'GET',
- auth: true
- },
- // 获取提现记录带分页
- infoGetWithdrawPage: {
- url: '/api/info/getWithdrawPage',
- method: 'GET',
- auth: true
- },
- // 个人认证提交
- infoSubmitCertification: {
- url: '/api/info/submitCertification',
- method: 'GET',
- auth: true
- },
- // 企业认证提交
- infoSubmitCompanyCertification: {
- url: '/api/info/submitCompanyCertification',
- method: 'GET',
- auth: true
- },
- // 修改个人信息接口
- infoUpdateInfo: {
- url: '/api/info/updateInfo',
- method: 'POST',
- auth: true
- },
- // 用户提现
- infoWithdraw: {
- url: '/api/info/withdraw',
- method: 'GET',
- auth: true
- },
-
- //小程序-登录相关接口
-
- //绑定手机接口
- loginBindPhone: {
- url: '/api/login/bindPhone',
- method: 'GET',
- auth: true
- },
- // 找回密码接口
- loginForget: {
- url: '/api/login/forget',
- method: 'GET',
- auth: true
- },
- // 登录接口
- loginLogin: {
- url: '/api/login/login',
- method: 'GET',
- },
- // 退出接口
- loginLogout: {
- url: '/api/login/logout',
- method: 'GET',
- auth: true
- },
- // 注册接口
- loginRegister: {
- url: '/api/login/register',
- method: 'GET',
- },
- // 发送验证码接口
- loginSendcode: {
- url: '/api/login/sendCode',
- method: 'GET',
- },
- }
-
- export function api(key, data, callback, loadingTitle) {
- let req = config[key]
-
- if (!req) {
- console.error('无效key' + key);
- return
- }
-
- if (typeof callback == 'string') {
- loadingTitle = callback
- }
-
- if (typeof data == 'function') {
- callback = data
- data = {}
- }
-
- // 接口限流
- if (req.limit) {
- let storageKey = 'limit:' + req.url
- let storage = uni.getStorageSync(storageKey)
- if (storage && new Date().getTime() - parseInt(storage) < req.limit) {
- return
- }
- uni.setStorageSync(storageKey, new Date().getTime())
- }
-
- //必须登录
- if (req.auth) {
- if (!uni.getStorageSync('token')) {
- uni.navigateTo({
- url: '/pages/auth/login'
- })
- console.error('需要登录')
- return
- }
- }
-
- http.http(req.url, data, callback, req.method,
- loadingTitle || req.showLoading, loadingTitle || req.loadingTitle)
- }
-
-
-
- export default api
|