2018-02-21 03:27:01 +00:00
|
|
|
<template>
|
|
|
|
<div class="mk-twitter-setting">
|
2018-11-13 16:31:36 +00:00
|
|
|
<p>{{ $t('description') }}</p>
|
2018-11-08 18:44:35 +00:00
|
|
|
<p class="account" v-if="$store.state.i.twitter" :title="`Twitter ID: ${$store.state.i.twitter.userId}`">{{ $t('connected-to') }}: <a :href="`https://twitter.com/${$store.state.i.twitter.screenName}`" target="_blank">@{{ $store.state.i.twitter.screenName }}</a></p>
|
2018-02-21 03:27:01 +00:00
|
|
|
<p>
|
2018-11-08 18:44:35 +00:00
|
|
|
<a :href="`${apiUrl}/connect/twitter`" target="_blank" @click.prevent="connect">{{ $store.state.i.twitter ? this.$t('reconnect') : this.$t('connect') }}</a>
|
2018-05-27 04:49:09 +00:00
|
|
|
<span v-if="$store.state.i.twitter"> or </span>
|
2018-11-08 18:44:35 +00:00
|
|
|
<a :href="`${apiUrl}/disconnect/twitter`" target="_blank" v-if="$store.state.i.twitter" @click.prevent="disconnect">{{ $t('disconnect') }}</a>
|
2018-02-21 03:27:01 +00:00
|
|
|
</p>
|
2018-05-27 04:49:09 +00:00
|
|
|
<p class="id" v-if="$store.state.i.twitter">Twitter ID: {{ $store.state.i.twitter.userId }}</p>
|
2018-02-21 03:27:01 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
2018-11-08 18:44:35 +00:00
|
|
|
import i18n from '../../../i18n';
|
2018-11-13 16:31:36 +00:00
|
|
|
import { apiUrl } from '../../../config';
|
2018-02-21 03:27:01 +00:00
|
|
|
|
|
|
|
export default Vue.extend({
|
2018-11-08 18:44:35 +00:00
|
|
|
i18n: i18n('common/views/components/twitter-setting.vue'),
|
2018-02-21 03:27:01 +00:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
form: null,
|
2018-11-13 16:31:36 +00:00
|
|
|
apiUrl
|
2018-02-21 03:27:01 +00:00
|
|
|
};
|
|
|
|
},
|
2018-02-26 09:31:55 +00:00
|
|
|
mounted() {
|
2018-05-27 04:49:09 +00:00
|
|
|
this.$watch('$store.state.i', () => {
|
|
|
|
if (this.$store.state.i.twitter) {
|
2018-02-21 03:27:01 +00:00
|
|
|
if (this.form) this.form.close();
|
|
|
|
}
|
2018-02-26 09:31:55 +00:00
|
|
|
}, {
|
|
|
|
deep: true
|
|
|
|
});
|
2018-02-21 03:27:01 +00:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
connect() {
|
|
|
|
this.form = window.open(apiUrl + '/connect/twitter',
|
|
|
|
'twitter_connect_window',
|
|
|
|
'height=570, width=520');
|
|
|
|
},
|
|
|
|
|
|
|
|
disconnect() {
|
|
|
|
window.open(apiUrl + '/disconnect/twitter',
|
|
|
|
'twitter_disconnect_window',
|
|
|
|
'height=570, width=520');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
|
|
|
.mk-twitter-setting
|
|
|
|
.account
|
|
|
|
border solid 1px #e1e8ed
|
|
|
|
border-radius 4px
|
|
|
|
padding 16px
|
|
|
|
|
|
|
|
a
|
|
|
|
font-weight bold
|
|
|
|
color inherit
|
|
|
|
|
|
|
|
.id
|
|
|
|
color #8899a6
|
|
|
|
</style>
|