Browse Source

Merge branch 'dev/1.0.36_zsy' of jianyu/web into feature/v1.0.36

zhangsiya 1 year ago
parent
commit
854d9f6945

+ 9 - 4
apps/bigmember_pc/src/views/search/bidding/model/base.js

@@ -1,4 +1,4 @@
-import { computed, reactive, ref, toRefs, onMounted, onBeforeUnmount, getCurrentInstance } from 'vue'
+import { computed, reactive, ref, toRefs, onMounted,onBeforeMount, onBeforeUnmount, getCurrentInstance } from 'vue'
 import { without, throttle } from 'lodash'
 import { useStore } from '@/store'
 import { useRoute, useRouter } from 'vue-router/composables'
@@ -182,14 +182,19 @@ export default function () {
   /**
    * 搜索前校验
    */
+  const { keywords: urlKeywords } = useRoute().query
   const {
     getWhiteList,
     onTheWhiteList,
     checkAndClearTextIncludesCommonWords
-  } = beforeSearchModel({ inputKeywordsState })
+  } = beforeSearchModel({ inputKeywordsState, urlKeywords })
 
-  onMounted(async () => {
-    await getWhiteList()
+  onBeforeMount( async() => {
+    try{
+     await getWhiteList()
+    } catch (e){
+      console.warn('e')
+    }
   })
 
   /**

+ 3 - 3
apps/bigmember_pc/src/views/search/bidding/model/modules/before-search.js

@@ -9,14 +9,14 @@ import $bus from '@/utils/bus'
 
 export function beforeSearchModel (paramsObj = { }) {
 
-  const { inputKeywordsState } = paramsObj
+  const { inputKeywordsState, urlKeywords } = paramsObj
   // 是否是白名单用户
   let onTheWhiteList = ref(false)
   // 关键词搜索的校验规则
   const commonSearchWordsRegExp = ref([])
 
   async function getWhiteList () {
-    const keywords = inputKeywordsState.value.input
+    const keywords = urlKeywords || inputKeywordsState.value.input
 
     const { error_code: code, data } = await getInAntiSpiderWhiteList()
     if(code === 0 && data) {
@@ -36,7 +36,7 @@ export function beforeSearchModel (paramsObj = { }) {
           if (hasCommonWords) {
             showToast('请输入项目名称等关键词')
           }
-        }, 500)
+        })
       }
     }
   }