zhaoxiaoqiang
2022-08-05 1e3e3593a39d743d5dfa8491a9abb95b8be4f079
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<!--
 * @Author: 小明丶
 * @Date: 2020-06-04 09:55:50
 * @LastEditors: zxq
 * @LastEditTime: 2022-08-05 09:43:56
 * @Description:
-->
<template>
  <div></div>
</template>
<script>
import { mapActions } from "vuex";
import Vue from "vue";
import { RadioGroup, Radio } from "vant";
import { Checkbox, CheckboxGroup } from "vant";
import { GoWeChat } from "../../utils/wechat";
 
Vue.use(Checkbox);
Vue.use(CheckboxGroup);
Vue.use(Radio);
Vue.use(RadioGroup);
 
export default {
  data() {
    return {};
  },
  created() {
    var _this = this;
    // localStorage.axx_ins_client_openId = 'oJbj21YwUatdNaYf3iEPwwGtWuUg'
    // localStorage.axx_ins_client_userMation = '{"openid":"oGGPLs2yZ5tiBnB9iYcZrV60DoqM","nickname":"乌卡拉卡","sex":"1","province":"四川","city":"成都","country":"中国","headimgurl":"http://thirdwx.qlogo.cn/mmopen/vi_32/sYsBGsncFia9ql7K5stRibY61BSjDkPkNQFiasqdHiczTwbnX7JeZhcrp49RZD9icFTDLd2JqUjIrHHVw0f52kE4Uibw/132"}'
    // this.$router.push("/login");
    //本地是否存储有openId,有就调用openId登录
    if (localStorage.axx_ins_client_openId && localStorage.axx_ins_client_openId != undefined) {
      //this.$router.push("/login");
      this.openIdLogin({
          vm: _this,
          openId: localStorage.axx_ins_client_openId
        });
    } else {
     this.$router.push("/login");
    }
  },
  methods: {
    ...mapActions(["login", "getVercode", "openIdLogin"]),
    //截取code值
    getUrlCode(name) {
      return (
        decodeURIComponent(
          (new RegExp("[?|&]" + name + "=" + "([^&;]+?)(&|#|;|$)").exec(
            location.href
          ) || [, ""])[1].replace(/\+/g, "%20")
        ) || null
      );
    },
    //登录验证
    loginBut() {
        // 无openId跳转授权,有就执行openId登录
      //if (!localStorage.axx_ins_client_openId || localStorage.axx_ins_client_openId == undefined) {
        let url = location.host
        //console.log(location.href)
        //console.log("准备跳转");   wx594ab33e0466eccf
        //var str = encodeURIComponent("https://t.finlean.com/aic_cus/#/login");
        var str = encodeURIComponent(`https://${url}/aic_cus/#/login`);
        //goWeChat("wx9bfa36fe433b079a", str); //四个参数appid-公众号id,redirect_uri-回调链接,scope-授权模式,state-重定向将会带上的state参数
        var fn = new GoWeChat("wx581e3447c6cad0d6", str);
        fn.gocontract()
      // } else {
 
      // }
    }
  }
};
</script>