完善钱包和修改logo

master
joeyoyo 6 years ago
parent 06f7b4493a
commit 573433d5b9
  1. 742
      html/wallet/html/assets.html
  2. 621
      html/wallet/html/wallet.html
  3. 896
      html/wallet/js/wallet.api.js
  4. 1134
      mine/html/my/my_about_us.html
  5. 268
      mine/html/my/share_app.html
  6. 1231
      mine/html/wallet_my.html
  7. 819
      mine/html/wallet_pass_login.html
  8. BIN
      mine/img/logo.png
  9. BIN
      mine/img/shareLogo.jpg
  10. BIN
      mine/img/yanhuo_logo.jpg

@ -1,368 +1,376 @@
<!doctype html> <!doctype html>
<html> <html>
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>资产</title> <title>资产</title>
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no,viewport-fit=cover"> <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no,viewport-fit=cover">
<link href="../../../lib/css/mui.min.css" rel="stylesheet" /> <link href="../../../lib/css/mui.min.css" rel="stylesheet" />
<!--引入公共样式--> <!--引入公共样式-->
<link href="../../../lib/css/basic.css" rel="stylesheet" /> <link href="../../../lib/css/basic.css" rel="stylesheet" />
<link href="../css/assets.css" rel="stylesheet" /> <link href="../css/assets.css" rel="stylesheet" />
<script src="../../../lib/js/rem-layout.js"></script> <script src="../../../lib/js/rem-layout.js"></script>
<script src="../../../lib/js/require2.1.11.js"></script> <script src="../../../lib/js/require2.1.11.js"></script>
<script type="text/javascript" src="../js/base.config.js"></script> <script type="text/javascript" src="../js/base.config.js"></script>
</head> </head>
<body> <body>
<div id="js-data-info"> <div id="js-data-info">
<header class="mui-bar mui-bar-nav"> <header class="mui-bar mui-bar-nav">
<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a> <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
<h1 class="mui-title">{{coin.walletType | filetWalletType}} — {{coin.tokenSymbol}} {{langue.capital}}</h1> <h1 class="mui-title">{{coin.walletType | filetWalletType}} — {{coin.tokenSymbol}} {{langue.capital}}</h1>
</header> </header>
<div class="mui-content"> <div class="mui-content">
<!--代币信息--> <!--代币信息-->
<div class="coin"> <div class="coin">
<div class="coin-kind"> <div class="coin-kind">
<div class="coin-kind-img"><img :src="coin.src" /></div> <div class="coin-kind-img"><img :src="coin.src" /></div>
<span class="coin-kind-txt">{{coin.tokenSymbol}}</span> <span class="coin-kind-txt">{{coin.tokenSymbol}}</span>
</div> </div>
<div class="coin-item"> <div class="coin-item">
<ul> <ul>
<li class="coin-item-list"> <li class="coin-item-list">
<span class="coin-item-list-txt">{{langue.amount}}</span> <span class="coin-item-list-txt">{{langue.amount}}</span>
<span class="coin-item-list-num">{{coin.balance}}</span> <span class="coin-item-list-num">{{coin.balance}}</span>
</li> </li>
<li class="coin-item-list"> <li class="coin-item-list">
<span class="coin-item-list-txt">{{langue.freeBalance}}</span> <span class="coin-item-list-txt">{{langue.freeBalance}}</span>
<span class="coin-item-list-num">{{coin.freeBalance}}</span> <span class="coin-item-list-num">{{coin.freeBalance}}</span>
</li> </li>
<li class="coin-item-list"> <li class="coin-item-list">
<span class="coin-item-list-txt">{{langue.freezeBalance}}</span> <span class="coin-item-list-txt">{{langue.freezeBalance}}</span>
<span class="coin-item-list-num">{{coin.freezeBalance}}</span> <span class="coin-item-list-num">{{coin.freezeBalance}}</span>
</li> </li>
<!--<li class="coin-item-list"> <!--<li class="coin-item-list">
<span class="coin-item-list-txt">{{langue.valuation}}({{marketData ? marketData.basecoin : 'USDT'}})</span> <span class="coin-item-list-txt">{{langue.valuation}}({{marketData ? marketData.basecoin : 'USDT'}})</span>
<span class="coin-item-list-num">{{valuation.countCoin}}</span> <span class="coin-item-list-num">{{valuation.countCoin}}</span>
</li> </li>
<li class="coin-item-list"> <li class="coin-item-list">
<span class="coin-item-list-txt">{{langue.valuation}}({{valuation.moneyKey}})</span> <span class="coin-item-list-txt">{{langue.valuation}}({{valuation.moneyKey}})</span>
<span class="coin-item-list-num">{{valuation.countAmount}}</span> <span class="coin-item-list-num">{{valuation.countAmount}}</span>
</li>--> </li>-->
</ul> </ul>
</div> </div>
</div> </div>
<!--去交易--> <!--去交易-->
<div class="transaction"> <div class="transaction">
<h3>{{langue.record}}</h3> <h3>{{langue.record}}</h3>
<div class="transaction-data"> <div class="transaction-data">
<div class="mui-row transaction-data-title"> <div class="mui-row transaction-data-title">
<div class="mui-col-sm-4 mui-col-xs-4">{{langue.amount}}</div> <div class="mui-col-sm-4 mui-col-xs-4">{{langue.amount}}</div>
<div class="mui-col-sm-4 mui-col-xs-4">{{langue.state}}</div> <div class="mui-col-sm-4 mui-col-xs-4">{{langue.state}}</div>
<div class="mui-col-sm-4 mui-col-xs-4 mui-text-right">{{langue.dateTime}}</div> <div class="mui-col-sm-4 mui-col-xs-4 mui-text-right">{{langue.dateTime}}</div>
</div> </div>
<div class="record-contorol"> <div class="record-contorol">
<div class="mui-scroll-wrapper"> <div class="mui-scroll-wrapper">
<div id="js-scroll" class=" mui-scroll"> <div id="js-scroll" class=" mui-scroll">
<ul class="mui-table-view transaction-data-record"> <ul class="mui-table-view transaction-data-record">
<li class="mui-table-view-cell mui-row js-coin-record" v-for="(row,index) in coinRecord" :data-index="index"> <li class="mui-table-view-cell mui-row js-coin-record" v-for="(row,index) in coinRecord" :data-index="index">
<div class="mui-row"> <div class="mui-row">
<div class="mui-col-sm-4 mui-col-xs-4 mui-ellipsis">{{row.amount | filtAmount}}</div> <div class="mui-col-sm-4 mui-col-xs-4 mui-ellipsis">{{row.amount | filtAmount}}</div>
<div class="mui-col-sm-4 mui-col-xs-4">{{row.status | filtStatus}}</div> <div class="mui-col-sm-4 mui-col-xs-4">{{row.status | filtStatus}}</div>
<div class="mui-col-sm-4 mui-col-xs-4 mui-text-right">{{row.createTime || row.timestamp | filtDate}}</div> <div class="mui-col-sm-4 mui-col-xs-4 mui-text-right">{{row.createTime || row.timestamp | filtDate}}</div>
</div> </div>
</li> </li>
</ul> </ul>
</div> </div>
</div> </div>
<div class="btn mui-row" v-if="coin.tokenSymbol != 'DIA' && coin.tokenSymbol != 'TIN' "> <div class="btn mui-row" v-if="coin.tokenSymbol != 'DIA' && coin.tokenSymbol != 'TIN' ">
<div class="mui-col-sm-6 mui-col-xs-6"> <div class="mui-col-sm-4 mui-col-xs-4">
<div class="btn-recharge" id="btn-recharge">{{langue.addCredit}}</div> <div class="btn-recharge" id="btn-recharge">{{langue.addCredit}}</div>
</div> </div>
<!--<div class="mui-col-sm-4 mui-col-xs-4"> <div class="mui-col-sm-4 mui-col-xs-4">
<div class="btn-withdraw" id="btn-withdraw">{{langue.withdrawCoin}}</div> <div class="btn-withdraw" id="btn-withdraw">{{langue.withdrawCoin}}</div>
</div>--> </div>
<div class="mui-col-sm-6 mui-col-xs-6"> <div class="mui-col-sm-4 mui-col-xs-4">
<div class="btn-transfer" id="btn-transfer">{{langue.transfer}}</div> <div class="btn-transfer" id="btn-transfer">{{langue.transfer}}</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</body> </body>
<script type="text/javascript"> <script type="text/javascript">
define('langues', { define('langues', {
zh_CN: { zh_CN: {
capital: "资产", capital: "资产",
title: "钱包", title: "钱包",
totalBalance: "总额", totalBalance: "总额",
valuation: "估值", valuation: "估值",
addCredit: "充值", addCredit: "充值",
withdrawCoin: "提现", withdrawCoin: "提现",
transfer: '划转', transfer: '划转',
freeBalance: "可用余额", freeBalance: "可用余额",
freezeBalance: "冻结余额", freezeBalance: "冻结余额",
succeed: "成功", succeed: "成功",
error: "失败", error: "失败",
coinWallet: "币币钱包", coinWallet: "币币钱包",
currencyWallet: "法币钱包", currencyWallet: "法币钱包",
dateTime: "时间", dateTime: "时间",
amount: "数量", amount: "数量",
state: "状态", state: "状态",
await: "打包中", await: "打包中",
pendingon: "待处理", pendingon: "待处理",
record: "财务记录", record: "财务记录",
statusObj: { statusObj: {
0: "失败", 0: "失败",
1: "成功", 1: "成功",
2: "待处理", 2: "待处理",
3: "待处理", 3: "待处理",
4: "待处理", 4: "待处理",
5: "打包中", 5: "打包中",
6: "失败", 6: "失败",
7: "失败", 7: "失败",
} }
}, },
zh_HK: { zh_HK: {
capital: "資產", capital: "資產",
title: "錢包", title: "錢包",
totalBalance: "總額", totalBalance: "總額",
valuation: "估值", valuation: "估值",
addCredit: "充值", addCredit: "充值",
withdrawCoin: "提現", withdrawCoin: "提現",
transfer: '劃轉', transfer: '劃轉',
freeBalance: "可用余額", freeBalance: "可用余額",
freezeBalance: "凍結余額", freezeBalance: "凍結余額",
succeed: "成功", succeed: "成功",
error: "失敗", error: "失敗",
coinWallet: "幣幣錢包", coinWallet: "幣幣錢包",
currencyWallet: "法幣錢包", currencyWallet: "法幣錢包",
dateTime: "時間", dateTime: "時間",
amount: "數量", amount: "數量",
state: "狀態", state: "狀態",
await: "打包中", await: "打包中",
pendingon: "待處理", pendingon: "待處理",
record: "財務記錄", record: "財務記錄",
statusObj: { statusObj: {
0: "失敗", 0: "失敗",
1: "成功", 1: "成功",
2: "待處理", 2: "待處理",
3: "待處理", 3: "待處理",
4: "待處理", 4: "待處理",
5: "打包中", 5: "打包中",
6: "失敗", 6: "失敗",
7: "失敗", 7: "失敗",
} }
}, },
en_US: { en_US: {
capital: "Capital", capital: "Capital",
title: "Wallet", title: "Wallet",
totalBalance: "Total Balance", totalBalance: "Total Balance",
valuation: "Valuation", valuation: "Valuation",
addCredit: "Recharge", addCredit: "Recharge",
withdrawCoin: "Withdraw", withdrawCoin: "Withdraw",
transfer: 'Transfer', transfer: 'Transfer',
freeBalance: "Free Balance", freeBalance: "Free Balance",
freezeBalance: "Freeze Balance", freezeBalance: "Freeze Balance",
succeed: "Success", succeed: "Success",
error: "ERROR", error: "ERROR",
coinWallet: "CCT", coinWallet: "CCT",
currencyWallet: "OTC", currencyWallet: "OTC",
dateTime: "Date", dateTime: "Date",
amount: "Amount", amount: "Amount",
state: "State", state: "State",
await: "Await", await: "Await",
pendingon: "Pendingon", pendingon: "Pendingon",
record: "Financial record", record: "Financial record",
statusObj: { statusObj: {
0: "ERROR", 0: "ERROR",
1: "Success", 1: "Success",
2: "Pendingon", 2: "Pendingon",
3: "Pendingon", 3: "Pendingon",
4: "Pendingon", 4: "Pendingon",
5: "Await", 5: "Await",
6: "ERROR", 6: "ERROR",
7: "ERROR", 7: "ERROR",
} }
} }
}) })
</script> </script>
<script type="text/javascript"> <script type="text/javascript">
require(['mui', 'app', 'Vue', 'walletApi', 'langues', 'muiPullToRefresh', 'muiPullToRefreshMaterial'], function(mui, app, Vue, walletApi, langues) { require(['mui', 'app', 'Vue', 'walletApi', 'langues', 'muiPullToRefresh', 'muiPullToRefreshMaterial'], function(mui, app, Vue, walletApi, langues) {
var langue = langues[app.getLanguageLocalStorage()]; var langue = langues[app.getLanguageLocalStorage()];
var dataInfo = new Vue({ var dataInfo = new Vue({
el: "#js-data-info", el: "#js-data-info",
data: { data: {
langue: langue, langue: langue,
coin: {}, // 币种信息 coin: {}, // 币种信息
coinRecord: [], // 币种记录 coinRecord: [], // 币种记录
marketData: {}, // 行情数据 marketData: {}, // 行情数据
valuation: { valuation: {
countCoin: "0.000000", // 估值 countCoin: "0.000000", // 估值
countAmount: "0.000000", //估值多少币种 countAmount: "0.000000", //估值多少币种
moneyKey: app.getExchangeRateLocalStorage() moneyKey: app.getExchangeRateLocalStorage()
} }
}, },
filters: { filters: {
filtAmount: function(amount) { filtAmount: function(amount) {
return app.formatValue(amount); return app.formatValue(amount);
}, },
filtDate: function(date) { filtDate: function(date) {
return date.substring(0, 10); return date.substring(0, 10);
}, },
filtStatus: function(val) { filtStatus: function(val) {
return dataInfo.langue.statusObj[val]; return dataInfo.langue.statusObj[val];
}, },
filetWalletType: function(val) { filetWalletType: function(val) {
if(Object.is("CCT", val)) { if(Object.is("CCT", val)) {
return langue.coinWallet; return langue.coinWallet;
} }
if(Object.is("C2C", val)) { if(Object.is("C2C", val)) {
return langue.currencyWallet; return langue.currencyWallet;
} }
} }
} }
}) })
dataInfo.$nextTick(function() { dataInfo.$nextTick(function() {
mui.plusReady(function() { mui.plusReady(function() {
var currentWin = plus.webview.currentWebview() var currentWin = plus.webview.currentWebview()
dataInfo.coin = currentWin.coin; // 获取币种信息 dataInfo.coin = currentWin.coin; // 获取币种信息
dataInfo.marketData = currentWin.marketData; // 获取行情数据 dataInfo.marketData = currentWin.marketData; // 获取行情数据
valuationFun(dataInfo.marketData); valuationFun(dataInfo.marketData);
var deceleration = mui.os.ios ? 0.003 : 0.0009; // 阻尼系数 var deceleration = mui.os.ios ? 0.003 : 0.0009; // 阻尼系数
mui('.mui-scroll-wrapper').scroll({ mui('.mui-scroll-wrapper').scroll({
bounce: false, bounce: false,
indicators: false, //是否显示滚动条 indicators: false, //是否显示滚动条
deceleration: deceleration deceleration: deceleration
}); });
mui('.mui-content').pullToRefresh({ mui('.mui-content').pullToRefresh({
down: { down: {
callback: function() { callback: function() {
var self = this; var self = this;
record(); record();
walletApi.getWallet({ walletApi.getWallet({
walletType: dataInfo.coin.walletType, walletType: dataInfo.coin.walletType,
moduleType: dataInfo.coin.moduleType, moduleType: dataInfo.coin.moduleType,
tokenAddr: dataInfo.coin.tokenAddr tokenAddr: dataInfo.coin.tokenAddr
}, },
function(data) { function(data) {
dataInfo.coin = data; dataInfo.coin = data;
valuationFun(dataInfo.marketData); valuationFun(dataInfo.marketData);
}) })
setTimeout(function() { setTimeout(function() {
// 关闭下拉加载圈 // 关闭下拉加载圈
self.endPullDownToRefresh(); self.endPullDownToRefresh();
}, 2000); }, 2000);
} }
} }
}); });
record(); record();
function record() { function record() {
walletApi.getWalletRecord({ walletApi.getWalletRecord({
walletType: dataInfo.coin.walletType, walletType: dataInfo.coin.walletType,
moduleType: dataInfo.coin.moduleType, moduleType: dataInfo.coin.moduleType,
tokenAddr: dataInfo.coin.tokenAddr, tokenAddr: dataInfo.coin.tokenAddr,
pageNum: 0, pageNum: 0,
pageSize: 9999 pageSize: 9999
}, },
function(data) { function(data) {
dataInfo.coinRecord = data; dataInfo.coinRecord = data;
}); });
} }
// 记录页面监听 function recharge() {
mui(".transaction-data-record").on("tap", "li", function() { walletApi.getRecharge({
var index = this.getAttribute('data-index'); walletType: dataInfo.coin.walletType,
app.openWin('recharge_record.html', 'recharge_record.html', {}, { moduleType: dataInfo.coin.moduleType,
coinRecord: dataInfo.coinRecord[index], addr: dataInfo.coin.addr
addr: dataInfo.coin.addr || "" },
}); function(data) {
}); app.toast(data.msg)
// 提币划转事件 console.log(data.msg)
document.getElementById('btn-transfer').addEventListener('tap', function() { });
// if(dataInfo.coin.tokenSymbol == 'PC') {
// mui.toast("敬请期待"); }
// } else {
app.openWin('extract_coin_to_token.html', 'extract_coin_to_token.html', '', { // 记录页面监听
index: dataInfo.coin.coinIndex, mui(".transaction-data-record").on("tap", "li", function() {
coin: dataInfo.coin var index = this.getAttribute('data-index');
}); app.openWin('recharge_record.html', 'recharge_record.html', {}, {
// } coinRecord: dataInfo.coinRecord[index],
addr: dataInfo.coin.addr || ""
}); });
});
// 提币点击事件 // 提币划转事件
// document.getElementById('btn-withdraw').addEventListener('tap', function() { document.getElementById('btn-transfer').addEventListener('tap', function() {
// app.openWin('withdraw.html', 'withdraw.html', '', { app.openWin('extract_coin_to_token.html', 'extract_coin_to_token.html', '', {
// index: dataInfo.coin.coinIndex, index: dataInfo.coin.coinIndex,
// coin: dataInfo.coin coin: dataInfo.coin
// }); });
//
// }); });
// 充值点击事件
document.getElementById('btn-recharge').addEventListener('tap', function() { // 提币点击事件
// if(dataInfo.coin.tokenSymbol == 'PC') { document.getElementById('btn-withdraw').addEventListener('tap', function() {
// mui.toast("敬请期待"); app.openWin('withdraw.html', 'withdraw.html', '', {
// } else { index: dataInfo.coin.coinIndex,
app.openWin('recharge.html', 'recharge.html', '', { coin: dataInfo.coin
index: dataInfo.coin.coinIndex, });
coin: dataInfo.coin
}); });
// } // 充值点击事件
}); document.getElementById('btn-recharge').addEventListener('tap', function() {
// 国际化统一方法 console.log()
window.addEventListener('switchLangueData', function(e) { console.log(JSON.stringify(dataInfo.coin));
dataInfo.langue = langues[e.detail]; recharge();
}); // app.openWin('recharge.html', 'recharge.html', '', {
// index: dataInfo.coin.coinIndex,
// 钱包数据更新的监听 // coin: dataInfo.coin
window.addEventListener('walletSaveEvent', function(e) { // });
console.log(11); });
record(); // 国际化统一方法
walletApi.getWallet({ window.addEventListener('switchLangueData', function(e) {
walletType: dataInfo.coin.walletType, dataInfo.langue = langues[e.detail];
moduleType: dataInfo.coin.moduleType, });
tokenAddr: dataInfo.coin.tokenAddr
}, // 钱包数据更新的监听
function(data) { window.addEventListener('walletSaveEvent', function(e) {
dataInfo.coin = data; console.log(11);
valuationFun(dataInfo.marketData); record();
}) walletApi.getWallet({
}); walletType: dataInfo.coin.walletType,
}) moduleType: dataInfo.coin.moduleType,
tokenAddr: dataInfo.coin.tokenAddr
/** },
* 估值方法 function(data) {
* @param {Object} data 行情数据 dataInfo.coin = data;
*/ valuationFun(dataInfo.marketData);
function valuationFun(data) { })
if(data == null) return; });
var coinKey = data.baseCoin; // 当前兑换币种 })
var money = app.getExchangeRateLocalStorage();
var moneyKey = app.getExchangeRateLocalStorage().toLowerCase() + "Amount"; // 获取系统币种Key值; /**
var coinName = dataInfo.coin.tokenSymbol; * 估值方法
var countCoin = 0; * @param {Object} data 行情数据
var countAmount = 0; */
var moneyExchange = 0; // 汇率 function valuationFun(data) {
moneyExchange = parseFloat(data.marketObj[moneyKey]); if(data == null) return;
countCoin += parseFloat(dataInfo.coin.balance) * parseFloat(data.marketObj.amount); var coinKey = data.baseCoin; // 当前兑换币种
countAmount = app.formatValue(parseFloat(countCoin) * moneyExchange); var money = app.getExchangeRateLocalStorage();
dataInfo.valuation.countAmount = app.formatValue(countAmount); var moneyKey = app.getExchangeRateLocalStorage().toLowerCase() + "Amount"; // 获取系统币种Key值;
dataInfo.valuation.countCoin = app.formatValue(countCoin); var coinName = dataInfo.coin.tokenSymbol;
dataInfo.valuation.moneyKey = app.getExchangeRateLocalStorage(); var countCoin = 0;
} var countAmount = 0;
}) var moneyExchange = 0; // 汇率
moneyExchange = parseFloat(data.marketObj[moneyKey]);
}) countCoin += parseFloat(dataInfo.coin.balance) * parseFloat(data.marketObj.amount);
</script> countAmount = app.formatValue(parseFloat(countCoin) * moneyExchange);
dataInfo.valuation.countAmount = app.formatValue(countAmount);
dataInfo.valuation.countCoin = app.formatValue(countCoin);
dataInfo.valuation.moneyKey = app.getExchangeRateLocalStorage();
}
})
})
</script>
</html> </html>

@ -1,310 +1,313 @@
<!doctype html> <!doctype html>
<html> <html>
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>钱包</title> <title>钱包</title>
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no,viewport-fit=cover"> <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no,viewport-fit=cover">
<link href="../../../lib/css/mui.min.css" rel="stylesheet" /> <link href="../../../lib/css/mui.min.css" rel="stylesheet" />
<!--引入公共样式--> <!--引入公共样式-->
<link href="../../../lib/css/basic.css" rel="stylesheet" /> <link href="../../../lib/css/basic.css" rel="stylesheet" />
<link href="../../../lib/css/swiper.min.css" rel="stylesheet" /> <link href="../../../lib/css/swiper.min.css" rel="stylesheet" />
<link href="../css/wallet.css" rel="stylesheet" /> <link href="../css/wallet.css" rel="stylesheet" />
<script type="text/javascript" src="../../../lib/js/vue.min.js"></script> <script type="text/javascript" src="../../../lib/js/vue.min.js"></script>
<script src="../../../lib/js/rem-layout.js"></script> <script src="../../../lib/js/rem-layout.js"></script>
<script type="text/javascript" src="../../../lib/js/mui.min.js"></script> <script type="text/javascript" src="../../../lib/js/mui.min.js"></script>
<script type="text/javascript" src="../../../lib/js/app.js"></script> <script type="text/javascript" src="../../../lib/js/app.js"></script>
<script src="../../../lib/js/require2.1.11.js"></script> <script src="../../../lib/js/require2.1.11.js"></script>
<script type="text/javascript" src="../js/base.config.js"></script> <script type="text/javascript" src="../js/base.config.js"></script>
</head> </head>
<style> <style>
[v-cloak] { [v-cloak] {
display: none; display: none;
} }
</style> </style>
<body> <body>
<div id="js-data-info" v-cloak> <div id="js-data-info" v-cloak>
<header class="mui-bar mui-bar-nav"> <header class="mui-bar mui-bar-nav">
<h1 class="mui-title">{{langue.title}}</h1> <h1 class="mui-title">{{langue.title}}</h1>
</header> </header>
<div class="mui-content"> <div class="mui-content">
<div class="swiper-container"> <div class="swiper-container">
<div class="swiper-wrapper"> <div class="swiper-wrapper">
<div class="swiper-slide" v-for="(row,index) in wallets" :id="'item' + index"> <div class="swiper-slide" v-for="(row,index) in wallets" :id="'item' + index">
<div class="top-bg"> <div class="top-bg">
<div class="valuation"> <div class="valuation">
<div class="account">{{row | filetWalletType}}</div> <div class="account">{{row | filetWalletType}}</div>
<span class="valuation-txt">{{langue.valuation}}({{valuation[row].baseCoin}})</span> <span class="valuation-txt">{{langue.valuation}}({{valuation[row].baseCoin}})</span>
<span class="valuation-price">{{valuation[row].countCoin}}</span> <span class="valuation-price">{{valuation[row].countCoin}}</span>
<span class="valuation-rate">≈{{valuation[row].countAmount}} {{valuation[row].moneyKey}}</span> <span class="valuation-rate">≈{{valuation[row].countAmount}} {{valuation[row].moneyKey}}</span>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="coin"> <div class="coin">
<ul class="coin-ul"> <ul class="coin-ul">
<!--币币账户--> <!--币币账户-->
<li class="coin-item-list" v-for="(coin,index) in coins[wallets[0]]" v-if="coinStatus" :data-index="index" :data-type="wallets[0]"> <li class="coin-item-list" v-for="(coin,index) in coins[wallets[0]]" v-if="coinStatus && coin.tokenSymbol != 'PC'" :data-index="index" :data-type="wallets[0]">
<div class="coin-kind"> <div class="coin-kind" >
<div class="coin-kind-img"><img :src="coin.src" /></div> <div class="coin-kind-img"><img :src="coin.src" /></div>
<span class="coin-kind-txt">{{coin.tokenSymbol}}</span> <span class="coin-kind-txt">{{coin.tokenSymbol}}</span>
</div> </div>
<div class="coin-situation"> <div class="coin-situation">
<span class="coin-remain">{{langue.free}}:{{coin.freeBalance}}</span> <span class="coin-remain">{{langue.free}}:{{coin.freeBalance}}</span>
<span class="coin-reeze">{{langue.freeze}}:{{coin.freezeBalance}}</span> <span class="coin-reeze">{{langue.freeze}}:{{coin.freezeBalance}}</span>
</div> </div>
</li> </li>
<!--法币账户--> <!--法币账户-->
<li class="coin-item-list" v-for="(coin,index) in coins[wallets[1]]" v-if="!coinStatus" :data-index="index" :data-type="wallets[1]"> <li class="coin-item-list" v-for="(coin,index) in coins[wallets[1]]" v-if="!coinStatus && coin.tokenSymbol != 'PC'" :data-index="index" :data-type="wallets[1]">
<div class="coin-kind"> <div class="coin-kind">
<div class="coin-kind-img"><img :src="coin.src" /></div> <div class="coin-kind-img"><img :src="coin.src" /></div>
<span class="coin-kind-txt">{{coin.tokenSymbol}}</span> <span class="coin-kind-txt">{{coin.tokenSymbol}}</span>
</div> </div>
<div class="coin-situation"> <div class="coin-situation">
<span class="coin-remain">{{langue.free}}:{{coin.freeBalance}}</span> <span class="coin-remain">{{langue.free}}:{{coin.freeBalance}}</span>
<span class="coin-reeze">{{langue.freeze}}:{{coin.freezeBalance}}</span> <span class="coin-reeze">{{langue.freeze}}:{{coin.freezeBalance}}</span>
</div> </div>
</li> </li>
</ul> </ul>
</div> </div>
</div> </div>
</div> </div>
</body> </body>
<script type="text/javascript"> <script type="text/javascript">
define('langues', { define('langues', {
zh_CN: { zh_CN: {
title: "钱包", title: "钱包",
valuation: "估值", valuation: "估值",
addCredit: "充值", addCredit: "充值",
withdrawCoin: "提现", withdrawCoin: "提现",
free: "可用", free: "可用",
freeze: "冻结", freeze: "冻结",
walletTypeC2C: "法币交易", walletTypeC2C: "法币交易",
walletTypeCCT: "币币交易", walletTypeCCT: "币币交易",
coinWallet: "币币钱包", coinWallet: "币币钱包",
currencyWallet: "法币钱包" currencyWallet: "法币钱包"
}, },
zh_HK: { zh_HK: {
title: "錢包", title: "錢包",
valuation: "估值", valuation: "估值",
addCredit: "充值", addCredit: "充值",
withdrawCoin: "提現", withdrawCoin: "提現",
free: "可用", free: "可用",
freeze: "凍結", freeze: "凍結",
coinWallet: "幣幣錢包", coinWallet: "幣幣錢包",
currencyWallet: "法幣錢包", currencyWallet: "法幣錢包",
}, },
en_US: { en_US: {
title: "Wallet", title: "Wallet",
valuation: "Valuation", valuation: "Valuation",
addCredit: "Recharge", addCredit: "Recharge",
withdrawCoin: "Withdraw", withdrawCoin: "Withdraw",
free: "Free", free: "Free",
freeze: "Freeze", freeze: "Freeze",
coinWallet: "CCT", coinWallet: "CCT",
currencyWallet: "OTC" currencyWallet: "OTC"
} }
}) })
</script> </script>
<script type="text/javascript"> <script type="text/javascript">
mui.init({ mui.init({
swipeBack: false swipeBack: false
}); });
var dataInfo = new Vue({ var dataInfo = new Vue({
el: "#js-data-info", el: "#js-data-info",
data: { data: {
langue: {}, langue: {},
wallets: ["CCT", "C2C"], wallets: ["CCT", "C2C"],
currentWallets: "CCT", currentWallets: "CCT",
coinStatus: true, //切换账户的状态 coinStatus: true, //切换账户的状态
coins: { coins: {
CCT: app.getCoinWalletInfoLocalStorage(), CCT: app.getCoinWalletInfoLocalStorage(),
C2C: app.getC2CCoinWalletInfoLocalStorage() C2C: app.getC2CCoinWalletInfoLocalStorage()
}, },
valuation: { valuation: {
CCT: { CCT: {
countCoin: "0.00000000", // 估值 countCoin: "0.00000000", // 估值
countAmount: "0.00", //估值多少币种 countAmount: "0.00", //估值多少币种
moneyKey: app.getExchangeRateLocalStorage(), moneyKey: app.getExchangeRateLocalStorage(),
baseCoin: "USDT" baseCoin: "USDT"
}, },
C2C: { C2C: {
countCoin: "0.00000000", // 估值 countCoin: "0.00000000", // 估值
countAmount: "0.00", //估值多少币种 countAmount: "0.00", //估值多少币种
moneyKey: app.getExchangeRateLocalStorage(), moneyKey: app.getExchangeRateLocalStorage(),
baseCoin: "USDT" baseCoin: "USDT"
} }
}, },
marketData: {}, marketData: {},
marketList: {} marketList: {}
}, },
filters: { filters: {
filetWalletType:function(val) { filetWalletType:function(val) {
if(Object.is("CCT", val)) { if(Object.is("CCT", val)) {
return dataInfo.langue.coinWallet; return dataInfo.langue.coinWallet;
} }
if(Object.is("C2C", val)) { if(Object.is("C2C", val)) {
return dataInfo.langue.currencyWallet; return dataInfo.langue.currencyWallet;
} }
} }
} }
}) })
require(['walletApi', 'langues', 'Swiper', 'muiPullToRefresh', 'muiPullToRefreshMaterial'], function(walletApi, langues, Swiper) { require(['walletApi', 'langues', 'Swiper', 'muiPullToRefresh', 'muiPullToRefreshMaterial'], function(walletApi, langues, Swiper) {
dataInfo.langue = langues[app.getLanguageLocalStorage()]; dataInfo.langue = langues[app.getLanguageLocalStorage()];
dataInfo.$nextTick(function() { dataInfo.$nextTick(function() {
mui.init(); mui.init();
var swiper = new Swiper('.swiper-container', { var swiper = new Swiper('.swiper-container', {
grabCursor: true, grabCursor: true,
centeredSlides: true, centeredSlides: true,
slidesPerView: 'auto', slidesPerView: 'auto',
on: { on: {
transitionEnd: function() { transitionEnd: function() {
//根据切换卡片的activeIndex索引来显示不同账户的币种 //根据切换卡片的activeIndex索引来显示不同账户的币种
if(this.activeIndex === 0) { if(this.activeIndex === 0) {
dataInfo.coinStatus = true; dataInfo.coinStatus = true;
} else { } else {
dataInfo.coinStatus = false; dataInfo.coinStatus = false;
} }
} }
}, },
}); });
var deceleration = mui.os.ios ? 0.003 : 0.0009; // 阻尼系数 var deceleration = mui.os.ios ? 0.003 : 0.0009; // 阻尼系数
mui('.mui-scroll-wrapper').scroll({ mui('.mui-scroll-wrapper').scroll({
bounce: false, bounce: false,
indicators: true, //是否显示滚动条 indicators: true, //是否显示滚动条
deceleration: deceleration deceleration: deceleration
}); });
mui('.mui-content').pullToRefresh({ mui('.mui-content').pullToRefresh({
down: { down: {
callback: function() { callback: function() {
var self = this; var self = this;
walletApi.voidServieWalletPass(); walletApi.voidServieWalletPass();
// 发送用户信息查询请求 // 发送用户信息查询请求
saveWallet(); saveWallet();
setTimeout(function() { setTimeout(function() {
// 关闭下拉加载圈 // 关闭下拉加载圈
self.endPullDownToRefresh(); self.endPullDownToRefresh();
}, 3000); }, 3000);
} }
} }
}); });
//代币资产页面监听 //代币资产页面监听
mui(".coin-ul").on("tap", "li", function() { mui(".coin-ul").on("tap", "li", function() {
var index = this.getAttribute('data-index'); var index = this.getAttribute('data-index');
var type = this.getAttribute('data-type'); var type = this.getAttribute('data-type');
app.openWin('assets.html', 'assets.html', {}, { app.openWin('assets.html', 'assets.html', {}, {
coin: dataInfo.coins[type][index], coin: dataInfo.coins[type][index],
type: type type: type
}); });
}); });
saveWallet(); saveWallet();
function saveWallet() { function saveWallet() {
walletApi.getCCTWallets(function(data) { walletApi.getCCTWallets(function(data) {
dataInfo.coins.CCT = data; console.log(data);
coinsEvenPush(data); dataInfo.coins.CCT = data;
valuationFun(dataInfo.marketList, walletApi.walletType.CCT); coinsEvenPush(data);
}) valuationFun(dataInfo.marketList, walletApi.walletType.CCT);
walletApi.getC2CWallets(function(data) { })
dataInfo.coins.C2C = data; walletApi.getC2CWallets(function(data) {
valuationFun(dataInfo.marketList, walletApi.walletType.C2C); console.log(data);
})
} dataInfo.coins.C2C = data;
walletApi.voidServieWalletPass(); valuationFun(dataInfo.marketList, walletApi.walletType.C2C);
// 国际化统一方法 })
window.addEventListener('switchLangueData', function(e) { }
dataInfo.langue = langues[e.detail]; walletApi.voidServieWalletPass();
}); // 国际化统一方法
/** window.addEventListener('switchLangueData', function(e) {
* 监听获取行情列表 dataInfo.langue = langues[e.detail];
*/ });
window.addEventListener("marketList", function(event) { /**
var marketList = event.detail; * 监听获取行情列表
valuationFun(marketList, walletApi.walletType.CCT); */
valuationFun(marketList, walletApi.walletType.C2C); window.addEventListener("marketList", function(event) {
}); var marketList = event.detail;
valuationFun(marketList, walletApi.walletType.CCT);
// 钱包数据更新的监听 valuationFun(marketList, walletApi.walletType.C2C);
window.addEventListener('walletSaveEvent', function(e) { });
walletApi.voidServieWalletPass();
walletApi.getCCTWallets(function(data) { // 钱包数据更新的监听
dataInfo.coins.CCT = data; window.addEventListener('walletSaveEvent', function(e) {
coinsEvenPush(data); walletApi.voidServieWalletPass();
valuationFun(dataInfo.marketList, walletApi.walletType.CCT); walletApi.getCCTWallets(function(data) {
}) dataInfo.coins.CCT = data;
walletApi.getC2CWallets(function(data) { coinsEvenPush(data);
dataInfo.coins.C2C = data; valuationFun(dataInfo.marketList, walletApi.walletType.CCT);
otcCoinsEvenPush(data); })
valuationFun(dataInfo.marketList, walletApi.walletType.C2C); walletApi.getC2CWallets(function(data) {
}) dataInfo.coins.C2C = data;
}); otcCoinsEvenPush(data);
valuationFun(dataInfo.marketList, walletApi.walletType.C2C);
function valuationFun(data, type) { })
if(data == null) return; });
var coinKey = dataInfo.valuation[type].baseCoin; // 当前兑换币种
var money = app.getExchangeRateLocalStorage(); function valuationFun(data, type) {
var moneyKey = app.getExchangeRateLocalStorage().toLowerCase() + "Amount"; // 获取系统币种Key值; if(data == null) return;
var marketData = data[coinKey]; // 获取行情数据 var coinKey = dataInfo.valuation[type].baseCoin; // 当前兑换币种
if(marketData == null) return; var money = app.getExchangeRateLocalStorage();
var coins = dataInfo.coins[type]; var moneyKey = app.getExchangeRateLocalStorage().toLowerCase() + "Amount"; // 获取系统币种Key值;
var countCoin = 0; var marketData = data[coinKey]; // 获取行情数据
var countAmount = 0; if(marketData == null) return;
var moneyExchange = 0; // 汇率 var coins = dataInfo.coins[type];
var isMoneyV = true; var countCoin = 0;
for(var i = 0; i < coins.length; i++) { var countAmount = 0;
var coinName = coins[i].tokenSymbol; var moneyExchange = 0; // 汇率
if(coinName in marketData) { var isMoneyV = true;
if(isMoneyV) { for(var i = 0; i < coins.length; i++) {
marketData[coinKey] = {}; var coinName = coins[i].tokenSymbol;
marketData[coinKey].basecoin = marketData[coinName].basecoin; if(coinName in marketData) {
marketData[coinKey].marketObj = JSON.parse(JSON.stringify(marketData[coinName].marketObj)); if(isMoneyV) {
marketData[coinKey].marketObj.amount = 1; marketData[coinKey] = {};
moneyExchange = parseFloat(marketData[coinName].marketObj[moneyKey]); marketData[coinKey].basecoin = marketData[coinName].basecoin;
isMoneyV = false; marketData[coinKey].marketObj = JSON.parse(JSON.stringify(marketData[coinName].marketObj));
} marketData[coinKey].marketObj.amount = 1;
countCoin += parseFloat(coins[i].balance) * parseFloat(marketData[coinName].marketObj.amount); moneyExchange = parseFloat(marketData[coinName].marketObj[moneyKey]);
} else if(coinKey == coinName) { isMoneyV = false;
countCoin += parseFloat(coins[i].balance); }
} countCoin += parseFloat(coins[i].balance) * parseFloat(marketData[coinName].marketObj.amount);
} } else if(coinKey == coinName) {
countAmount = app.formatValue(parseFloat(countCoin) * moneyExchange); countCoin += parseFloat(coins[i].balance);
dataInfo.valuation[type].countAmount = countAmount; }
dataInfo.valuation[type].countCoin = app.formatValue(countCoin); }
dataInfo.valuation[type].moneyKey = app.getExchangeRateLocalStorage(); countAmount = app.formatValue(parseFloat(countCoin) * moneyExchange);
dataInfo.marketData = marketData; dataInfo.valuation[type].countAmount = countAmount;
dataInfo.marketList = data; dataInfo.valuation[type].countCoin = app.formatValue(countCoin);
} dataInfo.valuation[type].moneyKey = app.getExchangeRateLocalStorage();
/** dataInfo.marketData = marketData;
* 币币币种信息推送 dataInfo.marketList = data;
* @param {Array} coins }
*/ /**
function coinsEvenPush(coins) { * 币币币种信息推送
if(coins == null || coins.length == 0) return; * @param {Array} coins
var coinMap = {}; */
for(var i = 0; i < coins.length; i++) { function coinsEvenPush(coins) {
coinMap[coins[i].tokenSymbol] = coins[i]; if(coins == null || coins.length == 0) return;
} var coinMap = {};
mui.fire(plus.webview.getWebviewById("html/cct/html/cct_index.html"), "saveCoinsEven", coinMap); for(var i = 0; i < coins.length; i++) {
} coinMap[coins[i].tokenSymbol] = coins[i];
/** }
* 法币币种信息推送 mui.fire(plus.webview.getWebviewById("html/cct/html/cct_index.html"), "saveCoinsEven", coinMap);
* @param {Array} coins }
*/ /**
function otcCoinsEvenPush(coins) { * 法币币种信息推送
if(coins == null || coins.length == 0) return; * @param {Array} coins
var coinMap = {}; */
for(var i = 0; i < coins.length; i++) { function otcCoinsEvenPush(coins) {
coinMap[coins[i].tokenSymbol] = coins[i]; if(coins == null || coins.length == 0) return;
} var coinMap = {};
mui.fire(plus.webview.getWebviewById("merchant.html"), "saveCoinsEven", coinMap); for(var i = 0; i < coins.length; i++) {
} coinMap[coins[i].tokenSymbol] = coins[i];
}) }
}) mui.fire(plus.webview.getWebviewById("merchant.html"), "saveCoinsEven", coinMap);
</script> }
})
})
</script>
</html> </html>

@ -1,431 +1,467 @@
/** /**
* @NAME YH * @NAME YH
* @DATE 2019年2月24日10:41:28 * @DATE 2019年2月24日10:41:28
* @INFO 钱包接口JS * @INFO 钱包接口JS
*/ */
define(['mui', 'app', 'ajaxUtil', 'jsencrypt'], function(mui, app, ajaxUtil, jsencrypt) { define(['mui', 'app', 'ajaxUtil', 'jsencrypt'], function(mui, app, ajaxUtil, jsencrypt) {
var ethUrl = app.ethBaseUrl; // ETH模块请求连接 var ethUrl = app.ethBaseUrl; // ETH模块请求连接
var btcUrl = app.btcBaseUrl; // BTC模块请求连接 var btcUrl = app.btcBaseUrl; // BTC模块请求连接
var eosUrl = app.eosBaseUrl; // EOS模块请求连接 var eosUrl = app.eosBaseUrl; // EOS模块请求连接
var userUrl = app.walletBaseUrl; // 用户模块 var userUrl = app.walletBaseUrl; // 用户模块
// 请求方式 // 请求方式
var type = { var type = {
GET: "GET", GET: "GET",
POST: "POST" POST: "POST"
} }
// 钱包类型 // 钱包类型
var walletType = { var walletType = {
CCT: "CCT", CCT: "CCT",
C2C: "C2C" C2C: "C2C"
} }
// 钱包公用API // 钱包公用API
var baseApi = { var baseApi = {
// 获取公钥请求信息 // 获取公钥请求信息
AJAX_PULICKEY: { AJAX_PULICKEY: {
getUrl: ethUrl + "wallet/getPublicKey", getUrl: ethUrl + "wallet/getPublicKey",
getType: type.GET getType: type.GET
}, },
// 修改钱包资金密码接口 // 修改钱包资金密码接口
AJAX_SAVEPASS: { AJAX_SAVEPASS: {
getUrl: ethUrl + "wallet/saveWalletPass", getUrl: ethUrl + "wallet/saveWalletPass",
getType: type.POST getType: type.POST
}, },
// 查询是否绑定资金密码 // 查询是否绑定资金密码
AJAX_WALLETPASS: { AJAX_WALLETPASS: {
getUrl: ethUrl + "wallet/existsPass", getUrl: ethUrl + "wallet/existsPass",
getType: type.GET getType: type.GET
}, },
// 获取修改资金密码的验证码 // 获取修改资金密码的验证码
AJAX_SENDCODE: { AJAX_SENDCODE: {
getUrl: userUrl + "user/sendMoneyPasswordSmsg", getUrl: userUrl + "user/sendMoneyPasswordSmsg",
getType: type.GET getType: type.GET
} }
} }
// 钱包API // 钱包API
var walletApi = { var walletApi = {
eth: { eth: {
//请求所有钱包信息 //请求充值金額
WALLET_INFOS: { WALLET_RECHARGE: {
getUrl: ethUrl + "wallet/getWallets", getUrl: ethUrl + "wallet/resetWallet",
getType: type.GET getType: type.POST
}, },
//请求某种钱包币种信息 //请求所有钱包信息
WALLET_INFO: { WALLET_INFOS: {
getUrl: ethUrl + "wallet/getWallet", getUrl: ethUrl + "wallet/getWallets",
getType: type.GET getType: type.GET
}, },
// 获取币种财务记录记录 //请求某种钱包币种信息
WALLET_RECORD: { WALLET_INFO: {
getUrl: ethUrl + "walletTransfer/getTransfer", getUrl: ethUrl + "wallet/getWallet",
getType: type.GET getType: type.GET
}, },
// 提现申请 // 获取币种财务记录记录
WALLET_WITHDRAWDEPOSIT: { WALLET_RECORD: {
getUrl: ethUrl + "wallet/withdrawDeposit", getUrl: ethUrl + "walletTransfer/getTransfer",
getType: type.POST getType: type.GET
}, },
// 划转 // 提现申请
WALLET_HANDLETRANSFER: { WALLET_WITHDRAWDEPOSIT: {
getUrl: ethUrl + "wallet/transfer", getUrl: ethUrl + "wallet/withdrawDeposit",
getType: type.POST getType: type.POST
}, },
// 提现申请手续费信息 // 划转
WALLET_WITHDRAW_GAS: { WALLET_HANDLETRANSFER: {
getUrl: ethUrl + "walletParam/getGasConfig", getUrl: ethUrl + "wallet/transfer",
getType: type.GET getType: type.POST
}, },
// 提现申请手续费信息
}, WALLET_WITHDRAW_GAS: {
btc: { getUrl: ethUrl + "walletParam/getGasConfig",
//请求所有钱包信息 getType: type.GET
WALLET_INFOS: { },
getUrl: btcUrl + "wallet/getWallets",
getType: type.GET },
}, btc: {
//请求某种钱包币种信息 //请求充值金額
WALLET_INFO: { WALLET_RECHARGE: {
getUrl: btcUrl + "wallet/getWallet", getUrl: btcUrl + "wallet/resetWallet",
getType: type.GET getType: type.POST
}, },
// 获取币种财务记录记录 //请求所有钱包信息
WALLET_RECORD: { WALLET_INFOS: {
getUrl: btcUrl + "walletTransfer/getTransfer", getUrl: btcUrl + "wallet/getWallets",
getType: type.GET getType: type.GET
}, },
// 提现申请 //请求某种钱包币种信息
WALLET_WITHDRAWDEPOSIT: { WALLET_INFO: {
getUrl: btcUrl + "walletTransfer/withdraw", getUrl: btcUrl + "wallet/getWallet",
getType: type.POST getType: type.GET
}, },
// 划转 // 获取币种财务记录记录
WALLET_HANDLETRANSFER: { WALLET_RECORD: {
getUrl: btcUrl + "wallet/transfer", getUrl: btcUrl + "walletTransfer/getTransfer",
getType: type.POST getType: type.GET
}, },
// 提现申请手续费信息 // 提现申请
WALLET_WITHDRAW_GAS: { WALLET_WITHDRAWDEPOSIT: {
getUrl: btcUrl + "walletParam/getGasConfig", getUrl: btcUrl + "walletTransfer/withdraw",
getType: type.GET getType: type.POST
}, },
// 划转
}, WALLET_HANDLETRANSFER: {
eos: { getUrl: btcUrl + "wallet/transfer",
//请求所有钱包信息 getType: type.POST
WALLET_INFOS: { },
getUrl: eosUrl + "wallet/selectWalletByWalletType", // 提现申请手续费信息
getType: type.GET WALLET_WITHDRAW_GAS: {
}, getUrl: btcUrl + "walletParam/getGasConfig",
//请求某种钱包币种信息 getType: type.GET
WALLET_INFO: { },
getUrl: eosUrl + "wallet/selectWalletByTokenName",
getType: type.GET },
}, eos: {
// 获取币种财务记录记录 //请求充值金額
WALLET_RECORD: { WALLET_RECHARGE: {
getUrl: eosUrl + "walletTransfer/getTransfer", getUrl: btcUrl + "wallet/resetWallet",
getType: type.GET getType: type.POST
}, },
// 获取EOS充值账号 //请求所有钱包信息
WALLET_IN_USERNAME: { WALLET_INFOS: {
getUrl: eosUrl + "walletIn/listWalletInAccount", getUrl: eosUrl + "wallet/selectWalletByWalletType",
getType: type.POST getType: type.GET
}, },
// 提现申请 //请求某种钱包币种信息
WALLET_WITHDRAWDEPOSIT: { WALLET_INFO: {
getUrl: eosUrl + "wallet/withdrawDeposit", getUrl: eosUrl + "wallet/selectWalletByTokenName",
getType: type.POST getType: type.GET
}, },
// 划转 // 获取币种财务记录记录
WALLET_HANDLETRANSFER: { WALLET_RECORD: {
getUrl: eosUrl + "wallet/transfer", getUrl: eosUrl + "walletTransfer/getTransfer",
getType: type.POST getType: type.GET
}, },
// 提现申请手续费信息 // 获取EOS充值账号
WALLET_WITHDRAW_GAS: { WALLET_IN_USERNAME: {
getUrl: eosUrl + "configWalletParam/selectConfigWalletParam", getUrl: eosUrl + "walletIn/listWalletInAccount",
getType: type.GET getType: type.POST
}, },
}, // 提现申请
} WALLET_WITHDRAWDEPOSIT: {
/** getUrl: eosUrl + "wallet/withdrawDeposit",
* 设置多个币种属于什么模块 getType: type.POST
* @param {Object} type },
* @param {Object} coins // 划转
*/ WALLET_HANDLETRANSFER: {
function moduleTypes(type, coins) { getUrl: eosUrl + "wallet/transfer",
coins || (coins = []); getType: type.POST
for(var i = 0; i < coins.length; i++) { },
moduleType(type, coins[i]); // 提现申请手续费信息
} WALLET_WITHDRAW_GAS: {
return coins; getUrl: eosUrl + "configWalletParam/selectConfigWalletParam",
} getType: type.GET
/** },
* 设置币种属于什么模块 },
* @param {Object} type }
* @param {Object} coins /**
*/ * 设置多个币种属于什么模块
function moduleType(type, coin) { * @param {Object} type
coin.moduleType = type; * @param {Object} coins
coin.balance = app.formatValue(coin.balance); */
coin.freeBalance = app.formatValue(coin.freeBalance); function moduleTypes(type, coins) {
coin.freezeBalance = app.formatValue(coin.freezeBalance); coins || (coins = []);
coin.src = '../img/coin/' + coin.tokenSymbol + '.png'; for(var i = 0; i < coins.length; i++) {
if('tokenId' in coin) { moduleType(type, coins[i]);
coin.tokenAddr = coin.tokenId; }
} return coins;
if('tokenName' in coin) { }
coin.tokenAddr = coin.tokenName; /**
} * 设置币种属于什么模块
if(!('addr' in coin)) { * @param {Object} type
coin.addr = ''; * @param {Object} coins
} */
return coin; function moduleType(type, coin) {
} coin.moduleType = type;
coin.balance = app.formatValue(coin.balance);
function baseGetWallet(type, fun) { coin.freeBalance = app.formatValue(coin.freeBalance);
// #请求数据 coin.freezeBalance = app.formatValue(coin.freezeBalance);
var obj = { coin.src = '../img/coin/' + coin.tokenSymbol + '.png';
btc: [], if('tokenId' in coin) {
eth: [], coin.tokenAddr = coin.tokenId;
eos: [] }
}; if('tokenName' in coin) {
var count = 0; coin.tokenAddr = coin.tokenName;
ajaxUtil.send(walletApi.eth.WALLET_INFOS, { }
walletType: type if(!('addr' in coin)) {
}).then(function(data) { coin.addr = '';
obj.eth = moduleTypes('eth', data.data); }
count++; return coin;
}, function() { }
count++;
}); function baseGetWallet(type, fun) {
ajaxUtil.send(walletApi.btc.WALLET_INFOS, { // #请求数据
walletType: type var obj = {
}).then(function(data) { btc: [],
obj.btc = moduleTypes('btc', data.data); eth: [],
count++; eos: []
}, function() { };
count++; var count = 0;
}); ajaxUtil.send(walletApi.eth.WALLET_INFOS, {
// EOS币种信息查询 walletType: type
ajaxUtil.send(walletApi.eos.WALLET_INFOS, { }).then(function(data) {
walletType: type obj.eth = moduleTypes('eth', data.data);
}).then(function(data) { count++;
obj.eos = moduleTypes('eos', data.data); }, function() {
count++; count++;
}, function() { });
count++; ajaxUtil.send(walletApi.btc.WALLET_INFOS, {
}); walletType: type
// #数据同步处理,放进缓存 }).then(function(data) {
var time = 1000; obj.btc = moduleTypes('btc', data.data);
setTimeout(function() { count++;
if(count >= Object.keys(obj).length) { }, function() {
var coins = obj.btc.concat(obj.eth).concat(obj.eos); count++;
for(var j = 0; j < coins.length; j++) { });
coins[j].coinIndex = j; // EOS币种信息查询
} ajaxUtil.send(walletApi.eos.WALLET_INFOS, {
if(Object.is(type, walletType.CCT)) { walletType: type
app.setCoinWalletInfoLocalStorage(coins); }).then(function(data) {
} obj.eos = moduleTypes('eos', data.data);
if(Object.is(type, walletType.C2C)) { count++;
app.setC2CCoinWalletInfoLocalStorage(coins); }, function() {
} count++;
fun(coins); });
} else { // #数据同步处理,放进缓存
setTimeout(arguments.callee, time) var time = 1000;
} setTimeout(function() {
}, time); if(count >= Object.keys(obj).length) {
} var coins = obj.btc.concat(obj.eth).concat(obj.eos);
return { for(var j = 0; j < coins.length; j++) {
SUCCESS_CODE: 200, coins[j].coinIndex = j;
walletType: walletType, }
/** if(Object.is(type, walletType.CCT)) {
* 获取CCT所有币种信息 app.setCoinWalletInfoLocalStorage(coins);
* @param {Function} fun 回调方法 }
*/ if(Object.is(type, walletType.C2C)) {
getCCTWallets: function(fun) { app.setC2CCoinWalletInfoLocalStorage(coins);
baseGetWallet(walletType.CCT, fun) }
}, fun(coins);
/** } else {
* 获取C2C所有币种信息 setTimeout(arguments.callee, time)
* @param {Function} fun 回调方法 }
*/ }, time);
getC2CWallets: function(fun) { }
baseGetWallet(walletType.C2C, fun) return {
}, SUCCESS_CODE: 200,
/** walletType: walletType,
* 获取CCT某种币种信息 /**
* @param {Object} moduleType 所属模块,tokenAddr 币种地址 * 获取CCT所有币种信息
* @param {Function} 回调方法 * @param {Function} fun 回调方法
*/ */
getWallet: function(obj, fun) { getCCTWallets: function(fun) {
console.log(JSON.stringify(obj)); baseGetWallet(walletType.CCT, fun)
var params = { },
eth: { /**
tokenAddr: obj.tokenAddr * 获取C2C所有币种信息
}, * @param {Function} fun 回调方法
eos: { */
tokenName: obj.tokenAddr getC2CWallets: function(fun) {
}, baseGetWallet(walletType.C2C, fun)
btc: { },
tokenId: obj.tokenAddr /**
} * 获取CCT某种币种信息
}; * @param {Object} moduleType 所属模块,tokenAddr 币种地址
params[obj.moduleType].walletType = obj.walletType; * @param {Function} 回调方法
ajaxUtil.send(walletApi[obj.moduleType].WALLET_INFO, params[obj.moduleType]).then(function(data) { */
console.log(JSON.stringify(data)); getWallet: function(obj, fun) {
fun(moduleType(obj.moduleType, data.data)); console.log(JSON.stringify(obj));
}); var params = {
}, eth: {
/** tokenAddr: obj.tokenAddr
* 获取CCT某种币种的财务记录 },
* @param {Object} obj eos: {
* @param {Object} fun tokenName: obj.tokenAddr
*/ },
getWalletRecord: function(obj, fun) { btc: {
var params = { tokenId: obj.tokenAddr
eth: { }
tokenAddr: obj.tokenAddr };
}, params[obj.moduleType].walletType = obj.walletType;
eos: { ajaxUtil.send(walletApi[obj.moduleType].WALLET_INFO, params[obj.moduleType]).then(function(data) {
tokenName: obj.tokenAddr console.log(JSON.stringify(data));
}, fun(moduleType(obj.moduleType, data.data));
btc: { });
tokenId: obj.tokenAddr },
}
}; getRecharge: function(obj, fun) {
params[obj.moduleType].walletType = obj.walletType; console.log(JSON.stringify(obj));
params[obj.moduleType].pageNum = obj.pageNum; var params = {
params[obj.moduleType].pageSize = obj.pageSize; eth: {
ajaxUtil.send(walletApi[obj.moduleType].WALLET_RECORD, params[obj.moduleType]).then(function(data) { addr: obj.addr
fun(data.data); },
}); eos: {
}, addr: obj.addr
},
/** btc: {
* 获取CCTEOS addr: obj.addr
* @param {String} tokenName eos币种名称 }
* @param {Function} fun };
*/ params[obj.moduleType].walletType = obj.walletType;
getCCTEosInUserName: function(obj, fun) { params[obj.moduleType].tokenId = obj.moduleType;
ajaxUtil.send(walletApi.eos.WALLET_IN_USERNAME, obj).then(function(data) { ajaxUtil.send(walletApi[obj.moduleType].WALLET_RECHARGE, params[obj.moduleType]).then(function(data) {
fun(data.data); console.log(JSON.stringify(data));
}); fun(data);
}, });
/** },
* CCT应用钱包的提现申请 /**
* @param {Object} obj * 获取CCT某种币种的财务记录
*/ * @param {Object} obj
withdrawDeposit: function(obj) { * @param {Object} fun
var params = { */
eth: { getWalletRecord: function(obj, fun) {
tokenAddr: obj.tokenAddr var params = {
}, eth: {
eos: { tokenAddr: obj.tokenAddr
tokenName: obj.tokenAddr },
}, eos: {
btc: { tokenName: obj.tokenAddr
tokenId: obj.tokenAddr },
} btc: {
}; tokenId: obj.tokenAddr
params[obj.moduleType].walletType = obj.walletType; }
params[obj.moduleType].amount = obj.amount; // 提现余额 };
params[obj.moduleType].toAddr = obj.toAddr; // 接收地址 params[obj.moduleType].walletType = obj.walletType;
params[obj.moduleType].password = obj.password; // 密码 params[obj.moduleType].pageNum = obj.pageNum;
return ajaxUtil.send(walletApi[obj.moduleType].WALLET_WITHDRAWDEPOSIT, params[obj.moduleType]); params[obj.moduleType].pageSize = obj.pageSize;
}, ajaxUtil.send(walletApi[obj.moduleType].WALLET_RECORD, params[obj.moduleType]).then(function(data) {
fun(data.data);
/** });
* CCT提现手续费详情 },
* @param {String} tokenSymbol 名称
* @param {Function} fun /**
*/ * 获取CCTEOS
getCoinGasInfo: function(obj, fun) { * @param {String} tokenName eos币种名称
ajaxUtil.send(walletApi[obj.moduleType].WALLET_WITHDRAW_GAS, { * @param {Function} fun
tokenSymbol: obj.tokenSymbol */
}).then(function(data) { getCCTEosInUserName: function(obj, fun) {
fun(data.data); ajaxUtil.send(walletApi.eos.WALLET_IN_USERNAME, obj).then(function(data) {
}); fun(data.data);
}, });
/** },
* 加密密码 /**
* @param {String} pass 密码 * CCT应用钱包的提现申请
* @param {Function} fun 回调方法 * @param {Object} obj
*/ */
getPublicKey: function(pass, fun) { withdrawDeposit: function(obj) {
ajaxUtil.send(baseApi.AJAX_PULICKEY).then(function(data) { var params = {
var pulicData = data.data; eth: {
var crypt = new JSEncrypt({ tokenAddr: obj.tokenAddr
default_key_size: 1024 },
}); eos: {
crypt.setPublicKey(pulicData); tokenName: obj.tokenAddr
fun(crypt.encrypt(pass)); },
}); btc: {
}, tokenId: obj.tokenAddr
/** }
* 更新钱包密码 };
* @param {Object} obj params[obj.moduleType].walletType = obj.walletType;
* @param {Object} fun params[obj.moduleType].amount = obj.amount; // 提现余额
*/ params[obj.moduleType].toAddr = obj.toAddr; // 接收地址
saveWalletPass: function(obj, fun) { params[obj.moduleType].password = obj.password; // 密码
var curObj = this; return ajaxUtil.send(walletApi[obj.moduleType].WALLET_WITHDRAWDEPOSIT, params[obj.moduleType]);
//加密钱包密码 },
curObj.getPublicKey(obj.password, function(pass) {
obj.password = pass; /**
ajaxUtil.send(baseApi.AJAX_SAVEPASS, obj).then(function(data) { * CCT提现手续费详情
if(curObj.SUCCESS_CODE == data.code) { * @param {String} tokenSymbol 名称
app.setIsWalletPassLocalStorage(true); * @param {Function} fun
} */
fun(data); getCoinGasInfo: function(obj, fun) {
}); ajaxUtil.send(walletApi[obj.moduleType].WALLET_WITHDRAW_GAS, {
}) tokenSymbol: obj.tokenSymbol
}, }).then(function(data) {
/** fun(data.data);
* 查询是否设置资金密码 });
* },
*/ /**
voidServieWalletPass: function(fun) { * 加密密码
var curObj = this; * @param {String} pass 密码
ajaxUtil.send(baseApi.AJAX_WALLETPASS).then(function(data) { * @param {Function} fun 回调方法
if(curObj.SUCCESS_CODE == data.code) { */
app.setIsWalletPassLocalStorage(data.data); getPublicKey: function(pass, fun) {
if(fun != null) { ajaxUtil.send(baseApi.AJAX_PULICKEY).then(function(data) {
fun(); var pulicData = data.data;
} var crypt = new JSEncrypt({
} default_key_size: 1024
}); });
}, crypt.setPublicKey(pulicData);
/** fun(crypt.encrypt(pass));
* 发送资金密码的验证码 });
*/ },
getSendCode: function() { /**
ajaxUtil.send(baseApi.AJAX_SENDCODE).then(function(data) { * 更新钱包密码
console.log(JSON.stringify(data)); * @param {Object} obj
}); * @param {Object} fun
}, */
/** saveWalletPass: function(obj, fun) {
* 划转 var curObj = this;
* @param {Object} data //加密钱包密码
*/ curObj.getPublicKey(obj.password, function(pass) {
handleTransfer: function(data, fun) { obj.password = pass;
ajaxUtil.send(baseApi.AJAX_SAVEPASS, obj).then(function(data) {
ajaxUtil.send(walletApi[data.moduleType].WALLET_HANDLETRANSFER, data).then(function(data) { if(curObj.SUCCESS_CODE == data.code) {
fun(data); app.setIsWalletPassLocalStorage(true);
}); }
}, fun(data);
/** });
* 格式化 })
*/ },
formatValue: function(value, d) { /**
if(value == "") return ""; * 查询是否设置资金密码
if(parseFloat(value) == 0) return value; *
if(/^\.\.+/.test(value) || !/^\d.*/.test(value)) { */
return ""; voidServieWalletPass: function(fun) {
} var curObj = this;
value = value.replace(/[^\d\.]/g, ""); //清除“数字”和“.”以外的字符 ajaxUtil.send(baseApi.AJAX_WALLETPASS).then(function(data) {
if(/\d+\.\d+/.test(value)){ if(curObj.SUCCESS_CODE == data.code) {
return parseInt(parseFloat(value) * Math.pow(10,d)) / Math.pow(10,d); app.setIsWalletPassLocalStorage(data.data);
} if(fun != null) {
return value ; fun();
} }
} }
});
},
/**
* 发送资金密码的验证码
*/
getSendCode: function() {
ajaxUtil.send(baseApi.AJAX_SENDCODE).then(function(data) {
console.log(JSON.stringify(data));
});
},
/**
* 划转
* @param {Object} data
*/
handleTransfer: function(data, fun) {
ajaxUtil.send(walletApi[data.moduleType].WALLET_HANDLETRANSFER, data).then(function(data) {
fun(data);
});
},
/**
* 格式化
*/
formatValue: function(value, d) {
if(value == "") return "";
if(parseFloat(value) == 0) return value;
if(/^\.\.+/.test(value) || !/^\d.*/.test(value)) {
return "";
}
value = value.replace(/[^\d\.]/g, ""); //清除“数字”和“.”以外的字符
if(/\d+\.\d+/.test(value)) {
return parseInt(parseFloat(value) * Math.pow(10, d)) / Math.pow(10, d);
}
return value;
}
}
}) })

File diff suppressed because it is too large Load Diff

@ -1,135 +1,135 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" /> <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<title>分享APP</title> <title>分享APP</title>
<!--REM自适应布局JS--> <!--REM自适应布局JS-->
<link rel="stylesheet" type="text/css" href="../../../lib/css/mui.min.css"> <link rel="stylesheet" type="text/css" href="../../../lib/css/mui.min.css">
<link rel="stylesheet" type="text/css" href="../../../lib/css/basic.css" /> <link rel="stylesheet" type="text/css" href="../../../lib/css/basic.css" />
<link rel="stylesheet" type="text/css" href="../../css/base.css" /> <link rel="stylesheet" type="text/css" href="../../css/base.css" />
<script src="../../../lib/js/mui.min.js"></script> <script src="../../../lib/js/mui.min.js"></script>
<script src="../../../lib/js/vue.js"></script> <script src="../../../lib/js/vue.js"></script>
<script src="../../../lib/js/app.js"></script> <script src="../../../lib/js/app.js"></script>
<script src="../../js/base/rem-layout.js"></script> <script src="../../js/base/rem-layout.js"></script>
<script src="../../js/language/wallet_language.js"></script> <script src="../../js/language/wallet_language.js"></script>
<script type="text/javascript" src="../../js/my/my_ajax.js"></script> <script type="text/javascript" src="../../js/my/my_ajax.js"></script>
</head> </head>
<style> <style>
.protocol-box { .protocol-box {
position: fixed; position: fixed;
bottom: 0.25rem; bottom: 0.25rem;
font-size: 0.28rem; font-size: 0.28rem;
text-align: center; text-align: center;
width: 100%; width: 100%;
color: #666 !important; color: #666 !important;
} }
#logo-content { #logo-content {
width: 100%; width: 100%;
height: 2.5rem; height: 2.5rem;
position: relative; position: relative;
} }
#logo-content #logo { #logo-content #logo {
position: absolute; position: absolute;
width: 80px; width: 80px;
top: .6rem; top: .6rem;
left: calc(50% - 40px); left: calc(50% - 40px);
height: auto; height: auto;
} }
.app-name { .app-name {
font-size: 0.3rem; font-size: 0.3rem;
text-align: center; text-align: center;
margin-bottom: .2rem; margin-bottom: .2rem;
} }
.version { .version {
width: 100%; width: 100%;
font-size: 0.25rem; font-size: 0.25rem;
text-align: center; text-align: center;
margin-bottom: .5rem; margin-bottom: .5rem;
margin: 0 auto; margin: 0 auto;
} }
.version img { .version img {
margin-top: 2.5rem; margin-top: 2.5rem;
width: 2rem; width: 2rem;
height: 2rem; height: 2rem;
} }
.version p { .version p {
width: 100%; width: 100%;
text-align: center; text-align: center;
margin-top: .2rem; margin-top: .2rem;
} }
</style> </style>
<body> <body>
<div id="data-info"> <div id="data-info">
<header class="mui-bar mui-bar-nav app-header app-header-darkly"> <header class="mui-bar mui-bar-nav app-header app-header-darkly">
<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a> <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
<h1 class="mui-title" data-text="WalletMyAboutUsTitle">{{langue.about}}</h1> <h1 class="mui-title" data-text="WalletMyAboutUsTitle">{{langue.about}}</h1>
</header> </header>
<div class="mui-content"> <div class="mui-content">
<div id="logo-content"> <div id="logo-content">
<img id="logo" src="../../img/yanhuo_logo.jpg" /> <img id="logo" src="../../img/logo.png" />
</div> </div>
<p class="app-name">{{langue.name}}</p> <p class="app-name">{{langue.name}}</p>
<div class="version"> <div class="version">
<img src="../../img/flame_code.png" alt="" /> <img src="../../img/flame_code.png" alt="" />
<p>{{langue.note}}</p> <p>{{langue.note}}</p>
</div> </div>
</div> </div>
<div class="protocol-box"> <div class="protocol-box">
<p> <p>
{{langue.name}}</br> {{langue.name}}</br>
Copyright © 2019 flame.io Corporation.</br> Copyright © 2019 flame.io Corporation.</br>
All Rights Reserved. All Rights Reserved.
</p> </p>
</div> </div>
</div> </div>
</body> </body>
</html> </html>
<script> <script>
//1、每个页面写自己的国际化语言变量,例子: //1、每个页面写自己的国际化语言变量,例子:
var langues = { var langues = {
zh_CN: { zh_CN: {
cancel: '取消', cancel: '取消',
about: '分享App', about: '分享App',
name: '焰火网', name: '智信链',
note: '扫描二维码即分享', note: '扫描二维码即分享',
}, },
zh_HK: { zh_HK: {
cancel: '取消', cancel: '取消',
about: '分享App', about: '分享App',
name: '焰火網', name: '智信鏈',
note: '掃描二維碼即分享', note: '掃描二維碼即分享',
}, },
en_US: { en_US: {
cancel: 'Cancel', cancel: 'Cancel',
about: 'Share', about: 'Share',
name: 'Flame.io', name: 'Zhixin',
note: 'Scan QR code to share', note: 'Scan QR code to share',
} }
}; };
//2、页面上所有需要国际化的文字,包括提示,都通过Vue去引用,例子: //2、页面上所有需要国际化的文字,包括提示,都通过Vue去引用,例子:
var langueKey = app.getLanguageLocalStorage(); //获取国际化语种 var langueKey = app.getLanguageLocalStorage(); //获取国际化语种
var langue = langues[langueKey]; // 获取国际化语种数据 var langue = langues[langueKey]; // 获取国际化语种数据
var dataInfo = new Vue({ var dataInfo = new Vue({
el: "#data-info", el: "#data-info",
data: { data: {
langue: langue, langue: langue,
} }
}); });
//3、每个页面都需要加上以下的方法: //3、每个页面都需要加上以下的方法:
window.addEventListener('switchLangueData', function(e) { window.addEventListener('switchLangueData', function(e) {
//dataInfo为Vue对象的名称 //dataInfo为Vue对象的名称
dataInfo.langue = langues[e.detail]; dataInfo.langue = langues[e.detail];
}); });
</script> </script>

File diff suppressed because it is too large Load Diff

@ -1,411 +1,410 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" /> <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<title>我的登录</title> <title>我的登录</title>
<!--REM自适应布局JS--> <!--REM自适应布局JS-->
<link rel="stylesheet" type="text/css" href="../../lib/css/mui.min.css"> <link rel="stylesheet" type="text/css" href="../../lib/css/mui.min.css">
<link href="../../lib/css/basic.css" rel="stylesheet" /> <link href="../../lib/css/basic.css" rel="stylesheet" />
<link rel="stylesheet" type="text/css" href="../css/base.css" /> <link rel="stylesheet" type="text/css" href="../css/base.css" />
<script src="../../lib/js/mui.min.js"></script> <script src="../../lib/js/mui.min.js"></script>
<script src="../../lib/js/vue.js"></script> <script src="../../lib/js/vue.js"></script>
<script src="../../lib/js/app.js"></script> <script src="../../lib/js/app.js"></script>
<script src="../../lib/js/jsdeferred.nodoc.js"></script> <script src="../../lib/js/jsdeferred.nodoc.js"></script>
<script type="text/javascript" src="../js/base/rem-layout.js"></script> <script type="text/javascript" src="../js/base/rem-layout.js"></script>
<script type="text/javascript" src="../js/login/login_ajax.js"></script> <script type="text/javascript" src="../js/login/login_ajax.js"></script>
<script src="../../html/wakuang/js/eth/ajax/eth.ajaxApi.js"></script> <script src="../../html/wakuang/js/eth/ajax/eth.ajaxApi.js"></script>
<script src="../../lib/js/require2.1.11.js"></script> <script src="../../lib/js/require2.1.11.js"></script>
<script src="../../lib/js/internationalCode.js"></script> <script src="../../lib/js/internationalCode.js"></script>
<script src="../js/base/getClientInfo.js"></script> <script src="../js/base/getClientInfo.js"></script>
</head> </head>
<style> <style>
#user-login { #user-login {
margin: 0.25rem 0.25rem; margin: 0.25rem 0.25rem;
} }
#user-login label { #user-login label {
width: 1.25rem; width: 1.25rem;
} }
#user-login .app-input { #user-login .app-input {
width: 60%; width: 60%;
} }
#user-login #mobile-phone .app-input { #user-login #mobile-phone .app-input {
flex-grow: 7; flex-grow: 7;
} }
#user-login #password-input .app-input { #user-login #password-input .app-input {
flex-grow: 7; flex-grow: 7;
} }
#user-login .app-group-right-text { #user-login .app-group-right-text {
width: 40%; width: 40%;
border: 0px solid white; border: 0px solid white;
} }
#user-login .app-input-row-list { #user-login .app-input-row-list {
border-radius: 0.2rem; border-radius: 0.2rem;
margin: 0.2rem 0; margin: 0.2rem 0;
overflow: hidden; overflow: hidden;
border: 1px solid #DDDDDD !important; border: 1px solid #DDDDDD !important;
} }
#login-text-info { #login-text-info {
margin: 0.3rem 0 0 0; margin: 0.3rem 0 0 0;
} }
.mui-slider-item { .mui-slider-item {
border: none !important; border: none !important;
} }
.login-slider { .login-slider {
top: 90px !important; top: 90px !important;
} }
.login-slider-title { .login-slider-title {
padding: 0 0.68rem 0 0.68rem !important; padding: 0 0.68rem 0 0.68rem !important;
} }
#sliderSegmentedControl { #sliderSegmentedControl {
margin: 0 0 0 0.25rem !important; margin: 0 0 0 0.25rem !important;
} }
#forget-password { #forget-password {
margin: 0.4rem; margin: 0.4rem;
font-size: 0.25rem; font-size: 0.25rem;
line-height: 1.5em; line-height: 1.5em;
} }
</style> </style>
<body> <body>
<div id="data-info"> <div id="data-info">
<header class="mui-bar mui-bar-nav app-header app-header-darkly"> <header class="mui-bar mui-bar-nav app-header app-header-darkly">
<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a> <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
<h1 class="mui-title">{{langue.title}}</h1> <h1 class="mui-title">{{langue.title}}</h1>
<a id="js-code-login" class="mui-pull-right" style="position: absolute; right: 12px;bottom: .28rem;">{{langue.Codelogin}}</a> <a id="js-code-login" class="mui-pull-right" style="position: absolute; right: 12px;bottom: .28rem;">{{langue.Codelogin}}</a>
</header> </header>
<div class="mui-content" style="margin-top: 0.5rem;"> <div class="mui-content" style="margin-top: 0.5rem;">
<div id="user-login" class="app-input-group app-input-group-darkly"> <div id="user-login" class="app-input-group app-input-group-darkly">
<!--<div id="international-div" class="app-input-row-list">--> <!--<div id="international-div" class="app-input-row-list">-->
<!--<label class="mui-text-center">{{langue.countriesAndRegions}}</label>--> <!--<label class="mui-text-center">{{langue.countriesAndRegions}}</label>-->
<!--<label>请选择国家</label>--> <!--<label>请选择国家</label>-->
<!--<input id="international_code" class="app-input" type="text" readonly="readonly" :value="langue.Hongkong" /> <!--<input id="international_code" class="app-input" type="text" readonly="readonly" :value="langue.Hongkong" />
<input id="internationalCode" type="hidden" value="86" />--> <input id="internationalCode" type="hidden" value="86" />-->
<!--</div>--> <!--</div>-->
<div id="mobile-phone" class="app-input-row-list"> <div id="mobile-phone" class="app-input-row-list">
<!--<label id="mobilePhoneLabel" class="mui-text-center">+86</label>--> <!--<label id="mobilePhoneLabel" class="mui-text-center">+86</label>-->
<label class="mui-text-center">{{langue.phone}}</label> <label class="mui-text-center">{{langue.phone}}</label>
<input id="mobilePhone" class="app-input" type="text" v-model="dataParameter.mobilePhone" :placeholder="langue.placeholder01" /> <input id="mobilePhone" class="app-input" type="text" v-model="dataParameter.mobilePhone" :placeholder="langue.placeholder01" />
</div> </div>
<div id="mobile-phone" class="app-input-row-list"> <div id="mobile-phone" class="app-input-row-list">
<label class="mui-text-center">{{langue.Code}}</label> <label class="mui-text-center">{{langue.Code}}</label>
<input id="password" class="app-input" type="password" v-model="dataParameter.password" :placeholder="langue.placeholder02" /> <input id="password" class="app-input" type="password" v-model="dataParameter.password" :placeholder="langue.placeholder02" />
</div> </div>
<div> <div>
<p class="mui-text-right" style="padding: 0.2rem; float: right;" id="js-openview-signup"> <p class="mui-text-right" style="padding: 0.2rem; float: right;" id="js-openview-signup">
<a>{{langue.register}}</a> <a>{{langue.register}}</a>
</p> </p>
<p class="mui-text-left" style="padding: 0.2rem; float: left;" id="js-openview-forget"> <p class="mui-text-left" style="padding: 0.2rem; float: left;" id="js-openview-forget">
<a>{{langue.ForgetThePassword}}</a> <a>{{langue.ForgetThePassword}}</a>
</p> </p>
</div> </div>
</div> </div>
<div class="login-btn"> <div class="login-btn">
<button id="login-btn" class="app-btn app-btn-darkly" style="margin-top: 0.5rem;width: 90%; margin-left: 5%;">{{langue.login}}</button> <button id="login-btn" class="app-btn app-btn-darkly" style="margin-top: 0.5rem;width: 90%; margin-left: 5%;">{{langue.login}}</button>
<p id="login-text-info" class="mui-text-center">{{langue.loginText}} <p id="login-text-info" class="mui-text-center">{{langue.loginText}}
<a id="protocol">{{langue.loginHref}}</a> <a id="protocol">{{langue.loginHref}}</a>
</p> </p>
</div> </div>
</div> </div>
</div> </div>
</body> </body>
</html> </html>
<script> <script>
// 国际化 // 国际化
var langues = { var langues = {
zh_CN: { zh_CN: {
title: "密码登录", title: "密码登录",
Code: "密码", Code: "密码",
phone: "账号", phone: "账号",
placeholder01: "请输入手机号/邮箱", placeholder01: "请输入手机号/邮箱",
placeholder02: "请输入密码", placeholder02: "请输入密码",
register: "新用户注册", register: "新用户注册",
login: "登录", login: "登录",
loginText: "点击'登录'代表你已阅读并同意", loginText: "点击'登录'代表你已阅读并同意",
loginHref: "《服务协议》", loginHref: "《服务协议》",
alert01: "账号不能为空", alert01: "账号不能为空",
alert02: "密码不能为空", alert02: "密码不能为空",
Codelogin: "验证码登录", Codelogin: "验证码登录",
ForgetThePassword: "忘记密码", ForgetThePassword: "忘记密码",
WalletLoginSuccessMsg: "登录成功!", WalletLoginSuccessMsg: "登录成功!",
WalletLoginMobilePhoneNullMsg: "手机号不能为空!", WalletLoginMobilePhoneNullMsg: "手机号不能为空!",
countriesAndRegions: "国家地区", countriesAndRegions: "国家地区",
// China: "中国" // China: "中国"
Hongkong: "中国" Hongkong: "中国"
}, },
zh_HK: { zh_HK: {
title: "密碼登錄", title: "密碼登錄",
Code: "密碼", Code: "密碼",
phone: "賬號", phone: "賬號",
placeholder01: "請輸入手機號/郵箱", placeholder01: "請輸入手機號/郵箱",
placeholder02: "請輸入密碼", placeholder02: "請輸入密碼",
register: "新用戶註冊", register: "新用戶註冊",
login: "登錄", login: "登錄",
loginText: "點擊'登錄'代表妳已閱讀並同意", loginText: "點擊'登錄'代表妳已閱讀並同意",
loginHref: "《服務協議》", loginHref: "《服務協議》",
alert01: "賬號不能為空", alert01: "賬號不能為空",
alert02: "密碼不能為空", alert02: "密碼不能為空",
Codelogin: "驗證碼登錄", Codelogin: "驗證碼登錄",
ForgetThePassword: "忘記密碼", ForgetThePassword: "忘記密碼",
WalletLoginSuccessMsg: "登錄成功!", WalletLoginSuccessMsg: "登錄成功!",
WalletLoginMobilePhoneNullMsg: "手機號不能為空!", WalletLoginMobilePhoneNullMsg: "手機號不能為空!",
countriesAndRegions: "國家地區", countriesAndRegions: "國家地區",
// China: "中國" // China: "中國"
Hongkong: "中国" Hongkong: "中国"
}, },
en_US: { en_US: {
title: "Password login", title: "Password login",
Code: "Password", Code: "Password",
phone: "Account", phone: "Account",
placeholder01: "Input phone number/mailbox", placeholder01: "Input phone number/mailbox",
placeholder02: "Input password", placeholder02: "Input password",
register: "Register", register: "Register",
login: "Login", login: "Login",
loginText: "Click 'login' to read and agree", loginText: "Click 'login' to read and agree",
loginHref: " Service Agreement ", loginHref: " Service Agreement ",
alert01: "The account cannot be empty", alert01: "The account cannot be empty",
alert02: "The password cannot be empty", alert02: "The password cannot be empty",
Codelogin: "Switch", Codelogin: "Switch",
ForgetThePassword: "Forgot Password", ForgetThePassword: "Forgot Password",
WalletLoginSuccessMsg: "Login succeeded!", WalletLoginSuccessMsg: "Login succeeded!",
WalletLoginMobilePhoneNullMsg: "The phone number cannot be empty!", WalletLoginMobilePhoneNullMsg: "The phone number cannot be empty!",
countriesAndRegions: "Country Areas", countriesAndRegions: "Country Areas",
// China: "China" // China: "China"
Hongkong: "China" Hongkong: "China"
} }
} }
</script> </script>
<script> <script>
var dataInfo = new Vue({ var dataInfo = new Vue({
el: "#data-info", el: "#data-info",
data: { data: {
langue: langues[app.getLanguageLocalStorage()], langue: langues[app.getLanguageLocalStorage()],
dataBase: {}, // 页面渲染 dataBase: {}, // 页面渲染
dataParameter: { dataParameter: {
mobilePhone: "", // 手机号验证 mobilePhone: "", // 手机号验证
password: "", password: "",
internationalCode: "86" internationalCode: "86"
} }
} }
}); });
mui.init({ mui.init({
gestureConfig: { gestureConfig: {
longtap: true, //默认为false longtap: true, //默认为false
release: true release: true
} }
}); });
mui.plusReady(function() { mui.plusReady(function() {
//登录 //登录
document.getElementById("login-btn").addEventListener("tap", function() { document.getElementById("login-btn").addEventListener("tap", function() {
var ajaxData = { var ajaxData = {
username: dataInfo.dataParameter.mobilePhone, username: dataInfo.dataParameter.mobilePhone,
password: dataInfo.dataParameter.password password: dataInfo.dataParameter.password
}; };
if(!valueIsNotNull(ajaxData.username)) { if(!valueIsNotNull(ajaxData.username)) {
mui.toast(dataInfo.langue.WalletLoginMobilePhoneNullMsg); mui.toast(dataInfo.langue.WalletLoginMobilePhoneNullMsg);
} else if(!isPoneAvailable(ajaxData.username)) { } else if(!isPoneAvailable(ajaxData.username)) {
mui.toast(dataInfo.langue.alert01) mui.toast(dataInfo.langue.alert01)
} else if(!valueIsNotNull(ajaxData.password)) { } else if(!valueIsNotNull(ajaxData.password)) {
mui.toast(dataInfo.langue.alert02); mui.toast(dataInfo.langue.alert02);
} else { } else {
plus.nativeUI.showWaiting(dataInfo.langue.ShowWaiting); plus.nativeUI.showWaiting(dataInfo.langue.ShowWaiting);
ajaxData.tel = ajaxData.username; ajaxData.tel = ajaxData.username;
ajaxData.password = ajaxData.password; ajaxData.password = ajaxData.password;
//该值请从 mine/js/base/getClientInfo.js 中查看 //该值请从 mine/js/base/getClientInfo.js 中查看
ajaxData.clientId = plusClientId; ajaxData.clientId = plusClientId;
login(loginAjaxJs.AJAX_PASS_LOGIN, ajaxData); login(loginAjaxJs.AJAX_PASS_LOGIN, ajaxData);
} }
}); });
document.getElementById('protocol').addEventListener('tap', function() { document.getElementById('protocol').addEventListener('tap', function() {
mui.openWindow({ mui.openWindow({
id: "mine/html/wallet_terms_of_service.html", id: "mine/html/wallet_terms_of_service.html",
url: "wallet_terms_of_service.html" url: "wallet_terms_of_service.html"
}); });
}) })
// 跳转到注册页面 // 跳转到注册页面
document.getElementById('js-openview-signup').addEventListener('tap', function() { document.getElementById('js-openview-signup').addEventListener('tap', function() {
app.openWin("wallet_sign_up.html", "mine/html/wallet_sign_up.html"); app.openWin("wallet_sign_up.html", "mine/html/wallet_sign_up.html");
}) })
// 跳转到忘記密碼页面 // 跳转到忘記密碼页面
document.getElementById('js-openview-forget').addEventListener('tap', function() { document.getElementById('js-openview-forget').addEventListener('tap', function() {
app.openWin("user/not_login_user_forget-password.html", "not_login_user_forget-password.html"); app.openWin("user/not_login_user_forget-password.html", "not_login_user_forget-password.html");
}) })
//验证码登录 //验证码登录
document.getElementById('js-code-login').addEventListener('tap', function() { document.getElementById('js-code-login').addEventListener('tap', function() {
colseWin(); colseWin();
app.openWin("wallet_login.html", "mine/html/wallet_login.html"); app.openWin("wallet_login.html", "mine/html/wallet_login.html");
}) })
/** /**
* 国际代码回掉监听 * 国际代码回掉监听
*/ */
// window.addEventListener("internationalCode", function(event) { // window.addEventListener("internationalCode", function(event) {
// document.getElementById("internationalCode").value = event.detail.code; // document.getElementById("internationalCode").value = event.detail.code;
// document.getElementById('international_code').value = event.detail.name; // document.getElementById('international_code').value = event.detail.name;
// document.getElementById("mobilePhoneLabel").innerText = "+" + event.detail.code; // document.getElementById("mobilePhoneLabel").innerText = "+" + event.detail.code;
// dataInfo.langue.Hongkong = event.detail.name; // dataInfo.langue.Hongkong = event.detail.name;
// dataInfo.dataParameter.internationalCode = event.detail.code; // dataInfo.dataParameter.internationalCode = event.detail.code;
// }); // });
//选择国际点击事件 //选择国际点击事件
// document.getElementById('international_code').addEventListener('tap', function() { // document.getElementById('international_code').addEventListener('tap', function() {
// app.openWin('indexed-list.html', 'indexed-list.html', null, null); // app.openWin('indexed-list.html', 'indexed-list.html', null, null);
// }); // });
}); });
/** /**
* 空判断 * 空判断
* @param {Object} value 参数 * @param {Object} value 参数
*/ */
function valueIsNotNull(value) { function valueIsNotNull(value) {
if(null != value && value.replace(/\s+/g, "") != "") { if(null != value && value.replace(/\s+/g, "") != "") {
return true; return true;
} }
return false; return false;
} }
/** /**
* 判断是否为有效手机号 * 判断是否为有效手机号
* @param {Object} str * @param {Object} str
*/ */
/*function isPoneAvailable(str) { /*function isPoneAvailable(str) {
var myreg = /^1[3-9][0-9]{9}$/; var myreg = /^1[3-9][0-9]{9}$/;
if(!myreg.test(str)) { if(!myreg.test(str)) {
return false; return false;
} else { } else {
return true; return true;
} }
}*/ }*/
/** /**
* 空判断 * 空判断
* @param {Object} value 参数 * @param {Object} value 参数
*/ */
function isPoneAvailable(value) { function isPoneAvailable(value) {
if(null != value && value.replace(/\s+/g, "") != "") { if(null != value && value.replace(/\s+/g, "") != "") {
return true; return true;
} }
return false; return false;
} }
//登录 //登录
function login(ajaxObj, ajaxData) { function login(ajaxObj, ajaxData) {
mui.ajax(ajaxObj.getUrl, { mui.ajax(ajaxObj.getUrl, {
headers: { headers: {
// "X-Requested-Token": app.getTokenStorage(), // token头部 // "X-Requested-Token": app.getTokenStorage(), // token头部
"locale": app.getLanguageLocalStorage() // 语种头部 "locale": app.getLanguageLocalStorage() // 语种头部
}, },
type: ajaxObj.getType, //HTTP请求类型 type: ajaxObj.getType, //HTTP请求类型
data: ajaxData, data: ajaxData,
dataType: 'json', //服务器返回json格式数据 dataType: 'json', //服务器返回json格式数据
timeout: 10000, //超时时间设置为10秒; timeout: 10000, //超时时间设置为10秒;
success: function(data) { success: function(data) {
if("200" == data.code) { if("200" == data.code) {
JSON.stringify(data); JSON.stringify(data);
//用户数据加入缓存 //用户数据加入缓存
saveLocalStorage(data); saveLocalStorage(data);
synchrodataFun(); synchrodataFun();
// getEthWallet(); // getEthWallet();
// sleep(2000); // sleep(2000);
plus.nativeUI.closeWaiting(); plus.nativeUI.closeWaiting();
mui.back(); mui.back();
// plus.webview.currentWebview().close(); // plus.webview.currentWebview().close();
// mui.toast(dataInfo.langue.WalletLoginSuccessMsg); // mui.toast(dataInfo.langue.WalletLoginSuccessMsg);
} else { } else {
plus.nativeUI.closeWaiting(); plus.nativeUI.closeWaiting();
app.toast(data.msg); app.toast(data.msg);
} }
}, },
error: function(xhr, type, errorThrown) { error: function(xhr, type, errorThrown) {
plus.nativeUI.closeWaiting(); plus.nativeUI.closeWaiting();
// app.toast(langue.AjaxError); }
} })
}) }
}
function sleep(numberMillis) {
function sleep(numberMillis) { var now = new Date();
var now = new Date(); var exitTime = now.getTime() + numberMillis;
var exitTime = now.getTime() + numberMillis; while(true) {
while(true) { now = new Date();
now = new Date(); if(now.getTime() > exitTime)
if(now.getTime() > exitTime) return;
return; }
} }
}
/**
/** * 数据同步
* 数据同步 */
*/ function synchrodataFun() {
function synchrodataFun() { //“我的”首页
//“我的”首页 var walletMyView = plus.webview.getWebviewById("mine/html/wallet_my.html");
var walletMyView = plus.webview.getWebviewById("mine/html/wallet_my.html"); walletMyView.evalJS("saveUserInfoData();");
walletMyView.evalJS("saveUserInfoData();"); // 钱包页面
// 钱包页面 var walletView = plus.webview.getWebviewById("html/wallet/html/wallet.html");
var walletView = plus.webview.getWebviewById("html/wallet/html/wallet.html"); mui.fire(walletView, "walletSaveEvent");
mui.fire(walletView, "walletSaveEvent"); // 币币页面
// 币币页面 var CCTView = plus.webview.getWebviewById("html/cct/html/cct_index.html");
var CCTView = plus.webview.getWebviewById("html/cct/html/cct_index.html"); mui.fire(CCTView, "login");
mui.fire(CCTView, "login"); }
}
/**
/** * 更新缓存
* 更新缓存 */
*/ function saveLocalStorage(data) {
function saveLocalStorage(data) { app.setUserLocalStorage(data.data);
app.setUserLocalStorage(data.data); app.setTokenStorage(data.data.token);
app.setTokenStorage(data.data.token); }
}
/*function initJoinChatRoom() {
/*function initJoinChatRoom() { //“聊天室”
//“聊天室” let chatRoomView = plus.webview.getWebviewById("wallet_chat_room.html");
let chatRoomView = plus.webview.getWebviewById("wallet_chat_room.html"); // chatRoomView.evalJS("flushView();");
// chatRoomView.evalJS("flushView();"); }*/
}*/
/*function getEthWallet() {
/*function getEthWallet() { mui.ajax(ethAjaxApi.SELECT_ETHWALLET.getUrl, {
mui.ajax(ethAjaxApi.SELECT_ETHWALLET.getUrl, { headers: {
headers: { "X-Requested-Token": app.getTokenStorage(), // token头部
"X-Requested-Token": app.getTokenStorage(), // token头部 "locale": app.getLanguageLocalStorage() // 语种头部
"locale": app.getLanguageLocalStorage() // 语种头部 },
}, dataType: 'json', //服务器返回json格式数据
dataType: 'json', //服务器返回json格式数据 type: ethAjaxApi.SELECT_ETHWALLET.getType, //HTTP请求类型
type: ethAjaxApi.SELECT_ETHWALLET.getType, //HTTP请求类型 timeout: 10000, //超时时间设置为10秒
timeout: 10000, //超时时间设置为10秒 success: function(data) {
success: function(data) { app.setEthWalletInfoLocalStorage(data.data);
app.setEthWalletInfoLocalStorage(data.data); console.log(JSON.stringify(app.getEthWalletInfoLocalStorage()));
console.log(JSON.stringify(app.getEthWalletInfoLocalStorage())); synchrodataFun(); //数据同步
synchrodataFun(); //数据同步 }
} });
}); }*/
}*/
function colseWin() {
function colseWin() { var view = plus.webview.currentWebview();
var view = plus.webview.currentWebview(); setTimeout(function() {
setTimeout(function() { view.hide();
view.hide(); view.close();
view.close(); }, 500)
}, 500) }
} // 国际化统一方法
// 国际化统一方法 window.addEventListener('switchLangueData', function(e) {
window.addEventListener('switchLangueData', function(e) { dataInfo.langue = langues[e.detail];
dataInfo.langue = langues[e.detail]; });
});
</script> </script>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 172 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 133 KiB

Loading…
Cancel
Save