-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathresult.html
More file actions
306 lines (282 loc) · 10.8 KB
/
result.html
File metadata and controls
306 lines (282 loc) · 10.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="shortcut icon" href="./favicon.ico" type="image/x-icon">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<script src="./js/vue.min.js"></script>
<script src="./js/vue-clipboard.min.js"></script>
<script src="./js/jquery-3.2.1.min.js"></script>
<script src="./js/lodash.min.js"></script>
<script src="./js/vue-qrcode.min.js"></script>
<script>
Vue.component(VueQrcode.name, VueQrcode);
</script>
<link rel="stylesheet" type="text/css" href="./css/reset.css">
<link rel="stylesheet" type="text/css" href="./css/bootstrap.min.css">
</head>
<style type="text/css">
body {
background: #F6F6F6;
}
.three {
position: fixed;
width: 220px;
left: 0;
right: 0;
bottom: 34px;
height: 44px;
line-height: 44px;
background: #31AEFF;
border-radius: 200px;
margin: 0 auto;
z-index: 999;
}
.three p {
font-family: Bio Sans;
font-size: 16px;
text-align: center;
color: #ffffff;
}
.xiaoshuo {
cursor: pointer;
}
.footer {
position: fixed;
width: 300px;
left: 0;
right: 0;
bottom: 10px;
height: 20px;
line-height: 20px;
background-color: #fff;
text-align: center;
color: #31AEFF;
margin: 0 auto;
z-index: 999;
}
.toast {
position: fixed;
z-index: 2000;
left: 50%;
top: 25%;
transition: all .5s;
-webkit-transform: translateX(-50%) translateY(-50%);
-moz-transform: translateX(-50%) translateY(-50%);
-ms-transform: translateX(-50%) translateY(-50%);
-o-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
text-align: center;
border-radius: 5px;
color: #FFF;
background: rgba(17, 17, 17, 0.7);
height: 45px;
line-height: 45px;
padding: 0 15px;
width: 100%;
}
[v-cloak] {
display: none;
}
</style>
<body>
<div id="app" v-cloak>
<div class="toast" v-show="toastShow">
{{toastText}}
</div>
<div style="margin-left:5px;margin-right:5px;margin-top: 100px;font-size: 16px;">
<div style="text-align: center;">{{curLangule['key']}}</div>
</div>
<div style="margin-left:5px;margin-right:5px;margin-top: 10px;font-size: 16px;" v-if="payAddress">
<div style="text-align:center;" @click="docopy(payAddress)">{{curLangule['key4']}}:{{payAddress}}</div>
<div style="margin: 0 auto;width: 150px;">
<qrcode :value="payAddress" :options="{ width:150 }" style="display:block"></qrcode>
</div>
<div style="text-align:center;">{{curLangule['key5']}}:{{payBanance}} ELA</div>
<div style="text-align: center;color:#31AEFF;margin-top: 15px;cursor: pointer;" @click="goCharge"><span style="border-bottom: 1px solid #31AEFF;padding-bottom: 3px;">{{curLangule["key8"]}}</span></div>
</div>
<div style="margin-left:5px;margin-right:5px;margin-top: 10px;font-size: 16px;" v-if="amount">
<div style="text-align: center;">{{curLangule['key6']}} <span style="color:#ff0000">{{amount}} ELA</span> {{curLangule['key7']}}</div>
</div>
<!-- <div style="margin-left:5px;margin-right:5px;margin-top: 15px;font-size: 16px;" @click="redRecord()" v-if="amount">
<div style="text-align: center;color: #31AEFF;cursor: pointer;"><span style="border-bottom:#31AEFF 1px solid;padding:5px">{{curLangule['key8']}}</span></div>
</div> -->
<div class="three">
<p @click="back">{{curLangule['key1']}}</p>
</div>
<div class="footer" v-if="curblock!=''">
<!-- {{dateFormat(new Date(this.curTime*1000), 'yyyy-MM-dd HH:mm')}}-->{{curLangule['key2']}}:{{curblock}}
</div>
</div>
</body>
<script>
var app = new Vue({
el: '#app',
data: {
zh: {
title: '结果',
key: '交易已发送,当下一个区块产生的时候就可以查看到。',
key1: '返回主页',
key2: '当前区块',
key3: '复制成功',
key4: '充值地址',
key5: '充值金额',
key6: '恭喜你获得',
key7: '红包',
key8: '去充值'
},
en: {
title: 'Result',
key: 'The transaction has been sent. You can see it when the next block is generated.',
key1: 'Back Home',
key2: 'Current Block',
key3: 'Copy Success',
key4: 'Recharge address',
key5: 'Recharge amount',
key6: 'Congratulations on getting',
key7: 'redpacket',
key8: 'To recharge'
},
curLangule: {},
txId: "",
toastText: "",
toastShow: false,
type: '',
curblock: '',
payAddress: "",
payBanance: "",
schemeConfig: {
"AppID": "3461ba97b110118ed25a66697e021004e3de05a52c05bb10470619d73d3932a59c59e81a6f6621f22dfc9b0182df5891d13bd2afcb86cb8665d02e608f03b3cf",
"AppName": encodeURIComponent("Vote For Me"),
"DID": "ibxNTG1hBPK1rZuoc8fMy4eFQ96UYDAQ4J",
"PublicKey": "034c51ddc0844ff11397cc773a5b7d94d5eed05e7006fb229cf965b47f19d27c55",
"Description": "didvote",
"CoinName": "ELA",
"Amount": "",
"ReceivingAddress": "",
"ReturnUrl": "",
},
amount: "",
},
methods: {
doCopy(url) {
var v = this;
this.$copyText(url).then(function(e) {
v.toast(v.curLangule['key3']);
}, function(e) {})
},
toast(str) {
var v = this;
v.toastText = str
v.toastShow = true
setTimeout(function() {
v.toastShow = false;
}, 1500)
},
getUrl() {
//获取主机地址
var localhostPaht = window.location.protocol + "//" + window.location.host;
return localhostPaht;
},
goCharge() {
this.schemeConfig['ReceivingAddress'] = this.payAddress;
this.schemeConfig['Amount'] = this.payBanance;
var baseUrl = this.getUrl();
if (baseUrl === "file://") {
baseUrl = 'http://dev1.elapps.net';
}
this.schemeConfig['ReturnUrl'] = baseUrl + '/voteIndex.html';
var url = "elaphant://elapay?";
_.forEach(this.schemeConfig, function(val, key, index) {
if (key === 'ReturnUrl' || key === 'RequestInfo' || key === 'RequestedContent') {
val = encodeURIComponent(val);
}
url += key + '=' + val + '&';
});
var turl = 'https://launch.elaphant.app?appName=Vote For Me&autoRedirect=True&appTitle=Vote For Me&redirectURL=' + encodeURIComponent(url);
location.href = turl;
},
docopy(payAddress) {
this.doCopy(payAddress);
},
getAjax(url) {
return new Promise((resovle, reject) => {
$.ajax({
url: url,
dataType: 'json',
type: 'GET',
success: function(data) { //成功回调函数
resovle(data);
},
error: function(err) { //失败回调函数
reject(err);
}
});
});
},
getAjaxHeight() {
this.getAjax('https://explorer.elaphant.app/api/v1/block/height').then((res) => {
this.curblock = res[0].height;
}).catch(() => {
});
},
back() {
location.href = "./index.html";
},
getLanugle: function() {
this.curLangule = this.en;
this.curLanguleKey = 'en';
var JsSrc = (navigator.language || navigator.browserLanguage).toLowerCase();
if (JsSrc.indexOf('zh') >= 0) {
// 假如浏览器语言是中文
this.curLanguleKey = 'zh';
this.curLangule = this.zh;
} else if (JsSrc.indexOf('en') >= 0) {
this.curLangule = this.en;
this.curLanguleKey = 'en';
} else {
// 假如浏览器语言是其它语言
this.curLangule = this.en;
this.curLanguleKey = 'en';
}
},
getUrlParam: function(name) {
//正则表达式过滤
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
//正则规则
var r = window.location.search.substr(1).match(reg);
if (r != null) return decodeURI(r[2]);
return null;
}
},
created: function() {
this.getAjaxHeight();
this.payAddress = this.getUrlParam('payAddress') || "";
this.payBanance = this.getUrlParam('payBalance') || "";
this.type = this.getUrlParam('type') || "";
this.txId = this.getUrlParam('txId') || "";
this.amount = this.getUrlParam('amount') || "";
var hashList = localStorage.getItem('did-vote-sendTx-hashList') || "";
if (hashList === "") {
hashList = {};
} else {
hashList = JSON.parse(hashList);
}
var value = hashList[this.txId] || '';
if (this.txId != "" && value === '') {
hashList[this.txId] = {
"txHash": this.txId,
"createTime": parseInt((new Date().getTime() / 1000))
}
localStorage.setItem('did-vote-sendTx-hashList', JSON.stringify(hashList));
}
//localStorage.setItem('did-vote-sendTx-hashList', "");
},
mounted() {
this.getLanugle();
document.title = this.curLangule["title"];
}
});
</script>
</html>