123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589 |
- <template>
- <view class="page">
- <view class="page-content">
- <view class="page-list">
- <view class="page-item">
- <view class="page-item-left">
- <view>全员禁言</view>
- <view class="page-item-info">开启后仅群主和管理员可以发言</view>
- </view>
- <view class="page-item-right">
- <switch :checked="!!data.group.is_msg" @change="msgChange" />
- </view>
- </view>
- <view class="page-item">
- <view class="page-item-left">
- <view>允许群成员修改群名称和头像</view>
- <view class="page-item-info">关闭后紧群主和管理员可以修改群名称和头像</view>
- </view>
- <view class="page-item-right">
- <switch :checked="!!data.group.edit_photo" @change="editChange" />
- </view>
- </view>
- <view class="page-item">
- <view class="page-item-left">
- <view>允许群成员领取长时间未领取的红包</view>
- <view class="page-item-info">关闭后仅群主和管理员使用</view>
- </view>
- <view class="page-item-right">
- <switch :checked="!!data.group.can_get_bigred" @change="getRedChange" />
- </view>
- </view>
- <view class="page-item">
- <view class="page-item-left">
- <view>允许群成员上麦</view>
- <view class="page-item-info">关闭后仅群主和管理员可以上麦</view>
- </view>
- <view class="page-item-right">
- <switch :checked="!!data.group.can_shangmai" @change="shangmai" />
- </view>
- </view>
- <view class="page-item">
- <view class="page-item-left">
- <view>群内禁止好友</view>
- <view class="page-item-info">关闭后群成员直接可以加好友</view>
- </view>
- <view class="page-item-right">
- <switch checked="!data.group.can_add_friend" @change="switch1Change"/>
- </view>
- </view>
- <view class="page-item">
- <view class="page-item-left">
- <view>匿名聊天</view>
- <view class="page-item-info">开启后用户聊天不显示真实头像</view>
- </view>
- <view class="page-item-right">
- <switch :checked="data.group.can_niming == 1" @change="nimingChange" />
- </view>
- </view>
- <view class="page-item-footer" @tap="goSetAdmin(4)">
- <view class="page-item-left">
- <view>一键复制新群</view>
- </view>
- <view class="page-item-right">
- <view class="iconfont-im icon-jiantou font-jiantou"></view>
- </view>
- </view>
- <view class="footer-list">
- <view class="page-item-footer" @tap="goSetAdmin(1)">
- <view class="page-item-left">
- <view>设置管理员</view>
- </view>
- <view class="page-item-right">
- <view class="iconfont-im icon-jiantou font-jiantou"></view>
- </view>
- </view>
- <view class="footer-hr"></view>
- <view class="page-item-footer" @tap="goSetAdmin(3)">
- <view class="page-item-left">
- <view>群主管理权转让</view>
- </view>
- <view class="page-item-right">
- <view class="iconfont-im icon-jiantou font-jiantou"></view>
- </view>
- </view>
- <view class="footer-hr"></view>
- <view class="page-item-footer" @tap="reduce">
- <view class="page-item-left">
- <view>踢出群成员</view>
- </view>
- <view class="page-item-right">
- <view class="iconfont-im icon-jiantou font-jiantou"></view>
- </view>
- </view>
- <view class="footer-hr"></view>
- <view class="page-item-footer" @tap="goSetAdmin(2)">
- <view class="page-item-left">
- <view>禁言设置</view>
- </view>
- <view class="page-item-right">
- <view class="iconfont-im icon-jiantou font-jiantou"></view>
- </view>
- </view>
- <view class="footer-hr"></view>
- <view class="doButton" v-show="data.is_action == 2" >
- <button class="group-button" type="button" @tap="removeGroup">解散该群</button>
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import _hook from '../../../common/_hook';
- import _data from '../../../common/_data';
- import _page from '../../../common/common';
- export default {
- data() {
- return {
- data: {
- member: [],
- group: {
- is_photo: 'default_group_photo/90.jpg',
- },
- is_action: 0,
- type: 1,
- },
- list_id: 0,
- };
- },
- computed: {
- staticPhoto(){
- return _data.staticPhoto();
- },
- isAction(){
- if(this.data.group.main_id == _data.data('user_info').id){
- return true;
- }
- return false;
- }
- },
- onShow(){
- _hook.routeSonHook();
- let _this = this;
- _this.$httpSend({
- path: '/im/message/getChatDetails',
- data: { list_id: _this.list_id, },
- success(data) {
- _this.data = data;
- if(data.type == 1){
- uni.setNavigationBarTitle({
- title: data.group.name,
- });
- }
- let cache_data = _data.data('cache');
- if(data.type == 1 && !('group_photo_' + _this.list_id in cache_data)){
- uni.downloadFile({
- url: _data.staticPhoto() + data.group.is_photo,
- success: (res) => {
- if (res.statusCode === 200) {
- cache_data['group_photo_' + _this.list_id] = res.tempFilePath;
- _data.data('cache',cache_data);
- }
- }
- });
- }
- }
- });
- },
- methods: {
- shangmai(e){
- //消息免打扰
- let value = e.detail.value ? 1 : 0;
- let _this = this;
- this.$httpSend({
- path: '/im/vendor/setShangmai',
- data: {list_id: this.list_id, value: value},
- success(data) {
- _data.localData('DISTURB:'+_this.list_id,value)
- }
- });
- },
- groupNickname(val){
- console.log(val)
- uni.navigateTo({
- url:'group_nickname?'+_page.pageParam({list_id:this.list_id,nickname:val})
- })
- },
- disturb(e){
- //消息免打扰
- let value = e.detail.value ? 1 : 0;
- let _this = this;
- this.$httpSend({
- path: '/im/message/msgDisturb',
- data: {list_id: this.list_id, value: value},
- success(data) {
- _data.localData('DISTURB:'+_this.list_id,value)
- }
- });
- },
- liveGroup(){
- //离开群聊
- let _this = this;
- uni.showModal({
- title: '重要提示',
- content: '确定要离开群聊吗?',
- confirmText: '离开',
- cancelText: '再看看',
- confirmColor: 'red',
- cancelColor: '#353535',
- success: function (res) {
- if (res.confirm) {
- _this.$httpSend({
- path: '/im/message/liveGroup',
- data: { list_id: _this.list_id },
- success(data) {
- console.log(data)
- uni.switchTab({
- url: '../index'
- });
- }
- });
- }
- }
- });
- },
- imageError(e){
- console.log("图片加载失败!",e.detail);
- let index = e.currentTarget.dataset.index
- console.log(e.currentTarget.dataset.index)
- //替换index对应的图片
- console.log(this.data.member[index].photo)
- this.data.member[index].photo = '/default_photo_path.png';
- },
- removeGroup(){
- let _this = this;
- uni.showModal({
- title: '重要提示',
- content: '此操作数据不可恢复,确定要解散该群吗?',
- confirmText: '不解散',
- cancelText: '解散',
- confirmColor: '#353535',
- cancelColor: 'red',
- success: function (res) {
- if (!res.confirm) {
- _this.$httpSend({
- path: '/im/message/removeGroup',
- data: { list_id: _this.list_id, },
- success(data) {
- uni.switchTab({
- url: '../index'
- });
- }
- });
- }
- }
- });
- },
- photo(path){
- return this.staticPhoto + path + '?_=' + Math.random();
- },
- msgChange(e){
- let value = e.detail.value ? 1 : 0;
- if(this.data.is_action != 2){
- uni.showModal({
- content: '没有权限设置',
- showCancel: false,
- });
- return;
- }
- this.$httpSend({
- path: '/im/message/groupIsMsg',
- data: { list_id: this.list_id,value, },
- success(data) {
- return;
- uni.showToast({
- title: '设置成功',
- duration: 1500
- });
- }
- });
- },
- nimingChange(e){
- let value = e.detail.value ? 1 : 0;
- if(!this.data.is_action && this.data.is_action != 2){
- uni.showModal({
- content: '没有权限设置',
- showCancel: false,
- });
- return;
- }
- this.$httpSend({
- path: '/im/message/nimingChange',
- data: { list_id: this.list_id,value, },
- success(data) {
- return;
- uni.showToast({
- title: '设置成功',
- duration: 1500
- });
- }
- });
- },
- msgTop(e){
- let _this = this,
- value = e.detail.value ? 1 : 0;
- this.$httpSend({
- path: '/im/message/chatTop',
- data: { list_id: this.list_id,value, },
- success(data) {
- /** 更新对话列表数据 */
- for(let i = 0,local_chat_list = _data.localData('chat_list'),j = local_chat_list.length;i < j;i ++){
- if(local_chat_list[i].list_id == _this.list_id){
- let action_list_data = local_chat_list[i];
- local_chat_list.splice(i,1);
- local_chat_list.unshift(action_list_data);
- _data.localData('chat_list',local_chat_list);
- uni.$emit('data_chat_list',local_chat_list);
- break;
- }
- }
- return;
- uni.showToast({
- title: '设置成功',
- duration: 1500
- });
- }
- });
- },
- switch1Change(e){
- let _this = this, value = e.detail.value ? 1 : 0;
- this.$httpSend({
- path: '/im/message/speekChecked',
- data: { list_id: this.list_id,value:value,},
- success(data) {
- /** 更新对话列表数据 */
- for(let i = 0,local_chat_list = _data.localData('chat_list'),j = local_chat_list.length;i < j;i ++){
- if(local_chat_list[i].list_id == _this.list_id){
- let action_list_data = local_chat_list[i];
- local_chat_list.splice(i,1);
- local_chat_list.unshift(action_list_data);
- _data.localData('chat_list',local_chat_list);
- uni.$emit('data_chat_list',local_chat_list);
- break;
- }
- }
- }
- });
- },
- editChange(e){
- let _this = this, value = e.detail.value ? 1 : 0;
- this.$httpSend({
- path: '/im/vendor/editChange',
- data: { list_id: this.list_id,value:value,},
- success(data) {
- }
- });
- },
- goGroupQrcode(){
- uni.navigateTo({
- url: ('./group_qrcode?list_id=' + this.list_id),
- animationType: 'slide-in-bottom',
- });
- },
- goSetGroupPhoto(){
- if(this.data.is_action != 2 && !this.data.group.edit_photo){
- uni.showToast({
- title: '没有权限设置',
- icon: 'none',
- duration: 1000
- });
- return;
- }
- uni.navigateTo({
- url: ('../../set/group_photo?list_id=' + this.list_id),
- animationType: 'slide-in-bottom',
- });
- },
- goSetAdmin(type){
- switch (type){
- case 1:
- if(this.data.is_action != 2){
- console.log("this.data.is_action",this.data.is_action)
- uni.showToast({
- title: '群主才能设置',
- icon: 'none',
- duration: 1000
- });
- return;
- }
- break;
- case 2:
- if(this.data.is_action != 2){
- uni.showModal({
- content: '没有权限设置',
- showCancel: false,
- });
- return;
- }
- break;
- case 3:
- if(this.data.is_action != 2){
- uni.showModal({
- content: '没有权限设置',
- showCancel: false,
- });
- return;
- }
- break;
- case 4:
- if(this.data.is_action != 2){
- uni.showModal({
- content: '没有权限设置',
- showCancel: false,
- });
- return;
- }
- break;
- default:
- return;
- break;
- }
- let url = '../../set/group_admin?list_id=' + this.list_id + '&type=' + type;
- if(type == 3)url = '../../set/group_trans?list_id=' + this.list_id + '&type=' + type;
- if(type == 4)url = '../../set/copy_group?list_id=' + this.list_id + '&type=' + type;
- uni.navigateTo({
- url: url,
- animationType: 'slide-in-bottom',
- });
- },
- goSet(type){
- if(this.data.is_action != 2 && !this.data.group.edit_photo){
- uni.showToast({
- title: '没有权限设置',
- icon: 'none',
- duration: 1000
- });
- return;
- }
- uni.navigateTo({
- url: ('../../set/message_more?list_id=' + this.list_id + '&type=' + type),
- animationType: 'slide-in-bottom',
- });
- },
- goDetails(user_id){
- if(this.data.type&& this.data.is_action != 2){
- uni.showToast({
- title: '没有权限查看',
- icon: 'none',
- duration: 1000
- });
- return;
- }
- uni.navigateTo({
- url: ('../../details/index?user_id=' + user_id+'&type='+this.data.type+'&list_id='+this.list_id+"&is_action="+this.data.is_action),
- });
- },
- add(){
- uni.navigateTo({
- url: ('../../friend/index_list?list_id=' + this.list_id),
- animationType: 'slide-in-bottom',
- });
- },
- reduce(){
- uni.navigateTo({
- url: ('./reduce?list_id=' + this.list_id),
- animationType: 'slide-in-bottom',
- });
- },
- groupCopy(value) {
- _page.uniCopy({
- content:this.data.group.id,
- success:function () {
- uni.showToast({'title':'复制成功',duration:2000})
- }
- })
- },
- replaceStr(str){
- console.log(str)
- return str.substr(10)
- },
- getRedChange(e){
- let _this = this, value = e.detail.value ? 1 : 0;
- this.$httpSend({
- path: '/im/vendor/getRedChange',
- data: { list_id: this.list_id,value:value,},
- success(data) {
- }
- });
- },
- goBigRedList(){ //todo 长时间未领取红包列表
- uni.navigateTo({url:"../message/red_list?list_id="+this.list_id})
- },
- manarger(){
- uni.navigateTo({url:'../message/qun_manage?list_id='+this.list_id})
- }
- },
- onLoad(option) {
- this.list_id = option.list_id;
- this.data.type = option.type;
- },
- }
- </script>
- <style>
- page{
- background-color: #e5e5e5;
- }
- .page{
- height: 100%;
- }
- .page-content{
- display:flex;
- justify-content: space-between;
- flex-direction: column;
- }
- .page-list{
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- }
- .page-item{
- display: flex;
- justify-content: space-between;
- align-items: center;
- background-color: #ffffff;
- margin-bottom: 10px;
- padding: 10px 20px;
- }
- .page-item-footer{
- display: flex;
- justify-content: space-between;
- align-items: center;
- background-color: #ffffff;
- padding: 10px 20px;
- }
- .footer-hr{
- height: 1upx;
- width: 90%;
- background-color: #e1e1e1;
- margin: 0 auto;
- }
- .page-list:first-child{
- border-top: 1upx solid #e1e1e1;
- }
- .page-item-left{
- display: flex;
- justify-content: center;
- flex-direction: column;
- }
- .footer-list{
- background-color: #ffffff;
- padding-bottom: 20px;
- }
- .page-item-info{
- color: #bababa;
- font-size: 12px;
- }
- .font-jiantou{
- font-size: 12px;
- }
- .page-item-footer .page-item-right{
- margin-right: 20px;
- }
- .page-item-footer{
- margin-bottom: 10px;
- }
- .doButton{
- padding: 10px;
- }
- .group-button{
- width: 92%;
- background-color: #5693ee;
- color: white;
- height: 70upx;
- line-height: 70upx !important;
- border-radius: 40upx;
- font-size: 36upx;
- cursor: pointer;
- margin-top: 20upx;
- }
- </style>
|