homepage_room.php 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
  6. <title>群主页</title>
  7. <link type="text/css" rel="stylesheet"
  8. href="<?php echo RESOURCE_SITE_URL; ?>/mobile/talk/css/weui.css?<?php echo bonus_version(); ?>"/>
  9. <link rel="stylesheet"
  10. href="<?php echo RESOURCE_SITE_URL; ?>/mobile/talk/css/jquery-weui.min.css?<?php echo bonus_version(); ?>">
  11. <link type="text/css" rel="stylesheet"
  12. href="<?php echo RESOURCE_SITE_URL; ?>/mobile/talk/css/homepage.css?<?php echo bonus_version(); ?>"/>
  13. </head>
  14. <body class="n_room_body">
  15. <div class="room_pwd_board">
  16. <div class="board_title">
  17. <p>输入房间密码</p>
  18. </div>
  19. <div class="pwd">
  20. <div class="one line"></div>
  21. <div class="two line"></div>
  22. <div class="three line"></div>
  23. <div class="four line"></div>
  24. </div>
  25. <div class="keyboard">
  26. <div>
  27. <a href="javascript:void(0)" class="input_number">1</a>
  28. <a href="javascript:void(0)" class="input_number">2</a>
  29. <a href="javascript:void(0)" class="input_number">3</a>
  30. </div>
  31. <div>
  32. <a href="javascript:void(0)" class="input_number">4</a>
  33. <a href="javascript:void(0)" class="input_number">5</a>
  34. <a href="javascript:void(0)" class="input_number">6</a>
  35. </div>
  36. <div>
  37. <a href="javascript:void(0)" class="input_number">7</a>
  38. <a href="javascript:void(0)" class="input_number">8</a>
  39. <a href="javascript:void(0)" class="input_number">9</a>
  40. </div>
  41. <div>
  42. <a href="javascript:void(0)" class="cancel">取消</a>
  43. <a href="javascript:void(0)" class="input_number">0</a>
  44. <a href="javascript:void(0)" class="delete_btn">
  45. <img src="<?php echo RESOURCE_SITE_URL;?>/mobile/talk/images/del_btn.png" alt="">
  46. </a>
  47. </div>
  48. </div>
  49. </div>
  50. <?php
  51. if(isset($output['tpl']))
  52. {
  53. $opentalk = intval($output['param']['open_talk']);
  54. if($opentalk) {
  55. $output['tpl']->show_open();
  56. } else {
  57. $output['tpl']->show();
  58. }
  59. }
  60. ?>
  61. <script src="<?php echo RESOURCE_SITE_URL; ?>/mobile/comm/jquery-1.11.0.min.js?<?php echo bonus_version(); ?>"></script>
  62. <script src="<?php echo RESOURCE_SITE_URL; ?>/mobile/talk/js/jquery-weui.min.js?<?php echo bonus_version(); ?>"></script>
  63. <script type="text/javascript"
  64. src="<?php echo RESOURCE_SITE_URL; ?>/mobile/comm/new_bridge.js?<?php echo bonus_version(); ?>"></script>
  65. <script type="text/javascript"
  66. src="<?php echo RESOURCE_SITE_URL; ?>/js/ajaxfileupload/ajaxfileupload.js?<?php echo bonus_version(); ?>"></script>
  67. <script type="text/javascript"
  68. src="<?php echo RESOURCE_SITE_URL; ?>/mobile/comm/qrcode.js"></script>
  69. <script type="text/javascript">
  70. $(function () {
  71. var is_app = <?php echo $output['param']['is_app']; ?>;
  72. var talk_type = "<?php echo $output['param']['talk_type']; ?>";
  73. var talk_id = <?php echo $output['param']['talk_id']; ?>;
  74. var cur_mid = <?php echo $output['param']['member_id']; ?>;
  75. var relay_id = <?php echo $output['param']['relay_id']; ?>;
  76. var room_name = '<?php echo $output['param']['room_name']; ?>';
  77. var room_avatar = '<?php echo $output['param']['room_avatar']; ?>';
  78. var open_talk = <?php echo $output['param']['open_talk']; ?>;
  79. if(is_app) {
  80. var jsBridge = new Bridge();
  81. if(open_talk > 0) {
  82. $('html').css({
  83. 'min-height':"100%",
  84. 'background':'#FFF'
  85. });
  86. }
  87. }else{
  88. $('html').css('padding-bottom','60px');
  89. $('.app_inshow').hide();
  90. }
  91. var checkLogin = function () {
  92. if(is_app>0 && cur_mid <= 0) {
  93. jsBridge.call_native_handler('on_native_click', '{"action":"login"}', function (data) {
  94. var jsdata = JSON.parse(data);
  95. if (!jsdata.login) {
  96. return;
  97. }
  98. else {
  99. sessionStorage.setItem('is_reload','true');
  100. window.location.reload();
  101. }
  102. });
  103. }
  104. var is_reload = sessionStorage.getItem('is_reload');
  105. if(is_reload) {
  106. sessionStorage.removeItem('is_reload');
  107. window.location.reload();
  108. }
  109. };
  110. $(window).on('pageshow',function(){
  111. checkLogin();
  112. share_btn();
  113. });
  114. function share_btn()
  115. {
  116. if(is_app){
  117. if(talk_type == 'room' && open_talk==0)
  118. {
  119. if(room_name == '') room_name = "熊猫美妆";
  120. var app_share_url = $("#show-qrcode").attr('data-qrcode-url');
  121. var jsonobject = {
  122. action:"view_init",
  123. params: {
  124. can_share:true,
  125. title:"我在"+room_name+"群里等你",
  126. sub_title:"这10000元基金必须有你的一份 加群聊 共享天猫美妆员工价",
  127. img_url:room_avatar,
  128. url:app_share_url
  129. }
  130. };
  131. jsBridge.call_native_handler('on_native_click',JSON.stringify(jsonobject));
  132. }
  133. }
  134. }
  135. function share_wake(){
  136. if(is_app > 0 && talk_type == 'room')
  137. {
  138. var jsonobject = {
  139. action:"share_page",
  140. params: {
  141. path:"",
  142. title:room_name,
  143. sub_title:"加入美妆群,下载熊猫美妆APP,分享故事分享红包",
  144. img_url:room_avatar,
  145. url:'<?php echo BASE_SITE_URL . "/mobile/index.php?act=index&op=room_index&client_type=wap&talk_type=room&talk_id={$output['param']['talk_id']}"; ?>'
  146. }
  147. };
  148. jsBridge.call_native_handler('on_native_click',JSON.stringify(jsonobject));
  149. }
  150. }
  151. $("#room_share_btn").on('click',function(){
  152. share_wake();
  153. });
  154. if($('#add_group_pwd').length > 0 || $('#add_group_apply').length > 0 || $('#add_group').length > 0) {
  155. $('html').css({"min-height":"100%",background:"#ffffff"})
  156. }
  157. //上传头像 app 上传
  158. $('#edit_group_avatar').on('click', function (){
  159. var jsonobject = {
  160. action: "select_photo",
  161. params: {
  162. isCrop: true
  163. }
  164. };
  165. jsBridge.call_native_handler('on_native_click', JSON.stringify(jsonobject), function (res) {
  166. var room_avatar = res;
  167. if(room_avatar) {
  168. $.showLoading();
  169. $.post('/mobile/index.php?act=member_talk&op=change_room_avatar2',
  170. {
  171. room_id: talk_id,
  172. file_path: room_avatar,
  173. client_type: 'ajax'
  174. }, function (res) {
  175. var result = JSON.parse(res);
  176. if (result.code != 200) {
  177. $.alert(result.message);
  178. return false;
  179. } else {
  180. $(".g_avatar").attr("src", result.datas.avatar);
  181. $.toast('修改成功',1000);
  182. }
  183. });
  184. } else {
  185. return false;
  186. }
  187. });
  188. return false;
  189. });
  190. var getTalkInfo = function () {
  191. var jsonobject = {
  192. action: "talk_info",
  193. params: {
  194. talk_id: talk_id,
  195. talk_type: talk_type,//room和chatwo两个类型
  196. }
  197. };
  198. jsBridge.call_native_handler('on_native_click', JSON.stringify(jsonobject), function (res) {
  199. var datas = JSON.parse(res);
  200. if (datas.talk_info.stick) {
  201. $('#talk_top').attr('checked', true);
  202. }
  203. if (datas.talk_info.forbid) {
  204. $('#no_disturb').attr('checked', true);
  205. }
  206. });
  207. };
  208. if(is_app) {
  209. getTalkInfo();
  210. }
  211. $('#add_member').on('click', function () {
  212. var jsonobject = {
  213. action: "friend_add",
  214. params: {
  215. room_id: talk_id
  216. }
  217. };
  218. $.showLoading();
  219. jsBridge.call_native_handler('on_native_click', JSON.stringify(jsonobject), function (res) {
  220. $.hideLoading();
  221. var datas = JSON.parse(res);
  222. if (datas.friends.length <= 0 || datas.friends == null) return;
  223. var add_friends = datas.friends.join(',');
  224. $.showLoading();
  225. $.get('/mobile/index.php?act=member_talk&op=invite',
  226. {
  227. invitees: add_friends,
  228. room_id: talk_id,
  229. client_type: 'ajax'
  230. },
  231. function (res) {
  232. $.hideLoading();
  233. var datas = JSON.parse(res);
  234. if (datas.code != 200) {
  235. $.alert(datas.message);
  236. return;
  237. }
  238. var html = '';
  239. if (datas.datas.invitees && datas.datas.invitees.length > 0) {
  240. for (var i = 0; i < datas.datas.invitees.length; i++) {
  241. html += '<div class="weui-flex__item" data-member-id="' + datas.datas.invitees[i].member_id + '">' +
  242. '<img src="' + datas.datas.invitees[i].avatar + '" alt="">' +
  243. '<p>' + datas.datas.invitees[i].nickname + '</p>\n' +
  244. '</div>'
  245. }
  246. $('div[data-last="true"]').after(html);
  247. $.toast('添加成功',1000);
  248. }
  249. });
  250. });
  251. });
  252. $('#del_member').on('click', function () {
  253. var jsonobject = {
  254. action: "friend_del",
  255. params: {
  256. room_id: talk_id
  257. }
  258. };
  259. $.showLoading();
  260. jsBridge.call_native_handler('on_native_click', JSON.stringify(jsonobject), function (res) {
  261. $.hideLoading();
  262. var datas = JSON.parse(res);
  263. if (datas.friends.length <= 0 || datas.friends == null) return;
  264. var del_friends = datas.friends.join(',');
  265. $.showLoading();
  266. $.get('/mobile/index.php?act=member_talk&op=kickout', {
  267. users: del_friends,
  268. room_id: talk_id,
  269. client_type: 'ajax'
  270. }, function (res) {
  271. $.hideLoading();
  272. var result = JSON.parse(res);
  273. if (result.code != 200) {
  274. $.alert(result.message);
  275. return;
  276. }
  277. var del_users = result.datas.users;
  278. var num = del_users.length;
  279. if(num > 0)
  280. {
  281. for (var i = 0; i < del_users.length; i++) {
  282. $('div[data-member-id=' + datas.friends[i] + ']').remove();
  283. }
  284. $.toast('删除成功',1000);
  285. }else
  286. {
  287. $.alert("请先移交管理员权限后,再离开聊天");
  288. return;
  289. }
  290. });
  291. });
  292. });
  293. $('#change_owner').on('click', function () {
  294. var jsonobject = {
  295. action: "talk_manager",
  296. params: {
  297. room_id: talk_id
  298. }
  299. };
  300. $.showLoading();
  301. jsBridge.call_native_handler('on_native_click', JSON.stringify(jsonobject), function (res) {
  302. $.hideLoading();
  303. var datas = JSON.parse(res);
  304. if (datas.friends.length <= 0 || datas.friends == null) return;
  305. var new_owner = datas.friends.join(',');
  306. $.showLoading();
  307. $.get('/mobile/index.php?act=member_talk&op=change_room_owner',
  308. {
  309. room_owner:new_owner,
  310. room_id: talk_id,
  311. client_type: 'ajax'
  312. }, function (res) {
  313. $.hideLoading();
  314. var result = JSON.parse(res);
  315. console.log(result);
  316. if (result.code != 200) {
  317. $.alert(result.message);
  318. return;
  319. }
  320. $.toast('转让成功',1000);
  321. setTimeout(function () {
  322. window.location.reload();
  323. },1000);
  324. });
  325. });
  326. });
  327. $('#talk_top').on('change', function () {
  328. var _selfVal = $(this).is(':checked');
  329. var jsonobject;
  330. if (_selfVal) {
  331. jsonobject = {
  332. action: "talk_stick",
  333. params: {
  334. talk_id: talk_id,
  335. talk_type: talk_type,
  336. stick: true
  337. }
  338. };
  339. }
  340. else {
  341. jsonobject = {
  342. action: "talk_stick",
  343. params: {
  344. talk_id: talk_id,
  345. talk_type: talk_type,
  346. stick: false
  347. }
  348. };
  349. }
  350. jsBridge.call_native_handler('on_native_click', JSON.stringify(jsonobject));
  351. });
  352. $('#no_disturb').on('change', function () {
  353. var _selfVal = $(this).is(':checked');
  354. var jsonobject;
  355. if (_selfVal) {
  356. jsonobject = {
  357. action: "talk_forbid",
  358. params: {
  359. talk_id: talk_id,
  360. talk_type: talk_type,
  361. forbid: true
  362. }
  363. };
  364. }
  365. else {
  366. jsonobject = {
  367. action: "talk_forbid",
  368. params: {
  369. talk_id: talk_id,
  370. talk_type: talk_type,
  371. forbid: false
  372. }
  373. };
  374. }
  375. jsBridge.call_native_handler('on_native_click', JSON.stringify(jsonobject));
  376. });
  377. $('#edit_group_name').on('click', function () {
  378. $.prompt({
  379. title: '修改群名称',
  380. text: '请输入群名称(不得超过15字)',
  381. empty: false, // 是否允许为空
  382. onOK: function (input) {
  383. if (input && input.trim().length <= 15) {
  384. //点击确认
  385. $.showLoading();
  386. $.get('/mobile/index.php?act=member_talk&op=room_edit',
  387. {
  388. room_name: input,
  389. room_id: talk_id,
  390. client_type: 'ajax'
  391. }, function (res) {
  392. $.hideLoading();
  393. var result = JSON.parse(res);
  394. if (result.code != 200) {
  395. $.alert(result.message);
  396. return;
  397. }
  398. var new_group_name = input.trim();
  399. $('#edit_group_name .weui-cell__ft').text(new_group_name);
  400. $('.group_name h3').text(new_group_name);
  401. $.toast('修改成功',1000);
  402. });
  403. }
  404. else {
  405. $.alert('群名称不得超过15字');
  406. }
  407. },
  408. onCancel: function () {
  409. //点击取消
  410. }
  411. });
  412. });
  413. $('#edit_nickname').on('click',function(){
  414. $.prompt({
  415. title: '修改我的昵称',
  416. text: '请输入您的昵称(不得超过15字)',
  417. empty: false, // 是否允许为空
  418. onOK: function (input) {
  419. if (input && input.trim().length <= 15) {
  420. //点击确认
  421. $.showLoading();
  422. $.get('/mobile/index.php?act=member_talk&op=change_membernick',
  423. {
  424. member_nick: input,
  425. room_id: talk_id,
  426. client_type: 'ajax'
  427. }, function (res) {
  428. $.hideLoading();
  429. var result = JSON.parse(res);
  430. if (result.code != 200) {
  431. $.alert(result.message);
  432. return;
  433. }
  434. var new_group_name = input.trim();
  435. $('.weui-flex__item[data-member-id="'+cur_mid+'"] p').text(new_group_name);
  436. $('.group-nickname').text(new_group_name);
  437. $.toast('修改成功',1000);
  438. });
  439. }
  440. else {
  441. $.alert('群名称不得超过15字');
  442. }
  443. },
  444. onCancel: function () {
  445. //点击取消
  446. }
  447. });
  448. });
  449. $('#edit_room_desc').on('click',function(){
  450. $.prompt({
  451. title: '修改群介绍',
  452. text: '请输入群的简介(65个字符以内)',
  453. empty: false, // 是否允许为空
  454. onOK: function (input) {
  455. if (input && input.trim().length <= 65) {
  456. //点击确认
  457. $.showLoading();
  458. $.get('/mobile/index.php?act=member_talk&op=room_edit',
  459. {
  460. room_desc: input,
  461. room_id: talk_id,
  462. client_type: 'ajax'
  463. }, function (res) {
  464. $.hideLoading();
  465. var result = JSON.parse(res);
  466. if (result.code != 200) {
  467. $.alert(result.message);
  468. return;
  469. }
  470. var room_desc = input.trim();
  471. $('.group_name p').text(room_desc);
  472. $('#room-desc-btn').text("已设置");
  473. $.toast('修改成功',1000);
  474. });
  475. }
  476. else {
  477. $.alert('群介绍不得超过65字');
  478. }
  479. },
  480. onCancel: function () {
  481. //点击取消
  482. }
  483. });
  484. });
  485. $('#quit_group').on('click',function(){
  486. $.confirm({
  487. title: '确认退出',
  488. text: '您确认退出该群吗?',
  489. onOK: function () {
  490. $.showLoading();
  491. $.get('/mobile/index.php?act=member_talk&op=leave',{
  492. room_id:talk_id,
  493. client_type:'ajax'
  494. },function(res){
  495. var datas = JSON.parse(res);
  496. if(datas.code != 200) {
  497. $.alert(datas.message);
  498. $.hideLoading();
  499. return;
  500. }
  501. $.hideLoading();
  502. $.toast('退出成功',1000);
  503. if(is_app) {
  504. var jsonobject = {
  505. action: "talk_quit",
  506. params: {
  507. talk_id: talk_id,
  508. talk_type: talk_type
  509. }
  510. };
  511. jsBridge.call_native_handler('on_native_click', JSON.stringify(jsonobject),function(){
  512. $.hideLoading();
  513. });
  514. } else {
  515. WeixinJSBridge.call('closeWindow');
  516. }
  517. });
  518. },
  519. onCancel: function () {
  520. }
  521. });
  522. });
  523. $('#hide_msg').on('click', function () {
  524. $.confirm({
  525. title: '确认清空',
  526. text: '您确认清空聊天记录吗?',
  527. onOK: function () {
  528. $.showLoading();
  529. $.get('/mobile/index.php?act=member_talk&op=hide_msg',
  530. {
  531. room_id: talk_id,
  532. client_type: 'ajax'
  533. }, function (res) {
  534. $.hideLoading();
  535. var result = JSON.parse(res);
  536. console.log(result);
  537. if (result.code != 200) {
  538. $.alert(result.message);
  539. return;
  540. }
  541. $.toast('清除成功',1000);
  542. var jsonobject = {
  543. action: "talk_clear",
  544. params: {
  545. talk_id: talk_id,
  546. talk_type: talk_type
  547. }
  548. };
  549. jsBridge.call_native_handler('on_native_click', JSON.stringify(jsonobject));
  550. });
  551. },
  552. onCancel: function () {
  553. }
  554. })
  555. });
  556. $('#add_group').on('click', function () {
  557. $.showLoading();
  558. $.get('/mobile/index.php?act=member_talk&op=send_apply',
  559. {
  560. room_id: talk_id,
  561. relay_id:relay_id,
  562. client_type: 'ajax'
  563. },
  564. function (res) {
  565. $.hideLoading();
  566. var result = JSON.parse(res);
  567. if (result.code != 200) {
  568. $.alert(result.message);
  569. return;
  570. }
  571. $.toast('进入成功',1000,function(){
  572. if(is_app) {
  573. var jsonobject = {
  574. action:"chat_to",
  575. params:{
  576. talk_type:"room",
  577. talk_id:talk_id,
  578. name:'<?php echo str_replace("'","",$output['param']['room_name'])?>'
  579. }
  580. };
  581. jsBridge.call_native_handler('on_native_click', JSON.stringify(jsonobject));
  582. } else {
  583. window.location.reload();
  584. }
  585. });
  586. });
  587. });
  588. $('#add_group_pwd').on('click', function () {
  589. $('.room_pwd_board').show();
  590. pwdBoard.clear();
  591. });
  592. $('#add_group_apply').on('click', function () {
  593. window.location.href = "/mobile/index.php?act=member_talk&op=message_board&type=1&talk_id="+talk_id;
  594. });
  595. $('#add-member-btn').on('click',function(){
  596. var member = $(this).attr("data-member-id");
  597. window.location.href = "/mobile/index.php?act=member_talk&op=message_board&type=2&talk_id="+member;
  598. });
  599. $('#talk-member-btn').on('click',function(){
  600. var nickname = $(this).attr("data-member-nickname").trim();
  601. var member_id = $(this).attr("data-member-id");
  602. var jsonobject = {
  603. action:"chat_to",
  604. params:{
  605. talk_type:"chatwo",
  606. talk_id:member_id,
  607. name:nickname
  608. }
  609. };
  610. jsBridge.call_native_handler('on_native_click', JSON.stringify(jsonobject));
  611. });
  612. $('.group_notice_board p').on('click',function(){
  613. $(this).toggleClass('text_overflow');
  614. if($(this).hasClass('text_overflow')) {
  615. $('.group_notice_board').removeAttr('style');
  616. }
  617. else {
  618. $('.group_notice_board').css('max-height','999px');
  619. }
  620. });
  621. $('.qrcode_btn').on('click',function(){
  622. $('.pop').show(200);
  623. });
  624. $('.close_btn').on('click',function(){
  625. $('.pop').hide();
  626. });
  627. $('.pop').on('touchmove',function(e){
  628. e.preventDefault();
  629. });
  630. $('#group_pwd').on('click',function(e){
  631. if(!$(this).is(':checked')) {
  632. e.preventDefault();
  633. $.showLoading();
  634. $.get('/mobile/index.php?act=member_talk&op=change_passwd',
  635. {
  636. room_id: talk_id,
  637. client_type: 'ajax',
  638. use_pass:0
  639. }, function (res) {
  640. $.hideLoading();
  641. var result = JSON.parse(res);
  642. if (result.code != 200) {
  643. $.alert(result.message);
  644. return;
  645. }
  646. $('#group_pwd').removeAttr('checked');
  647. });
  648. }
  649. else {
  650. $('.room_pwd_board').show();
  651. pwdBoard.clear();
  652. }
  653. });
  654. $('#group_AC').on('click',function(){
  655. $.actions({
  656. actions: [{
  657. text: "企业认证",
  658. onClick: function() {
  659. $('.weui-actionsheet__action .weui-actionsheet__cell').click();
  660. setTimeout(function () {
  661. window.location.href="/mobile/index.php?act=member_talk&op=room_certificate&ctype=2&talk_id="+talk_id;
  662. },0)
  663. }
  664. },{
  665. text: "校园认证",
  666. onClick: function() {
  667. $('.weui-actionsheet__action .weui-actionsheet__cell').click();
  668. setTimeout(function () {
  669. window.location.href="/mobile/index.php?act=member_talk&op=room_certificate&ctype=1&talk_id="+talk_id;
  670. },0)
  671. }
  672. }]
  673. });
  674. });
  675. $('.group_members .member-detail').on('click',function(){
  676. var schema = $(this).attr('data-schema');
  677. window.location.href = schema;
  678. });
  679. $("#room-apply-btn").on('click',function () {
  680. window.location.href = "/mobile/index.php?act=member_talk&op=room_applys&talk_id="+talk_id;
  681. });
  682. var make_qrcode = function () {
  683. var typeNumber = 10;
  684. var errorCorrectionLevel = 'L';
  685. var qrCode = qrcode(typeNumber, errorCorrectionLevel);
  686. qrCode.addData(document.getElementById('show-qrcode').getAttribute('data-qrcode-url'));
  687. qrCode.make();
  688. document.getElementById('show-qrcode').innerHTML = qrCode.createImgTag(3,2);
  689. };
  690. make_qrcode();
  691. $("#view-group-notice").on('click',function () {
  692. var has_notice = parseInt($(this).attr('data-has-notice'));
  693. var ismanager = parseInt($(this).attr('data-ismanager'));
  694. if( has_notice || ismanager){
  695. var schema = $(this).attr("data-schema");
  696. window.location.href = schema;
  697. }else{
  698. $.alert("只有群主可以编辑公告");
  699. return false;
  700. }
  701. });
  702. var PwdBoard = function(){
  703. this.send_type = '';
  704. this.init = function () {
  705. if($('#add_group_pwd').length > 0) {
  706. this.send_type = 'apply';
  707. }
  708. else {
  709. this.send_type = 'create';
  710. }
  711. this.input();
  712. this.del();
  713. this.cancel();
  714. };
  715. this.pwd = [];
  716. this.input = function(){
  717. var _self = this;
  718. $(document).on('click','.input_number',function(){
  719. var number = $(this).text();
  720. _self.pwd.push(number);
  721. _self.show();
  722. if(_self.pwd.length >= 4) {
  723. _self.send();
  724. }
  725. });
  726. };
  727. this.clear = function(){
  728. $('.pwd .line').empty();
  729. this.pwd = [];
  730. };
  731. this.show = function(){
  732. $('.pwd .line').empty();
  733. for(var i=0;i<this.pwd.length;i++) {
  734. $('.pwd .line').eq(i).text(this.pwd[i]);
  735. }
  736. };
  737. this.del = function(){
  738. var _self = this;
  739. $(document).on('click','.delete_btn',function(){
  740. if(_self.pwd.length <= 0) return;
  741. _self.pwd.pop();
  742. _self.show();
  743. });
  744. };
  745. this.cancel = function(){
  746. $(document).on('click','.cancel',function(){
  747. $('.room_pwd_board').hide();
  748. $('#group_pwd').removeAttr('checked');
  749. });
  750. };
  751. this.send = function(){
  752. $.showLoading();
  753. if(this.send_type == 'create') {
  754. $.get('/mobile/index.php?act=member_talk&op=change_passwd',
  755. {
  756. passwd: this.pwd.join(""),
  757. room_id: talk_id,
  758. client_type: 'ajax',
  759. use_pass:1
  760. }, function (res) {
  761. $.hideLoading();
  762. var result = JSON.parse(res);
  763. if (result.code != 200) {
  764. $.alert(result.message);
  765. $('#group_pwd').removeAttr('checked');
  766. return;
  767. }
  768. $('#group_pwd').attr('checked',true);
  769. setTimeout(function(){
  770. $('.room_pwd_board').hide();
  771. },1000);
  772. $.toast('群密码设置成功',1500);
  773. });
  774. }
  775. else if(this.send_type == 'apply')
  776. {
  777. $.get('/mobile/index.php?act=member_talk&op=send_apply',
  778. {
  779. passwd :this.pwd.join(""),
  780. relay_id:relay_id,
  781. room_id: talk_id,
  782. client_type: 'ajax'
  783. }, function (res) {
  784. $.hideLoading();
  785. var result = JSON.parse(res);
  786. if (result.code != 200) {
  787. $.alert(result.message);
  788. setTimeout(function(){
  789. $('.room_pwd_board').hide();
  790. },1000);
  791. return;
  792. }
  793. setTimeout(function(){
  794. $('.room_pwd_board').hide();
  795. },1000);
  796. $.toast('进入成功',1000);
  797. var jsonobject = {
  798. action:"chat_to",
  799. params:{
  800. talk_type:"room",
  801. talk_id:talk_id,
  802. name:'<?php echo str_replace("'","",$output['param']['room_name'])?>'
  803. }
  804. };
  805. jsBridge.call_native_handler('on_native_click', JSON.stringify(jsonobject));
  806. });
  807. }
  808. };
  809. this.init();
  810. };
  811. var pwdBoard = new PwdBoard();
  812. function app()
  813. {
  814. var app=navigator.userAgent.toLowerCase(),//判断设备
  815. app_nav=navigator.appVersion.toLowerCase(),
  816. href='';
  817. if (app_nav.indexOf('iphone')>-1&&app.indexOf('iphone')){
  818. href='http://a.app.qq.com/o/simple.jsp?pkgname=com.lrlz.beautyshop';
  819. } else if (app.indexOf('micromessenger')>-1 && app_nav.indexOf('android')>-1) {
  820. href = "<?php echo BASE_SITE_URL . "/hfive/android_down/index.html"; ?>";
  821. }
  822. else {
  823. href="javascript:void(0)";
  824. }
  825. return href;
  826. }
  827. $('#link').attr('href',app());
  828. $("#more_members").on('click',function () {
  829. var url = $(this).attr('data-page');
  830. window.location.href = url;
  831. });
  832. $("#open_talk").on('click',function () {
  833. var jsonobject = {
  834. action:"chat_to",
  835. params:{
  836. talk_type:"room",
  837. talk_id:talk_id,
  838. name:'<?php echo str_replace("'","",$output['param']['room_name'])?>'
  839. }
  840. };
  841. jsBridge.call_native_handler('on_native_click', JSON.stringify(jsonobject));
  842. return;
  843. });
  844. }
  845. );
  846. </script>
  847. </body>
  848. </html>