Browse Source

🎈 perf:

优化tip显示时机
Pchen. 1 week ago
parent
commit
43d837e9cc
1 changed files with 20 additions and 4 deletions
  1. 20 4
      src/pages/lepao/accountList/index.vue

+ 20 - 4
src/pages/lepao/accountList/index.vue

@@ -106,7 +106,9 @@
                   </a-form-item>
                   </a-form-item>
                 </a-col>
                 </a-col>
                 <a-col :span="6">
                 <a-col :span="6">
-                  <a-popconfirm content="查看本学期之前添加的账号请在此处修改时间后查看" okText="知道了" position="br" unmount-on-close :default-popup-visible="true">
+                  <a-popconfirm content="查看本学期之前添加的账号请在此处修改时间后查看" okText="查看全部账号"
+                    position="br" unmount-on-close :default-popup-visible="semesterAccountTipVisible"
+                    @ok="handleViewAllAccounts" @cancel="markSemesterAccountTipViewed">
                     <a-form-item field="queryTime" label="更新时间">
                     <a-form-item field="queryTime" label="更新时间">
                       <a-range-picker v-model="queryDataForm.queryTime" show-time format="YY-MM-DD HH:mm"
                       <a-range-picker v-model="queryDataForm.queryTime" show-time format="YY-MM-DD HH:mm"
                         value-format="x" popup-container="body" @ok="search()" />
                         value-format="x" popup-container="body" @ok="search()" />
@@ -395,6 +397,9 @@ const notice = ref('')
 const faceInfo = ref({})
 const faceInfo = ref({})
 const bindBotRef = ref(null)
 const bindBotRef = ref(null)
 const accountDetailRef = ref(null)
 const accountDetailRef = ref(null)
+const semesterTimestamps = getSemesterTimestamps()
+const semesterAccountTipStorageKey = `lepao-account-list-semester-tip-viewed:${semesterTimestamps[0]}`
+const semesterAccountTipVisible = ref(localStorage.getItem(semesterAccountTipStorageKey) !== '1')
 
 
 const ROW_DETAIL_CONFIRM_MS = 3000
 const ROW_DETAIL_CONFIRM_MS = 3000
 const pendingDetailAccountId = ref(null)
 const pendingDetailAccountId = ref(null)
@@ -455,6 +460,17 @@ const search = () => {
   getAccountsAsync()
   getAccountsAsync()
 }
 }
 
 
+const markSemesterAccountTipViewed = () => {
+  localStorage.setItem(semesterAccountTipStorageKey, '1')
+  semesterAccountTipVisible.value = false
+}
+
+const handleViewAllAccounts = () => {
+  markSemesterAccountTipViewed()
+  queryDataForm.queryTime = null
+  search()
+}
+
 const reset = () => {
 const reset = () => {
   queryDataForm.area = ''
   queryDataForm.area = ''
   queryDataForm.student_num = ''
   queryDataForm.student_num = ''
@@ -839,8 +855,8 @@ const stopPolling = () => {
 }
 }
 
 
 onMounted(async () => {
 onMounted(async () => {
-  queryData.queryTime = getSemesterTimestamps()
-  queryDataForm.queryTime = getSemesterTimestamps()
+  queryData.queryTime = [...semesterTimestamps]
+  queryDataForm.queryTime = [...semesterTimestamps]
   getAccountsAsync()
   getAccountsAsync()
   GetNotice()
   GetNotice()
   startPolling()
   startPolling()
@@ -971,4 +987,4 @@ onUnmounted(() => {
     flex: 1;
     flex: 1;
   }
   }
 }
 }
-</style>
+</style>