123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- <template>
- <div class="c-view" v-loading="isLoading">
- <div class="box">
- <div class="box-hd">
- <div class="title-wrap">{{$t('group.relateTelegram')}}</div>
- </div>
- <div class="box-bd pub-scroll-box">
- <h2>{{$t('group.needRelateTelegram')}}:<span>{{tgGroupTitle}}</span></h2>
- <ul class="list-group" v-if="isBind">
- <li class="group-item" v-for="(item,index) in groups" :key="index">
- <h3>{{item.group_title}}</h3>
- <p>{{`https://mee.chat/s/${item.group_id}`}}</p>
- <p>{{$t('group.groupId')}}:{{item.group_id}}</p>
- <el-button type="primary" class="btn-relate" @click="doSync(index)">{{$t('group.relate')}}</el-button>
- </li>
- <li class="group-item ext-add">
- <h3>{{$t('group.createGroupToRelate')}}</h3>
- <i class="el-icon-plus"></i>
- </li>
- </ul>
- <div class="no-data" v-else>
- <h3>目前你还没有绑定Telegram账号,需绑定后进行后续操作</h3>
- <i class="icon-tele"></i>
- <el-button type="primary" class="btn-relate">点击绑定</el-button>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- import Vue from 'vue'
- import { Button } from 'element-ui'
- import api from '@/api'
- Vue.component(Button.name, Button)
- export default {
- name: 'relateGroup',
- components: {
- },
- data () {
- return {
- isLoading: false,
- isBind: false,
- tgGroupTitle: '',
- tgGroupId: 0,
- winHandler: null,
- groups: []
- }
- },
- async created () {
- let search = location.hash.replace('#/relateGroup?', '')
- let searchArgs = search.split('&')
- let params = {}
- searchArgs.forEach((item) => {
- let arr = item.split('=')
- params[arr[0]] = arr[1]
- })
- let { data } = await api.tg.getSyncInfo(params)
- this.groups = data.data.groups
- this.isBind = !!data.data.userId
- this.tgGroupTitle = decodeURI(data.data.tgGroupTitle)
- this.tgGroupId = data.data.tgGroupId
- },
- methods: {
- async doSync (index) {
- this.isLoading = true
- let groupId = this.groups[index].group_id
- api.tg.doSync({
- group_id: groupId,
- tg_group_id: this.tgGroupId
- }).then(() => {
- this.isLoading = false
- this.$router.replace(`/group/${groupId}`)
- }).catch(error => {
- this.isLoading = false
- console.log(error)
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- @import "./relateGroup.scss";
- </style>
|