user-ranking.html 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  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="telephßone=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/main.css">
  16. <style>
  17. .bgcstrong {background-color: #494965; background-image:none !important;}
  18. .ranking{background-image: linear-gradient(to bottom, #494965, #6C6D8C);height:100%;}
  19. .van-nav-bar{background-color:rgba(0,0,0,0);}
  20. .title{width:3.5467rem;vertical-align:middle;}
  21. .share{width:.56rem;vertical-align:middle;}
  22. .ranking_table{width:100vw;height:8.4267rem;}
  23. .ranking_table .time{margin-top:.08rem;opacity:.5;}
  24. .opt5{opacity:.5;}
  25. .ranking_table .photo{width:1.9733rem;height:1.9733rem;border-radius:50%;background-color:rgba(255,255,255,.6);}
  26. .ranking_table .table{width:100vw;bottom:0;}
  27. .ranking_table .name{margin-top:.16rem;}
  28. .ranking_table .opennum{justify-content:space-evenly;margin-top:.48rem;}
  29. .ranking_table .ranking_1{left:40%;top:-20%;transform:translateX(-50%);width:.8267rem;}
  30. .ranking_table .ranking_2{left:50%;top:50%;transform:translate(-50%,-50%);width:1.8133rem;border-radius:50%;}
  31. .ranking_3{width:.32rem;height:.32rem;margin-right:.1067rem;}
  32. .ranking_table .fir{left:50%;transform:translateX(-50%);top:19%;}
  33. .ranking_table .sec{left:7%;top:28%;}
  34. .ranking_table .thr{right:7%;top:31%;}
  35. .ranking_panel{padding:.8rem .5333rem .5867rem;border-radius:.5333rem .5333rem 0 0;margin-top:-26px;min-height:50vh;}
  36. .ranking_panel .ovh-x{height:100%;width:100%;padding-bottom:60px;box-sizing:border-box;}
  37. .van-cell::after{display: none;}
  38. .margintop{margin-top:.6667rem;}
  39. .ranking_cell {padding:0;height: .8533rem;}
  40. .ranking_cell .van-cell__title .ranking_cell_img {width: .8533rem;height: .8533rem;border-radius: 50%;vertical-align: middle;margin: 0 .2133rem 0 .4267rem; }
  41. .van-cell__title{flex:1.2;}
  42. .van-cell__value{flex:.5;}
  43. .shareimg{width:100%;}
  44. .rank_sharepanel .userinfo{top:51%;left:50%;transform:translateX(-50%);width:100%;}
  45. .rank_sharepanel .userinfo .qrcode{width:1.6rem;height:1.6rem;border-radius:50%;}
  46. .rank_sharepanel .spcolor{color:#F8CC95;}
  47. .lineheight{line-height:.7rem;}
  48. </style>
  49. </head>
  50. <body class="pb0 vh100 ovh" style="box-sizing:border-box;">
  51. <div class="iphonetitle bgcstrong"></div>
  52. <div class="user_ranking" id="app" v-cloak>
  53. <div class="ranking" ref="shareel">
  54. <van-nav-bar @click-left="goback" @click-right="sharebtn" left-arrow v-cloak>
  55. <template #left>
  56. <van-icon name="arrow-left" color="#fff" size="20" v-show="isshare"></van-icon>
  57. </template>
  58. <template #title> <img class="title" src="./static/images/user-ranking-title.png" alt=""></template>
  59. <template #right> <img class="share" src="./static/images/user-ranking-share.png" alt="" v-show="isshare"></template>
  60. </van-nav-bar>
  61. <div class="ranking_table rel">
  62. <div class="time f12 tc cfff">统计时间:{{date.StratTime}}-{{date.EndTime}}</div><img class="table abs" src="./static/images/user-ranking-table.png">
  63. <div class="fir tc abs" @click="makercode = 'K0000014'">
  64. <div class="photo rel"><img class="abs ranking_2" :src="userlist[0].HeadPhoto"><img class="abs ranking_1" src="./static/images/user-ranking-1.png"></div>
  65. <div class="f14 cfff name">{{userlist[0].RealName}}</div>
  66. <div class="f12 opt5 cfff">{{userlist[0].MakerCode}}</div>
  67. <div class="opennum df aic">
  68. <div class="df aic"><img class="ranking_3" src="./static/images/user-ranking-2.png">
  69. <div class="f14 cfff">{{userlist[0].OpenCount}}</div>
  70. </div>
  71. </div>
  72. </div>
  73. <div class="sec tc abs" @click="makercode = 'K0000011'">
  74. <div class="photo rel"><img class="abs ranking_2" :src="userlist[1].HeadPhoto"></div>
  75. <div class="f14 cfff name">{{userlist[1].RealName}}</div>
  76. <div class="f12 opt5 cfff">{{userlist[1].MakerCode}}</div>
  77. <div class="opennum df aic">
  78. <div class="df aic"><img class="ranking_3" src="./static/images/user-ranking-2.png">
  79. <div class="f14 cfff">{{userlist[1].OpenCount}}</div>
  80. </div>
  81. </div>
  82. </div>
  83. <div class="thr tc abs" @click="makercode = 'K0000012'">
  84. <div class="photo rel"><img class="abs ranking_2" :src="userlist[2].HeadPhoto"></div>
  85. <div class="f14 cfff name">{{userlist[2].RealName}}</div>
  86. <div class="f12 opt5 cfff">{{userlist[2].MakerCode}}</div>
  87. <div class="opennum df aic">
  88. <div class="df aic"><img class="ranking_3" src="./static/images/user-ranking-2.png">
  89. <div class="f14 cfff">{{userlist[2].OpenCount}}</div>
  90. </div>
  91. </div>
  92. </div>
  93. </div>
  94. <div class="ranking_panel bgcfff rel ovh">
  95. <div class="ovh-x">
  96. <van-cell class="ranking_cell" v-for="item,index in behinduser" :key="item.UserId" :class="index !== 0 ? 'margintop':''">
  97. <template #title>
  98. <div class="df aic"><span class="f18 c999">{{index + 4}}</span><img class="ranking_cell_img" :src="item.HeadPhoto" alt=""><span class="mr8 f14">{{item.RealName}}</span><span class="f14 c999">{{item.MakerCode}}</span></div>
  99. </template>
  100. <template #default>
  101. <div class="ranking_cell_money ranking_balabce c666"><img class="ranking_3" src="./static/images/user-ranking-2.png"><span class="f18">{{item.OpenCount}}</span><span class="f12">台</span></div>
  102. </template>
  103. </van-cell>
  104. </div>
  105. </div>
  106. </div>
  107. <div class="rel rank_sharepanel" ref="savecard"><img class="shareimg" src="./static/images/user-ranking-firstimg.jpg" alt="">
  108. <div class="abs tc userinfo"><img class="qrcode" :src="userlist[0].HeadPhoto">
  109. <div class="f14 cfff name" style="margin-top:.18rem;">{{userlist[rank].RealName}}</div>
  110. <div class="f12 cfff opt5" style="margin-top:.08rem;">{{userlist[rank].MakerCode}}</div>
  111. <div class="lineheight">
  112. <div class="f14 c999" style="margin-top:.2733rem">在{{date.StratTime}}-{{date.EndTime}}成功开机<span class="spcolor f18">{{userlist[rank].OpenCount}}</span><span>台</span></div>
  113. <div class="f14 c999">成为创业帮平台本周<span class="spcolor f18">[开机达人]</span></div>
  114. <div class="f14 c999">特此鼓励 再接再厉</div>
  115. </div>
  116. </div>
  117. </div>
  118. <van-share-sheet v-model="show" title="立即分享给好友" :options="options" @select="onquerycount"></van-share-sheet>
  119. </div>
  120. <script src="./static/js/klm-vv.min.js"></script>
  121. <script src="./static/js/appfunc.min.js"></script>
  122. <script src="./static/js/klm-axios-config.js"></script>
  123. <script src="./static/js/publicfn.js"></script>
  124. <script src="./static/js/iconfont.js"></script>
  125. <script src="./static/js/html2canvas.js"></script>
  126. <script>
  127. // 在 #app 标签下渲染一个按钮组件
  128. let app = new Vue({
  129. el: '#app',
  130. data() {
  131. return {
  132. makercode:'',
  133. date:{StratTime:'2022.08.08',EndTime:'2022.09.01'},
  134. pageinfo:{
  135. PageSize:10,
  136. PageNum:1
  137. },
  138. isshare:true,
  139. userlist:[
  140. {OpenCount:20,HeadPhoto:'https://thirdwx.qlogo.cn/mmopen/vi_32/OMDImDtH2ia1GSYfPiajE14VecYNA8nu2P2XPJYdjgUQNHlLCFhjwGyP1nB8YjiaTC3ovOMwPmOicTT0FQYbvFZGxA/132',MakerCode:'K0000014',RealName:'王*内1'},
  141. {OpenCount:0,HeadPhoto:'https://thirdwx.qlogo.cn/mmopen/vi_32/OMDImDtH2ia1GSYfPiajE14VecYNA8nu2P2XPJYdjgUQNHlLCFhjwGyP1nB8YjiaTC3ovOMwPmOicTT0FQYbvFZGxA/132',MakerCode:'K0000011',RealName:'王*内2'},
  142. {OpenCount:0,HeadPhoto:'https://thirdwx.qlogo.cn/mmopen/vi_32/OMDImDtH2ia1GSYfPiajE14VecYNA8nu2P2XPJYdjgUQNHlLCFhjwGyP1nB8YjiaTC3ovOMwPmOicTT0FQYbvFZGxA/132',MakerCode:'K0000012',RealName:'王*内3'},
  143. {OpenCount:0,HeadPhoto:'https://thirdwx.qlogo.cn/mmopen/vi_32/OMDImDtH2ia1GSYfPiajE14VecYNA8nu2P2XPJYdjgUQNHlLCFhjwGyP1nB8YjiaTC3ovOMwPmOicTT0FQYbvFZGxA/132',MakerCode:'K0000016',RealName:'王*内'},
  144. {OpenCount:0,HeadPhoto:'https://thirdwx.qlogo.cn/mmopen/vi_32/OMDImDtH2ia1GSYfPiajE14VecYNA8nu2P2XPJYdjgUQNHlLCFhjwGyP1nB8YjiaTC3ovOMwPmOicTT0FQYbvFZGxA/132',MakerCode:'K0000016',RealName:'王*内'},
  145. {OpenCount:0,HeadPhoto:'https://thirdwx.qlogo.cn/mmopen/vi_32/OMDImDtH2ia1GSYfPiajE14VecYNA8nu2P2XPJYdjgUQNHlLCFhjwGyP1nB8YjiaTC3ovOMwPmOicTT0FQYbvFZGxA/132',MakerCode:'K0000016',RealName:'王*内'},
  146. {OpenCount:0,HeadPhoto:'https://thirdwx.qlogo.cn/mmopen/vi_32/OMDImDtH2ia1GSYfPiajE14VecYNA8nu2P2XPJYdjgUQNHlLCFhjwGyP1nB8YjiaTC3ovOMwPmOicTT0FQYbvFZGxA/132',MakerCode:'K0000016',RealName:'王*内'},
  147. {OpenCount:0,HeadPhoto:'https://thirdwx.qlogo.cn/mmopen/vi_32/OMDImDtH2ia1GSYfPiajE14VecYNA8nu2P2XPJYdjgUQNHlLCFhjwGyP1nB8YjiaTC3ovOMwPmOicTT0FQYbvFZGxA/132',MakerCode:'K0000016',RealName:'王*内'},
  148. {OpenCount:0,HeadPhoto:'https://thirdwx.qlogo.cn/mmopen/vi_32/OMDImDtH2ia1GSYfPiajE14VecYNA8nu2P2XPJYdjgUQNHlLCFhjwGyP1nB8YjiaTC3ovOMwPmOicTT0FQYbvFZGxA/132',MakerCode:'K0000016',RealName:'王*内'},
  149. {OpenCount:0,HeadPhoto:'https://thirdwx.qlogo.cn/mmopen/vi_32/OMDImDtH2ia1GSYfPiajE14VecYNA8nu2P2XPJYdjgUQNHlLCFhjwGyP1nB8YjiaTC3ovOMwPmOicTT0FQYbvFZGxA/132',MakerCode:'K0000016',RealName:'王*内'},
  150. ],
  151. show:false,
  152. InvitePhoto:'',
  153. toptitleisshow:true,
  154. options: [
  155. { name: '微信', icon: 'wechat' },
  156. { name: '微信朋友圈', icon: 'wechat-moments' },
  157. ],
  158. Base64:'',
  159. rank:0,
  160. }
  161. },
  162. created(){
  163. this.getrankinglist();
  164. },
  165. mounted(){
  166. this.$nextTick(() => {
  167. setTimeout(()=>{
  168. const height = document.getElementsByClassName('ranking_table')[0].getBoundingClientRect().bottom;
  169. document.getElementsByClassName('ranking_panel')[0].style.height = `calc(100vh - ${ height + 26 }px)`;
  170. },100)
  171. });
  172. },
  173. computed:{
  174. //- 使用计算属性算筛选出非前三的列表
  175. behinduser(){
  176. const arr = [];
  177. for(let i = 0; i<7; i++){
  178. arr.push(this.userlist[ i + 3 ]);
  179. }
  180. return arr
  181. },
  182. },
  183. methods: {
  184. //- 图片生成
  185. // 生成快照
  186. convertToImage(container){
  187. window.pageYoffset = 0;
  188. document.documentElement.scrollTop = 0;
  189. document.body.scrollTop = 0;
  190. // 设置放大倍数
  191. const scale = window.devicePixelRatio;
  192. // 传入节点原始宽高
  193. const width = container.offsetWidth;
  194. const height = container.offsetHeight;
  195. const canvas = document.createElement('canvas');
  196. // 设定 canvas 元素属性宽高为 DOM 节点宽高 * 像素比
  197. canvas.width = width * scale;
  198. canvas.height = height * scale;
  199. // 设定 canvas css宽高为 DOM 节点宽高
  200. canvas.style.width = `${width}px`;
  201. canvas.style.height = `${height}px`;
  202. // 获取画笔
  203. const context = canvas.getContext('2d');
  204. // 将所有绘制内容放大像素比倍
  205. context.scale(scale, scale);
  206. var rect = container.getBoundingClientRect(); //获取元素相对于视察的偏移量
  207. context.translate(-rect.left, -rect.top); //设置context位置,值为相对于视窗的偏移量负值,让图片复位
  208. // html2canvas配置项
  209. //- console.log(11)
  210. const ops = {
  211. scale,
  212. canvas,
  213. width,
  214. height,
  215. logging: false,
  216. useCORS: true,
  217. allowTaint: false,
  218. dpi:300,
  219. };
  220. return html2canvas(container, ops).then(canvas => {
  221. // 返回图片的二进制数据
  222. return canvas.toDataURL("image/png");
  223. });
  224. },
  225. //- async saveimg(){
  226. //- // 调用函数,取到截图的二进制数据,对图片进行处理(保存本地、展示等)
  227. //- this.issaveimg = false;
  228. //- this.$nextTick(async()=>{
  229. //- const imgBlobData = await this.convertToImage(this.$refs.savecard);
  230. //- this.issaveimg = true;
  231. //- this.InvitePhoto = imgBlobData;
  232. //- });
  233. //- },
  234. async getrankinglist(){
  235. const res = await getRequest('api/v1/ActivityRecommendKing/List',JSON.stringify(this.pageinfo));
  236. if(res.status !== '1')return tips('获取排行榜失败,请重试!');
  237. //- 替换名字
  238. //- res.data.forEach(item=>{
  239. //- item.UserInfo.RealName = hidemiddlenum(item.UserInfo.RealName,1);
  240. //- });
  241. this.userlist = res.data;
  242. this.date = res.other;
  243. },
  244. goback(){
  245. PublicLib.GoBack({Level:1});
  246. },
  247. //- 分享
  248. sharebtn(){
  249. this.isshare = false;
  250. //- this.saveimg();
  251. this.show = true;
  252. const makercode = this.makercode;
  253. setTimeout(async()=>{
  254. //- const makercode = JSON.parse(PublicLib.getCookieInfo('userInfo')).MakerCode;
  255. if(String(makercode) === String(this.userlist[0].MakerCode)){
  256. this.rank = 0;
  257. setTimeout(async()=>{
  258. this.Base64 = await this.convertToImage(this.$refs.savecard);
  259. });
  260. }else if(String(makercode) === String(this.userlist[1].MakerCode)){
  261. this.rank = 1;
  262. setTimeout(async()=>{
  263. this.Base64 = await this.convertToImage(this.$refs.savecard);
  264. });
  265. }else if(String(makercode) === String(this.userlist[2].MakerCode)){
  266. this.rank = 2;
  267. setTimeout(async()=>{
  268. this.Base64 = await this.convertToImage(this.$refs.savecard);
  269. });
  270. }else{
  271. this.Base64 = await this.convertToImage(this.$refs.shareel);
  272. };
  273. this.isshare = true;
  274. },100)
  275. },
  276. weixinfriend:undebounce(function(){
  277. const type = browsertype.versions.ios ? 'ios' : 'android';
  278. if(type === 'ios'){
  279. window.webkit.messageHandlers.Base64ImageShareWechatTimeline.postMessage({Base64:this.Base64});
  280. }else{
  281. Func.Base64ImageShareWechatTimeline(JSON.stringify({Base64:this.Base64}))
  282. };
  283. }),
  284. weixin:undebounce(function(){
  285. //- debugger;
  286. const type = browsertype.versions.ios ? 'ios' : 'android';
  287. if(type === 'ios'){
  288. window.webkit.messageHandlers.Base64ImageShareWechatSession.postMessage({Base64:this.Base64});
  289. }else{
  290. Func.Base64ImageShareWechatSession(JSON.stringify({Base64:this.Base64}))
  291. };
  292. }),
  293. saveloaction(){
  294. PublicLib.SaveToSd({PicturePath:this.InvitePhoto});
  295. },
  296. onquerycount(option){
  297. if(option.name === '微信'){
  298. this.weixin();
  299. }else{
  300. this.weixinfriend();
  301. };
  302. },
  303. }
  304. });
  305. </script>
  306. </body>
  307. </html>