Google.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <template>
  2. <view>
  3. <headContent borderBottom>
  4. <template #left>
  5. <reverse-back />
  6. </template>
  7. <template #content>
  8. <view class="haed-title">
  9. 绑定谷歌验证
  10. </view>
  11. </template>
  12. </headContent>
  13. <view class="content-box">
  14. <text class="lable-text">1. 安装谷歌验证器</text>
  15. <text class="lable-hint">首先您需要在手机上安装谷歌验证器</text>
  16. <text class="lable-hint">(GoogleAuthenticator)</text>
  17. <view class="app-box">
  18. <image class="app-icon" src="@/static/images/google.png" mode="aspectFit"></image>
  19. <text class="app-btn" @click.stop="openUrl">立即安装</text>
  20. </view>
  21. <text class="lable-text">2. 绑定谷歌验证器</text>
  22. <text class="lable-hint">使用谷歌验证器App扫描该二维码或输入密钥</text>
  23. <text class="lable-hint">(GoogleAuthenticator)</text>
  24. <view class="qrcode">
  25. <tki-qrcode ref="qrcodeRef" :size="100" :showLoading="false" :val="codeurl" />
  26. </view>
  27. <view class="copy-box">
  28. <text class="copy-num">{{secret}}</text>
  29. <text v-show="secret" class="copy-icon iconfont" @click.stop="copySecret(secret)">&#xe65f;</text>
  30. </view>
  31. <view class="copy-hint">
  32. 请将16位密钥记录在纸上,并保存在安全的地方,如果遇到手机丢失,您可以通过密钥恢复您的谷歌验证。
  33. </view>
  34. <text class="bind-btn" @click.stop="bind">绑定</text>
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. import {
  40. Api_getGoogle
  41. } from "@/api/index.js"
  42. export default {
  43. name: 'Google',
  44. data() {
  45. return {
  46. val: '',
  47. account: '',
  48. secret: "", // 密钥
  49. codeurl: ""
  50. };
  51. },
  52. onLoad(opt) {
  53. this.account = opt?.account
  54. this.getGoogle()
  55. },
  56. mounted() {
  57. },
  58. methods: {
  59. getGoogle() {
  60. Api_getGoogle().then(res => {
  61. this.secret = res.secret
  62. this.codeurl = res.codeurl
  63. this.$nextTick(() => {
  64. if (this.codeurl) {
  65. this.$refs.qrcodeRef._makeCode()
  66. }
  67. })
  68. })
  69. },
  70. openUrl() {
  71. // const url = 'https://m.torrent.org.cn/soft/2703.html'
  72. const url = 'https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2&hl=zh&gl=US'
  73. plus.runtime.openWeb(url);
  74. },
  75. copySecret(secret) {
  76. uni.setClipboardData({
  77. data: secret,
  78. success: res => {
  79. uni.showToast({
  80. title: '复制成功',
  81. icon: 'none'
  82. })
  83. }
  84. });
  85. },
  86. bind() {
  87. // this.type = opt?.type;
  88. // this.account = opt?.account;
  89. uni.navigateTo({
  90. url: `/pages/login/safety-verification?type=2&account=${this.account}`
  91. })
  92. }
  93. }
  94. }
  95. </script>
  96. <style lang="scss" scoped>
  97. .content-box {
  98. width: 100%;
  99. padding: 20rpx $pages-padding;
  100. display: flex;
  101. flex-direction: column;
  102. .lable-text {
  103. font-size: 32rpx;
  104. font-weight: bold;
  105. line-height: 1.6;
  106. }
  107. .lable-hint {
  108. font-size: 28rpx;
  109. line-height: 1.4;
  110. color: $SizeColor3;
  111. }
  112. .app-box {
  113. width: 100%;
  114. display: flex;
  115. flex-direction: column;
  116. justify-content: center;
  117. align-items: center;
  118. padding: 50rpx 0;
  119. .app-icon {
  120. width: 100rpx;
  121. height: 100rpx;
  122. }
  123. .app-btn {
  124. background-color: $Theme-Color;
  125. width: 200rpx;
  126. height: 70rpx;
  127. text-align: center;
  128. line-height: 70rpx;
  129. font-size: 28rpx;
  130. color: #fff;
  131. border-radius: 10rpx;
  132. margin-top: 40rpx;
  133. }
  134. }
  135. .qrcode {
  136. text-align: center;
  137. padding: 60rpx 0;
  138. }
  139. .copy-box {
  140. width: 100%;
  141. background-color: $bg_02;
  142. height: 80rpx;
  143. display: flex;
  144. justify-content: center;
  145. align-items: center;
  146. .copy-num {
  147. font-size: 26rpx;
  148. font-weight: bold;
  149. }
  150. .copy-icon {
  151. font-size: 28rpx;
  152. color: $Theme-Color;
  153. padding-left: 30rpx;
  154. }
  155. }
  156. .copy-hint {
  157. padding: 10rpx 0;
  158. font-size: 26rpx;
  159. color: $Theme-Color;
  160. }
  161. .bind-btn {
  162. font-size: 28rpx;
  163. width: 100%;
  164. height: 80rpx;
  165. background-color: $Theme-Color;
  166. border-radius: 10rpx;
  167. text-align: center;
  168. line-height: 80rpx;
  169. color: #fff;
  170. margin-top: 20rpx;
  171. }
  172. }
  173. </style>