Browse Source

[edit][判断是否登陆,消息通知]

zhangwei 2 years ago
parent
commit
02bee8730a
1 changed files with 11 additions and 4 deletions
  1. 11 4
      src/view/iframe/red-packet/luck-draw.vue

+ 11 - 4
src/view/iframe/red-packet/luck-draw.vue

@@ -329,7 +329,7 @@
                     <span>{{ state.count_down_time || '' }}</span>
                 </div>
                 <get-more :style_type="2"></get-more>
-                <div class="notification_switch">
+                <div class="notification_switch" v-if="state.notification_show">
                     <span>Announcement Notification</span>
                     <a-switch v-model:checked="state.notification_switch" @change="changeNotification" />
                 </div>
@@ -423,7 +423,7 @@ export default {
 <script setup>
 import { onMounted, reactive, ref } from "vue";
 import { getPostDetail, getRedPacket, finishRedPacket, oneKeyLike, oneKeyReTweet, oneKeyFollow, getTaskDetail, getReceivedList, addFinishEvent } from '@/http/redPacket.js'
-import { getQueryString, guid, getBit,formatSecondsAsDaysOrTime } from '@/uilts/help.js'
+import { getQueryString, guid, getBit, formatSecondsAsDaysOrTime } from '@/uilts/help.js'
 import { message } from 'ant-design-vue';
 import FontAmount from '@/view/components/font-amount.vue'
 import GetMore from '@/view/iframe/publish/components/get-more.vue'
@@ -479,6 +479,7 @@ let state = reactive({
         repost_facebook: false,
         reply: false
     },
+    notification_show: false,
     notification_switch: false,
     open_timer_status: false,
     count_down_time: ''
@@ -1466,16 +1467,22 @@ const openTimer = () => {
         }
     })
 }
-const showLoadResult = () => {
+
+async function showLoadResult() {
     state.status = 'close'
     state.close_status = '等待结果'
-    getUserSetting()
+    getChromeStorage('userInfo', (_userInfo) => {
+        if (_userInfo) {
+            getUserSetting()
+        }
+    })
 }
 
 const getUserSetting = () => {
     getSetting({}).then((res) => {
         let { code, data } = res;
         if (code === 0) {
+            state.notification_show = true
             state.notification_switch = data.noticeSwitch === 1 ? true : false;
         }
     });