|
@@ -15,8 +15,8 @@
|
|
<div class="mask" @click="confirmStatus" v-if="showMask">
|
|
<div class="mask" @click="confirmStatus" v-if="showMask">
|
|
<img class="luck" :src=" require('@/assets/svg/icon-post-lock.svg') " />
|
|
<img class="luck" :src=" require('@/assets/svg/icon-post-lock.svg') " />
|
|
<div class="btn">
|
|
<div class="btn">
|
|
- <img class="img" v-if="nftAuthINfo.icon" :src=" nftAuthINfo.icon " />
|
|
|
|
- <div class="font">Available for holders of Ruomeng NFT</div>
|
|
|
|
|
|
+ <img class="img" v-if="detail.nftProjectIcon" :src=" detail.nftProjectIcon " />
|
|
|
|
+ <div class="font">Available for holders of {{detail.nftProjectName}} NFT</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<iframe :src="state.iframe_url" frameborder="0" allow="camera *;microphone *"></iframe>
|
|
<iframe :src="state.iframe_url" frameborder="0" allow="camera *;microphone *"></iframe>
|
|
@@ -26,7 +26,7 @@
|
|
<script setup>
|
|
<script setup>
|
|
import { reactive, ref } from "vue";
|
|
import { reactive, ref } from "vue";
|
|
import { ElMessage } from 'element-plus'
|
|
import { ElMessage } from 'element-plus'
|
|
-import { sendChromeTabMessage } from "@/uilts/chromeExtension";
|
|
|
|
|
|
+import { getChromeStorage, sendChromeTabMessage } from "@/uilts/chromeExtension";
|
|
import "element-plus/es/components/message/style/css";
|
|
import "element-plus/es/components/message/style/css";
|
|
|
|
|
|
let state = reactive({
|
|
let state = reactive({
|
|
@@ -35,11 +35,13 @@ let state = reactive({
|
|
tweetId: ''
|
|
tweetId: ''
|
|
})
|
|
})
|
|
|
|
|
|
|
|
+let detail = ref(null)
|
|
let nftAuthINfo = ref(null)
|
|
let nftAuthINfo = ref(null)
|
|
let showMask = ref(false)
|
|
let showMask = ref(false)
|
|
|
|
+let postId = ref('')
|
|
|
|
|
|
chrome.runtime.onMessage.addListener((req, sender, sendResponse) => {
|
|
chrome.runtime.onMessage.addListener((req, sender, sendResponse) => {
|
|
-
|
|
|
|
|
|
+console.log(3333, req);
|
|
switch (req.actionType) {
|
|
switch (req.actionType) {
|
|
// 事件传输
|
|
// 事件传输
|
|
case 'Set_ToolBox_Fixed':
|
|
case 'Set_ToolBox_Fixed':
|
|
@@ -47,6 +49,8 @@ chrome.runtime.onMessage.addListener((req, sender, sendResponse) => {
|
|
state.status = req.data.type
|
|
state.status = req.data.type
|
|
nftAuthINfo.value = req.data.nftAuthINfo;
|
|
nftAuthINfo.value = req.data.nftAuthINfo;
|
|
showMask.value = req.data.showMask;
|
|
showMask.value = req.data.showMask;
|
|
|
|
+ detail.value = req.data.detail;
|
|
|
|
+ postId.value = req.data.postId;
|
|
if (state.tweetId != req.data.tweetId) {
|
|
if (state.tweetId != req.data.tweetId) {
|
|
state.tweetId = req.data.tweetId
|
|
state.tweetId = req.data.tweetId
|
|
}
|
|
}
|
|
@@ -54,8 +58,10 @@ chrome.runtime.onMessage.addListener((req, sender, sendResponse) => {
|
|
state.iframe_url = req.data.iframe_url
|
|
state.iframe_url = req.data.iframe_url
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
break
|
|
break
|
|
|
|
+ case 'FINISH_ToolBox_By_Nft':
|
|
|
|
+ hideMask(req.data)
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
|
|
@@ -94,8 +100,8 @@ const changeFixed = () => {
|
|
|
|
|
|
const clickClose = () => {
|
|
const clickClose = () => {
|
|
sendClose()
|
|
sendClose()
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
+
|
|
const sendClose = () => {
|
|
const sendClose = () => {
|
|
sendChromeTabMessage({
|
|
sendChromeTabMessage({
|
|
actionType: 'Set_ToolBox_Fixed',
|
|
actionType: 'Set_ToolBox_Fixed',
|
|
@@ -110,14 +116,40 @@ const sendClose = () => {
|
|
}
|
|
}
|
|
|
|
|
|
const confirmStatus = () => {
|
|
const confirmStatus = () => {
|
|
- if (nftAuthINfo.value && nftAuthINfo.value?.certStatus === 1) {
|
|
|
|
- ElMessage({
|
|
|
|
- message: `NFT validated!`,
|
|
|
|
- type: 'success'
|
|
|
|
- })
|
|
|
|
- showMask.value = false;
|
|
|
|
- } else {
|
|
|
|
-
|
|
|
|
|
|
+ getChromeStorage('userInfo', (_userInfo) => {
|
|
|
|
+ if (!_userInfo) {
|
|
|
|
+ chrome.runtime.sendMessage(
|
|
|
|
+ { actionType: "POPUP_LOGIN", data: "" },
|
|
|
|
+ (response) => {
|
|
|
|
+ console.log("res", response);
|
|
|
|
+ }
|
|
|
|
+ )
|
|
|
|
+ } else {
|
|
|
|
+ if (nftAuthINfo.value && nftAuthINfo.value?.certStatus === 1) {
|
|
|
|
+ succBack()
|
|
|
|
+ } else {
|
|
|
|
+ sendChromeTabMessage({
|
|
|
|
+ actionType: 'Set_ToolBox_By_Nft',
|
|
|
|
+ data: {
|
|
|
|
+ postId: postId.value,
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+const succBack = () => {
|
|
|
|
+ ElMessage({
|
|
|
|
+ message: `NFT validated!`,
|
|
|
|
+ type: 'success'
|
|
|
|
+ })
|
|
|
|
+ showMask.value = false;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+const hideMask = (data) => {
|
|
|
|
+ if (data && data.post_Id && data.post_Id === postId.value) {
|
|
|
|
+ succBack()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|