소스 검색

[edit] currencyList fix

wenliming 2 년 전
부모
커밋
561cd41190
2개의 변경된 파일25개의 추가작업 그리고 4개의 파일을 삭제
  1. 24 3
      src/view/components/currency-list.vue
  2. 1 1
      src/view/iframe/publish/give-dialog.vue

+ 24 - 3
src/view/components/currency-list.vue

@@ -133,6 +133,7 @@ let listReqParams = {
         pageSize: 100,
     },
     loadMore: false,
+    requestIng: false
 };
 let show_empty = ref(false);
 const emits = defineEmits(["selectCurrency", "setCurrencyList", "addGeneralLottery"]);
@@ -201,7 +202,15 @@ const searchCurrency = debounce(function (searchWords) {
 /**
  * 获取货币列表
  */
-const getCurrencyInfoList = () => {
+const getCurrencyInfoList = (_params = {}) => {
+
+    if(listReqParams.requestIng) {
+        return;
+    }
+    listReqParams.requestIng = true;
+    if(_params.pageNum) {
+        listReqParams.params.pageNum = _params.pageNum;
+    }
     let params = {
         params: {
             pageNum: listReqParams.params.pageNum,
@@ -211,6 +220,7 @@ const getCurrencyInfoList = () => {
         }
     };
     getCurrencyInfo(params).then(res => {
+        listReqParams.requestIng = false;
         if (res.code == 0) {
             let resData = res.data;
             if (resData && resData.currencyCategories.length) {
@@ -223,14 +233,25 @@ const getCurrencyInfoList = () => {
                 } else {
                     let data = currencyInfoList.value;
                     let currencyCategories = resData.currencyCategories;
-                    data = data.concat(currencyCategories);
-                    currencyInfoList.value = data;
+
+                    if(currencyCategories.length) {
+                        let tokenData = currencyCategories.find(item => item.type == 2);
+                        if(tokenData && tokenData.data && tokenData.data.length) {
+                            let index = data.findIndex(item => item.type == 2);
+                            let tokenList = data[index]['data'];
+                            data[index]['data'] = tokenList.concat(tokenData.data);
+                            currencyInfoList.value = data;
+                        }
+                    }
+
                 }
                 listReqParams.loadMore = false;
             }else{
                 show_empty.value = true
             }
         }
+    }).catch(err => {
+        listReqParams.requestIng = false;
     })
 }
 

+ 1 - 1
src/view/iframe/publish/give-dialog.vue

@@ -908,7 +908,7 @@ const selectCurrencyPopHandle = () => {
         showCurrencyPop.value = true;
         nextTick(() => {
             if(currencyListDom.value) {
-                currencyListDom.value.getCurrencyInfoList && currencyListDom.value.getCurrencyInfoList();
+                currencyListDom.value.getCurrencyInfoList && currencyListDom.value.getCurrencyInfoList({pageNum: 1});
             }
         })
     }