| 1234567891011121314151617181920212223242526272829303132 |
- <script>
- export default {
- created() {
- const code = this.getUrlKey("code")
- const hostname = document.location.hostname;
- if(code){
- let params = {}
- params.code = code
- params.hostname = hostname
- this.$store.dispatch("WxLogin", params).then((res) => {
- this.$router.push({ path: "/" });
- // this.$router.push({ path: "/register" });
- }).catch((res) => {
- // console.log(code)
- // this.$router.push({ path: "/login" });
- this.$router.push({ path: "/register" });
- });
- }else{
- // this.$router.push({ path: "/login" });
- this.$router.push({ path: "/register" });
- }
- },
- render: function(h) {
- return h() // avoid warning message
- },
- methods: {
- getUrlKey(name) {
- return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.href) || [, ""])[1].replace(/\+/g, '%20')) || null
- },
- }
- }
- </script>
|