Ver código fonte

[bug] pin fix、style

wenliming 3 anos atrás
pai
commit
efef6d0f5e

+ 3 - 4
src/entry/background.js

@@ -29,7 +29,7 @@ function onInstalledMethod() {
             chrome.tabs.create({
                 url: "https://twitter.com",
             });
-        }   
+        }
     })
     getChromeCookie(LANDING_PAGE_MIND, (res_arr) => {
         // 没有cookie
@@ -45,7 +45,7 @@ function onInstalledMethod() {
     })
 
     chrome.action.getUserSettings().then(res => {
-        let isOnToolbar = res.isOnToolbar;
+        setChromeStorage({ userSettings: JSON.stringify({res})})    
         // 无刷新插入js
         chrome.tabs.query({}, (tab) => {
             for (let i in tab) {
@@ -55,9 +55,8 @@ function onInstalledMethod() {
                         files: ['js/content.js'],
                     }, () => {
                         setTimeout(() => {
-                            setChromeStorage({ executeScript: JSON.stringify({executeScript:1, isOnToolbar}) })    
+                            setChromeStorage({ executeScript: JSON.stringify({executeScript:1}) })    
                         }, 2000);
-                        
                     })
                 }
             }

+ 10 - 5
src/entry/content.js

@@ -29,9 +29,6 @@ chrome.storage.onChanged.addListener(changes => {
         let item = JSON.parse(changes.executeScript.newValue)
         if (item.executeScript) {
             init()
-            setTimeout(() => {
-                addPinedPop();
-            }, 600)
         }
     }
 })
@@ -40,12 +37,12 @@ window.onload = () => {
     init()
 };
 
-function init(isOnToolbar = true) {
+function init() {
     if (window.location.href.indexOf('twitter.com') < 0) {
         return
     }
     contentTwitterPinLogin(port);
-    renderDom(port, isOnToolbar);
+    renderDom(port);
     setIframeRedPacket();
 
     getChromeStorage("popupShowPublishDialog", (res) => {
@@ -60,6 +57,14 @@ function init(isOnToolbar = true) {
             chrome.storage.local.remove("popupShowPublishDialog");
         }
     });
+    getChromeStorage("userSettings", (res) => {
+        if (res && !res.isOnToolbar) {
+            setTimeout(() => {
+                addPinedPop();
+                chrome.storage.local.remove("userSettings");
+            }, 800);
+        }
+    });
 }
 
 window.onmessage = (res) => {

+ 3 - 3
src/view/components/custom-card-cover.vue

@@ -1,3 +1,4 @@
+<!-- 自定义卡片红包封面 -->
 <template>
     <div class="not-open">
         <img class="cover" :src="require('../../assets/subject/001-card.png')"  />
@@ -28,10 +29,9 @@
 </template>
 
 <script setup>
-/* eslint-disable */
-import { ref, defineProps, defineEmits } from "vue";
+import { defineProps, defineEmits } from "vue";
 
-const props = defineProps({
+defineProps({
     data: {
         type: Object,
         default: () => {

+ 1 - 2
src/view/components/give-dialog.vue

@@ -1,7 +1,7 @@
 <template>
     <div class="overlay" v-if="visible">
         <div class="content"
-            :style="{height: dialogHeight +'px' }">
+            :style="{height: dialogHeight +'px', width: !showPreview ? '650px' : 'auto' }">
             <div class="head">
                 <div class="left">
                     <div class="close-btn" @click="close">
@@ -558,7 +558,6 @@ onMounted(() => {
     overflow: auto;
 
     .content {
-        // width: 650px;
         height: 620px;
         background: #ffffff;
         border-radius: 20px;