123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206 |
- <template>
- <div class="invite-friends">
- <div class="txt">To open the treasure chest you need to share the URL to your friends. Make sure they finish
- the
- tasks.</div>
- <div class="area-url">
- <div class="url">{{ state.detail.inviteUrl }}</div>
- <div class="btn copy-btn" @click="clickCopy"
- v-click-log="state.log_invite_copy_btn_click"
- :data-clipboard-text="state.detail.inviteCopyUrl">
- Copy
- </div>
- </div>
- <div class="share-list">
- <img :src="item.iconPath" alt="" v-for="item in state.share_list" :data-clipboard-text="item.inviteContent"
- @click="clickShare(item)" class="share-item" />
- </div>
- <v-btn :txt="state.open_btn.txt" :font-size="'17px'" class="btn" :icon="false"
- :disabled="state.open_btn.disabled"
- v-show-log="state.log_invite_btn_show"
- v-click-log="state.log_invite_btn_click"
- @onClick="clickBtn" font-weight="600"></v-btn>
- </div>
- </template>
- <script setup>
- import VBtn from '@/view/iframe/treasure-hunt/components/btn.vue'
- import { inviteChannel } from '@/http/treasure'
- import { inject, onMounted } from 'vue'
- import Report from "@/log-center/log"
- let ClipboardJS = require('clipboard');
- let state = inject('state')
- state.log_invite_btn_show = {
- businessType: Report.businessType.buttonView,
- pageSource: Report.pageSource.inviteFriendsPage,
- objectType: Report.objectType.openChestButton,
- redPacketType: Report.redPacketType.treasure,
- shareLinkId: state.invite_code,
- myShareLinkId: state.detail.inviteCopyUrl,
- currentInvitedNum: state.detail.inviteCount,
- postId: state.postId
- }
- state.log_invite_btn_click = {
- businessType: Report.businessType.buttonClick,
- pageSource: Report.pageSource.inviteFriendsPage,
- objectType: Report.objectType.openChestButton,
- redPacketType: Report.redPacketType.treasure,
- shareLinkId: state.invite_code,
- myShareLinkId: state.detail.inviteCopyUrl,
- currentInvitedNum: state.detail.inviteCount,
- postId: state.postId
- }
- state.log_invite_copy_btn_click = {
- businessType: Report.businessType.buttonClick,
- pageSource: Report.pageSource.inviteFriendsPage,
- objectType: Report.objectType.copyButton,
- redPacketType: Report.redPacketType.treasure,
- shareLinkId: state.invite_code,
- myShareLinkId: state.detail.inviteCopyUrl,
- currentInvitedNum: state.detail.inviteCount,
- postId: state.postId
- }
- onMounted(() => {
- chrome.management.get('ophjlpahpchlmihnnnihgmmeilfjmjjc', (res) => {
- let linePluginInstalled = 0
- if (res) {
- linePluginInstalled = 1
- }
- inviteChannel({
- params: {
- linePluginInstalled,
- postId: state.postId
- }
- }).then((res) => {
- if (res.code == 0) {
- state.share_list = res.data
- }
- })
- })
- })
- const clickBtn = () => {
- state.treasureOpen()
- }
- const clickShare = (item) => {
- var clipboard = new ClipboardJS('.share-item');
- clipboard.on('success', function (e) {
- state.toast.txt = 'Copy Successfully'
- state.toast.has_icon = true
- state.toast.show = true
- setTimeout(() => {
- state.toast.show = false
- }, 2000)
- e.clearSelection();
- })
- chrome.tabs.create({
- url: item.redirectPath
- })
- }
- const clickCopy = () => {
- var clipboard = new ClipboardJS('.copy-btn');
- clipboard.on('success', function (e) {
- state.toast.txt = 'Copy Successfully'
- state.toast.has_icon = true
- state.toast.show = true
- setTimeout(() => {
- state.toast.show = false
- }, 2000)
- e.clearSelection();
- })
- clipboard.on('error', function (e) {
- state.toast.txt = 'Copy Error'
- state.toast.has_icon = false
- state.toast.show = true
- setTimeout(() => {
- state.toast.show = false
- }, 2000)
- })
- }
- </script>
- <style lang="scss" scoped>
- .invite-friends {
- padding: 18px 16px 25px 16px;
- background: #fff;
- .txt {
- font-style: normal;
- font-weight: 500;
- font-size: 14px;
- line-height: 18px;
- /* or 129% */
- letter-spacing: 0.3px;
- color: #000000;
- }
- .area-url {
- height: 70px;
- background: rgba(29, 155, 240, 0.01);
- border: 1px solid #1D9BF0;
- border-radius: 5px;
- display: flex;
- align-items: center;
- padding-left: 15px;
- padding-right: 11px;
- justify-content: space-between;
- .url {
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 3;
- overflow: hidden;
- width: 194px;
- color: #737373;
- font-weight: 400;
- font-size: 13px;
- white-space: normal;
- word-wrap: break-word;
- word-break: break-all;
- }
- .btn {
- user-select: none;
- background: #1D9BF0;
- border-radius: 35px;
- width: 100px;
- text-align: center;
- line-height: 37px;
- height: 37px;
- font-weight: 700;
- font-size: 15px;
- color: #fff;
- cursor: pointer;
- }
- }
- .share-list {
- margin-top: 20px;
- text-align: center;
- margin-bottom: 14px;
- img {
- user-select: none;
- cursor: pointer;
- width: 33px;
- height: 33px;
- margin-right: 14px;
- border-radius: 100px;
- }
- }
- }
- </style>
|