From 596d0775b3a2224e6ad85135a00a6f81e8d408d4 Mon Sep 17 00:00:00 2001 From: no99 <17663930442@163.com> Date: Tue, 19 Aug 2025 13:59:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E8=8E=B7=E5=8F=96=E5=85=91=E6=8D=A2?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/AIxiaocaishen.js | 15 +++++++++++++++ src/views/homePage.vue | 46 ++++++++++++++++++++++++++++------------------ 2 files changed, 43 insertions(+), 18 deletions(-) diff --git a/src/api/AIxiaocaishen.js b/src/api/AIxiaocaishen.js index 92327aa..c1650ac 100644 --- a/src/api/AIxiaocaishen.js +++ b/src/api/AIxiaocaishen.js @@ -303,3 +303,18 @@ export const clickRecordAPI = function (params) { data: params, }); }; + +// 8.18金币兑换Token start + +export const showExchangeAPI = function (params) { + return request({ + url: `http://192.168.1.22:8080/api/showExchange`, + method: "POST", + data: params, + headers: { + token: localStorage.getItem("localToken"), + }, + }); +}; + +// 8.18金币兑换Token end \ No newline at end of file diff --git a/src/views/homePage.vue b/src/views/homePage.vue index b4b7433..ac61f56 100644 --- a/src/views/homePage.vue +++ b/src/views/homePage.vue @@ -2,7 +2,7 @@ // 导入 import { ref, computed, onMounted, watch, nextTick, onUnmounted, h } from "vue"; import { setHeight } from "../utils/setHeight"; -import { getUserCountAPI } from "../api/AIxiaocaishen"; +import { getUserCountAPI, showExchangeAPI } from "../api/AIxiaocaishen"; import { ElMessage } from "element-plus"; import AIchat from "./AIchat.vue"; import AIfind from "./AIfind.vue"; @@ -348,17 +348,6 @@ const showFeedback = () => { } }; -// 点击剩余次数会弹出的弹窗 -// 新增一个 ref 来控制弹窗的显示与隐藏 -const dialogVisible = ref(false); -// 获取次数 -const showCount = () => { - console.log("显示剩余次数"); - // 显示弹窗 - dialogVisible.value = true; - console.log("dialogVisible 的值:", dialogVisible.value); // 添加日志确认 -}; - // 保证发送消息时,滚动屏在底部 const tabContentAIchat = ref(null); @@ -909,7 +898,10 @@ const userInfo = ref({ jwcode: "90042088", img: " https://d31zlh4on95l9h.cloudfront.net/images/403ef762dd2f335df3b0c9e3fe488375.png", }); -const changeRule = ref("1金币=1Token"); +const changeRule = ref({ + gold:1, + token:1, +}); const changeLevelList = ref([ { position: 10, calculatedPosition: 10 }, { position: 20, calculatedPosition: 20 }, @@ -922,12 +914,30 @@ const changeLevelList = ref([ const activeLevel = ref( changeLevelList.value[0] || { position: 10, calculatedPosition: 10 } ); -const gold = ref(100); - +const gold = ref(90); +// 点击剩余次数会弹出的弹窗 +// 新增一个 ref 来控制弹窗的显示与隐藏 +const dialogVisible = ref(false); const rechargeDialogVisible = ref(false); const confirmDialogVisible = ref(false); const changeSuccessDialogVisible = ref(false); +// 获取次数 +const showCount = async () => { + try { + const res = await showExchangeAPI(); + changeLevelList.value = res.data; + activeLevel.value = changeLevelList.value[0]; + changeRule.value.token=res.data[0].ratio; + + // 显示弹窗 + dialogVisible.value = true; + console.log("dialogVisible 的值:", dialogVisible.value); // 添加日志确认 + } catch (e) { + console.error("获取兑换列表出错", e); + } +}; + const chooseLevel = (item) => { activeLevel.value = item; }; @@ -1317,7 +1327,8 @@ onUnmounted(() => {