| | |
| | | <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=", // 自定义样式链接 |
| | | loginForm: { |
| | |
| | | }, |
| | | }, |
| | | mounted() { |
| | | 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)); |
| | | this.$router.push("/student"); |
| | | }); |
| | | }, |
| | | getWeChatUrl() { |
| | | // api.wachatQrUrl().then(res => { |
| | | // if (res && res.code === '0000') { |
| | |
| | | <script> |
| | | import { getData, getRenew, getExpire, getDeleted, handleExport } from "@/api/student"; |
| | | import StudentCreate from "./components/create.vue"; |
| | | import { login } from "@/api/user"; |
| | | |
| | | |
| | | export default { |
| | | filters: { |
| | |
| | | }, |
| | | created() { |
| | | // 获取地址栏code |
| | | let code = this.$route.query.code; |
| | | if (code) { |
| | | if (localStorage.getItem("code")) { |
| | | if (code !== localStorage.getItem("code")) { |
| | | this.getUserDate(code); |
| | | } |
| | | } else { |
| | | this.getUserDate(code); |
| | | } |
| | | } else { |
| | | if (!localStorage.getItem("user")) { |
| | | this.$router.push("/login"); |
| | | } |
| | | } |
| | | // let code = this.$route.query.code; |
| | | // if (code) { |
| | | // if (localStorage.getItem("code")) { |
| | | // if (code !== localStorage.getItem("code")) { |
| | | // this.getUserDate(code); |
| | | // } |
| | | // } else { |
| | | // this.getUserDate(code); |
| | | // } |
| | | // } else { |
| | | // if (!localStorage.getItem("user")) { |
| | | // this.$router.push("/login"); |
| | | // } |
| | | // } |
| | | if (localStorage.getItem("user")) { |
| | | this.fetchData(); |
| | | } else { |
| | | this.$router.push("/login"); |
| | | } |
| | | }, |
| | | methods: { |
| | | getUserDate(code) { |
| | | login({ |
| | | code: code, |
| | | }).then((res) => { |
| | | localStorage.setItem("user", JSON.stringify(res)); |
| | | localStorage.setItem("code", code); |
| | | window.location.reload(); |
| | | }); |
| | | }, |
| | | handleExport() { |
| | | this.download('exportPlayer?orgId=' + JSON.parse(localStorage.getItem("user")).staffs[0].org.id, { |
| | | }, `导出_${new Date().getTime()}.xlsx`) |