<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>我的二维码-创业帮</title>
    <meta name="keywords" content="我的二维码-创业帮">
    <meta name="description" content="我的二维码-创业帮">
    <meta content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,shrink-to-fit=no,user-scalable=no" name="viewport" viewport="cover">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <meta content="telephone=no" name="format-detection">
    <meta content="email=no" name="format-detection">
    <meta name="apple-mobile-web-app-title" content="我的二维码-创业帮">
    <meta http-equiv="Cache-Control" content="no-siteapp">
    <link rel="stylesheet" href="./static/css/main.css">
  </head>
  <body class="bgc-back ovh">
    <div class="iphonetitle"> </div>
    <div id="app">
      <van-nav-bar class="camp_title f16" title="我的二维码" v-if="toptitleisshow" @click-left="goback" right-text="保存" @click-right="rightbtn" left-arrow v-cloak>
        <template #left> 
          <van-icon name="arrow-left" color="#333" size="20"></van-icon>
        </template>
      </van-nav-bar>
      <div class="myqrcode" v-cloak>
        <div class="bgcfff tc shadow03">
          <div class="myqrcode-img rel">
            <div class="abs" id="qrcode">  <img :src="invitedcode" alt="" style="width:100%;"></div>
          </div>
          <div class="myqrcode-info df pt16 pb16" v-cloak>
            <div class="user-info cm flex1">
              <div class="tl">
                <div class="f14 c333"><span class="vm">{{name}} {{number}}  </span></div>
                <div class="f12 c333 op7">扫我加入创业帮</div>
              </div>
            </div>
            <div class="user-img">
              <van-image width="100%" :src="HeadPhoto" fit="cover" lazy-load round>
                <template v-slot:loading><img src="./static/images/user-img@3x.png" alt="" width="100%"></template>
              </van-image>
            </div>
          </div>
        </div>
      </div>
    </div> 
    <script src="./static/js/klm-vv.min.js"></script>
    <script src="./static/js/appfunc.min.js"></script>
    <script src="./static/js/klm-axios-config.js"></script>
    <script src="./static/js/publicfn.js"></script>
    <script>
      // 通过 CDN 引入时不会自动注册 Lazyload 组件
      // 可以通过下面的方式手动注册
      Vue.use(vant.Lazyload);
      //--- PublicLib.SetStatusBarStyle({type:'light', isShow:1});
      // 在 #app 标签下渲染一个按钮组件
      let app = new Vue({
        el: '#app',
        data() {
          return {
            toptitleisshow:true,
            active: 0,
            HeadPhoto: '',
            isShow: true,
            name:'',
            number:'',
            invitedcode:'',
          };
        },
        created() {
          //- 二维码图片连接由后端发送
          //- this.badgeisshow = true 
          //- setTimeout(()=>{
          //- new QRCode('qrcode', {
          //- text: this.qrcode,
          //- width: 200,
          //- height: 200,
          //- colorDark : '#000',
          //- colorLight : '#fff',
          //- correctLevel : QRCode.CorrectLevel.H
          //- });
          //- })
          this.getuserinfo();
        },
        methods: {
          async getuserinfo(){
            PublicLib.ShowLoading({Message:''});
            const Id = PublicLib.getCookieInfo('userId');
            const res = await getRequest('api/v1/users/mycard?t='+Math.random(6),JSON.stringify({Id}));
            if(res.status !== '1')return tips('获取个人信息失败!请刷新重试');
            PublicLib.HideLoading();
            //- 个人信息
            this.name = res.data.RealName;
            this.number = res.data.MakerCode;
            this.invitedcode = res.data.InvitePhoto;
            this.HeadPhoto = res.data.HeadPhoto;
          },
          goback(){
            PublicLib.GoBack({Level:1});
          },
          //- 点击保存
          rightbtn:undebounce(function(){
            PublicLib.SaveToSd({PicPath:this.invitedcode});
          }),
        }
      });
    </script>
  </body>
</html>