123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204 |
- <template>
- <div class="card">
- <div class="padding" v-if="detail">
- <div class="info">
- <div class="logo">
- <img :src="detail.groupIcon" />
- </div>
- <div class="mess">
- <div class="title">
- {{ detail.groupName }}
- </div>
- <div class="opt">
- <label>
- <img src="../../../assets/svg/icon-nft-member.svg" />
- <span>{{ detail.memberCount }} Members</span>
- </label>
- <label>
- <img src="../../../assets/svg/icon-nft-post.svg" />
- <span>{{ detail.postCount }} Posts</span>
- </label>
- </div>
- </div>
- </div>
- <div class="join" @click="jumpUserPage">
- {{ detail.joinStatus === 0 ? 'Join Now' : 'View' }}
- </div>
- </div>
- </div>
- </template>
- <script setup>
- import { onBeforeMount, onMounted, ref } from 'vue';
- import { getPostDetail } from '@/http/redPacket';
- import { getQueryString } from '@/uilts/help.js'
- import { srcPublishSuccess } from '@/http/publishApi'
- import { getChromeStorage, setChromeStorage } from '@/uilts/chromeExtension.js'
- let postId = getQueryString('projectId');
- let tweet_Id = getQueryString('tweet_Id')
- let detail = ref(null);
- const jumpUserPage = () => {
- getChromeStorage('userInfo', (_userInfo) => {
- if (!_userInfo) {
- chrome.runtime.sendMessage(
- { actionType: "POPUP_LOGIN", data: "" },
- (response) => {
- console.log("res", response);
- }
- )
- } else {
- setChromeStorage({
- groupTabData: JSON.stringify({
- deTabVal: 'deGroupTab'
- })
- })
- window.open(`https://twitter.com/${detail.value.defaultTwitterAccount}`)
- }
- })
- }
- // 重新绑定
- const reSetBindTwtterId = (_params = {}) => {
- getChromeStorage('userInfo', (_userInfo = {}) => {
- if (_userInfo && _userInfo.uid == _params.uid) {
- srcPublishSuccess({
- params: {
- postId: postId,
- srcContentId: tweet_Id
- }
- }).then((res) => {
- if (res.code == 0 || res.code == 3003) {
- }
- })
- }
- })
- }
- const getDetail = () => {
- getPostDetail({
- params: {
- postId: postId
- }
- }).then(res => {
- let { data } = res
- if (data !== null) {
- detail.value = JSON.parse(data.postBizData)
- }
- })
- }
- onMounted(() => {
- getPostDetail({
- params: {
- postId: postId
- }
- }).then(res => {
- let { data } = res
- if (data !== null) {
- detail.value = JSON.parse(data.postBizData)
- if (!data.srcContentId) {
- reSetBindTwtterId(data)
- return
- }
- }
- })
- // 登录回调
- chrome.runtime.onMessage.addListener((req, sender, sendResponse) => {
- switch (req.actionType) {
- case 'BG_LOGIN_SET_USERINFO_CB':
- getDetail();
- break;
- }
- sendResponse && sendResponse();
- })
- })
- </script>
- <style lang='scss'>
- html,
- body {
- margin: 0;
- padding: 0;
- user-select: none;
- }
- .card {
- height: 180px;
- border-radius: 12px;
- background: url('../../../assets/svg/icon-nft-group-pc.svg') no-repeat right bottom #48B1F7;
- .padding {
- padding: 20px;
- .info {
- display: flex;
- flex-direction: row;
- align-items: center;
- height: 100px;
- .logo {
- display: flex;
- align-items: center;
- justify-content: center;
- width: 54px;
- height: 54px;
- border-radius: 6px;
- background: #FFFFFF;
- margin-right: 20px;
- img {
- width: 50px;
- height: 50px;
- border-radius: 6px;
- }
- }
- .mess {
- flex: 1;
- .title {
- overflow: hidden;
- color: #FFFFFF;
- font-size: 18px;
- line-height: 21px;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .opt {
- color: #FFFFFF;
- font-size: 12px;
- margin-top: 8px;
- label {
- margin-right: 18px;
- img {
- margin-top: -4px;
- margin-right: 4px;
- vertical-align: middle;
- }
- }
- }
- }
- }
- .join {
- display: flex;
- align-items: center;
- justify-content: center;
- height: 40px;
- cursor: pointer;
- color: #FFFFFF;
- font-size: 16px;
- font-weight: bold;
- background: #101419;
- border-radius: 100px;
- }
- }
- }
- </style>
|