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.0 kB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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>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. window.location.href = this.$Cookies.get('redirect_to')
  71. }
  72. }, 1000)
  73. },
  74. },
  75. mounted() {
  76. this.getWxQrcode(false)
  77. // let QrcodeData = $("#WxAutorize-qrcode").val()
  78. // this.wx_qrcodeImg = 'https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket='+QrcodeData
  79. },
  80. created() {
  81. }
  82. };
  83. </script>
  84. <style scoped>
  85. .el-icon-loading{
  86. position: absolute;
  87. font-size: 32px;
  88. color: #bcbcbc;
  89. top: calc(50% - 16px);
  90. left: calc(50% - 16px);
  91. animation: rotating 2s linear infinite;
  92. }
  93. .wx-title{
  94. font-family: SourceHanSansSC-medium;
  95. font-size: 24px;
  96. color: rgba(16, 16, 16, 100);
  97. }
  98. .wx-desc-top{
  99. font-size: 14px;
  100. color: rgba(16, 16, 16, 100);
  101. font-family: SourceHanSansSC-light;
  102. }
  103. .qrcode{
  104. width: 200px;
  105. height: 200px;
  106. line-height: 180px;
  107. text-align: center;
  108. position: relative;
  109. }
  110. .wx-login{
  111. display: flex;
  112. flex-direction: column;
  113. align-items: center;
  114. margin-top: 24px;
  115. }
  116. .wx-qrcode{
  117. width: 100%;
  118. height: 100%;
  119. }
  120. .wx-qrcode-reload{
  121. width: 100%;
  122. height: 100%;
  123. left: 0px;
  124. top: 0px;
  125. position: absolute;
  126. cursor: pointer;
  127. }
  128. .wx-desc-bottom{
  129. color: rgba(145, 145, 145, 100);
  130. font-size: 14px;
  131. font-family: SourceHanSansSC-regular;
  132. }
  133. .user-agreement{
  134. display: flex;
  135. align-items: center;
  136. justify-content: center;
  137. margin-top: 51px;
  138. color: rgba(16, 16, 16, 100);
  139. font-size: 14px;
  140. font-family: SourceHanSansSC-regular;
  141. }
  142. .orange{
  143. color: #f2711c;
  144. }
  145. </style>