123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- <template>
- <div class="r-view-mgr" @click.stop>
- <template v-if="!adminShow">
- <div class="groudMgr-top">
- <i class="el-icon-arrow-left" @click="handleGroudMgr"></i>
- <span>{{$t('public.setting')}}</span>
- <i class="el-icon-close" @click="handleCloseCharSet"></i>
- </div>
- <div class="ad-wrap">
- <div class="ad-item" @click="adminShow = true">
- {{$t('group.adminSetting')}}<i class="el-icon-arrow-right"></i>
- </div>
- <div class="ad-item" @click="$showInvite(5)">
- {{$t('invite.transferGroupOwner')}}<i class="el-icon-arrow-right"></i>
- </div>
- <div class="ad-item" @click="addGroupAuth">
- {{$t('group.groupCertification')}}<i class="el-icon-arrow-right"></i>
- </div>
- <!-- <div class="ad-item" @click="$setGroupType">
- {{$t('group.groupTypeSetting')}}<i class="el-icon-arrow-right"></i>
- </div> -->
- <div class="ad-item" @click="isShowTeleTip=true">
- {{$t('group.relateTelegram')}}<i class="el-icon-arrow-right"></i>
- </div>
- </div>
- <a href="https://smartsignature.io/article/QmNrsHp36CTCQp5ggsy6dzSUuhzBKom7u53mtVf2JJoH3N" target="_blank" class="link-guide">群管理教程-></a>
- </template>
- <template v-else>
- <div class="groudMgr-top">
- <i class="el-icon-arrow-left" @click="adminShow = false"></i>
- <span>{{$t('group.admin')}}</span>
- <i class="el-icon-close" @click="handleCloseCharSet"></i>
- </div>
- <div class="groudMgr-admins">
- <div class="admins-add" @click="$showInvite(4)">
- <div class="add-fl">
- <i class="el-icon-circle-plus-outline"></i>{{$t('group.add')}}{{$t('group.admin')}}
- </div>
- <div class="add-fr">
- {{adminsList.length}}/{{membersArray.length}}
- <i class="el-icon-arrow-right"></i>
- </div>
- </div>
- <ul class="admin-list">
- <li class="admin-item" v-for="(item, key) in adminsList" :key="key">
- <img class="user-avatar" :src="item.cover_photo" v-if="item.cover_photo">
- <div class="user-avatar" v-else :class="`avatar_bg${item.user_id % 9}`" :data-name="item.nick_name.slice(0,2).toUpperCase()">
- </div>
- <span class="name">{{item.nick_name}}</span>
- <el-button @click="removeAdmin(item.user_id,item.nick_name)">{{$t('public.remove')}}</el-button>
- </li>
- </ul>
- </div>
- </template>
- <div class="view-telegram" :class="[{'move-left':isShowTeleTip}]">
- <div class="groudMgr-top">
- <i class="el-icon-arrow-left" @click="isShowTeleTip=false"></i>
- <span>{{$t('group.relateTelegram')}}</span>
- <i class="el-icon-close" @click="isShowTeleTip=false"></i>
- </div>
- <p>{{$t('group.teleStep1')}}</p>
- <p>{{$t('group.teleStep2')}}</p>
- <p><a href="https://smartsignature.io/article/QmNrsHp36CTCQp5ggsy6dzSUuhzBKom7u53mtVf2JJoH3N" target="_blank" class="link-guide">Telegram同步教程-></a></p>
- </div>
- </div>
- </template>
- <script>
- import Vue from 'vue'
- import { Button, MessageBox } from 'element-ui'
- import { mapState } from 'vuex'
- import API from '@/api'
- import { addPanelSessionMixin } from '@/mixins/index'
- Vue.component(Button.name, Button)
- export default {
- name: 'chatGroudMgr',
- mixins: [addPanelSessionMixin],
- computed: {
- ...mapState({
- curGroupId: state => state.curSession,
- userId: state => state.userId,
- membersArray: state => state.group.membersArray,
- sessionList: state => state.chat.sessionList
- }),
- adminsList () {
- return this.membersArray.filter(v => {
- return v.is_admin == 1
- })
- }
- },
- data () {
- return {
- isShowTeleTip: false,
- adminShow: false
- }
- },
- methods: {
- handleGroudMgr () {
- this.$emit('handleShowGroudMgr', 0)
- },
- handleCloseCharSet () {
- this.$emit('handleShowCharSet', 0)
- this.adminShow = false
- },
- removeAdmin (userId, nick) {
- MessageBox.confirm(`${this.$t('public.confirm')}${this.$t('public.remove')}${nick}?`).then(() => {
- API.group
- .removeAdmin({
- admin_id: userId,
- group_id: this.curGroupId
- })
- .then(({ data }) => {
- this.$store.dispatch('getGroupInfo')
- })
- })
- .catch(e => {
- console.log(e)
- })
- },
- addGroupAuth () {
- API.base.groupAuth({
- group_id: this.curGroupId
- }).then(({ data }) => {
- let serverId = data.data.serverId
- let sessionId = this.userId > serverId
- ? `${serverId}-${this.userId}`
- : `${this.userId}-${serverId}`
- this.addPanelSession(serverId, sessionId)
- this.$store.commit('changeSessionId', sessionId)
- this.$router.push({ path: `/pm/${sessionId}` })
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- @import "./style.scss";
- </style>
|