recharge.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <template>
  2. <view class="all">
  3. <view class="top">
  4. <view class="topO"> 鏈名稱 </view>
  5. <view class="topT">
  6. <view class="tt">USDT-TRC20</view>
  7. </view>
  8. <view class="topS">
  9. <view class="S">收款地址</view>
  10. <view
  11. class="SS"
  12. >{{ address }}</view
  13. >
  14. <image
  15. class="SSS"
  16. src="../../static/icon/cz.png"
  17. mode=""
  18. @click="copy(address)">
  19. </image>
  20. </view>
  21. <!-- 根据地址生成二维码 -->
  22. <view class="topF">
  23. <view class="qr">
  24. <canvas
  25. id="qrcode"
  26. canvas-id="qrcode"
  27. style="width: 120px; height: 120px"></canvas>
  28. </view>
  29. </view>
  30. <view class="last">
  31. <view class="le" >
  32. <view class="lef">保存相冊</view>
  33. </view>
  34. <view class="le" style="margin-left: 30rpx;">
  35. <view class="lef" @click="copy(address)">複製地址</view>
  36. </view>
  37. </view>
  38. </view>
  39. <view class="buttom">
  40. <view class="but">
  41. 提示:充值大於5000U,請先充值一筆小額的,到賬之後再進行大額充值。充值地址每個人都是唯一的!請一定要仔細確認避免充錯!
  42. </view>
  43. </view>
  44. </view>
  45. </template>
  46. <script>
  47. import UQRCode from "uqrcodejs"; // npm install uqrcodejs
  48. export default {
  49. data() {
  50. return {
  51. address: "ca87ca68ca68c6a986c98a678c7a8",
  52. };
  53. },
  54. mounted() {},
  55. onReady() {
  56. // 获取uQRCode实例
  57. var qr = new UQRCode();
  58. // 设置二维码内容
  59. qr.data = this.address;
  60. // 设置二维码大小,必须与canvas设置的宽高一致
  61. qr.size = 120;
  62. // 调用制作二维码方法
  63. qr.make();
  64. // 获取canvas上下文
  65. var canvasContext = uni.createCanvasContext("qrcode", this); // 如果是组件,this必须传入
  66. // 设置uQRCode实例的canvas上下文
  67. qr.canvasContext = canvasContext;
  68. // 调用绘制方法将二维码图案绘制到canvas上
  69. qr.drawCanvas();
  70. // 我之前写的保存的是地址 没让保存图片 他要保存图片的话 浏览器应该会给出长安保存选项 或者他自己截图 不用管这个了
  71. // 我这个收款地址,二维码怎么改变
  72. },
  73. methods: {
  74. // 复制地址
  75. copy(value) {
  76. uni.setClipboardData({
  77. data: value,
  78. success: function () {
  79. //调用方法成功
  80. console.log("success");
  81. },
  82. });
  83. },
  84. },
  85. };
  86. </script>
  87. <style lang="scss">
  88. .all {
  89. width: 750rpx;
  90. height: 1416rpx;
  91. background-color: #000000;
  92. }
  93. .top {
  94. margin-left: 28rpx;
  95. padding-top: 50rpx;
  96. width: 690rpx;
  97. height: 720rpx;
  98. background: #191a1f;
  99. border-radius: 20rpx;
  100. display: flex;
  101. flex-direction: column;
  102. }
  103. .topO {
  104. height: 31rpx;
  105. font-size: 32rpx;
  106. font-family: PingFang SC;
  107. font-weight: bold;
  108. color: #ffffff;
  109. line-height: 24rpx;
  110. margin-left: 21rpx;
  111. margin-top: 37rpx;
  112. }
  113. .topT {
  114. margin-left: 20rpx;
  115. margin-top: 30rpx;
  116. width: 218rpx;
  117. height: 68rpx;
  118. border: 2px solid #ddba82;
  119. border-radius: 10rpx;
  120. }
  121. .tt {
  122. width: 168rpx;
  123. height: 20rpx;
  124. font-size: 26rpx;
  125. font-family: PingFang SC;
  126. font-weight: bold;
  127. color: #feb041;
  128. line-height: 24rpx;
  129. margin-top: 20rpx;
  130. margin-left: 23rpx;
  131. }
  132. .topS {
  133. display: flex;
  134. justify-content: start;
  135. }
  136. .S {
  137. height: 31rpx;
  138. font-size: 32rpx;
  139. font-family: PingFang SC;
  140. font-weight: bold;
  141. color: #ffffff;
  142. line-height: 24rpx;
  143. margin-left: 23rpx;
  144. margin-top: 26rpx;
  145. }
  146. .SS {
  147. height: 20rpx;
  148. font-size: 26rpx;
  149. font-family: PingFang SC;
  150. font-weight: 500;
  151. color: #ffffff;
  152. line-height: 24rpx;
  153. margin-left: 23rpx;
  154. margin-top: 26rpx;
  155. }
  156. .SSS {
  157. width: 29rpx;
  158. height: 29rpx;
  159. margin-left: 23rpx;
  160. margin-top: 24rpx;
  161. }
  162. .buttom {
  163. margin-left: 30rpx;
  164. margin-top: 30rpx;
  165. width: 690rpx;
  166. height: 226rpx;
  167. background: #191a1f;
  168. border-radius: 20rpx;
  169. }
  170. .but {
  171. margin-left: 27rpx;
  172. padding-top: 50rpx;
  173. width: 625rpx;
  174. height: 114rpx;
  175. font-size: 26rpx;
  176. font-family: PingFang SC;
  177. font-weight: 500;
  178. color: #ffffff;
  179. line-height: 45rpx;
  180. }
  181. .topF {
  182. // flex: 1;
  183. margin-top: 34rpx;
  184. display: flex;
  185. align-items: center;
  186. justify-content: center;
  187. }
  188. .qr{
  189. width: 275rpx;
  190. height: 275rpx;
  191. display: flex;
  192. align-items: center;
  193. justify-content: center;
  194. background-color: #fff;
  195. }
  196. .last {
  197. display: flex;
  198. justify-content: center;
  199. }
  200. .le {
  201. margin-top: 43rpx;
  202. width: 201rpx;
  203. height: 59rpx;
  204. border: 2px solid #DDBA82;
  205. border-radius: 10rpx;
  206. }
  207. .lef {
  208. margin-top: 12rpx;
  209. margin-left: 49rpx;
  210. height: 25rpx;
  211. font-size: 26rpx;
  212. font-family: PingFang SC;
  213. font-weight: bold;
  214. color: #FEB041;
  215. line-height: 24rpx;
  216. }
  217. </style>