authorization.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <div class="authorization">
  3. <div class="sohuquan">
  4. <h1 style="font-weight: 400; color: #777777">点击授权登录</h1>
  5. <div class="platform">
  6. <img v-for="item in platformLsit" @click="() => toClick(item)" :key="item.url" :src="item.url" />
  7. </div>
  8. <div class="text">
  9. <span class="textarea">授权登录平台</span>
  10. </div>
  11. </div>
  12. </div>
  13. </template>
  14. <script setup>
  15. import ajax from '../../utils/request';
  16. import { ref } from 'vue';
  17. // import config from '../../config/index';
  18. const platformLsit = ref([
  19. {
  20. code: '/oauth/douyin/code',
  21. url: 'https://import.smcic.net/img/douyin.png',
  22. },
  23. {
  24. code: '/oauth/kuaishou/code',
  25. url: 'https://import.smcic.net/img/kuaishou.png',
  26. },
  27. {
  28. code: '/oauth/weixin/code',
  29. url: 'https://import.smcic.net/img/weixin.png',
  30. },
  31. {
  32. code: '/oauth/bilibili/code',
  33. url: 'https://import.smcic.net/img/bilibili.png',
  34. },
  35. {
  36. code: '/oauth/weibo/code',
  37. url: 'https://import.smcic.net/img/weibo.png',
  38. },
  39. {
  40. code: '/oauth/toutiao/code',
  41. url: 'https://import.smcic.net/img/toutiao.png',
  42. },
  43. ]);
  44. const toClick = item => {
  45. if(!item.code) return;
  46. ajax({
  47. api: item.code,
  48. data: {},
  49. headers: {
  50. Authorization: localStorage.getItem("token")
  51. }
  52. }).then(r=>{
  53. if(location.replace) location.replace(r.url);
  54. else location.href = r.url;
  55. })
  56. }
  57. </script>
  58. <style scoped></style>
  59. <style>
  60. .authorization {
  61. width: 100vw;
  62. height: 100vh;
  63. position: relative;
  64. background-image: url(https://import.smcic.net/img/bg.png);
  65. background-size: 100% 100%;
  66. background-repeat: no-repeat;
  67. }
  68. .sohuquan {
  69. position: absolute;
  70. top: 50%;
  71. right: 3em;
  72. transform: translateY(-50%);
  73. background-color: #fff;
  74. padding: 1em;
  75. border-radius: 5px;
  76. width: 55%;
  77. max-width: 500px;
  78. text-align: center;
  79. }
  80. .platform {
  81. margin: 1.5em 0;
  82. }
  83. .platform img {
  84. display: inline-block;
  85. max-width: 55px;
  86. margin-right: 5px;
  87. }
  88. .text {
  89. border-top: 1px solid #fdc112;
  90. color: #fdc112;
  91. font-size: 20px;
  92. margin: 3em 0 1em 0;
  93. }
  94. .text .textarea {
  95. margin-top: -1.5em;
  96. background: #fff;
  97. display: inline-block;
  98. padding: 0 1em;
  99. }
  100. </style>