li.shaoyi 2 tahun lalu
induk
melakukan
c76ec222b8
58 mengubah file dengan 1007 tambahan dan 1667 penghapusan
  1. 2 1
      public/manifest.json
  2. 77 101
      src/business/bank/index.ts
  3. 21 29
      src/business/contract/index.ts
  4. 23 36
      src/business/credit/index.ts
  5. 81 122
      src/business/goods/index.ts
  6. 4 7
      src/business/login/index.ts
  7. 18 23
      src/business/market/index.ts
  8. 21 31
      src/business/news/index.ts
  9. 78 114
      src/business/order/index.ts
  10. 19 27
      src/business/user/account.ts
  11. 10 13
      src/business/user/address.ts
  12. 10 13
      src/business/user/invoice.ts
  13. 2 2
      src/hooks/datatable/index.ts
  14. 1 1
      src/hooks/datatable/interface.ts
  15. 8 14
      src/hooks/echarts/candlestick/index.ts
  16. 15 19
      src/hooks/echarts/smoothedline/index.ts
  17. 8 14
      src/hooks/echarts/timeline/index.ts
  18. 103 0
      src/hooks/request/index.ts
  19. 17 26
      src/packages/mobile/views/credit/signin/index.vue
  20. 0 177
      src/packages/mobile/views/home/components/main/index.backup.vue
  21. 21 35
      src/packages/mobile/views/home/components/main/index.vue
  22. 18 20
      src/packages/mobile/views/home/index.vue
  23. 6 12
      src/packages/mobile/views/mine/generalize/index.vue
  24. 4 7
      src/packages/mobile/views/mine/main/index.vue
  25. 5 5
      src/packages/mobile/views/mine/wareorder/list/components/holdlb/index.vue
  26. 5 8
      src/packages/mobile/views/news/details/index.vue
  27. 4 7
      src/packages/mobile/views/supply-demand/detail/components/delisting/index.vue
  28. 4 7
      src/packages/mobile/views/supply-demand/detail/components/listing/index.vue
  29. 6 10
      src/packages/mobile/views/user/avatar/index.vue
  30. 35 47
      src/packages/mobile/views/user/forget/index.vue
  31. 30 40
      src/packages/mobile/views/user/register/index.vue
  32. 22 27
      src/packages/pc/views/member/index.vue
  33. 10 13
      src/packages/pc/views/profit/index.vue
  34. 10 14
      src/packages/pc/views/ratio/components/history/index.vue
  35. 9 12
      src/packages/pc/views/ratio/index.vue
  36. 3 3
      src/packages/pc/views/system/menu/index.vue
  37. 5 8
      src/packages/pc/views/system/role/index.vue
  38. 15 16
      src/services/api/account/index.ts
  39. 13 14
      src/services/api/bank/index.ts
  40. 38 39
      src/services/api/common/index.ts
  41. 4 5
      src/services/api/contract/index.ts
  42. 4 5
      src/services/api/credit/index.ts
  43. 26 34
      src/services/api/goods/index.ts
  44. 6 7
      src/services/api/market/index.ts
  45. 4 5
      src/services/api/news/index.ts
  46. 18 19
      src/services/api/order/index.ts
  47. 6 7
      src/services/api/quote/index.ts
  48. 5 6
      src/services/api/user/index.ts
  49. 95 106
      src/services/http/index.ts
  50. 0 254
      src/services/http/index@next.ts
  51. 3 28
      src/services/http/interface.ts
  52. 15 19
      src/stores/modules/account.ts
  53. 5 8
      src/stores/modules/enum.ts
  54. 4 7
      src/stores/modules/errorInfo.ts
  55. 20 25
      src/stores/modules/futures.ts
  56. 4 7
      src/stores/modules/menu.ts
  57. 5 9
      src/stores/modules/user.ts
  58. 2 2
      src/types/model/market.d.ts

+ 2 - 1
public/manifest.json

@@ -126,7 +126,8 @@
                 /*iOS应用打包个人证书,打包配置文件关联的个人证书*/
                 "devices" : "universal",
                 /*iOS应用支持的设备类型,可取值iphone/ipad/universal*/
-                "frameworks" : [] /*调用Native.js调用原生Objective-c API需要引用的FrameWork,如需调用GameCenter,则添加"GameKit.framework"*/
+                "frameworks" : [], /*调用Native.js调用原生Objective-c API需要引用的FrameWork,如需调用GameCenter,则添加"GameKit.framework"*/
+                "idfa" : false
             },
             "google" : {
                 "packagename" : "",

+ 77 - 101
src/business/bank/index.ts

@@ -16,19 +16,15 @@ export function useAmountStatementList() {
     const getAmountStatementList = async () => {
         loading.value = true
         await queryAmountLog({
-            data: {
-                page: pageIndex.value,
-                pagesize: pageSize.value,
-                pageflag: 1,
-                accountID: firstAccountId.value.toString(),
-            },
-            success: (res) => {
-                total.value = res.total
-                dataList.value = res.data
-            },
-            complete: () => {
-                loading.value = false
-            }
+            page: pageIndex.value,
+            pagesize: pageSize.value,
+            pageflag: 1,
+            accountID: firstAccountId.value.toString(),
+        }).then((res) => {
+            total.value = res.total
+            dataList.value = res.data
+        }).finally(() => {
+            loading.value = false
         })
         return dataList.value
     }
@@ -52,19 +48,15 @@ export function useHisAmountStatementList() {
     const getHisAmountStatementList = async () => {
         loading.value = true
         await queryHisAmountLog({
-            data: {
-                page: pageIndex.value,
-                pagesize: pageSize.value,
-                pageflag: 1,
-                accountID: firstAccountId.value.toString(),
-            },
-            success: (res) => {
-                total.value = res.total
-                dataList.value = res.data
-            },
-            complete: () => {
-                loading.value = false
-            }
+            page: pageIndex.value,
+            pagesize: pageSize.value,
+            pageflag: 1,
+            accountID: firstAccountId.value.toString(),
+        }).then((res) => {
+            total.value = res.total
+            dataList.value = res.data
+        }).finally(() => {
+            loading.value = false
         })
         return dataList.value
     }
@@ -85,20 +77,17 @@ export function useAccouuntInOutApplyListList() {
     const { dataList, total, pageIndex, pageSize, pageCount } = useDataTable<Model.AccountOutInApplyRsp>()
     const loading = shallowRef(false)
 
-    const getAccouuntInOutApplyList = () => {
-        loading.value = true
-        return queryAccountInOutApply({
-            data: {
+    const getAccouuntInOutApplyList = async () => {
+        try {
+            loading.value = true
+            const res = await queryAccountInOutApply({
                 userid: userId.value
-            },
-            success: (res) => {
-                total.value = res.total
-                dataList.value = res.data
-            },
-            complete: () => {
-                loading.value = false
-            }
-        })
+            })
+            total.value = res.total
+            dataList.value = res.data
+        } finally {
+            loading.value = false
+        }
     }
 
     return {
@@ -117,17 +106,15 @@ export function getCusBankSignBankList() {
     const { dataList, total, pageIndex, pageSize, pageCount } = useDataTable<Model.CusBankSignBankRsp>()
     const loading = shallowRef(false)
 
-    const getCusBankSignBankList = () => {
-        loading.value = true
-        return queryCusBankSignBank({
-            success: (res) => {
-                total.value = res.total
-                dataList.value = res.data
-            },
-            complete: () => {
-                loading.value = false
-            }
-        })
+    const getCusBankSignBankList = async () => {
+        try {
+            loading.value = true
+            const res = await queryCusBankSignBank()
+            total.value = res.total
+            dataList.value = res.data
+        } finally {
+            loading.value = false
+        }
     }
 
     return {
@@ -146,19 +133,16 @@ export function useBankAccountSign() {
     const { dataList } = useDataTable<Model.BankAccountSignRsp>()
     const loading = shallowRef(false)
 
-    const getBankAccountList = () => {
-        loading.value = true
-        return queryBankAccountSign({
-            data: {
+    const getBankAccountList = async () => {
+        try {
+            loading.value = true
+            const res = await queryBankAccountSign({
                 userid: userId.value
-            },
-            success: (res) => {
-                dataList.value = res.data
-            },
-            complete: () => {
-                loading.value = false
-            }
-        })
+            })
+            dataList.value = res.data
+        } finally {
+            loading.value = false
+        }
     }
 
     const bankInfo = computed(() => {
@@ -188,22 +172,19 @@ export function useDoWithdraw() {
 
     /// 查询签约信息
     const request = queryBankAccountSign({
-        data: {
-            userid: userId.value
-        },
-        success: (res) => {
-            if (res.data.length) {
-                bankAccountSign.value = res.data
-                const data = res.data[0]
-                formData.Currency = data.currency
-                formData.CusBankID = data.cusbankid
-                formData.BankAccoutName = data.bankaccountname
-                formData.OpenCardBankId = data.bankid
-                formData.AccountCode = data.accountcode
-                formData.BranchBankName = data.branchbankname
-                formData.BankAccoutName = data.bankaccountname2
-                formData.BankAccoutNum = data.bankaccountno2
-            }
+        userid: userId.value
+    }).then((res) => {
+        if (res.data.length) {
+            bankAccountSign.value = res.data
+            const data = res.data[0]
+            formData.Currency = data.currency
+            formData.CusBankID = data.cusbankid
+            formData.BankAccoutName = data.bankaccountname
+            formData.OpenCardBankId = data.bankid
+            formData.AccountCode = data.accountcode
+            formData.BranchBankName = data.branchbankname
+            formData.BankAccoutName = data.bankaccountname2
+            formData.BankAccoutNum = data.bankaccountno2
         }
     })
 
@@ -247,20 +228,17 @@ export function useDoDeposit() {
     const formData = reactive<Partial<Proto.t2bBankDepositReq>>({})
 
     const request = queryBankAccountSign({
-        data: {
-            userid: userId.value
-        },
-        success: (res) => {
-            if (res.data.length) {
-                sign.value = res.data
-                const data = res.data[0]
-                formData.Currency = data.currency
-                formData.CusBankID = data.cusbankid
-                formData.BankAccoutName = data.bankaccountname2
-                formData.OpenCardBankId = data.bankid
-                formData.AccountCode = data.accountcode
-                formData.BankAccoutNum = data.bankaccountno2
-            }
+        userid: userId.value
+    }).then((res) => {
+        if (res.data.length) {
+            sign.value = res.data
+            const data = res.data[0]
+            formData.Currency = data.currency
+            formData.CusBankID = data.cusbankid
+            formData.BankAccoutName = data.bankaccountname2
+            formData.OpenCardBankId = data.bankid
+            formData.AccountCode = data.accountcode
+            formData.BankAccoutNum = data.bankaccountno2
         }
     })
 
@@ -297,15 +275,13 @@ export function useDoBankSign() {
     /// 托管银行信息
     const cusSignBank = shallowRef<Model.CusBankSignBankRsp>()
     /// 查询签约银行信息
-    const request = queryCusBankSignBank({
-        success: (res) => {
-            if (res.data.length) {
-                const data = res.data[0]
-                cusSignBank.value = data
-                formData.Currency = data.currency
-                formData.CusBankID = data.cusbankid
-                formData.TradeDate = data.tradedate
-            }
+    const request = queryCusBankSignBank().then((res) => {
+        if (res.data.length) {
+            const data = res.data[0]
+            cusSignBank.value = data
+            formData.Currency = data.currency
+            formData.CusBankID = data.cusbankid
+            formData.TradeDate = data.tradedate
         }
     })
 

+ 21 - 29
src/business/contract/index.ts

@@ -11,18 +11,14 @@ export function useContractList() {
     const getWrstandardList = async (params: Partial<Model.THJPurchaseTransferReq> = {}) => {
         loading.value = true
         await queryTHJPurchaseTransfer({
-            data: {
-                page: pageIndex.value,
-                pagesize: pageSize.value,
-                wrstandardname: params.wrstandardname,
-            },
-            success: (res) => {
-                total.value = res.total
-                dataList.value = res.data
-            },
-            complete: () => {
-                loading.value = false
-            }
+            page: pageIndex.value,
+            pagesize: pageSize.value,
+            wrstandardname: params.wrstandardname,
+        }).then((res) => {
+            total.value = res.total
+            dataList.value = res.data
+        }).finally(() => {
+            loading.value = false
         })
         return dataList.value
     }
@@ -49,24 +45,20 @@ export function useContractDetails(wrstandardid: number) {
         date: []
     })
 
-    const getContractDetails = () => {
-        loading.value = true
-        return queryTHJPurchaseTransferDetail({
-            data: {
+    const getContractDetails = async () => {
+        try {
+            loading.value = true
+            const res = await queryTHJPurchaseTransferDetail({
                 wrstandardid,
-            },
-            success: (res) => {
-                details.value = res.data
-
-                res.data.spotgoodspricelogs.forEach(({ spotgoodsprice, tradedate }) => {
-                    chartData.price.push(spotgoodsprice)
-                    chartData.date.push(tradedate)
-                })
-            },
-            complete: () => {
-                loading.value = false
-            }
-        })
+            })
+            details.value = res.data
+            res.data.spotgoodspricelogs.forEach(({ spotgoodsprice, tradedate }) => {
+                chartData.price.push(spotgoodsprice)
+                chartData.date.push(tradedate)
+            })
+        } finally {
+            loading.value = false
+        }
     }
 
     return {

+ 23 - 36
src/business/credit/index.ts

@@ -17,19 +17,15 @@ export function useCreditStatementList(stype?: ScoreConfigType) {
     const getCreditStatementList = async () => {
         loading.value = true
         await queryUserScoreLog({
-            data: {
-                stype,
-                userid: userId.value,
-                page: pageIndex.value,
-                pagesize: pageSize.value,
-            },
-            success: (res) => {
-                total.value = res.total
-                dataList.value = res.data
-            },
-            complete: () => {
-                loading.value = false
-            }
+            stype,
+            userid: userId.value,
+            page: pageIndex.value,
+            pagesize: pageSize.value,
+        }).then((res) => {
+            total.value = res.total
+            dataList.value = res.data
+        }).finally(() => {
+            loading.value = false
         })
         return dataList.value
     }
@@ -59,23 +55,17 @@ export function useCreditLottery() {
 
     const formRefresh = () => {
         queryUserAccount({
-            data: {
-                userID: userId.value
-            },
-            success: (res) => {
-                userAccount.value = res.data
-            }
+            userID: userId.value
+        }).then((res) => {
+            userAccount.value = res.data
         })
         queryUserScoreLog({
-            data: {
-                stype: ScoreConfigType.Lottery,
-                userid: userId.value,
-                page: 1,
-                pagesize: 10,
-            },
-            success: (res) => {
-                creditList.value = res.data
-            },
+            stype: ScoreConfigType.Lottery,
+            userid: userId.value,
+            page: 1,
+            pagesize: 10,
+        }).then((res) => {
+            creditList.value = res.data
         })
     }
 
@@ -97,14 +87,11 @@ export function useCreditLottery() {
     }
 
     queryTHJScoreConfig({
-        data: {
-            stype: ScoreConfigType.Lottery
-        },
-        success: (res) => {
-            if (res.data.length) {
-                creditConfig.value = res.data[0]
-            }
-        },
+        stype: ScoreConfigType.Lottery
+    }).then((res) => {
+        if (res.data.length) {
+            creditConfig.value = res.data[0]
+        }
     })
 
     return {

+ 81 - 122
src/business/goods/index.ts

@@ -18,18 +18,14 @@ export function useWrstandardList() {
     const getWrstandardList = async (params: Partial<Model.THJWrstandardReq> = {}) => {
         loading.value = true
         await queryTHJWrstandard({
-            data: {
-                page: pageIndex.value,
-                pagesize: pageSize.value,
-                wrstandardname: params.wrstandardname
-            },
-            success: (res) => {
-                total.value = res.total
-                dataList.value = res.data
-            },
-            complete: () => {
-                loading.value = false
-            }
+            page: pageIndex.value,
+            pagesize: pageSize.value,
+            wrstandardname: params.wrstandardname
+        }).then((res) => {
+            total.value = res.total
+            dataList.value = res.data
+        }).finally(() => {
+            loading.value = false
         })
         return dataList.value
     }
@@ -66,35 +62,24 @@ export function useWrstandardDetails(wrstandardid: number) {
     // 获取采购详情
     const getWrstandardDetails = async () => {
         loading.value = true
-        return queryTHJWrstandardDetail({
-            data: {
-                wrstandardid,
-            },
-            success: (res) => {
-                details.value = res.data
-
-                res.data.spotgoodspricelogs.forEach(({ spotgoodsprice, tradedate }) => {
-                    chartData.price.push(spotgoodsprice)
-                    chartData.date.push(tradedate)
-                })
-            },
-            complete: () => {
-                loading.value = false
-            }
+        return queryTHJWrstandardDetail({ wrstandardid }).then((res) => {
+            details.value = res.data
+            res.data.spotgoodspricelogs.forEach(({ spotgoodsprice, tradedate }) => {
+                chartData.price.push(spotgoodsprice)
+                chartData.date.push(tradedate)
+            })
+        }).finally(() => {
+            loading.value = false
         })
     }
 
     // 获取个性化定金比例
-    const getTHJinvesotrdeposit = (presaleapplyid: string) => {
-        return queryTHJinvesotrdeposit({
-            data: {
-                userid: userId.value,
-                presaleapplyid
-            },
-            success: (res) => {
-                customDeposits.value = res.data
-            }
+    const getTHJinvesotrdeposit = async (presaleapplyid: string) => {
+        const res = await queryTHJinvesotrdeposit({
+            userid: userId.value,
+            presaleapplyid
         })
+        customDeposits.value = res.data
     }
 
     return {
@@ -112,20 +97,16 @@ export function useUserFavoriteGoods(goodsid: number) {
     // 添加收藏
     const getAddUserFavoriteGoods = () => {
         return addUserFavoriteGoods({
-            data: {
-                userID: userId.value,
-                goodsID: goodsid
-            },
+            userID: userId.value,
+            goodsID: goodsid
         })
     }
 
     // 移除收藏
     const getRemoveUserFavoriteGoods = () => {
         return removeUserFavoriteGoods({
-            data: {
-                userID: userId.value,
-                goodsID: goodsid
-            },
+            userID: userId.value,
+            goodsID: goodsid
         })
     }
 
@@ -143,19 +124,15 @@ export function useQueryTHJTradeDataList() {
     const getQueryTHJTradeDataList = async (marketid: number) => {
         loading.value = true
         await queryTHJTradeData({
-            data: {
-                userid: userId.value,
-                marketid: marketid,
-                page: pageIndex.value,
-                pagesize: pageSize.value,
-            },
-            success: (res) => {
-                total.value = res.total
-                dataList.value = res.data
-            },
-            complete: () => {
-                loading.value = false
-            }
+            userid: userId.value,
+            marketid: marketid,
+            page: pageIndex.value,
+            pagesize: pageSize.value,
+        }).then((res) => {
+            total.value = res.total
+            dataList.value = res.data
+        }).finally(() => {
+            loading.value = false
         })
         return dataList.value
     }
@@ -180,19 +157,15 @@ export function useQueryTHJProductLists() {
     const getQueryTHJProductLists = async () => {
         loading.value = true
         await queryTHJProduct({
-            data: {
-                userid: userId.value,
-                favoriteflag: false,
-                page: pageIndex.value,
-                pagesize: pageSize.value,
-            },
-            success: (res) => {
-                total.value = res.total
-                dataList.value = res.data
-            },
-            complete: () => {
-                loading.value = false
-            }
+            userid: userId.value,
+            favoriteflag: false,
+            page: pageIndex.value,
+            pagesize: pageSize.value,
+        }).then((res) => {
+            total.value = res.total
+            dataList.value = res.data
+        }).finally(() => {
+            loading.value = false
         })
         return dataList.value
     }
@@ -214,20 +187,17 @@ export function useQueryMarketRunLists() {
     const { dataList, total, pageIndex, pageSize, pageCount } = useDataTable<Model.MarketRunRsp>()
     const loading = shallowRef(false)
 
-    const getQueryMarketRunLists = (marketid?: number) => {
-        loading.value = true
-        return queryMarketRun({
-            data: {
+    const getQueryMarketRunLists = async (marketid?: number) => {
+        try {
+            loading.value = true
+            const res = await queryMarketRun({
                 marketID: marketid
-            },
-            success: (res) => {
-                total.value = res.total
-                dataList.value = res.data
-            },
-            complete: () => {
-                loading.value = false
-            }
-        })
+            })
+            total.value = res.total
+            dataList.value = res.data
+        } finally {
+            loading.value = false
+        }
     }
 
     return {
@@ -246,20 +216,17 @@ export function useQueryWrMarketTradeConfig() {
     const { dataList, total, pageIndex, pageSize, pageCount } = useDataTable<Model.WrMarketTradeConfigRsp>()
     const loading = shallowRef(false)
 
-    const wrMarketTradeConfig = (marketid?: number) => {
-        loading.value = true
-        return queryWrMarketTradeConfig({
-            data: {
+    const wrMarketTradeConfig = async (marketid?: number) => {
+        try {
+            loading.value = true
+            const res = await queryWrMarketTradeConfig({
                 marketid: marketid
-            },
-            success: (res) => {
-                total.value = res.total
-                dataList.value = res.data
-            },
-            complete: () => {
-                loading.value = false
-            }
-        })
+            })
+            total.value = res.total
+            dataList.value = res.data
+        } finally {
+            loading.value = false
+        }
     }
 
     return {
@@ -281,19 +248,15 @@ export function useOrderQuoteList() {
     const getOrderQuoteList = async (params: Partial<Model.OrderQuoteReq> = {}) => {
         loading.value = true
         await queryOrderQuote({
-            data: {
-                page: pageIndex.value,
-                pagesize: pageSize.value,
-                wrpricetype: 1,
-                ...params,
-            },
-            success: (res) => {
-                total.value = res.total
-                dataList.value = res.data
-            },
-            complete: () => {
-                loading.value = false
-            }
+            page: pageIndex.value,
+            pagesize: pageSize.value,
+            wrpricetype: 1,
+            ...params,
+        }).then((res) => {
+            total.value = res.total
+            dataList.value = res.data
+        }).finally(() => {
+            loading.value = false
         })
         return dataList.value
     }
@@ -318,19 +281,15 @@ export function useOrderQuoteDetail(wrfactortypeid?: string) {
         if (wrfactortypeid) {
             loading.value = true
             await queryOrderQuoteDetail({
-                data: {
-                    wrpricetype: 1,
-                    haswr: 1,
-                    wrfactortypeid,
-                    buyorsell,
-                },
-                success: (res) => {
-                    total.value = res.total
-                    dataList.value = res.data
-                },
-                complete: () => {
-                    loading.value = false
-                }
+                wrpricetype: 1,
+                haswr: 1,
+                wrfactortypeid,
+                buyorsell,
+            }).then((res) => {
+                total.value = res.total
+                dataList.value = res.data
+            }).finally(() => {
+                loading.value = false
             })
         }
         return dataList.value

+ 4 - 7
src/business/login/index.ts

@@ -94,13 +94,10 @@ export function useLogin() {
             const params = { ...formData }
             await loadBaseData()
             await queryLoginId({
-                data: {
-                    username: formData.LoginID
-                },
-                success: (res) => {
-                    params.LoginID = res.data
-                    params.LoginPWD = cryptojs.SHA256(res.data + formData.LoginPWD).toString()
-                }
+                username: formData.LoginID
+            }).then((res) => {
+                params.LoginID = res.data
+                params.LoginPWD = cryptojs.SHA256(res.data + formData.LoginPWD).toString()
             })
             return await loginAction(params)
         } finally {

+ 18 - 23
src/business/market/index.ts

@@ -9,21 +9,18 @@ export function useSpotGoodsPrice() {
     const { dataList, total, pageIndex, pageSize, pageCount } = useDataTable<Model.SpotGoodsPriceRsp>()
     const loading = shallowRef(false)
 
-    const getSpotGoodsPrice = () => {
-        loading.value = true
-        return querySpotGoodsPrice({
-            data: {
+    const getSpotGoodsPrice = async () => {
+        try {
+            loading.value = true
+            const res = await querySpotGoodsPrice({
                 page: pageIndex.value,
                 pagesize: pageSize.value,
-            },
-            success: (res) => {
-                total.value = res.total
-                dataList.value = res.data
-            },
-            complete: () => {
-                loading.value = false
-            }
-        })
+            })
+            total.value = res.total
+            dataList.value = res.data
+        } finally {
+            loading.value = false
+        }
     }
 
     return {
@@ -42,16 +39,14 @@ export function useSpotGoodsPriceList() {
     const { dataList, pageCount } = useDataTable<Model.SpotgoodsPriceRsp>()
     const loading = shallowRef(false)
 
-    const getSpotGoodsPriceList = () => {
-        loading.value = true
-        return querySpotgoodsPrice({
-            success: (res) => {
-                dataList.value = res.data
-            },
-            complete: () => {
-                loading.value = false
-            }
-        })
+    const getSpotGoodsPriceList = async () => {
+        try {
+            loading.value = true
+            const res = await querySpotgoodsPrice()
+            dataList.value = res.data
+        } finally {
+            loading.value = false
+        }
     }
 
     return {

+ 21 - 31
src/business/news/index.ts

@@ -10,13 +10,11 @@ export function useSiteColumnDetail() {
     const currentColumnId = shallowRef(0)
 
     /// 查询栏目配置
-    const getSiteColumnConfig = querySiteColumnConfig({
-        success: (res) => {
-            siteColumns.value = res.data
-            /// 默认第一个
-            if (res.data.length) {
-                currentColumnId.value = res.data[0].id
-            }
+    const getSiteColumnConfig = querySiteColumnConfig().then((res) => {
+        siteColumns.value = res.data
+        /// 默认第一个
+        if (res.data.length) {
+            currentColumnId.value = res.data[0].id
         }
     })
 
@@ -24,18 +22,14 @@ export function useSiteColumnDetail() {
         loading.value = true
         await getSiteColumnConfig
         await querySiteColumnDetail({
-            data: {
-                columnid: currentColumnId.value,
-                page: pageIndex.value,
-                pagesize: pageSize.value,
-            },
-            success: (res) => {
-                total.value = res.total
-                dataList.value = res.data
-            },
-            complete: () => {
-                loading.value = false
-            }
+            columnid: currentColumnId.value,
+            page: pageIndex.value,
+            pagesize: pageSize.value,
+        }).then((res) => {
+            total.value = res.total
+            dataList.value = res.data
+        }).finally(() => {
+            loading.value = false
         })
         return dataList.value
     }
@@ -62,18 +56,14 @@ export function useSiteColumnConfig() {
     const getSiteColumnConfig = (columntype?: number) => {
         loading.value = true
         return querySiteColumnConfig({
-            data: {
-                columntype: columntype,
-                page: pageIndex.value,
-                pagesize: pageSize.value,
-            },
-            success: (res) => {
-                total.value = res.total
-                dataList.value = res.data
-            },
-            complete: () => {
-                loading.value = false
-            }
+            columntype: columntype,
+            page: pageIndex.value,
+            pagesize: pageSize.value,
+        }).then((res) => {
+            total.value = res.total
+            dataList.value = res.data
+        }).finally(() => {
+            loading.value = false
         })
     }
 

+ 78 - 114
src/business/order/index.ts

@@ -22,23 +22,19 @@ export function useQueryHoldLB() {
     const getHoldLB = async (warehouseid?: number, deliverygoodsid?: number, wrstandardid?: number, wrfactortypeid?: string, dgitemname?: string) => {
         loading.value = true
         await queryHoldLB({
-            data: {
-                accountid: firstAccountId.value,
-                warehouseid,
-                deliverygoodsid,
-                wrstandardid,
-                wrfactortypeid,
-                dgitemname,
-                page: pageIndex.value,
-                pagesize: pageSize.value,
-            },
-            success: (res) => {
-                total.value = res.total
-                dataList.value = res.data
-            },
-            complete: () => {
-                loading.value = false
-            }
+            accountid: firstAccountId.value,
+            warehouseid,
+            deliverygoodsid,
+            wrstandardid,
+            wrfactortypeid,
+            dgitemname,
+            page: pageIndex.value,
+            pagesize: pageSize.value,
+        }).then((res) => {
+            total.value = res.total
+            dataList.value = res.data
+        }).finally(() => {
+            loading.value = false
         })
         return dataList.value
     }
@@ -62,20 +58,16 @@ export function useQueryWrOutInApply() {
     const getWrOutInApply = async (begindate?: string, enddate?: string) => {
         loading.value = true
         await queryWrOutInApply({
-            data: {
-                userid: userId.value,
-                begindate: begindate,
-                enddate: enddate,
-                page: 1,
-                pagesize: pageSize.value,
-            },
-            success: (res) => {
-                total.value = res.total
-                dataList.value = res.data
-            },
-            complete: () => {
-                loading.value = false
-            }
+            userid: userId.value,
+            begindate: begindate,
+            enddate: enddate,
+            page: 1,
+            pagesize: pageSize.value,
+        }).then((res) => {
+            total.value = res.total
+            dataList.value = res.data
+        }).finally(() => {
+            loading.value = false
         })
         return dataList.value
     }
@@ -105,15 +97,11 @@ export function useQueryWrOrderDetail() {
 
     const getWrOrderDetail = async () => {
         loading.value = true
-        await queryWrOrderDetail({
-            data: formData,
-            success: (res) => {
-                total.value = res.total
-                dataList.value = res.data
-            },
-            complete: () => {
-                loading.value = false
-            }
+        await queryWrOrderDetail(formData).then((res) => {
+            total.value = res.total
+            dataList.value = res.data
+        }).finally(() => {
+            loading.value = false
         })
         return dataList.value
     }
@@ -144,15 +132,11 @@ export function useQueryWrTradeDetail() {
 
     const getWrTradeDetail = async () => {
         loading.value = true
-        await queryWrTradeDetail({
-            data: formData,
-            success: (res) => {
-                total.value = res.total
-                dataList.value = res.data
-            },
-            complete: () => {
-                loading.value = false
-            }
+        await queryWrTradeDetail(formData).then((res) => {
+            total.value = res.total
+            dataList.value = res.data
+        }).finally(() => {
+            loading.value = false
         })
         return dataList.value
     }
@@ -177,19 +161,15 @@ export function useTHJPurchaseTradeDetail() {
     const getTHJPurchaseTradeDetail = async (type?: number) => {
         loading.value = true
         await queryTHJPurchaseTradeDetail({
-            data: {
-                userid: userId.value,
-                type: type,
-                page: pageIndex.value,
-                pagesize: pageSize.value,
-            },
-            success: (res) => {
-                total.value = res.total
-                dataList.value = res.data
-            },
-            complete: () => {
-                loading.value = false
-            }
+            userid: userId.value,
+            type: type,
+            page: pageIndex.value,
+            pagesize: pageSize.value,
+        }).then((res) => {
+            total.value = res.total
+            dataList.value = res.data
+        }).finally(() => {
+            loading.value = false
         })
         return dataList.value
     }
@@ -213,22 +193,18 @@ export function useQueryTHJPromotionIncome() {
     const getTHJPromotionIncome = async (status?: number) => {
         loading.value = true
         await queryTHJPromotionIncome({
-            data: {
-                userid: userId.value,
-                profitstatus: status,
-                page: pageIndex.value,
-                pagesize: pageSize.value,
-            },
-            success: (res) => {
-                total.value = res.total
-                dataList.value = res.data.map((e) => ({
-                    ...e,
-                    profitstatus: status ?? e.profitstatus
-                }))
-            },
-            complete: () => {
-                loading.value = false
-            }
+            userid: userId.value,
+            profitstatus: status,
+            page: pageIndex.value,
+            pagesize: pageSize.value,
+        }).then((res) => {
+            total.value = res.total
+            dataList.value = res.data.map((e) => ({
+                ...e,
+                profitstatus: status ?? e.profitstatus
+            }))
+        }).finally(() => {
+            loading.value = false
         })
         return dataList.value
     }
@@ -252,19 +228,15 @@ export function useQueryTHJPromotionIncomeDetail(month: string) {
     const getTHJPromotionIncomeDetail = async () => {
         loading.value = true
         await queryTHJPromotionIncomeDetail({
-            data: {
-                userid: userId.value,
-                mouth: month,
-                page: pageIndex.value,
-                pagesize: pageSize.value,
-            },
-            success: (res) => {
-                total.value = res.total
-                dataList.value = res.data
-            },
-            complete: () => {
-                loading.value = false
-            }
+            userid: userId.value,
+            mouth: month,
+            page: pageIndex.value,
+            pagesize: pageSize.value,
+        }).then((res) => {
+            total.value = res.total
+            dataList.value = res.data
+        }).finally(() => {
+            loading.value = false
         })
         return dataList.value
     }
@@ -288,19 +260,15 @@ export function useQueryTHJPurchaseTransferOrder() {
     const getTHJPurchaseTransferOrder = async (ordertype: number) => {
         loading.value = true
         await queryTHJPurchaseTransferOrder({
-            data: {
-                userid: userId.value,
-                page: pageIndex.value,
-                pagesize: pageSize.value,
-                ordertype: ordertype
-            },
-            success: (res) => {
-                total.value = res.total
-                dataList.value = res.data
-            },
-            complete: () => {
-                loading.value = false
-            }
+            userid: userId.value,
+            page: pageIndex.value,
+            pagesize: pageSize.value,
+            ordertype: ordertype
+        }).then((res) => {
+            total.value = res.total
+            dataList.value = res.data
+        }).finally(() => {
+            loading.value = false
         })
         return dataList.value
     }
@@ -324,17 +292,13 @@ export function useQueryTTHJPurchaseTransferOrderDetail(transferid: string) {
     const getTHJPurchaseTransferOrderDetail = () => {
         loading.value = true
         queryTHJPurchaseTransferOrderDetail({
-            data: {
-                transferid,
-            },
-            success: (res) => {
-                if (res.data.length) {
-                    details.value = res.data[0]
-                }
-            },
-            complete: () => {
-                loading.value = false
+            transferid,
+        }).then((res) => {
+            if (res.data.length) {
+                details.value = res.data[0]
             }
+        }).finally(() => {
+            loading.value = false
         })
     }
 

+ 19 - 27
src/business/user/account.ts

@@ -16,22 +16,18 @@ export function getWrDraftUserInfo(userstatus?: number) {
         userid: userId.value
     })
 
-    const getWrDraftUserInfoList = () => {
-        const { userstatus, userid } = formData
-        loading.value = true
-
-        return queryWrDraftUserInfo({
-            data: {
+    const getWrDraftUserInfoList = async () => {
+        try {
+            loading.value = true
+            const { userstatus, userid } = formData
+            const res = await queryWrDraftUserInfo({
                 userid: userid,
                 userstatus: userstatus
-            },
-            success: (res) => {
-                dataList.value = res.data
-            },
-            complete: () => {
-                loading.value = false
-            }
-        })
+            })
+            dataList.value = res.data
+        } finally {
+            loading.value = false
+        }
     }
 
     return {
@@ -51,25 +47,21 @@ export function addAuthReq() {
         cardtype: 0
     })
 
-    const formSubmit = () => {
-        loading.value = true
-
-        return requestAddAuth({
-            data: {
+    const formSubmit = async () => {
+        try {
+            loading.value = true
+            const res = await requestAddAuth({
                 ...formData,
                 username: formData.username,
                 cardtype: formData.cardtype,
                 cardbackphotourl: formData.cardbackphotourl,
                 cardfrontphotourl: formData.cardfrontphotourl,
                 cardnum: formData.cardnum
-            },
-            success: (res) => {
-                console.log(res)
-            },
-            complete: () => {
-                loading.value = false
-            }
-        })
+            })
+            console.log(res)
+        } finally {
+            loading.value = false
+        }
     }
 
     return {

+ 10 - 13
src/business/user/address.ts

@@ -10,20 +10,17 @@ export function useAddress() {
     const loading = shallowRef(false)
     const columns = shallowRef([])
 
-    const getUserAddressList = () => {
-        loading.value = true
-        return queryUserReceiveInfo({
-            data: {
+    const getUserAddressList = async () => {
+        try {
+            loading.value = true
+            const res = await queryUserReceiveInfo({
                 userid: userId.value,
-            },
-            success: (res) => {
-                total.value = res.total
-                dataList.value = res.data
-            },
-            complete: () => {
-                loading.value = false
-            }
-        })
+            })
+            total.value = res.total
+            dataList.value = res.data
+        } finally {
+            loading.value = false
+        }
     }
 
     return {

+ 10 - 13
src/business/user/invoice.ts

@@ -11,20 +11,17 @@ export function useInvoice() {
     const loading = shallowRef(false)
     const columns = shallowRef([])
 
-    const getUserInvoiceList = () => {
-        loading.value = true
-        return queryWrUserReceiptInfo({
-            data: {
+    const getUserInvoiceList = async () => {
+        try {
+            loading.value = true
+            const res = await queryWrUserReceiptInfo({
                 userid: userId.value,
-            },
-            success: (res) => {
-                total.value = res.total
-                dataList.value = res.data
-            },
-            complete: () => {
-                loading.value = false
-            }
-        })
+            })
+            total.value = res.total
+            dataList.value = res.data
+        } finally {
+            loading.value = false
+        }
     }
 
     return {

+ 2 - 2
src/hooks/datatable/index.ts

@@ -33,7 +33,7 @@ export function useDataTable<T>(options: DataTableOptions = {}) {
                 })
             })
             // 本地分页
-            if (options.pagination) {
+            if (options.localPagination) {
                 total.value = result.length
                 return result.slice((pageIndex.value - 1) * pageSize.value, pageIndex.value * pageSize.value)
             }
@@ -46,10 +46,10 @@ export function useDataTable<T>(options: DataTableOptions = {}) {
 
     return {
         dataList,
-        total,
         pageIndex,
         pageSize,
         pageCount,
+        total,
         filters,
     }
 }

+ 1 - 1
src/hooks/datatable/interface.ts

@@ -56,7 +56,7 @@ export interface FilterButton {
  * 数据表配置项
  */
 export interface DataTableOptions {
-    pagination?: boolean; // 是否进行本地分页
+    localPagination?: boolean; // 是否进行本地分页
     pageSize?: number; // 每页条数
     pageIndex?: number; // 当前页码
 }

+ 8 - 14
src/hooks/echarts/candlestick/index.ts

@@ -62,21 +62,15 @@ export function useCandlestickChart(goodscode: string) {
         isEmpty.value = true;
 
         // 获取历史行情
-        queryHistoryDatas({
-            data: {
-                goodscode
-            },
-            success: (res) => {
-                const data = res.data;
-                if (data.length) {
-                    dataIndex.value = data.length - 1;
-                    isEmpty.value = false;
-                    handleData(data);
-                }
-            },
-            complete: () => {
-                loading.value = false;
+        queryHistoryDatas({ goodscode }).then((res) => {
+            const data = res.data;
+            if (data.length) {
+                dataIndex.value = data.length - 1;
+                isEmpty.value = false;
+                handleData(data);
             }
+        }).finally(() => {
+            loading.value = false;
         })
     }
 

+ 15 - 19
src/hooks/echarts/smoothedline/index.ts

@@ -32,27 +32,23 @@ export function useSmoothedLineChart(goodscode: string) {
         loading.value = true;
 
         queryHistoryTikDatas({
-            data: {
-                goodsCode: goodscode,
-                startTime: formatDate(new Date().toISOString(), 'YYYY-MM-DD 00:00:00'),
-                endTime: formatDate(new Date().toISOString(), 'YYYY-MM-DD 23:59:59'),
-                isAsc: true,
-            },
-            success: (res) => {
-                if (res.data.length) {
-                    const { date, price } = dataset.line.source
-                    dataIndex.value = res.data.length - 1
-                    isEmpty.value = false
+            goodsCode: goodscode,
+            startTime: formatDate(new Date().toISOString(), 'YYYY-MM-DD 00:00:00'),
+            endTime: formatDate(new Date().toISOString(), 'YYYY-MM-DD 23:59:59'),
+            isAsc: true,
+        }).then((res) => {
+            if (res.data.length) {
+                const { date, price } = dataset.line.source
+                dataIndex.value = res.data.length - 1
+                isEmpty.value = false
 
-                    res.data.forEach(({ PE, TS }) => {
-                        date.push(formatDate(TS, 'HH:mm:ss'))
-                        price.push(PE)
-                    })
-                }
-            },
-            complete: () => {
-                loading.value = false
+                res.data.forEach(({ PE, TS }) => {
+                    date.push(formatDate(TS, 'HH:mm:ss'))
+                    price.push(PE)
+                })
             }
+        }).finally(() => {
+            loading.value = false
         })
     }
 

+ 8 - 14
src/hooks/echarts/timeline/index.ts

@@ -34,21 +34,15 @@ export function useTimelineChart(goodscode: string) {
         loading.value = true;
 
         // 获取历史行情
-        queryTSData({
-            data: {
-                goodscode
-            },
-            success: (res) => {
-                const { historyDatas } = res.data;
-                if (historyDatas.length) {
-                    dataIndex.value = historyDatas.length - 1;
-                    isEmpty.value = false;
-                    handleData(res.data);
-                }
-            },
-            complete: () => {
-                loading.value = false;
+        queryTSData({ goodscode }).then((res) => {
+            const { historyDatas } = res.data;
+            if (historyDatas.length) {
+                dataIndex.value = historyDatas.length - 1;
+                isEmpty.value = false;
+                handleData(res.data);
             }
+        }).finally(() => {
+            loading.value = false;
         })
     }
 

+ 103 - 0
src/hooks/request/index.ts

@@ -0,0 +1,103 @@
+import { ref, onUnmounted } from 'vue'
+import { CommonResult } from '@/services/http/interface'
+import { useDataTable } from '../datatable'
+
+interface RequestOptions<TParams, TResponse> {
+    params?: {
+        page?: number; // 当前页码
+        pagesize?: number; // 每页条数
+    } & TParams;
+    localPagination?: boolean;
+    delay?: number;
+    onSuccess?: (res: TResponse) => void;
+    onError?: (err: string) => void;
+    onFinally?: () => void;
+}
+
+export function useRequest<TParams extends object, TResponse>(request: (params: TParams) => Promise<TResponse>, options?: RequestOptions<TParams, TResponse>) {
+    const { params, localPagination, onSuccess, onError, onFinally } = options ?? {}
+
+    type Result = TResponse extends CommonResult ? TResponse['data'] : TResponse // 获取返回值的类型
+    type ResultType = Result extends (infer U)[] ? U : Result // 如果 U 是数组,取 U 的类型
+
+    const { dataList, filters, total, pageIndex, pageSize, pageCount } = useDataTable<ResultType>({
+        localPagination,
+        pageSize: params?.page,
+        pageIndex: params?.pagesize,
+    })
+    const data = ref<ResultType>()
+    const loading = ref(false)
+
+    // 判断对象是否通用响应对象
+    const isCommonResult = (obj: unknown): obj is CommonResult => {
+        if (obj instanceof Object) {
+            return 'code' in obj && 'data' in obj
+        }
+        return false
+    }
+
+    // 异步函数
+    const runAsync = async (payload: Partial<TParams> = {}) => {
+        try {
+            loading.value = true
+            if (params && params.page && params.pagesize) {
+                params.page = pageIndex.value
+                params.pagesize = pageIndex.value
+            }
+
+            const res = await request({ ...params, ...payload } as TParams)
+
+            if (isCommonResult(res)) {
+                total.value = res.total
+                if (Array.isArray(res.data)) {
+                    dataList.value = res.data
+                } else {
+                    data.value = res.data as ResultType
+                }
+            } else {
+                if (Array.isArray(res)) {
+                    dataList.value = res
+                } else {
+                    data.value = res as ResultType
+                }
+            }
+
+            return res
+        } finally {
+            loading.value = false
+        }
+    }
+
+    // 同步函数
+    const run = (payload: Partial<TParams> = {}) => {
+        runAsync(payload).then((res) => {
+            onSuccess && onSuccess(res)
+        }).catch((err) => {
+            onError && onError(err)
+        }).finally(() => {
+            onFinally && onFinally()
+        })
+    }
+
+    const cancel = () => {
+        console.warn('取消请求')
+    }
+
+    onUnmounted(() => {
+        cancel()
+    })
+
+    return {
+        loading,
+        data,
+        dataList,
+        total,
+        pageIndex,
+        pageSize,
+        pageCount,
+        filters,
+        runAsync,
+        run,
+        cancel,
+    }
+}

+ 17 - 26
src/packages/mobile/views/credit/signin/index.vue

@@ -86,7 +86,7 @@
                         <Button type="primary" round @click="toPurchase">去完成</Button>
                     </div>
                 </dd>
-                <!-- <dd class="list-item">
+                <dd class="list-item">
                     <div class="list-item__title">
                         <div class="title-icon">
                             <img src="@mobile/assets/icons/goods.png" />
@@ -99,7 +99,7 @@
                     <div class="list-item__button">
                         <Button type="primary" round @click="toSupplyDemand">去完成</Button>
                     </div>
-                </dd> -->
+                </dd>
             </dl>
         </div>
         <app-register-code v-model:show="showQRCode" :text="userAccount.refernum" />
@@ -152,39 +152,30 @@ const toSupplyDemand = () => {
 const userSignin = () => {
     fullloading(() => {
         signin({
-            data: {
-                userid: userId.value
-            },
-            success: (res) => {
-                if (res.data.signinstatus === 1) {
-                    getUserAccount()
-                    showSuccessToast('签到成功')
-                } else {
-                    showFailToast('今日已签到')
-                }
-            },
-            fail: () => {
-                showFailToast('签到失败')
-            },
+            userid: userId.value
+        }).then((res) => {
+            if (res.data.signinstatus === 1) {
+                getUserAccount()
+                showSuccessToast('签到成功')
+            } else {
+                showFailToast('今日已签到')
+            }
+        }).catch(() => {
+            showFailToast('签到失败')
         })
     }, '签到中...')
 }
 
 const getUserAccount = () => {
     queryUserAccount({
-        data: {
-            userID: userId.value
-        },
-        success: (res) => {
-            userAccount.value = res.data
-        }
+        userID: userId.value
+    }).then((res) => {
+        userAccount.value = res.data
     })
 }
 
-queryTHJScoreConfig({
-    success: (res) => {
-        scoreConfig.value = res.data
-    },
+queryTHJScoreConfig().then((res) => {
+    scoreConfig.value = res.data
 })
 
 onActivated(() => getUserAccount())

+ 0 - 177
src/packages/mobile/views/home/components/main/index.backup.vue

@@ -1,177 +0,0 @@
-<template>
-  <app-scroll-view class="home-main">
-    <template #afterHeader>
-      <app-navbar title="铁合金掌上行" :show-back-button="false" />
-    </template>
-    <app-statusbar class="home-main__header">
-      <div class="home-main__banner home-main__banner--header">
-        <Swipe :autoplay="5000" indicator-color="white" lazy-render>
-          <SwipeItem v-for="(item, index) in topBanners" :key="index">
-            <img :src="getImageUrl(item.imagepath)" />
-          </SwipeItem>
-        </Swipe>
-      </div>
-    </app-statusbar>
-    <PullRefresh class="home-main__container" v-model="refreshing" @refresh="onRefresh">
-      <app-block class="home-main__iconbar bg">
-        <ul>
-          <li @click="routerTo('product')">
-            <img src="@mobile/assets/icons/cpjs.png" />
-            <span>产品介绍</span>
-          </li>
-          <li @click="routerTo('Market')">
-            <img src="@mobile/assets/icons/cpjg.png" />
-            <span>产品价格</span>
-          </li>
-          <li @click="routerTo('NavigationPTGZ')">
-            <img src="@mobile/assets/icons/ptgz.png" />
-            <span>平台规则</span>
-          </li>
-        </ul>
-        <ul>
-          <li @click="routerTo('credit-signin')">
-            <img src="@mobile/assets/icons/wdrw.png" />
-            <span>我的任务</span>
-          </li>
-          <li @click="routerTo('contract')">
-            <img src="@mobile/assets/icons/htzr.png" />
-            <span>合同转让</span>
-          </li>
-          <li @click="routerTo('rules-ccwl')">
-            <img src="@mobile/assets/icons/ccwl.png" />
-            <span>仓储物流</span>
-          </li>
-        </ul>
-      </app-block>
-      <app-block class="home-main__market flex" v-if="false">
-        <div class="left">
-          <h2>合金指数</h2>
-          <span>{{ formatDate(marketRun.tradedate, "YYYY-MM-DD") }}</span>
-        </div>
-        <div class="right">
-          <Swipe :autoplay="10 * 1000" :show-indicators="false" vertical>
-            <SwipeItem v-for="(items, i) in groupList" :key="i">
-              <table cellspacing="0" cellpadding="0">
-                <tbody>
-                  <tr v-for="(item, n) in items" :key="i + n">
-                    <td>{{ item.wrstandardname }}</td>
-                    <td>{{ handleNumberValue(item.prespotgoodsprice) }}</td>
-                    <td>{{ handleNumberValue(item.todayspotgoodsprice) }}</td>
-                    <td>{{ parsePercent(item.chg) }}</td>
-                  </tr>
-                </tbody>
-              </table>
-            </SwipeItem>
-          </Swipe>
-        </div>
-      </app-block>
-      <app-block class="home-main__banner home-main__banner--body" v-if="false">
-        <Swipe :autoplay="5000" indicator-color="white" lazy-render>
-          <SwipeItem v-for="(item, index) in bodyBanners" :key="index">
-            <img :src="getImageUrl(item.imagepath)" />
-          </SwipeItem>
-        </Swipe>
-      </app-block>
-      <app-block class="home-main__news">
-        <CellGroup class="article">
-          <Cell class="titlebar" title-class="titlebar-title" value-class="titlebar-more" value="更多"
-            :to="{ name: 'news-list' }" is-link>
-            <template #title>
-              <img src="@mobile/assets/icons/fire.png" />
-              <span>市场资讯</span>
-            </template>
-          </Cell>
-          <template v-for="(item, index) in newsList" :key="index">
-            <Cell class="article-item" title-class="article-item__title" value-class="article-item__time"
-              :title="item.title" :value="formatDate(item.creaedate, 'MM/DD')" :to="{
-                name: 'news-details',
-                params: { item: JSON.stringify(item) },
-              }" />
-          </template>
-        </CellGroup>
-      </app-block>
-    </PullRefresh>
-  </app-scroll-view>
-</template>
-
-<script lang="ts" setup>
-import { shallowRef, computed } from "vue";
-import { Cell, CellGroup, Swipe, SwipeItem, PullRefresh } from "vant";
-import {
-  getImageUrl,
-  formatDate,
-  parsePercent,
-  handleNumberValue,
-} from "@/filters";
-import { useNavigation } from "@/hooks/navigation";
-import { queryImageConfigs } from "@/services/api/common";
-import { querySiteColumnDetail } from "@/services/api/news";
-import { useSpotGoodsPrice } from "@/business/market";
-import { queryMarketRun } from "@/services/api/goods";
-
-const { routerTo } = useNavigation();
-const { dataList, getSpotGoodsPrice } = useSpotGoodsPrice();
-const refreshing = shallowRef(false); // 是否处于加载中状态
-const topBanners = shallowRef<Model.ImageConfigsRsp[]>([]); // 轮播图列表
-const bodyBanners = shallowRef<Model.ImageConfigsRsp[]>([]); // 轮播图列表
-const newsList = shallowRef<Model.SiteColumnDetailRsp[]>([]); // 资讯列表
-const marketRun = shallowRef<Partial<Model.MarketRunRsp>>({}); // 市场
-
-// 合金指数组列表(4条记录为一组)
-const groupList = computed(() => {
-  const result: Model.SpotGoodsPriceRsp[][] = [];
-  for (let i = 0; i < dataList.value.length; i += 4) {
-    result.push(dataList.value.slice(i, i + 4));
-  }
-  return result;
-});
-
-// 下拉刷新
-const onRefresh = () => {
-  // 合金指数
-  getSpotGoodsPrice();
-  // 市场信息
-  queryMarketRun({
-    success: (res) => {
-      marketRun.value = res.data[0];
-    },
-  });
-  // 市场资讯
-  querySiteColumnDetail({
-    data: {
-      page: 1,
-      pagesize: 10,
-    },
-    success: (res) => {
-      newsList.value = res.data;
-    },
-    complete: () => {
-      refreshing.value = false;
-    },
-  });
-};
-
-queryImageConfigs({
-  data: {
-    imageType: 1,
-  },
-  success: (res) => {
-    topBanners.value = res.data;
-  },
-});
-
-queryImageConfigs({
-  data: {
-    imageType: 10,
-  },
-  success: (res) => {
-    bodyBanners.value = res.data;
-  },
-});
-
-onRefresh();
-</script>
-
-<style lang="less">
-@import "./index.less";
-</style>

+ 21 - 35
src/packages/mobile/views/home/components/main/index.vue

@@ -164,48 +164,34 @@ const onSpotChange = (index: number) => {
 // 下拉刷新
 const onRefresh = () => {
   // 市场信息
-  queryMarketRun({
-    success: (res) => {
-      marketRun.value = res.data[0];
-    },
-  });
+  queryMarketRun().then((res) => {
+    marketRun.value = res.data[0]
+  })
   // 市场资讯
   querySiteColumnDetail({
-    data: {
-      page: 1,
-      pagesize: 10,
-    },
-    success: (res) => {
-      newsList.value = res.data;
-    },
-    complete: () => {
-      refreshing.value = false;
-    },
-  });
-};
+    page: 1,
+    pagesize: 10,
+  }).then((res) => {
+    newsList.value = res.data
+  }).finally(() => {
+    refreshing.value = false
+  })
+}
 
 queryImageConfigs({
-  data: {
-    imageType: 1,
-  },
-  success: (res) => {
-    topBanners.value = res.data;
-  },
-});
+  imageType: 1,
+}).then((res) => {
+  topBanners.value = res.data
+})
 
 queryImageConfigs({
-  data: {
-    imageType: 10,
-  },
-  success: (res) => {
-    bodyBanners.value = res.data;
-  },
-});
+  imageType: 10,
+}).then((res) => {
+  bodyBanners.value = res.data
+})
 
-queryThjSpotQuoteConfig({
-  success: (res) => {
-    spotQuoteList.value = res.data
-  },
+queryThjSpotQuoteConfig().then((res) => {
+  spotQuoteList.value = res.data
 })
 
 onRefresh();

+ 18 - 20
src/packages/mobile/views/home/index.vue

@@ -46,12 +46,12 @@ const tabList: Tabbar[] = [
     icon: 'icon-purchase',
     activeIcon: 'icon-purchase-active',
   },
-  // {
-  //   name: 'supplyDemand',
-  //   label: '供求',
-  //   icon: 'icon-supply-demand',
-  //   activeIcon: 'icon-supply-demand-active',
-  // },
+  {
+    name: 'supplyDemand',
+    label: '供求',
+    icon: 'icon-supply-demand',
+    activeIcon: 'icon-supply-demand-active',
+  },
   {
     name: 'mine',
     label: '我的',
@@ -84,20 +84,18 @@ onActivated(() => {
 // 获取当前应用版本号
 plus.getVersionCode((currentVersionCode) => {
   // 获取应用更新信息
-  GetAppUpdateInfo({
-    success: (res) => {
-      const data = JSON.parse(res)
-      if (data) {
-        const { LastVersionCode, ApkUrl } = data[0] as Model.AppUpdateInfo
-        if (Number(LastVersionCode) > Number(currentVersionCode)) {
-          dialog({
-            message: '发现新版本,是否更新?',
-            showCancelButton: true,
-            confirmButtonText: '更新'
-          }).then(() => {
-            plus.updateApp(ApkUrl)
-          })
-        }
+  GetAppUpdateInfo().then((res) => {
+    const data = JSON.parse(res)
+    if (data) {
+      const { LastVersionCode, ApkUrl } = data[0] as Model.AppUpdateInfo
+      if (Number(LastVersionCode) > Number(currentVersionCode)) {
+        dialog({
+          message: '发现新版本,是否更新?',
+          showCancelButton: true,
+          confirmButtonText: '更新'
+        }).then(() => {
+          plus.updateApp(ApkUrl)
+        })
       }
     }
   })

+ 6 - 12
src/packages/mobile/views/mine/generalize/index.vue

@@ -110,21 +110,15 @@ const onMenuChange = () => {
 }
 
 queryUserAccount({
-    data: {
-        userID: userId.value
-    },
-    success: (res) => {
-        userAccount.value = res.data
-    }
+    userID: userId.value
+}).then((res) => {
+    userAccount.value = res.data
 })
 
 queryUserLevelInfo({
-    data: {
-        userid: userId.value
-    },
-    success: (res) => {
-        userLevelInfo.value = res.data
-    }
+    userid: userId.value
+}).then((res) => {
+    userLevelInfo.value = res.data
 })
 </script>
 

+ 4 - 7
src/packages/mobile/views/mine/main/index.vue

@@ -199,13 +199,10 @@ onActivated(() => {
   if (authStatus.value !== AuthStatus.Certified) {
     // 获取用户账号信息
     queryUserAccount({
-      data: {
-        userID: userId.value
-      },
-      success: (res) => {
-        authStatus.value = res.data.hasauth
-        registerCode.value = res.data.refernum
-      }
+      userID: userId.value
+    }).then((res) => {
+      authStatus.value = res.data.hasauth
+      registerCode.value = res.data.refernum
     })
   }
 })

+ 5 - 5
src/packages/mobile/views/mine/wareorder/list/components/holdlb/index.vue

@@ -26,7 +26,7 @@
                         </table>
                     </div>
                     <div class="section-item__btnbar">
-                        <!-- <Button size="small" round @click="listing(item)">挂牌</Button> -->
+                        <Button size="small" round @click="listing(item)">挂牌</Button>
                         <Button size="small" round @click="pickup(item)">提货</Button>
                     </div>
                 </li>
@@ -64,10 +64,10 @@ const pickup = (item: Model.HoldLBRsp) => {
     openComponent('pickup')
 }
 
-// const listing = (item: Model.HoldLBRsp) => {
-//     selectedRow.value = item
-//     openComponent('listing')
-// }
+const listing = (item: Model.HoldLBRsp) => {
+    selectedRow.value = item
+    openComponent('listing')
+}
 
 const onRefresh = (finish: () => void) => {
     /// 查询未完成

+ 5 - 8
src/packages/mobile/views/news/details/index.vue

@@ -41,14 +41,11 @@ if (item) {
 }
 
 querySiteColumnDetail({
-    data: {
-        columnid: columnid ? Number(columnid) : undefined,
-        page: 1,
-        pagesize: 10,
-    },
-    success: (res) => {
-        newsList.value = res.data.filter((e) => e.id !== details.value?.id)
-    }
+    columnid: columnid ? Number(columnid) : undefined,
+    page: 1,
+    pagesize: 10,
+}).then((res) => {
+    newsList.value = res.data.filter((e) => e.id !== details.value?.id)
 })
 </script>
 

+ 4 - 7
src/packages/mobile/views/supply-demand/detail/components/delisting/index.vue

@@ -164,13 +164,10 @@ const onSubmit = () => {
 }
 
 queryHoldLB({
-    data: {
-        accountid: firstAccountId.value,
-        wrfactortypeid: props.quoteItem.wrfactortypeid
-    },
-    success: (res) => {
-        selectedRow.value = res.data[0]
-    }
+    accountid: firstAccountId.value,
+    wrfactortypeid: props.quoteItem.wrfactortypeid
+}).then((res) => {
+    selectedRow.value = res.data[0]
 })
 
 // 暴露组件属性给父组件调用

+ 4 - 7
src/packages/mobile/views/supply-demand/detail/components/listing/index.vue

@@ -145,13 +145,10 @@ const onSubmit = () => {
 }
 
 queryHoldLB({
-    data: {
-        accountid: firstAccountId.value,
-        wrfactortypeid: props.quoteItem.wrfactortypeid
-    },
-    success: (res) => {
-        selectedRow.value = res.data[0]
-    }
+    accountid: firstAccountId.value,
+    wrfactortypeid: props.quoteItem.wrfactortypeid
+}).then((res) => {
+    selectedRow.value = res.data[0]
 })
 
 // 暴露组件属性给父组件调用

+ 6 - 10
src/packages/mobile/views/user/avatar/index.vue

@@ -54,16 +54,12 @@ const onUploadSuccess = (filePath: string) => {
 
 const onSubmit = () => {
     fullloading((hideLoading) => {
-        updateUserHeadUrl({
-            data: formData,
-            success: () => {
-                hideLoading()
-                userStore.actions.getUserData()
-                router.back()
-            },
-            fail: (err) => {
-                showFailToast(err)
-            }
+        updateUserHeadUrl(formData).then((res) => {
+            hideLoading()
+            userStore.actions.getUserData()
+            router.back()
+        }).catch((err) => {
+            showFailToast(err)
         })
     })
 }

+ 35 - 47
src/packages/mobile/views/user/forget/index.vue

@@ -5,10 +5,10 @@
         </template>
         <Form ref="formRef" class="g-form__container" @submit="formSubmit">
             <CellGroup inset>
-                <Field v-model="formData.mobile" type="tel" name="mobile" label="手机号码" placeholder="必填"
-                    autocomplete="off" :rules="formRules.mobile" />
-                <Field v-model="formData.vcode" type="digit" name="vcode" label="短信验证码" placeholder="必填"
-                    autocomplete="off" :rules="formRules.vcode">
+                <Field v-model="formData.mobile" type="tel" name="mobile" label="手机号码" placeholder="必填" autocomplete="off"
+                    :rules="formRules.mobile" />
+                <Field v-model="formData.vcode" type="digit" name="vcode" label="短信验证码" placeholder="必填" autocomplete="off"
+                    :rules="formRules.vcode">
                     <template #button>
                         <Button size="small" type="primary" :disabled="isCountdown" @click="sendVerifyCode">
                             <span v-if="isCountdown">重新发送({{ currentTime.seconds }})</span>
@@ -109,17 +109,13 @@ const formRules: { [key in keyof Model.ResetPasswordReq | 'confirmpassword']?: F
 const sendVerifyCode = () => {
     formRef.value?.validate('mobile').then(() => {
         sendResetVerifyCode({
-            data: {
-                mobile: getEncryptMobile(formData.mobile),
-                businessType: 1
-            },
-            success: () => {
-                isCountdown.value = true
-                countdown.start()
-            },
-            fail: () => {
-                showFailToast('发送失败')
-            }
+            mobile: getEncryptMobile(formData.mobile),
+            businessType: 1
+        }).then(() => {
+            isCountdown.value = true
+            countdown.start()
+        }).catch(() => {
+            showFailToast('发送失败')
         })
     })
 }
@@ -127,40 +123,32 @@ const sendVerifyCode = () => {
 const formSubmit = () => {
     fullloading((hideLoading) => {
         queryLoginId({
-            data: {
-                username: formData.mobile
-            },
-            success: (res) => {
-                const { mobile, password, vcode } = formData
-                const logincode = res.data
-                const encryptedData = cryptojs.SHA256(logincode + password).toString()
-                const encryptedHex = cryptojs.enc.Hex.parse(encryptedData).toString().toLocaleLowerCase()
+            username: formData.mobile
+        }).then((res) => {
+            const { mobile, password, vcode } = formData
+            const logincode = res.data
+            const encryptedData = cryptojs.SHA256(logincode + password).toString()
+            const encryptedHex = cryptojs.enc.Hex.parse(encryptedData).toString().toLocaleLowerCase()
 
-                resetPassword({
-                    data: {
-                        logincode,
-                        mobile: getEncryptMobile(mobile),
-                        password: encryptedHex,
-                        vcode,
-                    },
-                    success: (res) => {
-                        if (res.code === '0') {
-                            hideLoading()
-                            dialog('密码重置成功,请重新登录。').then(() => {
-                                router.back()
-                            })
-                        } else {
-                            showFailToast(res.message)
-                        }
-                    },
-                    fail: (err) => {
-                        showFailToast(err)
-                    }
-                })
-            },
-            fail: (err) => {
+            resetPassword({
+                logincode,
+                mobile: getEncryptMobile(mobile),
+                password: encryptedHex,
+                vcode,
+            }).then((res) => {
+                if (res.code === '0') {
+                    hideLoading()
+                    dialog('密码重置成功,请重新登录。').then(() => {
+                        router.back()
+                    })
+                } else {
+                    showFailToast(res.message)
+                }
+            }).catch((err) => {
                 showFailToast(err)
-            }
+            })
+        }).catch((err) => {
+            showFailToast(err)
         })
     })
 }

+ 30 - 40
src/packages/mobile/views/user/register/index.vue

@@ -133,14 +133,12 @@ const formRules: { [key in keyof Model.RegisterReq]?: FieldRule[] } = {
 const sendVerifyCode = () => {
   formRef.value?.validate('mobilephone').then(() => {
     sendRegisterVerifyCode({
-      data: formData.mobilephone,
-      success: () => {
-        isCountdown.value = true
-        countdown.start()
-      },
-      fail: () => {
-        showFailToast('发送失败')
-      }
+      phonenumber: formData.mobilephone
+    }).then(() => {
+      isCountdown.value = true
+      countdown.start()
+    }).catch(() => {
+      showFailToast('发送失败')
     })
   })
 }
@@ -153,22 +151,18 @@ const getRegisterMoney = (accountid: number) => {
     })
   }
   return queryMyRegisterMoney({
-    data: {
-      accountid
-    },
-    success: (res) => {
-      // 查询成功显示获得红包
-      if (res.data.length) {
-        redEnvelope.value = res.data[0].amount
-        showReward.value = true
-      } else {
-        toggleDialog()
-      }
-    },
-    fail: () => {
-      // 查询失败提示注册成功后返回登录页面
+    accountid
+  }).then((res) => {
+    // 查询成功显示获得红包
+    if (res.data.length) {
+      redEnvelope.value = res.data[0].amount
+      showReward.value = true
+    } else {
       toggleDialog()
     }
+  }).catch(() => {
+    // 查询失败提示注册成功后返回登录页面
+    toggleDialog()
   })
 }
 
@@ -182,25 +176,21 @@ const formSubmit = () => {
       const loginpwd = Base64.stringify(Utf8.parse(passwordData))
 
       userRegister({
-        data: {
-          ...formData,
-          loginpwd
-        },
-        success: (res) => {
-          if (res.code === 0) {
-            // 等待3秒后查询注册红包
-            setTimeout(() => {
-              getRegisterMoney(res.taaccount[0].accountid).finally(() => {
-                hideLoading()
-              })
-            }, 3000)
-          } else {
-            showFailToast(res.message)
-          }
-        },
-        fail: (err) => {
-          showFailToast(err)
+        ...formData,
+        loginpwd
+      }).then((res) => {
+        if (res.code === 0) {
+          // 等待3秒后查询注册红包
+          setTimeout(() => {
+            getRegisterMoney(res.taaccount[0].accountid).finally(() => {
+              hideLoading()
+            })
+          }, 3000)
+        } else {
+          showFailToast(res.message)
         }
+      }).catch((err) => {
+        showFailToast(err)
       })
     }, '正在注册...')
   } else {

+ 22 - 27
src/packages/pc/views/member/index.vue

@@ -130,30 +130,27 @@ const getPhoneNumber = (value: string) => {
     return phoneNumber?.replace(reg, '$1****$2')
 }
 
-const getTHJFriends = (params: Partial<Model.THJFriendsReq> = {}) => {
-    loading.value = true
-    return queryTHJFriends({
-        data: {
+const getTHJFriends = async (params: Partial<Model.THJFriendsReq> = {}) => {
+    try {
+        loading.value = true
+        const res = await queryTHJFriends({
             userid: selectedId.value,
             page: pageIndex.value,
             pagesize: pageSize.value,
             ...params
-        },
-        success: (res) => {
-            total.value = res.total
-            dataList.value = res.data
-
-            if (treeList[0].children?.length === 0) {
-                treeList[0].children = res.data.map((e) => ({
-                    label: e.customername,
-                    userid: e.frienduserid,
-                }))
-            }
-        },
-        complete: () => {
-            loading.value = false
+        })
+        total.value = res.total
+        dataList.value = res.data
+
+        if (treeList[0].children?.length === 0) {
+            treeList[0].children = res.data.map((e) => ({
+                label: e.customername,
+                userid: e.frienduserid,
+            }))
         }
-    })
+    } finally {
+        loading.value = false
+    }
 }
 
 // 当节点被点击的时候触发
@@ -185,14 +182,12 @@ const onRefresh = () => {
     })
 }
 
-queryInvestorLevelGroup({
-    success: (res) => {
-        const [levelGroups] = filterOptons.selectList
-        levelGroups.options = res.data.map((e) => ({
-            label: e.groupname,
-            value: e.levelgroupid
-        }))
-    }
+queryInvestorLevelGroup().then((res) => {
+    const [levelGroups] = filterOptons.selectList
+    levelGroups.options = res.data.map((e) => ({
+        label: e.groupname,
+        value: e.levelgroupid
+    }))
 })
 onRefresh()
 watch(filterText, (val) => {

+ 10 - 13
src/packages/pc/views/profit/index.vue

@@ -79,23 +79,20 @@ filterOptons.buttonList = [
     { lable: '查询', className: 'el-button--primary', onClick: () => onSearch() }
 ]
 
-const getTHJProfits = (params: Partial<Model.THJProfitsReq> = {}) => {
-    loading.value = true
-    return queryTHJProfits({
-        data: {
+const getTHJProfits = async (params: Partial<Model.THJProfitsReq> = {}) => {
+    try {
+        loading.value = true
+        const res = await queryTHJProfits({
             userid: userId.value,
             page: pageIndex.value,
             pagesize: pageSize.value,
             ...params,
-        },
-        success: (res) => {
-            total.value = res.total
-            dataList.value = res.data
-        },
-        complete: () => {
-            loading.value = false
-        }
-    })
+        })
+        total.value = res.total
+        dataList.value = res.data
+    } finally {
+        loading.value = false
+    }
 }
 
 const onSearch = (clear = false) => {

+ 10 - 14
src/packages/pc/views/ratio/components/history/index.vue

@@ -43,24 +43,20 @@ const tableColumns = shallowRef<Model.TableColumn[]>([
     { prop: 'wrtradedetailid', label: '采购单号', width: 200 },
 ])
 
-const getTHJInvesotrDepositLog = () => {
-    loading.value = true
-    return queryTHJInvesotrDepositLog({
-        data: {
+const getTHJInvesotrDepositLog = async () => {
+    try {
+        loading.value = true
+        const res = await queryTHJInvesotrDepositLog({
             userid: props.selectedRow.userid,
             depositrate: props.selectedRow.depositrate,
             page: pageIndex.value,
             pagesize: pageSize.value,
-
-        },
-        success: (res) => {
-            total.value = res.total
-            dataList.value = res.data
-        },
-        complete: () => {
-            loading.value = false
-        }
-    })
+        })
+        total.value = res.total
+        dataList.value = res.data
+    } finally {
+        loading.value = false
+    }
 }
 
 const onRefresh = () => {

+ 9 - 12
src/packages/pc/views/ratio/index.vue

@@ -35,19 +35,16 @@ const tableColumns = shallowRef<Model.TableColumn[]>([
     { prop: 'operate', label: '操作', width: 160, fixed: 'right' }
 ])
 
-const getMyDeposit = () => {
-    loading.value = true
-    return queryMyDeposit({
-        data: {
+const getMyDeposit = async () => {
+    try {
+        loading.value = true
+        const res = await queryMyDeposit({
             userid: userId.value,
-        },
-        success: (res) => {
-            dataList.value = res.data
-        },
-        complete: () => {
-            loading.value = false
-        }
-    })
+        })
+        dataList.value = res.data
+    } finally {
+        loading.value = false
+    }
 }
 
 getMyDeposit().catch((err) => ElMessage.error(err))

+ 3 - 3
src/packages/pc/views/system/menu/index.vue

@@ -2,14 +2,14 @@
     <app-view class="system-menu">
         <app-table ref="tableRef" :data="dataList" v-model:columns="columns" row-key="code" :selection="false">
             <template #header>
-                <app-action-menu :menus="getAuthButtons(['system_menu_add'])" @click="openComponent" />
+                <app-action-menu :menus="getActionMenus('system_menu_add')" @click="openComponent" />
                 <el-button type="primary" :icon="isRowExpansion ? 'FolderOpened' : 'Folder'" @click="tableExpandAll">
                     <span v-if="isRowExpansion">全部收起</span>
                     <span v-else>全部展开</span>
                 </el-button>
             </template>
             <template #operate="{ row }">
-                <app-action-menu :menus="getAuthButtons(['system_menu_edit', 'system_menu_delete'])" :record="row"
+                <app-action-menu :menus="getActionMenus('system_menu_edit', 'system_menu_delete')" :record="row"
                     @click="openComponent" linkButton />
             </template>
         </app-table>
@@ -27,7 +27,7 @@ import AppActionMenu from '@pc/components/modules/action-menu/index.vue'
 import AppTable from '@pc/components/base/table/index.vue'
 
 const { userRoutes } = useMenu()
-const { activeMenu, asyncComponent, getAuthButtons, openComponent, closeComponent } = useActionMenu<Model.UserRoutes>()
+const { activeMenu, asyncComponent, getActionMenus, openComponent, closeComponent } = useActionMenu<Model.UserRoutes>()
 const { dataList = userRoutes } = useDataTable<Model.UserRoutes>()
 const tableRef = ref()
 const isRowExpansion = ref(false)

+ 5 - 8
src/packages/pc/views/system/role/index.vue

@@ -2,11 +2,10 @@
     <app-view class="system-role">
         <app-table :data="dataList" v-model:columns="columns">
             <template #header>
-                <app-action-menu :menus="getAuthButtons(['system_role_add', 'system_role_delete'])"
-                    @click="openComponent" />
+                <app-action-menu :menus="getActionMenus('system_role_add', 'system_role_delete')" @click="openComponent" />
             </template>
             <template #operate="{ row }">
-                <app-action-menu :menus="getAuthButtons(['system_role_auth', 'system_role_edit', 'system_role_delete'])"
+                <app-action-menu :menus="getActionMenus('system_role_auth', 'system_role_edit', 'system_role_delete')"
                     :record="row" @click="openComponent" linkButton />
             </template>
         </app-table>
@@ -23,7 +22,7 @@ import { useActionMenu } from '@pc/components/modules/action-menu'
 import AppActionMenu from '@pc/components/modules/action-menu/index.vue'
 import AppTable from '@pc/components/base/table/index.vue'
 
-const { activeMenu, asyncComponent, getAuthButtons, openComponent, closeComponent } = useActionMenu<Model.UserRole>()
+const { activeMenu, asyncComponent, getActionMenus, openComponent, closeComponent } = useActionMenu<Model.UserRole>()
 const { dataList } = useDataTable<Model.UserRole>()
 
 const columns = ref([
@@ -34,9 +33,7 @@ const columns = ref([
     { prop: 'operate', label: '操作', }
 ])
 
-queryAccountRole({
-    success: (res) => {
-        dataList.value = res.data
-    }
+queryAccountRole().then((res) => {
+    dataList.value = res.data
 })
 </script>

+ 15 - 16
src/services/api/account/index.ts

@@ -1,5 +1,4 @@
 import { httpRequest, commonRequest, getServiceUrl } from '@/services/http'
-import { HttpParams, CommonParams } from '@/services/http/interface'
 import { tradeServerRequest } from '@/services/socket/trade'
 import { TradeParams } from '@/services/socket/trade/interface'
 
@@ -27,56 +26,56 @@ export function tokenCheck(params: TradeParams<Proto.TokenCheckReq, Proto.TokenC
 /**
  * 查询账户菜单
  */
-export function queryAccountMenu(params: HttpParams<{ rsp: Model.UserRoutes[] }>) {
-    return httpRequest('/account/menu', 'get', params);
+export function queryAccountMenu() {
+    return httpRequest<Model.UserRoutes[]>('/account/menu', 'get');
 }
 
 /**
  * 查询登录ID
  */
-export function queryLoginId(params: HttpParams<{ req: { username: string }, rsp: string }>) {
-    return httpRequest('/User/GetLoginID', 'get', params, 'GetLoginID');
+export function queryLoginId(params: { username: string }) {
+    return httpRequest<string>('/User/GetLoginID', 'get', params, 'GetLoginID');
 }
 
 /**
  * 查询登录账户配置信息
  */
-export function queryLoginData(params: HttpParams<{ req: Model.LoginQueryReq, rsp: Model.LoginQueryRsp }>) {
-    return httpRequest('/User/LoginQuery', 'get', params, 'LoginQuery');
+export function queryLoginData(params: Model.LoginQueryReq) {
+    return httpRequest<Model.LoginQueryRsp>('/User/LoginQuery', 'get', params, 'LoginQuery');
 }
 
 /**
  * 获取用户账号信息
  */
-export function queryUserAccount(params: HttpParams<{ req: { userID: number }, rsp: Model.UserAccount }>) {
-    return httpRequest('/User/GetUserAccount', 'get', params, 'GetUserAccount');
+export function queryUserAccount(params: { userID: number }) {
+    return httpRequest<Model.UserAccount>('/User/GetUserAccount', 'get', params, 'GetUserAccount');
 }
 
 /**
  * 查询资金账户信息
  */
-export function queryTaAccounts(params: HttpParams<{ req: Model.TaAccountsReq, rsp: Model.TaAccountsRsp[] }>) {
-    return httpRequest('/TaAccount/GetTaAccounts', 'get', params, 'GetTaAccounts');
+export function queryTaAccounts(params: Model.TaAccountsReq) {
+    return httpRequest<Model.TaAccountsRsp[]>('/TaAccount/GetTaAccounts', 'get', params, 'GetTaAccounts');
 }
 
 /**
  * 查询账户角色
  */
-export function queryAccountRole(params: HttpParams<{ rsp: Model.UserRole[] }>) {
-    return httpRequest('/account/role', 'get', params);
+export function queryAccountRole() {
+    return httpRequest<Model.UserRole[]>('/account/role', 'get');
 }
 
 /**
  * 查询实名认证信息
  */
-export function queryWrDraftUserInfo(params: HttpParams<{ req: Model.WrDraftUserInfoReq, rsp: Model.UserInfo[] }>) {
-    return httpRequest('/WrTrade2/QueryWrDraftUserInfo', 'get', params);
+export function queryWrDraftUserInfo(params: Model.WrDraftUserInfoReq) {
+    return httpRequest<Model.UserInfo[]>('/WrTrade2/QueryWrDraftUserInfo', 'get', params);
 }
 
 /**
  * 实名认证请求
  */
-export function requestAddAuth(params: CommonParams<{ req: Model.AddAuthReq }>) {
+export function requestAddAuth(params: Model.AddAuthReq) {
     return commonRequest(getServiceUrl('openApiUrl') + '/onlineopen/userInfo/addAuth', 'post', params);
 }
 

+ 13 - 14
src/services/api/bank/index.ts

@@ -1,5 +1,4 @@
 import { httpRequest } from '@/services/http'
-import { HttpParams } from '@/services/http/interface'
 import { tradeServerRequest } from '@/services/socket/trade'
 import { TradeParams } from '@/services/socket/trade/interface'
 
@@ -13,7 +12,7 @@ export function accountFundInfoReq(params: TradeParams<Partial<Proto.AccountFund
 /**
  * 银行签约
  */
- export function t2bBankSign(params: TradeParams<Partial<Proto.t2bBankSignReq>, Proto.t2bBankSignRsp>) {
+export function t2bBankSign(params: TradeParams<Partial<Proto.t2bBankSignReq>, Proto.t2bBankSignRsp>) {
     return tradeServerRequest('t2bBankSignReq', 't2bBankSignRsp', params);
 }
 
@@ -41,42 +40,42 @@ export function t2bBankDeposit(params: TradeParams<Partial<Proto.t2bBankDepositR
 /**
  * 查询托管银行
  */
-export function queryCusBankSignBank(params: HttpParams<{ rsp: Model.CusBankSignBankRsp[] }>) {
-    return httpRequest('/Qhj/QueryCusBankSignBank', 'get', params);
+export function queryCusBankSignBank() {
+    return httpRequest<Model.CusBankSignBankRsp[]>('/Qhj/QueryCusBankSignBank', 'get');
 }
 
 /**
  * 查询开户行
  */
-export function queryBankInfo(params: HttpParams<{ rsp: Model.BankInfoRsp[] }>) {
-    return httpRequest('/Qhj/QueryBankInfo', 'get', params);
+export function queryBankInfo() {
+    return httpRequest<Model.BankInfoRsp[]>('/Qhj/QueryBankInfo', 'get');
 }
 
 /**
  * 查询签约银行信息(提现账户管理)
  */
-export function queryBankAccountSign(params: HttpParams<{ req: Model.BankAccountSignReq, rsp: Model.BankAccountSignRsp[] }>) {
-    return httpRequest('/Qhj/QueryBankAccountSign', 'get', params);
+export function queryBankAccountSign(params: Model.BankAccountSignReq) {
+    return httpRequest<Model.BankAccountSignRsp[]>('/Qhj/QueryBankAccountSign', 'get', params);
 }
 
 /**
  * 查询充值提现
  */
-export function queryAccountInOutApply(params: HttpParams<{ req: Model.AccountInOutApplyReq, rsp: Model.AccountOutInApplyRsp[] }>) {
-    return httpRequest('/Qhj/QueryAccountInOutApply', 'get', params);
+export function queryAccountInOutApply(params: Model.AccountInOutApplyReq) {
+    return httpRequest<Model.AccountOutInApplyRsp[]>('/Qhj/QueryAccountInOutApply', 'get', params);
 }
 
 /**
  * 资金流水查询(历史)
  */
-export function queryHisAmountLog(params: HttpParams<{ req: Model.HisAmountLogReq, rsp: Model.HisAmountLogRsp[] }>) {
-    return httpRequest('/TaAccount/QueryHisAmountLog', 'get', params);
+export function queryHisAmountLog(params: Model.HisAmountLogReq) {
+    return httpRequest<Model.HisAmountLogRsp[]>('/TaAccount/QueryHisAmountLog', 'get', params);
 }
 
 /**
  * 资金流水查询(当前)
  */
- export function queryAmountLog(params: HttpParams<{ req: Model.AmountLogReq, rsp: Model.AmountLogRsp[] }>) {
-    return httpRequest('/TaAccount/QueryAmountLog', 'get', params);
+export function queryAmountLog(params: Model.AmountLogReq) {
+    return httpRequest<Model.AmountLogRsp[]>('/TaAccount/QueryAmountLog', 'get', params);
 }
 

+ 38 - 39
src/services/api/common/index.ts

@@ -1,136 +1,135 @@
 import { httpRequest, commonRequest, getServiceUrl } from '@/services/http'
-import { CommonParams, HttpParams } from '@/services/http/interface'
 
 /**
  * 获取应用配置信息
  */
-// export function GetAppConfig(params: CommonParams<{ rsp: { version: string, versionCode: string, apiUrl: string } }>) {
-//     return commonRequest('./config/appconfig.json', 'get', params);
+// export function GetAppConfig() {
+//     return commonRequest<{ version: string, versionCode: string, apiUrl: string }>('./config/appconfig.json', 'get', params);
 // }
 
 /**
  * 获取应用更新信息(ios存在跨域问题)
  */
-export function GetAppUpdateInfo(params: CommonParams<{ rsp: string }>) {
-    return commonRequest(getServiceUrl('androidUpdateUrl'), 'get', params);
+export function GetAppUpdateInfo() {
+    return commonRequest<string>(getServiceUrl('androidUpdateUrl'), 'get');
 }
 
 /**
  * 用户注册
  */
-export function userRegister(params: CommonParams<{ req: Model.RegisterReq, rsp: Model.RegisterRsp }>) {
-    return commonRequest(getServiceUrl('openApiUrl') + '/onlineopen/userInfo/add3', 'post', params);
+export function userRegister(params: Model.RegisterReq) {
+    return commonRequest<Model.RegisterRsp>(getServiceUrl('openApiUrl') + '/onlineopen/userInfo/add3', 'post', params);
 }
 
 /**
  * 发送注册短信验证码
  */
-export function sendRegisterVerifyCode(params: CommonParams<{ req: string }>) {
-    return commonRequest(getServiceUrl('openApiUrl') + '/verifycode/identifyCode/', 'get', params);
+export function sendRegisterVerifyCode(params: { phonenumber: string }) {
+    return commonRequest(getServiceUrl('openApiUrl') + '/verifycode/identifyCode/' + params.phonenumber, 'get');
 }
 
 /**
  * 重置密码
  */
-export function resetPassword(params: CommonParams<{ req: Model.ResetPasswordReq, rsp: Model.ResetPasswordRsp }>) {
-    return commonRequest(getServiceUrl('commSearchUrl') + '/tradeoperation/resetpwdbycardnum', 'post', params);
+export function resetPassword(params: Model.ResetPasswordReq) {
+    return commonRequest<Model.ResetPasswordRsp>(getServiceUrl('commSearchUrl') + '/tradeoperation/resetpwdbycardnum', 'post', params);
 }
 
 /**
  * 发送重置密码短信验证码
  */
-export function sendResetVerifyCode(params: CommonParams<{ req: Model.SendResetVerifyCodeReq, rsp: Model.SendResetVerifyCodeRsp }>) {
-    return commonRequest(getServiceUrl('commSearchUrl') + '/user/smsvcode', 'post', params);
+export function sendResetVerifyCode(params: Model.SendResetVerifyCodeReq) {
+    return commonRequest<Model.SendResetVerifyCodeRsp>(getServiceUrl('commSearchUrl') + '/user/smsvcode', 'post', params);
 }
 
 /**
  * 文件上传
  */
-export function uploadFile(params: CommonParams<{ req: Model.uploadFileReq, rsp: Model.uploadFileRsp }>) {
-    return commonRequest(getServiceUrl('uploadUrl'), 'post', params);
+export function uploadFile(params: Model.uploadFileReq) {
+    return commonRequest<Model.uploadFileRsp>(getServiceUrl('uploadUrl'), 'post', params);
 }
 
 /**
  * 查询轮播图配置信息
  */
-export function queryImageConfigs(params: HttpParams<{ req: Model.ImageConfigsReq, rsp: Model.ImageConfigsRsp[] }>) {
-    return httpRequest('/Common/QueryImageConfigs', 'get', params);
+export function queryImageConfigs(params: Model.ImageConfigsReq) {
+    return httpRequest<Model.ImageConfigsRsp[]>('/Common/QueryImageConfigs', 'get', params);
 }
 
 /**
  * 查询所有枚举信息
  */
-export function queryAllEnums(params: HttpParams<{ req: Model.EnumReq, rsp: Model.EnumRsp[] }>) {
-    return httpRequest('/Common/GetAllEnums', 'get', params, 'GetAllEnums');
+export function queryAllEnums(params?: Model.EnumReq) {
+    return httpRequest<Model.EnumRsp[]>('/Common/GetAllEnums', 'get', params, 'GetAllEnums');
 }
 
 /**
  * 获取数据库错误信息
  */
-export function queryErrorInfos(params: HttpParams<{ req: Model.ErrorInfosReq, rsp: Model.ErrorInfosRsp[] }>) {
-    return httpRequest('/Common/QueryErrorInfos', 'get', params, 'QueryErrorInfos');
+export function queryErrorInfos(params?: Model.ErrorInfosReq) {
+    return httpRequest<Model.ErrorInfosRsp[]>('/Common/QueryErrorInfos', 'get', params, 'QueryErrorInfos');
 }
 
 /**
  * 用户签到
  * signinstatus 状态操作标志 1-签到成功 2-当日已签到,不能重复签到
  */
-export function signin(params: HttpParams<{ req: { userid: number }, rsp: { signinstatus: number } }>) {
-    return httpRequest('/Ferroalloy/Signin', 'post', params);
+export function signin(params: { userid: number }) {
+    return httpRequest<{ signinstatus: number }>('/Ferroalloy/Signin', 'post', params);
 }
 
 /**
  * 查询我的注册红包
  */
-export function queryMyRegisterMoney(params: HttpParams<{ req: Model.MyRegisterMoneyReq, rsp: Model.MyRegisterMoneyRsp[] }>) {
-    return httpRequest('/Ferroalloy/QueryMyRegisterMoney', 'get', params);
+export function queryMyRegisterMoney(params: Model.MyRegisterMoneyReq) {
+    return httpRequest<Model.MyRegisterMoneyRsp[]>('/Ferroalloy/QueryMyRegisterMoney', 'get', params);
 }
 
 /**
  * 查询用户等级信息
  */
-export function queryUserLevelInfo(params: HttpParams<{ req: Model.UserLevelInfoReq, rsp: Model.UserLevelInfoRsp }>) {
-    return httpRequest('/Ferroalloy/QueryUserLevelInfo', 'get', params);
+export function queryUserLevelInfo(params: Model.UserLevelInfoReq) {
+    return httpRequest<Model.UserLevelInfoRsp>('/Ferroalloy/QueryUserLevelInfo', 'get', params);
 }
 
 /**
  * 查询查询我推荐的好友等级
  */
-export function queryInvestorLevelGroup(params: HttpParams<{ rsp: Model.InvestorLevelGroupRsp[] }>) {
-    return httpRequest('/Ferroalloy/QueryInvestorLevelGroup', 'get', params);
+export function queryInvestorLevelGroup() {
+    return httpRequest<Model.InvestorLevelGroupRsp[]>('/Ferroalloy/QueryInvestorLevelGroup', 'get');
 }
 
 /**
  * 查询好友
  */
-export function queryTHJFriends(params: HttpParams<{ req: Model.THJFriendsReq, rsp: Model.THJFriendsRsp[] }>) {
-    return httpRequest('/Ferroalloy/QueryTHJFriends', 'get', params);
+export function queryTHJFriends(params: Model.THJFriendsReq) {
+    return httpRequest<Model.THJFriendsRsp[]>('/Ferroalloy/QueryTHJFriends', 'get', params);
 }
 
 /**
  * 查询收益
  */
-export function queryTHJProfits(params: HttpParams<{ req: Model.THJProfitsReq, rsp: Model.THJProfitsRsp[] }>) {
-    return httpRequest('/Ferroalloy/QueryTHJProfits', 'get', params);
+export function queryTHJProfits(params: Model.THJProfitsReq) {
+    return httpRequest<Model.THJProfitsRsp[]>('/Ferroalloy/QueryTHJProfits', 'get', params);
 }
 
 /**
  * 查询本人定金比例
  */
-export function queryMyDeposit(params: HttpParams<{ req: Partial<Model.MyDepositReq>, rsp: Model.MyDepositRsp[] }>) {
-    return httpRequest('/Ferroalloy/QueryMyDeposit', 'get', params);
+export function queryMyDeposit(params: Partial<Model.MyDepositReq>) {
+    return httpRequest<Model.MyDepositRsp[]>('/Ferroalloy/QueryMyDeposit', 'get', params);
 }
 
 /**
  * 定金比例个性化查询
  */
-export function queryTHJinvesotrdeposit(params: HttpParams<{ req: Partial<Model.THJinvesotrdepositReq>, rsp: Model.THJinvesotrdepositRsp[] }>) {
-    return httpRequest('/Ferroalloy/QueryTHJinvesotrdeposit', 'get', params);
+export function queryTHJinvesotrdeposit(params: Partial<Model.THJinvesotrdepositReq>) {
+    return httpRequest<Model.THJinvesotrdepositRsp[]>('/Ferroalloy/QueryTHJinvesotrdeposit', 'get', params);
 }
 
 /**
  * 比例变更流水查询
  */
-export function queryTHJInvesotrDepositLog(params: HttpParams<{ req: Partial<Model.THJInvesotrDepositLogReq>, rsp: Model.THJInvesotrDepositLogRsp[] }>) {
-    return httpRequest('/Ferroalloy/QueryTHJInvesotrDepositLog', 'get', params);
+export function queryTHJInvesotrDepositLog(params: Partial<Model.THJInvesotrDepositLogReq>) {
+    return httpRequest<Model.THJInvesotrDepositLogRsp[]>('/Ferroalloy/QueryTHJInvesotrDepositLog', 'get', params);
 }

+ 4 - 5
src/services/api/contract/index.ts

@@ -1,16 +1,15 @@
 import { httpRequest } from '@/services/http'
-import { HttpParams } from '@/services/http/interface'
 
 /**
  * 查询合同转让列表
  */
-export function queryTHJPurchaseTransfer(params: HttpParams<{ req: Model.THJPurchaseTransferReq, rsp: Model.THJPurchaseTransferRsp[] }>) {
-    return httpRequest('/Ferroalloy/QueryTHJPurchaseTransfer', 'get', params);
+export function queryTHJPurchaseTransfer(params: Model.THJPurchaseTransferReq) {
+    return httpRequest<Model.THJPurchaseTransferRsp[]>('/Ferroalloy/QueryTHJPurchaseTransfer', 'get', params);
 }
 
 /**
  * 查询合同转让详情
  */
-export function queryTHJPurchaseTransferDetail(params: HttpParams<{ req: Model.THJPurchaseTransferDetailReq, rsp: Model.THJPurchaseTransferDetailRsp }>) {
-    return httpRequest('/Ferroalloy/QueryTHJPurchaseTransferDetail', 'get', params);
+export function queryTHJPurchaseTransferDetail(params: Model.THJPurchaseTransferDetailReq) {
+    return httpRequest<Model.THJPurchaseTransferDetailRsp>('/Ferroalloy/QueryTHJPurchaseTransferDetail', 'get', params);
 }

+ 4 - 5
src/services/api/credit/index.ts

@@ -1,21 +1,20 @@
 import { Market } from '@/constants/market'
 import { httpRequest } from '@/services/http'
-import { HttpParams } from '@/services/http/interface'
 import { tradeServerRequest } from '@/services/socket/trade'
 import { TradeParams } from '@/services/socket/trade/interface'
 
 /**
  * 查询我的积分流水
  */
-export function queryUserScoreLog(params: HttpParams<{ req: Model.UserScoreLogReq, rsp: Model.UserScoreLogRsp[] }>) {
-    return httpRequest('/Ferroalloy/QueryUserScoreLog', 'get', params);
+export function queryUserScoreLog(params: Model.UserScoreLogReq) {
+    return httpRequest<Model.UserScoreLogRsp[]>('/Ferroalloy/QueryUserScoreLog', 'get', params);
 }
 
 /**
  * 查询积分配置
  */
-export function queryTHJScoreConfig(params: HttpParams<{ req: Model.THJScoreConfigReq, rsp: Model.THJScoreConfigRsp[] }>) {
-    return httpRequest('/Ferroalloy/QueryTHJScoreConfig', 'get', params);
+export function queryTHJScoreConfig(params?: Model.THJScoreConfigReq) {
+    return httpRequest<Model.THJScoreConfigRsp[]>('/Ferroalloy/QueryTHJScoreConfig', 'get', params);
 }
 
 /**

+ 26 - 34
src/services/api/goods/index.ts

@@ -1,100 +1,92 @@
 import { httpRequest } from '@/services/http'
-import { HttpParams } from '@/services/http/interface'
-
-/**
- * 商品列表
- */
-export function queryGoodsList(params: HttpParams<{ rsp: Model.GoodsRsp[] }>) {
-    return httpRequest('/goods', 'get', params);
-}
 
 /**
  * 查询企业风管期货商品信息
  */
-export function queryErmcpGoods(params: HttpParams<{ req: Model.GoodsReq, rsp: Model.GoodsRsp[] }>) {
-    return httpRequest('/Ermcp/GetErmcpGoods', 'get', params, 'GetErmcpGoods');
+export function queryErmcpGoods(params?: Model.GoodsReq) {
+    return httpRequest<Model.GoodsRsp[]>('/Ermcp/GetErmcpGoods', 'get', params, 'GetErmcpGoods');
 }
 
 /**
  * 获取商品盘面信息
  */
-export function queryQuoteDay(params: HttpParams<{ req: Model.QuoteDayReq, rsp: Model.QuoteDayRsp[] }>) {
-    return httpRequest('/Quote/QueryQuoteDay', 'get', params, 'QueryQuoteDay');
+export function queryQuoteDay(params: Model.QuoteDayReq) {
+    return httpRequest<Model.QuoteDayRsp[]>('/Quote/QueryQuoteDay', 'get', params, 'QueryQuoteDay');
 }
 
 /**
  * 查询采购列表
  */
-export function queryTHJWrstandard(params: HttpParams<{ req: Model.THJWrstandardReq, rsp: Model.THJWrstandardRsp[] }>) {
-    return httpRequest('/Ferroalloy/QueryTHJWrstandard', 'get', params);
+export function queryTHJWrstandard(params: Model.THJWrstandardReq) {
+    return httpRequest<Model.THJWrstandardRsp[]>('/Ferroalloy/QueryTHJWrstandard', 'get', params);
 }
 
 /**
  * 查询采购详情
  */
-export function queryTHJWrstandardDetail(params: HttpParams<{ req: Model.THJWrstandardDetailReq, rsp: Model.THJWrstandardDetailRsp }>) {
-    return httpRequest('/Ferroalloy/QueryTHJWrstandardDetail', 'get', params);
+export function queryTHJWrstandardDetail(params: Model.THJWrstandardDetailReq) {
+    return httpRequest<Model.THJWrstandardDetailRsp>('/Ferroalloy/QueryTHJWrstandardDetail', 'get', params);
 }
 
 /**
  * 查询供求列表
  */
-export function queryTHJListing(params: HttpParams<{ req: Model.THJListingReq, rsp: Model.THJListingRsp[] }>) {
-    return httpRequest('/Ferroalloy/QueryTHJListing', 'get', params);
+export function queryTHJListing(params: Model.THJListingReq) {
+    return httpRequest<Model.THJListingRsp[]>('/Ferroalloy/QueryTHJListing', 'get', params);
 }
 
 /**
  * 查询大厅行情列表
  */
-export function queryOrderQuote(params: HttpParams<{ req: Model.OrderQuoteReq, rsp: Model.OrderQuoteRsp[] }>) {
-    return httpRequest('/WrTrade2/QueryOrderQuote', 'get', params);
+export function queryOrderQuote(params: Model.OrderQuoteReq) {
+    return httpRequest<Model.OrderQuoteRsp[]>('/WrTrade2/QueryOrderQuote', 'get', params);
 }
 
 /**
  * 查询买卖大厅
  */
-export function queryOrderQuoteDetail(params: HttpParams<{ req: Model.OrderQuoteDetailReq, rsp: Model.OrderQuoteDetailRsp[] }>) {
-    return httpRequest('/WrTrade2/QueryOrderQuoteDetail', 'get', params);
+export function queryOrderQuoteDetail(params: Model.OrderQuoteDetailReq) {
+    return httpRequest<Model.OrderQuoteDetailRsp[]>('/WrTrade2/QueryOrderQuoteDetail', 'get', params);
 }
 
 /**
  * 移除用户商品收藏信息
  */
-export function removeUserFavoriteGoods(params: HttpParams<{ req: Model.UserFavoriteGoodsReq, rsp: Model.UserFavoriteGoodsRsp }>) {
-    return httpRequest('/User/RemoveUserFavoriteGoods', 'post', params);
+export function removeUserFavoriteGoods(params: Model.UserFavoriteGoodsReq) {
+    return httpRequest<Model.UserFavoriteGoodsRsp>('/User/RemoveUserFavoriteGoods', 'post', params);
 }
 
 /**
  * 添加用户商品收藏信息
  */
-export function addUserFavoriteGoods(params: HttpParams<{ req: Model.UserFavoriteGoodsReq, rsp: Model.UserFavoriteGoodsRsp }>) {
-    return httpRequest('/User/AddUserFavoriteGoods', 'post', params);
+export function addUserFavoriteGoods(params: Model.UserFavoriteGoodsReq) {
+    return httpRequest<Model.UserFavoriteGoodsRsp>('/User/AddUserFavoriteGoods', 'post', params);
 }
 
 /**
  * 获取我的推广-交易数据
  */
-export function queryTHJTradeData(params: HttpParams<{ req: Model.THJTradeDataReq, rsp: Model.THJTradeDataRsp[] }>) {
-    return httpRequest('/Ferroalloy/QueryTHJTradeData', 'get', params);
+export function queryTHJTradeData(params: Model.THJTradeDataReq) {
+    return httpRequest<Model.THJTradeDataRsp[]>('/Ferroalloy/QueryTHJTradeData', 'get', params);
 }
 
 /**
  * 获取产品介绍列表
  */
-export function queryTHJProduct(params: HttpParams<{ req: Model.THJProductReq, rsp: Model.THJProductRsp[] }>) {
-    return httpRequest('/Ferroalloy/QueryTHJProduct', 'get', params);
+export function queryTHJProduct(params: Model.THJProductReq) {
+    return httpRequest<Model.THJProductRsp[]>('/Ferroalloy/QueryTHJProduct', 'get', params);
 }
 
 /**
  * 查询市场运行信息
  */
-export function queryMarketRun(params: HttpParams<{ req: Model.MarketRunReq, rsp: Model.MarketRunRsp[] }>) {
-    return httpRequest('/Market/QueryMarketRun', 'get', params);
+export function queryMarketRun(params?: Model.MarketRunReq) {
+    return httpRequest<Model.MarketRunRsp[]>('/Market/QueryMarketRun', 'get', params);
 }
 
 /**
  * 查询市场交易参数配置
  */
-export function queryWrMarketTradeConfig(params: HttpParams<{ req: Model.WrMarketTradeConfigReq, rsp: Model.WrMarketTradeConfigRsp[] }>) {
-    return httpRequest('/WrTrade2/QueryWrMarketTradeConfig', 'get', params);
+export function queryWrMarketTradeConfig(params: Model.WrMarketTradeConfigReq) {
+    return httpRequest<Model.WrMarketTradeConfigRsp[]>('/WrTrade2/QueryWrMarketTradeConfig', 'get', params);
 }

+ 6 - 7
src/services/api/market/index.ts

@@ -1,23 +1,22 @@
 import { httpRequest } from '@/services/http'
-import { HttpParams } from '@/services/http/interface'
 
 /**
  * 获取现货行情
  */
-export function querySpotGoodsPrice(params: HttpParams<{ req: Model.SpotGoodsPriceReq, rsp: Model.SpotGoodsPriceRsp[] }>) {
-    return httpRequest('/Ferroalloy/GetSpotGoodsPrice', 'get', params);
+export function querySpotGoodsPrice(params: Model.SpotGoodsPriceReq) {
+    return httpRequest<Model.SpotGoodsPriceRsp[]>('/Ferroalloy/GetSpotGoodsPrice', 'get', params);
 }
 
 /**
  * 查询行情-现货列表
  */
-export function querySpotgoodsPrice(params: HttpParams<{ req: Model.SpotgoodsPriceReq, rsp: Model.SpotgoodsPriceRsp[] }>) {
-    return httpRequest('/Ferroalloy/QuerySpotgoodsPrice', 'get', params);
+export function querySpotgoodsPrice(params?: Model.SpotgoodsPriceReq) {
+    return httpRequest<Model.SpotgoodsPriceRsp[]>('/Ferroalloy/QuerySpotgoodsPrice', 'get', params);
 }
 
 /**
  * 查询现货行情配置表
  */
-export function queryThjSpotQuoteConfig(params: HttpParams<{ rsp: Model.ThjSpotQuoteConfigRsp[] }>) {
-    return httpRequest('/Ferroalloy/QueryThjSpotQuoteConfig', 'get', params);
+export function queryThjSpotQuoteConfig() {
+    return httpRequest<Model.ThjSpotQuoteConfigRsp[]>('/Ferroalloy/QueryThjSpotQuoteConfig', 'get');
 }

+ 4 - 5
src/services/api/news/index.ts

@@ -1,16 +1,15 @@
 import { httpRequest } from '@/services/http'
-import { HttpParams } from '@/services/http/interface'
 
 /**
  * 查询资讯
  */
-export function querySiteColumnDetail(params: HttpParams<{ req: Model.SiteColumnDetailReq, rsp: Model.SiteColumnDetailRsp[] }>) {
-    return httpRequest('/WrTrade2/QuerySiteColumnDetail', 'get', params);
+export function querySiteColumnDetail(params: Model.SiteColumnDetailReq) {
+    return httpRequest<Model.SiteColumnDetailRsp[]>('/WrTrade2/QuerySiteColumnDetail', 'get', params);
 }
 
 /**
  * 查询资讯栏目配置
  */
-export function querySiteColumnConfig(params: HttpParams<{ req: Model.SiteColumnConfigReq, rsp: Model.SiteColumnConfigRsp[] }>) {
-    return httpRequest('/WrTrade2/QuerySiteColumnConfig', 'get', params);
+export function querySiteColumnConfig(params?: Model.SiteColumnConfigReq) {
+    return httpRequest<Model.SiteColumnConfigRsp[]>('/WrTrade2/QuerySiteColumnConfig', 'get', params);
 }

+ 18 - 19
src/services/api/order/index.ts

@@ -1,65 +1,64 @@
 import { httpRequest } from '@/services/http'
-import { HttpParams } from '@/services/http/interface'
 
 /**
  * 查询仓单成交明细
  */
-export function queryWrTradeDetail(params: HttpParams<{ req: Partial<Model.WrTradeDetailReq>, rsp: Model.WrTradeDetailRsp[] }>) {
-    return httpRequest('/WrTrade2/QueryWrTradeDetail', 'get', params);
+export function queryWrTradeDetail(params: Partial<Model.WrTradeDetailReq>) {
+    return httpRequest<Model.WrTradeDetailRsp[]>('/WrTrade2/QueryWrTradeDetail', 'get', params);
 }
 
 /**
  * 查询仓单委托单
  */
-export function queryWrOrderDetail(params: HttpParams<{ req: Partial<Model.WrOrderDetailReq>, rsp: Model.WrOrderDetailRsp[] }>) {
-    return httpRequest('/WrTrade2/QueryWrOrderDetail', 'get', params);
+export function queryWrOrderDetail(params: Partial<Model.WrOrderDetailReq>) {
+    return httpRequest<Model.WrOrderDetailRsp[]>('/WrTrade2/QueryWrOrderDetail', 'get', params);
 }
 
 /**
  * 查询我的订单-采购订单
  */
-export function queryTHJPurchaseTradeDetail(params: HttpParams<{ req: Model.THJPurchaseTradeDetailReq, rsp: Model.THJPurchaseTradeDetailRsp[] }>) {
-    return httpRequest('/Ferroalloy/QueryTHJPurchaseTradeDetail', 'get', params);
+export function queryTHJPurchaseTradeDetail(params: Model.THJPurchaseTradeDetailReq) {
+    return httpRequest<Model.THJPurchaseTradeDetailRsp[]>('/Ferroalloy/QueryTHJPurchaseTradeDetail', 'get', params);
 }
 
 /**
  * 查询仓单持有记录
  */
-export function queryHoldLB(params: HttpParams<{ req: Model.HoldLBReq, rsp: Model.HoldLBRsp[] }>) {
-    return httpRequest('/WrTrade2/QueryHoldLB', 'get', params);
+export function queryHoldLB(params: Model.HoldLBReq) {
+    return httpRequest<Model.HoldLBRsp[]>('/WrTrade2/QueryHoldLB', 'get', params);
 }
 
 /**
  * 查询提货申请
  */
-export function queryWrOutInApply(params: HttpParams<{ req: Model.WrOutInApplyReq, rsp: Model.WrOutInApplyRsp[] }>) {
-    return httpRequest('/WrTrade2/QueryWrOutInApply', 'get', params);
+export function queryWrOutInApply(params: Model.WrOutInApplyReq) {
+    return httpRequest<Model.WrOutInApplyRsp[]>('/WrTrade2/QueryWrOutInApply', 'get', params);
 }
 
 /**
  * 查询我的推广-推广收益
  */
-export function queryTHJPromotionIncome(params: HttpParams<{ req: Model.THJPromotionIncomeReq, rsp: Model.THJPromotionIncomeRsp[] }>) {
-    return httpRequest('/Ferroalloy/QueryTHJPromotionIncome', 'get', params);
+export function queryTHJPromotionIncome(params: Model.THJPromotionIncomeReq) {
+    return httpRequest<Model.THJPromotionIncomeRsp[]>('/Ferroalloy/QueryTHJPromotionIncome', 'get', params);
 }
 
 /**
  * 查询我的推广-推广收益-明细
  */
-export function queryTHJPromotionIncomeDetail(params: HttpParams<{ req: Model.THJPromotionIncomeDetailReq, rsp: Model.THJPromotionIncomeDetailRsp[] }>) {
-    return httpRequest('/Ferroalloy/QueryTHJPromotionIncomeDetail', 'get', params);
+export function queryTHJPromotionIncomeDetail(params: Model.THJPromotionIncomeDetailReq) {
+    return httpRequest<Model.THJPromotionIncomeDetailRsp[]>('/Ferroalloy/QueryTHJPromotionIncomeDetail', 'get', params);
 }
 
 /**
  * 查询我的订单-转让/受让订单
  */
-export function queryTHJPurchaseTransferOrder(params: HttpParams<{ req: Model.THJPurchaseTransferOrderReq, rsp: Model.THJPurchaseTransferOrderRsp[] }>) {
-    return httpRequest('/Ferroalloy/QueryTHJPurchaseTransferOrder', 'get', params);
+export function queryTHJPurchaseTransferOrder(params: Model.THJPurchaseTransferOrderReq) {
+    return httpRequest<Model.THJPurchaseTransferOrderRsp[]>('/Ferroalloy/QueryTHJPurchaseTransferOrder', 'get', params);
 }
 
 /**
  * 查询我的订单-转让/受让订单-详情
  */
-export function queryTHJPurchaseTransferOrderDetail(params: HttpParams<{ req: Model.THJPurchaseTransferOrderDetailReq, rsp: Model.THJPurchaseTransferOrderDetailRsp[] }>) {
-    return httpRequest('/Ferroalloy/QueryTHJPurchaseTransferOrderDetail', 'get', params);
+export function queryTHJPurchaseTransferOrderDetail(params: Model.THJPurchaseTransferOrderDetailReq) {
+    return httpRequest<Model.THJPurchaseTransferOrderDetailRsp[]>('/Ferroalloy/QueryTHJPurchaseTransferOrderDetail', 'get', params);
 }

+ 6 - 7
src/services/api/quote/index.ts

@@ -1,23 +1,22 @@
 import { httpRequest } from '@/services/http'
-import { HttpParams } from '@/services/http/interface'
 
 /**
  * 查询行情历史数据
  */
-export function queryHistoryDatas(params: HttpParams<{ req: { goodscode?: string }, rsp: Model.QueryHistoryDatasRsp[] }>) {
-    return httpRequest('/Quote/QueryHistoryDatas', 'get', params);
+export function queryHistoryDatas(params: { goodscode?: string }) {
+    return httpRequest<Model.QueryHistoryDatasRsp[]>('/Quote/QueryHistoryDatas', 'get', params);
 }
 
 /**
  * 分时图数据查询
  */
-export function queryTSData(params: HttpParams<{ req: { goodscode?: string }, rsp: Model.QueryTSDataRsp }>) {
-    return httpRequest('/Quote/QueryTSData', 'get', params);
+export function queryTSData(params: { goodscode?: string }) {
+    return httpRequest<Model.QueryTSDataRsp>('/Quote/QueryTSData', 'get', params);
 }
 
 /**
  * 查询行情Tik数据
  */
-export function queryHistoryTikDatas(params: HttpParams<{ req: Model.HistoryTikDatasReq, rsp: Model.HistoryTikDatasRsp[] }>) {
-    return httpRequest('/Quote/QueryHistoryTikDatas', 'get', params);
+export function queryHistoryTikDatas(params: Model.HistoryTikDatasReq) {
+    return httpRequest<Model.HistoryTikDatasRsp[]>('/Quote/QueryHistoryTikDatas', 'get', params);
 }

+ 5 - 6
src/services/api/user/index.ts

@@ -1,20 +1,19 @@
 import { httpRequest } from '@/services/http'
-import { HttpParams } from '@/services/http/interface'
 import { tradeServerRequest } from '@/services/socket/trade'
 import { TradeParams } from '@/services/socket/trade/interface'
 
 /**
  * 查询收货地址信息
  */
-export function queryUserReceiveInfo(params: HttpParams<{ req: Model.UserReceiveInfoReq, rsp: Model.UserReceiveInfoRsp[] }>) {
-    return httpRequest('/Qhj/QueryUserReceiveInfo', 'get', params);
+export function queryUserReceiveInfo(params: Model.UserReceiveInfoReq) {
+    return httpRequest<Model.UserReceiveInfoRsp[]>('/Qhj/QueryUserReceiveInfo', 'get', params);
 }
 
 /**
  * 查询发票信息
  */
-export function queryWrUserReceiptInfo(params: HttpParams<{ req: Model.WrUserReceiptInfoReq, rsp: Model.WrUserReceiptInfoRsp[] }>) {
-    return httpRequest('/WrTrade2/QueryWrUserReceiptInfo', 'get', params);
+export function queryWrUserReceiptInfo(params: Model.WrUserReceiptInfoReq) {
+    return httpRequest<Model.WrUserReceiptInfoRsp[]>('/WrTrade2/QueryWrUserReceiptInfo', 'get', params);
 }
 
 /**
@@ -62,6 +61,6 @@ export function dealerHead(params: TradeParams<Proto.DealerHeadReq, Proto.Dealer
 /**
  * 更新用户头像
  */
-export function updateUserHeadUrl(params: HttpParams<{ req: Model.UserHeadUrlReq }>) {
+export function updateUserHeadUrl(params: Model.UserHeadUrlReq) {
     return httpRequest('/User/UpdateUserHeadUrl', 'post', params);
 }

+ 95 - 106
src/services/http/index.ts

@@ -2,125 +2,114 @@ import axios, { AxiosRequestConfig, Method } from 'axios'
 //import qs from 'qs'
 //import cryptojs from 'crypto-js'
 //import { addPending, removePending } from './pending'
-import { loginStore } from '@/stores'
-import { HttpParams, CommonParams, HttpResponse, Payload, ResultCode } from './interface'
 import service from '@/services'
+import { loginStore } from '@/stores'
+import { CommonResult, ResultCode } from './interface'
 
-const httpService = new (class {
-    private axiosInstance = axios.create({
-        timeout: 30000,
-    })
+const axiosInstance = axios.create({
+    timeout: 30000,
+})
 
-    constructor() {
-        // 请求拦截器
-        this.axiosInstance.interceptors.request.use(
-            (config) => {
-                //addPending(config) //将当前请求添加到列表中
-                //请求头签名
-                const sign = {
-                    token: loginStore.getters.token,
-                    signsecret: 'qz7qWOMXKTMT5JlDs5w4NTPwWeR3xhF1v6wqbZ9cExmP6cc3spvNAp1wJJ1SqRI5',
-                    timestamp: new Date().getTime(),
-                }
-                //设置请求头
-                config.headers = {
-                    Authorization: sign.token,
-                    //Signid: 'eecd3f37625f4501b88e9f0fa14b4b51',
-                    //Sign: cryptojs.SHA256(qs.stringify(sign)).toString(),
-                    //Timestamp: sign.timestamp.toString(),
-                }
-                return config
-            },
-            (err) => {
-                console.error(err)
-                return Promise.reject('出现错误,请稍后再试')
-            }
-        )
-        // 响应拦截器
-        this.axiosInstance.interceptors.response.use(
-            (res) => {
-                //removePending(res) //在请求结束后,移除本次请求
-                return res
-            },
-            (err) => {
-                if (err.message === 'Network Error') {
-                    return Promise.reject('无网络连接,请检查网络')
-                }
-                if (err.response) {
-                    const { msg, message } = err.response.data ?? {}
-                    switch (err.response.status) {
-                        case 408: {
-                            return Promise.reject('请求超时,请稍后再试')
-                        }
-                        default: {
-                            return Promise.reject(msg || message)
-                        }
-                    }
-                }
-                return Promise.reject('出现错误,请稍后再试')
-            }
-        )
+// 请求拦截器
+axiosInstance.interceptors.request.use(
+    (config) => {
+        //addPending(config) //将当前请求添加到列表中
+        //请求头签名
+        const sign = {
+            token: loginStore.getters.token,
+            signsecret: 'qz7qWOMXKTMT5JlDs5w4NTPwWeR3xhF1v6wqbZ9cExmP6cc3spvNAp1wJJ1SqRI5',
+            timestamp: new Date().getTime(),
+        }
+        //设置请求头
+        config.headers = {
+            Authorization: sign.token,
+            //Signid: 'eecd3f37625f4501b88e9f0fa14b4b51',
+            //Sign: cryptojs.SHA256(qs.stringify(sign)).toString(),
+            //Timestamp: sign.timestamp.toString(),
+        }
+        return config
+    },
+    (err) => {
+        console.error(err)
+        return Promise.reject('出现错误,请稍后再试')
     }
+)
 
-    private request = async (url: string, method: Method, payload?: unknown) => {
-        const config = await service.onReady()
-        this.axiosInstance.defaults.baseURL = config.goCommonSearchUrl
-        const requestConfig: AxiosRequestConfig = {
-            url,
-            method,
+// 响应拦截器
+axiosInstance.interceptors.response.use(
+    (res) => {
+        //removePending(res) //在请求结束后,移除本次请求
+        return res
+    },
+    (err) => {
+        if (err.message === 'Network Error') {
+            return Promise.reject('无网络连接,请检查网络')
         }
-        if (payload instanceof Object) {
-            if (['post', 'POST', 'put', 'PUT', 'patch', 'PATCH'].includes(method)) {
-                requestConfig.data = payload
-            } else {
-                requestConfig.params = payload
+        if (err.response) {
+            const { msg, message } = err.response.data ?? {}
+            switch (err.response.status) {
+                case 408: {
+                    return Promise.reject('请求超时,请稍后再试')
+                }
+                default: {
+                    return Promise.reject(msg || message)
+                }
             }
-        } else {
-            requestConfig.url = url + (payload ?? '')
         }
-        return this.axiosInstance(requestConfig)
+        return Promise.reject('出现错误,请稍后再试')
     }
+)
 
-    commonRequest = async <T extends Payload>(url: string, method: Method, params: CommonParams<T>, errMsg?: string) => {
-        const { data, success, fail, complete } = params
-        return await this.request(url, method, data).then((res) => {
-            const data = res.data as T['rsp']
-            success && success(data)
-            return Promise.resolve(data)
-        }).catch((err) => {
-            const msg = err ?? (errMsg ? '请求失败: ' + errMsg : '请求失败,请稍后重试')
-            fail && fail(msg)
-            return Promise.reject(msg)
-        }).finally(() => {
-            complete && complete()
-        })
+/**
+ * Http 通用请求
+ * @param url 
+ * @param method 
+ * @param payload 
+ * @param errMsg 
+ * @returns 
+ */
+export async function commonRequest<T>(url: string, method: Method, payload?: unknown, errMsg?: string) {
+    await service.onReady().then((config) => {
+        axiosInstance.defaults.baseURL = config.goCommonSearchUrl
+    })
+    const config: AxiosRequestConfig = {
+        url,
+        method,
     }
-
-    httpRequest = async <T extends Payload>(url: string, method: Method, params: HttpParams<T>, errMsg?: string) => {
-        const { data, success, fail, complete } = params
-        return await this.request(url, method, data).then((res) => {
-            const data = res.data as HttpResponse<T['rsp']>
-            switch (data.code) {
-                case ResultCode.InvalidToken:
-                    return Promise.reject('令牌无效')
-                case ResultCode.Success:
-                    success && success(data)
-                    return Promise.resolve(data)
-                default:
-                    fail && fail(data.msg)
-                    return Promise.reject(data.msg)
-            }
-        }).catch((err) => {
-            const msg = err ?? (errMsg ? '请求失败: ' + errMsg : '请求失败,请稍后重试')
-            fail && fail(msg)
-            return Promise.reject(msg)
-        }).finally(() => {
-            complete && complete()
-        })
+    if (payload instanceof Object) {
+        if (['post', 'POST', 'put', 'PUT', 'patch', 'PATCH'].includes(method)) {
+            config.data = payload
+        } else {
+            config.params = payload
+        }
     }
-})
+    return await axiosInstance(config).then((res) => {
+        return res.data as T
+    }).catch((err) => {
+        const msg = err ?? (errMsg ? '请求失败: ' + errMsg : '请求失败,请稍后重试')
+        return Promise.reject(msg)
+    })
+}
 
-export const { commonRequest, httpRequest } = httpService
+/**
+ * Http 请求
+ * @param url 
+ * @param method 
+ * @param payload 
+ * @param errMsg 
+ * @returns 
+ */
+export async function httpRequest<T>(url: string, method: Method, payload?: unknown, errMsg?: string) {
+    const res = await commonRequest<CommonResult<T>>(url, method, payload, errMsg)
+    switch (res.code) {
+        case ResultCode.InvalidToken:
+            return Promise.reject('令牌无效')
+        case ResultCode.Success:
+            return res
+        default:
+            return Promise.reject(res.msg)
+    }
+}
 
 /**
  * 获取服务配置地址

+ 0 - 254
src/services/http/index@next.ts

@@ -1,254 +0,0 @@
-import { ref, onUnmounted } from 'vue'
-import axios, { AxiosRequestConfig, Method } from 'axios'
-//import qs from 'qs'
-//import cryptojs from 'crypto-js'
-//import { addPending, removePending } from './pending'
-import { loginStore } from '@/stores'
-import { useDataTable } from '@/hooks/datatable'
-import service from '@/services'
-
-/**
- * Http 通用响应对象
- */
-export interface CommonResult<T = unknown> {
-    code: ResultCode;
-    msg: string;
-    total: number;
-    data: T;
-}
-
-/**
- * Http 响应结果状态码
- */
-export enum ResultCode {
-    Success = 200, //成功
-    Error = 101, //发生错误
-    Fail = 102, //失败
-    Warning = 103, //非法请求
-    Unauthorized = 201, //授权失败
-    ParameterError = 202, //参数错误
-    InvalidToken = 203, //令牌无效
-    InvalidSign = 204, //签名无效
-}
-
-const httpService = new (class {
-    private axiosInstance = axios.create({
-        timeout: 30000,
-    })
-
-    constructor() {
-        // 请求拦截器
-        this.axiosInstance.interceptors.request.use(
-            (config) => {
-                //addPending(config) //将当前请求添加到列表中
-                //请求头签名
-                const sign = {
-                    token: loginStore.getters.token,
-                    signsecret: 'qz7qWOMXKTMT5JlDs5w4NTPwWeR3xhF1v6wqbZ9cExmP6cc3spvNAp1wJJ1SqRI5',
-                    timestamp: new Date().getTime(),
-                }
-                //设置请求头
-                config.headers = {
-                    Authorization: sign.token,
-                    //Signid: 'eecd3f37625f4501b88e9f0fa14b4b51',
-                    //Sign: cryptojs.SHA256(qs.stringify(sign)).toString(),
-                    //Timestamp: sign.timestamp.toString(),
-                }
-                return config
-            },
-            (err) => {
-                console.error(err)
-                return Promise.reject('出现错误,请稍后再试')
-            }
-        )
-        // 响应拦截器
-        this.axiosInstance.interceptors.response.use(
-            (res) => {
-                //removePending(res) //在请求结束后,移除本次请求
-                return res
-            },
-            (err) => {
-                if (err.message === 'Network Error') {
-                    return Promise.reject('无网络连接,请检查网络')
-                }
-                if (err.response) {
-                    const { msg, message } = err.response.data ?? {}
-                    switch (err.response.status) {
-                        case 408: {
-                            return Promise.reject('请求超时,请稍后再试')
-                        }
-                        default: {
-                            return Promise.reject(msg || message)
-                        }
-                    }
-                }
-                return Promise.reject('出现错误,请稍后再试')
-            }
-        )
-    }
-
-    commonRequest = async <T>(url: string, method: Method, payload?: unknown, errMsg?: string) => {
-        await service.onReady().then((config) => {
-            this.axiosInstance.defaults.baseURL = config.goCommonSearchUrl
-        })
-
-        const config: AxiosRequestConfig = {
-            url,
-            method,
-        }
-
-        if (payload instanceof Object) {
-            if (['post', 'POST', 'put', 'PUT', 'patch', 'PATCH'].includes(method)) {
-                config.data = payload
-            } else {
-                config.params = payload
-            }
-        }
-
-        return await this.axiosInstance(config).then((res) => {
-            return res.data as T
-        }).catch((err) => {
-            const msg = err ?? (errMsg ? '请求失败: ' + errMsg : '请求失败,请稍后重试')
-            return Promise.reject(msg)
-        })
-    }
-
-    httpRequest = async <T>(url: string, method: Method, payload?: unknown, errMsg?: string) => {
-        const res = await this.commonRequest<CommonResult<T>>(url, method, payload, errMsg)
-
-        switch (res.code) {
-            case ResultCode.InvalidToken:
-                return Promise.reject('令牌无效')
-            case ResultCode.Success:
-                return res
-            default:
-                return Promise.reject(res.msg)
-        }
-    }
-})
-
-export const { commonRequest, httpRequest } = httpService
-
-
-function queryLoginData(params: Model.LoginQueryReq) {
-    return httpRequest<Model.LoginQueryRsp[]>('/User/LoginQuery', 'get', params, 'LoginQuery')
-}
-
-interface RequestOptions<TParams, TResponse> {
-    params?: {
-        page?: number; // 当前页码
-        pagesize?: number; // 每页条数
-    } & TParams;
-    localPagination?: boolean;
-    delay?: number;
-    onSuccess?: (res: TResponse) => void;
-    onError?: (err: string) => void;
-    onFinally?: () => void;
-}
-
-function useRequest<TParams extends object, TResponse>(request: (params: TParams) => Promise<TResponse>, options?: RequestOptions<TParams, TResponse>) {
-    const { params, localPagination, onSuccess, onError, onFinally } = options ?? {}
-
-    type Result = TResponse extends CommonResult ? TResponse['data'] : TResponse // 获取返回值的类型
-    type ResultType = Result extends (infer U)[] ? U : Result // 如果 U 是数组,取 U 的类型
-
-    const { dataList, filters, total, pageIndex, pageSize, pageCount } = useDataTable<ResultType>({
-        pagination: localPagination,
-        pageSize: params?.page,
-        pageIndex: params?.pagesize,
-    })
-    const data = ref<ResultType>()
-    const loading = ref(false)
-
-    // 判断对象是否通用响应对象
-    const isCommonResult = (obj: unknown): obj is CommonResult => {
-        if (obj instanceof Object) {
-            return 'code' in obj && 'data' in obj
-        }
-        return false
-    }
-
-    // 异步函数
-    const runAsync = async (payload: Partial<TParams> = {}) => {
-        try {
-            loading.value = true
-            if (params && params.page && params.pagesize) {
-                params.page = pageIndex.value
-                params.pagesize = pageIndex.value
-            }
-
-            const res = await request({ ...params, ...payload } as TParams)
-
-            if (isCommonResult(res)) {
-                total.value = res.total
-                if (Array.isArray(res.data)) {
-                    dataList.value = res.data
-                } else {
-                    data.value = res.data as ResultType
-                }
-            } else {
-                if (Array.isArray(res)) {
-                    dataList.value = res
-                } else {
-                    data.value = res as ResultType
-                }
-            }
-
-            return res
-        } finally {
-            loading.value = false
-        }
-    }
-
-    // 同步函数
-    const run = (payload: Partial<TParams> = {}) => {
-        runAsync(payload).then((res) => {
-            onSuccess && onSuccess(res)
-        }).catch((err) => {
-            onError && onError(err)
-        }).finally(() => {
-            onFinally && onFinally()
-        })
-    }
-
-    const cancel = () => {
-        console.log('取消请求')
-    }
-
-    onUnmounted(() => {
-        cancel()
-    })
-
-    return {
-        loading,
-        data,
-        dataList,
-        total,
-        pageIndex,
-        pageSize,
-        pageCount,
-        filters,
-        runAsync,
-        run,
-        cancel,
-    }
-}
-
-const { run, data, dataList } = useRequest(queryLoginData, {
-    params: {
-        loginID: 0,
-    },
-    onSuccess: (res) => {
-        console.log(res)
-        dataList.value = res.data
-    },
-})
-
-/**
- * 获取服务配置地址
- * @param key 
- * @returns 
- */
-export function getServiceUrl(key: keyof typeof service.config) {
-    return service.config[key]
-}

+ 3 - 28
src/services/http/interface.ts

@@ -1,32 +1,7 @@
-export type Payload<T = unknown, R = unknown> = {
-    req?: T,
-    rsp?: R
-}
-
-/**
- * 请求参数
- */
-export interface RequestParams<T, R> {
-    data?: T;
-    success?: (res: R) => void;
-    fail?: (err: string) => void;
-    complete?: () => void;
-}
-
-/**
- * Http请求参数
- */
-export type HttpParams<T extends Payload = object> = RequestParams<T['req'], HttpResponse<T['rsp']>>
-
-/**
- * Http请求参数
- */
-export type CommonParams<T extends Payload = object> = RequestParams<T['req'], T['rsp']>
-
 /**
- * Http响应结果
+ * Http 通用响应对象
  */
-export interface HttpResponse<T = unknown> {
+export interface CommonResult<T = unknown> {
     code: ResultCode;
     msg: string;
     total: number;
@@ -34,7 +9,7 @@ export interface HttpResponse<T = unknown> {
 }
 
 /**
- * Http响应结果状态码
+ * Http 响应结果状态码
  */
 export enum ResultCode {
     Success = 200, //成功

+ 15 - 19
src/stores/modules/account.ts

@@ -35,29 +35,25 @@ export const accountStore = createStore({
         getAccountList() {
             this.state.loading = true
             return queryTaAccounts({
-                data: {
-                    loginID: loginStore.getters.loginId
-                },
-                success: (res) => {
-                    const dataList = res.data
-                    if (dataList.length) {
-                        this.state.accountList = dataList
-                        // 查找当前选中的资金账户
-                        const account = dataList.find((e) => e.accountid === this.state.accountId)
-                        if (account) {
-                            this.state.loading = false
-                        } else {
-                            // 如果不存在,默认选中第一个账户
-                            this.state.accountId = dataList[0].accountid
-                        }
-                    } else {
+                loginID: loginStore.getters.loginId
+            }).then((res) => {
+                const dataList = res.data
+                if (dataList.length) {
+                    this.state.accountList = dataList
+                    // 查找当前选中的资金账户
+                    const account = dataList.find((e) => e.accountid === this.state.accountId)
+                    if (account) {
                         this.state.loading = false
-                        this.actions.reset()
+                    } else {
+                        // 如果不存在,默认选中第一个账户
+                        this.state.accountId = dataList[0].accountid
                     }
-                },
-                fail: () => {
+                } else {
                     this.state.loading = false
+                    this.actions.reset()
                 }
+            }).catch(() => {
+                this.state.loading = false
             })
         },
         // 重置数据

+ 5 - 8
src/stores/modules/enum.ts

@@ -39,14 +39,11 @@ export const enumStore = createStore({
                     resolve()
                 } else {
                     this.state.loading = true
-                    queryAllEnums({
-                        success: (res) => {
-                            this.state.allEnums = res.data
-                            resolve()
-                        },
-                        complete: () => {
-                            this.state.loading = false
-                        }
+                    queryAllEnums().then((res) => {
+                        this.state.allEnums = res.data
+                        resolve()
+                    }).finally(() => {
+                        this.state.loading = false
                     })
                 }
             })

+ 4 - 7
src/stores/modules/errorInfo.ts

@@ -19,13 +19,10 @@ export const errorInfoStore = createStore({
                 return Promise.resolve()
             }
             this.state.loading = true
-            return queryErrorInfos({
-                success: (res) => {
-                    this.state.errorInfos = res.data
-                },
-                complete: () => {
-                    this.state.loading = false
-                }
+            return queryErrorInfos().then((res) => {
+                this.state.errorInfos = res.data
+            }).finally(() => {
+                this.state.loading = false
             })
         },
         // 根据 code 获取错误信息

+ 20 - 25
src/stores/modules/futures.ts

@@ -73,37 +73,32 @@ export const futuresStore = createStore({
     },
     actions: {
         // 获取商品列表
-        getGoodsList() {
+        async getGoodsList() {
             this.state.loading = true
-            return queryErmcpGoods({
-                success: (res) => {
-                    const codes = res.data.map((e) => e.goodscode)
-                    this.state.goodsList = res.data
+            try {
+                const res = await queryErmcpGoods()
+                const codes = res.data.map((e) => e.goodscode)
+                this.state.goodsList = res.data
 
-                    // 获取商品盘面信息
-                    const getQuoteDay = () => {
-                        return queryQuoteDay({
-                            data: {
-                                goodsCodes: codes.join(',')
-                            },
-                            success: (res) => {
-                                this.state.quoteDayList = res.data
-                            },
-                            complete: () => {
-                                // 每5分钟获取一次盘面
-                                timerTask.setTimeout(() => getQuoteDay(), 5 * 60 * 1000, 'quoteDay')
-                            }
+                // 获取商品盘面信息
+                const getQuoteDay = async () => {
+                    try {
+                        const res_1 = await queryQuoteDay({
+                            goodsCodes: codes.join(',')
                         })
+                        this.state.quoteDayList = res_1.data
+                    } finally {
+                        // 每5分钟获取一次盘面
+                        timerTask.setTimeout(() => getQuoteDay(), 5 * 60 * 1000, 'quoteDay')
                     }
+                }
 
-                    if (codes.length) {
-                        getQuoteDay()
-                    }
-                },
-                complete: () => {
-                    this.state.loading = false
+                if (codes.length) {
+                    getQuoteDay()
                 }
-            })
+            } finally {
+                this.state.loading = false
+            }
         },
         // 通过 goodscode 获取盘面实时行情
         getQuoteDayInfoByCode(goodscode: string) {

+ 4 - 7
src/stores/modules/menu.ts

@@ -13,13 +13,10 @@ export const menuStore = createStore({
         /** 获取用户菜单列表 */
         getUserMenuList() {
             this.state.loading = true
-            return queryAccountMenu({
-                success: (res) => {
-                    this.state.userRoutes = res.data
-                },
-                complete: () => {
-                    this.state.loading = false
-                }
+            return queryAccountMenu().then((res) => {
+                this.state.userRoutes = res.data
+            }).finally(() => {
+                this.state.loading = false
             })
         },
         /** 重置数据 */

+ 5 - 9
src/stores/modules/user.ts

@@ -41,15 +41,11 @@ export const userStore = createStore({
         getUserData() {
             this.state.loading = true
             return queryLoginData({
-                data: {
-                    loginID: loginStore.getters.loginId
-                },
-                success: (res) => {
-                    this.state.userData = res.data
-                },
-                complete: () => {
-                    this.state.loading = false
-                }
+                loginID: loginStore.getters.loginId
+            }).then((res) => {
+                this.state.userData = res.data
+            }).finally(() => {
+                this.state.loading = false
             })
         },
         // 获取用户数据

+ 2 - 2
src/types/model/market.d.ts

@@ -13,8 +13,8 @@ declare namespace Model {
 
     /** 查询行情-现货列表 请求 */
     interface SpotgoodsPriceReq {
-        page: number; // 页码
-        pagesize: number; // 每页条数
+        page?: number; // 页码
+        pagesize?: number; // 每页条数
     }
 
     /** 查询行情-现货列表 响应 */