Login.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <template>
  2. <div class="bodyImg">
  3. <div class="container">
  4. <div class="log-paper">
  5. <img src="../assets/img/Land_sbg.png">
  6. </div>
  7. <div class="log-container">
  8. <img class="log-icon" src="../assets/img/log.png">
  9. <div class="log-text">欢迎登陆私塾家在线人员管理后台</div>
  10. <div @click="WxLoginCtl" class="log-qrcode">
  11. <div id="login_container"></div>
  12. <!-- <img class="log-qrcode-image" src="../assets/img/ssj_qrcode.png"> -->
  13. </div>
  14. </div>
  15. </div>
  16. </div>
  17. </template>
  18. <script>
  19. // import { mapActions } from "vuex";
  20. // import wx from 'weixin-js-sdk'
  21. // import $ from 'jquery'
  22. export default {
  23. name: "login",
  24. data() {
  25. return {};
  26. },
  27. watch: {},
  28. created() {
  29. this.getTKByUnionid();
  30. },
  31. methods: {
  32. WxLoginCtl() {
  33. // this.$router.push({
  34. // path: "/aikmt/Redirect_uri",
  35. // query: {
  36. // unionid: "oPHg8wXraekgH5YKVHvD3H7Ujynw"
  37. // }
  38. // });
  39. },
  40. async getTKByUnionid() {
  41. if (window.location.href.indexOf("unionid") >= 0) {
  42. // 如果url中包含unionid,则保存到store中
  43. let unionid = window.location.href.split("?")[1];
  44. unionid = unionid.substring(8);
  45. let WxCode = unionid;
  46. this.WxCode = WxCode;
  47. localStorage.setItem("unionid", this.WxCode);
  48. this.$store.dispatch("UnionidLogin", {
  49. unionid: this.WxCode
  50. });
  51. }
  52. if (window.location.href.indexOf("code") >= 0) {
  53. // 如果url中包含code,则保存到store中
  54. let code = window.location.href.split("?")[1];
  55. code = code.substring(5, code.indexOf("&"));
  56. let WxCode = code;
  57. this.WxCode = WxCode;
  58. console.log("获取Code" + this.WxCode);
  59. this.$store.dispatch("GET_TOKEN", {
  60. code: this.WxCode
  61. });
  62. }
  63. return
  64. }
  65. },
  66. mounted() {
  67. var obj = new WxLogin({
  68. self_redirect: false,
  69. id: "login_container",
  70. appid: "wxd18ca9555a939281",
  71. scope: "snsapi_login",
  72. redirect_uri: encodeURIComponent(
  73. "https://kmt.sharingschool.com/aijia/manager/index.html"
  74. ),
  75. state: "",
  76. style: "width: 250px",
  77. href: ""
  78. });
  79. }
  80. };
  81. </script>
  82. <style scoped>
  83. body {
  84. background-image: url(../assets/img/Land_bg.png);
  85. background-size: 100% auto;
  86. }
  87. .bodyImg{
  88. background-image: url(../assets/img/Land_bg.png);
  89. background-size: 100% auto;
  90. height: 1000px!important;
  91. }
  92. .container {
  93. max-height: 70%;
  94. position: absolute;
  95. top: 50%;
  96. left: 50%;
  97. -webkit-transform: translate(-50%, -50%);
  98. -moz-transform: translate(-50%, -50%);
  99. -ms-transform: translate(-50%, -50%);
  100. -o-transform: translate(-50%, -50%);
  101. transform: translate(-50%, -50%);
  102. max-width: 70%;
  103. background: #ffffff;
  104. -webkit-box-shadow: 0 0 20px 0 rgba(50, 103, 0, 0.2);
  105. -webkit-border-radius: 4px;
  106. box-shadow: 0 0 20px 0 rgba(50, 103, 0, 0.2);
  107. border-radius: 4px;
  108. padding: 5%;
  109. }
  110. .log-paper {
  111. width: 45%;
  112. margin-right: 5%;
  113. float: left;
  114. }
  115. .log-paper img {
  116. width: 90%;
  117. }
  118. .log-container {
  119. width: 50%;
  120. margin-left: 5%;
  121. float: right;
  122. text-align: center;
  123. }
  124. .log-icon {
  125. width: 40%;
  126. }
  127. .log-text {
  128. font-size: 1.8em;
  129. color: #52cc60;
  130. margin: 0.5rem auto;
  131. }
  132. .log-qrcode {
  133. width: 70%;
  134. background: #ffffff;
  135. -webkit-box-shadow: 0 2px 10px 0 rgba(157, 166, 195, 0.3);
  136. box-shadow: 0 2px 10px 0 rgba(157, 166, 195, 0.3);
  137. padding: 10%;
  138. margin: 5% 10%;
  139. }
  140. .log-qrcode-image {
  141. width: 100%;
  142. }
  143. *,
  144. ::after,
  145. ::before {
  146. box-sizing: content-box;
  147. }
  148. .log-qrcode-text {
  149. margin-top: 1.5rem;
  150. font-size: 1em;
  151. color: #808080;
  152. }
  153. @media (min-width: 0px) and (max-width: 767px) {
  154. .container {
  155. width: 750px;
  156. }
  157. .log-paper {
  158. width: 0%;
  159. }
  160. .log-container {
  161. width: 100%;
  162. }
  163. }
  164. @media (min-width: 768px) and (max-width: 991px) {
  165. .container {
  166. width: 750px;
  167. }
  168. .log-paper {
  169. width: 45%;
  170. margin-top: 5%;
  171. }
  172. .log-container {
  173. width: 40%;
  174. }
  175. }
  176. @media (min-width: 992px) {
  177. .container {
  178. width: 970px;
  179. }
  180. .log-paper {
  181. width: 45%;
  182. }
  183. .log-container {
  184. width: 40%;
  185. }
  186. }
  187. @media (min-width: 1200px) {
  188. .container {
  189. width: 1170px;
  190. }
  191. }
  192. body {
  193. background: #f6f7fb;
  194. -webkit-font-smoothing: subpixel-antialiased;
  195. }
  196. .color-green {
  197. color: #52cc60 !important;
  198. }
  199. .color-purple {
  200. color: #612d00 !important;
  201. }
  202. .fontweight {
  203. font-weight: bold;
  204. }
  205. .text-indent {
  206. text-indent: 2.6rem;
  207. }
  208. .nodata {
  209. text-align: center;
  210. padding: 250px 20px !important;
  211. }
  212. .nodata p {
  213. padding-top: 50px;
  214. font-size: 18px;
  215. color: #65b800;
  216. }
  217. /* 适应1366 */
  218. /* @media screen and (max-width: 1366px) {
  219. .isShow1 {
  220. display: none;
  221. }
  222. .isShow2 {
  223. display: block;
  224. }
  225. .isShow3 {
  226. display: none;
  227. }
  228. .isShow4 {
  229. display: block;
  230. }
  231. } */
  232. </style>