From 1918aebc02d1f9f3fd51d90037d2ff7379d9f75f Mon Sep 17 00:00:00 2001
From: j1ack <1209452658@qq.com>
Date: Thu, 8 Sep 2022 16:31:32 +0800
Subject: [PATCH 1/4] =?UTF-8?q?=E5=90=88=E5=B9=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../entrustOrderList/entrustOrderList.vue | 16 +-
manifest.json | 21 +--
pages/home/index.vue | 2 +-
pages/markets/kLine.vue | 50 +++---
utils/axios.js | 151 +++++++++++-------
utils/websocket.js | 11 +-
6 files changed, 146 insertions(+), 105 deletions(-)
diff --git a/components/entrustOrderList/entrustOrderList.vue b/components/entrustOrderList/entrustOrderList.vue
index c02216d..c0ba207 100644
--- a/components/entrustOrderList/entrustOrderList.vue
+++ b/components/entrustOrderList/entrustOrderList.vue
@@ -32,8 +32,8 @@
{{item.openedPrice}}
{{ i18n.Bond }}
{{item.bondAmount}}
- {{ i18n.StyPrice }}
- {{item.winStopPrice}}
+ {{ i18n.StyPrice }}
+ {{item.winStopPrice}}
@@ -41,17 +41,17 @@
{{item.hand}} * {{item.leverage}}
{{ i18n.Fee }}
{{item.fee}}
- {{ i18n.StsPrice }}
- {{item.lossStopPrice}}
+ {{ i18n.StsPrice }}
+ {{item.lossStopPrice}}
{{ i18n.CurrentPrice }}
{{marketDetail.close}}
- {{ i18n.status }}
+
{{ i18n.do }}
{{ i18n.StopLimit }}
@@ -81,10 +81,10 @@
- {{ i18n.status }}
+
{{ i18n.PL }}
0
diff --git a/manifest.json b/manifest.json
index 28ab375..ce01c1a 100644
--- a/manifest.json
+++ b/manifest.json
@@ -44,7 +44,9 @@
"abiFilters" : [ "armeabi-v7a", "arm64-v8a", "x86" ]
},
/* ios打包配置 */
- "ios" : {},
+ "ios" : {
+ "dSYMs" : false
+ },
/* SDK配置 */
"sdkConfigs" : {
"ad" : {}
@@ -82,22 +84,7 @@
}
}
},
- "nativePlugins" : {
- "HF-Step" : {
- "__plugin_info__" : {
- "name" : "原生计步器(Android和IOS)",
- "description" : "计步器,原生计步器插件,安卓,IOS",
- "platforms" : "Android,iOS",
- "url" : "https://ext.dcloud.net.cn/plugin?id=6632",
- "android_package_name" : "com.samehome",
- "ios_bundle_id" : "com.samehome",
- "isCloud" : true,
- "bought" : 1,
- "pid" : "6632",
- "parameters" : {}
- }
- }
- }
+ "nativePlugins" : {}
},
"h5" : {
"publicPath" : "/",
diff --git a/pages/home/index.vue b/pages/home/index.vue
index 01233bc..c073d5b 100644
--- a/pages/home/index.vue
+++ b/pages/home/index.vue
@@ -170,7 +170,7 @@
}
},
onLoad() {
- this.baseURL = constant.BASE_URL
+ this.baseURL = constant.BASE_URL
this.getbanner();
this.noticeList();
this.getUserInfoBalance();
diff --git a/pages/markets/kLine.vue b/pages/markets/kLine.vue
index a42c0dc..aeefda1 100644
--- a/pages/markets/kLine.vue
+++ b/pages/markets/kLine.vue
@@ -279,11 +279,16 @@
} else if (data.channel === 'market.' + that.symbol.symbol + '.detail') {
that.marketDetail = data.data;
} else if (data.channel === 'market.' + that.symbol.symbol + ".kline." + that.type) {
+ // console.log('k线回来')
if (data.event === 'req') {
+ // console.log('k线回来req')
+ // console.log(11111,data)
that.kdata = that.splitData(data.data)
} else {
+
that.upkline(data.data)
}
+
}
});
@@ -392,22 +397,23 @@
script.src = './static/echarts.js';
script.onload = this.upData.bind(this);
document.head.appendChild(script);
-
-
},
calculateMA(dayCount, data) {
var result = [];
- for (var i = 0, len = data.values.length; i < len; i++) {
- if (i < dayCount) {
- result.push('-');
- continue;
- }
- var sum = 0;
- for (var j = 0; j < dayCount; j++) {
- sum += data.values[i - j][1];
+ if(data.values){
+ for (var i = 0, len = data.values.length; i < len; i++) {
+ if (i < dayCount) {
+ result.push('-');
+ continue;
+ }
+ var sum = 0;
+ for (var j = 0; j < dayCount; j++) {
+ sum += data.values[i - j][1];
+ }
+ result.push(+(sum / dayCount).toFixed(3));
}
- result.push(+(sum / dayCount).toFixed(3));
+
}
return result;
},
@@ -418,16 +424,20 @@
if (!this.is) {
// console.log("this.is11111111", this.is)
this.myChart = echarts.init(chartDom);
- if (this.kdata.categoryData.length < 100) {
- this.start = 50
- this.end = 100
- } else if (this.kdata.categoryData.length < 200) {
- this.start = 85
- this.end = 100
- } else {
- this.start = 98
- this.end = 100
+
+ if(this.kdata.categoryData){
+ if (this.kdata.categoryData.length < 100) {
+ this.start = 50
+ this.end = 100
+ } else if (this.kdata.categoryData.length < 200) {
+ this.start = 85
+ this.end = 100
+ } else {
+ this.start = 98
+ this.end = 100
+ }
}
+
} else {
// console.log(this.myChart.getModel().option.dataZoom[0].start)
diff --git a/utils/axios.js b/utils/axios.js
index afd423a..33398d0 100644
--- a/utils/axios.js
+++ b/utils/axios.js
@@ -21,7 +21,7 @@ const service = axios.create({
// request拦截器,在请求之前做一些处理
service.interceptors.request.use(
config => {
- const language = uni.getStorageSync("language")|| 'en_US';
+ const language = uni.getStorageSync("language") || 'en_US';
// console.log('语言', language)
if (constant.SHOW_DIALOG) {
// uni.showLoading({
@@ -29,21 +29,58 @@ service.interceptors.request.use(
// mask: true
// })
}
-
+ console.log(config.url)
+ if (config.url.indexOf("/api/index/register") !== -1 ||
+ config.url.indexOf("/api/user/login") !== -1 ||
+ config.url.indexOf("/api/user/forgotPassword") !== -1 ||
+ config.url.indexOf("/api/user/updatePassword") !== -1 ||
+ config.url.indexOf("/api/user/bindBank") !== -1 ||
+ config.url.indexOf("/api/user/updatePayPassword") !== -1 ||
+ config.url.indexOf("/api/index/sendEmailCode") !== -1 ||
+ config.url.indexOf("/api/user/loginOut") !== -1 ||
+ config.url.indexOf("/api/recharge/recharge") !== -1 ||
+ config.url.indexOf("/api/withdraw/withdrawAddressAdd") !== -1 ||
+ config.url.indexOf("/api/withdraw/withdraw") !== -1 ||
+ config.url.indexOf("/api/mine/mineSubmit") !== -1 ||
+ config.url.indexOf("/api/contract/order") !== -1 ||
+ config.url.indexOf("/api/contract/setWinOrLossStopPrice") !== -1 ||
+ config.url.indexOf("/api/contract/cancel") !== -1 ||
+ config.url.indexOf("/api/contract/closed") !== -1 ||
+ config.url.indexOf("/api/transfer/transfer") !== -1 ||
+ config.url.indexOf("/api/exchange/exchangeCoin") !== -1 ||
+ config.url.indexOf("/api/charity/charitySubmit") !== -1 ||
+ config.url.indexOf("/api/steps/receivStepsAward") !== -1 ||
+ config.url.indexOf("/api/withdraw/withdrawAddressDel") !== -1
+ ) {
+ console.log(config.url)
+ uni.showLoading({
+ title: 'loading',
+ mask: true
+ })
+ }
+
+ if (config.url.indexOf("/api/recharge/rechargeConfig") !== -1
+ || config.url.indexOf("/api/recharge/rechargeList") !== -1
+ || config.url.indexOf("/api/withdraw/withdrawConfig") !== -1
+ || config.url.indexOf("/api/withdraw/withdrawList") !== -1
+ || config.url.indexOf("/api/contract/orderList") !== -1
+ ) {
+ uni.hideLoading()
+ }
if (config.url.indexOf('market') > -1) {
- // #ifdef H5
- config.baseURL = constant.H5_MARKET_URL;
- // #endif
- // #ifdef APP-PLUS
- config.baseURL = constant.MARKET_URL
- // #endif
-
- }
-
+ // #ifdef H5
+ config.baseURL = constant.H5_MARKET_URL;
+ // #endif
+ // #ifdef APP-PLUS
+ config.baseURL = constant.MARKET_URL
+ // #endif
+
+ }
+
const ticket = uni.getStorageSync('ticket')
if (ticket) {
- if(!config.data){
+ if (!config.data) {
config.data = {};
}
config.data['ticket'] = ticket
@@ -70,7 +107,7 @@ service.interceptors.request.use(
}
- if (config.method == 'post') {
+ if (config.method == 'post') {
dataStr = decodeURIComponent(qs.stringify(config.data)).split('&');
}
//console.log(config.url,111111,config.data,dataStr)
@@ -82,9 +119,9 @@ service.interceptors.request.use(
var keys = [];
let sign = '';
-
+
var t = Date.now() - 2901;
-
+
config.data['lang'] = language;
for (var k in config.data)
keys.push(k);
@@ -92,8 +129,8 @@ service.interceptors.request.use(
return a < b ? -1 : 1;
})
-
-
+
+
keys.forEach(function(e) {
@@ -105,10 +142,10 @@ service.interceptors.request.use(
});
- var key = "key=" + constant.KEY;
-
-
- // console.log(sign + key)
+ var key = "key=" + constant.KEY;
+
+
+ // console.log(sign + key)
sign = md5(sign + key);
if (config.method == 'post') {
config.data['sign'] = sign
@@ -125,8 +162,8 @@ service.interceptors.request.use(
return config;
},
error => {
- // console.error(error);
- // for debug
+ // console.error(error);
+ // for debug
uni.hideLoading();
return Promise.reject(error);
}
@@ -134,45 +171,45 @@ service.interceptors.request.use(
//配置成功后的拦截器
service.interceptors.response.use(res => {
-
- uni.hideLoading()
-
- res=res.data;
- // console.log('数据',res)
+
+ uni.hideLoading()
+
+ res = res.data;
+ // console.log('数据',res)
// console.log(res.data)
// console.log(res.data.data[0].nameAlias)
- if (res.code===0||res.success) {
+ if (res.code === 0 || res.success) {
return res.data;
- }
-
- uni.showToast({
- title: res.errMsg,
- icon: 'none',
- duration: 1500
+ }
+
+ uni.showToast({
+ title: res.errMsg,
+ icon: 'none',
+ duration: 1500
+ })
+ if (res.errCode === 'SYS.0006') {
+ uni.setStorageSync('ticket', null);
+ uni.setStorageSync('logInfo', null);
+ uni.reLaunch({
+ url: '/pages/login/index'
})
- if (res.errCode === 'SYS.0006') {
- uni.setStorageSync('ticket',null);
- uni.setStorageSync('logInfo',null);
- uni.reLaunch({
- url: '/pages/login/index'
- })
- // #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
+ // #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')
}
- uni.$emit('refreshQrCode')
- return Promise.reject(res.errMsg);
+ // #endif
+ }
+ uni.$emit('refreshQrCode')
+ return Promise.reject(res.errMsg);
}, error => {
uni.hideLoading();
return Promise.reject(error)
diff --git a/utils/websocket.js b/utils/websocket.js
index 9b0b10c..3ae8472 100644
--- a/utils/websocket.js
+++ b/utils/websocket.js
@@ -124,6 +124,7 @@ class WebSocketClass {
// #ifdef APP-PLUS
this.ws.onMessage(event => {
+
this.globalCallback(JSON.parse(event.data))
});
// #endif
@@ -150,7 +151,7 @@ class WebSocketClass {
this.ws && this.ws.send({
data: JSON.stringify(msg),
success() {
- console.log('消息发送成功');
+ console.log('消息发送成功',msg);
},
fail(err) {
console.log('关闭失败', err)
@@ -218,7 +219,13 @@ class WebSocketClass {
}
subKHistory(timeType, symbol) {
var toDate = parseInt(new Date().getTime() / 1000);
- var num = 100000;
+ var num = 10000;
+
+
+ // #ifdef APP-PLUS
+ num = 3000;
+ // #endif
+
var fromDate = parseInt(new Date().getTime() / 1000);
switch (timeType) {
case '1min':
From 10c8ed6840604e3e545e2796c53a0a116b7d3b7a Mon Sep 17 00:00:00 2001
From: j1ack <1209452658@qq.com>
Date: Fri, 9 Sep 2022 10:13:15 +0800
Subject: [PATCH 2/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=A2=E5=8D=95?=
=?UTF-8?q?=E5=88=97=E8=A1=A8=E7=9A=84=E6=95=B0=E6=8D=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
components/entrustOrderList/entrustOrderList.vue | 14 ++++++++++++--
utils/language/en_US.js | 2 ++
utils/language/vi_VN.js | 1 +
utils/language/zh_TW.js | 1 +
4 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/components/entrustOrderList/entrustOrderList.vue b/components/entrustOrderList/entrustOrderList.vue
index c0ba207..bd2aa37 100644
--- a/components/entrustOrderList/entrustOrderList.vue
+++ b/components/entrustOrderList/entrustOrderList.vue
@@ -67,9 +67,12 @@
{{ i18n.ClosePrice }}
{{item.closedPrice}}
- {{ i18n.status }}
+ {{ i18n.ROE }}
- {{item.status=='undone'?i18n.undone:item.status=='opened'?i18n.opened:item.status=='revoked'?i18n.revoked:i18n.closed}}
+
+
+ {{getValue(item.profitAmount/item.bondAmount)}}%
+
{{ i18n.PL }}
@@ -246,6 +249,13 @@
timer2 = null;
},
methods: {
+ // 获取百分比位数
+ getValue(e){
+ let data = e*100
+ data = parseFloat(data.toPrecision(10))
+ data = String(data)
+ return data.substring(0, data.indexOf(".") + 3);
+ },
// 获取位数
getPrice(s) {
var i=s;
diff --git a/utils/language/en_US.js b/utils/language/en_US.js
index e2fa6c9..488ac7c 100644
--- a/utils/language/en_US.js
+++ b/utils/language/en_US.js
@@ -95,6 +95,8 @@ export default {
// 合约页面相关
markets: {
+ ROE:'ROE',
+
// 漏掉的国际化
undone:'undone',
opened:'open position',
diff --git a/utils/language/vi_VN.js b/utils/language/vi_VN.js
index 2431716..72e04c8 100644
--- a/utils/language/vi_VN.js
+++ b/utils/language/vi_VN.js
@@ -93,6 +93,7 @@ export default {
// 合约页面相关
markets: {
+ ROE:'Thua',
// 漏掉的国际化
undone: 'Không',
diff --git a/utils/language/zh_TW.js b/utils/language/zh_TW.js
index 63a79b6..accc342 100644
--- a/utils/language/zh_TW.js
+++ b/utils/language/zh_TW.js
@@ -94,6 +94,7 @@ export default {
// 合约页面相关
markets: {
+ ROE:'收益率',
// 漏掉的国际化
undone:'未成交',
opened:'已開倉',
From fc30384c6107a062ddce30e32d6867108713e84f Mon Sep 17 00:00:00 2001
From: j1ack <1209452658@qq.com>
Date: Fri, 9 Sep 2022 14:29:53 +0800
Subject: [PATCH 3/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=A2=E5=8D=95?=
=?UTF-8?q?=E5=88=97=E8=A1=A8=E7=9A=84=E6=95=B0=E6=8D=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../entrustOrderList/entrustOrderList.vue | 158 ++++++++++++++----
components/transaction/transaction.vue | 13 +-
pages/login/forget.vue | 2 +-
pages/markets/trade.vue | 4 +-
pages/withdrawal/addAddress.vue | 15 +-
pages/withdrawal/chooseAddress.vue | 2 +
utils/api.js | 1 +
utils/language/en_US.js | 3 +
utils/language/vi_VN.js | 2 +
utils/language/zh_TW.js | 7 +-
10 files changed, 168 insertions(+), 39 deletions(-)
diff --git a/components/entrustOrderList/entrustOrderList.vue b/components/entrustOrderList/entrustOrderList.vue
index bd2aa37..9a699cb 100644
--- a/components/entrustOrderList/entrustOrderList.vue
+++ b/components/entrustOrderList/entrustOrderList.vue
@@ -19,9 +19,16 @@
{{item.timestr}}
{{ i18n.CloseTime }}
{{item.timestr2}}
- {{
+ {{
i18n.close
}}
+
+ {{ i18n.PL }}:{{" "}}
+
+ 0
+
+
+
@@ -34,6 +41,9 @@
{{item.bondAmount}}
{{ i18n.StyPrice }}
{{item.winStopPrice}}
+
+ {{ i18n.Margincall }}
+
@@ -43,6 +53,12 @@
{{item.fee}}
{{ i18n.StsPrice }}
{{item.lossStopPrice}}
+
+
+
+ {{ i18n.StopLimit }}
+
+
@@ -52,16 +68,23 @@
{{item.status=='undone'?i18n.undone:item.status=='opened'?i18n.opened:item.status=='revoked'?i18n.revoked:i18n.closed}}
-->
- {{ i18n.do }}
-
- {{ i18n.StopLimit }}
+ {{ i18n.ROE }}
+
+ {{getValue(item.profitAmount/item.bondAmount)}}%
+
{{ i18n.ExpectProfit }}
{{getItem(item.direction=='buy'?(marketDetail.close-item.openedPrice)*item.hand:(item.openedPrice-marketDetail.close)*item.hand)}}
0
+
+
+ {{
+ i18n.close
+ }}
+
@@ -83,16 +106,16 @@
-
-
+
{{ i18n.PL }}
- 0
+ 0
-
+ -->
@@ -133,9 +156,28 @@
-
-
+
+
+
+
+
+
+
+ {{ i18n.AmountTrue }}
+
+
+
+
+
+
+
+
+
+
@@ -196,6 +238,7 @@
status: 'undone',
closeModalShow: false,
stopModalShow: false,
+ stopModalShowZui:false,
type: 0,
test: 0,
dealList: [{
@@ -266,6 +309,7 @@
i = String(i)
return i.substring(0, i.indexOf(".") + 5);
},
+
stopModalChange() {
if (this.stopLimitData.direction === 'buy') {
if (this.styValue)
@@ -298,7 +342,15 @@
this.profit = 0
this.loss = 0
},
-
+ // 设置保证金
+ Margincall(i){
+ this.stopLimitData = i
+ this.stopModalShowZui=true
+ this.styValue = 0;
+ this.stsValue = 0;
+ this.profit = 0
+ this.loss = 0
+ },
// 获取撤销订单
closeItem(item, i) {
this.itemData = item
@@ -378,26 +430,52 @@
* stop确认弹窗
*/
stopConfirm() {
- if (this.styValue < 0 || this.stsValue < 0) {
- uni.showToast({
- title: this.i18n.lessThan,
- icon: 'none',
- duration: 2000 //持续时间为
- })
- return;
+ if(this.stopModalShow){
+ if (this.styValue < 0 || this.stsValue < 0) {
+ uni.showToast({
+ title: this.i18n.lessThan,
+ icon: 'none',
+ duration: 2000 //持续时间为
+ })
+ return;
+ }
+ const orderList = this.$api.setWinOrLossStopPrice({
+ "orderNo": this.stopLimitData.orderNo,
+ "winStopPrice": this.styValue,
+ "lossStopPrice": this.stsValue,
+ });
+ orderList.then(res => {
+ uni.$u.toast(this.$t("markets").Succeeded)
+ this.stopModalShow = false
+ setTimeout(() => {
+ this.getContractOrderList()
+ }, 800)
+ });
}
- const orderList = this.$api.setWinOrLossStopPrice({
- "orderNo": this.stopLimitData.orderNo,
- "winStopPrice": this.styValue,
- "lossStopPrice": this.stsValue,
- });
- orderList.then(res => {
- uni.$u.toast(this.$t("markets").Succeeded)
- this.stopModalShow = false
- setTimeout(() => {
- this.getContractOrderList()
- }, 600)
- });
+
+ if(this.stopModalShowZui){
+ if (this.styValue < 0) {
+ uni.showToast({
+ title: this.i18n.lessThan,
+ icon: 'none',
+ duration: 2000 //持续时间为
+ })
+ return;
+ }
+ const orderList = this.$api.addBond({
+ "orderNo": this.stopLimitData.orderNo,
+ "amount": this.styValue,
+ });
+ orderList.then(res => {
+ uni.$u.toast(this.$t("markets").Succeeded)
+ this.stopModalShowZui = false
+ setTimeout(() => {
+ this.getContractOrderList()
+ }, 800)
+ });
+
+ }
+
},
/**
* styValue值变化
@@ -453,6 +531,23 @@