You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

WxAutorize.vue 4.2 kB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <template>
  2. <div>
  3. <div class="ui container">
  4. <div class="ui placeholder segment bgtask-none">
  5. <div class="bgtask-content-header">
  6. <h2 class="wx-title">微信扫码认证</h2>
  7. <p class="wx-desc-top">请绑定微信,然后再使用启智算力环境</p>
  8. </div>
  9. <div class="wx-login">
  10. <div class="qrcode" >
  11. <img class="wx-qrcode" :src="wx_qrcodeImg" v-show="!!wx_qrcodeImg">
  12. <span class="el-icon-loading" v-show="wxLoading"></span>
  13. <img class="wx-qrcode-reload" v-if="qrCodeReload" @click="getWxQrcode(true)" src="https://files.wondercv.com/auth/qrcode_reload.png">
  14. </div>
  15. <div class="wx-desc-bottom" style="color:#919191">微信扫码关注公众号即可完成绑定</div>
  16. </div>
  17. <div class="user-agreement">
  18. <i class="ri-information-line orange"></i>绑定微信代表已阅读并接受<a href="/home/term/"> OpenI启智社区AI协作平台使用协议</a>
  19. </div>
  20. </div>
  21. </div>
  22. </div>
  23. </template>
  24. <script>
  25. const {_AppSubUrl, _StaticUrlPrefix, csrf} = window.config;
  26. export default {
  27. components: {
  28. },
  29. data() {
  30. return {
  31. wx_qrcodeImg:'',
  32. wxLoading:false,
  33. isLogin:false,
  34. SceneStr:'',
  35. status:'',
  36. qrCodeReload:false
  37. };
  38. },
  39. methods: {
  40. getWxQrcode(reloadFlag) {
  41. if(reloadFlag){
  42. this.qrCodeReload=false
  43. }
  44. this.wxLoading = true
  45. this.$axios.get('/authentication/wechat/qrCode4Bind').then((res)=>{
  46. let ticket = res.data.data.Ticket
  47. this.SceneStr = res.data.data.SceneStr
  48. this.wx_qrcodeImg = 'https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket='+ticket
  49. this.wxLoading = false
  50. this.WxqrCheck()
  51. })
  52. },
  53. WxqrCheck(){
  54. this.$axios.get(`/authentication/wechat/bindStatus?sceneStr=${this.SceneStr}`).then((res)=>{
  55. this.status = res.data.data.status
  56. this.isLogin = true
  57. })
  58. }
  59. },
  60. watch:{
  61. isLogin: function () {
  62. let times = setInterval(async () => {
  63. if (this.status===0) {
  64. this.WxqrCheck()
  65. } else if (this.status === 9) {
  66. this.qrCodeReload=true
  67. } else if (this.status === 2) {
  68. //用户登录成功后清除定时器
  69. clearInterval(times)
  70. $('.alert').html('绑定成功!').removeClass('alert-danger').addClass('alert-success').show().delay(1500).fadeOut();
  71. window.location.href = this.$Cookies.get('redirect_to')
  72. }
  73. }, 1000)
  74. },
  75. },
  76. mounted() {
  77. this.getWxQrcode(false)
  78. // let QrcodeData = $("#WxAutorize-qrcode").val()
  79. // this.wx_qrcodeImg = 'https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket='+QrcodeData
  80. },
  81. created() {
  82. }
  83. };
  84. </script>
  85. <style scoped>
  86. .el-icon-loading{
  87. position: absolute;
  88. font-size: 32px;
  89. color: #bcbcbc;
  90. top: calc(50% - 16px);
  91. left: calc(50% - 16px);
  92. animation: rotating 2s linear infinite;
  93. }
  94. .wx-title{
  95. font-family: SourceHanSansSC-medium;
  96. font-size: 24px;
  97. color: rgba(16, 16, 16, 100);
  98. }
  99. .wx-desc-top{
  100. font-size: 14px;
  101. color: rgba(16, 16, 16, 100);
  102. font-family: SourceHanSansSC-light;
  103. }
  104. .qrcode{
  105. width: 200px;
  106. height: 200px;
  107. line-height: 180px;
  108. text-align: center;
  109. position: relative;
  110. }
  111. .wx-login{
  112. display: flex;
  113. flex-direction: column;
  114. align-items: center;
  115. margin-top: 24px;
  116. }
  117. .wx-qrcode{
  118. width: 100%;
  119. height: 100%;
  120. }
  121. .wx-qrcode-reload{
  122. width: 100%;
  123. height: 100%;
  124. left: 0px;
  125. top: 0px;
  126. position: absolute;
  127. cursor: pointer;
  128. }
  129. .wx-desc-bottom{
  130. color: rgba(145, 145, 145, 100);
  131. font-size: 14px;
  132. font-family: SourceHanSansSC-regular;
  133. }
  134. .user-agreement{
  135. display: flex;
  136. align-items: center;
  137. justify-content: center;
  138. margin-top: 51px;
  139. color: rgba(16, 16, 16, 100);
  140. font-size: 14px;
  141. font-family: SourceHanSansSC-regular;
  142. }
  143. .orange{
  144. color: #f2711c;
  145. }
  146. </style>