123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
- <title>群主页</title>
- <link type="text/css" rel="stylesheet"
- href="<?php echo RESOURCE_SITE_URL; ?>/mobile/talk/css/weui.css?<?php echo bonus_version(); ?>"/>
- <link rel="stylesheet"
- href="https://cdn.bootcss.com/jquery-weui/1.2.0/css/jquery-weui.min.css?<?php echo bonus_version(); ?>">
- <link type="text/css" rel="stylesheet"
- href="<?php echo RESOURCE_SITE_URL; ?>/mobile/talk/css/homepage.css?<?php echo bonus_version(); ?>"/>
- </head>
- <body>
- <?php $output['tpl']->show_cover(); ?>
- <div class="group_top">
- <div class="group_info">
- <?php $output['tpl']->show_group_header(); ?>
- <?php $output['tpl']->show_qrcode_btn(); ?>
- </div>
- <?php $output['tpl']->show_group_notice(); ?>
- <div class="group_handle weui-flex">
- <?php $output['tpl']->show_group_activity(); ?>
- </div>
- <div class="group_members weui-flex">
- <?php $output['tpl']->show_members(); ?>
- </div>
- <div id="callback"></div>
- </div>
- <?php $output['tpl']->show_group_body(); ?>
- <?php $output['tpl']->show_personal_settings(); ?>
- <?php $output['tpl']->show_group_footer(); ?>
- <?php $output['tpl']->show_footer_btn(); ?>
- <div class="pop">
- <?php $output['tpl']->show_qrcode()?>
- </div>
- <script src="https://cdn.bootcss.com/jquery/1.11.0/jquery.min.js?<?php echo bonus_version(); ?>"></script>
- <script src="https://cdn.bootcss.com/jquery-weui/1.2.0/js/jquery-weui.min.js?<?php echo bonus_version(); ?>"></script>
- <script type="text/javascript"
- src="<?php echo RESOURCE_SITE_URL; ?>/mobile/comm/new_bridge.js?<?php echo bonus_version(); ?>"></script>
- <script type="text/javascript"
- src="<?php echo RESOURCE_SITE_URL; ?>/js/ajaxfileupload/ajaxfileupload.js?<?php echo bonus_version(); ?>"></script>
- <script type="text/javascript">
- $(function () {
- var talk_type = "<?php echo $output['param']['talk_type']; ?>";
- var talk_id = "<?php echo $output['param']['talk_id']; ?>";
- var cur_mid ="<?php echo $output['param']['member_id']; ?>";
- var jsBridge = new Bridge();
- if($('#add_group_pwd').length > 0 || $('#add_group_apply').length > 0 || $('#add_group').length > 0) {
- $('html').css({"min-height":"100%",background:"#ffffff"})
- }
- var ajaxFileUpload = function () {
- $.showLoading();
- $.ajaxFileUpload({
- url: '/upfile.php',
- secureuri: false,
- type: 'post',
- fileElementId: 'uploader',
- dataType: 'json',
- data: {
- room_id: talk_id
- },
- success: function (res) {
- if (res.code != 200) {
- $.hideLoading();
- $.alert(res.message);
- } else {
- var room_avatar = res.datas.file_path;
- console.log(room_avatar);
- if (room_avatar) {
- const update = update_room_avatar(room_avatar);
- if (update) {
- $.hideLoading();
- } else {
- $.alert("网络错误");
- }
- } else {
- }
- }
- },
- error: function (data, status, e) {
- }
- });
- $('#uploader').on('change', function () {
- ajaxFileUpload();
- });
- };
- $('#uploader').on('change', function () {
- ajaxFileUpload();
- });
- var update_room_avatar = function (room_avatar) {
- $.post('/mobile/index.php?act=member_talk&op=change_room_avatar',
- {
- room_id: talk_id,
- file_path: room_avatar,
- client_type: 'ajax'
- }, function (res) {
- console.log(res);
- var result = JSON.parse(res);
- if (result.code != 200) {
- $.alert(result.message);
- return false;
- } else {
- console.log(result.datas.avatar);
- $(".g_avatar").attr("src", result.datas.avatar);
- $.toast('修改成功',1000);
- }
- });
- return true;
- };
- var getTalkInfo = function () {
- var jsonobject = {
- action: "talk_info",
- params: {
- talk_id: talk_id,
- talk_type: talk_type,//room和chatwo两个类型
- }
- };
- jsBridge.call_native_handler('on_native_click', JSON.stringify(jsonobject), function (res) {
- var datas = JSON.parse(res);
- if (datas.talk_info.stick) {
- $('#talk_top').attr('checked', true);
- }
- if (datas.talk_info.forbid) {
- $('#no_disturb').attr('checked', true);
- }
- });
- };
- getTalkInfo();
- $('#add_member').on('click', function () {
- var jsonobject = {
- action: "friend_add",
- params: {
- room_id: talk_id
- }
- };
- $.showLoading();
- jsBridge.call_native_handler('on_native_click', JSON.stringify(jsonobject), function (res) {
- $.hideLoading();
- var datas = JSON.parse(res);
- if (datas.friends.length <= 0 || datas.friends == null) return;
- var add_friends = datas.friends.join(',');
- $.showLoading();
- $.get('/mobile/index.php?act=member_talk&op=invite',
- {
- invitees: add_friends,
- room_id: talk_id,
- client_type: 'ajax'
- },
- function (res) {
- $.hideLoading();
- var datas = JSON.parse(res);
- if (datas.code != 200) {
- $.alert(datas.message);
- return;
- }
- var html = '';
- if (datas.datas.invitees && datas.datas.invitees.length > 0) {
- for (var i = 0; i < datas.datas.invitees.length; i++) {
- html += '<div class="weui-flex__item" data-member-id="' + datas.datas.invitees[i].member_id + '">' +
- '<img src="' + datas.datas.invitees[i].avatar + '" alt="">' +
- '<p>' + datas.datas.invitees[i].nickname + '</p>\n' +
- '</div>'
- }
- $('div[data-last="true"]').after(html);
- $.toast('添加成功',1000);
- }
- });
- });
- });
- $('#del_member').on('click', function () {
- var jsonobject = {
- action: "friend_del",
- params: {
- room_id: talk_id
- }
- };
- $.showLoading();
- jsBridge.call_native_handler('on_native_click', JSON.stringify(jsonobject), function (res) {
- $.hideLoading();
- var datas = JSON.parse(res);
- if (datas.friends.length <= 0 || datas.friends == null) return;
- var del_friends = datas.friends.join(',');
- $.showLoading();
- $.get('/mobile/index.php?act=member_talk&op=kickout', {
- users: del_friends,
- room_id: talk_id,
- client_type: 'ajax'
- }, function (res) {
- $.hideLoading();
- var result = JSON.parse(res);
- if (result.code != 200) {
- $.alert(result.message);
- return;
- }
- var del_users = result.datas.users;
- var num = del_users.length;
- if(num > 0)
- {
- for (var i = 0; i < del_users.length; i++) {
- $('div[data-member-id=' + datas.friends[i] + ']').remove();
- }
- $.toast('删除成功',1000);
- }else
- {
- $.alert("请先移交管理员权限后,再离开聊天");
- return;
- }
- });
- });
- });
- $('#change_owner').on('click', function () {
- var jsonobject = {
- action: "talk_manager",
- params: {
- room_id: talk_id
- }
- };
- $.showLoading();
- jsBridge.call_native_handler('on_native_click', JSON.stringify(jsonobject), function (res) {
- $.hideLoading();
- var datas = JSON.parse(res);
- if (datas.friends.length <= 0 || datas.friends == null) return;
- var new_owner = datas.friends.join(',');
- $.showLoading();
- $.get('/mobile/index.php?act=member_talk&op=change_room_owner',
- {
- room_owner:new_owner,
- room_id: talk_id,
- client_type: 'ajax'
- }, function (res) {
- $.hideLoading();
- var result = JSON.parse(res);
- console.log(result);
- if (result.code != 200) {
- $.alert(result.message);
- return;
- }
- $.toast('转让成功',1000);
- setTimeout(function () {
- window.location.reload();
- },1000);
- });
- });
- });
- $('#talk_top').on('change', function () {
- var _selfVal = $(this).is(':checked');
- var jsonobject;
- if (_selfVal) {
- jsonobject = {
- action: "talk_stick",
- params: {
- talk_id: talk_id,
- talk_type: talk_type,
- stick: true
- }
- };
- }
- else {
- jsonobject = {
- action: "talk_stick",
- params: {
- talk_id: talk_id,
- talk_type: talk_type,
- stick: false
- }
- };
- }
- jsBridge.call_native_handler('on_native_click', JSON.stringify(jsonobject));
- });
- $('#no_disturb').on('change', function () {
- var _selfVal = $(this).is(':checked');
- var jsonobject;
- if (_selfVal) {
- jsonobject = {
- action: "talk_forbid",
- params: {
- talk_id: talk_id,
- talk_type: talk_type,
- forbid: true
- }
- };
- }
- else {
- jsonobject = {
- action: "talk_forbid",
- params: {
- talk_id: talk_id,
- talk_type: talk_type,
- forbid: false
- }
- };
- }
- jsBridge.call_native_handler('on_native_click', JSON.stringify(jsonobject));
- });
- $('#edit_group_name').on('click', function () {
- $.prompt({
- title: '修改群名称',
- text: '请输入群名称(不得超过15字)',
- empty: false, // 是否允许为空
- onOK: function (input) {
- if (input && input.trim().length <= 15) {
- //点击确认
- $.showLoading();
- $.get('/mobile/index.php?act=member_talk&op=room_edit',
- {
- room_name: input,
- room_id: talk_id,
- client_type: 'ajax'
- }, function (res) {
- $.hideLoading();
- var result = JSON.parse(res);
- if (result.code != 200) {
- $.alert(result.message);
- return;
- }
- var new_group_name = input.trim();
- $('#edit_group_name .weui-cell__ft').text(new_group_name);
- $('.group_name h3').text(new_group_name);
- $.toast('修改成功',1000);
- });
- }
- else {
- $.alert('群名称不得超过15字');
- }
- },
- onCancel: function () {
- //点击取消
- }
- });
- });
- $('#edit_nickname').on('click',function(){
- $.prompt({
- title: '修改我的昵称',
- text: '请输入您的昵称(不得超过15字)',
- empty: false, // 是否允许为空
- onOK: function (input) {
- if (input && input.trim().length <= 15) {
- //点击确认
- $.showLoading();
- $.get('/mobile/index.php?act=member_talk&op=change_membernick',
- {
- member_nick: input,
- room_id: talk_id,
- client_type: 'ajax'
- }, function (res) {
- $.hideLoading();
- var result = JSON.parse(res);
- if (result.code != 200) {
- $.alert(result.message);
- return;
- }
- var new_group_name = input.trim();
- $('.weui-flex__item[data-member-id="'+cur_mid+'"] p').text(new_group_name);
- $('.group-nickname').text(new_group_name);
- $.toast('修改成功',1000);
- });
- }
- else {
- $.alert('群名称不得超过15字');
- }
- },
- onCancel: function () {
- //点击取消
- }
- });
- });
- $('#edit_room_notice').on('click',function(){
- $.prompt({
- title: '修改群公告',
- input: '请输入公告信息',
- empty: false, // 是否允许为空
- onOK: function (input) {
- if (input && input.trim().length <= 120) {
- //点击确认
- $.showLoading();
- $.get('/mobile/index.php?act=member_talk&op=change_room_notice',
- {
- room_notice: input,
- room_id: talk_id,
- client_type: 'ajax'
- }, function (res) {
- $.hideLoading();
- var result = JSON.parse(res);
- if (result.code != 200) {
- $.alert(result.message);
- return;
- }
- var new_notice = "【公告】"+ input.trim();
- $('.group_notice_board p').text(new_notice);
- $('#room-notice-btn').text("已设置");
- $('.group_notice_board').show();
- $.toast('修改成功',1000);
- });
- }
- else {
- $.alert('群公告不得超过120字');
- }
- },
- onCancel: function () {
- //点击取消
- }
- });
- $("#weui-prompt-input").remove(); //去除原始输入框
- $(".weui-dialog__bd").append('<textarea rows="8" style="height:110px;" class="weui_input weui-prompt-input" id="weui-prompt-input" value=""></textarea>');
- });
- $('#edit_room_desc').on('click',function(){
- $.prompt({
- title: '修改群介绍',
- text: '请输入群的简介(65个字符以内)',
- empty: false, // 是否允许为空
- onOK: function (input) {
- if (input && input.trim().length <= 65) {
- //点击确认
- $.showLoading();
- $.get('/mobile/index.php?act=member_talk&op=room_edit',
- {
- room_desc: input,
- room_id: talk_id,
- client_type: 'ajax'
- }, function (res) {
- $.hideLoading();
- var result = JSON.parse(res);
- if (result.code != 200) {
- $.alert(result.message);
- return;
- }
- var room_desc = input.trim();
- $('.group_name p').text(room_desc);
- $('#room-desc-btn').text("已设置");
- $.toast('修改成功',1000);
- });
- }
- else {
- $.alert('群介绍不得超过65字');
- }
- },
- onCancel: function () {
- //点击取消
- }
- });
- });
- $('#quit_group').on('click',function(){
- $.confirm({
- title: '确认退出',
- text: '您确认退出该群吗?',
- onOK: function () {
- $.showLoading();
- $.get('/mobile/index.php?act=member_talk&op=leave',{
- room_id:talk_id,
- client_type:'ajax'
- },function(res){
- var datas = JSON.parse(res);
- if(datas.code != 200) {
- $.alert(datas.message);
- $.hideLoading();
- return;
- }
- var jsonobject = {
- action: "talk_quit",
- params: {
- talk_id: talk_id,
- talk_type: talk_type
- }
- };
- jsBridge.call_native_handler('on_native_click', JSON.stringify(jsonobject),function(){
- $.hideLoading();
- });
- });
- },
- onCancel: function () {
- }
- });
- });
- $('#hide_msg').on('click', function () {
- $.confirm({
- title: '确认清空',
- text: '您确认清空聊天记录吗?',
- onOK: function () {
- $.showLoading();
- $.get('/mobile/index.php?act=member_talk&op=hide_msg',
- {
- room_id: talk_id,
- client_type: 'ajax'
- }, function (res) {
- $.hideLoading();
- var result = JSON.parse(res);
- console.log(result);
- if (result.code != 200) {
- $.alert(result.message);
- return;
- }
- var jsonobject = {
- action: "talk_clear",
- params: {
- talk_id: talk_id,
- talk_type: talk_type
- }
- };
- jsBridge.call_native_handler('on_native_click', JSON.stringify(jsonobject));
- $.toast('清除成功',1000);
- });
- },
- onCancel: function () {
- }
- })
- });
- $('#add_group').on('click', function () {
- $.showLoading();
- $.get('/mobile/index.php?act=member_talk&op=send_apply',
- {
- room_id: talk_id,
- client_type: 'ajax'
- }, function (res) {
- $.hideLoading();
- var result = JSON.parse(res);
- console.log(result);
- if (result.code != 200) {
- $.alert(result.message);
- return;
- }
- $.toast('进入成功',1000);
- });
- });
- $('#add_group_pwd').on('click', function () {
- $.prompt({
- title: '密码进群',
- text: '请输入密码(最长8位)',
- empty: false, // 是否允许为空
- onOK: function (input) {
- if (input && input.trim().length <= 8) {
- $.showLoading();
- $.get('/mobile/index.php?act=member_talk&op=send_apply',
- {
- passwd :input,
- room_id: talk_id,
- client_type: 'ajax'
- }, function (res) {
- $.hideLoading();
- var result = JSON.parse(res);
- console.log(result);
- if (result.code != 200) {
- $.alert(result.message);
- return;
- }
- $.toast('进入成功',1000);
- });
- }
- else {
- $.alert('密码最长为8位,可以由英文字母和数字任意组成,不区分大小写');
- }
- },
- onCancel: function () {
- //点击取消
- }
- });
- });
- $('#add_group_apply').on('click', function () {
- $.prompt({
- title: '申请入群',
- text: '请输入自我介绍(30字符以内)',
- empty: false,
- onOK: function (input) {
- if (input && input.trim().length <= 30) {
- $.showLoading();
- $.get('/mobile/index.php?act=member_talk&op=send_apply',
- {
- apply:1,
- msg :input,
- room_id: talk_id,
- client_type: 'ajax'
- }, function (res) {
- $.hideLoading();
- var result = JSON.parse(res);
- console.log(result);
- if (result.code != 200) {
- $.alert(result.message);
- return;
- }
- $.toast('申请成功',1000);
- });
- }
- else {
- $.alert('入群申请最长不得超过30字符');
- }
- },
- onCancel: function () {
- //点击取消
- }
- });
- });
- $('.group_notice_board p').on('click',function(){
- $(this).toggleClass('text_overflow');
- if($(this).hasClass('text_overflow')) {
- $('.group_notice_board').removeAttr('style');
- }
- else {
- $('.group_notice_board').css('max-height','999px');
- }
- });
- $('.qrcode_btn').on('click',function(){
- $('.pop').show(200);
- });
- $('.close_btn').on('click',function(){
- $('.pop').hide();
- });
- $('.pop').on('touchmove',function(e){
- e.preventDefault();
- });
- $('#group_pwd').on('click',function(e){
- if(!$(this).is(':checked')) {
- e.preventDefault();
- $.showLoading();
- $.get('/mobile/index.php?act=member_talk&op=change_passwd',
- {
- room_id: talk_id,
- client_type: 'ajax',
- use_pass:0
- }, function (res) {
- $.hideLoading();
- var result = JSON.parse(res);
- if (result.code != 200) {
- $.alert(result.message);
- return;
- }
- $('#group_pwd').removeAttr('checked');
- });
- }
- else {
- $.prompt({
- title: '修改群密码',
- text: '请设置4-8位群密码',
- empty: false,
- onOK: function (input) {
- if (input && (input.trim().length <= 8 && input.trim().length >= 4)) {
- //点击确认
- $.showLoading();
- $.get('/mobile/index.php?act=member_talk&op=change_passwd',
- {
- passwd: input,
- room_id: talk_id,
- client_type: 'ajax',
- use_pass:1
- }, function (res) {
- $.hideLoading();
- var result = JSON.parse(res);
- if (result.code != 200) {
- $.alert(result.message);
- $('#group_pwd').removeAttr('checked');
- return;
- }
- $('#group_pwd').attr('checked',true);
- $.toast('群密码设置成功',1000);
- });
- }
- else {
- $('#group_pwd').removeAttr('checked');
- $.alert('群密码设置错误,请重试');
- }
- },
- onCancel: function () {
- $('#group_pwd').removeAttr('checked');
- }
- });
- }
- });
- }
- );
- </script>
- </body>
- </html>
|