Spaces:
Running
Running
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title> </title> | |
<link rel="stylesheet" href="css/common.css"> | |
<link rel="stylesheet" href="css/dataMap.css"> | |
</head> | |
<style> | |
[v-cloak]{ | |
display: none ; | |
} | |
</style> | |
<body> | |
<!-- <div class="h20 bgHeader"></div> --> | |
<div id="app" v-cloak class="bgBalck"> | |
<div class="header plr15 flex alcenter bgHeader white fixed pt30"> | |
<img src="../../static/image/return.png" class="h15 wt15 mr10" @click="goback" /> | |
<div class="flex alcenter" @click="showLeft"> | |
<img src="../../static/image/lists.png" style="width: 20px;"> | |
<span class="white ft18 bold pl10">{{symbol}}</span> | |
</div> | |
<div class="flex alcenter gray7 all" @click="toTrade"> | |
<img src="../../static/image/all.png" class="h20 wt20 ml5"></img> | |
<span url="entrust">{{trade[lang].all}}</span> | |
</div> | |
</div> | |
<div> | |
<div class="pt60 pb10 plr20 bgHeader" style="min-height: 50px;"> | |
<div class="flex alcenter between pt5"> | |
<div class="tc" :class="[updown.substring(0,1) == '-'?'red':'green']"> | |
<p class="bold ft24 getlists_close">{{newprice || '0.00'}}</p> | |
<!-- <p class="mt10 ">{{updown}}%</p> --> | |
</div> | |
<div class="w50"> | |
<div class="flex between mb5"> | |
<span class="blue">{{translatedInfo.high || '--'}}</span> | |
<span class="blue white getlists_high">{{maxprice || '0.00'}}</span> | |
</div> | |
<div class="flex between mb5"> | |
<span class="blue">{{translatedInfo.low || '--'}}</span> | |
<span class="blue white getlists_low">{{minprice ||'0.00'}}</span> | |
</div> | |
<div class="flex between"> | |
<span class="blue">{{translatedInfo.volume || '--'}}</span> | |
<span class="blue white maxdayvom">{{dayvom ||'0.00'}}</span> | |
</div> | |
</div> | |
</div> | |
</div> | |
<div id="tv_chart_container" style="width:100%;height:70vh;margin-top: 5px;"></div> | |
<!--订单列表 --> | |
<div class="order-list dn"> | |
<div class="flex order-list-header between"> | |
<p class="tc" :class="[{'active':status == 1}]" @click="selectOrder(1)" data-localize="contract.positionList">{{texts[lang].list}}</p> | |
<p class="tc" :class="[{'active':status == 3}]" @click="selectOrder(3)" data-localize="td.drecord">{{texts[lang].record}}</p> | |
</div> | |
<p v-show="false">{{CountDown}}</p> | |
<ul class="lists"> | |
<li class="flex between ft10"> | |
<p data-localize="assets.num">{{texts[lang].num}}</p> | |
<p data-localize="contract.purchasePrice">{{texts[lang].buyprice}}</p> | |
<p v-show="status == 1" data-localize="deals.nowprice">{{texts[lang].nowprice}}</p> | |
<p v-show="status == 3" data-localize="contract.transactionPrice">{{texts[lang].okprice}}</p> | |
<p v-show="status == 1" data-localize="contract.estimated">{{texts[lang].estimate}}</p> | |
<p v-show="status == 1" data-localize="contract.countDown">{{texts[lang].count}}</p> | |
<p v-show="status == 3" data-localize="deals.fee">{{texts[lang].handrate}}</p> | |
<p v-show="status == 3" data-localize="contract.profitAndLoss">{{texts[lang].profit}}</p> | |
</li> | |
<li | |
v-if="orderList.length > 0 && item.remain_milli_seconds >0 && status==1 || status ==3 && orderList.length >0" | |
v-for="(item,index) in orderList" :key="item.id" class="flex between ft10"> | |
<!-- 数量 --> | |
<!-- <p v-if="item.is_insurance == 1">{{item.number || '0' | toFixedNum}}{{item.currency_name}}{{getlg('just')}}</p> | |
<p v-else-if="item.is_insurance == 2">{{item.number || '0' | toFixedNum}}{{item.currency_name}}{{getlg('back')}}</p> --> | |
<p>{{item.number || '0' | toFixedNum}}{{item.currency_name}}</p> | |
<!-- 购买价 --> | |
<p>{{item.open_price || '0.00' | toFixed4}} | |
<img v-if="item.type == 1" width="10" src="./image/buy.png" alt=""> | |
<img v-else width="10" src="./image/sell.png" alt=""> | |
</p> | |
<!-- 当前价 --> | |
<p v-if="status == 1&&item.status == 1" class="newprice">{{newprice || '0.00' | toFixed4}}</p> | |
<!-- 成交价 --> | |
<p v-if="status == 1&&item.status == 3">{{item.end_price || '0.00' | toFixed4}}</p> | |
<p v-if="status == 3&&item.remain_milli_seconds>0">--</p> | |
<p v-if="status == 3&&item.remain_milli_seconds<=0">{{item.end_price || '0.00' | toFixed4}}</p> | |
<p v-if="status == 1&&item.status == 1 && (item.open_price -0) == (newprice -0)" class="green">0</p> | |
<p v-if="status == 1&&item.status == 1 && item.type == 1 && (item.open_price -0) > (newprice -0)" class="red"> | |
-{{item.number || '0' | toFixedNum}}</p> | |
<p v-if="status == 1&&item.status == 1 && item.type == 1 && (item.open_price -0) < (newprice -0)" class="green"> | |
{{(item.number * item.profit_ratio -0) /100 || '0.00' | toFixedNum}}</p> | |
<p v-if="status == 1&&item.status == 1 && item.type == 2 && (item.open_price -0) > (newprice -0)" class="green"> | |
{{(item.number * item.profit_ratio -0) /100 || '0.00' | toFixedNum}}</p> | |
<p v-if="status == 1&&item.status == 1 && item.type == 2 && (item.open_price -0) < (newprice -0)" class="red"> | |
-{{(item.number -0) || '0.00' | toFixedNum}}</p> | |
<p v-if="status == 1&&item.status == 3" :class="item.fact_profits >= 0?'green':'red'">{{item.fact_profits || '0' | toFixedNum}}</p> | |
<p v-if="status == 1&&item.status == 1" class="times"> | |
{{countDown(item.endTime,index,item.seconds,item.remain_milli_seconds,item.id)}}s</p> | |
<p v-if="status == 1&&item.status == 3" class="times">0.0s</p> | |
<p v-if="status == 3&&item.remain_milli_seconds>0">--</p> | |
<p v-if="status == 3&&item.remain_milli_seconds<=0">{{item.fee || '0.00' | toFixed1}}</p> | |
<p v-if="status == 3&&item.remain_milli_seconds>0">--</p> | |
<p v-if="status == 3&&item.remain_milli_seconds<=0" :class="item.fact_profits >= 0?'green':'red'"> | |
{{item.fact_profits || '0' | toFixedNum}}</p> | |
<!-- <p v-if="item.status == 3">{{item.fact_profits || '0' | toFixedNum}}</p> --> | |
</li> | |
</ul> | |
<div v-if="orderList.length == 0" class="tc mt10" data-localize="transaction.nodata">{{texts[lang].norecord}}</div> | |
<div v-if="orderList.length>0 && hasmore" class="tc mt10" @click="getmore">{{texts[lang].more}}</div> | |
<div v-if="orderList.length>0 && !hasmore" class="tc mt10">{{texts[lang].nomore}}</div> | |
</div> | |
<div style="height:160px;"></div> | |
<!-- 底部 --> | |
<div id="bottom" class="flex between"> | |
<div class="flex bottom-left between" @click="slectedTime()"> | |
<div class="tc"> | |
<p data-localize="assets.num">{{texts[lang].num}}</p> | |
<p class="ftColor">{{inputValue || '0.00' | toFixedNum}}</p> | |
</div> | |
<div class="tc"> | |
<p data-localize="assets.time">{{texts[lang].time}}</p> | |
<p class="ftColor">{{seconds || '00'}}s</p> | |
</div> | |
<div class="tc"> | |
<p data-localize="contract.profitRate">{{texts[lang].rate}}</p> | |
<p class="ftColor">{{profitRatio || '00' | toFixedNum}}%</p> | |
</div> | |
<div class="logo-down"> | |
<img src="../../static/image/downs.png" alt=""> | |
</div> | |
</div> | |
<div class="flex"> | |
<!-- <button class="second-buy" @click="buyModal(1)" data-localize="contract.buyUp">{{texts[lang].up}}</button> | |
<button class="second-sell" @click="buyModal(2)" data-localize="contract.buyAll">{{texts[lang].down}}</button> --> | |
<!-- <button class="second-buy" @click="slectedTime()" data-localize="contract.buyUp">{{texts[lang].up}}</button> | |
<button class="second-sell" @click="slectedTime()" data-localize="contract.buyAll">{{texts[lang].down}}</button> --> | |
<button class="second-buy" @click="slectedTime()" data-localize="contract.buyUp">{{texts[lang].contracts}}</button> | |
<!-- <button class="second-sell" @click="slectedTime()" data-localize="contract.buyAll">{{texts[lang].sell}}</button> --> | |
</div> | |
</div> | |
<!-- <div class="flex between plr20 alcenter plr20 bgHeader fixed w100 pos_l0b0" style="height: 80px;"> | |
<button class="goTranbuy bgRed flex1 ptb10 mr20 white radius4" @click="goTrade('buy')">{{translatedInfo.buy || '--'}}</button> | |
<button class="goTransell bgGreen flex1 ptb10 white radius4" @click="goTrade('sell')">{{translatedInfo.sell || '--'}}</button> | |
</div> --> | |
</div> | |
<div id="sideColumn" class="bgBlackColor"> | |
<div class="ft20 bold bdbs pl20 texts-lever" data-localize="contract.secondContract">{{translatedInfo.micro}}</div> | |
<!-- <div class="flex alcenter between ptb20 plr20 bdbs"> | |
<div class="ft18 bold" :class="{'blue2':topnow==1}" @click="changeTop(1)">{{texts[lang].all}}</div> | |
<div class="ft18 bold" :class="{'blue2':topnow==2}" @click="changeTop(2)">{{texts[lang].main}}</div> | |
<div class="ft18 bold" :class="{'blue2':topnow==3}" @click="changeTop(3)">{{texts[lang].lever}}</div> | |
</div> --> | |
<div class="flex alcenter plr20 bdbs bdbs"> | |
<div class="ptb10 ft16 bold" :class="{'blue2':isActive==i}" v-for="(item,i) in currencyList" :key="i" @click="changeTab(i,item.name)"> | |
<div class="mr20">{{item.name}}</div> | |
</div> | |
</div> | |
<ul class="ul"> | |
<li v-for="item in currencyList[isActive].quotation" :key="item.id" v-if="item.open_microtrade == 1" | |
:class="['legal_name flex between',{'bg_active':currency_id==item.currency_id}]" | |
@click="selectCurrencys(item.id,item.legal_id,item.currency_id,item.legal_name,item.currency_name,item.plate_id)"> | |
<strong><span>{{item.currency_name}}/{{item.legal_name}}</span></strong> | |
<p class="fontC" :class="{ red: parseFloat(item.change) < 0, gre: parseFloat(item.change) >= 0 || item.change == '' }"> | |
<span>{{item.now_price}}</span> | |
</p> | |
</li> | |
</ul> | |
<!-- <ul class="ul" v-if="topnow==2"> | |
<li v-for="item in currencyList[isActive].quotation" :key="item.id" v-if="item.is_display == 1&&item.open_lever == 1&&item.plate_id==2" | |
:class="['legal_name flex between',{'bg_active':currency_id==item.currency_id}]" | |
@click="selectCurrencys(item.id,item.legal_id,item.currency_id,item.legal_name,item.currency_name,item.plate_id)"> | |
<strong><span>{{item.currency_name}}/{{item.legal_name}}</span></strong> | |
<p class="fontC" :class="{ red: parseFloat(item.change) < 0, gre: parseFloat(item.change) >= 0 || item.change == '' }"> | |
<span>{{item.now_price}}</span> | |
</p> | |
</li> | |
</ul> | |
<ul class="ul" v-if="topnow==3"> | |
<li v-for="item in currencyList[isActive].quotation" :key="item.id" v-if="item.is_display == 1&&item.open_lever == 1&&item.plate_id==3" | |
:class="['legal_name flex between',{'bg_active':currency_id==item.currency_id}]" | |
@click="selectCurrencys(item.id,item.legal_id,item.currency_id,item.legal_name,item.currency_name,item.plate_id)"> | |
<strong><span>{{item.currency_name}}/{{item.legal_name}}</span></strong> | |
<p class="fontC" :class="{ red: parseFloat(item.change) < 0, gre: parseFloat(item.change) >= 0 || item.change == '' }"> | |
<span>{{item.now_price}}</span> | |
</p> | |
</li> | |
</ul> --> | |
</div> | |
<!-- 倒计时下单弹窗 --> | |
<div class="time-modal"> | |
<!-- <div class="time-header"> | |
<div> | |
<p class="colorGrey ft12" data-localize="contract.transactionMode">{{texts[lang].pattern}}</p> | |
<div class="flex warps currency-list mt10"> | |
<p :class="[{'active':tradeCurrencyId == item.id}]" v-for="item in tradeCurrency" :key="item.id" | |
@click="tradeCurrencyClick(item.id,item.name)"> | |
{{item.name}} | |
</p> | |
</div> | |
</div> | |
</div> --> | |
<div class="time-header"> | |
<div> | |
<p class="colorGrey ft12" data-localize="contract.transactionMode">{{texts[lang].pattern}}</p> | |
<div class="flex warps currency-list mt10"> | |
<p :class="[{'active':tradeCurrencyId == item.id}]" v-for="item in tradeCurrency" :key="item.id" | |
@click="tradeCurrencyClick(item.id,item.name)"> | |
{{item.name}} | |
</p> | |
</div> | |
</div> | |
</div> | |
<div class="time-content mt10"> | |
<p class="colorGrey ft12" data-localize="contract.openQuantity">{{texts[lang].opennum}}</p> | |
<div class="time-num between"> | |
<ul class="flex warps1" id="top1"> | |
<li v-for="item in tradeNUm" :key="item.id" @click="tabNumbers(item.number)"> | |
<p :class="[{'active':(inputValue-0) == (item.number -0).toFixed(0)}]">{{item.number |toFixedNum}}</p> | |
</li> | |
</ul> | |
<input type="number" data-localize="contract.otherQuantities" placeholder="{{market.otherQuantities}}" v-model="inputValue"> | |
</div> | |
<div class="time-list"> | |
<p class="colorGrey ft12" data-localize="deals.optime">{{texts[lang].opentime}}</p> | |
<div class="flex warps1 currency-list mt10"> | |
<p :class="[{'active':seconds == item.seconds}]" v-for="item in timeList" :key="item.id" | |
@click="selectTime(item.seconds,item.profit_ratio)">{{item.seconds}}s</p> | |
</div> | |
</div> | |
<!-- <div class="time-list"> | |
<p class="colorGrey ft12">{{texts[lang].insurance}}</p> | |
<div class="flex warps1 currency-list mt10"> | |
<p :class="[{'active':is_insurance == 0}]" @click="changeInsurance(0)">{{texts[lang].no}}</p> | |
<p :class="[{'active':is_insurance == 1}]" @click="changeInsurance(1)">{{texts[lang].yes}}</p> | |
</div> | |
</div> --> | |
<div class="flex between ft14"> | |
<p><span data-localize="contract.accountBalance">{{texts[lang].balance}}</span>: <span class="green bold">{{balance|toFixed4}} {{tradeCurrencyName}}</span></p> | |
<p><span data-localize="contract.profitRate">{{texts[lang].rate}}</span>: <span class="green bold ft20">{{profitRatio | toFixedNum}}%</span></p> | |
</div> | |
</div> | |
</div> | |
<!-- 下单之后的弹窗 --> | |
<div class="orders"> | |
<div> | |
<div class="mt20 orders-list"> | |
<p class="mt10"> | |
<span data-localize="assets.num">{{texts[lang].num}}</span>: | |
<span>{{inputValue || '0' |toFixedNum}} {{tradeCurrencyName}}</span> | |
</p> | |
<p class="mt10"> | |
<span data-localize="assets.time">{{texts[lang].time}}</span>: | |
<span>{{seconds}} S</span> | |
</p> | |
<p class="mt10"> | |
<span data-localize="contract.profitRate">{{texts[lang].rate}}</span>: | |
<span>{{profitRatio}}%</span> | |
</p> | |
</div> | |
</div> | |
</div> | |
<div id="mask1" @click="closeLeft"></div> | |
</div> | |
<script src="lib/vue.min.js"></script> | |
<script src="lib/jquery.js"></script> | |
<script src="lib/layer_mobile/layer.js"></script> | |
<script src="javascripts/main.js"></script> | |
<script src="javascripts/socket.io.js"></script> | |
<script src="tradeview/charting_library/charting_library.min.js"></script> | |
<script src="javascripts/uni.webview.1.5.4.js"></script> | |
<!-- <script type="text/javascript" src="https://js.cdn.aliyun.dcloud.net.cn/dev/uni-app/uni.webview.1.5.2.js"></script> | |
<script src="lib/vue.min.js"></script> --> | |
<script> | |
// 在引用依赖的uni.webview文件后,需要在 HTML 中监听 UniAppJSBridgeReady 事件触发后,才能安全调用 uni 的 API | |
document.addEventListener('UniAppJSBridgeReady', function() { | |
uni.getEnv(function(res) { | |
console.log('当前环境:' + JSON.stringify(res)); | |
}); | |
// $(function(res){ | |
// var paramsed = get_all_params(); | |
// console.log(paramsed.symbol) | |
// var symbol=paramsed.symbol.replace('/', "").toLowerCase() | |
// console.log(symbol) | |
// //var userToken = getData(token) | |
// //console.log(userToken) | |
// var url = _API + params.url; | |
// $.ajax({ | |
// url: "currency/newGetDetail", | |
// data: {symbol: symbol}, | |
// type: "post", | |
// dataType: "josn", | |
// success: function(data) { | |
// console.log(55) | |
// console.log(data) | |
// } | |
// }) | |
// }) | |
}) | |
var vm = new Vue({ | |
el: '#app', | |
data: { | |
texts: { | |
zh: { | |
mairo: '合约对冲', | |
contract: '永续合约', | |
add: '添加自选', | |
all: '全部', | |
main: '主流', | |
lever: '合约', | |
pattern: '交易模式', | |
num: '数量', | |
time: '时间', | |
rate: '盈利率', | |
opennum: '开仓数量', | |
opentime: '开仓时间', | |
insurance: '是否购买保险', | |
no: '否', | |
yes: '是', | |
balance: '账户余额', | |
up: '买涨', | |
down: '买跌', | |
list: '持仓列表', | |
record: '订单记录', | |
buyprice: '购买价', | |
nowprice: '当前价', | |
okprice: '成交价', | |
estimate: '预计盈亏', | |
count: '倒计时', | |
handrate: '手续费', | |
profit: '盈亏', | |
norecord: '暂无记录', | |
more: '加载更多', | |
nomore: '没有更多了', | |
buy: '买入', | |
sell: '卖出', | |
contracts:'合同交易' | |
}, | |
en: { | |
mairo: 'contract hedging', | |
contract: 'perpetual contract', | |
add: 'add optional', | |
all: 'all', | |
main: 'main', | |
lever: 'contract', | |
pattern: 'transaction mode', | |
num: 'quantity', | |
time: 'time', | |
rate: 'profit rate', | |
opennum: 'open quantity', | |
opentime: 'opening time', | |
insurance: 'whether to buy insurance', | |
no: 'no', | |
yes: 'yes', | |
balance: 'account balance', | |
up: 'buy up', | |
down: 'buy down', | |
list: 'position list', | |
record: 'order record', | |
buyprice: 'purchase price', | |
nowprice: 'current price', | |
okprice: 'closing price', | |
estimate: 'estimated profit and loss', | |
count: 'count down', | |
handrate: 'service charge', | |
profit: 'profit and loss', | |
norecord: 'no record yet', | |
more: 'load more', | |
nomore: 'no more', | |
// buy: 'buy', | |
// sell: 'sell', | |
buy: 'Call', | |
sell: 'Put', | |
contracts:'contract transaction' | |
}, | |
hk: { | |
mairo: '合約對沖', | |
contracts: '永續合約', | |
add: '添加自選', | |
all: '全部', | |
main: '主流', | |
lever: '合約', | |
pattern: '交易模式', | |
num: '數量', | |
time: '時間', | |
rate: '盈利率', | |
opennum: '開倉數量', | |
opentime: '開倉時間', | |
insurance: '是否購買保險', | |
no: '否', | |
yes: '是', | |
balance: '帳戶餘額', | |
up: '買漲', | |
down: '買跌', | |
list: '持倉清單', | |
record: '訂單記錄', | |
buyprice: '購買價', | |
nowprice: '當前價', | |
okprice: '成交價', | |
estimate: '預計盈虧', | |
count: '倒數計時', | |
handrate: '手續費', | |
profit: '盈虧', | |
norecord: '暫無記錄', | |
more: '加載更多', | |
nomore: '沒有更多了', | |
buy: '買入', | |
sell: '賣出', | |
contracts:'契约交易' | |
}, | |
jp: { | |
mairo: '契約ヘッジ', | |
contract: '永遠契約', | |
add: '選択を追加', | |
all: '全部', | |
main: '主流', | |
lever: '契約', | |
pattern: '取引モード', | |
num: '数量', | |
time: '時間', | |
rate: '利益率', | |
opennum: '開倉数量', | |
opentime: '開倉時間', | |
insurance: 'は保険を買うかどうか', | |
no: 'いいえ', | |
yes: 'はい', | |
balance: '口座残高', | |
up: '買い上げる', | |
down: '買いおとす', | |
list: '保有リスト', | |
record: '注文記録', | |
buyprice: '買い入れ価格', | |
nowprice: '現在の価格', | |
okprice: '出来値', | |
estimate: '損益を予想する', | |
count: 'カウントダウン', | |
handrate: '手数料', | |
profit: '利益と損失', | |
norecord: '記録がない', | |
more: 'もっとロード', | |
nomore: 'これ以上ないです', | |
buy: '購入', | |
sell: '売却', | |
contracts:'契約取引' | |
}, | |
kor:{ | |
mairo:"계약 이 성립 하 다.", | |
contract:"무기한 계약", | |
add:"선택 추가", | |
all:"전부.", | |
main:"주류.", | |
lever:"계약", | |
pattern:"거래 패턴", | |
num:"수량.", | |
time:"시간.", | |
rate:"수익 률", | |
opennum:"창 고 를 여 는 수량.", | |
opentime:"창 고 를 여 는 시간.", | |
insurance:"보험 가입 여부", | |
no:"아니.", | |
yes:"예.", | |
balance:"계좌 잔액", | |
up:"값 이 오르다", | |
down:"매수 하여 떨어뜨리다", | |
list:"창고 보유 리스트", | |
record:"주문 기록", | |
buyprice:"구입 가격", | |
nowprice:"현재 가격", | |
okprice:"거래 가", | |
estimate:"예상 손익", | |
count:"카운트다운", | |
handrate:"수수료", | |
profit:"손익.", | |
norecord:"기록 이 없다", | |
more:"더 많이 불 러 오기", | |
nomore:"더 없어.", | |
buy: '매입', | |
sell: '매도', | |
}, | |
th:{ | |
mairo:"สัญญาป้องกันความเสี่ยง", | |
contract:"สัญญายั่งยืน", | |
add:"เพิ่มทางเลือก", | |
all:"จำนวนทั้งหมด", | |
main:"กระแสหลัก", | |
lever:"สนธิสัญญา", | |
pattern:"โหมดการซื้อขาย", | |
num:"จำนวนรวม", | |
time:"กาละ", | |
rate:"อัตรากำไร", | |
opennum:"จำนวนตำแหน่งเปิด", | |
opentime:"เวลาเปิด", | |
insurance:"ว่าจะซื้อประกันภัยหรือไม่", | |
no:"เลว", | |
yes:"ใช่แล้ว", | |
balance:"ดุลบัญชี", | |
up:"ซื้อขึ้น", | |
down:"ซื้อหรือขาย", | |
list:"รายชื่อตำแหน่ง", | |
record:"บันทึกการสั่งซื้อ", | |
buyprice:"ราคาซื้อ", | |
nowprice:"ราคาปัจจุบัน", | |
okprice:"มูลค่าการซื้อขาย", | |
estimate:"คาดการณ์กำไรและขาดทุน", | |
count:"การนับถอยหลัง", | |
handrate:"ค่าธรรมเนียม", | |
profit:"ขาดทุน", | |
norecord:"ไม่มีบันทึก", | |
more:"โหลดเพิ่มเติม", | |
nomore:"ไม่อีกแล้ว", | |
buy: 'ซื้อ', | |
sell: 'ขาย', | |
} | |
}, | |
widget: null, | |
symbolInfo: null, | |
feed: null, | |
wsEx: null, | |
ws: null, | |
lists: [], | |
newData: '', | |
symbol: '', | |
priceScale: 100000, | |
histime: '', | |
newprice: '0.00', | |
updown: '0.00', | |
maxprice: '0.00', | |
minprice: '0.00', | |
dayvom: '0.00', | |
currencyList: [], | |
couponSelected: '', | |
legal_id: '', | |
currency_id: '', | |
legal_name: '', | |
currency_name: '', | |
currency_match_id:'', | |
hasCollcet: '', | |
myid: '', | |
// balance: '', | |
rates: '', | |
// websockUrl: 'wss://www.hsfuture.net/ws', //'ws://74.91.27.98/ws' | |
// url: 'http://www.hsfuture.net/', | |
// websockUrl: 'http://www.bgobtc.com:2000/', | |
websockUrl: _DOMAIN+'/', | |
url: _DOMAIN+'/', | |
complete: [], | |
transwords: { | |
zh: { | |
high: '高', | |
low: '低', | |
volume: '24H量', | |
num: '数量', | |
price: '价格', | |
time: '时间', | |
buy: '买入', | |
sell: '卖出', | |
chicang:'持仓列表', | |
record:'订单记录', | |
num:'数量', | |
buyprice:'购买价', | |
cjprice:'成交价', | |
yuji:'预计盈亏', | |
daotime:'倒计时', | |
type:'类型', | |
yingkui:'盈亏', | |
time:'时间', | |
nolog:'暂无记录', | |
more:'加载更多', | |
nomore:'没有更多了', | |
ylrate:'盈利率', | |
buyup:'买涨', | |
buydown:'买跌', | |
micro:'期权交易', | |
model:'交易模式', | |
opennum:'开仓数量', | |
opentime:'开仓时间', | |
balance:'账户余额', | |
num1:'数量:', | |
yuqi:'预期收益:', | |
circle:'结算周期:', | |
nowprice:'当前价', | |
ceil:'取消', | |
ptime:'请选择开仓时间', | |
pnum:'请选择开仓数量', | |
success:'下单成功' | |
}, | |
en: { | |
high: 'high', | |
low: 'low', | |
volume: '24H volume', | |
num: 'number', | |
price: 'price', | |
time: 'time', | |
// buy: 'buy', | |
// sell: 'sell', | |
buy: 'Call', | |
sell: 'Put', | |
chicang: 'Position list', | |
record: 'Order record', | |
Num: 'Quantity', | |
buyprice: 'Purchase price', | |
cjprice: 'Closing price', | |
yuji: 'Estimated profit and loss', | |
daotime: 'Countdown', | |
type: 'Type', | |
yingkui: 'Profit and loss', | |
time: 'Time', | |
nolog: 'No record yet', | |
more: 'Load more', | |
nomore: 'No more', | |
ylrate: 'Profit rate', | |
buyup: 'Buy up', | |
buydown: 'Buy down', | |
micro: 'Option contract', | |
model: 'Transaction mode', | |
opennum: 'Open quantity', | |
opentime: 'Opening time', | |
balance: 'Balance', | |
num1: 'Quantity', | |
yuqi: 'Earnings', | |
circle: 'Settlement', | |
nowprice: 'Price', | |
ceil: 'Cancel', | |
ptime: 'Please select the opening time', | |
pnum: 'Please select the opening quantity', | |
success: 'Order successfully' | |
}, | |
hk: { | |
high: '高', | |
low: '低', | |
volume: '24H量', | |
num: '數量', | |
price: '價格', | |
time: '時間', | |
buy: '買入', | |
sell: '賣出', | |
chicang:'持倉清單', | |
record:'訂單記錄', | |
num:'數量', | |
buyprice:'購買價', | |
cjprice:'成交價', | |
yuji:'預計盈虧', | |
daotime:'倒數計時', | |
type:'類型', | |
yingkui:'盈虧', | |
time:'時間', | |
nolog:'暫無記錄', | |
more:'加載更多', | |
nomore:'沒有更多了', | |
ylrate:'盈利率', | |
buyup:'買漲', | |
buydown:'買跌', | |
micro:'秒合約', | |
model:'交易模式', | |
opennum:'開倉數量', | |
opentime:'開倉時間', | |
balance:'帳戶餘額', | |
num1:'數量:', | |
yuqi:'預期收益:', | |
circle:'結算週期:', | |
nowprice:'當前價', | |
ceil:'取消', | |
ptime:'請選擇開倉時間', | |
pnum:'請選擇開倉數量', | |
success:'下單成功' | |
}, | |
jp: { | |
high: '高さ', | |
low: '低い', | |
volume: '24 h量', | |
num: '数', | |
price: '価格', | |
time: '時間', | |
buy: '購入', | |
sell: '売却', | |
chicang:'持倉リスト', | |
record:'注文記録', | |
num:'数量', | |
buylice:'購買価格', | |
cjprice:'成約価格', | |
yuji:'損益予想', | |
daotime:'カウントダウン', | |
yingkui:'損益', | |
time:'時間', | |
nolog:'は記録がありません', | |
more:'より多くのロード', | |
nomore:'もっとないです' , | |
ylrate:'収益率', | |
buyup:'買上高', | |
buydown:'買って転んで、', | |
micro:'秒契約', | |
model:'取引モード', | |
opennum:'開倉数量', | |
opentime:'開倉時間', | |
balance:'口座残高', | |
num1:'数量:', | |
yuqi:'予想収益:', | |
circele:'決算周期:', | |
nowprice:'現在価格', | |
ceil:'キャンセル', | |
ptime:'開倉時間を選んでください', | |
pnum:'開倉数量を選んでください', | |
success:'注文成功' | |
}, | |
kor:{ | |
high:"높다.", | |
low:"낮다.", | |
volume:"24H 량", | |
num:"수량.", | |
price:"가격.", | |
time:"시간.", | |
buy:"매입 하 다.", | |
sell:"매출 하 다.", | |
chicang:"창고 보유 리스트", | |
record:"주문 기록", | |
buyprice:"구입 가격", | |
cjprice:"거래 가", | |
yuji:"예상 손익", | |
daotime:"카운트다운", | |
type:"유형.", | |
yingkui:"손익.", | |
nolog:"기록 이 없다", | |
more:"더 많이 불 러 오기", | |
nomore:"더 없어.", | |
ylrate:"수익 률", | |
buyup:"값 이 오르다", | |
buydown:"매수 하여 떨어뜨리다", | |
micro:"옵션 거래", | |
model:"거래 패턴", | |
opennum:"창 고 를 여 는 수량.", | |
opentime:"창 고 를 여 는 시간.", | |
balance:"계좌 잔액", | |
num1:"수량:", | |
yuqi:"예상 수익:", | |
circle:"결제 주기:", | |
nowprice:"현재 가격", | |
ceil:"취소 하 다.", | |
ptime:"창 고 를 여 는 시간 을 선택 하 세 요", | |
pnum:"창 고 수량 을 선택 하 세 요", | |
success:"주문 성공" | |
}, | |
th:{ | |
high:"โด่ง", | |
low:"หดหู่ใจ", | |
volume:"ปริมาณ", | |
num:"จำนวนรวม", | |
price:"ราคา", | |
time:"กาละ", | |
buy:"ซื้อ", | |
sell:"ขาย", | |
chicang:"รายชื่อตำแหน่ง", | |
record:"บันทึกการสั่งซื้อ", | |
buyprice:"ราคาซื้อ", | |
cjprice:"มูลค่าการซื้อขาย", | |
yuji:"คาดการณ์กำไรและขาดทุน", | |
daotime:"การนับถอยหลัง", | |
type:"รูปร่างลักษณะ", | |
yingkui:"ขาดทุน", | |
nolog:"ไม่มีบันทึก", | |
more:"โหลดเพิ่มเติม", | |
nomore:"ไม่อีกแล้ว", | |
ylrate:"อัตรากำไร", | |
buyup:"ซื้อขึ้น", | |
buydown:"ซื้อหรือขาย", | |
micro:"การซื้อขายตัวเลือก", | |
model:"โหมดการซื้อขาย", | |
opennum:"จำนวนตำแหน่งเปิด", | |
opentime:"เวลาเปิด", | |
balance:"ดุลบัญชี", | |
num1:"ปริมาณ", | |
yuqi:"รายได้ที่คาดหวัง", | |
circle:"วงจรการตั้งถิ่นฐาน", | |
nowprice:"ราคาปัจจุบัน", | |
ceil:"ยกเลิก", | |
ptime:"กรุณาเลือกเวลาเปิด", | |
pnum:"กรุณาเลือกหมายเลขการเปิด", | |
success:"สั่งซื้อสำเร็จ" | |
}, | |
de:{ | |
high:"hoch", | |
low:"niedrig", | |
volume:"24h Volumen", | |
num:"Anzahl", | |
price:"Preis", | |
time:"Zeit", | |
buy:"Kauf", | |
sell:"Verkauf aus", | |
chicang:"Liste der Positionen", | |
record:"Aufzeichnungen der Bestellung", | |
buyprice:"Der Kaufpreis", | |
cjprice:"Preis der Transaktion", | |
yuji:"Geschätzte Gewinne und Verluste", | |
daotime:"Zählen nach unten", | |
type:"Typ", | |
yingkui:"Gewinn und Verlust", | |
nolog:"Kein Eintrag", | |
more:"Laden Sie mehr", | |
nomore:"Nicht mehr", | |
ylrate:"Verzinsung des Gewinns", | |
buyup:"Kaufen Sie auf", | |
buydown:"Kaufen Sie unten", | |
micro:"Handel mit Optionen", | |
model:"Modus der Transaktion", | |
opennum:"Menge der Öffnung", | |
opentime:"Open Time", | |
balance:"Saldo des Kontos", | |
num1:"Anzahl:", | |
yuqi:"Erwartete Einnahmen:", | |
circle:"Zeitraum der Abrechnung:", | |
nowprice:"Aktueller Preis", | |
ceil:"Stornieren", | |
ptime:"Bitte die Öffnungszeiten auswählen", | |
pnum:"Bitte wählen Sie die Öffnungsmenge", | |
success:"Erfolg der Kasse" | |
}, | |
fra:{ | |
high:"Élevé", | |
low:"Faible", | |
volume:"Quantité 24h", | |
num:"Nombre", | |
price:"Prix", | |
time:"Temps", | |
buy:"Acheter", | |
sell:"Vendre", | |
chicang:"Liste des positions", | |
record:"Enregistrement des commandes", | |
buyprice:"Prix d'achat", | |
cjprice:"Prix de transaction", | |
yuji:"Résultat escompté", | |
daotime:"Compte à rebours", | |
type:"Type", | |
yingkui:"Profits et pertes", | |
nolog:"Pas d'enregistrement pour le moment", | |
more:"Charger plus", | |
nomore:"Il n'y en a plus.", | |
ylrate:"Taux de rentabilité", | |
buyup:"Augmentation des achats", | |
buydown:"Buy down", | |
micro:"Opérations d'options", | |
model:"Mode de transaction", | |
opennum:"Quantité d'ouverture", | |
opentime:"Heure d'ouverture", | |
balance:"Solde du compte", | |
num1:"Quantité:", | |
yuqi:"Avantages escomptés:", | |
circle:"Période de règlement:", | |
nowprice:"Prix courants", | |
ceil:"Annulation", | |
ptime:"Veuillez sélectionner l'heure d'ouverture", | |
pnum:"Veuillez sélectionner la quantité d'ouverture", | |
success:"Commande réussie" | |
}, | |
hi:{ | |
high:"उच्च", | |
low:"कम", | |
volume:"24H मात्रा", | |
num:"मात्रा", | |
price:"कीमत", | |
time:"समय", | |
buy:"खरीदना", | |
sell:"बेचना", | |
chicang:"पदों की सूची", | |
record:"आदेश रिकॉर्ड", | |
buyprice:"खरीद मूल्य", | |
cjprice:"अंतिम कीमत", | |
yuji:"अनुमानित लाभ और हानि", | |
daotime:"उलटी गिनती", | |
type:"के प्रकार", | |
yingkui:"लाभ और हानि", | |
nolog:"कोई रिकॉर्ड नहीं", | |
more:"और लोड करें", | |
nomore:"अब और नहीं", | |
ylrate:"लाभप्रदता", | |
buyup:"खरीद लेना", | |
buydown:"खरीदना या गिरना", | |
micro:"ऑप्शन ट्रेडिंग", | |
model:"लेनदेन मोड", | |
opennum:"खोले गए पदों की संख्या", | |
opentime:"खुलने का समय", | |
balance:"खाते में शेष", | |
num1:"मात्रा:", | |
yuqi:"अपेक्षित आय:", | |
circle:"बिलिंग चक्र:", | |
nowprice:"मौजूदा कीमत", | |
ceil:"रद्द करना", | |
ptime:"कृपया खुलने का समय चुनें", | |
pnum:"कृपया उद्घाटन की मात्रा चुनें", | |
success:"सफलतापूर्वक आदेश दिया गया" | |
}, | |
id:{ | |
high:"tinggi", | |
low:"rendah", | |
volume:"Volume 24 jam", | |
num:"Kuantitas", | |
price:"harga", | |
time:"waktu", | |
buy:"Membeli di", | |
sell:"Menjual", | |
chicang:"Daftar posisi", | |
record:"Catatan pesanan", | |
buyprice:"Harga pembelian", | |
cjprice:"harga akhir", | |
yuji:"Taksiran untung dan rugi", | |
daotime:"Hitung mundur", | |
type:"Jenis dari", | |
yingkui:"Laba rugi", | |
nolog:"Tidak ada catatan", | |
more:"Muat lebih banyak", | |
nomore:"Tidak lagi", | |
ylrate:"Profitabilitas", | |
buyup:"Memborong", | |
buydown:"Beli atau jatuh", | |
micro:"Perdagangan opsi", | |
model:"Mode transaksi", | |
opennum:"Jumlah posisi dibuka", | |
opentime:"Waktu pembukaan", | |
balance:"Saldo rekening", | |
num1:"Kuantitas:", | |
yuqi:"Hasil yang diharapkan:", | |
circle:"Siklus penagihan:", | |
nowprice:"Harga sekarang", | |
ceil:"membatalkan", | |
ptime:"Pilih jam buka", | |
pnum:"Silakan pilih jumlah pembukaan", | |
success:"berhasil dipesan" | |
}, | |
pt:{ | |
high:"Alto", | |
low:"Baixo", | |
volume:"24h volume", | |
num:"Número", | |
price:"Preço", | |
time:"Tempo", | |
buy:"Compra", | |
sell:"Vender fora", | |
chicang:"Lista de posições", | |
record:"Registos de encomendas", | |
buyprice:"Preço de compra", | |
cjprice:"Preço de transacção", | |
yuji:"Lucros e Perdas estimados", | |
daotime:"Contagem decrescente", | |
type:"Tipo", | |
yingkui:"Resultado e perda", | |
nolog:"Sem Registro", | |
more:"Carregar Mais", | |
nomore:"Não mais.", | |
ylrate:"Taxa de lucro", | |
buyup:"Compra aí.", | |
buydown:"Comprar para baixo", | |
micro:"Opções de negociação", | |
model:"Modo de transação", | |
opennum:"Quantidade de Abertura", | |
opentime:"Tempo Aberto", | |
balance:"Balanço de conta", | |
num1:"Número:", | |
yuqi:"Receitas previstas:", | |
circle:"Período de liquidação:", | |
nowprice:"Preço actual", | |
ceil:"Cancelar", | |
ptime:"Por favor, selecione a Hora de Abertura", | |
pnum:"Seleccione por favor a quantidade de Abertura", | |
success:"SUCESSO do checkout" | |
}, | |
ru:{ | |
high:"высота", | |
low:"низкий", | |
volume:"24H количество", | |
num:"количество", | |
price:"цена", | |
time:"время", | |
buy:"покупать", | |
sell:"продать", | |
chicang:"Список владельцев бункера", | |
record:"запись заказа", | |
buyprice:"покупная цена", | |
cjprice:"цена сделки", | |
yuji:"ожидаемая прибыльность", | |
daotime:"обратный отсчет", | |
type:"тип", | |
yingkui:"полный убыток", | |
nolog:"Пока нет записи", | |
more:"Загрузить дополнительно", | |
nomore:"Больше нет", | |
ylrate:"норма прибыли", | |
buyup:"купить", | |
buydown:"упасть", | |
micro:"опционная сделка", | |
model:"режим сделок", | |
opennum:"количество вскрытия", | |
opentime:"время открытия бункера", | |
balance:"сальдо счета", | |
num1:"количество", | |
yuqi:"Ожидаемые выгоды:", | |
circle:"расчетный период:", | |
nowprice:"текущая цена", | |
ceil:"отмена", | |
ptime:"Выберите время начала бункера", | |
pnum:"Выберите количество бункера", | |
success:"Следующий успех" | |
}, | |
spa:{ | |
high:"Alto", | |
low:"Baja", | |
volume:"Cantidad de 24h", | |
num:"Cantidad", | |
price:"Precio", | |
time:"Tiempo", | |
buy:"Comprar", | |
sell:"Vender", | |
chicang:"Lista de posiciones", | |
record:"Registro de pedidos", | |
buyprice:"Precio de compra", | |
cjprice:"Precio de transacción", | |
yuji:"Ganancias y pérdidas previstas", | |
daotime:"Cuenta atrás", | |
type:"Tipo", | |
yingkui:"Ganancias y pérdidas", | |
nolog:"No hay registro", | |
more:"Cargar más", | |
nomore:"No más", | |
ylrate:"Tasa de ganancia", | |
buyup:"Comprar", | |
buydown:"Comprar o caer", | |
micro:"Comercio de opciones", | |
model:"Modo de transacción", | |
opennum:"Cantidad de apertura", | |
opentime:"Tiempo de apertura", | |
balance:"Saldo de la cuenta", | |
num1:"Cantidad:", | |
yuqi:"Ingresos previstos:", | |
circle:"Período de liquidación:", | |
nowprice:"Precio actual", | |
ceil:"Cancelar", | |
ptime:"Por favor, seleccione el tiempo de apertura", | |
pnum:"Por favor, seleccione la cantidad de apertura", | |
success:"Pedido exitoso" | |
} | |
}, | |
translatedInfo: { | |
high:'', | |
low:'', | |
volume:'', | |
buy:'', | |
sell:'' | |
}, | |
trade:{ | |
en:{ | |
all:'all' | |
}, | |
zh:{ | |
all:'全部' | |
}, | |
hk:{ | |
all:'全部' | |
}, | |
jp:{ | |
all:'すべて' | |
} | |
}, | |
lang: 'en', | |
sellType: 'buy', | |
multipleList: [], | |
CountDown: '', | |
balance: '', | |
rate: '', | |
numbers: '0.00', | |
expectedReturn: '0.00', | |
guaranteeAmount: '0.00', | |
tradeType: '', | |
tradeCurrency: [], | |
getlists:[], | |
tradeCurrencylist: [], | |
tradeCurrencyId: '', | |
tradeCurrencyName: '', | |
tradeCurrencyData: [], | |
tradeNUm: [], | |
timeList: [], | |
seconds: '', | |
inputValue: '', | |
profitRatio: '', | |
tradeCurrencyIdTest: '', | |
secondsTest: '', | |
inputValueTest: '', | |
profitRatioTest: '', | |
balanceTest: '', | |
rateTest: '', | |
orderData: { | |
}, | |
progress: 100, | |
set: null, | |
status: 1, | |
currencyName: "", | |
orderList: [], | |
maxdayvom:'', | |
set: null, | |
bmbBalance: '', | |
sets: null, | |
insurancType:[], | |
userInsurancId:'', | |
page:1, | |
hasmore:false, | |
plate:'', | |
opt: false, | |
addid:'', | |
isActive:0, | |
topnow:1, | |
topList:['全部','主流','合约'], | |
is_insurance: 0, | |
styleColor:'', | |
greenColor:'#02C289', | |
redColor:'#e86d43' | |
}, | |
filters:{ | |
fixed4:function(vals){ | |
var values = iTofixed(vals,4); | |
return values; | |
}, | |
toFixeds: function (value) { | |
value = Number(value); | |
return value.toFixed(2); | |
}, | |
toFixeds1: function (value) { | |
value = Number(value); | |
return value.toFixed(8); | |
}, | |
toFixed4: function (value, options) { | |
value = Number(value); | |
return value.toFixed(4); | |
}, | |
toFixedNum: function (value, options) { | |
value = Number(value); | |
return value.toFixed(0); | |
}, | |
toFixed1: function (value, options) { | |
value = Number(value); | |
return value.toFixed(1); | |
}, | |
}, | |
created() { | |
this.lang = this.getJsUrl().lang | |
var paramsed = get_all_params(); | |
console.log(paramsed) | |
let that = this | |
if(paramsed.symbol){ | |
that.symbol = paramsed.symbol; | |
let c_name = paramsed.symbol.split('/') | |
that.legal_name = c_name[1]; | |
that.currency_name = c_name[0]; | |
that.legal_id = paramsed.legal_id; | |
that.currency_id = paramsed.currency_id; | |
that.currency_match_id = paramsed.currency_match_id; | |
that.plate = paramsed.plate; | |
that.topnow = paramsed.plate || 1; | |
document.title = that.symbol; | |
} | |
var token=uni.getStorageSync('token'); | |
// let token1 = window.localStorage.getItem('token') | |
// console.log(token1) | |
console.log(token) | |
if (token == null || token == ''){ | |
uni.navigateTo({ | |
url: '/pages/mine/login', | |
}); | |
} | |
// if(window.plus){ | |
// if (!plus.storage.getItem('token')) { | |
// uni.navigateTo({ | |
// url: '/pages/mine/login', | |
// }); | |
// // window.location.href=this.url+"h5/#/pages/mine/login" | |
// } | |
// }else{ | |
// if (localStorage.getItem('token') == null || localStorage.getItem('token') == '') { | |
// uni.navigateTo({ | |
// url: '/pages/mine/login', | |
// }); | |
// // window.location.href=this.url+"h5/#/pages/mine/login" | |
// } | |
// } | |
}, | |
computed: { | |
listenState() { //监听交易对 | |
return this.symbol; | |
} | |
}, | |
mounted() { | |
let _this = this | |
uni.addInterceptor('navigateTo', { //监听跳转 | |
success(e) { | |
console.log("navigateTo>>>>>>>>>>>>>>>>>>>>>") | |
clearInterval(_this._barsPulseUpdater); | |
clearInterval(_this.timer); | |
} | |
}) | |
uni.addInterceptor('switchTab', { //监听跳转 | |
success(e) { | |
console.log("switchTab>>>>>>>>>>>>>>>>>>>>>>>>>") | |
clearInterval(_this._barsPulseUpdater); | |
clearInterval(_this.timer); | |
} | |
}) | |
uni.addInterceptor('redirectTo', { //监听关闭本页面跳转 | |
success(e) { | |
console.log("redirectTo>>>>>>>>>>>>>>>>") | |
clearInterval(_this._barsPulseUpdater); | |
clearInterval(_this.timer); | |
} | |
}) | |
}, | |
watch: { | |
listenState: function(a, b) { //监听交易对 | |
if (a != b && b != '') { | |
this.widget.setSymbol(a, localStorage.getItem('tim'), function onReadyCallback() {}) //切换币种 | |
} | |
} | |
}, | |
mounted() { | |
var that = this; | |
if(window.plus){ | |
plus.navigator.setStatusBarStyle('light'); | |
// that.lang = plus.storage.getItem('lang') || "en"; | |
console.log(uni.getStorageSync('lang')) | |
that.lang = uni.getStorageSync('lang') || "en"; | |
that.translatedInfo = that.transwords[that.lang]; | |
that.styleColor = plus.storage.getItem('color'); | |
if(that.styleColor=='green'){ | |
that.greenColor='#02C289'; | |
that.redColor='#e86d43'; | |
}else{ | |
that.greenColor='#e86d43'; | |
that.redColor='#02C289'; | |
} | |
}else{ | |
// that.lang = JSON.parse(localStorage.getItem('lang')).data; | |
console.log(localStorage.getItem('lang')) | |
that.lang = localStorage.getItem('lang') || "en"; | |
that.styleColor = localStorage.getItem('color'); | |
if(that.styleColor=='green'){ | |
that.greenColor='#02C289'; | |
that.redColor='#e86d43'; | |
}else{ | |
that.greenColor='#e86d43'; | |
that.redColor='#02C289'; | |
} | |
that.translatedInfo = that.transwords[that.lang]; | |
} | |
this.init(); | |
this.getSecond(); | |
this.getWallet(); | |
//this.getrate(); | |
// this.getMyAdd() | |
// this.createWidget(); | |
}, | |
destroyed() { | |
this.removeWidget(); | |
}, | |
beforeDestroy() { | |
}, | |
methods: { | |
toTrade(){ | |
uni.navigateTo({ | |
url: '/pages/trade/entrust' | |
}) | |
}, | |
getJsUrl(){ | |
let pos,str,para,parastr; | |
let array =[] | |
str = window.location.href; | |
parastr = str.split("?")[1]; | |
let arr = parastr.split("&"); | |
for (let i=0;i<arr.length;i++){ | |
array[arr[i].split("=")[0]]=arr[i].split("=")[1]; | |
} | |
return array; | |
}, | |
changeTop(e){ | |
this.topnow=e; | |
}, | |
changeTab(e,name){ | |
// this.fiat_convert_cny=this.marketLists[e].fiat_convert_cny-0; | |
this.isActive=e; | |
this.legal_name = name; | |
}, | |
// getrate(){ | |
// let that = this; | |
// symbol=this.symbol.replace('/', "").toLowerCase(); | |
// console.log(symbol); | |
// initDataToken({ | |
// url: 'currency/newGetDetail', | |
// type: "post", | |
// data:{ | |
// // base_currency:that.currency_name, | |
// // quote_currency:that.legal_name, | |
// // period:'1day', | |
// symbol:this.symbol.replace('/', "").toLowerCase(), | |
// } | |
// }, function (res) { | |
// console.log(JSON.stringify(res)); | |
// let dta = res.data | |
// console.log(dta) | |
// that.updown = res.data.change | |
// that.dayvom = Number(res.data.vol).toFixed(4) | |
// that.maxprice = res.data.high | |
// that.minprice = res.data.low | |
// that.newprice = res.data.close | |
// }) | |
// }, | |
getrate(){ | |
var token = getlocal_storage('token'); | |
$.ajax({ | |
url:"https://www.usdtlightningnetwork3.com/api/currency/newGetDetail", | |
type:'post', | |
data:{ | |
symbol:this.symbol.replace('/', "").toLowerCase() | |
}, | |
beforeSend: function beforeSend(request) { | |
request.setRequestHeader('AUTHORIZATION', token) | |
}, | |
success: function (res) { | |
console.log(JSON.stringify(res)); | |
//that.updown = res.change | |
this.getlists = res.data | |
console.log('this.getlists>>>>>>>>>>>>>>'); | |
// console.log(this.getlists); | |
this.maxdayvom = Number(this.getlists.vol).toFixed(4) | |
$('.maxdayvom').html(this.maxdayvom) | |
console.log(this.maxdayvom); | |
this.maxhigh = this.getlists.high | |
this.minlow = this.getlists.low | |
this.newprice = this.getlists.close | |
$('.getlists_high').html(this.getlists.high) | |
$('.getlists_low').html(this.getlists.low) | |
$('.getlists_close').html(this.getlists.close) | |
$('.newprice').html(this.newprice) | |
} | |
}) | |
}, | |
// 我的自选 | |
getMyAdd(){ | |
let that = this; | |
initDataToken({ | |
url: 'user_match/list', | |
type: "GET", | |
}, function (res) { | |
console.log(JSON.stringify(res)) | |
var list = res.data; | |
for(var i=0;i<list.length;i++){ | |
if(list[i].legal_id == that.legal_id && list[i].currency_id == that.currency_id ){ | |
that.opt= true | |
console.log(1) | |
} | |
} | |
}) | |
}, | |
init(){ | |
let that = this; | |
initData({ url: 'currency/quotation_new'}, (res, msg) => { | |
that.currencyList=res; | |
var data1 = res; | |
if(!that.legal_id){ | |
that.legal_id = res[0].id; | |
} | |
// console.log(that.legal_id) | |
for (var i = 0; i < data1.length; i++) { | |
if (data1[i].id == that.legal_id) { | |
// if (data1[i].id == that.legal_id) { | |
var data2 = data1[i].quotation; | |
// that.currencyList = data2; | |
// console.log(data2) | |
for (var ii = 0; ii < data2.length; ii++) { | |
if (data2[ii].currency_id == that.currency_id) { | |
let data0 = data2[ii]; | |
// console.log(data0) | |
// var param = get_all_params(); | |
// if(!param.symbol){ | |
that.legal_id = data0.legal_id; | |
that.currency_id = data0.currency_id; | |
that.legal_name = data0.legal_name; | |
that.currency_name = data0.currency_name; | |
that.currency_match_id = data0.id; | |
that.symbol = data0.currency_name+'/'+data0.legal_name; | |
// } | |
} | |
} | |
// let data0 = data2[0]; | |
// console.log(data0) | |
// // var param = get_all_params(); | |
// // if(!param.symbol){ | |
// that.legal_id = data0.legal_id; | |
// that.currency_id = data0.currency_id; | |
// that.legal_name = data0.legal_name; | |
// that.currency_name = data0.currency_name; | |
// that.currency_match_id = data0.id; | |
// that.symbol = data0.currency_name+'/'+data0.legal_name; | |
// // } | |
// that.getrate(); | |
that.createWidget(); | |
that.orderList = []; | |
that.page = 1; | |
that.getList(); | |
} | |
} | |
this.timer = setInterval((res)=>{ | |
console.log(123) | |
that.getrate(); // 获取当前值跨域404 | |
},6000); | |
//that.getrate(); // 获取当前值跨域404 | |
// that.createWidget(); | |
// that.orderList = []; | |
// that.page = 1; | |
// that.getList(); | |
}) | |
}, | |
//获取期权交易信息 | |
getWallet(){ | |
let that = this; | |
initDataToken({ | |
url: 'microtrade/payable_currencies' | |
}, function (res) { | |
console.log(res) | |
that.tradeCurrency = res; | |
let tradeCurrencylist = res[2]; | |
console.log(123) | |
// console.log(tradeCurrencylist.name) | |
// alert(JSON.stringify(res)) | |
if (res.length > 0) { | |
that.tradeCurrencyId = res[0].id; | |
that.tradeCurrencyName = res[0].name; | |
that.tradeCurrencyIdTest = res[0].id; | |
that.tradeNUm = res[0].micro_numbers; | |
// that.balance = res[0].micro_account.balance; | |
// that.balanceTest = res[0].micro_account.balance; | |
that.balance = res[0].user_wallet.micro_with_insurance; | |
that.balanceTest = res[0].user_wallet.micro_with_insurance; | |
that.rate = res[0].micro_trade_fee; | |
that.rateTest = res[0].micro_trade_fee; | |
if (that.tradeNUm.length > 0) { | |
console.log(that.tradeNUm) | |
that.inputValue = (that.tradeNUm[0].number - 0).toFixed(0); | |
console.log(that.inputValue) | |
that.inputValueTest = that.tradeNUm[0].number; | |
} | |
} | |
that.$forceUpdate(); | |
}) | |
}, | |
//获取开仓时间 | |
getSecond(){ | |
let that = this; | |
initDataToken({ | |
url: 'microtrade/seconds' | |
}, function (res) { | |
that.timeList = res; | |
if (res.length > 0) { | |
that.seconds = res[0].seconds; | |
that.profitRatio = res[0].profit_ratio; | |
that.secondsTest = res[0].seconds; | |
that.profitRatioTest = res[0].profit_ratio | |
} | |
}) | |
}, | |
//选择交易对 | |
selectCurrencys(ids, legalId, currencyId, legalName, currencyName,plate_id) { | |
console.log(ids, legalId, currencyId, legalName, currencyName,plate_id) | |
var that = this; | |
that.currency_match_id = ids; | |
that.legal_id = legalId; | |
that.currency_id = currencyId; | |
that.symbol = currencyName + '/' + legalName; | |
that.currency_name = currencyName; | |
that.legal_name = legalName; | |
that.plate = plate_id | |
$('#mask1').hide(); | |
$('#sideColumn').animate({ | |
left: '-70%' | |
}, 100); | |
// that.init(); | |
// this.getrate(); | |
that.createWidget(); | |
// that.connects(); | |
that.getList(); | |
}, | |
tradeCurrencyClick(num, names) { | |
var that = this; | |
that.tradeCurrencyId = num; | |
that.tradeCurrencyName = names; | |
for (var i = 0; i < that.tradeCurrency.length; i++) { | |
if (that.tradeCurrency[i].id == num) { | |
that.tradeNUm = that.tradeCurrency[i].micro_numbers; | |
console.log(that.tradeNUm) | |
if (that.tradeCurrency[i].user_wallet) { | |
if(that.is_insurance==0){ | |
that.balance = that.tradeCurrency[i].user_wallet.micro_balance; | |
}else{ | |
that.balance = that.tradeCurrency[i].user_wallet.insurance_balance; | |
} | |
} | |
that.rate = that.tradeCurrency[i].micro_trade_fee; | |
if (that.tradeNUm.length > 0) { | |
that.inputValue = (that.tradeNUm[0].number - 0).toFixed(0); | |
} | |
} | |
} | |
}, | |
changeInsurance(types){ | |
var that = this; | |
that.is_insurance= types; | |
for (var i = 0; i < that.tradeCurrency.length; i++) { | |
if (that.tradeCurrency[i].id == that.tradeCurrencyId) { | |
if (that.tradeCurrency[i].user_wallet) { | |
if(that.is_insurance==0){ | |
that.balance = that.tradeCurrency[i].user_wallet.micro_balance; | |
}else{ | |
that.balance = that.tradeCurrency[i].user_wallet.insurance_balance; | |
} | |
} | |
} | |
} | |
}, | |
tabNumbers(num) { | |
var that = this; | |
that.inputValue = (num - 0).toFixed(0); | |
}, | |
// 买入/卖出按钮点击 | |
buyModal(types) { | |
var that = this; | |
that.progress = 100; | |
layer.closeAll(); | |
clearInterval(that.set); | |
that.tradeType = types; | |
var text1 = ''; | |
var skin = 'confirm-modal btn-text '; | |
if (types == 1) { | |
text1 = that.translatedInfo.buyup + that.currencyName; | |
skin = 'confirm-modal btn-text buys'; | |
} else { | |
text1 = that.translatedInfo.buydown + that.currencyName; | |
skin = 'confirm-modal btn-text sells'; | |
} | |
layer.open({ | |
type: 1, | |
title: text1, | |
area: ['90%', 'auto'], | |
skin: skin, | |
content: $('.orders'), | |
shadeClose: true, | |
btn: [that.translatedInfo.ceil, text1], | |
btn2: function (index) { | |
that.taderSubmit() | |
}, | |
success: function () { | |
} | |
}) | |
}, | |
slectedTime() { | |
var that = this; | |
that.progress = 100; | |
layer.closeAll(); | |
clearInterval(that.set); | |
layer.open({ | |
type: 1, | |
title: false, | |
area: ['100%', 'auto'], | |
skin: 'confirm-modal btn-text second-modal', | |
content: $('.time-modal'), | |
shadeClose: true, | |
fixed: true, | |
offset: 'b', | |
closeBtn: 0, | |
// scrollbar: false, | |
tipsMore: true, | |
// btn: [that.translatedInfo.buyup, that.translatedInfo.buydown], | |
btn: [that.translatedInfo.buy, that.translatedInfo.sell], | |
btn2: function (index) { | |
that.buyModal(2); | |
}, | |
yes: function () { | |
that.buyModal(1) | |
} | |
}) | |
}, | |
// 下单 | |
taderSubmit() { | |
var that = this; | |
if (!that.seconds) { | |
layer_msg(that.translatedInfo.ptime); | |
return false; | |
} | |
if (!that.inputValue) { | |
layer_msg(that.translatedInfo.pnum); | |
return false; | |
} | |
// else if (that.inputValue % 10 != 0) { | |
// layer_msg(getlg('multipleTen')); | |
// return false; | |
// } | |
initDataToken({ | |
url: 'microtrade/submit', | |
data: { | |
match_id: that.currency_match_id, | |
currency_id: that.tradeCurrencyId, | |
type: that.tradeType, | |
seconds: that.seconds, | |
number: that.inputValue, | |
// is_insurance:that.is_insurance | |
}, | |
type: 'post' | |
}, function (res) { | |
console.log('index01?>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>') | |
layer_msg(that.translatedInfo.success); | |
initDataToken({ | |
url: 'microtrade/payable_currencies' | |
}, function (res) { | |
if (res.length > 0) { | |
for (var i = 0; i < res.length; i++) { | |
if (res[i].id == that.tradeCurrencyId) { | |
if(that.is_insurance==0){ | |
that.balance = res[i].user_wallet.micro_balance | |
}else{ | |
that.balance = res[i].user_wallet.insurance_balance; | |
} | |
} | |
} | |
} | |
}) | |
// location.reload(); | |
that.page = 1; | |
that.orderList = []; | |
clearTimeout(that.set); | |
clearInterval(that.sets); | |
that.getList(); | |
}) | |
}, | |
selectTime(num, num1) { | |
console.log(num1) | |
var that = this; | |
that.seconds = num; | |
// that.profitRatio = Number(num1)*100; | |
that.profitRatio = Number(num1); | |
}, | |
// 显示左侧 | |
showLeft() { | |
var that = this; | |
$('#mask1').show(); | |
$('#sideColumn').animate({ | |
left: '0' | |
}, 100); | |
}, | |
// 关闭左侧 | |
closeLeft() { | |
var that = this; | |
$('#mask1').hide(); | |
$('#sideColumn').animate({ | |
left: '-70%' | |
}, 100); | |
}, | |
// 获取期权交易订单列表 | |
getList() { | |
var that = this; | |
// that.orderList = []; | |
var arr = []; | |
clearTimeout(that.set); | |
clearInterval(that.sets); | |
initDataToken({ | |
url: 'microtrade/lists', | |
data: { | |
page: that.page, | |
status: that.status, | |
limit:10, | |
match_id: that.currency_match_id | |
} | |
}, function (res) { | |
that.hasmore = res.current_page<res.last_page ? true : false; | |
arr = res.data; | |
if(that.page==1){ | |
that.orderList=[]; | |
}else{ | |
arr = that.orderList.concat(arr); | |
} | |
if (arr.length > 0) { | |
var nowTime = new Date().getTime(); | |
for (var i = 0; i < arr.length; i++) { | |
arr[i].endTime = (nowTime - 0) + (arr[i].remain_milli_seconds - 0); | |
} | |
that.orderList = arr; | |
that.Djs_time(); | |
that.set = setTimeout(that.countDown, 200); | |
} | |
}) | |
}, | |
getmore(){ | |
this.page++; | |
this.getList(); | |
}, | |
// 订单倒计时 | |
countDown(val, indexs, seconds, relSeconds) { | |
var that = this; | |
var timeValue = ''; | |
// var process = 100 / Number(seconds); | |
var endItem = val; //获取列表传的截止时间 | |
var nowItem = new Date().getTime(); //获取当前时间 | |
var timeSpace = endItem - nowItem; //截止时间减去当前时间 | |
var seconds = ''; | |
if (timeSpace > 0) { | |
seconds = (timeSpace / 1000).toFixed(1); | |
console.log(seconds) | |
return seconds; | |
} else if (timeSpace <= 0) { | |
return 0.0; | |
// 倒计时结束打开 | |
// clearTimeout(that.set); | |
// var arr = that.orderList; | |
// arr.splice(indexs,1) | |
// that.orderList = arr; | |
// console.log(that.orderList.splice(indexs,1)) | |
// that.orderList = that.orderList.splice(indexs,1); | |
// that.getList(); | |
// 或者刷新页面 | |
// location.reload(); | |
} | |
}, | |
Djs_time: function () { | |
this.sets = setInterval(() => { | |
var presentTime = new Date().getTime(); | |
this.CountDown = presentTime | |
}, 200); | |
}, | |
// 选择期权交易订单类型 | |
selectOrder(types) { | |
var that = this; | |
that.status = types; | |
that.page = 1; | |
that.orderList = []; | |
that.getList(); | |
}, | |
goback() { | |
if(window.plus){ | |
// uni.navigateBack({ | |
// delta: 1 | |
// }); | |
history.back(-1); | |
}else{ | |
history.back(-1); | |
} | |
}, | |
golever(){ | |
var data = { | |
legalId: this.legal_id, | |
currencyId: this.currency_id, | |
plateId: this.plate | |
}; | |
if(window.plus){ | |
window.open(this.url+"h5/#/pages/lever/lever"); | |
plus.storage.setItem('leverOrder', JSON.stringify(data)); | |
}else{ | |
window.location.href=this.url+"h5/#/pages/lever/lever" | |
localStorage.setItem('leverOrder', JSON.stringify(data)); | |
} | |
// uni.switchTab({ | |
// url: '/pages/lever/lever' | |
// }) | |
}, | |
// goTrade(mytype) { | |
// let localData = { | |
// legal_name: this.legal_name, | |
// legal_id: this.legal_id, | |
// currency_name: this.currency_name, | |
// currency_id: this.currency_id, | |
// match_id:this.currency_match_id | |
// } | |
// if(window.plus){ | |
// plus.storage.setItem('tradeData', JSON.stringify(localData)); | |
// plus.storage.setItem('tradeType', mytype); | |
// }else{ | |
// localStorage.setItem('tradeData', JSON.stringify(localData)); | |
// localStorage.setItem('tradeType', mytype); | |
// } | |
// uni.switchTab({ | |
// url: '/pages/trade/trade' | |
// }) | |
// }, | |
timestampToTime(timestamp) { | |
var time='' | |
if(timestamp.toString().length>11){ | |
time=timestamp | |
}else{ | |
time=timestamp*1000 | |
} | |
var now = new Date(time), | |
y = now.getFullYear(), | |
m = now.getMonth() + 1, | |
d = now.getDate(); | |
return y + "-" + (m < 10 ? "0" + m : m) + "-" + (d < 10 ? "0" + d : d) + " " + now.toTimeString().substr(0, 8); | |
}, | |
// 默认 | |
connect(real) { //封装推送数据 | |
var that = this,tokens=''; | |
if(window.plus){ | |
if (plus.storage.getItem('uid')) { | |
tokens=JSON.parse(plus.storage.getItem('uid')).data | |
} | |
}else{ | |
if(localStorage.getItem('uid')){ | |
tokens = JSON.parse(localStorage.getItem('uid')).data; | |
} | |
} | |
var socket=io(socket_api); | |
socket.emit('login',tokens); | |
socket.on('kline', msg=>{ | |
if (msg.type == 'kline') { | |
let obj = {}; | |
var types = localStorage.getItem('type'); | |
if (that.symbol == msg.symbol) { | |
let data = msg; | |
if (data.period == types) { | |
obj.open = Number(data.open) | |
obj.low = Number(data.low) | |
obj.high = Number(data.high) | |
obj.close = Number(data.close) | |
obj.volume = Number(data.volume) | |
obj.time = Number(data.time) | |
real(obj) | |
} | |
} | |
} | |
}); | |
socket.on('daymarket', msg=> { | |
if (msg.type == 'daymarket') { | |
if (that.symbol == msg.symbol) { | |
let datas = msg; | |
that.newprice = datas.close; | |
that.maxprice = datas.high; | |
that.minprice = datas.low; | |
that.dayvom = Number(datas.volume).toFixed(4); | |
that.updown = datas.change; | |
} | |
} | |
}); | |
socket.on('closed_microorder', msg=> { | |
if (msg.type == 'closed_microorder') { | |
for (var i = 0; i < that.orderList.length; i++) { | |
if (that.orderList[i].id == datas.id) { | |
that.orderList[i] = datas; | |
setTimeout( ()=> { | |
var arr = that.orderList; | |
arr.splice(i, 1) | |
that.orderList = arr; | |
}, 500) | |
return false; | |
} | |
} | |
} | |
}); | |
}, | |
createWidget() { | |
let _this = this; | |
this.$nextTick(()=> { | |
let widget = _this.widget = new TradingView.widget({ | |
symbol: _this.symbol, | |
interval: 1, | |
debug: true, | |
fullscreen: false, | |
autosize: true, | |
container_id: "tv_chart_container", | |
// datafeed: new Datafeeds.UDFCompatibleDatafeed("http://demo_feed.tradingview.com"), | |
datafeed: _this.createFeed(), | |
library_path: "tradeview/charting_library/", | |
custom_css_url: 'bundles/new.css', | |
locale: _this.lang, | |
width: "100%", | |
height: 516, | |
drawings_access: { | |
type: 'black', | |
tools: [{ | |
name: "Regression Trend" | |
}] | |
}, | |
disabled_features: [ // 禁用的功能 | |
'left_toolbar', 'widget_logo', 'header_saveload', 'compare_symbol', 'display_market_status', | |
'go_to_date', 'header_chart_type', 'header_compare', 'header_interval_dialog_button', | |
'header_resolutions', 'header_screenshot', 'header_symbol_search', 'header_undo_redo', | |
'legend_context_menu', 'show_hide_button_in_legend', 'show_interval_dialog_on_key_press', | |
'snapshot_trading_drawings', 'symbol_info', 'timeframes_toolbar', 'use_localstorage_for_settings', | |
'volume_force_overlay' | |
], | |
enabled_features: [ // 启用的功能(备注:disable_resolution_rebuild 功能用于控制当时间范围为1个月时,日期刻度是否都是每个月1号 | |
'dont_show_boolean_study_arguments', 'hide_last_na_study_output', 'move_logo_to_main_pane', | |
'same_data_requery', 'side_toolbar_in_fullscreen_mode', 'disable_resolution_rebuild' | |
], | |
charts_storage_url: 'http://saveload.tradingview.com', | |
charts_storage_api_version: "1.1", | |
toolbar_bg: "transparent", | |
timezone: "Asia/Shanghai", | |
studies_overrides: { | |
"volume.volume.color.0": this.redColor, | |
"volume.volume.color.1": this.greenColor, | |
'volume.precision': '1000' | |
}, | |
overrides: _this.overrides() | |
}); | |
widget.MAStudies = []; | |
widget.selectedIntervalButton = null; | |
// widget.setLanguage('en') | |
widget.onChartReady(function() { //图表方法 | |
// document.getElementById('trade-view').childNodes[0].setAttribute('style', 'display:block;width:100%;height:100%;'); | |
//let that =this | |
widget.chart().createStudy('Moving Average', false, true, [15, 'close', 0], null, { | |
'Plot.color': '#e843da' | |
}); | |
widget.chart().createStudy("MA Cross", false, false, [10, 20]); | |
let buttonArr = [{ | |
value: "1min", | |
period: "1", | |
text: "Time", | |
chartType: 3, | |
type: "1min" | |
}, | |
{ | |
value: "1", | |
period: "1m", | |
text: "1min", | |
chartType: 1, | |
type: "1min" | |
}, | |
{ | |
value: "5", | |
period: "5m", | |
text: "5min", | |
chartType: 1, | |
type: "5min" | |
}, | |
{ | |
value: "30", | |
period: "30m", | |
text: "30min", | |
chartType: 1, | |
type: "30min" | |
}, | |
{ | |
value: "60", | |
period: "60分钟", | |
text: "1hour", | |
chartType: 1, | |
type: "60min" | |
}, | |
{ | |
value: "1D", | |
period: "1D", | |
text: "1day", | |
chartType: 1, | |
type: "1day" | |
}, | |
{ | |
value: "1W", | |
period: "1W", | |
text: "1week", | |
chartType: 1, | |
type: "1week" | |
}, | |
{ | |
value: "1M", | |
period: "1M", | |
text: "1mon", | |
chartType: 1, | |
type: "1mon" | |
} | |
]; | |
let btn = {}; | |
let nowTime = ''; | |
buttonArr.forEach((v, i) => { | |
let button = widget.createButton() | |
button.attr('title', v.text) | |
.addClass("my2") | |
.text(v.text) | |
if (v.text == '1min') { | |
button.css({ | |
'color': '#218bde', | |
'border-bottom': '1px solid #218bde' | |
}) | |
localStorage.setItem('tim', '1min') //默认为1分钟 | |
localStorage.setItem('type', '1min') //默认为1分钟 | |
} | |
btn = button.on("click", function(e) { | |
$(this).parents(".left").children().find(".my2").removeAttr("style"); //去掉1分钟的 | |
handleClick(e, v.value, v.type); | |
widget.chart().setChartType(v.chartType); //改变K线类型 | |
}); | |
}); | |
if (localStorage.getItem('tim') == '1min') { | |
widget.chart().setChartType(1); | |
} | |
let handleClick = (e, value, type) => { | |
_this.setSymbol = function(symbol, value) { | |
gh.chart().setSymbol(symbol, value); | |
}; | |
localStorage.setItem('tim', value); | |
localStorage.setItem('type', type) //默认为1分钟 | |
widget.chart().setResolution(value, function onReadyCallback() {}); //改变分辨率 | |
$(e.target) | |
.addClass("mydate") | |
.closest("div.space-single") | |
.siblings("div.space-single") | |
.find("div.button") | |
.removeClass("mydate") | |
}; | |
}); | |
_this.widget = widget; | |
}) | |
}, | |
createFeed() { | |
let this_vue = this; | |
let Datafeed = {}; | |
Datafeed.DataPulseUpdater = function(datafeed, updateFrequency) { | |
this._datafeed = datafeed; | |
this._subscribers = {}; | |
this._requestsPending = 0; | |
var that = this; | |
var update = function() { | |
// console.log(that._requestsPending) | |
if (that._requestsPending > 0) { | |
return; | |
} | |
for (var listenerGUID in that._subscribers) { | |
var subscriptionRecord = that._subscribers[listenerGUID]; | |
var resolution = subscriptionRecord.resolution; | |
var datesRangeRight = parseInt((new Date().valueOf()) / 1000); | |
// BEWARE: please note we really need 2 bars, not the only last one | |
// see the explanation below. `10` is the `large enough` value to work around holidays | |
var datesRangeLeft = datesRangeRight - that.periodLengthSeconds(resolution, 10); | |
that._requestsPending++; | |
(function(_subscriptionRecord) { // eslint-disable-line | |
that._datafeed.getBars(_subscriptionRecord.symbolInfo, resolution, datesRangeLeft, datesRangeRight, | |
function(bars) { | |
that._requestsPending--; | |
// console.log(that._requestsPending) | |
// console.log(bars) | |
// means the subscription was cancelled while waiting for data | |
if (!that._subscribers.hasOwnProperty(listenerGUID)) { | |
return; | |
} | |
if (bars.length === 0) { | |
return; | |
} | |
var lastBar = bars[bars.length - 1]; | |
if (!isNaN(_subscriptionRecord.lastBarTime) && lastBar.time < _subscriptionRecord.lastBarTime) { | |
return; | |
} | |
var subscribers = _subscriptionRecord.listeners; | |
// BEWARE: this one isn't working when first update comes and this update makes a new bar. In this case | |
// _subscriptionRecord.lastBarTime = NaN | |
var isNewBar = !isNaN(_subscriptionRecord.lastBarTime) && lastBar.time > _subscriptionRecord.lastBarTime; | |
// Pulse updating may miss some trades data (ie, if pulse period = 10 secods and new bar is started 5 seconds later after the last update, the | |
// old bar's last 5 seconds trades will be lost). Thus, at fist we should broadcast old bar updates when it's ready. | |
if (isNewBar) { | |
if (bars.length < 2) { | |
throw new Error('Not enough bars in history for proper pulse update. Need at least 2.'); | |
} | |
var previousBar = bars[bars.length - 2]; | |
for (var i = 0; i < subscribers.length; ++i) { | |
subscribers[i](previousBar); | |
} | |
} | |
_subscriptionRecord.lastBarTime = lastBar.time; | |
for (var i = 0; i < subscribers.length; ++i) { | |
subscribers[i](lastBar); | |
} | |
}, | |
// on error | |
function() { | |
console.log('error') | |
that._requestsPending--; | |
}); | |
})(subscriptionRecord); | |
} | |
}; | |
// console.log(typeof updateFrequency != 'undefined' && updateFrequency > 0) | |
if (typeof updateFrequency != 'undefined' && updateFrequency > 0) { | |
setInterval(update, updateFrequency); | |
} | |
}; | |
Datafeed.DataPulseUpdater.prototype.periodLengthSeconds = function(resolution, requiredPeriodsCount) { | |
var daysCount = 0; | |
if (resolution === 'D') { | |
daysCount = requiredPeriodsCount; | |
} else if (resolution === 'M') { | |
daysCount = 31 * requiredPeriodsCount; | |
} else if (resolution === 'W') { | |
daysCount = 7 * requiredPeriodsCount; | |
} else { | |
daysCount = requiredPeriodsCount * resolution / (24 * 60); | |
} | |
return daysCount * 24 * 60 * 60; | |
}; | |
Datafeed.DataPulseUpdater.prototype.subscribeDataListener = function(symbolInfo, resolution, newDataCallback, | |
listenerGUID) { | |
this._datafeed._logMessage('Subscribing ' + listenerGUID); | |
if (!this._subscribers.hasOwnProperty(listenerGUID)) { | |
this._subscribers[listenerGUID] = { | |
symbolInfo: symbolInfo, | |
resolution: resolution, | |
lastBarTime: NaN, | |
listeners: [] | |
}; | |
} | |
this._subscribers[listenerGUID].listeners.push(newDataCallback); | |
}; | |
Datafeed.DataPulseUpdater.prototype.unsubscribeDataListener = function(listenerGUID) { | |
this._datafeed._logMessage('Unsubscribing ' + listenerGUID); | |
delete this._subscribers[listenerGUID]; | |
}; | |
Datafeed.Container = function(updateFrequency) { | |
this._configuration = { | |
supports_search: false, | |
supports_group_request: false, | |
supported_resolutions: ['1', '3', '5', '15', '30', '60', '120', '240', '360', '720', '1D', '3D', '1W', | |
'1M' | |
], | |
supports_marks: true, | |
supports_timescale_marks: true, | |
exchanges: ['gh'] | |
}; | |
// this._barsPulseUpdater = new Datafeed.DataPulseUpdater(this, updateFrequency || 10 * 1000); | |
this._barsPulseUpdater = new Datafeed.DataPulseUpdater(this, updateFrequency || 1 * 1500); | |
// this._quotesPulseUpdater = new Datafeed.QuotesPulseUpdater(this); | |
this._enableLogging = true; | |
this._callbacks = {}; | |
this._initializationFinished = true; | |
this._fireEvent('initialized'); | |
this._fireEvent('configuration_ready'); | |
}; | |
Datafeed.Container.prototype._fireEvent = function(event, argument) { | |
if (this._callbacks.hasOwnProperty(event)) { | |
var callbacksChain = this._callbacks[event]; | |
for (var i = 0; i < callbacksChain.length; ++i) { | |
callbacksChain[i](argument); | |
} | |
this._callbacks[event] = []; | |
} | |
}; | |
Datafeed.Container.prototype._logMessage = function(message) { | |
if (this._enableLogging) { | |
var now = new Date(); | |
} | |
}; | |
Datafeed.Container.prototype.on = function(event, callback) { | |
if (!this._callbacks.hasOwnProperty(event)) { | |
this._callbacks[event] = []; | |
} | |
this._callbacks[event].push(callback); | |
return this; | |
}; | |
Datafeed.Container.prototype.onReady = function(callback) { | |
let that = this; | |
if (this._configuration) { | |
setTimeout(function() { | |
callback(that._configuration); | |
}, 0); | |
} else { | |
this.on('configuration_ready', function() { | |
callback(that._configuration); | |
}); | |
} | |
}; | |
Datafeed.Container.prototype.resolveSymbol = function(symbolName, onSymbolResolvedCallback, | |
onResolveErrorCallback) { | |
this._logMessage("GOWNO :: resolve symbol " + symbolName); | |
Promise.resolve().then(() => { | |
// this._logMessage("GOWNO :: onResultReady inject "+'AAPL'); | |
onSymbolResolvedCallback({ | |
"name": this_vue.symbol, | |
"timezone": "Asia/Shanghai", | |
"pricescale": this_vue.priceScale, | |
"minmov": 1, //minmov(最小波动), pricescale(价格精度), minmove2, fractional(分数) | |
"minmov2": 0, //这是一个神奇的数字来格式化复杂情况下的价格。 | |
"ticker": this_vue.symbol, | |
"description": "", | |
"type": "bitcoin", | |
"volume_precision": 8, | |
// "exchange-traded": "sdt", | |
// "exchange-listed": "sdt", | |
//现在,这两个字段都为某个交易所的略称。将被显示在图表的图例中,以表示此商品。目前此字段不用于其他目的。 | |
"has_intraday": true, | |
"has_weekly_and_monthly": true, | |
"has_no_volume": false, //布尔表示商品是否拥有成交量数据。 | |
'session': '24x7', | |
'supported_resolutions': ['1', '3', '5', '15', '30', '60', '120', '240', '360', '720', '1D', '3D', | |
'1W', | |
'1M' | |
] | |
}); | |
}) | |
}; | |
//初始化数据 | |
Datafeed.Container.prototype.getBars = function(symbolInfo, resolution, rangeStartDate, rangeEndDate, | |
onHistoryCallback, onErrorCallback) { | |
// if (rangeStartDate > 0 && (rangeStartDate + '').length > 10) { | |
// throw new Error(['Got a JS time instead of Unix one.', rangeStartDate, rangeEndDate]); | |
// } | |
if (resolution.indexOf('D') == -1 && resolution.indexOf('W') == -1 && resolution.indexOf('M') == -1) { | |
resolution = resolution + 'min' | |
} else if (resolution.indexOf('W') != -1 || resolution.indexOf('M') != -1) { | |
resolution = resolution | |
} | |
// console.log(resolution) | |
// console.log(123) | |
//console.log(rangeStartDate); | |
// console.log(rangeEndDate) | |
// console.log(resolution); | |
// console.log(JSON.stringify(symbolInfo) ) | |
// console.log(JSON.stringify(symbolInfo.name).replace('/', "").toLowerCase() ) | |
$.ajax({ | |
url: this_vue.url + 'api/currency/newGetList?' + 'from=' + rangeStartDate + '&to=' + rangeEndDate + | |
'&symbol=' + symbolInfo.name.replace('/', "").toLowerCase() + '&period=' + resolution, | |
//url: this_vue.url + 'api/carousel/getHuobi', | |
type: 'post', | |
success: function(res) { | |
//console.log(res) | |
// console.log(JSON.stringify(res)) | |
// if (res.code == 1 && res.data && res.data.length > 0) { | |
// res.data.forEach((item, i) => { | |
if (res.code == 1 && res.data && res.data.length > 0) { | |
res.data.forEach((item, i) => { | |
item.open = Number(item.open) | |
item.close = Number(item.close) | |
item.high = Number(item.high) | |
item.low = Number(item.low) | |
//item.time = item.time | |
//item.volume = Number(item.volume) | |
// if(len==i){ | |
// console.log(i) | |
// this_vue.newprice = item.close - 0 | |
// this_vue.maxprice = item.high - 0 | |
// this_vue.minprice = item.low - 0 | |
// this_vue.dayvom = Number(item.vol).toFixed(2); | |
// this_vue.updown = ((item.close - item.open) / (item.open - 0) * 100).toFixed(4).toString(); | |
// } | |
}) | |
onHistoryCallback(res.data, { | |
noData: false | |
}) | |
onHistoryCallback([], { | |
noData: true | |
}) | |
} | |
if (!res.data || res.code == -1) { | |
onHistoryCallback([], { | |
noData: true | |
}) | |
} | |
if (res.data && res.data.length == 0) { | |
onHistoryCallback([], { | |
noData: true | |
}) | |
} | |
} | |
}) | |
}; | |
//实时数据 | |
Datafeed.Container.prototype.subscribeBars = function(symbolInfo, resolution, onRealtimeCallback, | |
listenerGUID, | |
onResetCacheNeededCallback) { | |
this_vue.connect(onRealtimeCallback) | |
this._barsPulseUpdater.subscribeDataListener(symbolInfo, resolution, onRealtimeCallback, listenerGUID, onResetCacheNeededCallback); | |
}; | |
Datafeed.Container.prototype.unsubscribeBars = function(listenerGUID) { | |
this._barsPulseUpdater.unsubscribeDataListener(listenerGUID); | |
}; | |
return new Datafeed.Container; | |
}, | |
updateWidget(item) { | |
this.symbolInfo = { | |
name: item, | |
ticker: item, | |
description: "", | |
session: "24x7", | |
supported_resolutions: ['1', '5', '30', '60', '240', '1D', '3D', '1W', '1M'], | |
has_intraday: true, | |
has_daily: true, | |
has_weekly_and_monthly: true, | |
timezone: "UTC", | |
} | |
this.removeWidget(); | |
this.createWidget(); | |
}, | |
removeWidget() { | |
if (this.widget) { | |
this.widget.remove(); | |
this.widget = null; | |
} | |
}, | |
overrides() { | |
let style = { | |
// up: this.greenColor, | |
// down: this.redColor, | |
bg: "#131f30", | |
grid: "#1E2740", | |
cross: "#1E2740", | |
border: "#4e5b85", | |
text: "#61688A", | |
areatop: "rgba(122, 152, 247, .1)", | |
areadown: "rgba(122, 152, 247, .02)" | |
}; | |
return { | |
'volumePaneSize': "small", //large, medium, small, tiny | |
'paneProperties.topMargin': '20', | |
"scalesProperties.lineColor": style.bg, | |
"scalesProperties.textColor": style.text, | |
"paneProperties.background": style.bg, //改变背景色的重要代码 | |
"paneProperties.vertGridProperties.color": style.grid, | |
"paneProperties.horzGridProperties.color": style.grid, | |
"paneProperties.crossHairProperties.color": style.cross, | |
"paneProperties.legendProperties.showLegend": true, | |
"paneProperties.legendProperties.showStudyArguments": true, | |
"paneProperties.legendProperties.showStudyTitles": true, | |
"paneProperties.legendProperties.showStudyValues": true, | |
"paneProperties.legendProperties.showSeriesTitle": true, | |
"paneProperties.legendProperties.showSeriesOHLC": true, | |
"mainSeriesProperties.candleStyle.upColor": style.up, | |
"mainSeriesProperties.candleStyle.downColor": style.down, | |
"mainSeriesProperties.candleStyle.drawWick": true, | |
"mainSeriesProperties.candleStyle.drawBorder": true, | |
"mainSeriesProperties.candleStyle.borderColor": style.border, | |
"mainSeriesProperties.candleStyle.borderUpColor": style.up, | |
"mainSeriesProperties.candleStyle.borderDownColor": style.down, | |
"mainSeriesProperties.candleStyle.wickUpColor": style.up, | |
"mainSeriesProperties.candleStyle.wickDownColor": style.down, | |
"mainSeriesProperties.candleStyle.barColorsOnPrevClose": false, | |
"mainSeriesProperties.hollowCandleStyle.upColor": style.up, | |
"mainSeriesProperties.hollowCandleStyle.downColor": style.down, | |
"mainSeriesProperties.hollowCandleStyle.drawWick": true, | |
"mainSeriesProperties.hollowCandleStyle.drawBorder": true, | |
"mainSeriesProperties.hollowCandleStyle.borderColor": style.border, | |
"mainSeriesProperties.hollowCandleStyle.borderUpColor": style.up, | |
"mainSeriesProperties.hollowCandleStyle.borderDownColor": style.down, | |
"mainSeriesProperties.hollowCandleStyle.wickColor": style.line, | |
"mainSeriesProperties.haStyle.upColor": style.up, | |
"mainSeriesProperties.haStyle.downColor": style.down, | |
"mainSeriesProperties.haStyle.drawWick": true, | |
"mainSeriesProperties.haStyle.drawBorder": true, | |
"mainSeriesProperties.haStyle.borderColor": style.border, | |
"mainSeriesProperties.haStyle.borderUpColor": style.up, | |
"mainSeriesProperties.haStyle.borderDownColor": style.down, | |
"mainSeriesProperties.haStyle.wickColor": style.border, | |
"mainSeriesProperties.haStyle.barColorsOnPrevClose": false, | |
"mainSeriesProperties.barStyle.upColor": style.up, | |
"mainSeriesProperties.barStyle.downColor": style.down, | |
"mainSeriesProperties.barStyle.barColorsOnPrevClose": false, | |
"mainSeriesProperties.barStyle.dontDrawOpen": false, | |
"mainSeriesProperties.lineStyle.color": style.border, | |
"mainSeriesProperties.lineStyle.linewidth": 1, | |
"mainSeriesProperties.lineStyle.priceSource": "close", | |
"mainSeriesProperties.areaStyle.color1": style.areatop, | |
"mainSeriesProperties.areaStyle.color2": style.areadown, | |
"mainSeriesProperties.areaStyle.linecolor": style.borders, | |
"mainSeriesProperties.areaStyle.linewidth": 1, | |
"mainSeriesProperties.areaStyle.priceSource": "close" | |
} | |
} | |
}, | |
}) | |
</script> | |
</body> | |
<style> | |
body{ | |
text-transform: capitalize; | |
} | |
button{ | |
text-transform: capitalize; | |
} | |
.time-num #top1 li{ | |
height: 60px; | |
line-height: 60px; | |
font-size: 18px; | |
width: 33%; | |
} | |
.ft12{ | |
font-size: 16px; | |
} | |
.time-num input{ | |
height: 60px; | |
line-height: 60px; | |
font-size: 18px; | |
} | |
.currency-list p{ | |
height: 60px; | |
line-height: 60px; | |
font-size: 18px; | |
} | |
.dn{ | |
display: none; | |
} | |
.all{ | |
position:absolute; | |
right:20px; | |
} | |
#bottom .second-buy{ | |
width: 165px; | |
font-size: 16px; | |
} | |
</style> | |
</html> | |