From ce5d3130e9cdc1f22e05e00a492dad24e702a33b Mon Sep 17 00:00:00 2001 From: zhangrenyuan <18990852002@163.com> Date: Mon, 25 Aug 2025 11:43:11 +0800 Subject: [PATCH 1/2] feat currency --- .env.development | 4 +- src/views/recharge/gold/addCoinRecharge.vue | 71 ++++++++++------------------- 2 files changed, 27 insertions(+), 48 deletions(-) diff --git a/.env.development b/.env.development index cc1bf16..ce634d9 100644 --- a/.env.development +++ b/.env.development @@ -1,4 +1,4 @@ - VITE_API_BASE='https://hwjb.homilychart.com/dev/admin' + # VITE_API_BASE='https://hwjb.homilychart.com/dev/admin' # 测试环境 # VITE_API_BASE='http://54.255.212.181:10704/' # 正式环境 @@ -13,4 +13,4 @@ VITE_UPLOAD_URL=http://39.101.133.168:8828/hljw/api/aws/upload # 本地 #VITE_API_BASE='http://localhost:8081/' # sunjiabei -# VITE_API_BASE='http://192.168.0.115:8081/' \ No newline at end of file +VITE_API_BASE='http://192.168.0.34:8081/' \ No newline at end of file diff --git a/src/views/recharge/gold/addCoinRecharge.vue b/src/views/recharge/gold/addCoinRecharge.vue index c1632c2..4dc7cf0 100644 --- a/src/views/recharge/gold/addCoinRecharge.vue +++ b/src/views/recharge/gold/addCoinRecharge.vue @@ -475,53 +475,31 @@ const activity = ref([]) //货币条目 -const rateName = [ - { - value: 'USD', - label: 'USD', - rateId: 1 - }, - { - value: 'HKD', - label: 'HKD', - rateId: 2 - }, - { - value: 'THB', - label: 'THB', - rateId: 3 - }, - { - value: 'VND', - label: 'VND', - rateId: 4 - }, - { - value: 'CAD', - label: 'CAD', - rateId: 5 - }, - { - value: 'MYR', - label: 'MYR', - rateId: 6 - }, - { - value: 'KRW', - label: 'KRW', - rateId: 7 - }, - { - value: 'JPY', - label: 'JPY', - rateId: 8 - }, - { - value: 'CNY', - label: 'CNY', - rateId: 9 +const rateName = ref([]) + +const fetchRateData = async () => { + try { + const result = await API({ + url: '/general/getRate', + data: {} + }); + console.log('response', result); + if (result.code === 200) { + rateName.value = result.data.map(item => { + // 从字符串中提取货币代码,如 '美元(USD)' 提取 'USD' + const match = item.match(/\(([^)]+)\)/); + const currencyCode = match ? match[1] : item; + return { + value: item, + label: currencyCode, + }; + }); + } + console.log('货币信息', rateName.value); + } catch (error) { + console.error('获取货币信息失败:', error); } -] +}; // 修改上传处理 const customUpload = async (options) => { @@ -648,6 +626,7 @@ const deleteRecharge = function () { onMounted(async function () { await getAdminData() + await fetchRateData() // await getCurrency() // await getActivity()// 现在的活动就是文字输入框,不需要请求接口,具体等后续需求 From e744965c99517e5ae0a4fdf10df3b74ce8c503b4 Mon Sep 17 00:00:00 2001 From: zhangrenyuan <18990852002@163.com> Date: Mon, 25 Aug 2025 13:19:14 +0800 Subject: [PATCH 2/2] fix currency --- src/views/recharge/gold/addCoinRecharge.vue | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/views/recharge/gold/addCoinRecharge.vue b/src/views/recharge/gold/addCoinRecharge.vue index 4dc7cf0..7d8835c 100644 --- a/src/views/recharge/gold/addCoinRecharge.vue +++ b/src/views/recharge/gold/addCoinRecharge.vue @@ -485,15 +485,10 @@ const fetchRateData = async () => { }); console.log('response', result); if (result.code === 200) { - rateName.value = result.data.map(item => { - // 从字符串中提取货币代码,如 '美元(USD)' 提取 'USD' - const match = item.match(/\(([^)]+)\)/); - const currencyCode = match ? match[1] : item; - return { - value: item, - label: currencyCode, - }; - }); + rateName.value = result.data.map(item => ({ + value: item, + label: item + })); } console.log('货币信息', rateName.value); } catch (error) {