addLayer.html 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484
  1. <style type="text/css">
  2. /*
  3. 浏览器重置样式
  4. */
  5. .LF,.LF *{
  6. -webkit-box-sizing:border-box;
  7. -moz-box-sizing:border-box;
  8. box-sizing:border-box;
  9. margin:0px;
  10. padding:0px;
  11. vertical-align:baseline;
  12. word-break:break-word;
  13. word-wrap:break-word;
  14. }
  15. .LF a{
  16. text-decoration:none;
  17. }
  18. .black-opacity-mask{
  19. position:fixed;
  20. left:0px;
  21. top:0px;
  22. width:3000px;
  23. height:3000px;
  24. margin-left:-1500px;
  25. margin-top:-1500px;
  26. z-index:-1;
  27. /* background-color:rgba(255,255,255,0.3); */
  28. background-color:transparent;
  29. }
  30. .LF__operate{
  31. text-align:center;
  32. display:-webkit-box;
  33. display:-ms-box;
  34. display:-webkit-flex;
  35. display:flex;
  36. align-items:center;
  37. justify-content:center;
  38. padding:8px 0px;
  39. }
  40. .LF__loadmore{
  41. padding:0px 15px;
  42. flex:0 0 100px;
  43. color:#fff;
  44. background-color:#05C775;
  45. line-height:32px;
  46. font-weight:bold;
  47. border-radius:16px;
  48. user-select:none;
  49. }
  50. .LF{
  51. /*position:absolute;*/
  52. /*left:100px;*/
  53. /*top:40px;*/
  54. background-color:#05C775;
  55. padding:2px 0px;
  56. width:470px;
  57. z-index:9;
  58. border-radius:2px;
  59. box-shadow:0px 1px 1px 1px rgba(135,135,135,0.5);
  60. }
  61. .LF__title{
  62. line-height:32px;
  63. height:35px;
  64. text-align:center;
  65. color:#fff;
  66. font-size:14px;
  67. position: relative;
  68. z-index:2;
  69. }
  70. .null-data{
  71. padding:10px;
  72. line-height:1.3;
  73. display:-webkit-flex;
  74. display:flex;
  75. height:150px;
  76. color:#999;
  77. justify-content:center;
  78. text-align:center;
  79. align-items:center;
  80. }
  81. .LF__btn{
  82. padding:0px 15px;
  83. flex:0 0 115px;
  84. color:#fff;
  85. background-color:#05C775;
  86. line-height:32px;
  87. font-weight:bold;
  88. text-align:center;
  89. border-radius:16px;
  90. user-select:none;
  91. }
  92. .LF__btn.plusWidth{
  93. flex: 0 0 130px;
  94. }
  95. .LF__btn._2{
  96. flex:0 0 92px;
  97. }
  98. .LF__btn.offline{
  99. background-color:#66e6b0;
  100. color:#fff;
  101. display:-webkit-flex;
  102. display: flex;
  103. justify-content:center;
  104. align-items:center;
  105. }
  106. .LF__btn.offline ._i{
  107. width:12px;
  108. height: 7px;
  109. border-left:2px solid #fff;
  110. border-bottom:2px solid #fff;
  111. -webkit-transform:rotate(-35deg);
  112. -moz-transform:rotate(-35deg);
  113. -ms-transform:rotate(-35deg);
  114. -o-transform:rotate(-35deg);
  115. transform:rotate(-35deg);
  116. -webkit-transform-origin:34% -50%;
  117. -moz-transform-origin:34% -50%;
  118. -ms-transform-origin:34% -50%;
  119. -o-transform-origin:34% -50%;
  120. transform-origin:34% -50%;
  121. }
  122. .LF__content{
  123. flex:auto;
  124. padding:0px 15px;
  125. overflow:hidden;
  126. }
  127. .LF__content ._text{
  128. display:block;
  129. overflow:hidden;
  130. white-space:nowrap;
  131. -o-text-overflow:ellipsis;
  132. text-overflow:ellipsis;
  133. word-wrap:break-word;
  134. word-break:break-word;
  135. font-weight:bold;
  136. }
  137. .LF__content ._text._name{
  138. font-size:14px;
  139. color:#333;
  140. }
  141. .LF__box{
  142. background-color:#fff;
  143. font-size:12px;
  144. color:#666;
  145. }
  146. .LF__box ul{
  147. list-style:none;
  148. }
  149. .LF__box ul >li{
  150. width:100%;
  151. display:-webkit-flex;
  152. display:flex;
  153. padding:6px 12px;
  154. justify-content:flex-start;
  155. align-items:center;
  156. border-bottom:1px solid #ddd;
  157. }
  158. .LF__anchorphoto{
  159. width:44px;
  160. height:44px;
  161. flex:0 0 44px;
  162. border-radius:50%;
  163. background-repeat:no-repeat;
  164. background-position:center top;
  165. background-size:100% auto;
  166. background-image:url('<%=public_path%>/img/logo.png');
  167. }
  168. .HLS{
  169. font-size:12px;
  170. text-align:center;
  171. padding:15px 0px;
  172. }
  173. .HLS__reload{
  174. height:150px;
  175. padding:186px 0px;
  176. }
  177. .HLS__status{
  178. display:-webkit-flex;
  179. display:flex;
  180. justify-content:center;
  181. align-items:flex-start;
  182. color:#6B6B6B;
  183. line-height:23px;
  184. padding:0px 20px;
  185. margin-bottom:20px;
  186. }
  187. .HLS__status ._t{
  188. text-align:left;
  189. }
  190. .HLS__status ._i{
  191. width:23px;
  192. height:23px;
  193. margin-right:10px;
  194. background:transparent url('<%=public_path%>/img/u3959.png') no-repeat center center scroll;
  195. background-size:23px 23px;
  196. }
  197. .HLS__btn{
  198. display:inline-block;
  199. line-height:30px;
  200. padding:0px 20px;
  201. min-width:90px;
  202. color:#fff;
  203. border-radius:14px;
  204. background-color:#05C775;
  205. -webkit-transition:all 0.3s ease-in;
  206. -moz-transition:all 0.3s ease-in;
  207. -ms-transition:all 0.3s ease-in;
  208. -o-transition:all 0.3s ease-in;
  209. transition:all 0.3s ease-in;
  210. }
  211. .HLS__btn:active{
  212. background-color:#eee;
  213. }
  214. .HLS__btn.loading{
  215. display:-webkit-flexbox;
  216. display:flexbox;
  217. display:-webkit-box;
  218. display:box;
  219. display:-webkit-inline-flex;
  220. display:inline-flex;
  221. justify-content:center;
  222. align-items:center;
  223. }
  224. .HLS__btn.loading:before{
  225. content:'';
  226. width:10px;
  227. height:10px;
  228. margin-right:5px;
  229. background:transparent url('<%=public_path%>/img/live2.gif') no-repeat center center scroll;
  230. }
  231. .LF__close{
  232. width:20px;
  233. height: 20px;
  234. position: absolute;
  235. z-index:9;
  236. right: 10px;
  237. top:9px;
  238. background:transparent url('<%=public_path%>/img/close.png') no-repeat center center scroll;
  239. background-size:20px 20px;
  240. display: block;
  241. text-indent:-9999em;
  242. }
  243. .LF__errorTips{
  244. position: absolute;
  245. z-index:11;
  246. color:#fff;
  247. font-size:12px;
  248. background-color:rgba(239,134,72,0.8);
  249. padding:8px 15px;
  250. line-height:1.5;
  251. text-align:left;
  252. top:37px;
  253. left: 0px;
  254. right:0px;
  255. }
  256. #wrapper {
  257. position: absolute;
  258. z-index: 1;
  259. top:0px;
  260. bottom:0px;
  261. left: 0;
  262. width: 100%;
  263. /*background: #ccc;*/
  264. overflow: hidden;
  265. -webkit-touch-callout: none;
  266. -webkit-user-select: none;
  267. -moz-user-select: none;
  268. -ms-user-select: none;
  269. user-select: none;
  270. -webkit-text-size-adjust: none;
  271. -moz-text-size-adjust: none;
  272. -ms-text-size-adjust: none;
  273. -o-text-size-adjust: none;
  274. text-size-adjust: none;
  275. }
  276. </style>
  277. <script src="<%=public_path%>/js/iscroll5/build/iscroll.js"></script>
  278. <script src="<%=public_path%>/js/iscroll5/demoUtils.js"></script>
  279. <div class="LadyFriends LF">
  280. <!--蒙层遮罩 start-->
  281. <div ref="dommask" class="black-opacity-mask"></div>
  282. <!--蒙层遮罩 end-->
  283. <!--关闭-->
  284. <a class="LF__close" href="javascript:void(0);">close</a>
  285. <h2 class="LF__title">Add new friends</h2>
  286. <!--错误提示-->
  287. <div class="LF__errorTips" style="display: none;"></div>
  288. <!--列表开始 start-->
  289. <div class="LF__box">
  290. <!--滚动器 start-->
  291. <div>
  292. <div>
  293. <%if(addFriendsList.length > 0){%>
  294. <div id="cao" style="height:342px; overflow:hidden;position:relative;">
  295. <div id="wrapper">
  296. <ul id="wrapBox">
  297. <%for(var data of addFriendsList){%>
  298. <li>
  299. <div class="LF__anchorphoto" style="background-image:url('<%=data.avatar_img%>');"></div>
  300. <div class="LF__content">
  301. <p class="_text _name"><%=data.nick_name%></p>
  302. <p class="_text"><%=data.age%>yrs / <%=data.country%></p>
  303. </div>
  304. <a class="LF__btn sendRequest" data-id="<%=data.friend_id%>" data-name="<%=data.nick_name%>" href="javascript:void(0);" style="<%if(data.status == 0){%>display: flex;<%}else{%>display: none;<%}%>">Send request</a>
  305. <a class="LF__btn offline plusWidth requestSent" href="javascript:void(0);" style="<%if(data.status == 1){%><%}else{%>display: none;<%}%>">
  306. <span>Request sent</span><i class="_i"></i>
  307. </a>
  308. <a class="LF__btn Accept" data-id="<%=data.friend_id%>" data-name="<%=data.nick_name%>" href="javascript:void(0);" style="<%if(data.status == 2){%><%}else{%>display: none;<%}%>">Accept</a>
  309. <a class="LF__btn offline Added" href="javascript:void(0);" style="display: none;">
  310. <span>Added</span><i class="_i"></i>
  311. </a>
  312. </li>
  313. <%}%>
  314. </ul>
  315. </div>
  316. </div>
  317. <%}%>
  318. <!--加载更多主播-->
  319. <!--下载按钮 start-->
  320. <div class="HLS">
  321. <div style="height:5px;"></div>
  322. <!--下载数据-->
  323. <!--loadmore-->
  324. <a class="HLS__btn LoadMore" style="<%if(addFriendsList.length < step){%>display: none;<%}%>" href="javascript:void(0);" @click="loadmore">Load more</a>
  325. <!--loading-->
  326. <span class="HLS__btn loading" style="display: none;">Loading</span>
  327. <!--五数据 reload-->
  328. <div class="HLS__reload" style="<%if(addFriendsList.length != 0){%>display: none;<%}%>">
  329. <div class="HLS__status">
  330. <p class="_t">No friends to add yet.</p>
  331. </div>
  332. <!--<a class="HLS__btn" href="javascript:void(0);">Reload</a>-->
  333. </div>
  334. <!--网络错误 reload-->
  335. <!--<div class="HLS__reload">-->
  336. <!--<div class="HLS__status">-->
  337. <!--<i class="_i"></i><p class="_t">Could not load your friend list.</p>-->
  338. <!--</div>-->
  339. <!--<a class="HLS__btn" href="javascript:void(0);" @click="neterrorReload">Reload</a>-->
  340. <!--</div>-->
  341. <!--其它类型按钮-->
  342. <a class="HLS__btn noMoreData" style="<%if(addFriendsList.length == step || addFriendsList.length==0){%>display: none;<%}%>background-color:#F2F2F2;color:#AEAEAE;" href="javascript:void(0);">No more data</a>
  343. </div>
  344. <!--下载按钮 end-->
  345. </div>
  346. </div>
  347. <!--滚动器 end-->
  348. </div>
  349. <!--列表开始 end-->
  350. </div>
  351. <script>
  352. $(function(){
  353. var index = parent.layer.getFrameIndex(window.name);
  354. //自适应高度
  355. parent.layer.iframeAuto(index);
  356. $('.LF__close').click(function(){
  357. parent.layer.close(index);
  358. })
  359. //获取列表长度
  360. let addFriendsListNum = '<%=addFriendsList.length%>';
  361. var myScroll;
  362. //如果列表长度为0则不执行滚动插件
  363. if(addFriendsListNum > 0){
  364. if(addFriendsListNum >= 6){
  365. $('#cao').height('342px');
  366. myScroll = new IScroll('#wrapper', { useTransition: false, scrollbars: true, mouseWheel:true });
  367. }else{
  368. var height = addFriendsListNum * 57;
  369. $('#cao').height(height);
  370. }
  371. //自适应高度
  372. parent.layer.iframeAuto(index);
  373. }else{
  374. //自适应高度
  375. parent.layer.iframeAuto(index);
  376. }
  377. var page = 2;
  378. $(document).on('click','.LoadMore',function(){
  379. $('.LoadMore').hide();
  380. $('.loading').show();
  381. $.ajax({
  382. url: '/broadcast/hangoutLayer/addLayerAjax',
  383. type: 'POST',
  384. data: 'page='+page,
  385. success:function(data) {
  386. if(data.errno == 0){
  387. if(data.data.html == ''){
  388. $('.loading').hide();
  389. $('.noMoreData').show();
  390. }else {
  391. $('#wrapBox').append(data.data.html);
  392. $('.LoadMore').show();
  393. $('.loading').hide();
  394. myScroll.refresh();
  395. page++;
  396. }
  397. }
  398. },
  399. error:function(){
  400. errorFun('Trouble connecting to the server. Please try again later.');
  401. }
  402. });
  403. });
  404. $(document).on('click','.sendRequest',function(){
  405. var that = $(this);
  406. var friend_id = $(this).attr('data-id');
  407. var anchor_name = $(this).attr('data-name');
  408. $.ajax({
  409. url: '/lady/v1/addAnchorFriend',
  410. type: 'POST',
  411. data: {userid:friend_id},
  412. success:function(data) {
  413. if(data.errno == 0){
  414. that.hide();
  415. that.siblings('.requestSent').show();
  416. }else if(data.errno == 16314){
  417. errorFun('You are not available to add '+anchor_name+' at the moment.');
  418. }else if(data.errno == 16342){
  419. errorFun(''+anchor_name+' has been added as your friend.');
  420. that.hide();
  421. that.siblings('.Added').show();
  422. }else if(data.errno == 16343){
  423. errorFun('You are not available to add '+anchor_name+' at the moment.');
  424. that.hide();
  425. that.siblings('.requestSent').show();
  426. }else{
  427. errorFun('Failed to send the friend request. Please try again later.');
  428. }
  429. },
  430. error:function(){
  431. errorFun('Trouble connecting to the server. Please try again later.');
  432. }
  433. });
  434. })
  435. /**
  436. * 同意好友请求
  437. */
  438. $(document).on('click','.Accept',function(){
  439. var that = $(this);
  440. var friend_id = $(this).attr('data-id');
  441. var anchor_name = $(this).attr('data-name');
  442. $.ajax({
  443. url: '/lady/v1/answerAddFriend',
  444. type: 'POST',
  445. data: {friend_id:friend_id,accept:1},
  446. success:function(data) {
  447. if(data.errno == 0){
  448. that.hide();
  449. that.siblings('.Added').show();
  450. }else{
  451. errorFun(anchor_name + ' has been added as your friend.');
  452. that.hide();
  453. that.siblings('.Added').show();
  454. }
  455. },
  456. error:function(){
  457. errorFun('Trouble connecting to the server. Please try again later.');
  458. }
  459. });
  460. });
  461. //错误提示
  462. function errorFun(msg){
  463. $('.LF__errorTips').show().text(msg);
  464. setTimeout(function(){
  465. $('.LF__errorTips').hide();
  466. },3000);
  467. };
  468. })
  469. </script>