user-info.html 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>个人资料-创业帮</title>
  6. <meta name="keywords" content="个人资料-创业帮">
  7. <meta name="description" content="个人资料-创业帮">
  8. <meta content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,shrink-to-fit=no,user-scalable=no" name="viewport" viewport="cover">
  9. <meta name="apple-mobile-web-app-capable" content="yes">
  10. <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
  11. <meta content="telephone=no" name="format-detection">
  12. <meta content="email=no" name="format-detection">
  13. <meta name="apple-mobile-web-app-title" content="个人资料-创业帮">
  14. <meta http-equiv="Cache-Control" content="no-siteapp">
  15. <link rel="stylesheet" href="./static/css/crop.css">
  16. <link rel="stylesheet" href="./static/css/main.css">
  17. </head>
  18. <body class="bgc-back">
  19. <div id="app">
  20. <van-nav-bar class="user_rank_explan_title user_title_normal" left-arrow title="个人资料" v-if="toptitleisshow" @click-left="goback">
  21. <template #left> <img src="./static/images/left.png" alt=""></template>
  22. </van-nav-bar>
  23. <van-cell-group class="top_line user_info_userphoto" :border="false" v-cloak>
  24. <van-cell is-link center @click="uploadphoto">
  25. <template #title><span>头像</span></template>
  26. <template #default><img class="user-info-header" :src="PublicLib.CachePicture({picUrl:userinfo.HeadPhoto,domid:'usercenterimg'})" id="usercenterimg" style="border-radius:50%;"></template>
  27. </van-cell>
  28. <van-cell title="姓名" :value="userinfo.RealName"></van-cell>
  29. </van-cell-group>
  30. <van-cell-group class="bt8f7f7f7" :border="false" v-cloak>
  31. <van-cell title="手机" :value="userinfo.Mobile"></van-cell>
  32. <van-cell title="我的推荐码">
  33. <template #right-icon>
  34. <div class="f12 dib c999 pr16" id="inviteCode">{{userinfo.MakerCode}}</div>
  35. <van-button plain size="mini" :data-clipboard-text="userinfo.MakerCode" data-clipboard-action="copy" data-clipboard-target="#inviteCode" ref="copy" @click="copyCode">复制</van-button>
  36. </template>
  37. </van-cell>
  38. <van-cell title="我的名片" is-link @click="mycard">
  39. <template #default>
  40. <van-icon name="qr"></van-icon>
  41. </template>
  42. </van-cell>
  43. </van-cell-group>
  44. <input type="file" accept="image/*" id="upload" style="display:none;">
  45. </div>
  46. <script src="./static/js/klm-vv.min.js"></script>
  47. <script src="./static/js/clipboard.min.js"></script>
  48. <script src="./static/js/klm-axios-config.js"></script>
  49. <script src="./static/js/exif.js"></script>
  50. <script src="./static/js/transformation-matrix.js"></script>
  51. <script src="./static/js/prefix-umd.js"></script>
  52. <script src="./static/js/index.js"></script>
  53. <script>
  54. //上回后回调方法,用于调用缩放、裁切、旋转功能
  55. function AppUpload(imgpath) {
  56. setTimeout(function () {
  57. WapCropForApp(800, 800, 'upload', imgpath, 1);
  58. }, 300);
  59. };
  60. //裁切结束后回调方法
  61. function ShowPhoto(url) {
  62. //获取最终的图片地址
  63. app.uploadheadhpotofn(url);
  64. };
  65. //初始化crop
  66. if (isWeb) {
  67. PublicLib.WapCrop(1000, 1000, 'upload', 1);
  68. };
  69. // 通过 CDN 引入时不会自动注册 Lazyload 组件
  70. // 可以通过下面的方式手动注册
  71. Vue.use(vant.Lazyload);
  72. // 在 #app 标签下渲染一个按钮组件
  73. let app = new Vue({
  74. el: '#app',
  75. data() {
  76. return {
  77. toptitleisshow:false,
  78. active: 0,
  79. isRealAuth: true,
  80. checked: false,
  81. copyBtn: {},
  82. userinfo:{
  83. HeadPhoto:"",
  84. }
  85. };
  86. },
  87. created() {
  88. this.toptitleisshow = toptitleisshow;
  89. this.getuserinfo();
  90. const that = this;
  91. this.$nextTick(()=>{
  92. that.copyBtn = new ClipboardJS(this.$refs.copy);
  93. })
  94. },
  95. methods: {
  96. async getuserinfo(){
  97. PublicLib.ShowLoading({Message:''});
  98. const Id = PublicLib.getCookieInfo('userId');
  99. const res = await getRequest('/api/v1/users/personalinfo',JSON.stringify({Id}));
  100. if(res.status !== '1') return tips('获取创客信息失败!')
  101. PublicLib.HideLoading();
  102. this.userinfo = res.data;
  103. //- this.userinfo.InviteMobile = '111111';
  104. },
  105. giveToast(str){
  106. vant.Toast(str);
  107. },
  108. copyCode(){
  109. const that = this;
  110. const clipboard = that.copyBtn;
  111. clipboard.on('success', function(e) {
  112. that.giveToast('复制成功');
  113. });
  114. clipboard.on('error', function(e) {
  115. that.giveToast('复制失败,请手动选择复制!');
  116. });
  117. },
  118. //- 点击了我的名片
  119. mycard(){
  120. PublicLib.Goto({Url:'user-myqrcode'});
  121. },
  122. //- 拨打电话
  123. takephone(phonenum){
  124. PublicLib.PhoneCall(phonenum);
  125. },
  126. goback(){
  127. PublicLib.GoBack({Level:1});
  128. },
  129. //- 上传头像
  130. uploadphoto(){
  131. PublicLib.UploadPhoto({
  132. Quality:1,
  133. });
  134. },
  135. //- 上传头像到个人资料
  136. async uploadheadhpotofn(HeadPhoto){
  137. const Id = PublicLib.getCookieInfo('userId');
  138. const res = await postRequest('/api/v1/users/uploadheadphoto',JSON.stringify({Id,HeadPhoto}));
  139. if(res.status !== '1') return tips('上传头像失败,请重试!')
  140. tips('上传头像成功!');
  141. this.userinfo.HeadPhoto = showHost + HeadPhoto;
  142. }
  143. }
  144. });
  145. </script>
  146. </body>
  147. </html>