user-ranking-blance.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  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 {
  18. background-color: #FFD500; background-image:none !important;}
  19. .whit_icon .van-nav-bar__right .van-nav-bar__text{color:#333}
  20. .ranking_titpanel {
  21. height: 7rem;
  22. background-image: linear-gradient(to top, #FFD500, #FFD500);
  23. padding: .2133rem .613333rem 0; }
  24. .ranking_titpanel .title {
  25. color: rgba(51, 51, 51, 0.7); }
  26. .ranking_titpanel .ranking_front {
  27. display: grid;
  28. height: 100%;
  29. grid-template-columns: 1fr 1.3fr 1fr; }
  30. .ranking_titpanel .ranking_front .ranking {
  31. height: 100%; }
  32. .ranking_titpanel .ranking_front .ranking .image {
  33. width: 1.706667rem;
  34. height: 1.706667rem;
  35. margin: 0 auto;
  36. border-radius: 50%;
  37. background-image: linear-gradient(to bottom, #F7F6F9, #BCC0C8); }
  38. .ranking_titpanel .ranking_front .ranking .image img {
  39. width: 90%;
  40. border-radius: 50%;
  41. top: 50%;
  42. left: 50%;
  43. transform: translate(-50%, -50%); }
  44. .ranking_titpanel .ranking_front .ranking .ranklogo {
  45. position: absolute;
  46. bottom: 0;
  47. left: 50%;
  48. transform: translate(-50%, 40%);
  49. width: .533333rem;
  50. height: .533333rem;
  51. background-image: linear-gradient(to bottom, #FFFFFF, #c5c5c5);
  52. border-radius: 50%;
  53. line-height: .533333rem; }
  54. .ranking_titpanel .table {
  55. width: 100%;
  56. height: 3.02rem;
  57. margin: .64rem auto 0;
  58. border-radius: .213333rem 0 0 0;
  59. background-image: linear-gradient(to bottom, #ffc400, #ffd500); }
  60. .ranking_titpanel .table .mt12 {
  61. margin-top: .32rem; }
  62. .ranking_titpanel .frist {
  63. width: 2.026667rem !important;
  64. height: 2.026667rem !important;
  65. background-image: linear-gradient(to bottom, #ffc400, #EEB031) !important; }
  66. .ranking_titpanel .frist .ranklogo {
  67. background-image: linear-gradient(to bottom, #FFD971, #EEB031) !important; }
  68. .ranking_titpanel .firsttable {
  69. border-radius: .213333rem .213333rem 0 0; }
  70. .ranking_titpanel .third {
  71. background-image: linear-gradient(to bottom, #F3BB6D, #C18135) !important; }
  72. .ranking_titpanel .third .ranklogo {
  73. background-image: linear-gradient(to bottom, #f3c27e, #e29f41) !important; }
  74. .ranking_titpanel .thirdtable {
  75. border-radius: 0 .213333rem 0 0; }
  76. .ranking_cell {
  77. padding: 0 .426667rem;
  78. height: 1.706667rem; }
  79. .ranking_cell .van-cell__title {
  80. line-height: 1.706667rem; }
  81. .ranking_cell .van-cell__title .ranking_cell_img {
  82. width: 1.066667rem;
  83. height: 1.066667rem;
  84. border-radius: 50%;
  85. vertical-align: middle;
  86. margin: 0 .426667rem; }
  87. .ranking_cell .ranking_cell_money {
  88. line-height: 1.706667rem; }
  89. .van-cell__title{flex:1.2;}
  90. .van-cell__value{flex:.5;}
  91. </style>
  92. </head>
  93. <body class="pb0">
  94. <div class="iphonetitle bgcstrong"></div>
  95. <div id="app" v-cloak>
  96. <van-sticky>
  97. <van-nav-bar class="bgcstrong whit_icon" title="开机排行榜" @click-left="goback" right-text="分享到" @click-right="sharebtn" left-arrow v-if="toptitleisshow" v-cloak>
  98. <template #left>
  99. <van-icon name="arrow-left" color="#333" size="20"></van-icon>
  100. </template>
  101. </van-nav-bar>
  102. </van-sticky>
  103. <div ref="savecard">
  104. <div class="ranking_titpanel">
  105. <div class="title f12 tc">统计时间:{{date.StratTime}} - {{date.EndTime}}</div>
  106. <div class="ranking_front" :class="userlist.length === 1 ? 'ranking_iscenter':''">
  107. <div class="ranking rel" style="padding-top:1.8133rem;" v-if="userlist.length &gt; 1">
  108. <div class="image rel"><img class="sec abs" :src="userlist[1].HeadPhoto" alt="">
  109. <div class="ranklogo tc c333 b abs f12">2</div>
  110. </div>
  111. <div class="table tc ovh">
  112. <div class="f12 c333 mt8">{{userlist[1].RealName}}</div>
  113. <div class="f12 c333">{{userlist[1].MakerCode}}</div>
  114. <div class="f12 c333 mt8 tc ranking_balabce">{{userlist[1].OpenCount}}台</div>
  115. </div>
  116. </div>
  117. <div class="ranking rel" style="padding-top:1.1733rem;" v-if="userlist.length !== 0">
  118. <div class="image rel frist"><img class="sec abs" :src="userlist[0].HeadPhoto" alt="">
  119. <div class="ranklogo tc c333 b abs f12">1</div>
  120. </div>
  121. <div class="table firsttable tc ovh">
  122. <div class="f12 c333 mt8">{{userlist[0].RealName}}</div>
  123. <div class="f12 c333">{{userlist[0].MakerCode}}</div>
  124. <div class="f12 c333 mt8 tc ranking_balabce">{{userlist[0].OpenCount}}台</div>
  125. </div>
  126. </div>
  127. <div class="ranking rel" style="padding-top:2.1333rem;" v-if="userlist.length &gt; 2">
  128. <div class="image rel third"><img class="sec abs" :src="userlist[2].HeadPhoto" alt="">
  129. <div class="ranklogo tc c333 b abs f12">3</div>
  130. </div>
  131. <div class="table thirdtable tc ovh">
  132. <div class="f12 c333 mt8">{{userlist[2].RealName}}</div>
  133. <div class="f12 c333">{{userlist[2].MakerCode}}</div>
  134. <div class="f12 c333 mt8 tc ranking_balabce">{{userlist[2].OpenCount}}台</div>
  135. </div>
  136. </div>
  137. </div>
  138. </div>
  139. <van-cell class="ranking_cell" v-for="item,index in behinduser" :key="item.UserId">
  140. <template #title><span>{{index + 4}}</span><img class="ranking_cell_img" :src="item.HeadPhoto" alt=""><span class="mr8 f14">{{item.RealName}}</span><span>{{item.MakerCode}}</span></template>
  141. <template #default>
  142. <div class="ranking_cell_money ranking_balabce">{{item.OpenCount}}台</div>
  143. </template>
  144. </van-cell>
  145. </div>
  146. <van-share-sheet v-model="show" title="立即分享给好友" :options="options" @select="onquerycount"></van-share-sheet>
  147. </div>
  148. <script src="./static/js/klm-vv.min.js"></script>
  149. <script src="./static/js/appfunc.min.js"></script>
  150. <script src="./static/js/klm-axios-config.js"></script>
  151. <script src="./static/js/publicfn.js"></script>
  152. <script src="./static/js/iconfont.js"></script>
  153. <script src="./static/js/html2canvas.js"></script>
  154. <script>
  155. // 在 #app 标签下渲染一个按钮组件
  156. let app = new Vue({
  157. el: '#app',
  158. data() {
  159. return {
  160. date:{},
  161. pageinfo:{
  162. PageSize:10,
  163. PageNum:1
  164. },
  165. userlist:[
  166. {OpenCount:0,HeadPhoto:'',MakerCode:'',RealName:''},
  167. {OpenCount:0,HeadPhoto:'',MakerCode:'',RealName:''},
  168. {OpenCount:0,HeadPhoto:'',MakerCode:'',RealName:''},
  169. {OpenCount:0,HeadPhoto:'',MakerCode:'',RealName:''},
  170. {OpenCount:0,HeadPhoto:'',MakerCode:'',RealName:''},
  171. {OpenCount:0,HeadPhoto:'',MakerCode:'',RealName:''},
  172. {OpenCount:0,HeadPhoto:'',MakerCode:'',RealName:''},
  173. {OpenCount:0,HeadPhoto:'',MakerCode:'',RealName:''},
  174. {OpenCount:0,HeadPhoto:'',MakerCode:'',RealName:''},
  175. {OpenCount:0,HeadPhoto:'',MakerCode:'',RealName:''},
  176. ],
  177. show:false,
  178. InvitePhoto:'',
  179. toptitleisshow:true,
  180. options: [
  181. { name: '微信', icon: 'wechat' },
  182. { name: '微信朋友圈', icon: 'wechat-moments' },
  183. ],
  184. Base64:'',
  185. }
  186. },
  187. created(){
  188. this.getrankinglist();
  189. },
  190. computed:{
  191. //- 使用计算属性算筛选出非前三的列表
  192. behinduser(){
  193. const arr = [];
  194. for(let i = 0; i<7; i++){
  195. arr.push(this.userlist[ i + 3 ]);
  196. }
  197. return arr
  198. },
  199. },
  200. methods: {
  201. //- 图片生成
  202. // 生成快照
  203. convertToImage(container){
  204. window.pageYoffset = 0;
  205. document.documentElement.scrollTop = 0;
  206. document.body.scrollTop = 0;
  207. // 设置放大倍数
  208. const scale = window.devicePixelRatio;
  209. // 传入节点原始宽高
  210. const width = container.offsetWidth;
  211. const height = container.offsetHeight;
  212. const canvas = document.createElement('canvas');
  213. // 设定 canvas 元素属性宽高为 DOM 节点宽高 * 像素比
  214. canvas.width = width * scale;
  215. canvas.height = height * scale;
  216. // 设定 canvas css宽高为 DOM 节点宽高
  217. canvas.style.width = `${width}px`;
  218. canvas.style.height = `${height}px`;
  219. // 获取画笔
  220. const context = canvas.getContext('2d');
  221. // 将所有绘制内容放大像素比倍
  222. context.scale(scale, scale);
  223. var rect = container.getBoundingClientRect(); //获取元素相对于视察的偏移量
  224. context.translate(-rect.left, -rect.top); //设置context位置,值为相对于视窗的偏移量负值,让图片复位
  225. // html2canvas配置项
  226. //- console.log(11)
  227. const ops = {
  228. scale,
  229. canvas,
  230. width,
  231. height,
  232. logging: false,
  233. useCORS: true,
  234. allowTaint: false,
  235. dpi:300,
  236. };
  237. return html2canvas(container, ops).then(canvas => {
  238. // 返回图片的二进制数据
  239. return canvas.toDataURL("image/png");
  240. });
  241. },
  242. //- async saveimg(){
  243. //- // 调用函数,取到截图的二进制数据,对图片进行处理(保存本地、展示等)
  244. //- this.issaveimg = false;
  245. //- this.$nextTick(async()=>{
  246. //- const imgBlobData = await this.convertToImage(this.$refs.savecard);
  247. //- this.issaveimg = true;
  248. //- this.InvitePhoto = imgBlobData;
  249. //- });
  250. //- },
  251. async getrankinglist(){
  252. const res = await getRequest('api/v1/ActivityRecommendKing/List',JSON.stringify(this.pageinfo));
  253. if(res.status !== '1')return tips('获取排行榜失败,请重试!');
  254. //- 替换名字
  255. //- res.data.forEach(item=>{
  256. //- item.UserInfo.RealName = hidemiddlenum(item.UserInfo.RealName,1);
  257. //- });
  258. this.userlist = res.data;
  259. this.date = res.other;
  260. },
  261. goback(){
  262. PublicLib.GoBack({Level:1});
  263. },
  264. //- 分享
  265. async sharebtn(){
  266. //- this.saveimg();
  267. this.show = true;
  268. this.Base64 = await this.convertToImage(this.$refs.savecard);
  269. },
  270. weixinfriend:undebounce(function(){
  271. const type = browsertype.versions.ios ? 'ios' : 'android';
  272. if(type === 'ios'){
  273. window.webkit.messageHandlers.Base64ImageShareWechatTimeline.postMessage({Base64:this.Base64});
  274. }else{
  275. Func.Base64ImageShareWechatTimeline(JSON.stringify({Base64:this.Base64}))
  276. };
  277. }),
  278. weixin:undebounce(function(){
  279. //- debugger;
  280. const type = browsertype.versions.ios ? 'ios' : 'android';
  281. if(type === 'ios'){
  282. window.webkit.messageHandlers.Base64ImageShareWechatSession.postMessage({Base64:this.Base64});
  283. }else{
  284. Func.Base64ImageShareWechatSession(JSON.stringify({Base64:this.Base64}))
  285. };
  286. }),
  287. saveloaction(){
  288. PublicLib.SaveToSd({PicturePath:this.InvitePhoto});
  289. },
  290. onquerycount(option){
  291. if(option.name === '微信'){
  292. this.weixin();
  293. }else{
  294. this.weixinfriend();
  295. };
  296. },
  297. }
  298. });
  299. </script>
  300. </body>
  301. </html>