杨磊
4 天以前 ef37c59e055a990ce247b265b27d3fcef430a243
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
<template>
  <div class="bingBox">
    <p class="title">微信绑定</p>
    <div class="qrcodeBox">
      <wxlogin
        :redirect_uri="wxLogin.redirectURL"
        style="
          width: 300px;
          height: 340px;
          margin: -40px auto 0;
          overflow: hidden;
        "
        :appid="wxLogin.appid"
        :scope="wxLogin.scope"
        state="WeChatScanningCodeBind"
      >
      </wxlogin>
    </div>
    <p class="tips">使用微信扫一扫扫描二维码进行绑定</p>
  </div>
</template>
<script>
import wxlogin from "vue-wxlogin";
export default {
  components: {
    wxlogin
  },
  data() {
    return {
      wxLogin: {
        appid: "wxad15251431e1f3fd",
        scope: "snsapi_login",
        redirectURL: encodeURIComponent(
          "https://www.caupress.com.cn/website/#/bindWeChatBack"
        )
      }
    };
  },
  created() {
    this.weChatBindFun();
  },
  methods: {
    weChatBindFun() {
      window.location.href = `https://open.weixin.qq.com/connect/qrconnect?appid=${this.wxLogin.appid}&scope=${this.wxLogin.scope}&redirect_uri=${this.wxLogin.redirectURL}&state=WeChatScanningCodeBind`
    },
  }
};
</script>
<style lang="less" scoped>
.title {
  text-align: center;
  font-size: 20px;
  padding-top: 50px;
  margin-bottom: 10px;
}
.qrcodeBox {
  overflow: hidden;
}
.tips{
  text-align: center;
  font-size: 14px;
  color: #666;
  margin-top: 10px;
}
</style>