nieyuge 2 年之前
父节点
当前提交
db9b297128
共有 2 个文件被更改,包括 21 次插入1 次删除
  1. 8 1
      src/view/iframe/red-packet/luck-draw.vue
  2. 13 0
      src/view/popup/setting/index.vue

+ 8 - 1
src/view/iframe/red-packet/luck-draw.vue

@@ -671,7 +671,7 @@ function changeNotification(checked) {
     putSetting({
         params: { noticeSwitch }
     }).then(res => {
-        let { code, data } = res;
+        let { code } = res;
         if (code === 0) {
             state.notification_switch = checked
         } else {
@@ -682,6 +682,10 @@ function changeNotification(checked) {
     })
 }
 
+function setNotification(req) {
+    state.notification_switch = req.status;
+}
+
 async function clickReply(params) {
     let _userInfo = await checkIsLogin()
     if (!_userInfo) {
@@ -1901,6 +1905,9 @@ function onRuntimeMsg() {
                     }
                 }
                 break;
+            case 'USER_SETTING':
+                setNotification(req.data)
+                break;
         }
     })
 }

+ 13 - 0
src/view/popup/setting/index.vue

@@ -44,6 +44,19 @@ function change(checked) {
     }).catch(() => {
         noticeStatus.value = !checked
     })
+
+    noticeSetting()
+}
+
+function noticeSetting() {
+    chrome.runtime.sendMessage({
+        actionType: "USER_SETTING",
+        data: {
+            status: noticeStatus.value
+        }
+    }, (response) => {
+        console.log("res", response);
+    });
 }
 
 onBeforeMount(() => {