diff --git a/pages/home/index.vue b/pages/home/index.vue
index 9dce638..64da822 100644
--- a/pages/home/index.vue
+++ b/pages/home/index.vue
@@ -1,711 +1,647 @@
-
-
-
-
- {{ i18n.customerService }}
-
- {{ langTrue }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ i18n.homeMessage }}
-
-
-
-
-
- {{ i18n.Recharge }}
-
-
-
- {{ i18n.Mine }}
-
-
-
- {{ i18n.Subcription }}
-
-
-
-
-
- {{ i18n.TodaySteps }}
-
-
- {{ i18n.ReceiveEarnings }}
-
-
-
-
-
-
-
- {{ item.title }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
diff --git a/utils/api.js b/utils/api.js
index 31560e8..f151cd6 100644
--- a/utils/api.js
+++ b/utils/api.js
@@ -1,80 +1,100 @@
import Vue from 'vue';
import qs from 'qs'
const api = {
- //---------------------------------account---------------------------------
- siteInfo: () => Vue.prototype.$axios.get('/api/home/siteInfo'),
- register: (params) => Vue.prototype.$axios.post('/api/home/register',params),
- login: (params) => Vue.prototype.$axios.post('/api/user/login',params),
- loginOut: (params) => Vue.prototype.$axios.post('/api/user/loginOut',params),
- forgotPassword: (params) => Vue.prototype.$axios.post('/api/user/forgotPassword',params),
- updatePassword: (params) => Vue.prototype.$axios.post('/api/user/updatePassword',params),
- userInfo: (params) => Vue.prototype.$axios.post('/api/user/userInfo',params),
- updateNickname: (params) => Vue.prototype.$axios.post('/api/user/updateNickname',params),
- updateGender: (params) => Vue.prototype.$axios.post('/api/user/updateGender',params),
+ //---------------------------------recharge充值---------------------------------
+ rechargeConfig: (qs.stringify(params) => Vue.prototype.$axios.post('/api/recharge/rechargeConfig',qs.stringify(params),//获取充值配置
+ rechargeAddress: (qs.stringify(params) => Vue.prototype.$axios.post('/api/recharge/rechargeAddress',qs.stringify(params),//获取对应数字币种的充值地址
+ recharge: (qs.stringify(params) => Vue.prototype.$axios.post('/api/recharge/recharge',qs.stringify(params),//法币在线充值下单
+ rechargeList: (qs.stringify(params) => Vue.prototype.$axios.post('/api/recharge/rechargeList',qs.stringify(params),//充值记录
+
- //--------------------------------- free ---------------------------------
- imgCode: () => Vue.prototype.$axios.get('/api/home/imgCode'),
- sendSmsCode: (params) => Vue.prototype.$axios.post('/api/home/sendSmsCode',params),
- article: (params) => Vue.prototype.$axios.post('/api/index/article',params),
-appVersion: (params) => Vue.prototype.$axios.post('/api/index/appVersion',params),
-
-info: () => Vue.prototype.$axios.post('/api/index/info'),
- //--------------------------------- bet ---------------------------------
- lotteryClassList: (params) => Vue.prototype.$axios.post('/api/lottery/lotteryClassList',params),
- nextLotteryPeriod: (params) => Vue.prototype.$axios.post('/api/lottery/nextLotteryPeriod',params),
- bettingConfig: (params) => Vue.prototype.$axios.post('/api/lottery/bettingConfig',params),
- betting: (params) => Vue.prototype.$axios.post('/api/lottery/betting',params),
- lotteryRecords: (params) => Vue.prototype.$axios.post('/api/lottery/lotteryRecords',params),
- myLotteryRecords: (params) => Vue.prototype.$axios.post('/api/lottery/myLotteryRecords',params),
+ //--------------------------------- withdraw提现 ---------------------------------
+ withdrawConfig: (qs.stringify(params) => Vue.prototype.$axios.post('/api/withdraw/withdrawConfig',qs.stringify(params),//获取提现配置
+ withdrawAddressList: (qs.stringify(params) => Vue.prototype.$axios.post('/api/withdraw/withdrawAddressList',qs.stringify(params),//提现地址列表
+ withdrawAddressAdd: (qs.stringify(params) => Vue.prototype.$axios.post('/api/withdraw/withdrawAddressAdd',qs.stringify(params),//保存提现地址
+ withdrawAddressDel: (qs.stringify(params) => Vue.prototype.$axios.post('/api/withdraw/withdrawAddressDel',qs.stringify(params),//删除提现地址
+ withdraw: (qs.stringify(params) => Vue.prototype.$axios.post('/api/withdraw/withdraw',qs.stringify(params),//提现下单
+ withdrawList: (qs.stringify(params) => Vue.prototype.$axios.post('/api/withdraw/withdrawList',qs.stringify(params),//提现记录
+
+
+ //--------------------------------- mine 挖矿 ---------------------------------
+ mineList: (qs.stringify(params) => Vue.prototype.$axios.post('/api/mine/mineList',qs.stringify(params),//获取挖矿产品列表、
+ mineRecord: (qs.stringify(params) => Vue.prototype.$axios.post('/api/mine/mineRecord',qs.stringify(params),//获取购买挖矿记录
+ showMineDetails: (qs.stringify(params) => Vue.prototype.$axios.post('/api/mine/showMineDetails',qs.stringify(params),//获取挖矿产品详情和用户余额
+ mineSubmit: (qs.stringify(params) => Vue.prototype.$axios.post('/api/mine/mineSubmit',qs.stringify(params),//提交购买挖矿产品订单
+ //--------------------------------- 行情 ---------------------------------
+ addFavor: (qs.stringify(params) => Vue.prototype.$axios.post('/market/addFavor',qs.stringify(params),//关注交易对
+ removeFavor: (qs.stringify(params) => Vue.prototype.$axios.post('/market/removeFavor',qs.stringify(params),//取消关注交易对
+ symbolGroup: (qs.stringify(params) => Vue.prototype.$axios.post('/market/symbolGroup',qs.stringify(params),//(新)获取交易对列表(HTTP)
+ marketDetail: (qs.stringify(params) => Vue.prototype.$axios.post('/market/detail',qs.stringify(params),//获取24显示行情(HTTP)
+ bboList: (qs.stringify(params) => Vue.prototype.$axios.post('/market/bboList',qs.stringify(params),//获取买卖单(HTTP)
+ tradeList: (qs.stringify(params) => Vue.prototype.$axios.post('/market/tradeList',qs.stringify(params),//获取成交记录(HTTP)
+
+ //--------------------------------- contract ---------------------------------
+ contractOrder: (qs.stringify(params) => Vue.prototype.$axios.post('/api/contract/order',qs.stringify(params),//合约下单接口
+ setWinOrLossStopPrice: (qs.stringify(params) => Vue.prototype.$axios.post('/api/contract/setWinOrLossStopPrice',qs.stringify(params),//设置止盈止损
+ contractCancel: (qs.stringify(params) => Vue.prototype.$axios.post('/api/contract/cancel',qs.stringify(params),//订单撤销
+ contractClosed: (qs.stringify(params) => Vue.prototype.$axios.post('/api/contract/closed',qs.stringify(params),//合约订单平仓
+ contractConfig: (qs.stringify(params) => Vue.prototype.$axios.post('/api/contract/contractConfig',qs.stringify(params),//合约配置
+ contractOrderList: (qs.stringify(params) => Vue.prototype.$axios.post('/api/contract/orderList',qs.stringify(params),//合约订单列表
+
+ //--------------------------------- transfer ---------------------------------
+ getTransferConfig: (qs.stringify(params) => Vue.prototype.$axios.post('/api/transfer/getTransferConfig',qs.stringify(params),//获取转账配置配置
+ changeCoinWays: (qs.stringify(params) => Vue.prototype.$axios.post('/api/transfer/changeCoinWays',qs.stringify(params),//切换币种或转出账户
+ transfer: (qs.stringify(params) => Vue.prototype.$axios.post('/api/transfer/transfer',qs.stringify(params),//提交划转资金
+
+ //--------------------------------- invitation ---------------------------------
+ invitation: (qs.stringify(params) => Vue.prototype.$axios.post('/api/invitation/invitRules',qs.stringify(params),//获取邀请规则文案
+ invitData: (qs.stringify(params) => Vue.prototype.$axios.post('/api/invitation/invitData',qs.stringify(params),//获取用户邀请数据
+ invitationRecord: (qs.stringify(params) => Vue.prototype.$axios.post('/api/invitation/invitationRecord',qs.stringify(params),//获取用户邀请记录
+ //--------------------------------- 申购 ---------------------------------
+ subscriptionList: (qs.stringify(params) => Vue.prototype.$axios.post('/api/exchange/subscriptionList',qs.stringify(params),//申购币列表
+ subscription: (qs.stringify(params) => Vue.prototype.$axios.post('/api/exchange/subscription',qs.stringify(params),//申购币详情
+ selCoin: (qs.stringify(params) => Vue.prototype.$axios.post('api/exchange/selCoin',qs.stringify(params),//申购详情页切换币种
+ exchangeCoin: (qs.stringify(params) => Vue.prototype.$axios.post('/api/exchange/exchangeCoin',qs.stringify(params),//提交申购订单
+ subscriptionRecord: (qs.stringify(params) => Vue.prototype.$axios.post('/api/exchange/subscriptionRecord',qs.stringify(params),//用户申购记录
+
- //--------------------------------- me ---------------------------------
- getPayType: (params) => Vue.prototype.$axios.post('/api/recharge/getPayType',params),
- rechargeConfig: (params) => Vue.prototype.$axios.post('/api/recharge/rechargeConfig',params),
- recharge: (params) => Vue.prototype.$axios.post('/api/recharge/recharge',params),
- rechargeList: (params) => Vue.prototype.$axios.post('/api/recharge/rechargeList',params),
- toPay: (params) => Vue.prototype.$axios.post('/api/recharge/toPay',params),
- withdrawConfig: (params) => Vue.prototype.$axios.post('/api/withdraw/withdrawConfig',params),
- withdrawServiceCharge: (params) => Vue.prototype.$axios.post('/api/withdraw/withdrawServiceCharge',params),
- withdraw: (params) => Vue.prototype.$axios.post('/api/withdraw/withdraw',params),
- withdrawList: (params) => Vue.prototype.$axios.post('/api/withdraw/withdrawList',params),
- billList: (params) => Vue.prototype.$axios.post('/api/summary/billList',params),
+ //--------------------------------- charity ---------------------------------
+ charityList: (qs.stringify(params) => Vue.prototype.$axios.post('/api/charity/charityList',qs.stringify(params),//获取慈善产品列表
+ charityRecord: (qs.stringify(params) => Vue.prototype.$axios.post('/api/charity/charityRecord',qs.stringify(params),//获取慈善捐赠记录
+ charitySubmit: (qs.stringify(params) => Vue.prototype.$axios.post('/api/charity/charitySubmit',qs.stringify(params),//提交捐赠
+ showCharityDetails: (qs.stringify(params) => Vue.prototype.$axios.post('/api/charity/showCharityDetails',qs.stringify(params),//获取慈善产品详情和用户余额
+ //--------------------------------- 步数 ---------------------------------
+ updateSteps: (qs.stringify(params) => Vue.prototype.$axios.post('/api/steps/updateSteps',qs.stringify(params),// 更新步数
+ receivStepsAward: (qs.stringify(params) => Vue.prototype.$axios.post('/api/steps/receivStepsAward',qs.stringify(params),//领取奖励
- //--------------------------------- invite ---------------------------------
- inviteCode: (params) => Vue.prototype.$axios.post('/api/user/inviteCode',params),
- bonusOut: (params) => Vue.prototype.$axios.post('/api/summary/bonusOut',params),
- bonusOutRecords: (params) => Vue.prototype.$axios.post('/api/summary/bonusOutRecords',params),
- promotionRecords: (params) => Vue.prototype.$axios.post('/api/summary/promotionRecords',params),
- bonusRecords: (params) => Vue.prototype.$axios.post('/api/summary/bonusRecords',params),
- bonusSummary: (params) => Vue.prototype.$axios.post('/api/summary/bonusSummary',params),
- //--------------------------------- bankCard ---------------------------------
- bankcardList: (params) => Vue.prototype.$axios.post('/api/user/bankcardList',params),
- bindBank: (params) => Vue.prototype.$axios.post('/api/user/bindBank',params),
- delBankCard: (params) => Vue.prototype.$axios.post('/api/user/delBankCard',params),
+ //--------------------------------- home ---------------------------------
+ indexInfo: () => Vue.prototype.$axios.get('/api/index/info'),//获取系统通用配置
+ indexLang: (qs.stringify(params) => Vue.prototype.$axios.post('/api/index/lang',qs.stringify(params),//切换语言
+ customerService: (qs.stringify(params) => Vue.prototype.$axios.post('/api/index/customerService',qs.stringify(params),//获取客服联系方式
+ sendEmailCode: (qs.stringify(params) => Vue.prototype.$axios.post('/api/index/sendEmailCode',qs.stringify(params),//发送邮箱验证码
+ indexBanner: (qs.stringify(params) => Vue.prototype.$axios.post('/api/index/banner',qs.stringify(params),//获取banner图列表
+ noticeList: (qs.stringify(params) => Vue.prototype.$axios.post('/api/index/noticeList',qs.stringify(params),//获取公告滚动数据
+ notices: (qs.stringify(params) => Vue.prototype.$axios.post('/api/index/notices',qs.stringify(params),//获取公告分页列表
+ noticeRead: (qs.stringify(params) => Vue.prototype.$axios.post('/api/index/noticeRead',qs.stringify(params),//标记公告已读
+ noticeDetail: (qs.stringify(params) => Vue.prototype.$axios.post('/api/index/noticeDetail',qs.stringify(params),//获取公告详情
+ appVersion: (qs.stringify(params) => Vue.prototype.$axios.post('/api/index/appVersion',qs.stringify(params),//校验APP应用版本
- //--------------------------------- address ---------------------------------
- addressList: (params) => Vue.prototype.$axios.post('/api/user/addressList',params),
- addressSave: (params) => Vue.prototype.$axios.post('/api/user/addressSave',params),
- delAddress: (params) => Vue.prototype.$axios.post('/api/user/delAddress',params),
- //--------------------------------- goods ---------------------------------
- banner: () => Vue.prototype.$axios.get('/api/home/banner'),
- goodsList: (params) => Vue.prototype.$axios.post('/api/index/goodsList',params),
- goodsDetail: (params) => Vue.prototype.$axios.post('/api/index/goods',params),
+ //--------------------------------- 个人中心 ---------------------------------
+ register: (qs.stringify(params) => Vue.prototype.$axios.post('/api/index/register',qs.stringify(params),//注册
+ login: (qs.stringify(params) => Vue.prototype.$axios.post('/api/user/login',qs.stringify(params),//登录
+ loginOut: (qs.stringify(params) => Vue.prototype.$axios.post('/api/user/loginOut',qs.stringify(params),//退出登录
+ forgotPassword: (qs.stringify(params) => Vue.prototype.$axios.post('/api/user/forgotPassword',qs.stringify(params),//忘记密码
+ updatePassword: () => Vue.prototype.$axios.get('/api/user/updatePassword'),//修改登录密码
+ userAccount: (qs.stringify(params) => Vue.prototype.$axios.post('/api/user/userAccount',qs.stringify(params),//用户余额信息
+ bankCardInfo: (qs.stringify(params) => Vue.prototype.$axios.post('/api/user/bankCardInfo',qs.stringify(params),//获取银行卡信息
+ bindBank: (qs.stringify(params) => Vue.prototype.$axios.post('/api/user/bindBank',qs.stringify(params),//绑定/修改银行卡
+ certification: (qs.stringify(params) => Vue.prototype.$axios.post('/api/user/certification',qs.stringify(params),//保存实名认证信息
+ certificationInfo: (qs.stringify(params) => Vue.prototype.$axios.post('/api/user/certificationInfo',qs.stringify(params),//获取实名认证信息
+ billList: (qs.stringify(params) => Vue.prototype.$axios.post('/api/user/billList',qs.stringify(params),//账单记录
+ userInfo: (qs.stringify(params) => Vue.prototype.$axios.post('/api/user/userInfo',qs.stringify(params),//会员基本信息
+ updatePayPassword: (qs.stringify(params) => Vue.prototype.$axios.post('/api/user/updatePayPassword',qs.stringify(params),//修改提现密码
+
+
- //--------------------------------- moni ---------------------------------
- // lotteryClassListM: (params) => Vue.prototype.$axios.post('/api/demo/lotteryClassListDemo',params),
- nextLotteryPeriodM: (params) => Vue.prototype.$axios.post('/api/demo/nextLotteryPeriodDemo',params),
- bettingConfigM: (params) => Vue.prototype.$axios.post('/api/demo/bettingConfigDemo',params),
- bettingM: (params) => Vue.prototype.$axios.post('/api/demo/bettingDemo',params),
- lotteryRecordsM: (params) => Vue.prototype.$axios.post('/api/demo/lotteryRecordsDemo',params),
- myLotteryRecordsM: (params) => Vue.prototype.$axios.post('/api/demo/myLotteryRecordsDemo',params),
- //--------------------------------- hongbao ---------------------------------
- launchRedEnvelop: (params) => Vue.prototype.$axios.post('/api/user/launchRedEnvelop',params),
- redEnvelopList: (params) => Vue.prototype.$axios.post('/api/user/redEnvelopList',params),
- cancelRedEnvelop: (params) => Vue.prototype.$axios.post('/api/user/cancelRedEnvelop',params),
- redEnvelop: (params) => Vue.prototype.$axios.post('/api/user/redEnvelop',params),
- receiveRedEnvelop: (params) => Vue.prototype.$axios.post('/api/user/receiveRedEnvelop',params),
}
diff --git a/utils/axios.js b/utils/axios.js
index 0e35d97..fda9908 100644
--- a/utils/axios.js
+++ b/utils/axios.js
@@ -1,220 +1,219 @@
-import Vue from 'vue'
-import axios from 'axios'
-import qs from 'qs'
-import md5 from 'js-md5';
-import constant from './constant.js';
-
-let baseURL = '';
-let key = '';
-// #ifdef H5
-baseURL = constant.H5
-key = constant.H5_KEY
-// #endif
-// #ifdef APP-PLUS
-baseURL = constant.APP
-key = constant.APP_KEY
-// #endif
-const service = axios.create({
- withCredentials: true,
- crossDomain: true,
- baseURL,
- timeout: 160000
-})
-
-// request拦截器,在请求之前做一些处理
-service.interceptors.request.use(
- config => {
- // console.log('showDialog' + Vue.prototype.$showDialog)
- if (Vue.prototype.$showDialog) {
- uni.showLoading({
- title: 'loading',
- mask: true
- })
- }
- const ticket = uni.getStorageSync('ticket')
- let dataStr = [];
- if (config.method == 'get') {
- if (config.url.split('?').length > 1) {
- dataStr = config.url.split('?')[1].split('&');
- }
-
- }
+import Vue from 'vue'
+import axios from 'axios'
+import qs from 'qs'
+import md5 from 'js-md5';
+import constant from './constant.js';
+
+let baseURL = '';
+let key = '';
+// #ifdef H5
+baseURL = constant.H5
+key = constant.H5_KEY
+// #endif
+// #ifdef APP-PLUS
+baseURL = constant.APP
+key = constant.APP_KEY
+// #endif
+const service = axios.create({
+ withCredentials: true,
+ crossDomain: true,
+ baseURL: constant.BASE_URL,
+ timeout: 160000
+})
+console.log(constant.BASE_URL)
+
+// request拦截器,在请求之前做一些处理
+service.interceptors.request.use(
+ config => {
+ const language = uni.getStorageSync("language") || 'en_US';
+ console.log('语言', uni.getStorageSync('language'))
+ if (constant.SHOW_DIALOG) {
+ uni.showLoading({
+ title: 'loading',
+ mask: true
+ })
+ }
+ if (config.url.indexOf('market') > -1) {
+ config.baseURL = Vue.prototype.MARKET_URL;
+ }
+ const ticket = uni.getStorageSync('ticket')
+ if (ticket != '') {
+ config.data['ticket'] = ticket
+ }
+ if (Vue.prototype.$showDialog) {
+ uni.showLoading({
+ title: 'loading',
+ mask: true
+ })
+ }
+ // if (store.state.token) {
+ // // 给请求头添加user-token
+ // config.headers["user-token"] = store.state.token;
+ // }
+ //const ticket = Vue.prototype.$store.state.ticket
+
+
+ let dataStr = [];
+ if (config.method == 'get') {
+
+ if (config.url.split('?').length > 1) {
+ dataStr = config.url.split('?')[1].split('&');
+ }
+
+ }
+
if (config.method == 'post') {
- dataStr = qs.stringify(config.data).split('&');
- // dataStr = JSON.stringify(config.data);
- // dataStr = config.data;
-
- // dataStr = config.data.name;
-
- }
- config.data = {};
- dataStr.forEach(function (e) {
- console.log(e, 666666)
- config.data[e.split('=')[0]] = e.split('=')[1];
- });
- // console.log(ticket)
- if (ticket != '') {
- config.data['ticket'] = ticket
- }
- var keys = [];
- let sign = '';
- for (var k in config.data)
- keys.push(k);
- keys.sort(function (a, b) {
- return a < b ? -1 : 1;
- })
- // console.log("keys===========");
- keys.forEach(function (e) {
- if (config.data[e] || config.data[e] == '') {
- sign += e + '=' + config.data[e] + '&'
- }
-
- });
-
- // console.log("签名参数===========");
- // console.log(config.url);
- // console.log(sign + key);
- sign = md5(sign + key);
- // console.log("提交参数===========");
- // console.log(qs.stringify(config.data));
- if (config.method == 'post') {
- // console.log(config.data,666666)
- config.data['sign'] = sign
- config.data = qs.stringify(config.data)
- // config.data = config.data.replace(/(\w+)\s*, \s*(\w+)/, "$2 $1");
- // if(config.url == ){
-
- // #ifdef H5
- if (config.url == '/api/index/goodsList') {
- config.data = config.data.replaceAll('20', "");
- config.data = config.data.replaceAll('26', "");
- config.data = config.data.replaceAll('2F', "/");
- config.data = config.data.replaceAll('28', "");
- config.data = config.data.replaceAll('29', "");
- // config.data = config.data.replaceAll('%C2%AE', "®");
- }
- // #endif
- // #ifdef APP-PLUS
- if (config.url == '/api/index/goodsList') {
- config.data = config.data.replace(new RegExp('20', "gm"), "");
- config.data = config.data.replace(new RegExp('26', "gm"), "");
- config.data = config.data.replace(new RegExp('2F', "gm"), "/");
- config.data = config.data.replace(new RegExp('28', "gm"), "");
- config.data = config.data.replace(new RegExp('29', "gm"), "");
- // config.data = config.data.replaceAll('%C2%AE', "®");
- }
- // #endif
-
-
- // config.data = config.data.replaceAll('2528',"(");
- // config.data = config.data.replaceAll('2529',")");
- // config.data = config.data.replaceAll('252',"%2F");
-
- // }
-
- }
- if (config.method == 'get') {
- if (ticket != '') {
- config.url = config.url + '&ticket=' + ticket + '&sign=' + sign
- } else {
- config.url = config.url + '?sign=' + sign
- }
- }
- // console.log(config)
- return config;
- },
- error => {
- // console.log(error); // for debug
- return Promise.reject(error);
- }
-);
-
-//配置成功后的拦截器
-service.interceptors.response.use(res => {
- console.log('过期了吗')
- uni.hideLoading()
- // console.log(res)
- // console.log(res.data)
- // console.log(res.data.data[0].nameAlias)
- if (res.data.success || res.data.errCode === 'USER.0017') {
- // console.log(res.data.success)
- return res.data
- } else {
- uni.showToast({
- title: res.data.errMsg,
- icon: 'none',
- duration: 1500
- })
- if (res.data.errCode === 'USER.0010') {
-
- uni.removeStorage({
- key: 'logInfo',
- success: function (res) {
- uni.reLaunch({ url: '/pages/login/index' })
- },
- fail: (err) => {
- }
- });
-
-
- // #ifdef H5
- var url = location.href;
- if (url.indexOf('pages') > -1) {
- uni.setStorage({
- key: 'url',
- data: url,
- success: function () {
- console.log('success')
- }
- });
- } else {
- uni.removeStorageSync('url')
- }
- // #endif
-
-
- }
- uni.$emit('refreshQrCode')
- return Promise.reject(res.data.errMsg);
- }
-}, error => {
- return Promise.reject(error)
-})
-
-
-axios.defaults.adapter = function (config) { //自己定义个适配器,用来适配uniapp的语法
- return new Promise((resolve, reject) => {
- // console.log(config)
- var settle = require('axios/lib/core/settle');
- var buildURL = require('axios/lib/helpers/buildURL');
- uni.request({
- method: config.method.toUpperCase(),
- url: config.baseURL + buildURL(config.url, config.params, config.paramsSerializer),
- header: config.headers,
- data: config.data,
- dataType: config.dataType,
- responseType: config.responseType,
- sslVerify: config.sslVerify,
- complete: function complete(response) {
- //console.log("执行完成:",config.baseURL + buildURL(config.url, config.params, config.paramsSerializer),response.data)
- response = {
- data: response.data,
- status: response.statusCode,
- errMsg: response.errMsg,
- header: response.header,
- config: config
- };
-
- settle(resolve, reject, response);
- },
- fail: res => {
- uni.showToast({
- title: res,
- icon: 'none',
- duration: 1500
- })
- }
- })
- })
-}
+ console.log(config.data)
+ dataStr = config.data.split('&');
+
+
+
+ }
+ //console.log(config.url,111111,config.data,dataStr)
+ config.data = {};
+
+ dataStr.forEach(function(e) {
+ config.data[e.split('=')[0]] = e.split('=')[1];
+ });
+
+
+ var keys = [];
+ let sign = '';
+
+ var t = Date.now() - 2901;
+ // config.headers["timestamp"] = t;
+ // config.data["timestamp"] = t
+
+ for (var k in config.data)
+ keys.push(k);
+ keys.sort(function(a, b) {
+ return a < b ? -1 : 1;
+ })
+
+
+ //console.log("keys===========",keys);
+
+
+ keys.forEach(function(e) {
+
+ if (config.data[e] || config.data[e] == '') {
+ sign += e + '=' + config.data[e] + '&'
+ }
+
+ });
+
+
+ key = "key=" + constant.KEY;
+ sign = md5(sign + key);
+ config.data['timestamp'] = null
+ if (config.method == 'post') {
+ config.data['sign'] = sign
+
+ config.data = qs.stringify(config.data).replace("timestamp=&", "")
+
+
+ }
+ if (config.method == 'get') {
+
+ config.url = config.url + '&sign=' + sign
+ }
+
+ return config;
+ },
+ error => {
+ // console.log(error); // for debug
+ uni.hideLoading();
+ return Promise.reject(error);
+ }
+);
+
+//配置成功后的拦截器
+service.interceptors.response.use(res => {
+ console.log('过期了吗', res)
+ uni.hideLoading()
+ // console.log(res)
+ // console.log(res.data)
+ // console.log(res.data.data[0].nameAlias)
+ if (res.data.success || res.data.errCode === 'USER.0017') {
+ // console.log(res.data.success)
+ return res.data
+ } else {
+ uni.showToast({
+ title: res.data.errMsg,
+ icon: 'none',
+ duration: 1500
+ })
+ if (res.data.errCode === 'USER.0010') {
+
+ uni.removeStorage({
+ key: 'logInfo',
+ success: function(res) {
+ uni.reLaunch({
+ url: '/pages/login/index'
+ })
+ },
+ fail: (err) => {}
+ });
+
+
+ // #ifdef H5
+ var url = location.href;
+ if (url.indexOf('pages') > -1) {
+ uni.setStorage({
+ key: 'url',
+ data: url,
+ success: function() {
+ console.log('success')
+ }
+ });
+ } else {
+ uni.removeStorageSync('url')
+ }
+ // #endif
+
+
+ }
+ uni.$emit('refreshQrCode')
+ return Promise.reject(res.data.errMsg);
+ }
+}, error => {
+ uni.hideLoading();
+ return Promise.reject(error)
+})
+
+
+axios.defaults.adapter = function(config) { //自己定义个适配器,用来适配uniapp的语法
+ return new Promise((resolve, reject) => {
+ // console.log(config)
+ var settle = require('axios/lib/core/settle');
+ var buildURL = require('axios/lib/helpers/buildURL');
+ uni.request({
+ method: config.method.toUpperCase(),
+ url: config.baseURL + buildURL(config.url, config.params, config.paramsSerializer),
+ header: config.headers,
+ data: config.data,
+ dataType: config.dataType,
+ responseType: config.responseType,
+ sslVerify: config.sslVerify,
+ complete: function complete(response) {
+ //console.log("执行完成:",config.baseURL + buildURL(config.url, config.params, config.paramsSerializer),response.data)
+ response = {
+ data: response.data,
+ status: response.statusCode,
+ errMsg: response.errMsg,
+ header: response.header,
+ config: config
+ };
+
+ settle(resolve, reject, response);
+ },
+ fail: res => {
+ uni.showLoading({
+ title: res,
+ mask: true
+ })
+ }
+ })
+ })
+}
export default service
diff --git a/utils/constant.js b/utils/constant.js
index 4b23699..4f40d86 100644
--- a/utils/constant.js
+++ b/utils/constant.js
@@ -1,14 +1,14 @@
-const H5 = '/start';
-const H5_KEY = 'key=PBcGdWvA7dUintx7WNOR11cOdCrEpasM';
-
-const APP = 'https://api.wingold6.com'; //正式
-// const APP = 'https://apitest.luck-work.com'; //测试
-const APP_KEY = 'key=PBcGdWvA7dUintx7WNOR11cOdCrEpasM';
-const showDialog = true
+const IS_TEST = true;
+const BASE_URL = IS_TEST?'https://sapi.payairs.com':'';
+const MARKET_URL = IS_TEST?'https://market.acefinex.com':'';
+const KEY = IS_TEST?'jsabdjhfbsjndfksnjndja,sndmbstart':'';
+const WSSURL = IS_TEST?'wss://market.acefinex.com/wss/':'';
+const SHOW_DIALOG=true
export default {
- H5,
- H5_KEY,
- APP,
- APP_KEY,
- showDialog,
+ IS_TEST,
+ BASE_URL,
+ MARKET_URL,
+ KEY,
+ WSSURL,
+ SHOW_DIALOG
}
\ No newline at end of file