199
199
>
200
200
Generate QR code
201
201
</button >
202
+ <button
203
+ class =" button mt-1"
204
+ :disabled =" invalid"
205
+ @click =" generateURL()"
206
+ >
207
+ Generate URL
208
+ </button >
209
+ <div v-if =" url" class =" url mt-2" >
210
+ <label v-text =" 'URL'" />
211
+ <div class =" field" >
212
+ <img
213
+ class =" icon copy"
214
+ src =" ~/assets/copy.svg"
215
+ alt =" Copy to clipboard"
216
+ @click =" copyToClipboard(url)"
217
+ >
218
+ <p v-text =" url" />
219
+ </div >
220
+ </div >
202
221
<div class =" qr-code" >
203
222
<canvas ref =" canvas" class =" canvas" />
204
223
<img
@@ -328,7 +347,8 @@ export default {
328
347
url: ' //gwan-ssl.wandevs.org:46891/'
329
348
}
330
349
],
331
- qrcode: null
350
+ qrcode: null ,
351
+ url: ' '
332
352
}
333
353
},
334
354
computed: {
@@ -410,15 +430,16 @@ export default {
410
430
}
411
431
},
412
432
async getAssetInfo () {
413
- const asset = await this . assetLedger . getAsset ( this . formData . assetId )
414
- if ( asset . uri ) {
415
- try {
433
+ try {
434
+ const asset = await this . assetLedger . getAsset ( this . formData . assetId )
435
+ if ( asset . uri ) {
416
436
const result = await this .$axios .get (asset .uri )
417
437
this .formData .metadata = JSON .stringify (result .data )
418
438
this .formData .schema = JSON .stringify ((await this .$axios .get (result .data .$schema )).data )
419
439
this .formData .evidence = JSON .stringify ((await this .$axios .get (result .data .$evidence )).data )
420
- } catch {
421
440
}
441
+ } catch {
442
+ this .$toast .error (' Error fetching asset information.' )
422
443
}
423
444
},
424
445
async verifyAsset () {
@@ -427,6 +448,13 @@ export default {
427
448
window .scrollTo (0 , 0 )
428
449
this .state = ' results'
429
450
},
451
+ generateURL () {
452
+ this .url = ` https://verify.0xcert.org?assetId=${ this .formData .assetId } &ledgerId=${ this .formData .assetLedgerId } &network=${ this .formData .network } `
453
+ },
454
+ copyToClipboard (text ) {
455
+ this .$toast .success (' Coppied to clipboard.' )
456
+ navigator .clipboard .writeText (text)
457
+ },
430
458
async generateQRCode () {
431
459
this .qrcode = new QrCodeWithLogo ({
432
460
canvas: this .$refs .canvas ,
@@ -487,4 +515,31 @@ export default {
487
515
margin : 0 auto ;
488
516
}
489
517
}
518
+ .url {
519
+
520
+ label {
521
+ font-weight : bold ;
522
+ }
523
+ }
524
+
525
+ .field {
526
+ margin-top : 2px ;
527
+ background-color : #ECEFF1 ;
528
+ border-radius : 4px ;
529
+ padding : 10px 30px 10px 10px ;
530
+ position : relative ;
531
+
532
+ p {
533
+ margin-top : 5px ;
534
+ }
535
+ }
536
+
537
+ .copy {
538
+ height : 15px ;
539
+ cursor : pointer ;
540
+ position : absolute ;
541
+ right : 8px ;
542
+ top : 50% ;
543
+ margin-top : -7px ;
544
+ }
490
545
</style >
0 commit comments