| | |
| | | <script> |
| | | import { validUsername } from "@/utils/validate"; |
| | | import wxlogin from "vue-wxlogin"; |
| | | import { login } from "@/api/user"; |
| | | export default { |
| | | name: "Login", |
| | | components: { wxlogin }, |
| | |
| | | }; |
| | | return { |
| | | appid: "wx7103925df6236723", |
| | | redirect_uri: encodeURIComponent("https://dingdang.9village.cn/#/student"), |
| | | redirect_uri: encodeURIComponent("https://dingdang.9village.cn/#/login"), |
| | | state: "1", |
| | | href: "data:text/css;base64,LmltcG93ZXJCb3ggLnFyY29kZSB7CiAgICAgICAgICBib3JkZXI6IG5vbmU7CiAgICAgICAgICB3aWR0aDogMTQwcHg7CiAgICAgICAgICBoZWlnaHQ6IDE0MHB4OwogICAgICAgIH0=", // 自定义样式链接 |
| | | href: "data:text/css;base64,LmltcG93ZXJCb3ggLnFyY29kZSB7d2lkdGg6IDIwMHB4O30KLmltcG93ZXJCb3ggLnRpdGxlIHtkaXNwbGF5OiBub25lO30KLmltcG93ZXJCb3ggLmluZm8ge3dpZHRoOiAyMDBweDt9Ci5zdGF0dXNfaWNvbiB7ZGlzcGxheTogbm9uZX0KLmltcG93ZXJCb3ggLnN0YXR1cyB7dGV4dC1hbGlnbjogY2VudGVyO30g", // 自定义样式链接 |
| | | loginForm: { |
| | | username: "admin", |
| | | password: "111111", |
| | |
| | | immediate: true, |
| | | }, |
| | | }, |
| | | beforeRouteUpdate(route, from, next) { |
| | | this.redirect = route.query && route.query.redirect; |
| | | let code = route.query.code; |
| | | if (code) { |
| | | this.getUserDate(code); |
| | | } else { |
| | | this.getWeChatUrl(); |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.getWeChatUrl(); |
| | | let code = this.$route.query.code; |
| | | if (code) { |
| | | this.getUserDate(code); |
| | | } else { |
| | | this.getWeChatUrl(); |
| | | } |
| | | }, |
| | | methods: { |
| | | getUserDate(code) { |
| | | login({ |
| | | code: code, |
| | | }).then((res) => { |
| | | localStorage.setItem("user", JSON.stringify(res)); |
| | | localStorage.setItem("staffs", JSON.stringify(res.staffs)); |
| | | localStorage.setItem("selectStaff", JSON.stringify(res.staffs[0])); |
| | | this.$router.push("/student"); |
| | | }); |
| | | }, |
| | | getWeChatUrl() { |
| | | // api.wachatQrUrl().then(res => { |
| | | // if (res && res.code === '0000') { |
| | |
| | | user-select: none; |
| | | } |
| | | } |
| | | |
| | | .main_wx{ |
| | | height: 360px; |
| | | margin-bottom: 100px; |
| | | } |
| | | </style> |